primevul_valid_grouped_depth_3-5.json 4.0 MB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425942694279428942994309431943294339434943594369437943894399440944194429443944494459446944794489449945094519452945394549455945694579458945994609461946294639464946594669467946894699470947194729473947494759476947794789479948094819482948394849485948694879488948994909491949294939494949594969497949894999500950195029503950495059506950795089509951095119512951395149515951695179518951995209521952295239524952595269527952895299530953195329533953495359536953795389539954095419542954395449545954695479548954995509551955295539554955595569557955895599560956195629563956495659566956795689569957095719572957395749575957695779578957995809581958295839584958595869587958895899590959195929593959495959596959795989599960096019602960396049605960696079608960996109611961296139614961596169617961896199620962196229623962496259626962796289629963096319632963396349635963696379638963996409641964296439644964596469647964896499650965196529653965496559656965796589659966096619662966396649665966696679668966996709671967296739674967596769677967896799680968196829683968496859686968796889689969096919692969396949695969696979698969997009701970297039704970597069707970897099710971197129713971497159716971797189719972097219722972397249725972697279728972997309731973297339734973597369737973897399740974197429743974497459746974797489749975097519752975397549755975697579758975997609761976297639764976597669767976897699770977197729773977497759776977797789779978097819782978397849785978697879788978997909791979297939794979597969797979897999800980198029803980498059806980798089809981098119812981398149815981698179818981998209821982298239824982598269827982898299830983198329833983498359836983798389839984098419842984398449845984698479848984998509851985298539854985598569857985898599860986198629863986498659866986798689869987098719872987398749875987698779878987998809881988298839884988598869887988898899890989198929893989498959896989798989899990099019902990399049905990699079908990999109911991299139914991599169917991899199920992199229923992499259926992799289929993099319932993399349935993699379938993999409941994299439944994599469947994899499950995199529953995499559956995799589959996099619962996399649965996699679968996999709971997299739974997599769977997899799980998199829983998499859986998799889989999099919992999399949995999699979998999910000100011000210003100041000510006100071000810009100101001110012100131001410015100161001710018100191002010021100221002310024100251002610027100281002910030100311003210033100341003510036100371003810039100401004110042100431004410045100461004710048100491005010051100521005310054100551005610057100581005910060100611006210063100641006510066100671006810069100701007110072100731007410075100761007710078100791008010081100821008310084100851008610087100881008910090100911009210093100941009510096100971009810099101001010110102101031010410105101061010710108101091011010111101121011310114101151011610117101181011910120101211012210123101241012510126101271012810129101301013110132101331013410135101361013710138101391014010141101421014310144101451014610147101481014910150101511015210153101541015510156101571015810159101601016110162101631016410165101661016710168101691017010171101721017310174101751017610177101781017910180101811018210183101841018510186101871018810189101901019110192101931019410195101961019710198101991020010201102021020310204102051020610207102081020910210102111021210213102141021510216102171021810219102201022110222102231022410225102261022710228102291023010231102321023310234102351023610237102381023910240102411024210243102441024510246102471024810249102501025110252102531025410255102561025710258102591026010261102621026310264102651026610267102681026910270102711027210273102741027510276102771027810279102801028110282102831028410285102861028710288102891029010291102921029310294102951029610297102981029910300103011030210303103041030510306103071030810309103101031110312103131031410315103161031710318103191032010321103221032310324103251032610327103281032910330103311033210333103341033510336103371033810339103401034110342103431034410345103461034710348103491035010351103521035310354103551035610357103581035910360103611036210363103641036510366103671036810369103701037110372103731037410375103761037710378103791038010381103821038310384103851038610387103881038910390103911039210393103941039510396103971039810399104001040110402104031040410405104061040710408104091041010411104121041310414104151041610417104181041910420104211042210423104241042510426104271042810429104301043110432104331043410435104361043710438104391044010441104421044310444104451044610447104481044910450104511045210453104541045510456104571045810459104601046110462104631046410465104661046710468104691047010471104721047310474104751047610477104781047910480104811048210483104841048510486104871048810489104901049110492104931049410495104961049710498104991050010501105021050310504105051050610507105081050910510105111051210513105141051510516105171051810519105201052110522105231052410525105261052710528105291053010531105321053310534105351053610537105381053910540105411054210543105441054510546105471054810549105501055110552105531055410555105561055710558105591056010561105621056310564105651056610567105681056910570105711057210573105741057510576105771057810579105801058110582105831058410585105861058710588105891059010591105921059310594105951059610597105981059910600106011060210603106041060510606106071060810609106101061110612106131061410615106161061710618106191062010621106221062310624106251062610627106281062910630106311063210633106341063510636106371063810639106401064110642106431064410645106461064710648106491065010651106521065310654106551065610657106581065910660106611066210663106641066510666106671066810669106701067110672106731067410675106761067710678106791068010681106821068310684106851068610687106881068910690106911069210693106941069510696106971069810699107001070110702107031070410705107061070710708107091071010711107121071310714107151071610717107181071910720107211072210723107241072510726107271072810729107301073110732107331073410735107361073710738107391074010741107421074310744107451074610747107481074910750107511075210753107541075510756107571075810759107601076110762107631076410765107661076710768107691077010771107721077310774107751077610777107781077910780107811078210783107841078510786107871078810789107901079110792107931079410795107961079710798107991080010801108021080310804108051080610807108081080910810108111081210813108141081510816108171081810819108201082110822108231082410825108261082710828108291083010831108321083310834108351083610837108381083910840108411084210843108441084510846108471084810849108501085110852108531085410855108561085710858108591086010861108621086310864108651086610867108681086910870108711087210873108741087510876108771087810879108801088110882108831088410885108861088710888108891089010891108921089310894108951089610897108981089910900109011090210903109041090510906109071090810909109101091110912109131091410915109161091710918109191092010921109221092310924109251092610927109281092910930109311093210933109341093510936109371093810939109401094110942109431094410945109461094710948109491095010951109521095310954109551095610957109581095910960109611096210963109641096510966109671096810969109701097110972109731097410975109761097710978109791098010981109821098310984109851098610987109881098910990109911099210993109941099510996109971099810999110001100111002110031100411005110061100711008110091101011011110121101311014110151101611017110181101911020110211102211023110241102511026110271102811029110301103111032110331103411035110361103711038110391104011041110421104311044110451104611047110481104911050110511105211053110541105511056110571105811059110601106111062110631106411065110661106711068110691107011071110721107311074110751107611077110781107911080110811108211083110841108511086110871108811089110901109111092110931109411095110961109711098110991110011101111021110311104111051110611107111081110911110111111111211113111141111511116111171111811119111201112111122111231112411125111261112711128111291113011131111321113311134111351113611137111381113911140111411114211143111441114511146111471114811149111501115111152111531115411155111561115711158111591116011161111621116311164111651116611167111681116911170111711117211173111741117511176111771117811179111801118111182111831118411185111861118711188111891119011191111921119311194111951119611197111981119911200112011120211203112041120511206112071120811209112101121111212112131121411215112161121711218112191122011221112221122311224112251122611227112281122911230112311123211233112341123511236112371123811239112401124111242112431124411245112461124711248112491125011251112521125311254112551125611257112581125911260112611126211263112641126511266112671126811269112701127111272112731127411275112761127711278112791128011281112821128311284112851128611287112881128911290112911129211293112941129511296112971129811299113001130111302113031130411305113061130711308113091131011311113121131311314113151131611317113181131911320113211132211323113241132511326113271132811329113301133111332113331133411335113361133711338113391134011341113421134311344113451134611347113481134911350113511135211353113541135511356113571135811359113601136111362113631136411365113661136711368113691137011371113721137311374113751137611377113781137911380113811138211383113841138511386113871138811389113901139111392113931139411395113961139711398113991140011401114021140311404114051140611407114081140911410114111141211413114141141511416114171141811419114201142111422114231142411425114261142711428114291143011431114321143311434114351143611437114381143911440114411144211443114441144511446114471144811449114501145111452114531145411455114561145711458114591146011461114621146311464114651146611467114681146911470114711147211473114741147511476114771147811479114801148111482114831148411485114861148711488114891149011491114921149311494114951149611497114981149911500115011150211503115041150511506115071150811509115101151111512115131151411515115161151711518115191152011521115221152311524115251152611527115281152911530115311153211533115341153511536115371153811539115401154111542115431154411545115461154711548115491155011551115521155311554115551155611557115581155911560115611156211563115641156511566115671156811569115701157111572115731157411575115761157711578115791158011581115821158311584115851158611587115881158911590115911159211593115941159511596115971159811599116001160111602116031160411605116061160711608116091161011611116121161311614116151161611617116181161911620116211162211623116241162511626116271162811629116301163111632116331163411635116361163711638116391164011641116421164311644116451164611647116481164911650116511165211653116541165511656116571165811659116601166111662116631166411665116661166711668116691167011671116721167311674116751167611677116781167911680116811168211683116841168511686116871168811689116901169111692116931169411695116961169711698116991170011701117021170311704117051170611707117081170911710117111171211713117141171511716117171171811719117201172111722117231172411725117261172711728117291173011731117321173311734117351173611737117381173911740117411174211743117441174511746117471174811749117501175111752117531175411755117561175711758117591176011761117621176311764117651176611767117681176911770117711177211773117741177511776117771177811779117801178111782117831178411785117861178711788117891179011791117921179311794117951179611797117981179911800118011180211803118041180511806118071180811809118101181111812118131181411815118161181711818118191182011821118221182311824118251182611827118281182911830118311183211833118341183511836118371183811839118401184111842118431184411845118461184711848118491185011851118521185311854118551185611857118581185911860118611186211863118641186511866118671186811869118701187111872118731187411875118761187711878118791188011881118821188311884118851188611887118881188911890118911189211893118941189511896118971189811899119001190111902119031190411905119061190711908119091191011911119121191311914119151191611917119181191911920119211192211923119241192511926119271192811929119301193111932119331193411935119361193711938119391194011941119421194311944119451194611947119481194911950119511195211953119541195511956119571195811959119601196111962119631196411965119661196711968119691197011971119721197311974119751197611977119781197911980119811198211983119841198511986119871198811989119901199111992119931199411995119961199711998119991200012001120021200312004120051200612007120081200912010120111201212013120141201512016120171201812019120201202112022120231202412025120261202712028120291203012031120321203312034120351203612037120381203912040120411204212043120441204512046120471204812049120501205112052120531205412055120561205712058120591206012061120621206312064120651206612067120681206912070120711207212073120741207512076120771207812079120801208112082120831208412085120861208712088120891209012091120921209312094120951209612097120981209912100121011210212103121041210512106121071210812109121101211112112121131211412115121161211712118121191212012121121221212312124121251212612127121281212912130121311213212133121341213512136121371213812139121401214112142121431214412145121461214712148121491215012151121521215312154121551215612157121581215912160121611216212163121641216512166121671216812169121701217112172121731217412175121761217712178121791218012181121821218312184121851218612187121881218912190121911219212193121941219512196121971219812199122001220112202122031220412205122061220712208122091221012211122121221312214122151221612217122181221912220122211222212223122241222512226122271222812229122301223112232122331223412235122361223712238122391224012241122421224312244122451224612247122481224912250122511225212253122541225512256122571225812259122601226112262122631226412265122661226712268122691227012271122721227312274122751227612277122781227912280122811228212283122841228512286122871228812289122901229112292122931229412295122961229712298122991230012301123021230312304123051230612307123081230912310123111231212313123141231512316123171231812319123201232112322123231232412325123261232712328123291233012331123321233312334123351233612337123381233912340123411234212343123441234512346123471234812349123501235112352123531235412355123561235712358123591236012361123621236312364123651236612367123681236912370123711237212373123741237512376123771237812379123801238112382123831238412385123861238712388123891239012391123921239312394123951239612397123981239912400124011240212403124041240512406124071240812409124101241112412124131241412415124161241712418124191242012421124221242312424124251242612427124281242912430124311243212433124341243512436124371243812439124401244112442124431244412445124461244712448124491245012451124521245312454124551245612457124581245912460124611246212463124641246512466124671246812469124701247112472124731247412475124761247712478124791248012481124821248312484124851248612487124881248912490124911249212493124941249512496124971249812499125001250112502125031250412505125061250712508125091251012511125121251312514125151251612517125181251912520125211252212523125241252512526125271252812529125301253112532125331253412535125361253712538125391254012541125421254312544125451254612547125481254912550125511255212553125541255512556125571255812559125601256112562125631256412565125661256712568125691257012571125721257312574125751257612577125781257912580125811258212583125841258512586125871258812589125901259112592125931259412595125961259712598125991260012601126021260312604126051260612607126081260912610126111261212613126141261512616126171261812619126201262112622126231262412625126261262712628126291263012631126321263312634126351263612637126381263912640126411264212643126441264512646126471264812649126501265112652126531265412655126561265712658126591266012661126621266312664126651266612667126681266912670126711267212673126741267512676126771267812679126801268112682126831268412685126861268712688126891269012691126921269312694126951269612697126981269912700127011270212703127041270512706127071270812709127101271112712127131271412715127161271712718127191272012721127221272312724127251272612727127281272912730127311273212733127341273512736127371273812739127401274112742127431274412745127461274712748127491275012751127521275312754127551275612757127581275912760127611276212763127641276512766127671276812769127701277112772127731277412775127761277712778127791278012781127821278312784127851278612787127881278912790127911279212793127941279512796127971279812799128001280112802128031280412805128061280712808128091281012811128121281312814128151281612817128181281912820128211282212823128241282512826128271282812829128301283112832128331283412835128361283712838128391284012841128421284312844128451284612847128481284912850128511285212853128541285512856128571285812859128601286112862128631286412865128661286712868128691287012871128721287312874128751287612877128781287912880128811288212883128841288512886128871288812889128901289112892128931289412895128961289712898128991290012901129021290312904129051290612907129081290912910129111291212913129141291512916129171291812919129201292112922129231292412925129261292712928129291293012931129321293312934129351293612937129381293912940129411294212943129441294512946129471294812949129501295112952129531295412955129561295712958129591296012961129621296312964129651296612967129681296912970129711297212973129741297512976129771297812979129801298112982129831298412985129861298712988129891299012991129921299312994129951299612997129981299913000130011300213003130041300513006130071300813009130101301113012130131301413015130161301713018130191302013021130221302313024130251302613027130281302913030130311303213033130341303513036130371303813039130401304113042130431304413045130461304713048130491305013051130521305313054130551305613057130581305913060130611306213063130641306513066130671306813069130701307113072130731307413075130761307713078130791308013081130821308313084130851308613087130881308913090130911309213093130941309513096130971309813099131001310113102131031310413105131061310713108131091311013111131121311313114131151311613117131181311913120131211312213123131241312513126131271312813129131301313113132131331313413135131361313713138131391314013141131421314313144131451314613147131481314913150131511315213153131541315513156131571315813159131601316113162131631316413165131661316713168131691317013171131721317313174131751317613177131781317913180131811318213183131841318513186131871318813189131901319113192131931319413195131961319713198131991320013201132021320313204132051320613207132081320913210132111321213213132141321513216132171321813219132201322113222132231322413225132261322713228132291323013231132321323313234132351323613237132381323913240132411324213243132441324513246132471324813249132501325113252132531325413255132561325713258132591326013261132621326313264132651326613267132681326913270132711327213273132741327513276132771327813279132801328113282132831328413285132861328713288132891329013291132921329313294132951329613297132981329913300133011330213303133041330513306133071330813309133101331113312133131331413315133161331713318133191332013321133221332313324133251332613327133281332913330133311333213333133341333513336133371333813339133401334113342133431334413345133461334713348133491335013351133521335313354133551335613357133581335913360133611336213363133641336513366133671336813369133701337113372133731337413375133761337713378133791338013381133821338313384133851338613387133881338913390133911339213393133941339513396133971339813399134001340113402134031340413405134061340713408134091341013411134121341313414134151341613417134181341913420134211342213423134241342513426134271342813429134301343113432134331343413435134361343713438134391344013441134421344313444134451344613447134481344913450134511345213453134541345513456134571345813459134601346113462134631346413465134661346713468134691347013471134721347313474134751347613477134781347913480134811348213483134841348513486134871348813489134901349113492134931349413495134961349713498134991350013501135021350313504135051350613507135081350913510135111351213513135141351513516135171351813519135201352113522135231352413525135261352713528135291353013531135321353313534135351353613537135381353913540135411354213543135441354513546135471354813549135501355113552135531355413555135561355713558135591356013561135621356313564135651356613567135681356913570135711357213573135741357513576135771357813579135801358113582135831358413585135861358713588135891359013591135921359313594135951359613597135981359913600136011360213603136041360513606136071360813609136101361113612136131361413615136161361713618136191362013621136221362313624136251362613627136281362913630136311363213633136341363513636136371363813639136401364113642136431364413645136461364713648136491365013651136521365313654136551365613657136581365913660136611366213663136641366513666136671366813669136701367113672136731367413675136761367713678136791368013681136821368313684136851368613687136881368913690136911369213693136941369513696136971369813699137001370113702137031370413705137061370713708137091371013711137121371313714137151371613717137181371913720137211372213723137241372513726137271372813729137301373113732137331373413735137361373713738137391374013741137421374313744137451374613747137481374913750137511375213753137541375513756137571375813759137601376113762137631376413765137661376713768137691377013771137721377313774137751377613777137781377913780137811378213783137841378513786137871378813789137901379113792137931379413795137961379713798137991380013801138021380313804138051380613807138081380913810138111381213813138141381513816138171381813819138201382113822138231382413825138261382713828138291383013831138321383313834138351383613837138381383913840138411384213843138441384513846138471384813849138501385113852138531385413855138561385713858138591386013861138621386313864138651386613867138681386913870138711387213873138741387513876138771387813879138801388113882138831388413885138861388713888138891389013891138921389313894138951389613897138981389913900139011390213903139041390513906139071390813909139101391113912139131391413915139161391713918139191392013921139221392313924139251392613927139281392913930139311393213933139341393513936139371393813939139401394113942139431394413945139461394713948139491395013951139521395313954139551395613957139581395913960139611396213963139641396513966139671396813969139701397113972139731397413975139761397713978139791398013981139821398313984139851398613987139881398913990139911399213993139941399513996139971399813999140001400114002140031400414005140061400714008140091401014011140121401314014140151401614017140181401914020140211402214023140241402514026140271402814029140301403114032140331403414035140361403714038140391404014041140421404314044140451404614047140481404914050140511405214053140541405514056140571405814059140601406114062140631406414065140661406714068140691407014071140721407314074140751407614077140781407914080140811408214083140841408514086140871408814089140901409114092140931409414095140961409714098140991410014101141021410314104141051410614107141081410914110141111411214113141141411514116141171411814119141201412114122141231412414125141261412714128141291413014131141321413314134141351413614137141381413914140141411414214143141441414514146141471414814149141501415114152141531415414155141561415714158141591416014161141621416314164141651416614167141681416914170141711417214173141741417514176141771417814179141801418114182141831418414185141861418714188141891419014191141921419314194141951419614197141981419914200142011420214203142041420514206142071420814209142101421114212142131421414215142161421714218142191422014221142221422314224142251422614227142281422914230142311423214233142341423514236142371423814239142401424114242142431424414245142461424714248142491425014251142521425314254142551425614257142581425914260142611426214263142641426514266142671426814269142701427114272142731427414275142761427714278142791428014281142821428314284142851428614287142881428914290142911429214293142941429514296142971429814299143001430114302143031430414305143061430714308143091431014311143121431314314143151431614317143181431914320143211432214323143241432514326143271432814329143301433114332143331433414335143361433714338143391434014341143421434314344143451434614347143481434914350143511435214353143541435514356143571435814359143601436114362143631436414365143661436714368143691437014371143721437314374143751437614377143781437914380143811438214383143841438514386143871438814389143901439114392143931439414395143961439714398143991440014401144021440314404144051440614407144081440914410144111441214413144141441514416144171441814419144201442114422144231442414425144261442714428144291443014431144321443314434144351443614437144381443914440144411444214443144441444514446144471444814449144501445114452144531445414455144561445714458144591446014461144621446314464144651446614467144681446914470144711447214473144741447514476144771447814479144801448114482144831448414485144861448714488144891449014491144921449314494144951449614497144981449914500145011450214503145041450514506145071450814509145101451114512145131451414515145161451714518145191452014521145221452314524145251452614527145281452914530145311453214533145341453514536145371453814539145401454114542145431454414545145461454714548145491455014551145521455314554145551455614557145581455914560145611456214563145641456514566145671456814569145701457114572145731457414575145761457714578145791458014581145821458314584145851458614587145881458914590145911459214593145941459514596145971459814599146001460114602146031460414605146061460714608146091461014611146121461314614146151461614617146181461914620146211462214623146241462514626146271462814629146301463114632146331463414635146361463714638146391464014641146421464314644146451464614647146481464914650146511465214653146541465514656146571465814659146601466114662146631466414665146661466714668146691467014671146721467314674146751467614677146781467914680146811468214683146841468514686146871468814689146901469114692146931469414695146961469714698146991470014701147021470314704147051470614707147081470914710147111471214713147141471514716147171471814719147201472114722147231472414725147261472714728147291473014731147321473314734147351473614737147381473914740147411474214743147441474514746147471474814749147501475114752147531475414755147561475714758147591476014761147621476314764147651476614767147681476914770147711477214773147741477514776147771477814779147801478114782147831478414785147861478714788147891479014791147921479314794147951479614797147981479914800148011480214803148041480514806148071480814809148101481114812148131481414815148161481714818148191482014821148221482314824148251482614827148281482914830148311483214833148341483514836148371483814839148401484114842148431484414845148461484714848148491485014851148521485314854148551485614857148581485914860148611486214863148641486514866148671486814869148701487114872148731487414875148761487714878148791488014881148821488314884148851488614887148881488914890148911489214893148941489514896148971489814899149001490114902149031490414905149061490714908149091491014911149121491314914149151491614917149181491914920149211492214923149241492514926149271492814929149301493114932149331493414935149361493714938149391494014941149421494314944149451494614947149481494914950149511495214953149541495514956149571495814959149601496114962149631496414965149661496714968149691497014971149721497314974149751497614977149781497914980149811498214983149841498514986149871498814989149901499114992149931499414995149961499714998149991500015001150021500315004150051500615007150081500915010150111501215013150141501515016150171501815019150201502115022150231502415025150261502715028150291503015031150321503315034150351503615037150381503915040150411504215043150441504515046150471504815049150501505115052150531505415055150561505715058150591506015061150621506315064150651506615067150681506915070150711507215073150741507515076150771507815079150801508115082150831508415085150861508715088150891509015091150921509315094150951509615097150981509915100151011510215103151041510515106151071510815109151101511115112151131511415115151161511715118151191512015121151221512315124151251512615127151281512915130151311513215133151341513515136151371513815139151401514115142151431514415145151461514715148151491515015151151521515315154151551515615157151581515915160151611516215163151641516515166151671516815169151701517115172151731517415175151761517715178151791518015181151821518315184151851518615187151881518915190151911519215193151941519515196151971519815199152001520115202152031520415205152061520715208152091521015211152121521315214152151521615217152181521915220152211522215223152241522515226152271522815229152301523115232152331523415235152361523715238152391524015241152421524315244152451524615247152481524915250152511525215253152541525515256152571525815259152601526115262152631526415265152661526715268152691527015271152721527315274152751527615277152781527915280152811528215283152841528515286152871528815289152901529115292152931529415295152961529715298152991530015301153021530315304153051530615307153081530915310153111531215313153141531515316153171531815319153201532115322153231532415325153261532715328153291533015331153321533315334153351533615337153381533915340153411534215343153441534515346153471534815349153501535115352153531535415355153561535715358153591536015361153621536315364153651536615367153681536915370153711537215373153741537515376153771537815379153801538115382153831538415385153861538715388153891539015391153921539315394153951539615397153981539915400154011540215403154041540515406154071540815409154101541115412154131541415415154161541715418154191542015421154221542315424154251542615427154281542915430154311543215433154341543515436154371543815439154401544115442154431544415445154461544715448154491545015451154521545315454154551545615457154581545915460154611546215463154641546515466154671546815469154701547115472154731547415475154761547715478154791548015481154821548315484154851548615487154881548915490154911549215493154941549515496154971549815499155001550115502155031550415505155061550715508155091551015511155121551315514155151551615517155181551915520155211552215523155241552515526155271552815529155301553115532155331553415535155361553715538155391554015541155421554315544155451554615547155481554915550155511555215553155541555515556155571555815559155601556115562155631556415565155661556715568155691557015571155721557315574155751557615577155781557915580155811558215583155841558515586155871558815589155901559115592155931559415595155961559715598155991560015601156021560315604156051560615607156081560915610156111561215613156141561515616156171561815619156201562115622156231562415625156261562715628156291563015631156321563315634156351563615637156381563915640156411564215643156441564515646156471564815649156501565115652156531565415655156561565715658156591566015661156621566315664156651566615667156681566915670156711567215673156741567515676156771567815679156801568115682156831568415685156861568715688156891569015691156921569315694156951569615697156981569915700157011570215703157041570515706157071570815709157101571115712157131571415715157161571715718157191572015721157221572315724157251572615727157281572915730157311573215733157341573515736157371573815739157401574115742157431574415745157461574715748157491575015751157521575315754157551575615757157581575915760157611576215763157641576515766157671576815769157701577115772157731577415775157761577715778157791578015781157821578315784157851578615787157881578915790157911579215793157941579515796157971579815799158001580115802158031580415805158061580715808158091581015811158121581315814158151581615817158181581915820158211582215823158241582515826158271582815829158301583115832158331583415835158361583715838158391584015841158421584315844158451584615847158481584915850158511585215853158541585515856158571585815859158601586115862158631586415865158661586715868158691587015871158721587315874158751587615877158781587915880158811588215883158841588515886158871588815889158901589115892158931589415895158961589715898158991590015901159021590315904159051590615907159081590915910159111591215913159141591515916159171591815919159201592115922159231592415925159261592715928159291593015931159321593315934159351593615937159381593915940159411594215943159441594515946159471594815949159501595115952159531595415955159561595715958159591596015961159621596315964159651596615967159681596915970159711597215973159741597515976159771597815979159801598115982159831598415985159861598715988159891599015991159921599315994159951599615997159981599916000160011600216003160041600516006160071600816009160101601116012160131601416015160161601716018160191602016021160221602316024160251602616027160281602916030160311603216033160341603516036160371603816039160401604116042160431604416045160461604716048160491605016051160521605316054160551605616057160581605916060160611606216063160641606516066160671606816069160701607116072160731607416075160761607716078160791608016081160821608316084160851608616087160881608916090160911609216093160941609516096160971609816099161001610116102161031610416105161061610716108161091611016111161121611316114161151611616117161181611916120161211612216123161241612516126161271612816129161301613116132161331613416135161361613716138161391614016141161421614316144161451614616147161481614916150161511615216153161541615516156161571615816159161601616116162161631616416165161661616716168161691617016171161721617316174161751617616177161781617916180161811618216183161841618516186161871618816189161901619116192161931619416195161961619716198161991620016201162021620316204162051620616207162081620916210162111621216213162141621516216162171621816219162201622116222162231622416225162261622716228162291623016231162321623316234162351623616237162381623916240162411624216243162441624516246162471624816249162501625116252162531625416255162561625716258162591626016261162621626316264162651626616267162681626916270162711627216273162741627516276162771627816279162801628116282162831628416285162861628716288162891629016291162921629316294162951629616297162981629916300163011630216303163041630516306163071630816309163101631116312163131631416315163161631716318163191632016321163221632316324163251632616327163281632916330163311633216333163341633516336163371633816339163401634116342163431634416345163461634716348163491635016351163521635316354163551635616357163581635916360163611636216363163641636516366163671636816369163701637116372163731637416375163761637716378163791638016381163821638316384163851638616387163881638916390163911639216393163941639516396163971639816399164001640116402164031640416405164061640716408164091641016411164121641316414164151641616417164181641916420164211642216423164241642516426164271642816429164301643116432164331643416435164361643716438164391644016441164421644316444164451644616447164481644916450164511645216453164541645516456164571645816459164601646116462164631646416465164661646716468164691647016471164721647316474164751647616477164781647916480164811648216483164841648516486164871648816489164901649116492164931649416495164961649716498164991650016501165021650316504165051650616507165081650916510165111651216513165141651516516165171651816519165201652116522165231652416525165261652716528165291653016531165321653316534165351653616537165381653916540165411654216543165441654516546165471654816549165501655116552165531655416555165561655716558165591656016561165621656316564165651656616567165681656916570165711657216573165741657516576165771657816579165801658116582165831658416585165861658716588165891659016591165921659316594165951659616597165981659916600166011660216603166041660516606166071660816609166101661116612166131661416615166161661716618166191662016621166221662316624166251662616627166281662916630166311663216633166341663516636166371663816639166401664116642166431664416645166461664716648166491665016651166521665316654166551665616657166581665916660166611666216663166641666516666166671666816669166701667116672166731667416675166761667716678166791668016681166821668316684166851668616687166881668916690166911669216693166941669516696166971669816699167001670116702167031670416705167061670716708167091671016711167121671316714167151671616717167181671916720167211672216723167241672516726167271672816729167301673116732167331673416735167361673716738167391674016741167421674316744167451674616747167481674916750167511675216753167541675516756167571675816759167601676116762167631676416765167661676716768167691677016771167721677316774167751677616777167781677916780167811678216783167841678516786167871678816789167901679116792167931679416795167961679716798167991680016801168021680316804168051680616807168081680916810168111681216813168141681516816168171681816819168201682116822168231682416825168261682716828168291683016831168321683316834168351683616837168381683916840168411684216843168441684516846168471684816849168501685116852168531685416855168561685716858168591686016861168621686316864168651686616867168681686916870168711687216873168741687516876168771687816879168801688116882168831688416885168861688716888168891689016891168921689316894168951689616897168981689916900169011690216903169041690516906169071690816909169101691116912169131691416915169161691716918169191692016921169221692316924169251692616927169281692916930169311693216933169341693516936169371693816939169401694116942169431694416945169461694716948169491695016951169521695316954169551695616957169581695916960169611696216963169641696516966169671696816969169701697116972169731697416975169761697716978169791698016981169821698316984169851698616987169881698916990169911699216993169941699516996169971699816999170001700117002170031700417005170061700717008170091701017011170121701317014170151701617017170181701917020170211702217023170241702517026170271702817029170301703117032170331703417035170361703717038170391704017041170421704317044170451704617047170481704917050170511705217053170541705517056170571705817059170601706117062170631706417065170661706717068170691707017071170721707317074170751707617077170781707917080170811708217083170841708517086170871708817089170901709117092170931709417095170961709717098170991710017101171021710317104171051710617107171081710917110171111711217113171141711517116171171711817119171201712117122171231712417125171261712717128171291713017131171321713317134171351713617137171381713917140171411714217143171441714517146171471714817149171501715117152171531715417155171561715717158171591716017161171621716317164171651716617167171681716917170171711717217173171741717517176171771717817179171801718117182171831718417185171861718717188171891719017191171921719317194171951719617197171981719917200172011720217203172041720517206172071720817209172101721117212172131721417215172161721717218172191722017221172221722317224172251722617227172281722917230172311723217233172341723517236172371723817239172401724117242172431724417245172461724717248172491725017251172521725317254172551725617257172581725917260172611726217263172641726517266172671726817269172701727117272172731727417275172761727717278172791728017281172821728317284172851728617287172881728917290172911729217293172941729517296172971729817299173001730117302173031730417305173061730717308173091731017311173121731317314173151731617317173181731917320173211732217323173241732517326173271732817329173301733117332173331733417335173361733717338173391734017341173421734317344173451734617347173481734917350173511735217353173541735517356173571735817359173601736117362173631736417365173661736717368173691737017371173721737317374173751737617377173781737917380173811738217383173841738517386173871738817389173901739117392173931739417395173961739717398173991740017401174021740317404174051740617407174081740917410174111741217413174141741517416174171741817419174201742117422174231742417425174261742717428174291743017431174321743317434174351743617437174381743917440174411744217443174441744517446174471744817449174501745117452174531745417455174561745717458174591746017461174621746317464174651746617467174681746917470174711747217473174741747517476174771747817479174801748117482174831748417485174861748717488174891749017491174921749317494174951749617497174981749917500175011750217503175041750517506175071750817509175101751117512175131751417515175161751717518175191752017521175221752317524175251752617527175281752917530175311753217533175341753517536175371753817539175401754117542175431754417545175461754717548175491755017551175521755317554175551755617557175581755917560175611756217563175641756517566175671756817569175701757117572175731757417575175761757717578175791758017581175821758317584175851758617587175881758917590175911759217593175941759517596175971759817599176001760117602176031760417605176061760717608176091761017611176121761317614176151761617617176181761917620176211762217623176241762517626176271762817629176301763117632176331763417635176361763717638176391764017641176421764317644176451764617647176481764917650176511765217653176541765517656176571765817659176601766117662176631766417665176661766717668176691767017671176721767317674176751767617677176781767917680176811768217683176841768517686176871768817689176901769117692176931769417695176961769717698176991770017701177021770317704177051770617707177081770917710177111771217713177141771517716177171771817719177201772117722177231772417725177261772717728177291773017731177321773317734177351773617737177381773917740177411774217743177441774517746177471774817749177501775117752177531775417755177561775717758177591776017761177621776317764177651776617767177681776917770177711777217773177741777517776177771777817779177801778117782177831778417785177861778717788177891779017791177921779317794177951779617797177981779917800178011780217803178041780517806178071780817809178101781117812178131781417815178161781717818178191782017821178221782317824178251782617827178281782917830178311783217833178341783517836178371783817839178401784117842178431784417845178461784717848178491785017851178521785317854178551785617857178581785917860178611786217863178641786517866178671786817869178701787117872178731787417875178761787717878178791788017881178821788317884178851788617887178881788917890178911789217893178941789517896178971789817899179001790117902179031790417905179061790717908179091791017911179121791317914179151791617917179181791917920179211792217923179241792517926179271792817929179301793117932179331793417935179361793717938179391794017941179421794317944179451794617947179481794917950179511795217953179541795517956179571795817959179601796117962179631796417965179661796717968179691797017971179721797317974179751797617977179781797917980179811798217983179841798517986179871798817989179901799117992179931799417995179961799717998179991800018001180021800318004180051800618007180081800918010180111801218013180141801518016180171801818019180201802118022180231802418025180261802718028180291803018031180321803318034180351803618037180381803918040180411804218043180441804518046180471804818049180501805118052180531805418055180561805718058180591806018061180621806318064180651806618067180681806918070180711807218073180741807518076180771807818079180801808118082180831808418085180861808718088180891809018091180921809318094180951809618097180981809918100181011810218103181041810518106181071810818109181101811118112181131811418115181161811718118181191812018121181221812318124181251812618127181281812918130181311813218133181341813518136181371813818139181401814118142181431814418145181461814718148181491815018151181521815318154181551815618157181581815918160181611816218163181641816518166181671816818169181701817118172181731817418175181761817718178181791818018181181821818318184181851818618187181881818918190181911819218193181941819518196181971819818199182001820118202182031820418205182061820718208182091821018211182121821318214182151821618217182181821918220182211822218223182241822518226182271822818229182301823118232182331823418235182361823718238182391824018241182421824318244182451824618247182481824918250182511825218253182541825518256182571825818259182601826118262182631826418265182661826718268182691827018271182721827318274182751827618277182781827918280182811828218283182841828518286182871828818289182901829118292182931829418295182961829718298182991830018301183021830318304183051830618307183081830918310183111831218313183141831518316183171831818319183201832118322183231832418325183261832718328183291833018331183321833318334183351833618337183381833918340183411834218343183441834518346183471834818349183501835118352183531835418355183561835718358183591836018361183621836318364183651836618367183681836918370183711837218373183741837518376183771837818379183801838118382183831838418385183861838718388183891839018391183921839318394183951839618397183981839918400184011840218403184041840518406184071840818409184101841118412184131841418415184161841718418184191842018421184221842318424184251842618427184281842918430184311843218433184341843518436184371843818439184401844118442184431844418445184461844718448184491845018451184521845318454184551845618457184581845918460184611846218463184641846518466184671846818469184701847118472184731847418475184761847718478184791848018481184821848318484184851848618487184881848918490184911849218493184941849518496184971849818499185001850118502185031850418505185061850718508185091851018511185121851318514185151851618517185181851918520185211852218523185241852518526185271852818529185301853118532185331853418535185361853718538185391854018541185421854318544185451854618547185481854918550185511855218553185541855518556185571855818559185601856118562185631856418565185661856718568185691857018571185721857318574185751857618577185781857918580185811858218583185841858518586185871858818589185901859118592185931859418595185961859718598185991860018601186021860318604186051860618607186081860918610186111861218613186141861518616186171861818619186201862118622186231862418625186261862718628186291863018631186321863318634186351863618637186381863918640186411864218643186441864518646186471864818649186501865118652186531865418655186561865718658186591866018661186621866318664186651866618667186681866918670186711867218673186741867518676186771867818679186801868118682186831868418685186861868718688186891869018691186921869318694186951869618697186981869918700187011870218703187041870518706187071870818709187101871118712187131871418715187161871718718187191872018721187221872318724187251872618727187281872918730187311873218733187341873518736187371873818739187401874118742187431874418745187461874718748187491875018751187521875318754187551875618757187581875918760187611876218763187641876518766187671876818769187701877118772187731877418775187761877718778187791878018781187821878318784187851878618787187881878918790187911879218793187941879518796187971879818799188001880118802188031880418805188061880718808188091881018811188121881318814188151881618817188181881918820188211882218823188241882518826188271882818829188301883118832188331883418835188361883718838188391884018841188421884318844188451884618847188481884918850188511885218853188541885518856188571885818859188601886118862188631886418865188661886718868188691887018871188721887318874188751887618877188781887918880188811888218883188841888518886188871888818889188901889118892188931889418895188961889718898188991890018901189021890318904189051890618907189081890918910189111891218913189141891518916189171891818919189201892118922189231892418925189261892718928189291893018931189321893318934189351893618937189381893918940189411894218943189441894518946189471894818949189501895118952189531895418955189561895718958189591896018961189621896318964189651896618967189681896918970189711897218973189741897518976189771897818979189801898118982189831898418985189861898718988189891899018991189921899318994189951899618997189981899919000190011900219003190041900519006190071900819009190101901119012190131901419015190161901719018190191902019021190221902319024190251902619027190281902919030190311903219033190341903519036190371903819039190401904119042190431904419045190461904719048190491905019051190521905319054190551905619057190581905919060190611906219063190641906519066190671906819069190701907119072190731907419075190761907719078190791908019081190821908319084190851908619087190881908919090190911909219093190941909519096190971909819099191001910119102191031910419105191061910719108191091911019111191121911319114191151911619117191181911919120191211912219123191241912519126191271912819129191301913119132191331913419135191361913719138191391914019141191421914319144191451914619147191481914919150191511915219153191541915519156191571915819159191601916119162191631916419165191661916719168191691917019171191721917319174191751917619177191781917919180191811918219183191841918519186191871918819189191901919119192191931919419195191961919719198191991920019201192021920319204192051920619207192081920919210192111921219213192141921519216192171921819219192201922119222192231922419225192261922719228192291923019231192321923319234192351923619237192381923919240192411924219243192441924519246192471924819249192501925119252192531925419255192561925719258192591926019261192621926319264192651926619267192681926919270192711927219273192741927519276192771927819279192801928119282192831928419285192861928719288192891929019291192921929319294192951929619297192981929919300193011930219303193041930519306193071930819309193101931119312193131931419315193161931719318193191932019321193221932319324193251932619327193281932919330193311933219333193341933519336193371933819339193401934119342193431934419345193461934719348193491935019351193521935319354193551935619357193581935919360193611936219363193641936519366193671936819369193701937119372193731937419375193761937719378193791938019381193821938319384193851938619387193881938919390193911939219393193941939519396193971939819399194001940119402194031940419405194061940719408194091941019411194121941319414194151941619417194181941919420194211942219423194241942519426194271942819429194301943119432194331943419435194361943719438194391944019441194421944319444194451944619447194481944919450194511945219453194541945519456194571945819459194601946119462194631946419465194661946719468194691947019471194721947319474194751947619477194781947919480194811948219483194841948519486194871948819489194901949119492194931949419495194961949719498194991950019501195021950319504195051950619507195081950919510195111951219513195141951519516195171951819519195201952119522195231952419525195261952719528195291953019531195321953319534195351953619537195381953919540195411954219543195441954519546195471954819549195501955119552195531955419555195561955719558195591956019561195621956319564195651956619567195681956919570195711957219573195741957519576195771957819579195801958119582195831958419585195861958719588195891959019591195921959319594195951959619597195981959919600196011960219603196041960519606196071960819609196101961119612196131961419615196161961719618196191962019621196221962319624196251962619627196281962919630196311963219633196341963519636196371963819639196401964119642196431964419645196461964719648196491965019651196521965319654196551965619657196581965919660196611966219663196641966519666196671966819669196701967119672196731967419675196761967719678196791968019681196821968319684196851968619687196881968919690196911969219693196941969519696196971969819699197001970119702197031970419705197061970719708197091971019711197121971319714197151971619717197181971919720197211972219723197241972519726197271972819729197301973119732197331973419735197361973719738197391974019741197421974319744197451974619747197481974919750197511975219753197541975519756197571975819759197601976119762197631976419765197661976719768197691977019771197721977319774197751977619777197781977919780197811978219783197841978519786197871978819789197901979119792197931979419795197961979719798197991980019801198021980319804198051980619807198081980919810198111981219813198141981519816198171981819819198201982119822198231982419825198261982719828198291983019831198321983319834198351983619837198381983919840198411984219843198441984519846198471984819849198501985119852198531985419855198561985719858198591986019861198621986319864198651986619867198681986919870198711987219873198741987519876198771987819879198801988119882198831988419885198861988719888198891989019891198921989319894198951989619897198981989919900199011990219903199041990519906199071990819909199101991119912199131991419915199161991719918199191992019921199221992319924199251992619927199281992919930199311993219933199341993519936199371993819939199401994119942199431994419945199461994719948199491995019951199521995319954199551995619957199581995919960199611996219963199641996519966199671996819969199701997119972199731997419975199761997719978199791998019981199821998319984199851998619987199881998919990199911999219993199941999519996199971999819999200002000120002200032000420005200062000720008200092001020011200122001320014200152001620017200182001920020200212002220023200242002520026200272002820029200302003120032200332003420035200362003720038200392004020041200422004320044200452004620047200482004920050200512005220053200542005520056200572005820059200602006120062200632006420065200662006720068200692007020071200722007320074200752007620077200782007920080200812008220083200842008520086200872008820089200902009120092200932009420095200962009720098200992010020101201022010320104201052010620107201082010920110201112011220113201142011520116201172011820119201202012120122201232012420125201262012720128201292013020131201322013320134201352013620137201382013920140201412014220143201442014520146201472014820149201502015120152201532015420155201562015720158201592016020161201622016320164201652016620167201682016920170201712017220173201742017520176201772017820179201802018120182201832018420185201862018720188201892019020191201922019320194201952019620197201982019920200202012020220203202042020520206202072020820209202102021120212202132021420215202162021720218202192022020221202222022320224202252022620227202282022920230202312023220233202342023520236202372023820239202402024120242202432024420245202462024720248202492025020251202522025320254202552025620257202582025920260202612026220263202642026520266202672026820269202702027120272202732027420275202762027720278202792028020281202822028320284202852028620287202882028920290202912029220293202942029520296202972029820299203002030120302203032030420305203062030720308203092031020311203122031320314203152031620317203182031920320203212032220323203242032520326203272032820329203302033120332203332033420335203362033720338203392034020341203422034320344203452034620347203482034920350203512035220353203542035520356203572035820359203602036120362203632036420365203662036720368203692037020371203722037320374203752037620377203782037920380203812038220383203842038520386203872038820389203902039120392203932039420395203962039720398203992040020401204022040320404204052040620407204082040920410204112041220413204142041520416204172041820419204202042120422204232042420425204262042720428204292043020431204322043320434204352043620437204382043920440204412044220443204442044520446204472044820449204502045120452204532045420455204562045720458204592046020461204622046320464204652046620467204682046920470204712047220473204742047520476204772047820479204802048120482204832048420485204862048720488204892049020491204922049320494204952049620497204982049920500205012050220503205042050520506205072050820509205102051120512205132051420515205162051720518205192052020521205222052320524205252052620527205282052920530205312053220533205342053520536205372053820539205402054120542205432054420545205462054720548205492055020551205522055320554205552055620557205582055920560205612056220563205642056520566205672056820569205702057120572205732057420575205762057720578205792058020581205822058320584205852058620587205882058920590205912059220593205942059520596205972059820599206002060120602206032060420605206062060720608206092061020611206122061320614206152061620617206182061920620206212062220623206242062520626206272062820629206302063120632206332063420635206362063720638206392064020641206422064320644206452064620647206482064920650206512065220653206542065520656206572065820659206602066120662206632066420665206662066720668206692067020671206722067320674206752067620677206782067920680206812068220683206842068520686206872068820689206902069120692206932069420695206962069720698206992070020701207022070320704207052070620707207082070920710207112071220713207142071520716207172071820719207202072120722207232072420725207262072720728207292073020731207322073320734207352073620737207382073920740207412074220743207442074520746207472074820749207502075120752207532075420755207562075720758207592076020761207622076320764207652076620767207682076920770207712077220773207742077520776207772077820779207802078120782207832078420785207862078720788207892079020791207922079320794207952079620797207982079920800208012080220803208042080520806208072080820809208102081120812208132081420815208162081720818208192082020821208222082320824208252082620827208282082920830208312083220833208342083520836208372083820839208402084120842208432084420845208462084720848208492085020851208522085320854208552085620857208582085920860208612086220863208642086520866208672086820869208702087120872208732087420875208762087720878208792088020881208822088320884208852088620887208882088920890208912089220893208942089520896208972089820899209002090120902209032090420905209062090720908209092091020911209122091320914209152091620917209182091920920209212092220923209242092520926209272092820929209302093120932209332093420935209362093720938209392094020941209422094320944209452094620947209482094920950209512095220953209542095520956209572095820959209602096120962209632096420965209662096720968209692097020971209722097320974209752097620977209782097920980209812098220983209842098520986209872098820989209902099120992209932099420995209962099720998209992100021001210022100321004210052100621007210082100921010210112101221013210142101521016210172101821019210202102121022210232102421025210262102721028210292103021031210322103321034210352103621037210382103921040210412104221043210442104521046210472104821049210502105121052210532105421055210562105721058210592106021061210622106321064210652106621067210682106921070210712107221073210742107521076210772107821079210802108121082210832108421085210862108721088210892109021091210922109321094210952109621097210982109921100211012110221103211042110521106211072110821109211102111121112211132111421115211162111721118211192112021121211222112321124211252112621127211282112921130211312113221133211342113521136211372113821139211402114121142211432114421145211462114721148211492115021151211522115321154211552115621157211582115921160211612116221163211642116521166211672116821169211702117121172211732117421175211762117721178211792118021181211822118321184211852118621187211882118921190211912119221193211942119521196211972119821199212002120121202212032120421205212062120721208212092121021211212122121321214212152121621217212182121921220212212122221223212242122521226212272122821229212302123121232212332123421235212362123721238212392124021241212422124321244212452124621247212482124921250212512125221253212542125521256212572125821259212602126121262212632126421265212662126721268212692127021271212722127321274212752127621277212782127921280212812128221283212842128521286212872128821289212902129121292212932129421295212962129721298212992130021301213022130321304213052130621307213082130921310213112131221313213142131521316213172131821319213202132121322213232132421325213262132721328213292133021331213322133321334213352133621337213382133921340213412134221343213442134521346213472134821349213502135121352213532135421355213562135721358213592136021361213622136321364213652136621367213682136921370213712137221373213742137521376213772137821379213802138121382213832138421385213862138721388213892139021391213922139321394213952139621397213982139921400214012140221403214042140521406214072140821409214102141121412214132141421415214162141721418214192142021421214222142321424214252142621427214282142921430214312143221433214342143521436214372143821439214402144121442214432144421445214462144721448214492145021451214522145321454214552145621457214582145921460214612146221463214642146521466214672146821469214702147121472214732147421475214762147721478214792148021481214822148321484214852148621487214882148921490214912149221493214942149521496214972149821499215002150121502215032150421505215062150721508215092151021511215122151321514215152151621517215182151921520215212152221523215242152521526215272152821529215302153121532215332153421535215362153721538215392154021541215422154321544215452154621547215482154921550215512155221553215542155521556215572155821559215602156121562215632156421565215662156721568215692157021571215722157321574215752157621577215782157921580215812158221583215842158521586215872158821589215902159121592215932159421595215962159721598215992160021601216022160321604216052160621607216082160921610216112161221613216142161521616216172161821619216202162121622216232162421625216262162721628216292163021631216322163321634216352163621637216382163921640216412164221643216442164521646216472164821649216502165121652216532165421655216562165721658216592166021661216622166321664216652166621667216682166921670216712167221673216742167521676216772167821679216802168121682216832168421685216862168721688216892169021691216922169321694216952169621697216982169921700217012170221703217042170521706217072170821709217102171121712217132171421715217162171721718217192172021721217222172321724217252172621727217282172921730217312173221733217342173521736217372173821739217402174121742217432174421745217462174721748217492175021751217522175321754217552175621757217582175921760217612176221763217642176521766217672176821769217702177121772217732177421775217762177721778217792178021781217822178321784217852178621787217882178921790217912179221793217942179521796217972179821799218002180121802218032180421805218062180721808218092181021811218122181321814218152181621817218182181921820218212182221823218242182521826218272182821829218302183121832218332183421835218362183721838218392184021841218422184321844218452184621847218482184921850218512185221853218542185521856218572185821859218602186121862218632186421865218662186721868218692187021871218722187321874218752187621877218782187921880218812188221883218842188521886218872188821889218902189121892218932189421895218962189721898218992190021901219022190321904219052190621907219082190921910219112191221913219142191521916219172191821919219202192121922219232192421925219262192721928219292193021931219322193321934219352193621937219382193921940219412194221943219442194521946219472194821949219502195121952219532195421955219562195721958219592196021961219622196321964219652196621967219682196921970219712197221973219742197521976219772197821979219802198121982219832198421985219862198721988219892199021991219922199321994219952199621997219982199922000220012200222003220042200522006220072200822009220102201122012220132201422015220162201722018220192202022021220222202322024220252202622027220282202922030220312203222033220342203522036220372203822039220402204122042220432204422045220462204722048220492205022051220522205322054220552205622057220582205922060220612206222063220642206522066220672206822069220702207122072220732207422075220762207722078220792208022081220822208322084220852208622087220882208922090220912209222093220942209522096220972209822099221002210122102221032210422105221062210722108221092211022111221122211322114221152211622117221182211922120221212212222123221242212522126221272212822129221302213122132221332213422135221362213722138221392214022141221422214322144221452214622147221482214922150221512215222153221542215522156221572215822159221602216122162221632216422165221662216722168221692217022171221722217322174221752217622177221782217922180221812218222183221842218522186221872218822189221902219122192221932219422195221962219722198221992220022201222022220322204222052220622207222082220922210222112221222213222142221522216222172221822219222202222122222222232222422225222262222722228222292223022231222322223322234222352223622237222382223922240222412224222243222442224522246222472224822249222502225122252222532225422255222562225722258222592226022261222622226322264222652226622267222682226922270222712227222273222742227522276222772227822279222802228122282222832228422285222862228722288222892229022291222922229322294222952229622297222982229922300223012230222303223042230522306223072230822309223102231122312223132231422315223162231722318223192232022321223222232322324223252232622327223282232922330223312233222333223342233522336223372233822339223402234122342223432234422345223462234722348223492235022351223522235322354223552235622357223582235922360223612236222363223642236522366223672236822369223702237122372223732237422375223762237722378223792238022381223822238322384223852238622387223882238922390223912239222393223942239522396223972239822399224002240122402224032240422405224062240722408224092241022411224122241322414224152241622417224182241922420224212242222423224242242522426224272242822429224302243122432224332243422435224362243722438224392244022441224422244322444224452244622447224482244922450224512245222453224542245522456224572245822459224602246122462224632246422465224662246722468224692247022471224722247322474224752247622477224782247922480224812248222483224842248522486224872248822489224902249122492224932249422495224962249722498224992250022501225022250322504225052250622507225082250922510225112251222513225142251522516225172251822519225202252122522225232252422525225262252722528225292253022531225322253322534225352253622537225382253922540225412254222543225442254522546225472254822549225502255122552225532255422555225562255722558225592256022561225622256322564225652256622567225682256922570225712257222573225742257522576225772257822579225802258122582225832258422585225862258722588225892259022591225922259322594225952259622597225982259922600226012260222603226042260522606226072260822609226102261122612226132261422615226162261722618226192262022621226222262322624226252262622627226282262922630226312263222633226342263522636226372263822639226402264122642226432264422645226462264722648226492265022651226522265322654226552265622657226582265922660226612266222663226642266522666226672266822669226702267122672226732267422675226762267722678226792268022681226822268322684226852268622687226882268922690226912269222693226942269522696226972269822699227002270122702227032270422705227062270722708227092271022711227122271322714227152271622717227182271922720227212272222723227242272522726227272272822729227302273122732227332273422735227362273722738227392274022741227422274322744227452274622747227482274922750227512275222753227542275522756227572275822759227602276122762227632276422765227662276722768227692277022771227722277322774227752277622777227782277922780227812278222783227842278522786227872278822789227902279122792227932279422795227962279722798227992280022801228022280322804228052280622807228082280922810228112281222813228142281522816228172281822819228202282122822228232282422825228262282722828228292283022831228322283322834228352283622837228382283922840228412284222843228442284522846228472284822849228502285122852228532285422855228562285722858228592286022861228622286322864228652286622867228682286922870228712287222873228742287522876228772287822879228802288122882228832288422885228862288722888228892289022891228922289322894228952289622897228982289922900229012290222903229042290522906229072290822909229102291122912229132291422915229162291722918229192292022921229222292322924229252292622927229282292922930229312293222933229342293522936229372293822939229402294122942229432294422945229462294722948229492295022951229522295322954229552295622957229582295922960229612296222963229642296522966229672296822969229702297122972229732297422975229762297722978229792298022981229822298322984229852298622987229882298922990229912299222993229942299522996229972299822999230002300123002230032300423005230062300723008230092301023011230122301323014230152301623017230182301923020230212302223023230242302523026230272302823029230302303123032230332303423035230362303723038230392304023041230422304323044230452304623047230482304923050230512305223053230542305523056230572305823059230602306123062230632306423065230662306723068230692307023071230722307323074230752307623077230782307923080230812308223083230842308523086230872308823089230902309123092230932309423095230962309723098230992310023101231022310323104231052310623107231082310923110231112311223113231142311523116231172311823119231202312123122231232312423125231262312723128231292313023131231322313323134231352313623137231382313923140231412314223143231442314523146231472314823149231502315123152231532315423155231562315723158231592316023161231622316323164231652316623167231682316923170231712317223173231742317523176231772317823179231802318123182231832318423185231862318723188231892319023191231922319323194231952319623197231982319923200232012320223203232042320523206232072320823209232102321123212232132321423215232162321723218232192322023221232222322323224232252322623227232282322923230232312323223233232342323523236232372323823239232402324123242232432324423245232462324723248232492325023251232522325323254232552325623257232582325923260232612326223263232642326523266232672326823269232702327123272232732327423275232762327723278232792328023281232822328323284232852328623287232882328923290232912329223293232942329523296232972329823299233002330123302233032330423305233062330723308233092331023311233122331323314233152331623317233182331923320233212332223323233242332523326233272332823329233302333123332233332333423335233362333723338233392334023341233422334323344233452334623347233482334923350233512335223353233542335523356233572335823359233602336123362233632336423365233662336723368233692337023371233722337323374233752337623377233782337923380233812338223383233842338523386233872338823389233902339123392233932339423395233962339723398233992340023401234022340323404234052340623407234082340923410234112341223413234142341523416234172341823419234202342123422234232342423425234262342723428234292343023431234322343323434234352343623437234382343923440234412344223443234442344523446234472344823449234502345123452234532345423455234562345723458234592346023461234622346323464234652346623467234682346923470234712347223473234742347523476234772347823479234802348123482234832348423485234862348723488234892349023491234922349323494234952349623497234982349923500235012350223503235042350523506235072350823509235102351123512235132351423515235162351723518235192352023521235222352323524235252352623527235282352923530235312353223533235342353523536235372353823539235402354123542235432354423545235462354723548235492355023551235522355323554235552355623557235582355923560235612356223563235642356523566235672356823569235702357123572235732357423575235762357723578235792358023581235822358323584235852358623587235882358923590235912359223593235942359523596235972359823599236002360123602236032360423605236062360723608236092361023611236122361323614236152361623617236182361923620236212362223623236242362523626236272362823629236302363123632236332363423635236362363723638236392364023641236422364323644236452364623647236482364923650236512365223653236542365523656236572365823659236602366123662236632366423665236662366723668236692367023671236722367323674236752367623677236782367923680236812368223683236842368523686236872368823689236902369123692236932369423695236962369723698236992370023701237022370323704237052370623707237082370923710237112371223713237142371523716237172371823719237202372123722237232372423725237262372723728237292373023731237322373323734237352373623737237382373923740237412374223743237442374523746237472374823749237502375123752237532375423755237562375723758237592376023761237622376323764237652376623767237682376923770237712377223773237742377523776237772377823779237802378123782237832378423785237862378723788237892379023791237922379323794237952379623797237982379923800238012380223803238042380523806238072380823809238102381123812238132381423815238162381723818238192382023821238222382323824238252382623827238282382923830238312383223833238342383523836238372383823839238402384123842238432384423845238462384723848238492385023851238522385323854238552385623857238582385923860238612386223863238642386523866238672386823869238702387123872238732387423875238762387723878238792388023881238822388323884238852388623887238882388923890238912389223893238942389523896238972389823899239002390123902239032390423905239062390723908239092391023911239122391323914239152391623917239182391923920239212392223923239242392523926239272392823929239302393123932239332393423935239362393723938239392394023941239422394323944239452394623947239482394923950239512395223953239542395523956239572395823959239602396123962239632396423965239662396723968239692397023971239722397323974239752397623977239782397923980239812398223983239842398523986239872398823989239902399123992239932399423995239962399723998239992400024001240022400324004240052400624007240082400924010240112401224013240142401524016240172401824019240202402124022240232402424025240262402724028240292403024031240322403324034240352403624037240382403924040240412404224043240442404524046240472404824049240502405124052240532405424055240562405724058240592406024061240622406324064240652406624067240682406924070240712407224073240742407524076240772407824079240802408124082240832408424085240862408724088240892409024091240922409324094240952409624097240982409924100241012410224103241042410524106241072410824109241102411124112241132411424115241162411724118241192412024121241222412324124241252412624127241282412924130241312413224133241342413524136241372413824139241402414124142241432414424145241462414724148241492415024151241522415324154241552415624157241582415924160241612416224163241642416524166241672416824169241702417124172241732417424175241762417724178241792418024181241822418324184241852418624187241882418924190241912419224193241942419524196241972419824199242002420124202242032420424205242062420724208242092421024211242122421324214242152421624217242182421924220242212422224223242242422524226242272422824229242302423124232242332423424235242362423724238242392424024241242422424324244242452424624247242482424924250242512425224253242542425524256242572425824259242602426124262242632426424265242662426724268242692427024271242722427324274242752427624277242782427924280242812428224283242842428524286242872428824289242902429124292242932429424295242962429724298242992430024301243022430324304243052430624307243082430924310243112431224313243142431524316243172431824319243202432124322243232432424325243262432724328243292433024331243322433324334243352433624337243382433924340243412434224343243442434524346243472434824349243502435124352243532435424355243562435724358243592436024361243622436324364243652436624367243682436924370243712437224373243742437524376243772437824379243802438124382243832438424385243862438724388243892439024391243922439324394243952439624397243982439924400244012440224403244042440524406244072440824409244102441124412244132441424415244162441724418244192442024421244222442324424244252442624427244282442924430244312443224433244342443524436244372443824439244402444124442244432444424445244462444724448244492445024451244522445324454244552445624457244582445924460244612446224463244642446524466244672446824469244702447124472244732447424475244762447724478244792448024481244822448324484244852448624487244882448924490244912449224493244942449524496244972449824499245002450124502245032450424505245062450724508245092451024511245122451324514245152451624517245182451924520245212452224523245242452524526245272452824529245302453124532245332453424535245362453724538245392454024541245422454324544245452454624547245482454924550245512455224553245542455524556245572455824559245602456124562245632456424565245662456724568245692457024571245722457324574245752457624577245782457924580245812458224583245842458524586245872458824589245902459124592245932459424595245962459724598245992460024601246022460324604246052460624607246082460924610246112461224613246142461524616246172461824619246202462124622246232462424625246262462724628246292463024631246322463324634246352463624637246382463924640246412464224643246442464524646246472464824649246502465124652246532465424655246562465724658246592466024661246622466324664246652466624667246682466924670246712467224673246742467524676246772467824679246802468124682246832468424685246862468724688246892469024691246922469324694246952469624697246982469924700247012470224703247042470524706247072470824709247102471124712247132471424715247162471724718247192472024721247222472324724247252472624727247282472924730247312473224733247342473524736247372473824739247402474124742247432474424745247462474724748247492475024751247522475324754247552475624757247582475924760247612476224763247642476524766247672476824769247702477124772247732477424775247762477724778247792478024781247822478324784247852478624787247882478924790247912479224793247942479524796247972479824799248002480124802248032480424805248062480724808248092481024811248122481324814248152481624817248182481924820248212482224823248242482524826248272482824829248302483124832248332483424835248362483724838248392484024841248422484324844248452484624847248482484924850248512485224853248542485524856248572485824859248602486124862248632486424865248662486724868248692487024871248722487324874248752487624877248782487924880248812488224883248842488524886248872488824889248902489124892248932489424895248962489724898248992490024901249022490324904249052490624907249082490924910249112491224913249142491524916249172491824919249202492124922249232492424925249262492724928249292493024931249322493324934249352493624937249382493924940249412494224943249442494524946249472494824949249502495124952249532495424955249562495724958249592496024961249622496324964249652496624967249682496924970249712497224973249742497524976249772497824979249802498124982249832498424985249862498724988249892499024991249922499324994249952499624997249982499925000250012500225003250042500525006250072500825009250102501125012250132501425015250162501725018250192502025021250222502325024250252502625027250282502925030250312503225033250342503525036250372503825039250402504125042250432504425045250462504725048250492505025051250522505325054250552505625057250582505925060250612506225063250642506525066250672506825069250702507125072250732507425075250762507725078250792508025081250822508325084250852508625087250882508925090250912509225093250942509525096250972509825099251002510125102251032510425105251062510725108251092511025111251122511325114251152511625117251182511925120251212512225123251242512525126251272512825129251302513125132251332513425135251362513725138251392514025141251422514325144251452514625147251482514925150251512515225153251542515525156251572515825159251602516125162251632516425165251662516725168251692517025171251722517325174251752517625177251782517925180251812518225183251842518525186251872518825189251902519125192251932519425195251962519725198251992520025201252022520325204252052520625207252082520925210252112521225213252142521525216252172521825219252202522125222252232522425225252262522725228252292523025231252322523325234252352523625237252382523925240252412524225243252442524525246252472524825249252502525125252252532525425255252562525725258252592526025261252622526325264252652526625267252682526925270252712527225273252742527525276252772527825279252802528125282252832528425285252862528725288252892529025291252922529325294252952529625297252982529925300253012530225303253042530525306253072530825309253102531125312253132531425315253162531725318253192532025321253222532325324253252532625327253282532925330253312533225333253342533525336253372533825339253402534125342253432534425345253462534725348253492535025351253522535325354253552535625357253582535925360253612536225363253642536525366253672536825369253702537125372253732537425375253762537725378253792538025381253822538325384253852538625387253882538925390253912539225393253942539525396253972539825399254002540125402254032540425405254062540725408254092541025411254122541325414254152541625417254182541925420254212542225423254242542525426254272542825429254302543125432254332543425435254362543725438254392544025441254422544325444254452544625447254482544925450254512545225453254542545525456254572545825459254602546125462254632546425465254662546725468254692547025471254722547325474254752547625477254782547925480254812548225483254842548525486254872548825489254902549125492254932549425495254962549725498254992550025501255022550325504255052550625507255082550925510255112551225513255142551525516255172551825519255202552125522255232552425525255262552725528255292553025531255322553325534255352553625537255382553925540255412554225543255442554525546255472554825549255502555125552255532555425555255562555725558255592556025561255622556325564255652556625567255682556925570255712557225573255742557525576255772557825579255802558125582255832558425585255862558725588255892559025591255922559325594255952559625597255982559925600256012560225603256042560525606256072560825609256102561125612256132561425615256162561725618256192562025621256222562325624256252562625627256282562925630256312563225633256342563525636256372563825639256402564125642256432564425645256462564725648256492565025651256522565325654256552565625657256582565925660256612566225663256642566525666256672566825669256702567125672256732567425675256762567725678256792568025681256822568325684256852568625687256882568925690256912569225693256942569525696256972569825699257002570125702257032570425705257062570725708257092571025711257122571325714257152571625717257182571925720257212572225723257242572525726257272572825729257302573125732257332573425735257362573725738257392574025741257422574325744257452574625747257482574925750257512575225753257542575525756257572575825759257602576125762257632576425765257662576725768257692577025771257722577325774257752577625777257782577925780257812578225783257842578525786257872578825789257902579125792257932579425795257962579725798257992580025801258022580325804258052580625807258082580925810258112581225813258142581525816258172581825819258202582125822258232582425825258262582725828258292583025831258322583325834258352583625837258382583925840258412584225843258442584525846258472584825849258502585125852258532585425855258562585725858258592586025861258622586325864258652586625867258682586925870258712587225873258742587525876258772587825879258802588125882258832588425885258862588725888258892589025891258922589325894258952589625897258982589925900259012590225903259042590525906259072590825909259102591125912259132591425915259162591725918259192592025921259222592325924259252592625927259282592925930259312593225933259342593525936259372593825939259402594125942259432594425945259462594725948259492595025951259522595325954259552595625957259582595925960259612596225963259642596525966259672596825969259702597125972259732597425975259762597725978259792598025981259822598325984259852598625987259882598925990259912599225993259942599525996259972599825999260002600126002260032600426005260062600726008260092601026011260122601326014260152601626017260182601926020260212602226023260242602526026260272602826029260302603126032260332603426035260362603726038260392604026041260422604326044260452604626047260482604926050260512605226053260542605526056260572605826059260602606126062260632606426065260662606726068260692607026071260722607326074260752607626077260782607926080260812608226083260842608526086260872608826089260902609126092260932609426095260962609726098260992610026101261022610326104261052610626107261082610926110261112611226113261142611526116261172611826119261202612126122261232612426125261262612726128261292613026131261322613326134261352613626137261382613926140261412614226143261442614526146261472614826149261502615126152261532615426155261562615726158261592616026161261622616326164261652616626167261682616926170261712617226173261742617526176261772617826179261802618126182261832618426185261862618726188261892619026191261922619326194261952619626197261982619926200262012620226203262042620526206262072620826209262102621126212262132621426215262162621726218262192622026221262222622326224262252622626227262282622926230262312623226233262342623526236262372623826239262402624126242262432624426245262462624726248262492625026251262522625326254262552625626257262582625926260262612626226263262642626526266262672626826269262702627126272262732627426275262762627726278262792628026281262822628326284262852628626287262882628926290262912629226293262942629526296262972629826299263002630126302263032630426305263062630726308263092631026311263122631326314263152631626317263182631926320263212632226323263242632526326263272632826329263302633126332263332633426335263362633726338263392634026341263422634326344263452634626347263482634926350263512635226353263542635526356263572635826359263602636126362263632636426365263662636726368263692637026371263722637326374263752637626377263782637926380263812638226383263842638526386263872638826389263902639126392263932639426395263962639726398263992640026401264022640326404264052640626407264082640926410264112641226413264142641526416264172641826419264202642126422264232642426425264262642726428264292643026431264322643326434264352643626437264382643926440264412644226443264442644526446264472644826449264502645126452264532645426455264562645726458264592646026461264622646326464264652646626467264682646926470264712647226473264742647526476264772647826479264802648126482264832648426485264862648726488264892649026491264922649326494264952649626497264982649926500265012650226503265042650526506265072650826509265102651126512265132651426515265162651726518265192652026521265222652326524265252652626527265282652926530265312653226533265342653526536265372653826539265402654126542265432654426545265462654726548265492655026551265522655326554265552655626557265582655926560265612656226563265642656526566265672656826569265702657126572
  1. {
  2. "metadata": {
  3. "source_file": "primevul_valid_grouped.json",
  4. "filter_min_depth": 3,
  5. "filter_max_depth": 5,
  6. "original_groups": 4777,
  7. "filtered_groups": 198,
  8. "total_functions": 2181,
  9. "depth_distribution": {
  10. "25": 1,
  11. "1": 4057,
  12. "14": 3,
  13. "13": 1,
  14. "5": 13,
  15. "2": 489,
  16. "6": 16,
  17. "3": 135,
  18. "4": 50,
  19. "7": 6,
  20. "8": 2,
  21. "12": 2,
  22. "11": 1,
  23. "10": 1
  24. }
  25. },
  26. "groups": [
  27. {
  28. "call_depth": 5,
  29. "longest_call_chain": [
  30. "msusb_msconfig_read",
  31. "msusb_msinterface_read_list",
  32. "msusb_msinterface_read",
  33. "msusb_mspipes_read",
  34. "msusb_mspipe_new"
  35. ],
  36. "group_size": 14,
  37. "functions": [
  38. {
  39. "func": "static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(wStream* s, UINT32 NumberOfPipes)\n{\n\tUINT32 pnum;\n\tMSUSB_PIPE_DESCRIPTOR** MsPipes;\n\n\tif (Stream_GetRemainingCapacity(s) < 12 * NumberOfPipes)\n\t\treturn NULL;\n\n\tMsPipes = (MSUSB_PIPE_DESCRIPTOR**)calloc(NumberOfPipes, sizeof(MSUSB_PIPE_DESCRIPTOR*));\n\n\tif (!MsPipes)\n\t\treturn NULL;\n\n\tfor (pnum = 0; pnum < NumberOfPipes; pnum++)\n\t{\n\t\tMSUSB_PIPE_DESCRIPTOR* MsPipe = msusb_mspipe_new();\n\n\t\tif (!MsPipe)\n\t\t\tgoto out_error;\n\n\t\tStream_Read_UINT16(s, MsPipe->MaximumPacketSize);\n\t\tStream_Seek(s, 2);\n\t\tStream_Read_UINT32(s, MsPipe->MaximumTransferSize);\n\t\tStream_Read_UINT32(s, MsPipe->PipeFlags);\n\t\t/* Already set to zero by memset\n\t\t MsPipe->PipeHandle\t = 0;\n\t\t MsPipe->bEndpointAddress = 0;\n\t\t MsPipe->bInterval\t\t= 0;\n\t\t MsPipe->PipeType\t\t = 0;\n\t\t MsPipe->InitCompleted\t= 0;\n\t\t*/\n\t\tMsPipes[pnum] = MsPipe;\n\t}\n\n\treturn MsPipes;\nout_error:\n\n\tfor (pnum = 0; pnum < NumberOfPipes; pnum++)\n\t\tfree(MsPipes[pnum]);\n\n\tfree(MsPipes);\n\treturn NULL;\n}",
  40. "project": "FreeRDP",
  41. "hash": 43522950749896036127664697861930743417,
  42. "size": 43,
  43. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  44. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  45. "target": 1,
  46. "dataset": "other",
  47. "idx": 205671
  48. },
  49. {
  50. "func": "static MSUSB_PIPE_DESCRIPTOR** msusb_mspipes_read(wStream* s, UINT32 NumberOfPipes)\n{\n\tUINT32 pnum;\n\tMSUSB_PIPE_DESCRIPTOR** MsPipes;\n\n\tif (Stream_GetRemainingCapacity(s) / 12 < NumberOfPipes)\n\t\treturn NULL;\n\n\tMsPipes = (MSUSB_PIPE_DESCRIPTOR**)calloc(NumberOfPipes, sizeof(MSUSB_PIPE_DESCRIPTOR*));\n\n\tif (!MsPipes)\n\t\treturn NULL;\n\n\tfor (pnum = 0; pnum < NumberOfPipes; pnum++)\n\t{\n\t\tMSUSB_PIPE_DESCRIPTOR* MsPipe = msusb_mspipe_new();\n\n\t\tif (!MsPipe)\n\t\t\tgoto out_error;\n\n\t\tStream_Read_UINT16(s, MsPipe->MaximumPacketSize);\n\t\tStream_Seek(s, 2);\n\t\tStream_Read_UINT32(s, MsPipe->MaximumTransferSize);\n\t\tStream_Read_UINT32(s, MsPipe->PipeFlags);\n\t\t/* Already set to zero by memset\n\t\t MsPipe->PipeHandle\t = 0;\n\t\t MsPipe->bEndpointAddress = 0;\n\t\t MsPipe->bInterval\t\t= 0;\n\t\t MsPipe->PipeType\t\t = 0;\n\t\t MsPipe->InitCompleted\t= 0;\n\t\t*/\n\t\tMsPipes[pnum] = MsPipe;\n\t}\n\n\treturn MsPipes;\nout_error:\n\n\tfor (pnum = 0; pnum < NumberOfPipes; pnum++)\n\t\tfree(MsPipes[pnum]);\n\n\tfree(MsPipes);\n\treturn NULL;\n}",
  51. "project": "FreeRDP",
  52. "hash": 327097256253608261746407166636662999864,
  53. "size": 43,
  54. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  55. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  56. "target": 0,
  57. "dataset": "other",
  58. "idx": 370198
  59. },
  60. {
  61. "func": "static void msusb_msinterface_free(MSUSB_INTERFACE_DESCRIPTOR* MsInterface)\n{\n\tif (MsInterface)\n\t{\n\t\tmsusb_mspipes_free(MsInterface->MsPipes, MsInterface->NumberOfPipes);\n\t\tMsInterface->MsPipes = NULL;\n\t\tfree(MsInterface);\n\t}\n}",
  62. "project": "FreeRDP",
  63. "hash": 111719313818634845962432534061650784720,
  64. "size": 9,
  65. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  66. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  67. "target": 0,
  68. "dataset": "other",
  69. "idx": 370195
  70. },
  71. {
  72. "func": "static MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_new()\n{\n\treturn (MSUSB_INTERFACE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_INTERFACE_DESCRIPTOR));\n}",
  73. "project": "FreeRDP",
  74. "hash": 195102358277270166636371095078324614685,
  75. "size": 4,
  76. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  77. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  78. "target": 0,
  79. "dataset": "other",
  80. "idx": 370190
  81. },
  82. {
  83. "func": "static MSUSB_PIPE_DESCRIPTOR* msusb_mspipe_new()\n{\n\treturn (MSUSB_PIPE_DESCRIPTOR*)calloc(1, sizeof(MSUSB_PIPE_DESCRIPTOR));\n}",
  84. "project": "FreeRDP",
  85. "hash": 286269363881544208550715036997896416778,
  86. "size": 4,
  87. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  88. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  89. "target": 0,
  90. "dataset": "other",
  91. "idx": 370185
  92. },
  93. {
  94. "func": "static void msusb_mspipes_free(MSUSB_PIPE_DESCRIPTOR** MsPipes, UINT32 NumberOfPipes)\n{\n\tUINT32 pnum = 0;\n\n\tif (MsPipes)\n\t{\n\t\tfor (pnum = 0; pnum < NumberOfPipes && MsPipes[pnum]; pnum++)\n\t\t\tfree(MsPipes[pnum]);\n\n\t\tfree(MsPipes);\n\t}\n}",
  95. "project": "FreeRDP",
  96. "hash": 298850235727179719739936200735090397102,
  97. "size": 12,
  98. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  99. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  100. "target": 0,
  101. "dataset": "other",
  102. "idx": 370194
  103. },
  104. {
  105. "func": "MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_new(void)\n{\n\treturn (MSUSB_CONFIG_DESCRIPTOR*)calloc(1, sizeof(MSUSB_CONFIG_DESCRIPTOR));\n}",
  106. "project": "FreeRDP",
  107. "hash": 116475666787466662372093513378582272026,
  108. "size": 4,
  109. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  110. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  111. "target": 0,
  112. "dataset": "other",
  113. "idx": 370189
  114. },
  115. {
  116. "func": "BOOL msusb_msinterface_replace(MSUSB_CONFIG_DESCRIPTOR* MsConfig, BYTE InterfaceNumber,\n MSUSB_INTERFACE_DESCRIPTOR* NewMsInterface)\n{\n\tif (!MsConfig || !MsConfig->MsInterfaces)\n\t\treturn FALSE;\n\n\tmsusb_msinterface_free(MsConfig->MsInterfaces[InterfaceNumber]);\n\tMsConfig->MsInterfaces[InterfaceNumber] = NewMsInterface;\n\treturn TRUE;\n}",
  117. "project": "FreeRDP",
  118. "hash": 163043333955182832460253605601479340365,
  119. "size": 10,
  120. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  121. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  122. "target": 0,
  123. "dataset": "other",
  124. "idx": 370192
  125. },
  126. {
  127. "func": "static MSUSB_INTERFACE_DESCRIPTOR** msusb_msinterface_read_list(wStream* s, UINT32 NumInterfaces)\n{\n\tUINT32 inum;\n\tMSUSB_INTERFACE_DESCRIPTOR** MsInterfaces;\n\tMsInterfaces =\n\t (MSUSB_INTERFACE_DESCRIPTOR**)calloc(NumInterfaces, sizeof(MSUSB_INTERFACE_DESCRIPTOR*));\n\n\tif (!MsInterfaces)\n\t\treturn NULL;\n\n\tfor (inum = 0; inum < NumInterfaces; inum++)\n\t{\n\t\tMsInterfaces[inum] = msusb_msinterface_read(s);\n\n\t\tif (!MsInterfaces[inum])\n\t\t\tgoto fail;\n\t}\n\n\treturn MsInterfaces;\nfail:\n\n\tfor (inum = 0; inum < NumInterfaces; inum++)\n\t\tmsusb_msinterface_free(MsInterfaces[inum]);\n\n\tfree(MsInterfaces);\n\treturn NULL;\n}",
  128. "project": "FreeRDP",
  129. "hash": 301570211779473080394701095071166755889,
  130. "size": 27,
  131. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  132. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  133. "target": 0,
  134. "dataset": "other",
  135. "idx": 370184
  136. },
  137. {
  138. "func": "static void msusb_msinterface_free_list(MSUSB_INTERFACE_DESCRIPTOR** MsInterfaces,\n UINT32 NumInterfaces)\n{\n\tUINT32 inum = 0;\n\n\tif (MsInterfaces)\n\t{\n\t\tfor (inum = 0; inum < NumInterfaces; inum++)\n\t\t{\n\t\t\tmsusb_msinterface_free(MsInterfaces[inum]);\n\t\t}\n\n\t\tfree(MsInterfaces);\n\t}\n}",
  139. "project": "FreeRDP",
  140. "hash": 255545382072794521231443556625399604321,
  141. "size": 15,
  142. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  143. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  144. "target": 0,
  145. "dataset": "other",
  146. "idx": 370196
  147. },
  148. {
  149. "func": "void msusb_msconfig_free(MSUSB_CONFIG_DESCRIPTOR* MsConfig)\n{\n\tif (MsConfig)\n\t{\n\t\tmsusb_msinterface_free_list(MsConfig->MsInterfaces, MsConfig->NumInterfaces);\n\t\tMsConfig->MsInterfaces = NULL;\n\t\tfree(MsConfig);\n\t}\n}",
  150. "project": "FreeRDP",
  151. "hash": 247496999087104528986755682952452432422,
  152. "size": 9,
  153. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  154. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  155. "target": 0,
  156. "dataset": "other",
  157. "idx": 370186
  158. },
  159. {
  160. "func": "BOOL msusb_mspipes_replace(MSUSB_INTERFACE_DESCRIPTOR* MsInterface,\n MSUSB_PIPE_DESCRIPTOR** NewMsPipes, UINT32 NewNumberOfPipes)\n{\n\tif (!MsInterface || !NewMsPipes)\n\t\treturn FALSE;\n\n\t/* free orignal MsPipes */\n\tmsusb_mspipes_free(MsInterface->MsPipes, MsInterface->NumberOfPipes);\n\t/* And replace it */\n\tMsInterface->MsPipes = NewMsPipes;\n\tMsInterface->NumberOfPipes = NewNumberOfPipes;\n\treturn TRUE;\n}",
  161. "project": "FreeRDP",
  162. "hash": 272826545862192184139368934588135834022,
  163. "size": 13,
  164. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  165. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  166. "target": 0,
  167. "dataset": "other",
  168. "idx": 370188
  169. },
  170. {
  171. "func": "MSUSB_INTERFACE_DESCRIPTOR* msusb_msinterface_read(wStream* s)\n{\n\tMSUSB_INTERFACE_DESCRIPTOR* MsInterface;\n\n\tif (Stream_GetRemainingCapacity(s) < 12)\n\t\treturn NULL;\n\n\tMsInterface = msusb_msinterface_new();\n\n\tif (!MsInterface)\n\t\treturn NULL;\n\n\tStream_Read_UINT16(s, MsInterface->Length);\n\tStream_Read_UINT16(s, MsInterface->NumberOfPipesExpected);\n\tStream_Read_UINT8(s, MsInterface->InterfaceNumber);\n\tStream_Read_UINT8(s, MsInterface->AlternateSetting);\n\tStream_Seek(s, 2);\n\tStream_Read_UINT32(s, MsInterface->NumberOfPipes);\n\tMsInterface->InterfaceHandle = 0;\n\tMsInterface->bInterfaceClass = 0;\n\tMsInterface->bInterfaceSubClass = 0;\n\tMsInterface->bInterfaceProtocol = 0;\n\tMsInterface->InitCompleted = 0;\n\tMsInterface->MsPipes = NULL;\n\n\tif (MsInterface->NumberOfPipes > 0)\n\t{\n\t\tMsInterface->MsPipes = msusb_mspipes_read(s, MsInterface->NumberOfPipes);\n\n\t\tif (!MsInterface->MsPipes)\n\t\t\tgoto out_error;\n\t}\n\n\treturn MsInterface;\nout_error:\n\tmsusb_msinterface_free(MsInterface);\n\treturn NULL;\n}",
  172. "project": "FreeRDP",
  173. "hash": 315713004236029849064051996144827842346,
  174. "size": 38,
  175. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  176. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  177. "target": 0,
  178. "dataset": "other",
  179. "idx": 370197
  180. },
  181. {
  182. "func": "MSUSB_CONFIG_DESCRIPTOR* msusb_msconfig_read(wStream* s, UINT32 NumInterfaces)\n{\n\tMSUSB_CONFIG_DESCRIPTOR* MsConfig;\n\tBYTE lenConfiguration, typeConfiguration;\n\n\tif (Stream_GetRemainingCapacity(s) < 6ULL + NumInterfaces * 2ULL)\n\t\treturn NULL;\n\n\tMsConfig = msusb_msconfig_new();\n\n\tif (!MsConfig)\n\t\tgoto fail;\n\n\tMsConfig->MsInterfaces = msusb_msinterface_read_list(s, NumInterfaces);\n\n\tif (!MsConfig->MsInterfaces)\n\t\tgoto fail;\n\n\tStream_Read_UINT8(s, lenConfiguration);\n\tStream_Read_UINT8(s, typeConfiguration);\n\n\tif (lenConfiguration != 0x9 || typeConfiguration != 0x2)\n\t{\n\t\tWLog_ERR(TAG, \"len and type must be 0x9 and 0x2 , but it is 0x%\" PRIx8 \" and 0x%\" PRIx8 \"\",\n\t\t lenConfiguration, typeConfiguration);\n\t\tgoto fail;\n\t}\n\n\tStream_Read_UINT16(s, MsConfig->wTotalLength);\n\tStream_Seek(s, 1);\n\tStream_Read_UINT8(s, MsConfig->bConfigurationValue);\n\tMsConfig->NumInterfaces = NumInterfaces;\n\treturn MsConfig;\nfail:\n\tmsusb_msconfig_free(MsConfig);\n\treturn NULL;\n}",
  183. "project": "FreeRDP",
  184. "hash": 5241623909507677207100469971939005727,
  185. "size": 37,
  186. "commit_id": "9f77fc3dd2394373e1be753952b00dafa1a9b7da",
  187. "message": "Fixed int overflow in msusb_mspipes_read\n\nThanks to hac425",
  188. "target": 0,
  189. "dataset": "other",
  190. "idx": 370187
  191. }
  192. ]
  193. },
  194. {
  195. "call_depth": 5,
  196. "longest_call_chain": [
  197. "rdp_send_confirm_active",
  198. "rdp_write_confirm_active",
  199. "rdp_print_capability_sets",
  200. "rdp_print_bitmap_codecs_capability_set",
  201. "rdp_read_bitmap_codec_guid"
  202. ],
  203. "group_size": 112,
  204. "functions": [
  205. {
  206. "func": "static BOOL rdp_write_remote_programs_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT32 railSupportLevel;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\trailSupportLevel = RAIL_LEVEL_SUPPORTED;\n\n\tif (settings->RemoteApplicationSupportLevel & RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED)\n\t{\n\t\tif (settings->RemoteAppLanguageBarSupported)\n\t\t\trailSupportLevel |= RAIL_LEVEL_DOCKED_LANGBAR_SUPPORTED;\n\t}\n\n\trailSupportLevel |= RAIL_LEVEL_SHELL_INTEGRATION_SUPPORTED;\n\trailSupportLevel |= RAIL_LEVEL_LANGUAGE_IME_SYNC_SUPPORTED;\n\trailSupportLevel |= RAIL_LEVEL_SERVER_TO_CLIENT_IME_SYNC_SUPPORTED;\n\trailSupportLevel |= RAIL_LEVEL_HIDE_MINIMIZED_APPS_SUPPORTED;\n\trailSupportLevel |= RAIL_LEVEL_WINDOW_CLOAKING_SUPPORTED;\n\trailSupportLevel |= RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED;\n\t/* Mask out everything the server does not support. */\n\trailSupportLevel &= settings->RemoteApplicationSupportLevel;\n\tStream_Write_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_RAIL);\n\treturn TRUE;\n}",
  207. "project": "FreeRDP",
  208. "hash": 193709063470865603451783243875991335784,
  209. "size": 29,
  210. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  211. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  212. "target": 0,
  213. "dataset": "other",
  214. "idx": 409659
  215. },
  216. {
  217. "func": "static BOOL rdp_print_font_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 fontSupportFlags = 0;\n\tUINT16 pad2Octets = 0;\n\tWLog_INFO(TAG, \"FontCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length > 4)\n\t\tStream_Read_UINT16(s, fontSupportFlags); /* fontSupportFlags (2 bytes) */\n\n\tif (length > 6)\n\t\tStream_Read_UINT16(s, pad2Octets); /* pad2Octets (2 bytes) */\n\n\tWLog_INFO(TAG, \"\\tfontSupportFlags: 0x%04\" PRIX16 \"\", fontSupportFlags);\n\tWLog_INFO(TAG, \"\\tpad2Octets: 0x%04\" PRIX16 \"\", pad2Octets);\n\treturn TRUE;\n}",
  218. "project": "FreeRDP",
  219. "hash": 287219390919017726670088650927058088376,
  220. "size": 16,
  221. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  222. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  223. "target": 0,
  224. "dataset": "other",
  225. "idx": 409619
  226. },
  227. {
  228. "func": "static BOOL rdp_read_glyph_cache_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tif (length < 52)\n\t\treturn FALSE;\n\n\t/* glyphCache (40 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[0])); /* glyphCache0 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[1])); /* glyphCache1 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[2])); /* glyphCache2 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[3])); /* glyphCache3 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[4])); /* glyphCache4 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[5])); /* glyphCache5 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[6])); /* glyphCache6 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[7])); /* glyphCache7 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[8])); /* glyphCache8 (4 bytes) */\n\trdp_read_cache_definition(s, &(settings->GlyphCache[9])); /* glyphCache9 (4 bytes) */\n\trdp_read_cache_definition(s, settings->FragCache); /* fragCache (4 bytes) */\n\tStream_Read_UINT16(s, settings->GlyphSupportLevel); /* glyphSupportLevel (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\treturn TRUE;\n}",
  229. "project": "FreeRDP",
  230. "hash": 290575542386525663549333405388088029038,
  231. "size": 21,
  232. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  233. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  234. "target": 0,
  235. "dataset": "other",
  236. "idx": 409625
  237. },
  238. {
  239. "func": "static BOOL rdp_read_capability_sets(wStream* s, rdpSettings* settings, UINT16 numberCapabilities,\n UINT16 totalLength)\n{\n\tBOOL treated;\n\tsize_t start, end, len;\n\tUINT16 count = numberCapabilities;\n\n\tstart = Stream_GetPosition(s);\n\twhile (numberCapabilities > 0 && Stream_GetRemainingLength(s) >= 4)\n\t{\n\t\tUINT16 type;\n\t\tUINT16 length;\n\t\tBYTE* em;\n\t\tBYTE* bm = Stream_Pointer(s);\n\t\trdp_read_capability_set_header(s, &length, &type);\n\n\t\tif (type < 32)\n\t\t{\n\t\t\tsettings->ReceivedCapabilities[type] = TRUE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tWLog_WARN(TAG, \"not handling capability type %\" PRIu16 \" yet\", type);\n\t\t}\n\n\t\tem = bm + length;\n\n\t\tif (Stream_GetRemainingLength(s) + 4 < ((size_t)length))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"error processing stream\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\ttreated = TRUE;\n\n\t\tswitch (type)\n\t\t{\n\t\t\tcase CAPSET_TYPE_GENERAL:\n\t\t\t\tif (!rdp_read_general_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP:\n\t\t\t\tif (!rdp_read_bitmap_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_ORDER:\n\t\t\t\tif (!rdp_read_order_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_POINTER:\n\t\t\t\tif (!rdp_read_pointer_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_INPUT:\n\t\t\t\tif (!rdp_read_input_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_VIRTUAL_CHANNEL:\n\t\t\t\tif (!rdp_read_virtual_channel_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_SHARE:\n\t\t\t\tif (!rdp_read_share_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_COLOR_CACHE:\n\t\t\t\tif (!rdp_read_color_cache_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_FONT:\n\t\t\t\tif (!rdp_read_font_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_DRAW_GDI_PLUS:\n\t\t\t\tif (!rdp_read_draw_gdiplus_cache_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_RAIL:\n\t\t\t\tif (!rdp_read_remote_programs_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_WINDOW:\n\t\t\t\tif (!rdp_read_window_list_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_MULTI_FRAGMENT_UPDATE:\n\t\t\t\tif (!rdp_read_multifragment_update_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_LARGE_POINTER:\n\t\t\t\tif (!rdp_read_large_pointer_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_COMP_DESK:\n\t\t\t\tif (!rdp_read_desktop_composition_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_SURFACE_COMMANDS:\n\t\t\t\tif (!rdp_read_surface_commands_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP_CODECS:\n\t\t\t\tif (!rdp_read_bitmap_codecs_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_FRAME_ACKNOWLEDGE:\n\t\t\t\tif (!rdp_read_frame_acknowledge_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP_CACHE_V3_CODEC_ID:\n\t\t\t\tif (!rdp_read_bitmap_cache_v3_codec_id_capability_set(s, length, settings))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\ttreated = FALSE;\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (!treated)\n\t\t{\n\t\t\tif (settings->ServerMode)\n\t\t\t{\n\t\t\t\t/* treating capabilities that are supposed to be send only from the client */\n\t\t\t\tswitch (type)\n\t\t\t\t{\n\t\t\t\t\tcase CAPSET_TYPE_BITMAP_CACHE:\n\t\t\t\t\t\tif (!rdp_read_bitmap_cache_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_BITMAP_CACHE_V2:\n\t\t\t\t\t\tif (!rdp_read_bitmap_cache_v2_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_BRUSH:\n\t\t\t\t\t\tif (!rdp_read_brush_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_GLYPH_CACHE:\n\t\t\t\t\t\tif (!rdp_read_glyph_cache_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_OFFSCREEN_CACHE:\n\t\t\t\t\t\tif (!rdp_read_offscreen_bitmap_cache_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_SOUND:\n\t\t\t\t\t\tif (!rdp_read_sound_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_CONTROL:\n\t\t\t\t\t\tif (!rdp_read_control_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_ACTIVATION:\n\t\t\t\t\t\tif (!rdp_read_window_activation_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase CAPSET_TYPE_DRAW_NINE_GRID_CACHE:\n\t\t\t\t\t\tif (!rdp_read_draw_nine_grid_cache_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tWLog_ERR(TAG, \"capability %s(%\" PRIu16 \") not expected from client\",\n\t\t\t\t\t\t get_capability_name(type), type);\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t/* treating capabilities that are supposed to be send only from the server */\n\t\t\t\tswitch (type)\n\t\t\t\t{\n\t\t\t\t\tcase CAPSET_TYPE_BITMAP_CACHE_HOST_SUPPORT:\n\t\t\t\t\t\tif (!rdp_read_bitmap_cache_host_support_capability_set(s, length, settings))\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tWLog_ERR(TAG, \"capability %s(%\" PRIu16 \") not expected from server\",\n\t\t\t\t\t\t get_capability_name(type), type);\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (Stream_Pointer(s) != em)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"incorrect offset, type:0x%04\" PRIX16 \" actual:%\" PRIuz \" expected:%\" PRIuz \"\",\n\t\t\t type, Stream_Pointer(s) - bm, em - bm);\n\t\t\tStream_SetPointer(s, em);\n\t\t}\n\n\t\tnumberCapabilities--;\n\t}\n\n\tend = Stream_GetPosition(s);\n\tlen = end - start;\n\n\tif (numberCapabilities)\n\t{\n\t\tWLog_ERR(TAG,\n\t\t \"strange we haven't read the number of announced capacity sets, read=%d \"\n\t\t \"expected=%\" PRIu16 \"\",\n\t\t count - numberCapabilities, count);\n\t}\n\n#ifdef WITH_DEBUG_CAPABILITIES\n\t{\n\t\tStream_SetPosition(s, start);\n\t\tnumberCapabilities = count;\n\t\trdp_print_capability_sets(s, numberCapabilities, TRUE);\n\t\tStream_SetPosition(s, end);\n\t}\n#endif\n\n\tif (len > totalLength)\n\t{\n\t\tWLog_ERR(TAG, \"Capability length expected %\" PRIu16 \", actual %\" PRIdz, totalLength, len);\n\t\treturn FALSE;\n\t}\n\treturn TRUE;\n}",
  240. "project": "FreeRDP",
  241. "hash": 67779701891338520668353647467913614405,
  242. "size": 280,
  243. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  244. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  245. "target": 0,
  246. "dataset": "other",
  247. "idx": 409685
  248. },
  249. {
  250. "func": "static BOOL rdp_read_color_cache_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT16(s); /* colorTableCacheSize (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\treturn TRUE;\n}",
  251. "project": "FreeRDP",
  252. "hash": 170743954534991278023661558618450335809,
  253. "size": 10,
  254. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  255. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  256. "target": 0,
  257. "dataset": "other",
  258. "idx": 409683
  259. },
  260. {
  261. "func": "static void rdp_write_bitmap_cache_cell_info(wStream* s, BITMAP_CACHE_V2_CELL_INFO* cellInfo)\n{\n\tUINT32 info;\n\t/**\n\t * numEntries is in the first 31 bits, while the last bit (k)\n\t * is used to indicate a persistent bitmap cache.\n\t */\n\tinfo = (cellInfo->numEntries | (cellInfo->persistent << 31));\n\tStream_Write_UINT32(s, info);\n}",
  262. "project": "FreeRDP",
  263. "hash": 315141264147868383992564277570837036722,
  264. "size": 10,
  265. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  266. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  267. "target": 0,
  268. "dataset": "other",
  269. "idx": 409626
  270. },
  271. {
  272. "func": "static BOOL rdp_read_offscreen_bitmap_cache_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tUINT32 offscreenSupportLevel;\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, offscreenSupportLevel); /* offscreenSupportLevel (4 bytes) */\n\tStream_Read_UINT16(s, settings->OffscreenCacheSize); /* offscreenCacheSize (2 bytes) */\n\tStream_Read_UINT16(s, settings->OffscreenCacheEntries); /* offscreenCacheEntries (2 bytes) */\n\n\tif (offscreenSupportLevel & TRUE)\n\t\tsettings->OffscreenSupportLevel = TRUE;\n\n\treturn TRUE;\n}",
  273. "project": "FreeRDP",
  274. "hash": 62983332440671309324742543335528050053,
  275. "size": 17,
  276. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  277. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  278. "target": 0,
  279. "dataset": "other",
  280. "idx": 409615
  281. },
  282. {
  283. "func": "static BOOL rdp_write_color_cache_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(s, 6); /* colorTableCacheSize (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_COLOR_CACHE);\n\treturn TRUE;\n}",
  284. "project": "FreeRDP",
  285. "hash": 278164959863837085932912697446259628534,
  286. "size": 16,
  287. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  288. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  289. "target": 0,
  290. "dataset": "other",
  291. "idx": 409652
  292. },
  293. {
  294. "func": "static BOOL rdp_print_window_activation_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 helpKeyFlag;\n\tUINT16 helpKeyIndexFlag;\n\tUINT16 helpExtendedKeyFlag;\n\tUINT16 windowManagerKeyFlag;\n\tWLog_INFO(TAG, \"WindowActivationCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, helpKeyFlag); /* helpKeyFlag (2 bytes) */\n\tStream_Read_UINT16(s, helpKeyIndexFlag); /* helpKeyIndexFlag (2 bytes) */\n\tStream_Read_UINT16(s, helpExtendedKeyFlag); /* helpExtendedKeyFlag (2 bytes) */\n\tStream_Read_UINT16(s, windowManagerKeyFlag); /* windowManagerKeyFlag (2 bytes) */\n\tWLog_INFO(TAG, \"\\thelpKeyFlag: 0x%04\" PRIX16 \"\", helpKeyFlag);\n\tWLog_INFO(TAG, \"\\thelpKeyIndexFlag: 0x%04\" PRIX16 \"\", helpKeyIndexFlag);\n\tWLog_INFO(TAG, \"\\thelpExtendedKeyFlag: 0x%04\" PRIX16 \"\", helpExtendedKeyFlag);\n\tWLog_INFO(TAG, \"\\twindowManagerKeyFlag: 0x%04\" PRIX16 \"\", windowManagerKeyFlag);\n\treturn TRUE;\n}",
  295. "project": "FreeRDP",
  296. "hash": 153479571757899139175602773326518312374,
  297. "size": 21,
  298. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  299. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  300. "target": 0,
  301. "dataset": "other",
  302. "idx": 409628
  303. },
  304. {
  305. "func": "static BOOL rdp_print_remote_programs_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 railSupportLevel;\n\tWLog_INFO(TAG, \"RemoteProgramsCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */\n\tWLog_INFO(TAG, \"\\trailSupportLevel: 0x%08\" PRIX32 \"\", railSupportLevel);\n\treturn TRUE;\n}",
  306. "project": "FreeRDP",
  307. "hash": 72639172899165116266830345752544775949,
  308. "size": 12,
  309. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  310. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  311. "target": 0,
  312. "dataset": "other",
  313. "idx": 409587
  314. },
  315. {
  316. "func": "BOOL rdp_send_demand_active(rdpRdp* rdp)\n{\n\twStream* s = rdp_send_stream_pdu_init(rdp);\n\tBOOL status;\n\n\tif (!s)\n\t\treturn FALSE;\n\n\trdp->settings->ShareId = 0x10000 + rdp->mcs->userId;\n\tstatus = rdp_write_demand_active(s, rdp->settings) &&\n\t rdp_send_pdu(rdp, s, PDU_TYPE_DEMAND_ACTIVE, rdp->mcs->userId);\n\tStream_Release(s);\n\treturn status;\n}",
  317. "project": "FreeRDP",
  318. "hash": 205696353185449835056499661961516775413,
  319. "size": 14,
  320. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  321. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  322. "target": 0,
  323. "dataset": "other",
  324. "idx": 409586
  325. },
  326. {
  327. "func": "static BOOL rdp_read_window_list_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tif (length < 11)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, settings->RemoteWndSupportLevel); /* wndSupportLevel (4 bytes) */\n\tStream_Read_UINT8(s, settings->RemoteAppNumIconCaches); /* numIconCaches (1 byte) */\n\tStream_Read_UINT16(s,\n\t settings->RemoteAppNumIconCacheEntries); /* numIconCacheEntries (2 bytes) */\n\treturn TRUE;\n}",
  328. "project": "FreeRDP",
  329. "hash": 67896909242570986520479535524505651635,
  330. "size": 11,
  331. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  332. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  333. "target": 0,
  334. "dataset": "other",
  335. "idx": 409665
  336. },
  337. {
  338. "func": "static BOOL rdp_write_rfx_client_capability_container(wStream* s, const rdpSettings* settings)\n{\n\tUINT32 captureFlags;\n\tBYTE codecMode;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\tcaptureFlags = settings->RemoteFxOnly ? 0 : CARDP_CAPS_CAPTURE_NON_CAC;\n\tcodecMode = settings->RemoteFxCodecMode;\n\tStream_Write_UINT16(s, 49); /* codecPropertiesLength */\n\t/* TS_RFX_CLNT_CAPS_CONTAINER */\n\tStream_Write_UINT32(s, 49); /* length */\n\tStream_Write_UINT32(s, captureFlags); /* captureFlags */\n\tStream_Write_UINT32(s, 37); /* capsLength */\n\t/* TS_RFX_CAPS */\n\tStream_Write_UINT16(s, CBY_CAPS); /* blockType */\n\tStream_Write_UINT32(s, 8); /* blockLen */\n\tStream_Write_UINT16(s, 1); /* numCapsets */\n\t/* TS_RFX_CAPSET */\n\tStream_Write_UINT16(s, CBY_CAPSET); /* blockType */\n\tStream_Write_UINT32(s, 29); /* blockLen */\n\tStream_Write_UINT8(s, 0x01); /* codecId (MUST be set to 0x01) */\n\tStream_Write_UINT16(s, CLY_CAPSET); /* capsetType */\n\tStream_Write_UINT16(s, 2); /* numIcaps */\n\tStream_Write_UINT16(s, 8); /* icapLen */\n\t/* TS_RFX_ICAP (RLGR1) */\n\tStream_Write_UINT16(s, CLW_VERSION_1_0); /* version */\n\tStream_Write_UINT16(s, CT_TILE_64x64); /* tileSize */\n\tStream_Write_UINT8(s, codecMode); /* flags */\n\tStream_Write_UINT8(s, CLW_COL_CONV_ICT); /* colConvBits */\n\tStream_Write_UINT8(s, CLW_XFORM_DWT_53_A); /* transformBits */\n\tStream_Write_UINT8(s, CLW_ENTROPY_RLGR1); /* entropyBits */\n\t/* TS_RFX_ICAP (RLGR3) */\n\tStream_Write_UINT16(s, CLW_VERSION_1_0); /* version */\n\tStream_Write_UINT16(s, CT_TILE_64x64); /* tileSize */\n\tStream_Write_UINT8(s, codecMode); /* flags */\n\tStream_Write_UINT8(s, CLW_COL_CONV_ICT); /* colConvBits */\n\tStream_Write_UINT8(s, CLW_XFORM_DWT_53_A); /* transformBits */\n\tStream_Write_UINT8(s, CLW_ENTROPY_RLGR3); /* entropyBits */\n\treturn TRUE;\n}",
  339. "project": "FreeRDP",
  340. "hash": 200878113568940200705345537700818220319,
  341. "size": 42,
  342. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  343. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  344. "target": 0,
  345. "dataset": "other",
  346. "idx": 409602
  347. },
  348. {
  349. "func": "BOOL rdp_send_confirm_active(rdpRdp* rdp)\n{\n\twStream* s = rdp_send_stream_pdu_init(rdp);\n\tBOOL status;\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tstatus = rdp_write_confirm_active(s, rdp->settings) &&\n\t rdp_send_pdu(rdp, s, PDU_TYPE_CONFIRM_ACTIVE, rdp->mcs->userId);\n\tStream_Release(s);\n\treturn status;\n}",
  350. "project": "FreeRDP",
  351. "hash": 303361272103618703355733933078905733598,
  352. "size": 13,
  353. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  354. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  355. "target": 0,
  356. "dataset": "other",
  357. "idx": 409681
  358. },
  359. {
  360. "func": "static BOOL rdp_write_virtual_channel_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT32 flags;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tflags = VCCAPS_NO_COMPR;\n\tStream_Write_UINT32(s, flags); /* flags (4 bytes) */\n\tStream_Write_UINT32(s, settings->VirtualChannelChunkSize); /* VCChunkSize (4 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_VIRTUAL_CHANNEL);\n\treturn TRUE;\n}",
  361. "project": "FreeRDP",
  362. "hash": 307084930192072983573817185031030778059,
  363. "size": 15,
  364. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  365. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  366. "target": 0,
  367. "dataset": "other",
  368. "idx": 409688
  369. },
  370. {
  371. "func": "BOOL rdp_recv_confirm_active(rdpRdp* rdp, wStream* s, UINT16 pduLength)\n{\n\trdpSettings* settings;\n\tUINT16 lengthSourceDescriptor;\n\tUINT16 lengthCombinedCapabilities;\n\tUINT16 numberCapabilities;\n\tsettings = rdp->settings;\n\n\tif (Stream_GetRemainingLength(s) < 10)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT32(s); /* shareId (4 bytes) */\n\tStream_Seek_UINT16(s); /* originatorId (2 bytes) */\n\tStream_Read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */\n\tStream_Read_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */\n\n\tif (Stream_GetRemainingLength(s) < lengthSourceDescriptor + 4U)\n\t\treturn FALSE;\n\n\tStream_Seek(s, lengthSourceDescriptor); /* sourceDescriptor */\n\tStream_Read_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */\n\tStream_Seek(s, 2); /* pad2Octets (2 bytes) */\n\tif (!rdp_read_capability_sets(s, rdp->settings, numberCapabilities, lengthCombinedCapabilities))\n\t\treturn FALSE;\n\n\tif (!settings->ReceivedCapabilities[CAPSET_TYPE_SURFACE_COMMANDS])\n\t{\n\t\t/* client does not support surface commands */\n\t\tsettings->SurfaceCommandsEnabled = FALSE;\n\t\tsettings->SurfaceFrameMarkerEnabled = FALSE;\n\t}\n\n\tif (!settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE])\n\t{\n\t\t/* client does not support frame acks */\n\t\tsettings->FrameAcknowledge = 0;\n\t}\n\n\tif (!settings->ReceivedCapabilities[CAPSET_TYPE_BITMAP_CACHE_V3_CODEC_ID])\n\t{\n\t\t/* client does not support bitmap cache v3 */\n\t\tsettings->BitmapCacheV3Enabled = FALSE;\n\t}\n\n\tif (!settings->ReceivedCapabilities[CAPSET_TYPE_BITMAP_CODECS])\n\t{\n\t\t/* client does not support bitmap codecs */\n\t\tsettings->RemoteFxCodec = FALSE;\n\t\tsettings->NSCodec = FALSE;\n\t\tsettings->JpegCodec = FALSE;\n\t}\n\n\tif (!settings->ReceivedCapabilities[CAPSET_TYPE_MULTI_FRAGMENT_UPDATE])\n\t{\n\t\t/* client does not support multi fragment updates - make sure packages are not fragmented */\n\t\tsettings->MultifragMaxRequestSize = FASTPATH_FRAGMENT_SAFE_SIZE;\n\t}\n\n\tif (!settings->ReceivedCapabilities[CAPSET_TYPE_LARGE_POINTER])\n\t{\n\t\t/* client does not support large pointers */\n\t\tsettings->LargePointerFlag = 0;\n\t}\n\n\treturn tpkt_ensure_stream_consumed(s, pduLength);\n}",
  372. "project": "FreeRDP",
  373. "hash": 91493289017108646570943692625390752372,
  374. "size": 66,
  375. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  376. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  377. "target": 0,
  378. "dataset": "other",
  379. "idx": 409640
  380. },
  381. {
  382. "func": "static BOOL rdp_write_large_pointer_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 largePointerSupportFlags;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tlargePointerSupportFlags =\n\t settings->LargePointerFlag & (LARGE_POINTER_FLAG_96x96 | LARGE_POINTER_FLAG_384x384);\n\tStream_Write_UINT16(s, largePointerSupportFlags); /* largePointerSupportFlags (2 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_LARGE_POINTER);\n\treturn TRUE;\n}",
  383. "project": "FreeRDP",
  384. "hash": 109685188564620579761907320676178023525,
  385. "size": 15,
  386. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  387. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  388. "target": 0,
  389. "dataset": "other",
  390. "idx": 409616
  391. },
  392. {
  393. "func": "static BOOL rdp_write_frame_acknowledge_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT32(s, settings->FrameAcknowledge); /* (4 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_FRAME_ACKNOWLEDGE);\n\treturn TRUE;\n}",
  394. "project": "FreeRDP",
  395. "hash": 191472304007744135114926456006727424452,
  396. "size": 14,
  397. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  398. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  399. "target": 0,
  400. "dataset": "other",
  401. "idx": 409591
  402. },
  403. {
  404. "func": "static BOOL rdp_print_sound_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 soundFlags;\n\tUINT16 pad2OctetsA;\n\tWLog_INFO(TAG, \"SoundCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, soundFlags); /* soundFlags (2 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsA); /* pad2OctetsA (2 bytes) */\n\tWLog_INFO(TAG, \"\\tsoundFlags: 0x%04\" PRIX16 \"\", soundFlags);\n\tWLog_INFO(TAG, \"\\tpad2OctetsA: 0x%04\" PRIX16 \"\", pad2OctetsA);\n\treturn TRUE;\n}",
  405. "project": "FreeRDP",
  406. "hash": 270468318396106321627842466475171868710,
  407. "size": 15,
  408. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  409. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  410. "target": 0,
  411. "dataset": "other",
  412. "idx": 409690
  413. },
  414. {
  415. "func": "static BOOL rdp_print_offscreen_bitmap_cache_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 offscreenSupportLevel;\n\tUINT16 offscreenCacheSize;\n\tUINT16 offscreenCacheEntries;\n\tWLog_INFO(TAG, \"OffscreenBitmapCacheCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, offscreenSupportLevel); /* offscreenSupportLevel (4 bytes) */\n\tStream_Read_UINT16(s, offscreenCacheSize); /* offscreenCacheSize (2 bytes) */\n\tStream_Read_UINT16(s, offscreenCacheEntries); /* offscreenCacheEntries (2 bytes) */\n\tWLog_INFO(TAG, \"\\toffscreenSupportLevel: 0x%08\" PRIX32 \"\", offscreenSupportLevel);\n\tWLog_INFO(TAG, \"\\toffscreenCacheSize: 0x%04\" PRIX16 \"\", offscreenCacheSize);\n\tWLog_INFO(TAG, \"\\toffscreenCacheEntries: 0x%04\" PRIX16 \"\", offscreenCacheEntries);\n\treturn TRUE;\n}",
  416. "project": "FreeRDP",
  417. "hash": 52430610983265653194826083004421839498,
  418. "size": 18,
  419. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  420. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  421. "target": 0,
  422. "dataset": "other",
  423. "idx": 409663
  424. },
  425. {
  426. "func": "static void rdp_read_bitmap_codec_guid(wStream* s, GUID* guid)\n{\n\tBYTE g[16];\n\tStream_Read(s, g, 16);\n\tguid->Data1 = (g[3] << 24) | (g[2] << 16) | (g[1] << 8) | g[0];\n\tguid->Data2 = (g[5] << 8) | g[4];\n\tguid->Data3 = (g[7] << 8) | g[6];\n\tguid->Data4[0] = g[8];\n\tguid->Data4[1] = g[9];\n\tguid->Data4[2] = g[10];\n\tguid->Data4[3] = g[11];\n\tguid->Data4[4] = g[12];\n\tguid->Data4[5] = g[13];\n\tguid->Data4[6] = g[14];\n\tguid->Data4[7] = g[15];\n}",
  427. "project": "FreeRDP",
  428. "hash": 4886774312460546608647694875224936828,
  429. "size": 16,
  430. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  431. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  432. "target": 0,
  433. "dataset": "other",
  434. "idx": 409620
  435. },
  436. {
  437. "func": "static BOOL rdp_print_frame_acknowledge_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 frameAcknowledge;\n\tWLog_INFO(TAG, \"FrameAcknowledgeCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, frameAcknowledge); /* frameAcknowledge (4 bytes) */\n\tWLog_INFO(TAG, \"\\tframeAcknowledge: 0x%08\" PRIX32 \"\", frameAcknowledge);\n\treturn TRUE;\n}",
  438. "project": "FreeRDP",
  439. "hash": 160917538292160124231779813896302866645,
  440. "size": 12,
  441. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  442. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  443. "target": 0,
  444. "dataset": "other",
  445. "idx": 409678
  446. },
  447. {
  448. "func": "static void rdp_write_cache_definition(wStream* s, GLYPH_CACHE_DEFINITION* cache_definition)\n{\n\tStream_Write_UINT16(s, cache_definition->cacheEntries); /* cacheEntries (2 bytes) */\n\tStream_Write_UINT16(\n\t s, cache_definition->cacheMaximumCellSize); /* cacheMaximumCellSize (2 bytes) */\n}",
  449. "project": "FreeRDP",
  450. "hash": 242617420166332381831381736771931983231,
  451. "size": 6,
  452. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  453. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  454. "target": 0,
  455. "dataset": "other",
  456. "idx": 409593
  457. },
  458. {
  459. "func": "static BOOL rdp_write_confirm_active(wStream* s, rdpSettings* settings)\n{\n\tsize_t bm, em, lm;\n\tUINT16 numberCapabilities;\n\tUINT16 lengthSourceDescriptor;\n\tsize_t lengthCombinedCapabilities;\n\tBOOL ret;\n\tlengthSourceDescriptor = sizeof(SOURCE_DESCRIPTOR);\n\tStream_Write_UINT32(s, settings->ShareId); /* shareId (4 bytes) */\n\tStream_Write_UINT16(s, 0x03EA); /* originatorId (2 bytes) */\n\tStream_Write_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */\n\tlm = Stream_GetPosition(s);\n\tStream_Seek_UINT16(s); /* lengthCombinedCapabilities (2 bytes) */\n\tStream_Write(s, SOURCE_DESCRIPTOR, lengthSourceDescriptor); /* sourceDescriptor */\n\tbm = Stream_GetPosition(s);\n\tStream_Seek_UINT16(s); /* numberCapabilities (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */\n\t/* Capability Sets */\n\tnumberCapabilities = 15;\n\n\tif (!rdp_write_general_capability_set(s, settings) ||\n\t !rdp_write_bitmap_capability_set(s, settings) ||\n\t !rdp_write_order_capability_set(s, settings))\n\t\treturn FALSE;\n\n\tif (settings->RdpVersion >= RDP_VERSION_5_PLUS)\n\t\tret = rdp_write_bitmap_cache_v2_capability_set(s, settings);\n\telse\n\t\tret = rdp_write_bitmap_cache_capability_set(s, settings);\n\n\tif (!ret)\n\t\treturn FALSE;\n\n\tif (!rdp_write_pointer_capability_set(s, settings) ||\n\t !rdp_write_input_capability_set(s, settings) ||\n\t !rdp_write_brush_capability_set(s, settings) ||\n\t !rdp_write_glyph_cache_capability_set(s, settings) ||\n\t !rdp_write_virtual_channel_capability_set(s, settings) ||\n\t !rdp_write_sound_capability_set(s, settings) ||\n\t !rdp_write_share_capability_set(s, settings) ||\n\t !rdp_write_font_capability_set(s, settings) ||\n\t !rdp_write_control_capability_set(s, settings) ||\n\t !rdp_write_color_cache_capability_set(s, settings) ||\n\t !rdp_write_window_activation_capability_set(s, settings))\n\t{\n\t\treturn FALSE;\n\t}\n\n\tif (settings->OffscreenSupportLevel)\n\t{\n\t\tnumberCapabilities++;\n\n\t\tif (!rdp_write_offscreen_bitmap_cache_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (settings->DrawNineGridEnabled)\n\t{\n\t\tnumberCapabilities++;\n\n\t\tif (!rdp_write_draw_nine_grid_cache_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (settings->ReceivedCapabilities[CAPSET_TYPE_LARGE_POINTER])\n\t{\n\t\tif (settings->LargePointerFlag)\n\t\t{\n\t\t\tnumberCapabilities++;\n\n\t\t\tif (!rdp_write_large_pointer_capability_set(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\tif (settings->RemoteApplicationMode)\n\t{\n\t\tnumberCapabilities += 2;\n\n\t\tif (!rdp_write_remote_programs_capability_set(s, settings) ||\n\t\t !rdp_write_window_list_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (settings->ReceivedCapabilities[CAPSET_TYPE_MULTI_FRAGMENT_UPDATE])\n\t{\n\t\tnumberCapabilities++;\n\n\t\tif (!rdp_write_multifragment_update_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (settings->ReceivedCapabilities[CAPSET_TYPE_SURFACE_COMMANDS])\n\t{\n\t\tnumberCapabilities++;\n\n\t\tif (!rdp_write_surface_commands_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (settings->ReceivedCapabilities[CAPSET_TYPE_BITMAP_CODECS])\n\t{\n\t\tnumberCapabilities++;\n\n\t\tif (!rdp_write_bitmap_codecs_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (!settings->ReceivedCapabilities[CAPSET_TYPE_FRAME_ACKNOWLEDGE])\n\t\tsettings->FrameAcknowledge = 0;\n\n\tif (settings->FrameAcknowledge)\n\t{\n\t\tnumberCapabilities++;\n\n\t\tif (!rdp_write_frame_acknowledge_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (settings->ReceivedCapabilities[CAPSET_TYPE_BITMAP_CACHE_V3_CODEC_ID])\n\t{\n\t\tif (settings->BitmapCacheV3CodecId != 0)\n\t\t{\n\t\t\tnumberCapabilities++;\n\n\t\t\tif (!rdp_write_bitmap_cache_v3_codec_id_capability_set(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\tem = Stream_GetPosition(s);\n\tStream_SetPosition(s, lm); /* go back to lengthCombinedCapabilities */\n\tlengthCombinedCapabilities = (em - bm);\n\tif (lengthCombinedCapabilities > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(\n\t s, (UINT16)lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */\n\tStream_SetPosition(s, bm); /* go back to numberCapabilities */\n\tStream_Write_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */\n#ifdef WITH_DEBUG_CAPABILITIES\n\tStream_Seek_UINT16(s);\n\trdp_print_capability_sets(s, numberCapabilities, FALSE);\n\tStream_SetPosition(s, bm);\n\tStream_Seek_UINT16(s);\n#endif\n\tStream_SetPosition(s, em);\n\n\treturn TRUE;\n}",
  460. "project": "FreeRDP",
  461. "hash": 327946317814750375154764007246473998380,
  462. "size": 149,
  463. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  464. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  465. "target": 0,
  466. "dataset": "other",
  467. "idx": 409592
  468. },
  469. {
  470. "func": "static BOOL rdp_write_surface_commands_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT32 cmdFlags;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tcmdFlags = SURFCMDS_SET_SURFACE_BITS | SURFCMDS_STREAM_SURFACE_BITS;\n\n\tif (settings->SurfaceFrameMarkerEnabled)\n\t\tcmdFlags |= SURFCMDS_FRAME_MARKER;\n\n\tStream_Write_UINT32(s, cmdFlags); /* cmdFlags (4 bytes) */\n\tStream_Write_UINT32(s, 0); /* reserved (4 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_SURFACE_COMMANDS);\n\treturn TRUE;\n}",
  471. "project": "FreeRDP",
  472. "hash": 265887635769419825443180195929426885533,
  473. "size": 19,
  474. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  475. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  476. "target": 0,
  477. "dataset": "other",
  478. "idx": 409621
  479. },
  480. {
  481. "func": "static char* rdp_get_bitmap_codec_guid_name(const GUID* guid)\n{\n\tRPC_STATUS rpc_status;\n\n\tif (UuidEqual(guid, &CODEC_GUID_REMOTEFX, &rpc_status))\n\t\treturn \"CODEC_GUID_REMOTEFX\";\n\telse if (UuidEqual(guid, &CODEC_GUID_NSCODEC, &rpc_status))\n\t\treturn \"CODEC_GUID_NSCODEC\";\n\telse if (UuidEqual(guid, &CODEC_GUID_IGNORE, &rpc_status))\n\t\treturn \"CODEC_GUID_IGNORE\";\n\telse if (UuidEqual(guid, &CODEC_GUID_IMAGE_REMOTEFX, &rpc_status))\n\t\treturn \"CODEC_GUID_IMAGE_REMOTEFX\";\n\n#if defined(WITH_JPEG)\n\telse if (UuidEqual(guid, &CODEC_GUID_JPEG, &rpc_status))\n\t\treturn \"CODEC_GUID_JPEG\";\n\n#endif\n\treturn \"CODEC_GUID_UNKNOWN\";\n}",
  482. "project": "FreeRDP",
  483. "hash": 155254763281841975956016535383696375092,
  484. "size": 20,
  485. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  486. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  487. "target": 0,
  488. "dataset": "other",
  489. "idx": 409680
  490. },
  491. {
  492. "func": "static BOOL rdp_read_control_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT16(s); /* controlFlags (2 bytes) */\n\tStream_Seek_UINT16(s); /* remoteDetachFlag (2 bytes) */\n\tStream_Seek_UINT16(s); /* controlInterest (2 bytes) */\n\tStream_Seek_UINT16(s); /* detachInterest (2 bytes) */\n\treturn TRUE;\n}",
  493. "project": "FreeRDP",
  494. "hash": 246788064512336968283169931181073093043,
  495. "size": 12,
  496. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  497. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  498. "target": 0,
  499. "dataset": "other",
  500. "idx": 409614
  501. },
  502. {
  503. "func": "static BOOL rdp_print_draw_nine_grid_cache_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 drawNineGridSupportLevel;\n\tUINT16 DrawNineGridCacheSize;\n\tUINT16 DrawNineGridCacheEntries;\n\tWLog_INFO(TAG, \"DrawNineGridCacheCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */\n\tStream_Read_UINT16(s, DrawNineGridCacheSize); /* drawNineGridCacheSize (2 bytes) */\n\tStream_Read_UINT16(s, DrawNineGridCacheEntries); /* drawNineGridCacheEntries (2 bytes) */\n\treturn TRUE;\n}",
  504. "project": "FreeRDP",
  505. "hash": 99697391840067480834853895868286238230,
  506. "size": 15,
  507. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  508. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  509. "target": 0,
  510. "dataset": "other",
  511. "idx": 409579
  512. },
  513. {
  514. "func": "static BOOL rdp_read_font_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length > 4)\n\t\tStream_Seek_UINT16(s); /* fontSupportFlags (2 bytes) */\n\n\tif (length > 6)\n\t\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\n\treturn TRUE;\n}",
  515. "project": "FreeRDP",
  516. "hash": 63945765978373457675419959857261610616,
  517. "size": 11,
  518. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  519. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  520. "target": 1,
  521. "dataset": "other",
  522. "idx": 208417
  523. },
  524. {
  525. "func": "static BOOL rdp_read_font_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length > 5)\n\t\tStream_Seek_UINT16(s); /* fontSupportFlags (2 bytes) */\n\n\tif (length > 7)\n\t\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\n\treturn TRUE;\n}",
  526. "project": "FreeRDP",
  527. "hash": 92561895110037279576315503246460434637,
  528. "size": 11,
  529. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  530. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  531. "target": 0,
  532. "dataset": "other",
  533. "idx": 409646
  534. },
  535. {
  536. "func": "static BOOL rdp_print_large_pointer_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 largePointerSupportFlags;\n\tWLog_INFO(TAG, \"LargePointerCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 6)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, largePointerSupportFlags); /* largePointerSupportFlags (2 bytes) */\n\tWLog_INFO(TAG, \"\\tlargePointerSupportFlags: 0x%04\" PRIX16 \"\", largePointerSupportFlags);\n\treturn TRUE;\n}",
  537. "project": "FreeRDP",
  538. "hash": 339958623772639294175049811240387745622,
  539. "size": 12,
  540. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  541. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  542. "target": 0,
  543. "dataset": "other",
  544. "idx": 409623
  545. },
  546. {
  547. "func": "static BOOL rdp_read_window_activation_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT16(s); /* helpKeyFlag (2 bytes) */\n\tStream_Seek_UINT16(s); /* helpKeyIndexFlag (2 bytes) */\n\tStream_Seek_UINT16(s); /* helpExtendedKeyFlag (2 bytes) */\n\tStream_Seek_UINT16(s); /* windowManagerKeyFlag (2 bytes) */\n\treturn TRUE;\n}",
  548. "project": "FreeRDP",
  549. "hash": 92929385624240835162166734974587379320,
  550. "size": 13,
  551. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  552. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  553. "target": 0,
  554. "dataset": "other",
  555. "idx": 409684
  556. },
  557. {
  558. "func": "static void rdp_print_bitmap_codec_guid(const GUID* guid)\n{\n\tWLog_INFO(TAG,\n\t \"%08\" PRIX32 \"%04\" PRIX16 \"%04\" PRIX16 \"%02\" PRIX8 \"%02\" PRIX8 \"%02\" PRIX8 \"%02\" PRIX8\n\t \"%02\" PRIX8 \"%02\" PRIX8 \"%02\" PRIX8 \"%02\" PRIX8 \"\",\n\t guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2],\n\t guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);\n}",
  559. "project": "FreeRDP",
  560. "hash": 77099897294778299773712257711439024635,
  561. "size": 8,
  562. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  563. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  564. "target": 0,
  565. "dataset": "other",
  566. "idx": 409651
  567. },
  568. {
  569. "func": "static BOOL rdp_print_window_list_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 wndSupportLevel;\n\tBYTE numIconCaches;\n\tUINT16 numIconCacheEntries;\n\tWLog_INFO(TAG, \"WindowListCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 11)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, wndSupportLevel); /* wndSupportLevel (4 bytes) */\n\tStream_Read_UINT8(s, numIconCaches); /* numIconCaches (1 byte) */\n\tStream_Read_UINT16(s, numIconCacheEntries); /* numIconCacheEntries (2 bytes) */\n\tWLog_INFO(TAG, \"\\twndSupportLevel: 0x%08\" PRIX32 \"\", wndSupportLevel);\n\tWLog_INFO(TAG, \"\\tnumIconCaches: 0x%02\" PRIX8 \"\", numIconCaches);\n\tWLog_INFO(TAG, \"\\tnumIconCacheEntries: 0x%04\" PRIX16 \"\", numIconCacheEntries);\n\treturn TRUE;\n}",
  570. "project": "FreeRDP",
  571. "hash": 56084745407537054957836216665066621553,
  572. "size": 18,
  573. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  574. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  575. "target": 0,
  576. "dataset": "other",
  577. "idx": 409638
  578. },
  579. {
  580. "func": "static BOOL rdp_write_share_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 nodeId;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tnodeId = (settings->ServerMode) ? 0x03EA : 0;\n\tStream_Write_UINT16(s, nodeId); /* nodeId (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_SHARE);\n\treturn TRUE;\n}",
  581. "project": "FreeRDP",
  582. "hash": 26910384615262271113922396983420701080,
  583. "size": 17,
  584. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  585. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  586. "target": 0,
  587. "dataset": "other",
  588. "idx": 409596
  589. },
  590. {
  591. "func": "static BOOL rdp_print_brush_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 brushSupportLevel;\n\tWLog_INFO(TAG, \"BrushCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, brushSupportLevel); /* brushSupportLevel (4 bytes) */\n\tWLog_INFO(TAG, \"\\tbrushSupportLevel: 0x%08\" PRIX32 \"\", brushSupportLevel);\n\treturn TRUE;\n}",
  592. "project": "FreeRDP",
  593. "hash": 285436586425045297137013893498254341233,
  594. "size": 12,
  595. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  596. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  597. "target": 0,
  598. "dataset": "other",
  599. "idx": 409581
  600. },
  601. {
  602. "func": "static BOOL rdp_read_desktop_composition_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tif (length < 6)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT16(s); /* compDeskSupportLevel (2 bytes) */\n\treturn TRUE;\n}",
  603. "project": "FreeRDP",
  604. "hash": 257896305155583954962696210326662575434,
  605. "size": 9,
  606. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  607. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  608. "target": 0,
  609. "dataset": "other",
  610. "idx": 409612
  611. },
  612. {
  613. "func": "static BOOL rdp_write_offscreen_bitmap_cache_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT32 offscreenSupportLevel = 0x00;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tif (settings->OffscreenSupportLevel)\n\t{\n\t\toffscreenSupportLevel = 0x01;\n\t\tStream_Write_UINT32(s, offscreenSupportLevel); /* offscreenSupportLevel (4 bytes) */\n\t\tStream_Write_UINT16(s, settings->OffscreenCacheSize); /* offscreenCacheSize (2 bytes) */\n\t\tStream_Write_UINT16(s,\n\t\t settings->OffscreenCacheEntries); /* offscreenCacheEntries (2 bytes) */\n\t}\n\telse\n\t\tStream_Zero(s, 8);\n\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_OFFSCREEN_CACHE);\n\treturn TRUE;\n}",
  614. "project": "FreeRDP",
  615. "hash": 34976567181626346706020341189913124378,
  616. "size": 25,
  617. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  618. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  619. "target": 0,
  620. "dataset": "other",
  621. "idx": 409672
  622. },
  623. {
  624. "func": "static BOOL rdp_print_bitmap_cache_v2_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 cacheFlags;\n\tBYTE pad2;\n\tBYTE numCellCaches;\n\tBITMAP_CACHE_V2_CELL_INFO bitmapCacheV2CellInfo[5];\n\tWLog_INFO(TAG, \"BitmapCacheV2CapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 40)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, cacheFlags); /* cacheFlags (2 bytes) */\n\tStream_Read_UINT8(s, pad2); /* pad2 (1 byte) */\n\tStream_Read_UINT8(s, numCellCaches); /* numCellCaches (1 byte) */\n\trdp_read_bitmap_cache_cell_info(s,\n\t &bitmapCacheV2CellInfo[0]); /* bitmapCache0CellInfo (4 bytes) */\n\trdp_read_bitmap_cache_cell_info(s,\n\t &bitmapCacheV2CellInfo[1]); /* bitmapCache1CellInfo (4 bytes) */\n\trdp_read_bitmap_cache_cell_info(s,\n\t &bitmapCacheV2CellInfo[2]); /* bitmapCache2CellInfo (4 bytes) */\n\trdp_read_bitmap_cache_cell_info(s,\n\t &bitmapCacheV2CellInfo[3]); /* bitmapCache3CellInfo (4 bytes) */\n\trdp_read_bitmap_cache_cell_info(s,\n\t &bitmapCacheV2CellInfo[4]); /* bitmapCache4CellInfo (4 bytes) */\n\tStream_Seek(s, 12); /* pad3 (12 bytes) */\n\tWLog_INFO(TAG, \"\\tcacheFlags: 0x%04\" PRIX16 \"\", cacheFlags);\n\tWLog_INFO(TAG, \"\\tpad2: 0x%02\" PRIX8 \"\", pad2);\n\tWLog_INFO(TAG, \"\\tnumCellCaches: 0x%02\" PRIX8 \"\", numCellCaches);\n\tWLog_INFO(TAG, \"\\tbitmapCache0CellInfo: numEntries: %\" PRIu32 \" persistent: %\" PRId32 \"\",\n\t bitmapCacheV2CellInfo[0].numEntries, bitmapCacheV2CellInfo[0].persistent);\n\tWLog_INFO(TAG, \"\\tbitmapCache1CellInfo: numEntries: %\" PRIu32 \" persistent: %\" PRId32 \"\",\n\t bitmapCacheV2CellInfo[1].numEntries, bitmapCacheV2CellInfo[1].persistent);\n\tWLog_INFO(TAG, \"\\tbitmapCache2CellInfo: numEntries: %\" PRIu32 \" persistent: %\" PRId32 \"\",\n\t bitmapCacheV2CellInfo[2].numEntries, bitmapCacheV2CellInfo[2].persistent);\n\tWLog_INFO(TAG, \"\\tbitmapCache3CellInfo: numEntries: %\" PRIu32 \" persistent: %\" PRId32 \"\",\n\t bitmapCacheV2CellInfo[3].numEntries, bitmapCacheV2CellInfo[3].persistent);\n\tWLog_INFO(TAG, \"\\tbitmapCache4CellInfo: numEntries: %\" PRIu32 \" persistent: %\" PRId32 \"\",\n\t bitmapCacheV2CellInfo[4].numEntries, bitmapCacheV2CellInfo[4].persistent);\n\treturn TRUE;\n}",
  625. "project": "FreeRDP",
  626. "hash": 296655781578711417366859937464765040063,
  627. "size": 40,
  628. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  629. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  630. "target": 0,
  631. "dataset": "other",
  632. "idx": 409608
  633. },
  634. {
  635. "func": "static BOOL rdp_read_general_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tUINT16 extraFlags;\n\tBYTE refreshRectSupport;\n\tBYTE suppressOutputSupport;\n\n\tif (length < 24)\n\t\treturn FALSE;\n\n\tif (settings->ServerMode)\n\t{\n\t\tStream_Read_UINT16(s, settings->OsMajorType); /* osMajorType (2 bytes) */\n\t\tStream_Read_UINT16(s, settings->OsMinorType); /* osMinorType (2 bytes) */\n\t}\n\telse\n\t{\n\t\tStream_Seek_UINT16(s); /* osMajorType (2 bytes) */\n\t\tStream_Seek_UINT16(s); /* osMinorType (2 bytes) */\n\t}\n\n\tStream_Seek_UINT16(s); /* protocolVersion (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */\n\tStream_Seek_UINT16(s); /* generalCompressionTypes (2 bytes) */\n\tStream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */\n\tStream_Seek_UINT16(s); /* updateCapabilityFlag (2 bytes) */\n\tStream_Seek_UINT16(s); /* remoteUnshareFlag (2 bytes) */\n\tStream_Seek_UINT16(s); /* generalCompressionLevel (2 bytes) */\n\tStream_Read_UINT8(s, refreshRectSupport); /* refreshRectSupport (1 byte) */\n\tStream_Read_UINT8(s, suppressOutputSupport); /* suppressOutputSupport (1 byte) */\n\tsettings->NoBitmapCompressionHeader = (extraFlags & NO_BITMAP_COMPRESSION_HDR) ? TRUE : FALSE;\n\tsettings->LongCredentialsSupported = (extraFlags & LONG_CREDENTIALS_SUPPORTED) ? TRUE : FALSE;\n\n\tif (!(extraFlags & FASTPATH_OUTPUT_SUPPORTED))\n\t\tsettings->FastPathOutput = FALSE;\n\n\tif (!(extraFlags & ENC_SALTED_CHECKSUM))\n\t\tsettings->SaltedChecksum = FALSE;\n\n\tif (!settings->ServerMode)\n\t{\n\t\t/**\n\t\t * Note: refreshRectSupport and suppressOutputSupport are\n\t\t * server-only flags indicating to the client weather the\n\t\t * respective PDUs are supported. See MS-RDPBCGR 2.2.7.1.1\n\t\t */\n\t\tif (!refreshRectSupport)\n\t\t\tsettings->RefreshRect = FALSE;\n\n\t\tif (!suppressOutputSupport)\n\t\t\tsettings->SuppressOutput = FALSE;\n\t}\n\n\treturn TRUE;\n}",
  636. "project": "FreeRDP",
  637. "hash": 849871180783904750462910493265742730,
  638. "size": 54,
  639. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  640. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  641. "target": 0,
  642. "dataset": "other",
  643. "idx": 409649
  644. },
  645. {
  646. "func": "static BOOL rdp_write_rfx_server_capability_container(wStream* s, const rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 8))\n\t\treturn FALSE;\n\n\tStream_Write_UINT16(s, 4); /* codecPropertiesLength */\n\tStream_Write_UINT32(s, 0); /* reserved */\n\treturn TRUE;\n}",
  647. "project": "FreeRDP",
  648. "hash": 30381998541812809023414048959611680622,
  649. "size": 10,
  650. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  651. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  652. "target": 0,
  653. "dataset": "other",
  654. "idx": 409647
  655. },
  656. {
  657. "func": "static BOOL rdp_print_color_cache_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 colorTableCacheSize;\n\tUINT16 pad2Octets;\n\tWLog_INFO(TAG, \"ColorCacheCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, colorTableCacheSize); /* colorTableCacheSize (2 bytes) */\n\tStream_Read_UINT16(s, pad2Octets); /* pad2Octets (2 bytes) */\n\tWLog_INFO(TAG, \"\\tcolorTableCacheSize: 0x%04\" PRIX16 \"\", colorTableCacheSize);\n\tWLog_INFO(TAG, \"\\tpad2Octets: 0x%04\" PRIX16 \"\", pad2Octets);\n\treturn TRUE;\n}",
  658. "project": "FreeRDP",
  659. "hash": 147412173596886311190003265789714347848,
  660. "size": 15,
  661. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  662. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  663. "target": 0,
  664. "dataset": "other",
  665. "idx": 409682
  666. },
  667. {
  668. "func": "static BOOL rdp_read_virtual_channel_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tUINT32 flags;\n\tUINT32 VCChunkSize;\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, flags); /* flags (4 bytes) */\n\n\tif (length > 8)\n\t\tStream_Read_UINT32(s, VCChunkSize); /* VCChunkSize (4 bytes) */\n\telse\n\t\tVCChunkSize = 1600;\n\n\tif (settings->ServerMode != TRUE)\n\t\tsettings->VirtualChannelChunkSize = VCChunkSize;\n\n\treturn TRUE;\n}",
  669. "project": "FreeRDP",
  670. "hash": 290598108437996799579687211407031343101,
  671. "size": 21,
  672. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  673. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  674. "target": 0,
  675. "dataset": "other",
  676. "idx": 409597
  677. },
  678. {
  679. "func": "static BOOL rdp_read_order_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tint i;\n\tUINT16 orderFlags;\n\tBYTE orderSupport[32];\n\tUINT16 orderSupportExFlags;\n\tBOOL BitmapCacheV3Enabled = FALSE;\n\tBOOL FrameMarkerCommandEnabled = FALSE;\n\n\tif (length < 88)\n\t\treturn FALSE;\n\n\tStream_Seek(s, 16); /* terminalDescriptor (16 bytes) */\n\tStream_Seek_UINT32(s); /* pad4OctetsA (4 bytes) */\n\tStream_Seek_UINT16(s); /* desktopSaveXGranularity (2 bytes) */\n\tStream_Seek_UINT16(s); /* desktopSaveYGranularity (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */\n\tStream_Seek_UINT16(s); /* maximumOrderLevel (2 bytes) */\n\tStream_Seek_UINT16(s); /* numberFonts (2 bytes) */\n\tStream_Read_UINT16(s, orderFlags); /* orderFlags (2 bytes) */\n\tStream_Read(s, orderSupport, 32); /* orderSupport (32 bytes) */\n\tStream_Seek_UINT16(s); /* textFlags (2 bytes) */\n\tStream_Read_UINT16(s, orderSupportExFlags); /* orderSupportExFlags (2 bytes) */\n\tStream_Seek_UINT32(s); /* pad4OctetsB (4 bytes) */\n\tStream_Seek_UINT32(s); /* desktopSaveSize (4 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsC (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsD (2 bytes) */\n\tStream_Seek_UINT16(s); /* textANSICodePage (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsE (2 bytes) */\n\n\tfor (i = 0; i < 32; i++)\n\t{\n\t\tif (orderSupport[i] == FALSE)\n\t\t\tsettings->OrderSupport[i] = FALSE;\n\t}\n\n\tif (orderFlags & ORDER_FLAGS_EXTRA_SUPPORT)\n\t{\n\t\tif (orderSupportExFlags & CACHE_BITMAP_V3_SUPPORT)\n\t\t\tBitmapCacheV3Enabled = TRUE;\n\n\t\tif (orderSupportExFlags & ALTSEC_FRAME_MARKER_SUPPORT)\n\t\t\tFrameMarkerCommandEnabled = TRUE;\n\t}\n\n\tif (settings->BitmapCacheV3Enabled && BitmapCacheV3Enabled)\n\t\tsettings->BitmapCacheVersion = 3;\n\telse\n\t\tsettings->BitmapCacheV3Enabled = FALSE;\n\n\tif (settings->FrameMarkerCommandEnabled && !FrameMarkerCommandEnabled)\n\t\tsettings->FrameMarkerCommandEnabled = FALSE;\n\n\treturn TRUE;\n}",
  680. "project": "FreeRDP",
  681. "hash": 189672869918992028391314712470791613301,
  682. "size": 55,
  683. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  684. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  685. "target": 0,
  686. "dataset": "other",
  687. "idx": 409676
  688. },
  689. {
  690. "func": "static BOOL rdp_write_nsc_server_capability_container(wStream* s, const rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 8))\n\t\treturn FALSE;\n\n\tStream_Write_UINT16(s, 4); /* codecPropertiesLength */\n\tStream_Write_UINT32(s, 0); /* reserved */\n\treturn TRUE;\n}",
  691. "project": "FreeRDP",
  692. "hash": 60725325689248985919258800414909485501,
  693. "size": 10,
  694. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  695. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  696. "target": 0,
  697. "dataset": "other",
  698. "idx": 409601
  699. },
  700. {
  701. "func": "static BOOL rdp_write_bitmap_cache_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tUINT32 bpp;\n\tsize_t header;\n\tUINT32 size;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tbpp = (settings->ColorDepth + 7) / 8;\n\tif (bpp > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT32(s, 0); /* pad1 (4 bytes) */\n\tStream_Write_UINT32(s, 0); /* pad2 (4 bytes) */\n\tStream_Write_UINT32(s, 0); /* pad3 (4 bytes) */\n\tStream_Write_UINT32(s, 0); /* pad4 (4 bytes) */\n\tStream_Write_UINT32(s, 0); /* pad5 (4 bytes) */\n\tStream_Write_UINT32(s, 0); /* pad6 (4 bytes) */\n\tsize = bpp * 256;\n\tif (size > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(s, 200); /* Cache0Entries (2 bytes) */\n\tStream_Write_UINT16(s, (UINT16)size); /* Cache0MaximumCellSize (2 bytes) */\n\tsize = bpp * 1024;\n\tif (size > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(s, 600); /* Cache1Entries (2 bytes) */\n\tStream_Write_UINT16(s, (UINT16)size); /* Cache1MaximumCellSize (2 bytes) */\n\tsize = bpp * 4096;\n\tif (size > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(s, 1000); /* Cache2Entries (2 bytes) */\n\tStream_Write_UINT16(s, (UINT16)size); /* Cache2MaximumCellSize (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_BITMAP_CACHE);\n\treturn TRUE;\n}",
  702. "project": "FreeRDP",
  703. "hash": 121157721180275409455921259823027389764,
  704. "size": 39,
  705. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  706. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  707. "target": 0,
  708. "dataset": "other",
  709. "idx": 409648
  710. },
  711. {
  712. "func": "static BOOL rdp_read_brush_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT32(s); /* brushSupportLevel (4 bytes) */\n\treturn TRUE;\n}",
  713. "project": "FreeRDP",
  714. "hash": 201932960273049902456905707665273606852,
  715. "size": 9,
  716. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  717. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  718. "target": 0,
  719. "dataset": "other",
  720. "idx": 409603
  721. },
  722. {
  723. "func": "static BOOL rdp_write_nsc_client_capability_container(wStream* s, const rdpSettings* settings)\n{\n\tBYTE colorLossLevel;\n\tBYTE fAllowSubsampling;\n\tBYTE fAllowDynamicFidelity;\n\tfAllowDynamicFidelity = settings->NSCodecAllowDynamicColorFidelity;\n\tfAllowSubsampling = settings->NSCodecAllowSubsampling;\n\tcolorLossLevel = settings->NSCodecColorLossLevel;\n\n\tif (colorLossLevel < 1)\n\t\tcolorLossLevel = 1;\n\n\tif (colorLossLevel > 7)\n\t\tcolorLossLevel = 7;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 8))\n\t\treturn FALSE;\n\n\tStream_Write_UINT16(s, 3); /* codecPropertiesLength */\n\t/* TS_NSCODEC_CAPABILITYSET */\n\tStream_Write_UINT8(s, fAllowDynamicFidelity); /* fAllowDynamicFidelity (1 byte) */\n\tStream_Write_UINT8(s, fAllowSubsampling); /* fAllowSubsampling (1 byte) */\n\tStream_Write_UINT8(s, colorLossLevel); /* colorLossLevel (1 byte) */\n\treturn TRUE;\n}",
  724. "project": "FreeRDP",
  725. "hash": 42897287390959164091468957982836296378,
  726. "size": 25,
  727. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  728. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  729. "target": 0,
  730. "dataset": "other",
  731. "idx": 409657
  732. },
  733. {
  734. "func": "static BOOL rdp_print_input_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 inputFlags;\n\tUINT16 pad2OctetsA;\n\tUINT32 keyboardLayout;\n\tUINT32 keyboardType;\n\tUINT32 keyboardSubType;\n\tUINT32 keyboardFunctionKey;\n\tWLog_INFO(TAG, \"InputCapabilitySet (length %\" PRIu16 \")\", length);\n\n\tif (length < 88)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, inputFlags); /* inputFlags (2 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsA); /* pad2OctetsA (2 bytes) */\n\tStream_Read_UINT32(s, keyboardLayout); /* keyboardLayout (4 bytes) */\n\tStream_Read_UINT32(s, keyboardType); /* keyboardType (4 bytes) */\n\tStream_Read_UINT32(s, keyboardSubType); /* keyboardSubType (4 bytes) */\n\tStream_Read_UINT32(s, keyboardFunctionKey); /* keyboardFunctionKeys (4 bytes) */\n\tStream_Seek(s, 64); /* imeFileName (64 bytes) */\n\tWLog_INFO(TAG, \"\\tinputFlags: 0x%04\" PRIX16 \"\", inputFlags);\n\tWLog_INFO(TAG, \"\\tpad2OctetsA: 0x%04\" PRIX16 \"\", pad2OctetsA);\n\tWLog_INFO(TAG, \"\\tkeyboardLayout: 0x%08\" PRIX32 \"\", keyboardLayout);\n\tWLog_INFO(TAG, \"\\tkeyboardType: 0x%08\" PRIX32 \"\", keyboardType);\n\tWLog_INFO(TAG, \"\\tkeyboardSubType: 0x%08\" PRIX32 \"\", keyboardSubType);\n\tWLog_INFO(TAG, \"\\tkeyboardFunctionKey: 0x%08\" PRIX32 \"\", keyboardFunctionKey);\n\treturn TRUE;\n}",
  735. "project": "FreeRDP",
  736. "hash": 92834056900707877098460532450876414616,
  737. "size": 28,
  738. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  739. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  740. "target": 0,
  741. "dataset": "other",
  742. "idx": 409650
  743. },
  744. {
  745. "func": "static BOOL rdp_write_pointer_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 colorPointerFlag;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tif (settings->PointerCacheSize > UINT16_MAX)\n\t\treturn FALSE;\n\n\tcolorPointerFlag = (settings->ColorPointerFlag) ? 1 : 0;\n\tStream_Write_UINT16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */\n\tStream_Write_UINT16(s,\n\t (UINT16)settings->PointerCacheSize); /* colorPointerCacheSize (2 bytes) */\n\n\tif (settings->LargePointerFlag)\n\t{\n\t\tStream_Write_UINT16(s, (UINT16)settings->PointerCacheSize); /* pointerCacheSize (2 bytes) */\n\t}\n\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_POINTER);\n\treturn TRUE;\n}",
  746. "project": "FreeRDP",
  747. "hash": 149417436358850467055827054446942927975,
  748. "size": 27,
  749. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  750. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  751. "target": 0,
  752. "dataset": "other",
  753. "idx": 409610
  754. },
  755. {
  756. "func": "static BOOL rdp_write_desktop_composition_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 compDeskSupportLevel;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tcompDeskSupportLevel =\n\t (settings->AllowDesktopComposition) ? COMPDESK_SUPPORTED : COMPDESK_NOT_SUPPORTED;\n\tStream_Write_UINT16(s, compDeskSupportLevel); /* compDeskSupportLevel (2 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_COMP_DESK);\n\treturn TRUE;\n}",
  757. "project": "FreeRDP",
  758. "hash": 273318921816338668560055755973757610116,
  759. "size": 15,
  760. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  761. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  762. "target": 0,
  763. "dataset": "other",
  764. "idx": 409643
  765. },
  766. {
  767. "func": "static BOOL rdp_write_bitmap_cache_host_support_capability_set(wStream* s,\n const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT8(s, BITMAP_CACHE_V2); /* cacheVersion (1 byte) */\n\tStream_Write_UINT8(s, 0); /* pad1 (1 byte) */\n\tStream_Write_UINT16(s, 0); /* pad2 (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_BITMAP_CACHE_HOST_SUPPORT);\n\treturn TRUE;\n}",
  768. "project": "FreeRDP",
  769. "hash": 135633036669097795306427700527407315652,
  770. "size": 18,
  771. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  772. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  773. "target": 0,
  774. "dataset": "other",
  775. "idx": 409673
  776. },
  777. {
  778. "func": "static BOOL rdp_write_bitmap_cache_v3_codec_id_capability_set(wStream* s,\n const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tif (settings->BitmapCacheV3CodecId > UINT8_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT8(s, (UINT8)settings->BitmapCacheV3CodecId);\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_BITMAP_CACHE_V3_CODEC_ID);\n\treturn TRUE;\n}",
  779. "project": "FreeRDP",
  780. "hash": 10452923046637731164141377400720189331,
  781. "size": 17,
  782. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  783. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  784. "target": 0,
  785. "dataset": "other",
  786. "idx": 409624
  787. },
  788. {
  789. "func": "static BOOL rdp_read_bitmap_codecs_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tBYTE codecId;\n\tGUID codecGuid;\n\tRPC_STATUS rpc_status;\n\tBYTE bitmapCodecCount;\n\tUINT16 codecPropertiesLength;\n\tUINT16 remainingLength;\n\tBOOL guidNSCodec = FALSE;\n\tBOOL guidRemoteFx = FALSE;\n\tBOOL guidRemoteFxImage = FALSE;\n\n\tif (length < 5)\n\t\treturn FALSE;\n\n\tStream_Read_UINT8(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */\n\tremainingLength = length - 5;\n\n\twhile (bitmapCodecCount > 0)\n\t{\n\t\tif (remainingLength < 19)\n\t\t\treturn FALSE;\n\n\t\trdp_read_bitmap_codec_guid(s, &codecGuid); /* codecGuid (16 bytes) */\n\t\tStream_Read_UINT8(s, codecId); /* codecId (1 byte) */\n\t\tStream_Read_UINT16(s, codecPropertiesLength); /* codecPropertiesLength (2 bytes) */\n\t\tremainingLength -= 19;\n\n\t\tif (remainingLength < codecPropertiesLength)\n\t\t\treturn FALSE;\n\n\t\tif (settings->ServerMode)\n\t\t{\n\t\t\tUINT32 beg;\n\t\t\tUINT32 end;\n\t\t\tbeg = (UINT32)Stream_GetPosition(s);\n\t\t\tend = beg + codecPropertiesLength;\n\n\t\t\tif (UuidEqual(&codecGuid, &CODEC_GUID_REMOTEFX, &rpc_status))\n\t\t\t{\n\t\t\t\tUINT32 rfxCapsLength;\n\t\t\t\tUINT32 rfxPropsLength;\n\t\t\t\tUINT32 captureFlags;\n\t\t\t\tguidRemoteFx = TRUE;\n\t\t\t\tsettings->RemoteFxCodecId = codecId;\n\t\t\t\tStream_Read_UINT32(s, rfxPropsLength); /* length (4 bytes) */\n\t\t\t\tStream_Read_UINT32(s, captureFlags); /* captureFlags (4 bytes) */\n\t\t\t\tStream_Read_UINT32(s, rfxCapsLength); /* capsLength (4 bytes) */\n\t\t\t\tsettings->RemoteFxCaptureFlags = captureFlags;\n\t\t\t\tsettings->RemoteFxOnly = (captureFlags & CARDP_CAPS_CAPTURE_NON_CAC) ? TRUE : FALSE;\n\n\t\t\t\tif (rfxCapsLength)\n\t\t\t\t{\n\t\t\t\t\tUINT16 blockType;\n\t\t\t\t\tUINT32 blockLen;\n\t\t\t\t\tUINT16 numCapsets;\n\t\t\t\t\tBYTE rfxCodecId;\n\t\t\t\t\tUINT16 capsetType;\n\t\t\t\t\tUINT16 numIcaps;\n\t\t\t\t\tUINT16 icapLen;\n\t\t\t\t\t/* TS_RFX_CAPS */\n\t\t\t\t\tStream_Read_UINT16(s, blockType); /* blockType (2 bytes) */\n\t\t\t\t\tStream_Read_UINT32(s, blockLen); /* blockLen (4 bytes) */\n\t\t\t\t\tStream_Read_UINT16(s, numCapsets); /* numCapsets (2 bytes) */\n\n\t\t\t\t\tif (blockType != 0xCBC0)\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tif (blockLen != 8)\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tif (numCapsets != 1)\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t/* TS_RFX_CAPSET */\n\t\t\t\t\tStream_Read_UINT16(s, blockType); /* blockType (2 bytes) */\n\t\t\t\t\tStream_Read_UINT32(s, blockLen); /* blockLen (4 bytes) */\n\t\t\t\t\tStream_Read_UINT8(s, rfxCodecId); /* codecId (1 byte) */\n\t\t\t\t\tStream_Read_UINT16(s, capsetType); /* capsetType (2 bytes) */\n\t\t\t\t\tStream_Read_UINT16(s, numIcaps); /* numIcaps (2 bytes) */\n\t\t\t\t\tStream_Read_UINT16(s, icapLen); /* icapLen (2 bytes) */\n\n\t\t\t\t\tif (blockType != 0xCBC1)\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tif (rfxCodecId != 1)\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tif (capsetType != 0xCFC0)\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\twhile (numIcaps--)\n\t\t\t\t\t{\n\t\t\t\t\t\tUINT16 version;\n\t\t\t\t\t\tUINT16 tileSize;\n\t\t\t\t\t\tBYTE codecFlags;\n\t\t\t\t\t\tBYTE colConvBits;\n\t\t\t\t\t\tBYTE transformBits;\n\t\t\t\t\t\tBYTE entropyBits;\n\t\t\t\t\t\t/* TS_RFX_ICAP */\n\t\t\t\t\t\tStream_Read_UINT16(s, version); /* version (2 bytes) */\n\t\t\t\t\t\tStream_Read_UINT16(s, tileSize); /* tileSize (2 bytes) */\n\t\t\t\t\t\tStream_Read_UINT8(s, codecFlags); /* flags (1 byte) */\n\t\t\t\t\t\tStream_Read_UINT8(s, colConvBits); /* colConvBits (1 byte) */\n\t\t\t\t\t\tStream_Read_UINT8(s, transformBits); /* transformBits (1 byte) */\n\t\t\t\t\t\tStream_Read_UINT8(s, entropyBits); /* entropyBits (1 byte) */\n\n\t\t\t\t\t\tif (version == 0x0009)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/* Version 0.9 */\n\t\t\t\t\t\t\tif (tileSize != 0x0080)\n\t\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse if (version == 0x0100)\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\t/* Version 1.0 */\n\t\t\t\t\t\t\tif (tileSize != 0x0040)\n\t\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tif (colConvBits != 1)\n\t\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\t\tif (transformBits != 1)\n\t\t\t\t\t\t\treturn FALSE;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\telse if (UuidEqual(&codecGuid, &CODEC_GUID_IMAGE_REMOTEFX, &rpc_status))\n\t\t\t{\n\t\t\t\t/* Microsoft RDP servers ignore CODEC_GUID_IMAGE_REMOTEFX codec properties */\n\t\t\t\tguidRemoteFxImage = TRUE;\n\t\t\t\tStream_Seek(s, codecPropertiesLength); /* codecProperties */\n\t\t\t}\n\t\t\telse if (UuidEqual(&codecGuid, &CODEC_GUID_NSCODEC, &rpc_status))\n\t\t\t{\n\t\t\t\tBYTE colorLossLevel;\n\t\t\t\tBYTE fAllowSubsampling;\n\t\t\t\tBYTE fAllowDynamicFidelity;\n\t\t\t\tguidNSCodec = TRUE;\n\t\t\t\tsettings->NSCodecId = codecId;\n\t\t\t\tStream_Read_UINT8(s, fAllowDynamicFidelity); /* fAllowDynamicFidelity (1 byte) */\n\t\t\t\tStream_Read_UINT8(s, fAllowSubsampling); /* fAllowSubsampling (1 byte) */\n\t\t\t\tStream_Read_UINT8(s, colorLossLevel); /* colorLossLevel (1 byte) */\n\n\t\t\t\tif (colorLossLevel < 1)\n\t\t\t\t\tcolorLossLevel = 1;\n\n\t\t\t\tif (colorLossLevel > 7)\n\t\t\t\t\tcolorLossLevel = 7;\n\n\t\t\t\tsettings->NSCodecAllowDynamicColorFidelity = fAllowDynamicFidelity;\n\t\t\t\tsettings->NSCodecAllowSubsampling = fAllowSubsampling;\n\t\t\t\tsettings->NSCodecColorLossLevel = colorLossLevel;\n\t\t\t}\n\t\t\telse if (UuidEqual(&codecGuid, &CODEC_GUID_IGNORE, &rpc_status))\n\t\t\t{\n\t\t\t\tStream_Seek(s, codecPropertiesLength); /* codecProperties */\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tStream_Seek(s, codecPropertiesLength); /* codecProperties */\n\t\t\t}\n\n\t\t\tif (Stream_GetPosition(s) != end)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG,\n\t\t\t\t \"error while reading codec properties: actual offset: %\" PRIuz\n\t\t\t\t \" expected offset: %\" PRIu32 \"\",\n\t\t\t\t Stream_GetPosition(s), end);\n\t\t\t\tStream_SetPosition(s, end);\n\t\t\t}\n\n\t\t\tremainingLength -= codecPropertiesLength;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tStream_Seek(s, codecPropertiesLength); /* codecProperties */\n\t\t\tremainingLength -= codecPropertiesLength;\n\t\t}\n\n\t\tbitmapCodecCount--;\n\t}\n\n\tif (settings->ServerMode)\n\t{\n\t\t/* only enable a codec if we've announced/enabled it before */\n\t\tsettings->RemoteFxCodec = settings->RemoteFxCodec && guidRemoteFx;\n\t\tsettings->RemoteFxImageCodec = settings->RemoteFxImageCodec && guidRemoteFxImage;\n\t\tsettings->NSCodec = settings->NSCodec && guidNSCodec;\n\t\tsettings->JpegCodec = FALSE;\n\t}\n\n\treturn TRUE;\n}",
  790. "project": "FreeRDP",
  791. "hash": 211558337571308508511556254604496342865,
  792. "size": 197,
  793. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  794. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  795. "target": 0,
  796. "dataset": "other",
  797. "idx": 409580
  798. },
  799. {
  800. "func": "static BOOL rdp_write_input_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 inputFlags;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 128))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tinputFlags = INPUT_FLAG_SCANCODES;\n\n\tif (settings->FastPathInput)\n\t{\n\t\tinputFlags |= INPUT_FLAG_FASTPATH_INPUT;\n\t\tinputFlags |= INPUT_FLAG_FASTPATH_INPUT2;\n\t}\n\n\tif (settings->HasHorizontalWheel)\n\t\tinputFlags |= TS_INPUT_FLAG_MOUSE_HWHEEL;\n\n\tif (settings->UnicodeInput)\n\t\tinputFlags |= INPUT_FLAG_UNICODE;\n\n\tif (settings->HasExtendedMouseEvent)\n\t\tinputFlags |= INPUT_FLAG_MOUSEX;\n\n\tStream_Write_UINT16(s, inputFlags); /* inputFlags (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */\n\tStream_Write_UINT32(s, settings->KeyboardLayout); /* keyboardLayout (4 bytes) */\n\tStream_Write_UINT32(s, settings->KeyboardType); /* keyboardType (4 bytes) */\n\tStream_Write_UINT32(s, settings->KeyboardSubType); /* keyboardSubType (4 bytes) */\n\tStream_Write_UINT32(s, settings->KeyboardFunctionKey); /* keyboardFunctionKeys (4 bytes) */\n\tStream_Zero(s, 64); /* imeFileName (64 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_INPUT);\n\treturn TRUE;\n}",
  801. "project": "FreeRDP",
  802. "hash": 338872550335327331413384147382884031144,
  803. "size": 38,
  804. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  805. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  806. "target": 0,
  807. "dataset": "other",
  808. "idx": 409679
  809. },
  810. {
  811. "func": "BOOL rdp_recv_get_active_header(rdpRdp* rdp, wStream* s, UINT16* pChannelId, UINT16* length)\n{\n\tUINT16 securityFlags = 0;\n\n\tif (!rdp_read_header(rdp, s, length, pChannelId))\n\t\treturn FALSE;\n\n\tif (freerdp_shall_disconnect(rdp->instance))\n\t\treturn TRUE;\n\n\tif (rdp->settings->UseRdpSecurityLayer)\n\t{\n\t\tif (!rdp_read_security_header(s, &securityFlags, length))\n\t\t\treturn FALSE;\n\n\t\tif (securityFlags & SEC_ENCRYPT)\n\t\t{\n\t\t\tif (!rdp_decrypt(rdp, s, length, securityFlags))\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"rdp_decrypt failed\");\n\t\t\t\treturn FALSE;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (*pChannelId != MCS_GLOBAL_CHANNEL_ID)\n\t{\n\t\tUINT16 mcsMessageChannelId = rdp->mcs->messageChannelId;\n\n\t\tif ((mcsMessageChannelId == 0) || (*pChannelId != mcsMessageChannelId))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"unexpected MCS channel id %04\" PRIx16 \" received\", *pChannelId);\n\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\treturn TRUE;\n}",
  812. "project": "FreeRDP",
  813. "hash": 69761426746625133711469800190507649484,
  814. "size": 38,
  815. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  816. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  817. "target": 0,
  818. "dataset": "other",
  819. "idx": 409606
  820. },
  821. {
  822. "func": "static BOOL rdp_print_bitmap_cache_v3_codec_id_capability_set(wStream* s, UINT16 length)\n{\n\tBYTE bitmapCacheV3CodecId;\n\tWLog_INFO(TAG, \"BitmapCacheV3CodecIdCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 5)\n\t\treturn FALSE;\n\n\tStream_Read_UINT8(s, bitmapCacheV3CodecId); /* bitmapCacheV3CodecId (1 byte) */\n\tWLog_INFO(TAG, \"\\tbitmapCacheV3CodecId: 0x%02\" PRIX8 \"\", bitmapCacheV3CodecId);\n\treturn TRUE;\n}",
  823. "project": "FreeRDP",
  824. "hash": 200222901722079828895109214050225335139,
  825. "size": 12,
  826. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  827. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  828. "target": 0,
  829. "dataset": "other",
  830. "idx": 409618
  831. },
  832. {
  833. "func": "static BOOL rdp_read_surface_commands_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tUINT32 cmdFlags;\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, cmdFlags); /* cmdFlags (4 bytes) */\n\tStream_Seek_UINT32(s); /* reserved (4 bytes) */\n\tsettings->SurfaceCommandsEnabled = TRUE;\n\tsettings->SurfaceFrameMarkerEnabled = (cmdFlags & SURFCMDS_FRAME_MARKER) ? TRUE : FALSE;\n\treturn TRUE;\n}",
  834. "project": "FreeRDP",
  835. "hash": 63310942064729278467171666552306282666,
  836. "size": 14,
  837. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  838. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  839. "target": 0,
  840. "dataset": "other",
  841. "idx": 409656
  842. },
  843. {
  844. "func": "static BOOL rdp_write_window_list_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tStream_Write_UINT32(s, settings->RemoteWndSupportLevel); /* wndSupportLevel (4 bytes) */\n\tStream_Write_UINT8(s, settings->RemoteAppNumIconCaches); /* numIconCaches (1 byte) */\n\tStream_Write_UINT16(s,\n\t settings->RemoteAppNumIconCacheEntries); /* numIconCacheEntries (2 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_WINDOW);\n\treturn TRUE;\n}",
  845. "project": "FreeRDP",
  846. "hash": 269751178337665990773470592456743275364,
  847. "size": 15,
  848. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  849. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  850. "target": 0,
  851. "dataset": "other",
  852. "idx": 409675
  853. },
  854. {
  855. "func": "static BOOL rdp_read_bitmap_cache_v2_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length < 40)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT16(s); /* cacheFlags (2 bytes) */\n\tStream_Seek_UINT8(s); /* pad2 (1 byte) */\n\tStream_Seek_UINT8(s); /* numCellCaches (1 byte) */\n\tStream_Seek(s, 4); /* bitmapCache0CellInfo (4 bytes) */\n\tStream_Seek(s, 4); /* bitmapCache1CellInfo (4 bytes) */\n\tStream_Seek(s, 4); /* bitmapCache2CellInfo (4 bytes) */\n\tStream_Seek(s, 4); /* bitmapCache3CellInfo (4 bytes) */\n\tStream_Seek(s, 4); /* bitmapCache4CellInfo (4 bytes) */\n\tStream_Seek(s, 12); /* pad3 (12 bytes) */\n\treturn TRUE;\n}",
  856. "project": "FreeRDP",
  857. "hash": 263490146809338800269291031396967779750,
  858. "size": 18,
  859. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  860. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  861. "target": 0,
  862. "dataset": "other",
  863. "idx": 409636
  864. },
  865. {
  866. "func": "static BOOL rdp_write_sound_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 soundFlags;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tsoundFlags = (settings->SoundBeepsEnabled) ? SOUND_BEEPS_FLAG : 0;\n\tStream_Write_UINT16(s, soundFlags); /* soundFlags (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_SOUND);\n\treturn TRUE;\n}",
  867. "project": "FreeRDP",
  868. "hash": 158780408568565551652650021789085155322,
  869. "size": 17,
  870. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  871. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  872. "target": 0,
  873. "dataset": "other",
  874. "idx": 409677
  875. },
  876. {
  877. "func": "static BOOL rdp_write_bitmap_cache_v2_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 cacheFlags;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tcacheFlags = ALLOW_CACHE_WAITING_LIST_FLAG;\n\n\tif (settings->BitmapCachePersistEnabled)\n\t\tcacheFlags |= PERSISTENT_KEYS_EXPECTED_FLAG;\n\n\tStream_Write_UINT16(s, cacheFlags); /* cacheFlags (2 bytes) */\n\tStream_Write_UINT8(s, 0); /* pad2 (1 byte) */\n\tStream_Write_UINT8(s, settings->BitmapCacheV2NumCells); /* numCellCaches (1 byte) */\n\trdp_write_bitmap_cache_cell_info(\n\t s, &settings->BitmapCacheV2CellInfo[0]); /* bitmapCache0CellInfo (4 bytes) */\n\trdp_write_bitmap_cache_cell_info(\n\t s, &settings->BitmapCacheV2CellInfo[1]); /* bitmapCache1CellInfo (4 bytes) */\n\trdp_write_bitmap_cache_cell_info(\n\t s, &settings->BitmapCacheV2CellInfo[2]); /* bitmapCache2CellInfo (4 bytes) */\n\trdp_write_bitmap_cache_cell_info(\n\t s, &settings->BitmapCacheV2CellInfo[3]); /* bitmapCache3CellInfo (4 bytes) */\n\trdp_write_bitmap_cache_cell_info(\n\t s, &settings->BitmapCacheV2CellInfo[4]); /* bitmapCache4CellInfo (4 bytes) */\n\tStream_Zero(s, 12); /* pad3 (12 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CACHE_V2);\n\treturn TRUE;\n}",
  878. "project": "FreeRDP",
  879. "hash": 7403566936328765357261527626239563020,
  880. "size": 31,
  881. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  882. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  883. "target": 0,
  884. "dataset": "other",
  885. "idx": 409671
  886. },
  887. {
  888. "func": "static BOOL rdp_write_control_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(s, 0); /* controlFlags (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* remoteDetachFlag (2 bytes) */\n\tStream_Write_UINT16(s, 2); /* controlInterest (2 bytes) */\n\tStream_Write_UINT16(s, 2); /* detachInterest (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_CONTROL);\n\treturn TRUE;\n}",
  889. "project": "FreeRDP",
  890. "hash": 135483827949982748357864462755091453961,
  891. "size": 18,
  892. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  893. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  894. "target": 0,
  895. "dataset": "other",
  896. "idx": 409645
  897. },
  898. {
  899. "func": "static BOOL rdp_read_frame_acknowledge_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tif (settings->ServerMode)\n\t{\n\t\tStream_Read_UINT32(s, settings->FrameAcknowledge); /* (4 bytes) */\n\t}\n\telse\n\t{\n\t\tStream_Seek_UINT32(s); /* (4 bytes) */\n\t}\n\n\treturn TRUE;\n}",
  900. "project": "FreeRDP",
  901. "hash": 284070112210894721326557355488230804603,
  902. "size": 17,
  903. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  904. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  905. "target": 0,
  906. "dataset": "other",
  907. "idx": 409627
  908. },
  909. {
  910. "func": "static BOOL rdp_write_brush_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT32(s, settings->BrushSupportLevel); /* brushSupportLevel (4 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_BRUSH);\n\treturn TRUE;\n}",
  911. "project": "FreeRDP",
  912. "hash": 93963722394653772517521252922174557981,
  913. "size": 14,
  914. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  915. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  916. "target": 0,
  917. "dataset": "other",
  918. "idx": 409599
  919. },
  920. {
  921. "func": "static BOOL rdp_read_multifragment_update_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tUINT32 multifragMaxRequestSize;\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, multifragMaxRequestSize); /* MaxRequestSize (4 bytes) */\n\n\tif (settings->ServerMode)\n\t{\n\t\t/*\n\t\t * Special case: The client announces multifragment update support but sets the maximum\n\t\t * request size to something smaller than maximum size for *one* fast-path PDU. In this case\n\t\t * behave like no multifragment updates were supported and make sure no fragmentation\n\t\t * happens by setting FASTPATH_FRAGMENT_SAFE_SIZE.\n\t\t *\n\t\t * This behaviour was observed with some windows ce rdp clients.\n\t\t */\n\t\tif (multifragMaxRequestSize < FASTPATH_MAX_PACKET_SIZE)\n\t\t\tmultifragMaxRequestSize = FASTPATH_FRAGMENT_SAFE_SIZE;\n\n\t\tif (settings->RemoteFxCodec)\n\t\t{\n\t\t\t/**\n\t\t\t * If we are using RemoteFX the client MUST use a value greater\n\t\t\t * than or equal to the value we've previously sent in the server to\n\t\t\t * client multi-fragment update capability set (MS-RDPRFX 1.5)\n\t\t\t */\n\t\t\tif (multifragMaxRequestSize < settings->MultifragMaxRequestSize)\n\t\t\t{\n\t\t\t\t/**\n\t\t\t\t * If it happens to be smaller we honor the client's value but\n\t\t\t\t * have to disable RemoteFX\n\t\t\t\t */\n\t\t\t\tsettings->RemoteFxCodec = FALSE;\n\t\t\t\tsettings->MultifragMaxRequestSize = multifragMaxRequestSize;\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\t/* no need to increase server's max request size setting here */\n\t\t\t}\n\t\t}\n\t\telse\n\t\t{\n\t\t\tsettings->MultifragMaxRequestSize = multifragMaxRequestSize;\n\t\t}\n\t}\n\telse\n\t{\n\t\t/**\n\t\t * In client mode we keep up with the server's capabilites.\n\t\t * In RemoteFX mode we MUST do this but it might also be useful to\n\t\t * receive larger related bitmap updates.\n\t\t */\n\t\tif (multifragMaxRequestSize > settings->MultifragMaxRequestSize)\n\t\t\tsettings->MultifragMaxRequestSize = multifragMaxRequestSize;\n\t}\n\n\treturn TRUE;\n}",
  922. "project": "FreeRDP",
  923. "hash": 37401917209807069896060133616819073503,
  924. "size": 62,
  925. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  926. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  927. "target": 0,
  928. "dataset": "other",
  929. "idx": 409584
  930. },
  931. {
  932. "func": "static const char* get_capability_name(UINT16 type)\n{\n\tif (type > CAPSET_TYPE_FRAME_ACKNOWLEDGE)\n\t\treturn \"<unknown>\";\n\n\treturn CAPSET_TYPE_STRINGS[type];\n}",
  933. "project": "FreeRDP",
  934. "hash": 16777793439146057316455334333971045236,
  935. "size": 7,
  936. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  937. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  938. "target": 0,
  939. "dataset": "other",
  940. "idx": 409629
  941. },
  942. {
  943. "func": "static BOOL rdp_write_draw_nine_grid_cache_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT32 drawNineGridSupportLevel;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tdrawNineGridSupportLevel =\n\t (settings->DrawNineGridEnabled) ? DRAW_NINEGRID_SUPPORTED_V2 : DRAW_NINEGRID_NO_SUPPORT;\n\tStream_Write_UINT32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */\n\tStream_Write_UINT16(s, settings->DrawNineGridCacheSize); /* drawNineGridCacheSize (2 bytes) */\n\tStream_Write_UINT16(\n\t s, settings->DrawNineGridCacheEntries); /* drawNineGridCacheEntries (2 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_DRAW_NINE_GRID_CACHE);\n\treturn TRUE;\n}",
  944. "project": "FreeRDP",
  945. "hash": 35511811275078158737832815679711271274,
  946. "size": 18,
  947. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  948. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  949. "target": 0,
  950. "dataset": "other",
  951. "idx": 409674
  952. },
  953. {
  954. "func": "static BOOL rdp_write_demand_active(wStream* s, rdpSettings* settings)\n{\n\tsize_t bm, em, lm;\n\tUINT16 numberCapabilities;\n\tsize_t lengthCombinedCapabilities;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\tStream_Write_UINT32(s, settings->ShareId); /* shareId (4 bytes) */\n\tStream_Write_UINT16(s, 4); /* lengthSourceDescriptor (2 bytes) */\n\tlm = Stream_GetPosition(s);\n\tStream_Seek_UINT16(s); /* lengthCombinedCapabilities (2 bytes) */\n\tStream_Write(s, \"RDP\", 4); /* sourceDescriptor */\n\tbm = Stream_GetPosition(s);\n\tStream_Seek_UINT16(s); /* numberCapabilities (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */\n\tnumberCapabilities = 14;\n\n\tif (!rdp_write_general_capability_set(s, settings) ||\n\t !rdp_write_bitmap_capability_set(s, settings) ||\n\t !rdp_write_order_capability_set(s, settings) ||\n\t !rdp_write_pointer_capability_set(s, settings) ||\n\t !rdp_write_input_capability_set(s, settings) ||\n\t !rdp_write_virtual_channel_capability_set(s, settings) ||\n\t !rdp_write_share_capability_set(s, settings) ||\n\t !rdp_write_font_capability_set(s, settings) ||\n\t !rdp_write_multifragment_update_capability_set(s, settings) ||\n\t !rdp_write_large_pointer_capability_set(s, settings) ||\n\t !rdp_write_desktop_composition_capability_set(s, settings) ||\n\t !rdp_write_surface_commands_capability_set(s, settings) ||\n\t !rdp_write_bitmap_codecs_capability_set(s, settings) ||\n\t !rdp_write_frame_acknowledge_capability_set(s, settings))\n\t{\n\t\treturn FALSE;\n\t}\n\n\tif (settings->BitmapCachePersistEnabled)\n\t{\n\t\tnumberCapabilities++;\n\n\t\tif (!rdp_write_bitmap_cache_host_support_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tif (settings->RemoteApplicationMode)\n\t{\n\t\tnumberCapabilities += 2;\n\n\t\tif (!rdp_write_remote_programs_capability_set(s, settings) ||\n\t\t !rdp_write_window_list_capability_set(s, settings))\n\t\t\treturn FALSE;\n\t}\n\n\tem = Stream_GetPosition(s);\n\tStream_SetPosition(s, lm); /* go back to lengthCombinedCapabilities */\n\tlengthCombinedCapabilities = (em - bm);\n\tif (lengthCombinedCapabilities > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(\n\t s, (UINT16)lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */\n\tStream_SetPosition(s, bm); /* go back to numberCapabilities */\n\tStream_Write_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */\n#ifdef WITH_DEBUG_CAPABILITIES\n\tStream_Seek_UINT16(s);\n\trdp_print_capability_sets(s, numberCapabilities, FALSE);\n\tStream_SetPosition(s, bm);\n\tStream_Seek_UINT16(s);\n#endif\n\tStream_SetPosition(s, em);\n\tStream_Write_UINT32(s, 0); /* sessionId */\n\treturn TRUE;\n}",
  955. "project": "FreeRDP",
  956. "hash": 200964485296716695117994736252941627244,
  957. "size": 73,
  958. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  959. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  960. "target": 0,
  961. "dataset": "other",
  962. "idx": 409689
  963. },
  964. {
  965. "func": "static BOOL rdp_read_bitmap_cache_host_support_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tBYTE cacheVersion;\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT8(s, cacheVersion); /* cacheVersion (1 byte) */\n\tStream_Seek_UINT8(s); /* pad1 (1 byte) */\n\tStream_Seek_UINT16(s); /* pad2 (2 bytes) */\n\n\tif (cacheVersion & BITMAP_CACHE_V2)\n\t\tsettings->BitmapCachePersistEnabled = TRUE;\n\n\treturn TRUE;\n}",
  966. "project": "FreeRDP",
  967. "hash": 194862320568674981995591289915994818222,
  968. "size": 17,
  969. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  970. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  971. "target": 0,
  972. "dataset": "other",
  973. "idx": 409654
  974. },
  975. {
  976. "func": "static BOOL rdp_read_input_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tUINT16 inputFlags;\n\n\tif (length < 88)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, inputFlags); /* inputFlags (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */\n\n\tif (settings->ServerMode)\n\t{\n\t\tStream_Read_UINT32(s, settings->KeyboardLayout); /* keyboardLayout (4 bytes) */\n\t\tStream_Read_UINT32(s, settings->KeyboardType); /* keyboardType (4 bytes) */\n\t\tStream_Read_UINT32(s, settings->KeyboardSubType); /* keyboardSubType (4 bytes) */\n\t\tStream_Read_UINT32(s, settings->KeyboardFunctionKey); /* keyboardFunctionKeys (4 bytes) */\n\t}\n\telse\n\t{\n\t\tStream_Seek_UINT32(s); /* keyboardLayout (4 bytes) */\n\t\tStream_Seek_UINT32(s); /* keyboardType (4 bytes) */\n\t\tStream_Seek_UINT32(s); /* keyboardSubType (4 bytes) */\n\t\tStream_Seek_UINT32(s); /* keyboardFunctionKeys (4 bytes) */\n\t}\n\n\tStream_Seek(s, 64); /* imeFileName (64 bytes) */\n\n\tif (!settings->ServerMode)\n\t{\n\t\tif (inputFlags & INPUT_FLAG_FASTPATH_INPUT)\n\t\t{\n\t\t\t/* advertised by RDP 5.0 and 5.1 servers */\n\t\t}\n\t\telse if (inputFlags & INPUT_FLAG_FASTPATH_INPUT2)\n\t\t{\n\t\t\t/* advertised by RDP 5.2, 6.0, 6.1 and 7.0 servers */\n\t\t}\n\t\telse\n\t\t{\n\t\t\t/* server does not support fastpath input */\n\t\t\tsettings->FastPathInput = FALSE;\n\t\t}\n\n\t\tif (inputFlags & TS_INPUT_FLAG_MOUSE_HWHEEL)\n\t\t\tsettings->HasHorizontalWheel = TRUE;\n\n\t\tif (inputFlags & INPUT_FLAG_UNICODE)\n\t\t\tsettings->UnicodeInput = TRUE;\n\n\t\tif (inputFlags & INPUT_FLAG_MOUSEX)\n\t\t\tsettings->HasExtendedMouseEvent = TRUE;\n\t}\n\n\treturn TRUE;\n}",
  977. "project": "FreeRDP",
  978. "hash": 126033178202274719085086663919529272091,
  979. "size": 55,
  980. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  981. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  982. "target": 0,
  983. "dataset": "other",
  984. "idx": 409609
  985. },
  986. {
  987. "func": "static BOOL rdp_print_bitmap_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 preferredBitsPerPixel;\n\tUINT16 receive1BitPerPixel;\n\tUINT16 receive4BitsPerPixel;\n\tUINT16 receive8BitsPerPixel;\n\tUINT16 desktopWidth;\n\tUINT16 desktopHeight;\n\tUINT16 pad2Octets;\n\tUINT16 desktopResizeFlag;\n\tUINT16 bitmapCompressionFlag;\n\tBYTE highColorFlags;\n\tBYTE drawingFlags;\n\tUINT16 multipleRectangleSupport;\n\tUINT16 pad2OctetsB;\n\tWLog_INFO(TAG, \"BitmapCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 28)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */\n\tStream_Read_UINT16(s, receive1BitPerPixel); /* receive1BitPerPixel (2 bytes) */\n\tStream_Read_UINT16(s, receive4BitsPerPixel); /* receive4BitsPerPixel (2 bytes) */\n\tStream_Read_UINT16(s, receive8BitsPerPixel); /* receive8BitsPerPixel (2 bytes) */\n\tStream_Read_UINT16(s, desktopWidth); /* desktopWidth (2 bytes) */\n\tStream_Read_UINT16(s, desktopHeight); /* desktopHeight (2 bytes) */\n\tStream_Read_UINT16(s, pad2Octets); /* pad2Octets (2 bytes) */\n\tStream_Read_UINT16(s, desktopResizeFlag); /* desktopResizeFlag (2 bytes) */\n\tStream_Read_UINT16(s, bitmapCompressionFlag); /* bitmapCompressionFlag (2 bytes) */\n\tStream_Read_UINT8(s, highColorFlags); /* highColorFlags (1 byte) */\n\tStream_Read_UINT8(s, drawingFlags); /* drawingFlags (1 byte) */\n\tStream_Read_UINT16(s, multipleRectangleSupport); /* multipleRectangleSupport (2 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsB); /* pad2OctetsB (2 bytes) */\n\tWLog_INFO(TAG, \"\\tpreferredBitsPerPixel: 0x%04\" PRIX16 \"\", preferredBitsPerPixel);\n\tWLog_INFO(TAG, \"\\treceive1BitPerPixel: 0x%04\" PRIX16 \"\", receive1BitPerPixel);\n\tWLog_INFO(TAG, \"\\treceive4BitsPerPixel: 0x%04\" PRIX16 \"\", receive4BitsPerPixel);\n\tWLog_INFO(TAG, \"\\treceive8BitsPerPixel: 0x%04\" PRIX16 \"\", receive8BitsPerPixel);\n\tWLog_INFO(TAG, \"\\tdesktopWidth: 0x%04\" PRIX16 \"\", desktopWidth);\n\tWLog_INFO(TAG, \"\\tdesktopHeight: 0x%04\" PRIX16 \"\", desktopHeight);\n\tWLog_INFO(TAG, \"\\tpad2Octets: 0x%04\" PRIX16 \"\", pad2Octets);\n\tWLog_INFO(TAG, \"\\tdesktopResizeFlag: 0x%04\" PRIX16 \"\", desktopResizeFlag);\n\tWLog_INFO(TAG, \"\\tbitmapCompressionFlag: 0x%04\" PRIX16 \"\", bitmapCompressionFlag);\n\tWLog_INFO(TAG, \"\\thighColorFlags: 0x%02\" PRIX8 \"\", highColorFlags);\n\tWLog_INFO(TAG, \"\\tdrawingFlags: 0x%02\" PRIX8 \"\", drawingFlags);\n\tWLog_INFO(TAG, \"\\tmultipleRectangleSupport: 0x%04\" PRIX16 \"\", multipleRectangleSupport);\n\tWLog_INFO(TAG, \"\\tpad2OctetsB: 0x%04\" PRIX16 \"\", pad2OctetsB);\n\treturn TRUE;\n}",
  988. "project": "FreeRDP",
  989. "hash": 126081365899131686923850704232043707399,
  990. "size": 48,
  991. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  992. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  993. "target": 0,
  994. "dataset": "other",
  995. "idx": 409585
  996. },
  997. {
  998. "func": "static BOOL rdp_print_capability_sets(wStream* s, UINT16 numberCapabilities, BOOL receiving)\n{\n\tUINT16 type;\n\tUINT16 length;\n\tBYTE *bm, *em;\n\n\twhile (numberCapabilities > 0)\n\t{\n\t\tStream_GetPointer(s, bm);\n\t\trdp_read_capability_set_header(s, &length, &type);\n\t\tWLog_INFO(TAG, \"%s \", receiving ? \"Receiving\" : \"Sending\");\n\t\tem = bm + length;\n\n\t\tif (Stream_GetRemainingLength(s) < (size_t)(length - 4))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"error processing stream\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tswitch (type)\n\t\t{\n\t\t\tcase CAPSET_TYPE_GENERAL:\n\t\t\t\tif (!rdp_print_general_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP:\n\t\t\t\tif (!rdp_print_bitmap_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_ORDER:\n\t\t\t\tif (!rdp_print_order_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP_CACHE:\n\t\t\t\tif (!rdp_print_bitmap_cache_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_CONTROL:\n\t\t\t\tif (!rdp_print_control_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_ACTIVATION:\n\t\t\t\tif (!rdp_print_window_activation_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_POINTER:\n\t\t\t\tif (!rdp_print_pointer_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_SHARE:\n\t\t\t\tif (!rdp_print_share_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_COLOR_CACHE:\n\t\t\t\tif (!rdp_print_color_cache_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_SOUND:\n\t\t\t\tif (!rdp_print_sound_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_INPUT:\n\t\t\t\tif (!rdp_print_input_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_FONT:\n\t\t\t\tif (!rdp_print_font_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BRUSH:\n\t\t\t\tif (!rdp_print_brush_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_GLYPH_CACHE:\n\t\t\t\tif (!rdp_print_glyph_cache_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_OFFSCREEN_CACHE:\n\t\t\t\tif (!rdp_print_offscreen_bitmap_cache_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP_CACHE_HOST_SUPPORT:\n\t\t\t\tif (!rdp_print_bitmap_cache_host_support_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP_CACHE_V2:\n\t\t\t\tif (!rdp_print_bitmap_cache_v2_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_VIRTUAL_CHANNEL:\n\t\t\t\tif (!rdp_print_virtual_channel_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_DRAW_NINE_GRID_CACHE:\n\t\t\t\tif (!rdp_print_draw_nine_grid_cache_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_DRAW_GDI_PLUS:\n\t\t\t\tif (!rdp_print_draw_gdiplus_cache_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_RAIL:\n\t\t\t\tif (!rdp_print_remote_programs_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_WINDOW:\n\t\t\t\tif (!rdp_print_window_list_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_COMP_DESK:\n\t\t\t\tif (!rdp_print_desktop_composition_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_MULTI_FRAGMENT_UPDATE:\n\t\t\t\tif (!rdp_print_multifragment_update_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_LARGE_POINTER:\n\t\t\t\tif (!rdp_print_large_pointer_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_SURFACE_COMMANDS:\n\t\t\t\tif (!rdp_print_surface_commands_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP_CODECS:\n\t\t\t\tif (!rdp_print_bitmap_codecs_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_FRAME_ACKNOWLEDGE:\n\t\t\t\tif (!rdp_print_frame_acknowledge_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase CAPSET_TYPE_BITMAP_CACHE_V3_CODEC_ID:\n\t\t\t\tif (!rdp_print_bitmap_cache_v3_codec_id_capability_set(s, length))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tWLog_ERR(TAG, \"unknown capability type %\" PRIu16 \"\", type);\n\t\t\t\tbreak;\n\t\t}\n\n\t\tif (Stream_Pointer(s) != em)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"incorrect offset, type:0x%04\" PRIX16 \" actual:%\" PRIuz \" expected:%\" PRIuz \"\",\n\t\t\t type, Stream_Pointer(s) - bm, em - bm);\n\t\t}\n\n\t\tStream_SetPointer(s, em);\n\t\tnumberCapabilities--;\n\t}\n\n\treturn TRUE;\n}",
  999. "project": "FreeRDP",
  1000. "hash": 105372768838707288001971402184306047802,
  1001. "size": 213,
  1002. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1003. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1004. "target": 0,
  1005. "dataset": "other",
  1006. "idx": 409611
  1007. },
  1008. {
  1009. "func": "static BOOL rdp_print_share_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 nodeId;\n\tUINT16 pad2Octets;\n\tWLog_INFO(TAG, \"ShareCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, nodeId); /* nodeId (2 bytes) */\n\tStream_Read_UINT16(s, pad2Octets); /* pad2Octets (2 bytes) */\n\tWLog_INFO(TAG, \"\\tnodeId: 0x%04\" PRIX16 \"\", nodeId);\n\tWLog_INFO(TAG, \"\\tpad2Octets: 0x%04\" PRIX16 \"\", pad2Octets);\n\treturn TRUE;\n}",
  1010. "project": "FreeRDP",
  1011. "hash": 82707890459590975223038772323618896983,
  1012. "size": 15,
  1013. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1014. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1015. "target": 0,
  1016. "dataset": "other",
  1017. "idx": 409635
  1018. },
  1019. {
  1020. "func": "static BOOL rdp_write_order_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 orderFlags;\n\tUINT16 orderSupportExFlags;\n\tUINT16 textANSICodePage = 0;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\t/* see [MSDN-CP]: http://msdn.microsoft.com/en-us/library/dd317756 */\n\tif (!settings->ServerMode)\n\t\ttextANSICodePage = CP_UTF8; /* Unicode (UTF-8) */\n\n\torderSupportExFlags = 0;\n\torderFlags = NEGOTIATE_ORDER_SUPPORT | ZERO_BOUNDS_DELTA_SUPPORT | COLOR_INDEX_SUPPORT;\n\n\tif (settings->BitmapCacheV3Enabled)\n\t{\n\t\torderSupportExFlags |= CACHE_BITMAP_V3_SUPPORT;\n\t\torderFlags |= ORDER_FLAGS_EXTRA_SUPPORT;\n\t}\n\n\tif (settings->FrameMarkerCommandEnabled)\n\t{\n\t\torderSupportExFlags |= ALTSEC_FRAME_MARKER_SUPPORT;\n\t\torderFlags |= ORDER_FLAGS_EXTRA_SUPPORT;\n\t}\n\n\tStream_Zero(s, 16); /* terminalDescriptor (16 bytes) */\n\tStream_Write_UINT32(s, 0); /* pad4OctetsA (4 bytes) */\n\tStream_Write_UINT16(s, 1); /* desktopSaveXGranularity (2 bytes) */\n\tStream_Write_UINT16(s, 20); /* desktopSaveYGranularity (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */\n\tStream_Write_UINT16(s, 1); /* maximumOrderLevel (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* numberFonts (2 bytes) */\n\tStream_Write_UINT16(s, orderFlags); /* orderFlags (2 bytes) */\n\tStream_Write(s, settings->OrderSupport, 32); /* orderSupport (32 bytes) */\n\tStream_Write_UINT16(s, 0); /* textFlags (2 bytes) */\n\tStream_Write_UINT16(s, orderSupportExFlags); /* orderSupportExFlags (2 bytes) */\n\tStream_Write_UINT32(s, 0); /* pad4OctetsB (4 bytes) */\n\tStream_Write_UINT32(s, 230400); /* desktopSaveSize (4 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsC (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsD (2 bytes) */\n\tStream_Write_UINT16(s, textANSICodePage); /* textANSICodePage (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsE (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_ORDER);\n\treturn TRUE;\n}",
  1021. "project": "FreeRDP",
  1022. "hash": 62966291564570637375163967456258879772,
  1023. "size": 52,
  1024. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1025. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1026. "target": 0,
  1027. "dataset": "other",
  1028. "idx": 409577
  1029. },
  1030. {
  1031. "func": "static BOOL rdp_write_general_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tUINT16 extraFlags;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\textraFlags = 0;\n\n\tif (settings->LongCredentialsSupported)\n\t\textraFlags |= LONG_CREDENTIALS_SUPPORTED;\n\n\tif (settings->NoBitmapCompressionHeader)\n\t\textraFlags |= NO_BITMAP_COMPRESSION_HDR;\n\n\tif (settings->AutoReconnectionEnabled)\n\t\textraFlags |= AUTORECONNECT_SUPPORTED;\n\n\tif (settings->FastPathOutput)\n\t\textraFlags |= FASTPATH_OUTPUT_SUPPORTED;\n\n\tif (settings->SaltedChecksum)\n\t\textraFlags |= ENC_SALTED_CHECKSUM;\n\n\tif ((settings->OsMajorType > UINT16_MAX) || (settings->OsMinorType > UINT16_MAX))\n\t{\n\t\tWLog_ERR(TAG,\n\t\t \"OsMajorType=%08\" PRIx32 \", OsMinorType=%08\" PRIx32\n\t\t \" they need to be smaller %04\" PRIx16,\n\t\t settings->OsMajorType, settings->OsMinorType, UINT16_MAX);\n\t\treturn FALSE;\n\t}\n\tStream_Write_UINT16(s, (UINT16)settings->OsMajorType); /* osMajorType (2 bytes) */\n\tStream_Write_UINT16(s, (UINT16)settings->OsMinorType); /* osMinorType (2 bytes) */\n\tStream_Write_UINT16(s, CAPS_PROTOCOL_VERSION); /* protocolVersion (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* generalCompressionTypes (2 bytes) */\n\tStream_Write_UINT16(s, extraFlags); /* extraFlags (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* updateCapabilityFlag (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* remoteUnshareFlag (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* generalCompressionLevel (2 bytes) */\n\tStream_Write_UINT8(s, settings->RefreshRect ? 1 : 0); /* refreshRectSupport (1 byte) */\n\tStream_Write_UINT8(s, settings->SuppressOutput ? 1 : 0); /* suppressOutputSupport (1 byte) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_GENERAL);\n\treturn TRUE;\n}",
  1032. "project": "FreeRDP",
  1033. "hash": 73312758503643501467084662633560847526,
  1034. "size": 50,
  1035. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1036. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1037. "target": 0,
  1038. "dataset": "other",
  1039. "idx": 409637
  1040. },
  1041. {
  1042. "func": "static BOOL rdp_print_bitmap_cache_host_support_capability_set(wStream* s, UINT16 length)\n{\n\tBYTE cacheVersion;\n\tBYTE pad1;\n\tUINT16 pad2;\n\tWLog_INFO(TAG, \"BitmapCacheHostSupportCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT8(s, cacheVersion); /* cacheVersion (1 byte) */\n\tStream_Read_UINT8(s, pad1); /* pad1 (1 byte) */\n\tStream_Read_UINT16(s, pad2); /* pad2 (2 bytes) */\n\tWLog_INFO(TAG, \"\\tcacheVersion: 0x%02\" PRIX8 \"\", cacheVersion);\n\tWLog_INFO(TAG, \"\\tpad1: 0x%02\" PRIX8 \"\", pad1);\n\tWLog_INFO(TAG, \"\\tpad2: 0x%04\" PRIX16 \"\", pad2);\n\treturn TRUE;\n}",
  1043. "project": "FreeRDP",
  1044. "hash": 160808522847092520296495320523643539377,
  1045. "size": 18,
  1046. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1047. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1048. "target": 0,
  1049. "dataset": "other",
  1050. "idx": 409575
  1051. },
  1052. {
  1053. "func": "static BOOL rdp_write_jpeg_server_capability_container(wStream* s, const rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 8))\n\t\treturn FALSE;\n\n\tStream_Write_UINT16(s, 1); /* codecPropertiesLength */\n\tStream_Write_UINT8(s, 75);\n\treturn TRUE;\n}",
  1054. "project": "FreeRDP",
  1055. "hash": 333617504875696343154040639255234735592,
  1056. "size": 10,
  1057. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1058. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1059. "target": 0,
  1060. "dataset": "other",
  1061. "idx": 409600
  1062. },
  1063. {
  1064. "func": "static BOOL rdp_read_sound_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tUINT16 soundFlags;\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, soundFlags); /* soundFlags (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */\n\tsettings->SoundBeepsEnabled = (soundFlags & SOUND_BEEPS_FLAG) ? TRUE : FALSE;\n\treturn TRUE;\n}",
  1065. "project": "FreeRDP",
  1066. "hash": 168130594877741834723027781386436848480,
  1067. "size": 12,
  1068. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1069. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1070. "target": 0,
  1071. "dataset": "other",
  1072. "idx": 409613
  1073. },
  1074. {
  1075. "func": "static BOOL rdp_write_window_activation_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(s, 0); /* helpKeyFlag (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* helpKeyIndexFlag (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* helpExtendedKeyFlag (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* windowManagerKeyFlag (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_ACTIVATION);\n\treturn TRUE;\n}",
  1076. "project": "FreeRDP",
  1077. "hash": 39519253932521963435868974399763685508,
  1078. "size": 18,
  1079. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1080. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1081. "target": 0,
  1082. "dataset": "other",
  1083. "idx": 409639
  1084. },
  1085. {
  1086. "func": "static BOOL rdp_print_general_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 osMajorType;\n\tUINT16 osMinorType;\n\tUINT16 protocolVersion;\n\tUINT16 pad2OctetsA;\n\tUINT16 generalCompressionTypes;\n\tUINT16 extraFlags;\n\tUINT16 updateCapabilityFlag;\n\tUINT16 remoteUnshareFlag;\n\tUINT16 generalCompressionLevel;\n\tBYTE refreshRectSupport;\n\tBYTE suppressOutputSupport;\n\n\tif (length < 24)\n\t\treturn FALSE;\n\n\tWLog_INFO(TAG, \"GeneralCapabilitySet (length %\" PRIu16 \"):\", length);\n\tStream_Read_UINT16(s, osMajorType); /* osMajorType (2 bytes) */\n\tStream_Read_UINT16(s, osMinorType); /* osMinorType (2 bytes) */\n\tStream_Read_UINT16(s, protocolVersion); /* protocolVersion (2 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsA); /* pad2OctetsA (2 bytes) */\n\tStream_Read_UINT16(s, generalCompressionTypes); /* generalCompressionTypes (2 bytes) */\n\tStream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */\n\tStream_Read_UINT16(s, updateCapabilityFlag); /* updateCapabilityFlag (2 bytes) */\n\tStream_Read_UINT16(s, remoteUnshareFlag); /* remoteUnshareFlag (2 bytes) */\n\tStream_Read_UINT16(s, generalCompressionLevel); /* generalCompressionLevel (2 bytes) */\n\tStream_Read_UINT8(s, refreshRectSupport); /* refreshRectSupport (1 byte) */\n\tStream_Read_UINT8(s, suppressOutputSupport); /* suppressOutputSupport (1 byte) */\n\tWLog_INFO(TAG, \"\\tosMajorType: 0x%04\" PRIX16 \"\", osMajorType);\n\tWLog_INFO(TAG, \"\\tosMinorType: 0x%04\" PRIX16 \"\", osMinorType);\n\tWLog_INFO(TAG, \"\\tprotocolVersion: 0x%04\" PRIX16 \"\", protocolVersion);\n\tWLog_INFO(TAG, \"\\tpad2OctetsA: 0x%04\" PRIX16 \"\", pad2OctetsA);\n\tWLog_INFO(TAG, \"\\tgeneralCompressionTypes: 0x%04\" PRIX16 \"\", generalCompressionTypes);\n\tWLog_INFO(TAG, \"\\textraFlags: 0x%04\" PRIX16 \"\", extraFlags);\n\tWLog_INFO(TAG, \"\\tupdateCapabilityFlag: 0x%04\" PRIX16 \"\", updateCapabilityFlag);\n\tWLog_INFO(TAG, \"\\tremoteUnshareFlag: 0x%04\" PRIX16 \"\", remoteUnshareFlag);\n\tWLog_INFO(TAG, \"\\tgeneralCompressionLevel: 0x%04\" PRIX16 \"\", generalCompressionLevel);\n\tWLog_INFO(TAG, \"\\trefreshRectSupport: 0x%02\" PRIX8 \"\", refreshRectSupport);\n\tWLog_INFO(TAG, \"\\tsuppressOutputSupport: 0x%02\" PRIX8 \"\", suppressOutputSupport);\n\treturn TRUE;\n}",
  1087. "project": "FreeRDP",
  1088. "hash": 5500072580712139778494173931145880946,
  1089. "size": 42,
  1090. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1091. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1092. "target": 0,
  1093. "dataset": "other",
  1094. "idx": 409631
  1095. },
  1096. {
  1097. "func": "static BOOL rdp_read_remote_programs_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tUINT32 railSupportLevel;\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, railSupportLevel); /* railSupportLevel (4 bytes) */\n\n\tif ((railSupportLevel & RAIL_LEVEL_SUPPORTED) == 0)\n\t{\n\t\tif (settings->RemoteApplicationMode == TRUE)\n\t\t{\n\t\t\t/* RemoteApp Failure! */\n\t\t\tsettings->RemoteApplicationMode = FALSE;\n\t\t}\n\t}\n\n\t/* 2.2.2.2.3 HandshakeEx PDU (TS_RAIL_ORDER_HANDSHAKE_EX)\n\t * the handshake ex pdu is supported when both, client and server announce\n\t * it OR if we are ready to begin enhanced remoteAPP mode. */\n\tif (settings->RemoteApplicationMode)\n\t\trailSupportLevel |= RAIL_LEVEL_HANDSHAKE_EX_SUPPORTED;\n\n\tsettings->RemoteApplicationSupportLevel =\n\t railSupportLevel & settings->RemoteApplicationSupportMask;\n\treturn TRUE;\n}",
  1098. "project": "FreeRDP",
  1099. "hash": 133850945589594759190444119473191077444,
  1100. "size": 29,
  1101. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1102. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1103. "target": 0,
  1104. "dataset": "other",
  1105. "idx": 409595
  1106. },
  1107. {
  1108. "func": "static BOOL rdp_print_multifragment_update_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 maxRequestSize;\n\tWLog_INFO(TAG, \"MultifragmentUpdateCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, maxRequestSize); /* maxRequestSize (4 bytes) */\n\tWLog_INFO(TAG, \"\\tmaxRequestSize: 0x%08\" PRIX32 \"\", maxRequestSize);\n\treturn TRUE;\n}",
  1109. "project": "FreeRDP",
  1110. "hash": 249919513915138150249317489840873024684,
  1111. "size": 12,
  1112. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1113. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1114. "target": 0,
  1115. "dataset": "other",
  1116. "idx": 409691
  1117. },
  1118. {
  1119. "func": "static BOOL rdp_print_bitmap_codecs_capability_set(wStream* s, UINT16 length)\n{\n\tGUID codecGuid;\n\tBYTE bitmapCodecCount;\n\tBYTE codecId;\n\tUINT16 codecPropertiesLength;\n\tUINT16 remainingLength;\n\tWLog_INFO(TAG, \"BitmapCodecsCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 5)\n\t\treturn FALSE;\n\n\tStream_Read_UINT8(s, bitmapCodecCount); /* bitmapCodecCount (1 byte) */\n\tremainingLength = length - 5;\n\tWLog_INFO(TAG, \"\\tbitmapCodecCount: %\" PRIu8 \"\", bitmapCodecCount);\n\n\twhile (bitmapCodecCount > 0)\n\t{\n\t\tif (remainingLength < 19)\n\t\t\treturn FALSE;\n\n\t\trdp_read_bitmap_codec_guid(s, &codecGuid); /* codecGuid (16 bytes) */\n\t\tStream_Read_UINT8(s, codecId); /* codecId (1 byte) */\n\t\tWLog_INFO(TAG, \"\\tcodecGuid: 0x\");\n\t\trdp_print_bitmap_codec_guid(&codecGuid);\n\t\tWLog_INFO(TAG, \" (%s)\", rdp_get_bitmap_codec_guid_name(&codecGuid));\n\t\tWLog_INFO(TAG, \"\\tcodecId: %\" PRIu8 \"\", codecId);\n\t\tStream_Read_UINT16(s, codecPropertiesLength); /* codecPropertiesLength (2 bytes) */\n\t\tWLog_INFO(TAG, \"\\tcodecPropertiesLength: %\" PRIu16 \"\", codecPropertiesLength);\n\t\tremainingLength -= 19;\n\n\t\tif (remainingLength < codecPropertiesLength)\n\t\t\treturn FALSE;\n\n\t\tStream_Seek(s, codecPropertiesLength); /* codecProperties */\n\t\tremainingLength -= codecPropertiesLength;\n\t\tbitmapCodecCount--;\n\t}\n\n\treturn TRUE;\n}",
  1120. "project": "FreeRDP",
  1121. "hash": 24114546032535399803500638112004720719,
  1122. "size": 41,
  1123. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1124. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1125. "target": 0,
  1126. "dataset": "other",
  1127. "idx": 409582
  1128. },
  1129. {
  1130. "func": "static BOOL rdp_print_order_capability_set(wStream* s, UINT16 length)\n{\n\tBYTE terminalDescriptor[16];\n\tUINT32 pad4OctetsA;\n\tUINT16 desktopSaveXGranularity;\n\tUINT16 desktopSaveYGranularity;\n\tUINT16 pad2OctetsA;\n\tUINT16 maximumOrderLevel;\n\tUINT16 numberFonts;\n\tUINT16 orderFlags;\n\tBYTE orderSupport[32];\n\tUINT16 textFlags;\n\tUINT16 orderSupportExFlags;\n\tUINT32 pad4OctetsB;\n\tUINT32 desktopSaveSize;\n\tUINT16 pad2OctetsC;\n\tUINT16 pad2OctetsD;\n\tUINT16 textANSICodePage;\n\tUINT16 pad2OctetsE;\n\tWLog_INFO(TAG, \"OrderCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 88)\n\t\treturn FALSE;\n\n\tStream_Read(s, terminalDescriptor, 16); /* terminalDescriptor (16 bytes) */\n\tStream_Read_UINT32(s, pad4OctetsA); /* pad4OctetsA (4 bytes) */\n\tStream_Read_UINT16(s, desktopSaveXGranularity); /* desktopSaveXGranularity (2 bytes) */\n\tStream_Read_UINT16(s, desktopSaveYGranularity); /* desktopSaveYGranularity (2 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsA); /* pad2OctetsA (2 bytes) */\n\tStream_Read_UINT16(s, maximumOrderLevel); /* maximumOrderLevel (2 bytes) */\n\tStream_Read_UINT16(s, numberFonts); /* numberFonts (2 bytes) */\n\tStream_Read_UINT16(s, orderFlags); /* orderFlags (2 bytes) */\n\tStream_Read(s, orderSupport, 32); /* orderSupport (32 bytes) */\n\tStream_Read_UINT16(s, textFlags); /* textFlags (2 bytes) */\n\tStream_Read_UINT16(s, orderSupportExFlags); /* orderSupportExFlags (2 bytes) */\n\tStream_Read_UINT32(s, pad4OctetsB); /* pad4OctetsB (4 bytes) */\n\tStream_Read_UINT32(s, desktopSaveSize); /* desktopSaveSize (4 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsC); /* pad2OctetsC (2 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsD); /* pad2OctetsD (2 bytes) */\n\tStream_Read_UINT16(s, textANSICodePage); /* textANSICodePage (2 bytes) */\n\tStream_Read_UINT16(s, pad2OctetsE); /* pad2OctetsE (2 bytes) */\n\tWLog_INFO(TAG, \"\\tpad4OctetsA: 0x%08\" PRIX32 \"\", pad4OctetsA);\n\tWLog_INFO(TAG, \"\\tdesktopSaveXGranularity: 0x%04\" PRIX16 \"\", desktopSaveXGranularity);\n\tWLog_INFO(TAG, \"\\tdesktopSaveYGranularity: 0x%04\" PRIX16 \"\", desktopSaveYGranularity);\n\tWLog_INFO(TAG, \"\\tpad2OctetsA: 0x%04\" PRIX16 \"\", pad2OctetsA);\n\tWLog_INFO(TAG, \"\\tmaximumOrderLevel: 0x%04\" PRIX16 \"\", maximumOrderLevel);\n\tWLog_INFO(TAG, \"\\tnumberFonts: 0x%04\" PRIX16 \"\", numberFonts);\n\tWLog_INFO(TAG, \"\\torderFlags: 0x%04\" PRIX16 \"\", orderFlags);\n\tWLog_INFO(TAG, \"\\torderSupport:\");\n\tWLog_INFO(TAG, \"\\t\\tDSTBLT: %\" PRIu8 \"\", orderSupport[NEG_DSTBLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tPATBLT: %\" PRIu8 \"\", orderSupport[NEG_PATBLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tSCRBLT: %\" PRIu8 \"\", orderSupport[NEG_SCRBLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMEMBLT: %\" PRIu8 \"\", orderSupport[NEG_MEMBLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMEM3BLT: %\" PRIu8 \"\", orderSupport[NEG_MEM3BLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tATEXTOUT: %\" PRIu8 \"\", orderSupport[NEG_ATEXTOUT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tAEXTTEXTOUT: %\" PRIu8 \"\", orderSupport[NEG_AEXTTEXTOUT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tDRAWNINEGRID: %\" PRIu8 \"\", orderSupport[NEG_DRAWNINEGRID_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tLINETO: %\" PRIu8 \"\", orderSupport[NEG_LINETO_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMULTI_DRAWNINEGRID: %\" PRIu8 \"\",\n\t orderSupport[NEG_MULTI_DRAWNINEGRID_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tOPAQUE_RECT: %\" PRIu8 \"\", orderSupport[NEG_OPAQUE_RECT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tSAVEBITMAP: %\" PRIu8 \"\", orderSupport[NEG_SAVEBITMAP_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tWTEXTOUT: %\" PRIu8 \"\", orderSupport[NEG_WTEXTOUT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMEMBLT_V2: %\" PRIu8 \"\", orderSupport[NEG_MEMBLT_V2_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMEM3BLT_V2: %\" PRIu8 \"\", orderSupport[NEG_MEM3BLT_V2_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMULTIDSTBLT: %\" PRIu8 \"\", orderSupport[NEG_MULTIDSTBLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMULTIPATBLT: %\" PRIu8 \"\", orderSupport[NEG_MULTIPATBLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMULTISCRBLT: %\" PRIu8 \"\", orderSupport[NEG_MULTISCRBLT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tMULTIOPAQUERECT: %\" PRIu8 \"\", orderSupport[NEG_MULTIOPAQUERECT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tFAST_INDEX: %\" PRIu8 \"\", orderSupport[NEG_FAST_INDEX_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tPOLYGON_SC: %\" PRIu8 \"\", orderSupport[NEG_POLYGON_SC_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tPOLYGON_CB: %\" PRIu8 \"\", orderSupport[NEG_POLYGON_CB_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tPOLYLINE: %\" PRIu8 \"\", orderSupport[NEG_POLYLINE_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tUNUSED23: %\" PRIu8 \"\", orderSupport[NEG_UNUSED23_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tFAST_GLYPH: %\" PRIu8 \"\", orderSupport[NEG_FAST_GLYPH_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tELLIPSE_SC: %\" PRIu8 \"\", orderSupport[NEG_ELLIPSE_SC_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tELLIPSE_CB: %\" PRIu8 \"\", orderSupport[NEG_ELLIPSE_CB_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tGLYPH_INDEX: %\" PRIu8 \"\", orderSupport[NEG_GLYPH_INDEX_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tGLYPH_WEXTTEXTOUT: %\" PRIu8 \"\", orderSupport[NEG_GLYPH_WEXTTEXTOUT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tGLYPH_WLONGTEXTOUT: %\" PRIu8 \"\",\n\t orderSupport[NEG_GLYPH_WLONGTEXTOUT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tGLYPH_WLONGEXTTEXTOUT: %\" PRIu8 \"\",\n\t orderSupport[NEG_GLYPH_WLONGEXTTEXTOUT_INDEX]);\n\tWLog_INFO(TAG, \"\\t\\tUNUSED31: %\" PRIu8 \"\", orderSupport[NEG_UNUSED31_INDEX]);\n\tWLog_INFO(TAG, \"\\ttextFlags: 0x%04\" PRIX16 \"\", textFlags);\n\tWLog_INFO(TAG, \"\\torderSupportExFlags: 0x%04\" PRIX16 \"\", orderSupportExFlags);\n\tWLog_INFO(TAG, \"\\tpad4OctetsB: 0x%08\" PRIX32 \"\", pad4OctetsB);\n\tWLog_INFO(TAG, \"\\tdesktopSaveSize: 0x%08\" PRIX32 \"\", desktopSaveSize);\n\tWLog_INFO(TAG, \"\\tpad2OctetsC: 0x%04\" PRIX16 \"\", pad2OctetsC);\n\tWLog_INFO(TAG, \"\\tpad2OctetsD: 0x%04\" PRIX16 \"\", pad2OctetsD);\n\tWLog_INFO(TAG, \"\\ttextANSICodePage: 0x%04\" PRIX16 \"\", textANSICodePage);\n\tWLog_INFO(TAG, \"\\tpad2OctetsE: 0x%04\" PRIX16 \"\", pad2OctetsE);\n\treturn TRUE;\n}",
  1131. "project": "FreeRDP",
  1132. "hash": 314984488369612595242281546417973409324,
  1133. "size": 94,
  1134. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1135. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1136. "target": 0,
  1137. "dataset": "other",
  1138. "idx": 409634
  1139. },
  1140. {
  1141. "func": "static BOOL rdp_write_bitmap_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tBYTE drawingFlags = 0;\n\tUINT16 preferredBitsPerPixel;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tif (settings->DrawAllowSkipAlpha)\n\t\tdrawingFlags |= DRAW_ALLOW_SKIP_ALPHA;\n\n\tif (settings->DrawAllowDynamicColorFidelity)\n\t\tdrawingFlags |= DRAW_ALLOW_DYNAMIC_COLOR_FIDELITY;\n\n\tif (settings->DrawAllowColorSubsampling)\n\t\tdrawingFlags |= DRAW_ALLOW_COLOR_SUBSAMPLING; /* currently unimplemented */\n\n\t/* While bitmap_decode.c now implements YCoCg, in turning it\n\t * on we have found Microsoft is inconsistent on whether to invert R & B.\n\t * And it's not only from one server to another; on Win7/2008R2, it appears\n\t * to send the main content with a different inversion than the Windows\n\t * button! So... don't advertise that we support YCoCg and the server\n\t * will not send it. YCoCg is still needed for EGFX, but it at least\n\t * appears consistent in its use.\n\t */\n\n\tif ((settings->ColorDepth > UINT16_MAX) || (settings->DesktopWidth > UINT16_MAX) ||\n\t (settings->DesktopHeight > UINT16_MAX) || (settings->DesktopResize > UINT16_MAX))\n\t\treturn FALSE;\n\n\tif (settings->RdpVersion >= RDP_VERSION_5_PLUS)\n\t\tpreferredBitsPerPixel = (UINT16)settings->ColorDepth;\n\telse\n\t\tpreferredBitsPerPixel = 8;\n\n\tStream_Write_UINT16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */\n\tStream_Write_UINT16(s, 1); /* receive1BitPerPixel (2 bytes) */\n\tStream_Write_UINT16(s, 1); /* receive4BitsPerPixel (2 bytes) */\n\tStream_Write_UINT16(s, 1); /* receive8BitsPerPixel (2 bytes) */\n\tStream_Write_UINT16(s, (UINT16)settings->DesktopWidth); /* desktopWidth (2 bytes) */\n\tStream_Write_UINT16(s, (UINT16)settings->DesktopHeight); /* desktopHeight (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */\n\tStream_Write_UINT16(s, (UINT16)settings->DesktopResize); /* desktopResizeFlag (2 bytes) */\n\tStream_Write_UINT16(s, 1); /* bitmapCompressionFlag (2 bytes) */\n\tStream_Write_UINT8(s, 0); /* highColorFlags (1 byte) */\n\tStream_Write_UINT8(s, drawingFlags); /* drawingFlags (1 byte) */\n\tStream_Write_UINT16(s, 1); /* multipleRectangleSupport (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2OctetsB (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_BITMAP);\n\treturn TRUE;\n}",
  1142. "project": "FreeRDP",
  1143. "hash": 214825058683404299590112235974415655493,
  1144. "size": 55,
  1145. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1146. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1147. "target": 0,
  1148. "dataset": "other",
  1149. "idx": 409633
  1150. },
  1151. {
  1152. "func": "static void rdp_read_capability_set_header(wStream* s, UINT16* length, UINT16* type)\n{\n\tStream_Read_UINT16(s, *type); /* capabilitySetType */\n\tStream_Read_UINT16(s, *length); /* lengthCapability */\n}",
  1153. "project": "FreeRDP",
  1154. "hash": 80707266597010700872327549120082707400,
  1155. "size": 5,
  1156. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1157. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1158. "target": 0,
  1159. "dataset": "other",
  1160. "idx": 409594
  1161. },
  1162. {
  1163. "func": "static BOOL rdp_write_bitmap_codecs_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\tBYTE bitmapCodecCount;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tbitmapCodecCount = 0;\n\n\tif (settings->RemoteFxCodec)\n\t\tbitmapCodecCount++;\n\n\tif (settings->NSCodec)\n\t\tbitmapCodecCount++;\n\n#if defined(WITH_JPEG)\n\n\tif (settings->JpegCodec)\n\t\tbitmapCodecCount++;\n\n#endif\n\n\tif (settings->RemoteFxImageCodec)\n\t\tbitmapCodecCount++;\n\n\tStream_Write_UINT8(s, bitmapCodecCount);\n\n\tif (settings->RemoteFxCodec)\n\t{\n\t\trdp_write_bitmap_codec_guid(s, &CODEC_GUID_REMOTEFX); /* codecGUID */\n\n\t\tif (settings->ServerMode)\n\t\t{\n\t\t\tStream_Write_UINT8(s, 0); /* codecID is defined by the client */\n\n\t\t\tif (!rdp_write_rfx_server_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tStream_Write_UINT8(s, RDP_CODEC_ID_REMOTEFX); /* codecID */\n\n\t\t\tif (!rdp_write_rfx_client_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\tif (settings->NSCodec)\n\t{\n\t\trdp_write_bitmap_codec_guid(s, &CODEC_GUID_NSCODEC); /* codecGUID */\n\n\t\tif (settings->ServerMode)\n\t\t{\n\t\t\tStream_Write_UINT8(s, 0); /* codecID is defined by the client */\n\n\t\t\tif (!rdp_write_nsc_server_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tStream_Write_UINT8(s, RDP_CODEC_ID_NSCODEC); /* codecID */\n\n\t\t\tif (!rdp_write_nsc_client_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n#if defined(WITH_JPEG)\n\n\tif (settings->JpegCodec)\n\t{\n\t\trdp_write_bitmap_codec_guid(s, &CODEC_GUID_JPEG); /* codecGUID */\n\n\t\tif (settings->ServerMode)\n\t\t{\n\t\t\tStream_Write_UINT8(s, 0); /* codecID is defined by the client */\n\n\t\t\tif (!rdp_write_jpeg_server_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tStream_Write_UINT8(s, RDP_CODEC_ID_JPEG); /* codecID */\n\n\t\t\tif (!rdp_write_jpeg_client_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n#endif\n\n\tif (settings->RemoteFxImageCodec)\n\t{\n\t\trdp_write_bitmap_codec_guid(s, &CODEC_GUID_IMAGE_REMOTEFX); /* codecGUID */\n\n\t\tif (settings->ServerMode)\n\t\t{\n\t\t\tStream_Write_UINT8(s, 0); /* codecID is defined by the client */\n\n\t\t\tif (!rdp_write_rfx_server_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tStream_Write_UINT8(s, RDP_CODEC_ID_IMAGE_REMOTEFX); /* codecID */\n\n\t\t\tif (!rdp_write_rfx_client_capability_container(s, settings))\n\t\t\t\treturn FALSE;\n\t\t}\n\t}\n\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_BITMAP_CODECS);\n\treturn TRUE;\n}",
  1164. "project": "FreeRDP",
  1165. "hash": 332928462654213428990596858954074010072,
  1166. "size": 116,
  1167. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1168. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1169. "target": 0,
  1170. "dataset": "other",
  1171. "idx": 409660
  1172. },
  1173. {
  1174. "func": "static BOOL rdp_write_jpeg_client_capability_container(wStream* s, const rdpSettings* settings)\n{\n\tif (!Stream_EnsureRemainingCapacity(s, 8))\n\t\treturn FALSE;\n\n\tStream_Write_UINT16(s, 1); /* codecPropertiesLength */\n\tStream_Write_UINT8(s, settings->JpegQuality);\n\treturn TRUE;\n}",
  1175. "project": "FreeRDP",
  1176. "hash": 230066296694265455843662918473236864709,
  1177. "size": 9,
  1178. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1179. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1180. "target": 0,
  1181. "dataset": "other",
  1182. "idx": 409664
  1183. },
  1184. {
  1185. "func": "static void rdp_read_cache_definition(wStream* s, GLYPH_CACHE_DEFINITION* cache_definition)\n{\n\tStream_Read_UINT16(s, cache_definition->cacheEntries); /* cacheEntries (2 bytes) */\n\tStream_Read_UINT16(s,\n\t cache_definition->cacheMaximumCellSize); /* cacheMaximumCellSize (2 bytes) */\n}",
  1186. "project": "FreeRDP",
  1187. "hash": 45805913852648643995751491508146469984,
  1188. "size": 6,
  1189. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1190. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1191. "target": 0,
  1192. "dataset": "other",
  1193. "idx": 409666
  1194. },
  1195. {
  1196. "func": "static BOOL rdp_read_draw_nine_grid_cache_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tUINT32 drawNineGridSupportLevel;\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, drawNineGridSupportLevel); /* drawNineGridSupportLevel (4 bytes) */\n\tStream_Read_UINT16(s, settings->DrawNineGridCacheSize); /* drawNineGridCacheSize (2 bytes) */\n\tStream_Read_UINT16(s,\n\t settings->DrawNineGridCacheEntries); /* drawNineGridCacheEntries (2 bytes) */\n\n\tif ((drawNineGridSupportLevel & DRAW_NINEGRID_SUPPORTED) ||\n\t (drawNineGridSupportLevel & DRAW_NINEGRID_SUPPORTED_V2))\n\t\tsettings->DrawNineGridEnabled = TRUE;\n\n\treturn TRUE;\n}",
  1197. "project": "FreeRDP",
  1198. "hash": 40633978534520824703644583410869744929,
  1199. "size": 19,
  1200. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1201. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1202. "target": 0,
  1203. "dataset": "other",
  1204. "idx": 409632
  1205. },
  1206. {
  1207. "func": "static BOOL rdp_print_desktop_composition_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 compDeskSupportLevel;\n\tWLog_INFO(TAG, \"DesktopCompositionCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 6)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, compDeskSupportLevel); /* compDeskSupportLevel (2 bytes) */\n\tWLog_INFO(TAG, \"\\tcompDeskSupportLevel: 0x%04\" PRIX16 \"\", compDeskSupportLevel);\n\treturn TRUE;\n}",
  1208. "project": "FreeRDP",
  1209. "hash": 210379168711159173994520293055281545595,
  1210. "size": 12,
  1211. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1212. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1213. "target": 0,
  1214. "dataset": "other",
  1215. "idx": 409641
  1216. },
  1217. {
  1218. "func": "static void rdp_write_bitmap_codec_guid(wStream* s, const GUID* guid)\n{\n\tBYTE g[16];\n\tg[0] = guid->Data1 & 0xFF;\n\tg[1] = (guid->Data1 >> 8) & 0xFF;\n\tg[2] = (guid->Data1 >> 16) & 0xFF;\n\tg[3] = (guid->Data1 >> 24) & 0xFF;\n\tg[4] = (guid->Data2) & 0xFF;\n\tg[5] = (guid->Data2 >> 8) & 0xFF;\n\tg[6] = (guid->Data3) & 0xFF;\n\tg[7] = (guid->Data3 >> 8) & 0xFF;\n\tg[8] = guid->Data4[0];\n\tg[9] = guid->Data4[1];\n\tg[10] = guid->Data4[2];\n\tg[11] = guid->Data4[3];\n\tg[12] = guid->Data4[4];\n\tg[13] = guid->Data4[5];\n\tg[14] = guid->Data4[6];\n\tg[15] = guid->Data4[7];\n\tStream_Write(s, g, 16);\n}",
  1219. "project": "FreeRDP",
  1220. "hash": 325767040754059587070181348175035488638,
  1221. "size": 21,
  1222. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1223. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1224. "target": 0,
  1225. "dataset": "other",
  1226. "idx": 409668
  1227. },
  1228. {
  1229. "func": "static BOOL rdp_print_draw_gdiplus_cache_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 drawGdiPlusSupportLevel;\n\tUINT32 GdipVersion;\n\tUINT32 drawGdiplusCacheLevel;\n\tWLog_INFO(TAG, \"DrawGdiPlusCacheCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 40)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, drawGdiPlusSupportLevel); /* drawGdiPlusSupportLevel (4 bytes) */\n\tStream_Read_UINT32(s, GdipVersion); /* GdipVersion (4 bytes) */\n\tStream_Read_UINT32(s, drawGdiplusCacheLevel); /* drawGdiPlusCacheLevel (4 bytes) */\n\tStream_Seek(s, 10); /* GdipCacheEntries (10 bytes) */\n\tStream_Seek(s, 8); /* GdipCacheChunkSize (8 bytes) */\n\tStream_Seek(s, 6); /* GdipImageCacheProperties (6 bytes) */\n\treturn TRUE;\n}",
  1230. "project": "FreeRDP",
  1231. "hash": 2012687523423089845955647994143606739,
  1232. "size": 18,
  1233. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1234. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1235. "target": 0,
  1236. "dataset": "other",
  1237. "idx": 409644
  1238. },
  1239. {
  1240. "func": "static BOOL rdp_write_glyph_cache_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 64))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tif (settings->GlyphSupportLevel > UINT16_MAX)\n\t\treturn FALSE;\n\t/* glyphCache (40 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[0])); /* glyphCache0 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[1])); /* glyphCache1 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[2])); /* glyphCache2 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[3])); /* glyphCache3 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[4])); /* glyphCache4 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[5])); /* glyphCache5 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[6])); /* glyphCache6 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[7])); /* glyphCache7 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[8])); /* glyphCache8 (4 bytes) */\n\trdp_write_cache_definition(s, &(settings->GlyphCache[9])); /* glyphCache9 (4 bytes) */\n\trdp_write_cache_definition(s, settings->FragCache); /* fragCache (4 bytes) */\n\tStream_Write_UINT16(s, (UINT16)settings->GlyphSupportLevel); /* glyphSupportLevel (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_GLYPH_CACHE);\n\treturn TRUE;\n}",
  1241. "project": "FreeRDP",
  1242. "hash": 147467838726629004619531519247747352656,
  1243. "size": 29,
  1244. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1245. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1246. "target": 0,
  1247. "dataset": "other",
  1248. "idx": 409653
  1249. },
  1250. {
  1251. "func": "BOOL rdp_recv_demand_active(rdpRdp* rdp, wStream* s)\n{\n\tUINT16 channelId;\n\tUINT16 pduType;\n\tUINT16 pduLength;\n\tUINT16 pduSource;\n\tUINT16 length;\n\tUINT16 numberCapabilities;\n\tUINT16 lengthSourceDescriptor;\n\tUINT16 lengthCombinedCapabilities;\n\n\tif (!rdp_recv_get_active_header(rdp, s, &channelId, &length))\n\t\treturn FALSE;\n\n\tif (freerdp_shall_disconnect(rdp->instance))\n\t\treturn TRUE;\n\n\tif (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource))\n\t{\n\t\tWLog_ERR(TAG, \"rdp_read_share_control_header failed\");\n\t\treturn FALSE;\n\t}\n\n\tif (pduType == PDU_TYPE_DATA)\n\t{\n\t\t/**\n\t\t * We can receive a Save Session Info Data PDU containing a LogonErrorInfo\n\t\t * structure at this point from the server to indicate a connection error.\n\t\t */\n\t\tif (rdp_recv_data_pdu(rdp, s) < 0)\n\t\t\treturn FALSE;\n\n\t\treturn FALSE;\n\t}\n\n\tif (pduType != PDU_TYPE_DEMAND_ACTIVE)\n\t{\n\t\tif (pduType != PDU_TYPE_SERVER_REDIRECTION)\n\t\t\tWLog_ERR(TAG, \"expected PDU_TYPE_DEMAND_ACTIVE %04x, got %04\" PRIx16 \"\",\n\t\t\t PDU_TYPE_DEMAND_ACTIVE, pduType);\n\n\t\treturn FALSE;\n\t}\n\n\trdp->settings->PduSource = pduSource;\n\n\tif (Stream_GetRemainingLength(s) < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, rdp->settings->ShareId); /* shareId (4 bytes) */\n\tStream_Read_UINT16(s, lengthSourceDescriptor); /* lengthSourceDescriptor (2 bytes) */\n\tStream_Read_UINT16(s, lengthCombinedCapabilities); /* lengthCombinedCapabilities (2 bytes) */\n\n\tif (!Stream_SafeSeek(s, lengthSourceDescriptor) ||\n\t Stream_GetRemainingLength(s) < 4) /* sourceDescriptor */\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, numberCapabilities); /* numberCapabilities (2 bytes) */\n\tStream_Seek(s, 2); /* pad2Octets (2 bytes) */\n\n\t/* capabilitySets */\n\tif (!rdp_read_capability_sets(s, rdp->settings, numberCapabilities, lengthCombinedCapabilities))\n\t{\n\t\tWLog_ERR(TAG, \"rdp_read_capability_sets failed\");\n\t\treturn FALSE;\n\t}\n\n\tif (!Stream_SafeSeek(s, 4)) /* SessionId */\n\t\treturn FALSE;\n\n\trdp->update->secondary->glyph_v2 = (rdp->settings->GlyphSupportLevel > GLYPH_SUPPORT_FULL);\n\treturn tpkt_ensure_stream_consumed(s, length);\n}",
  1252. "project": "FreeRDP",
  1253. "hash": 44339431169826735119172547471406906347,
  1254. "size": 73,
  1255. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1256. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1257. "target": 0,
  1258. "dataset": "other",
  1259. "idx": 409604
  1260. },
  1261. {
  1262. "func": "static BOOL rdp_read_bitmap_cache_v3_codec_id_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tBYTE bitmapCacheV3CodecId;\n\n\tWINPR_UNUSED(settings);\n\tif (length < 5)\n\t\treturn FALSE;\n\n\tStream_Read_UINT8(s, bitmapCacheV3CodecId); /* bitmapCacheV3CodecId (1 byte) */\n\treturn TRUE;\n}",
  1263. "project": "FreeRDP",
  1264. "hash": 86826559054972396148544906904831060639,
  1265. "size": 12,
  1266. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1267. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1268. "target": 0,
  1269. "dataset": "other",
  1270. "idx": 409658
  1271. },
  1272. {
  1273. "func": "static BOOL rdp_print_glyph_cache_capability_set(wStream* s, UINT16 length)\n{\n\tGLYPH_CACHE_DEFINITION glyphCache[10];\n\tGLYPH_CACHE_DEFINITION fragCache;\n\tUINT16 glyphSupportLevel;\n\tUINT16 pad2Octets;\n\tWLog_INFO(TAG, \"GlyphCacheCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 52)\n\t\treturn FALSE;\n\n\t/* glyphCache (40 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[0]); /* glyphCache0 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[1]); /* glyphCache1 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[2]); /* glyphCache2 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[3]); /* glyphCache3 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[4]); /* glyphCache4 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[5]); /* glyphCache5 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[6]); /* glyphCache6 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[7]); /* glyphCache7 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[8]); /* glyphCache8 (4 bytes) */\n\trdp_read_cache_definition(s, &glyphCache[9]); /* glyphCache9 (4 bytes) */\n\trdp_read_cache_definition(s, &fragCache); /* fragCache (4 bytes) */\n\tStream_Read_UINT16(s, glyphSupportLevel); /* glyphSupportLevel (2 bytes) */\n\tStream_Read_UINT16(s, pad2Octets); /* pad2Octets (2 bytes) */\n\tWLog_INFO(TAG, \"\\tglyphCache0: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[0].cacheEntries, glyphCache[0].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache1: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[1].cacheEntries, glyphCache[1].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache2: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[2].cacheEntries, glyphCache[2].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache3: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[3].cacheEntries, glyphCache[3].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache4: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[4].cacheEntries, glyphCache[4].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache5: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[5].cacheEntries, glyphCache[5].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache6: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[6].cacheEntries, glyphCache[6].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache7: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[7].cacheEntries, glyphCache[7].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache8: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[8].cacheEntries, glyphCache[8].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphCache9: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t glyphCache[9].cacheEntries, glyphCache[9].cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tfragCache: Entries: %\" PRIu16 \" MaximumCellSize: %\" PRIu16 \"\",\n\t fragCache.cacheEntries, fragCache.cacheMaximumCellSize);\n\tWLog_INFO(TAG, \"\\tglyphSupportLevel: 0x%04\" PRIX16 \"\", glyphSupportLevel);\n\tWLog_INFO(TAG, \"\\tpad2Octets: 0x%04\" PRIX16 \"\", pad2Octets);\n\treturn TRUE;\n}",
  1274. "project": "FreeRDP",
  1275. "hash": 327012898936376103726124817366633874691,
  1276. "size": 51,
  1277. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1278. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1279. "target": 0,
  1280. "dataset": "other",
  1281. "idx": 409630
  1282. },
  1283. {
  1284. "func": "static BOOL rdp_print_pointer_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 colorPointerFlag;\n\tUINT16 colorPointerCacheSize;\n\tUINT16 pointerCacheSize;\n\n\tif (length < 10)\n\t\treturn FALSE;\n\n\tWLog_INFO(TAG, \"PointerCapabilitySet (length %\" PRIu16 \"):\", length);\n\tStream_Read_UINT16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */\n\tStream_Read_UINT16(s, colorPointerCacheSize); /* colorPointerCacheSize (2 bytes) */\n\tStream_Read_UINT16(s, pointerCacheSize); /* pointerCacheSize (2 bytes) */\n\tWLog_INFO(TAG, \"\\tcolorPointerFlag: 0x%04\" PRIX16 \"\", colorPointerFlag);\n\tWLog_INFO(TAG, \"\\tcolorPointerCacheSize: 0x%04\" PRIX16 \"\", colorPointerCacheSize);\n\tWLog_INFO(TAG, \"\\tpointerCacheSize: 0x%04\" PRIX16 \"\", pointerCacheSize);\n\treturn TRUE;\n}",
  1285. "project": "FreeRDP",
  1286. "hash": 303759523317706528285641459907488762007,
  1287. "size": 18,
  1288. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1289. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1290. "target": 0,
  1291. "dataset": "other",
  1292. "idx": 409662
  1293. },
  1294. {
  1295. "func": "static BOOL rdp_write_font_capability_set(wStream* s, const rdpSettings* settings)\n{\n\tsize_t header;\n\n\tWINPR_UNUSED(settings);\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\theader = rdp_capability_set_start(s);\n\tif (header > UINT16_MAX)\n\t\treturn FALSE;\n\tStream_Write_UINT16(s, FONTSUPPORT_FONTLIST); /* fontSupportFlags (2 bytes) */\n\tStream_Write_UINT16(s, 0); /* pad2Octets (2 bytes) */\n\trdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_FONT);\n\treturn TRUE;\n}",
  1296. "project": "FreeRDP",
  1297. "hash": 77739938369199003807908763104333147952,
  1298. "size": 16,
  1299. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1300. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1301. "target": 0,
  1302. "dataset": "other",
  1303. "idx": 409669
  1304. },
  1305. {
  1306. "func": "static BOOL rdp_read_share_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT16(s); /* nodeId (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\treturn TRUE;\n}",
  1307. "project": "FreeRDP",
  1308. "hash": 110630546321384895699149838140537479494,
  1309. "size": 10,
  1310. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1311. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1312. "target": 0,
  1313. "dataset": "other",
  1314. "idx": 409686
  1315. },
  1316. {
  1317. "func": "static void rdp_read_bitmap_cache_cell_info(wStream* s, BITMAP_CACHE_V2_CELL_INFO* cellInfo)\n{\n\tUINT32 info;\n\t/**\n\t * numEntries is in the first 31 bits, while the last bit (k)\n\t * is used to indicate a persistent bitmap cache.\n\t */\n\tStream_Read_UINT32(s, info);\n\tcellInfo->numEntries = (info & 0x7FFFFFFF);\n\tcellInfo->persistent = (info & 0x80000000) ? 1 : 0;\n}",
  1318. "project": "FreeRDP",
  1319. "hash": 243003567530089132513265118318891886949,
  1320. "size": 11,
  1321. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1322. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1323. "target": 0,
  1324. "dataset": "other",
  1325. "idx": 409578
  1326. },
  1327. {
  1328. "func": "static BOOL rdp_print_control_capability_set(wStream* s, UINT16 length)\n{\n\tUINT16 controlFlags;\n\tUINT16 remoteDetachFlag;\n\tUINT16 controlInterest;\n\tUINT16 detachInterest;\n\tWLog_INFO(TAG, \"ControlCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, controlFlags); /* controlFlags (2 bytes) */\n\tStream_Read_UINT16(s, remoteDetachFlag); /* remoteDetachFlag (2 bytes) */\n\tStream_Read_UINT16(s, controlInterest); /* controlInterest (2 bytes) */\n\tStream_Read_UINT16(s, detachInterest); /* detachInterest (2 bytes) */\n\tWLog_INFO(TAG, \"\\tcontrolFlags: 0x%04\" PRIX16 \"\", controlFlags);\n\tWLog_INFO(TAG, \"\\tremoteDetachFlag: 0x%04\" PRIX16 \"\", remoteDetachFlag);\n\tWLog_INFO(TAG, \"\\tcontrolInterest: 0x%04\" PRIX16 \"\", controlInterest);\n\tWLog_INFO(TAG, \"\\tdetachInterest: 0x%04\" PRIX16 \"\", detachInterest);\n\treturn TRUE;\n}",
  1329. "project": "FreeRDP",
  1330. "hash": 112568296590823747751147846820589701696,
  1331. "size": 21,
  1332. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1333. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1334. "target": 0,
  1335. "dataset": "other",
  1336. "idx": 409670
  1337. },
  1338. {
  1339. "func": "static BOOL rdp_write_multifragment_update_capability_set(wStream* s, rdpSettings* settings)\n{\n\tsize_t header;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\tif (settings->ServerMode && settings->MultifragMaxRequestSize == 0)\n\t{\n\t\t/**\n\t\t * In server mode we prefer to use the highest useful request size that\n\t\t * will allow us to pack a complete screen update into a single fast\n\t\t * path PDU using any of the supported codecs.\n\t\t * However, the client is completely free to accept our proposed\n\t\t * max request size or send a different value in the client-to-server\n\t\t * multi-fragment update capability set and we have to accept that,\n\t\t * unless we are using RemoteFX where the client MUST announce a value\n\t\t * greater than or equal to the value we're sending here.\n\t\t * See [MS-RDPRFX 1.5 capability #2]\n\t\t */\n\t\tUINT32 tileNumX = (settings->DesktopWidth + 63) / 64;\n\t\tUINT32 tileNumY = (settings->DesktopHeight + 63) / 64;\n\t\tsettings->MultifragMaxRequestSize = tileNumX * tileNumY * 16384;\n\t\t/* and add room for headers, regions, frame markers, etc. */\n\t\tsettings->MultifragMaxRequestSize += 16384;\n\t}\n\n\theader = rdp_capability_set_start(s);\n\tStream_Write_UINT32(s, settings->MultifragMaxRequestSize); /* MaxRequestSize (4 bytes) */\n\trdp_capability_set_finish(s, header, CAPSET_TYPE_MULTI_FRAGMENT_UPDATE);\n\treturn TRUE;\n}",
  1340. "project": "FreeRDP",
  1341. "hash": 284673504598250299343184535298414746342,
  1342. "size": 32,
  1343. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1344. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1345. "target": 0,
  1346. "dataset": "other",
  1347. "idx": 409667
  1348. },
  1349. {
  1350. "func": "static BOOL rdp_read_draw_gdiplus_cache_capability_set(wStream* s, UINT16 length,\n rdpSettings* settings)\n{\n\tUINT32 drawGDIPlusSupportLevel;\n\tUINT32 drawGdiplusCacheLevel;\n\n\tif (length < 40)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, drawGDIPlusSupportLevel); /* drawGDIPlusSupportLevel (4 bytes) */\n\tStream_Seek_UINT32(s); /* GdipVersion (4 bytes) */\n\tStream_Read_UINT32(s, drawGdiplusCacheLevel); /* drawGdiplusCacheLevel (4 bytes) */\n\tStream_Seek(s, 10); /* GdipCacheEntries (10 bytes) */\n\tStream_Seek(s, 8); /* GdipCacheChunkSize (8 bytes) */\n\tStream_Seek(s, 6); /* GdipImageCacheProperties (6 bytes) */\n\n\tif (drawGDIPlusSupportLevel & DRAW_GDIPLUS_SUPPORTED)\n\t\tsettings->DrawGdiPlusEnabled = TRUE;\n\n\tif (drawGdiplusCacheLevel & DRAW_GDIPLUS_CACHE_LEVEL_ONE)\n\t\tsettings->DrawGdiPlusCacheEnabled = TRUE;\n\n\treturn TRUE;\n}",
  1351. "project": "FreeRDP",
  1352. "hash": 234991757575908276803722590129707796626,
  1353. "size": 24,
  1354. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1355. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1356. "target": 0,
  1357. "dataset": "other",
  1358. "idx": 409590
  1359. },
  1360. {
  1361. "func": "static BOOL rdp_print_bitmap_cache_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 pad1, pad2, pad3;\n\tUINT32 pad4, pad5, pad6;\n\tUINT16 Cache0Entries;\n\tUINT16 Cache0MaximumCellSize;\n\tUINT16 Cache1Entries;\n\tUINT16 Cache1MaximumCellSize;\n\tUINT16 Cache2Entries;\n\tUINT16 Cache2MaximumCellSize;\n\tWLog_INFO(TAG, \"BitmapCacheCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 40)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, pad1); /* pad1 (4 bytes) */\n\tStream_Read_UINT32(s, pad2); /* pad2 (4 bytes) */\n\tStream_Read_UINT32(s, pad3); /* pad3 (4 bytes) */\n\tStream_Read_UINT32(s, pad4); /* pad4 (4 bytes) */\n\tStream_Read_UINT32(s, pad5); /* pad5 (4 bytes) */\n\tStream_Read_UINT32(s, pad6); /* pad6 (4 bytes) */\n\tStream_Read_UINT16(s, Cache0Entries); /* Cache0Entries (2 bytes) */\n\tStream_Read_UINT16(s, Cache0MaximumCellSize); /* Cache0MaximumCellSize (2 bytes) */\n\tStream_Read_UINT16(s, Cache1Entries); /* Cache1Entries (2 bytes) */\n\tStream_Read_UINT16(s, Cache1MaximumCellSize); /* Cache1MaximumCellSize (2 bytes) */\n\tStream_Read_UINT16(s, Cache2Entries); /* Cache2Entries (2 bytes) */\n\tStream_Read_UINT16(s, Cache2MaximumCellSize); /* Cache2MaximumCellSize (2 bytes) */\n\tWLog_INFO(TAG, \"\\tpad1: 0x%08\" PRIX32 \"\", pad1);\n\tWLog_INFO(TAG, \"\\tpad2: 0x%08\" PRIX32 \"\", pad2);\n\tWLog_INFO(TAG, \"\\tpad3: 0x%08\" PRIX32 \"\", pad3);\n\tWLog_INFO(TAG, \"\\tpad4: 0x%08\" PRIX32 \"\", pad4);\n\tWLog_INFO(TAG, \"\\tpad5: 0x%08\" PRIX32 \"\", pad5);\n\tWLog_INFO(TAG, \"\\tpad6: 0x%08\" PRIX32 \"\", pad6);\n\tWLog_INFO(TAG, \"\\tCache0Entries: 0x%04\" PRIX16 \"\", Cache0Entries);\n\tWLog_INFO(TAG, \"\\tCache0MaximumCellSize: 0x%04\" PRIX16 \"\", Cache0MaximumCellSize);\n\tWLog_INFO(TAG, \"\\tCache1Entries: 0x%04\" PRIX16 \"\", Cache1Entries);\n\tWLog_INFO(TAG, \"\\tCache1MaximumCellSize: 0x%04\" PRIX16 \"\", Cache1MaximumCellSize);\n\tWLog_INFO(TAG, \"\\tCache2Entries: 0x%04\" PRIX16 \"\", Cache2Entries);\n\tWLog_INFO(TAG, \"\\tCache2MaximumCellSize: 0x%04\" PRIX16 \"\", Cache2MaximumCellSize);\n\treturn TRUE;\n}",
  1362. "project": "FreeRDP",
  1363. "hash": 263214705750533080366269336572526014100,
  1364. "size": 41,
  1365. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1366. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1367. "target": 0,
  1368. "dataset": "other",
  1369. "idx": 409574
  1370. },
  1371. {
  1372. "func": "static BOOL rdp_read_bitmap_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tBYTE drawingFlags;\n\tUINT16 desktopWidth;\n\tUINT16 desktopHeight;\n\tUINT16 desktopResizeFlag;\n\tUINT16 preferredBitsPerPixel;\n\n\tif (length < 28)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, preferredBitsPerPixel); /* preferredBitsPerPixel (2 bytes) */\n\tStream_Seek_UINT16(s); /* receive1BitPerPixel (2 bytes) */\n\tStream_Seek_UINT16(s); /* receive4BitsPerPixel (2 bytes) */\n\tStream_Seek_UINT16(s); /* receive8BitsPerPixel (2 bytes) */\n\tStream_Read_UINT16(s, desktopWidth); /* desktopWidth (2 bytes) */\n\tStream_Read_UINT16(s, desktopHeight); /* desktopHeight (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\tStream_Read_UINT16(s, desktopResizeFlag); /* desktopResizeFlag (2 bytes) */\n\tStream_Seek_UINT16(s); /* bitmapCompressionFlag (2 bytes) */\n\tStream_Seek_UINT8(s); /* highColorFlags (1 byte) */\n\tStream_Read_UINT8(s, drawingFlags); /* drawingFlags (1 byte) */\n\tStream_Seek_UINT16(s); /* multipleRectangleSupport (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsB (2 bytes) */\n\n\tif (!settings->ServerMode && (preferredBitsPerPixel != settings->ColorDepth))\n\t{\n\t\t/* The client must respect the actual color depth used by the server */\n\t\tsettings->ColorDepth = preferredBitsPerPixel;\n\t}\n\n\tif (desktopResizeFlag == FALSE)\n\t\tsettings->DesktopResize = FALSE;\n\n\tif (!settings->ServerMode && settings->DesktopResize)\n\t{\n\t\t/* The server may request a different desktop size during Deactivation-Reactivation sequence\n\t\t */\n\t\tsettings->DesktopWidth = desktopWidth;\n\t\tsettings->DesktopHeight = desktopHeight;\n\t}\n\n\tif (settings->DrawAllowSkipAlpha)\n\t\tsettings->DrawAllowSkipAlpha = (drawingFlags & DRAW_ALLOW_SKIP_ALPHA) ? TRUE : FALSE;\n\n\tif (settings->DrawAllowDynamicColorFidelity)\n\t\tsettings->DrawAllowDynamicColorFidelity =\n\t\t (drawingFlags & DRAW_ALLOW_DYNAMIC_COLOR_FIDELITY) ? TRUE : FALSE;\n\n\tif (settings->DrawAllowColorSubsampling)\n\t\tsettings->DrawAllowColorSubsampling =\n\t\t (drawingFlags & DRAW_ALLOW_COLOR_SUBSAMPLING) ? TRUE : FALSE;\n\n\treturn TRUE;\n}",
  1373. "project": "FreeRDP",
  1374. "hash": 32241820168842739652588766287689298066,
  1375. "size": 55,
  1376. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1377. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1378. "target": 0,
  1379. "dataset": "other",
  1380. "idx": 409605
  1381. },
  1382. {
  1383. "func": "static BOOL rdp_read_large_pointer_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tUINT16 largePointerSupportFlags;\n\n\tif (length < 6)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, largePointerSupportFlags); /* largePointerSupportFlags (2 bytes) */\n\tsettings->LargePointerFlag =\n\t largePointerSupportFlags & (LARGE_POINTER_FLAG_96x96 | LARGE_POINTER_FLAG_384x384);\n\tif ((largePointerSupportFlags & ~(LARGE_POINTER_FLAG_96x96 | LARGE_POINTER_FLAG_384x384)) != 0)\n\t{\n\t\tWLog_WARN(\n\t\t TAG,\n\t\t \"TS_LARGE_POINTER_CAPABILITYSET with unsupported flags %04X (all flags %04X) received\",\n\t\t largePointerSupportFlags & ~(LARGE_POINTER_FLAG_96x96 | LARGE_POINTER_FLAG_384x384),\n\t\t largePointerSupportFlags);\n\t}\n\treturn TRUE;\n}",
  1384. "project": "FreeRDP",
  1385. "hash": 31411261199554286081134639045069445801,
  1386. "size": 20,
  1387. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1388. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1389. "target": 0,
  1390. "dataset": "other",
  1391. "idx": 409617
  1392. },
  1393. {
  1394. "func": "static BOOL rdp_print_virtual_channel_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 flags;\n\tUINT32 VCChunkSize;\n\tWLog_INFO(TAG, \"VirtualChannelCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, flags); /* flags (4 bytes) */\n\n\tif (length > 8)\n\t\tStream_Read_UINT32(s, VCChunkSize); /* VCChunkSize (4 bytes) */\n\telse\n\t\tVCChunkSize = 1600;\n\n\tWLog_INFO(TAG, \"\\tflags: 0x%08\" PRIX32 \"\", flags);\n\tWLog_INFO(TAG, \"\\tVCChunkSize: 0x%08\" PRIX32 \"\", VCChunkSize);\n\treturn TRUE;\n}",
  1395. "project": "FreeRDP",
  1396. "hash": 284706245349848953715070998125660485821,
  1397. "size": 20,
  1398. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1399. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1400. "target": 0,
  1401. "dataset": "other",
  1402. "idx": 409583
  1403. },
  1404. {
  1405. "func": "static BOOL rdp_print_surface_commands_capability_set(wStream* s, UINT16 length)\n{\n\tUINT32 cmdFlags;\n\tUINT32 reserved;\n\tWLog_INFO(TAG, \"SurfaceCommandsCapabilitySet (length %\" PRIu16 \"):\", length);\n\n\tif (length < 12)\n\t\treturn FALSE;\n\n\tStream_Read_UINT32(s, cmdFlags); /* cmdFlags (4 bytes) */\n\tStream_Read_UINT32(s, reserved); /* reserved (4 bytes) */\n\tWLog_INFO(TAG, \"\\tcmdFlags: 0x%08\" PRIX32 \"\", cmdFlags);\n\tWLog_INFO(TAG, \"\\treserved: 0x%08\" PRIX32 \"\", reserved);\n\treturn TRUE;\n}",
  1406. "project": "FreeRDP",
  1407. "hash": 201233689125804826922744190824697797071,
  1408. "size": 15,
  1409. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1410. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1411. "target": 0,
  1412. "dataset": "other",
  1413. "idx": 409607
  1414. },
  1415. {
  1416. "func": "static BOOL rdp_read_pointer_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tUINT16 colorPointerFlag;\n\tUINT16 colorPointerCacheSize;\n\tUINT16 pointerCacheSize;\n\n\tif (length < 8)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, colorPointerFlag); /* colorPointerFlag (2 bytes) */\n\tStream_Read_UINT16(s, colorPointerCacheSize); /* colorPointerCacheSize (2 bytes) */\n\n\t/* pointerCacheSize is optional */\n\tif (length >= 10)\n\t\tStream_Read_UINT16(s, pointerCacheSize); /* pointerCacheSize (2 bytes) */\n\telse\n\t\tpointerCacheSize = 0;\n\n\tif (colorPointerFlag == FALSE)\n\t\tsettings->ColorPointerFlag = FALSE;\n\n\tif (settings->ServerMode)\n\t{\n\t\tsettings->PointerCacheSize = pointerCacheSize;\n\t}\n\n\treturn TRUE;\n}",
  1417. "project": "FreeRDP",
  1418. "hash": 298168098402171989438387105409127129458,
  1419. "size": 28,
  1420. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1421. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1422. "target": 0,
  1423. "dataset": "other",
  1424. "idx": 409622
  1425. },
  1426. {
  1427. "func": "static BOOL rdp_read_bitmap_cache_capability_set(wStream* s, UINT16 length, rdpSettings* settings)\n{\n\tWINPR_UNUSED(settings);\n\tif (length < 40)\n\t\treturn FALSE;\n\n\tStream_Seek_UINT32(s); /* pad1 (4 bytes) */\n\tStream_Seek_UINT32(s); /* pad2 (4 bytes) */\n\tStream_Seek_UINT32(s); /* pad3 (4 bytes) */\n\tStream_Seek_UINT32(s); /* pad4 (4 bytes) */\n\tStream_Seek_UINT32(s); /* pad5 (4 bytes) */\n\tStream_Seek_UINT32(s); /* pad6 (4 bytes) */\n\tStream_Seek_UINT16(s); /* Cache0Entries (2 bytes) */\n\tStream_Seek_UINT16(s); /* Cache0MaximumCellSize (2 bytes) */\n\tStream_Seek_UINT16(s); /* Cache1Entries (2 bytes) */\n\tStream_Seek_UINT16(s); /* Cache1MaximumCellSize (2 bytes) */\n\tStream_Seek_UINT16(s); /* Cache2Entries (2 bytes) */\n\tStream_Seek_UINT16(s); /* Cache2MaximumCellSize (2 bytes) */\n\treturn TRUE;\n}",
  1428. "project": "FreeRDP",
  1429. "hash": 126632303879958348471370508278569584777,
  1430. "size": 20,
  1431. "commit_id": "3627aaf7d289315b614a584afb388f04abfb5bbf",
  1432. "message": "Fixed #6011: Bounds check in rdp_read_font_capability_set",
  1433. "target": 0,
  1434. "dataset": "other",
  1435. "idx": 409687
  1436. }
  1437. ]
  1438. },
  1439. {
  1440. "call_depth": 3,
  1441. "longest_call_chain": [
  1442. "irda_connect",
  1443. "irda_discover_daddr_and_lsap_sel",
  1444. "irda_find_lsap_sel"
  1445. ],
  1446. "group_size": 3,
  1447. "functions": [
  1448. {
  1449. "func": "static int irda_connect(struct socket *sock, struct sockaddr *uaddr,\n\t\t\tint addr_len, int flags)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct sockaddr_irda *addr = (struct sockaddr_irda *) uaddr;\n\tstruct irda_sock *self = irda_sk(sk);\n\tint err;\n\n\tIRDA_DEBUG(2, \"%s(%p)\\n\", __func__, self);\n\n\t/* Don't allow connect for Ultra sockets */\n\tif ((sk->sk_type == SOCK_DGRAM) && (sk->sk_protocol == IRDAPROTO_ULTRA))\n\t\treturn -ESOCKTNOSUPPORT;\n\n\tif (sk->sk_state == TCP_ESTABLISHED && sock->state == SS_CONNECTING) {\n\t\tsock->state = SS_CONNECTED;\n\t\treturn 0; /* Connect completed during a ERESTARTSYS event */\n\t}\n\n\tif (sk->sk_state == TCP_CLOSE && sock->state == SS_CONNECTING) {\n\t\tsock->state = SS_UNCONNECTED;\n\t\treturn -ECONNREFUSED;\n\t}\n\n\tif (sk->sk_state == TCP_ESTABLISHED)\n\t\treturn -EISCONN; /* No reconnect on a seqpacket socket */\n\n\tsk->sk_state = TCP_CLOSE;\n\tsock->state = SS_UNCONNECTED;\n\n\tif (addr_len != sizeof(struct sockaddr_irda))\n\t\treturn -EINVAL;\n\n\t/* Check if user supplied any destination device address */\n\tif ((!addr->sir_addr) || (addr->sir_addr == DEV_ADDR_ANY)) {\n\t\t/* Try to find one suitable */\n\t\terr = irda_discover_daddr_and_lsap_sel(self, addr->sir_name);\n\t\tif (err) {\n\t\t\tIRDA_DEBUG(0, \"%s(), auto-connect failed!\\n\", __func__);\n\t\t\treturn err;\n\t\t}\n\t} else {\n\t\t/* Use the one provided by the user */\n\t\tself->daddr = addr->sir_addr;\n\t\tIRDA_DEBUG(1, \"%s(), daddr = %08x\\n\", __func__, self->daddr);\n\n\t\t/* If we don't have a valid service name, we assume the\n\t\t * user want to connect on a specific LSAP. Prevent\n\t\t * the use of invalid LSAPs (IrLMP 1.1 p10). Jean II */\n\t\tif((addr->sir_name[0] != '\\0') ||\n\t\t (addr->sir_lsap_sel >= 0x70)) {\n\t\t\t/* Query remote LM-IAS using service name */\n\t\t\terr = irda_find_lsap_sel(self, addr->sir_name);\n\t\t\tif (err) {\n\t\t\t\tIRDA_DEBUG(0, \"%s(), connect failed!\\n\", __func__);\n\t\t\t\treturn err;\n\t\t\t}\n\t\t} else {\n\t\t\t/* Directly connect to the remote LSAP\n\t\t\t * specified by the sir_lsap field.\n\t\t\t * Please use with caution, in IrDA LSAPs are\n\t\t\t * dynamic and there is no \"well-known\" LSAP. */\n\t\t\tself->dtsap_sel = addr->sir_lsap_sel;\n\t\t}\n\t}\n\n\t/* Check if we have opened a local TSAP */\n\tif (!self->tsap)\n\t\tirda_open_tsap(self, LSAP_ANY, addr->sir_name);\n\n\t/* Move to connecting socket, start sending Connect Requests */\n\tsock->state = SS_CONNECTING;\n\tsk->sk_state = TCP_SYN_SENT;\n\n\t/* Connect to remote device */\n\terr = irttp_connect_request(self->tsap, self->dtsap_sel,\n\t\t\t\t self->saddr, self->daddr, NULL,\n\t\t\t\t self->max_sdu_size_rx, NULL);\n\tif (err) {\n\t\tIRDA_DEBUG(0, \"%s(), connect failed!\\n\", __func__);\n\t\treturn err;\n\t}\n\n\t/* Now the loop */\n\tif (sk->sk_state != TCP_ESTABLISHED && (flags & O_NONBLOCK))\n\t\treturn -EINPROGRESS;\n\n\tif (wait_event_interruptible(*(sk->sk_sleep),\n\t\t\t\t (sk->sk_state != TCP_SYN_SENT)))\n\t\treturn -ERESTARTSYS;\n\n\tif (sk->sk_state != TCP_ESTABLISHED) {\n\t\tsock->state = SS_UNCONNECTED;\n\t\terr = sock_error(sk);\n\t\treturn err? err : -ECONNRESET;\n\t}\n\n\tsock->state = SS_CONNECTED;\n\n\t/* At this point, IrLMP has assigned our source address */\n\tself->saddr = irttp_get_saddr(self->tsap);\n\n\treturn 0;\n}",
  1450. "target": 0,
  1451. "cwe": [
  1452. "CWE-200"
  1453. ],
  1454. "project": "linux-2.6",
  1455. "commit_id": "09384dfc76e526c3993c09c42e016372dc9dd22c",
  1456. "hash": 178099908447917320051948600173125641407,
  1457. "size": 104,
  1458. "message": "irda: Fix irda_getname() leak\n\nirda_getname() can leak kernel memory to user.\n\nSigned-off-by: Eric Dumazet <eric.dumazet@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  1459. "dataset": "other",
  1460. "idx": 490851
  1461. },
  1462. {
  1463. "func": "static int irda_discover_daddr_and_lsap_sel(struct irda_sock *self, char *name)\n{\n\tdiscinfo_t *discoveries;\t/* Copy of the discovery log */\n\tint\tnumber;\t\t\t/* Number of nodes in the log */\n\tint\ti;\n\tint\terr = -ENETUNREACH;\n\t__u32\tdaddr = DEV_ADDR_ANY;\t/* Address we found the service on */\n\t__u8\tdtsap_sel = 0x0;\t/* TSAP associated with it */\n\n\tIRDA_DEBUG(2, \"%s(), name=%s\\n\", __func__, name);\n\n\t/* Ask lmp for the current discovery log\n\t * Note : we have to use irlmp_get_discoveries(), as opposed\n\t * to play with the cachelog directly, because while we are\n\t * making our ias query, le log might change... */\n\tdiscoveries = irlmp_get_discoveries(&number, self->mask.word,\n\t\t\t\t\t self->nslots);\n\t/* Check if the we got some results */\n\tif (discoveries == NULL)\n\t\treturn -ENETUNREACH;\t/* No nodes discovered */\n\n\t/*\n\t * Now, check all discovered devices (if any), and connect\n\t * client only about the services that the client is\n\t * interested in...\n\t */\n\tfor(i = 0; i < number; i++) {\n\t\t/* Try the address in the log */\n\t\tself->daddr = discoveries[i].daddr;\n\t\tself->saddr = 0x0;\n\t\tIRDA_DEBUG(1, \"%s(), trying daddr = %08x\\n\",\n\t\t\t __func__, self->daddr);\n\n\t\t/* Query remote LM-IAS for this service */\n\t\terr = irda_find_lsap_sel(self, name);\n\t\tswitch (err) {\n\t\tcase 0:\n\t\t\t/* We found the requested service */\n\t\t\tif(daddr != DEV_ADDR_ANY) {\n\t\t\t\tIRDA_DEBUG(1, \"%s(), discovered service ''%s'' in two different devices !!!\\n\",\n\t\t\t\t\t __func__, name);\n\t\t\t\tself->daddr = DEV_ADDR_ANY;\n\t\t\t\tkfree(discoveries);\n\t\t\t\treturn(-ENOTUNIQ);\n\t\t\t}\n\t\t\t/* First time we found that one, save it ! */\n\t\t\tdaddr = self->daddr;\n\t\t\tdtsap_sel = self->dtsap_sel;\n\t\t\tbreak;\n\t\tcase -EADDRNOTAVAIL:\n\t\t\t/* Requested service simply doesn't exist on this node */\n\t\t\tbreak;\n\t\tdefault:\n\t\t\t/* Something bad did happen :-( */\n\t\t\tIRDA_DEBUG(0, \"%s(), unexpected IAS query failure\\n\", __func__);\n\t\t\tself->daddr = DEV_ADDR_ANY;\n\t\t\tkfree(discoveries);\n\t\t\treturn(-EHOSTUNREACH);\n\t\t\tbreak;\n\t\t}\n\t}\n\t/* Cleanup our copy of the discovery log */\n\tkfree(discoveries);\n\n\t/* Check out what we found */\n\tif(daddr == DEV_ADDR_ANY) {\n\t\tIRDA_DEBUG(1, \"%s(), cannot discover service ''%s'' in any device !!!\\n\",\n\t\t\t __func__, name);\n\t\tself->daddr = DEV_ADDR_ANY;\n\t\treturn(-EADDRNOTAVAIL);\n\t}\n\n\t/* Revert back to discovered device & service */\n\tself->daddr = daddr;\n\tself->saddr = 0x0;\n\tself->dtsap_sel = dtsap_sel;\n\n\tIRDA_DEBUG(1, \"%s(), discovered requested service ''%s'' at address %08x\\n\",\n\t\t __func__, name, self->daddr);\n\n\treturn 0;\n}",
  1464. "target": 0,
  1465. "cwe": [
  1466. "CWE-200"
  1467. ],
  1468. "project": "linux-2.6",
  1469. "commit_id": "09384dfc76e526c3993c09c42e016372dc9dd22c",
  1470. "hash": 318581748965276480005084377565136724550,
  1471. "size": 82,
  1472. "message": "irda: Fix irda_getname() leak\n\nirda_getname() can leak kernel memory to user.\n\nSigned-off-by: Eric Dumazet <eric.dumazet@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  1473. "dataset": "other",
  1474. "idx": 490850
  1475. },
  1476. {
  1477. "func": "static int irda_find_lsap_sel(struct irda_sock *self, char *name)\n{\n\tIRDA_DEBUG(2, \"%s(%p, %s)\\n\", __func__, self, name);\n\n\tif (self->iriap) {\n\t\tIRDA_WARNING(\"%s(): busy with a previous query\\n\",\n\t\t\t __func__);\n\t\treturn -EBUSY;\n\t}\n\n\tself->iriap = iriap_open(LSAP_ANY, IAS_CLIENT, self,\n\t\t\t\t irda_getvalue_confirm);\n\tif(self->iriap == NULL)\n\t\treturn -ENOMEM;\n\n\t/* Treat unexpected wakeup as disconnect */\n\tself->errno = -EHOSTUNREACH;\n\n\t/* Query remote LM-IAS */\n\tiriap_getvaluebyclass_request(self->iriap, self->saddr, self->daddr,\n\t\t\t\t name, \"IrDA:TinyTP:LsapSel\");\n\n\t/* Wait for answer, if not yet finished (or failed) */\n\tif (wait_event_interruptible(self->query_wait, (self->iriap==NULL)))\n\t\t/* Treat signals as disconnect */\n\t\treturn -EHOSTUNREACH;\n\n\t/* Check what happened */\n\tif (self->errno)\n\t{\n\t\t/* Requested object/attribute doesn't exist */\n\t\tif((self->errno == IAS_CLASS_UNKNOWN) ||\n\t\t (self->errno == IAS_ATTRIB_UNKNOWN))\n\t\t\treturn (-EADDRNOTAVAIL);\n\t\telse\n\t\t\treturn (-EHOSTUNREACH);\n\t}\n\n\t/* Get the remote TSAP selector */\n\tswitch (self->ias_result->type) {\n\tcase IAS_INTEGER:\n\t\tIRDA_DEBUG(4, \"%s() int=%d\\n\",\n\t\t\t __func__, self->ias_result->t.integer);\n\n\t\tif (self->ias_result->t.integer != -1)\n\t\t\tself->dtsap_sel = self->ias_result->t.integer;\n\t\telse\n\t\t\tself->dtsap_sel = 0;\n\t\tbreak;\n\tdefault:\n\t\tself->dtsap_sel = 0;\n\t\tIRDA_DEBUG(0, \"%s(), bad type!\\n\", __func__);\n\t\tbreak;\n\t}\n\tif (self->ias_result)\n\t\tirias_delete_value(self->ias_result);\n\n\tif (self->dtsap_sel)\n\t\treturn 0;\n\n\treturn -EADDRNOTAVAIL;\n}",
  1478. "target": 0,
  1479. "cwe": [
  1480. "CWE-200"
  1481. ],
  1482. "project": "linux-2.6",
  1483. "commit_id": "09384dfc76e526c3993c09c42e016372dc9dd22c",
  1484. "hash": 165698805698786493552979841809667640579,
  1485. "size": 62,
  1486. "message": "irda: Fix irda_getname() leak\n\nirda_getname() can leak kernel memory to user.\n\nSigned-off-by: Eric Dumazet <eric.dumazet@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  1487. "dataset": "other",
  1488. "idx": 490844
  1489. }
  1490. ]
  1491. },
  1492. {
  1493. "call_depth": 3,
  1494. "longest_call_chain": [
  1495. "php_openssl_csr_free",
  1496. "X509_REQ_free",
  1497. "CSRequest"
  1498. ],
  1499. "group_size": 3,
  1500. "functions": [
  1501. {
  1502. "func": "static void php_openssl_csr_free(zend_resource *rsrc)\n{\n\tX509_REQ * csr = (X509_REQ*)rsrc->ptr;\n\tX509_REQ_free(csr);\n}",
  1503. "project": "php-src",
  1504. "hash": 203588433657896308178929799818659920108,
  1505. "size": 5,
  1506. "commit_id": "0216630ea2815a5789a24279a1211ac398d4de79",
  1507. "message": "Fix bug #79601 (Wrong ciphertext/tag in AES-CCM encryption for a 12 bytes IV)",
  1508. "target": 0,
  1509. "dataset": "other",
  1510. "idx": 291401
  1511. },
  1512. {
  1513. "func": " explicit CSRequest(X509_REQ *csr) : m_csr(csr) {\n assertx(m_csr);\n }",
  1514. "project": "hhvm",
  1515. "hash": 185152408263537532527205151501544474583,
  1516. "size": 3,
  1517. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  1518. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  1519. "target": 0,
  1520. "dataset": "other",
  1521. "idx": 219423
  1522. },
  1523. {
  1524. "func": " ~CSRequest() override {\n // X509_REQ_free(nullptr) is a no-op\n X509_REQ_free(m_csr);\n }",
  1525. "project": "hhvm",
  1526. "hash": 172788866518608369448304811034265826884,
  1527. "size": 4,
  1528. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  1529. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  1530. "target": 0,
  1531. "dataset": "other",
  1532. "idx": 219893
  1533. }
  1534. ]
  1535. },
  1536. {
  1537. "call_depth": 4,
  1538. "longest_call_chain": [
  1539. "crypto_get_certificate_data",
  1540. "crypto_cert_fingerprint",
  1541. "crypto_cert_fingerprint_by_hash",
  1542. "crypto_cert_hash"
  1543. ],
  1544. "group_size": 9,
  1545. "functions": [
  1546. {
  1547. "func": "char* crypto_cert_issuer(X509* xcert)\n{\n\treturn crypto_print_name(X509_get_issuer_name(xcert));\n}",
  1548. "project": "FreeRDP",
  1549. "hash": 205497471462573990909815156371579244197,
  1550. "size": 4,
  1551. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1552. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1553. "target": 0,
  1554. "dataset": "other",
  1555. "idx": 473452
  1556. },
  1557. {
  1558. "func": "char* crypto_cert_fingerprint_by_hash(X509* xcert, const char* hash)\n{\n\tUINT32 fp_len, i;\n\tBYTE* fp;\n\tchar* p;\n\tchar* fp_buffer;\n\n\tfp = crypto_cert_hash(xcert, hash, &fp_len);\n\tif (!fp)\n\t\treturn NULL;\n\n\tfp_buffer = calloc(fp_len * 3 + 1, sizeof(char));\n\tif (!fp_buffer)\n\t\tgoto fail;\n\n\tp = fp_buffer;\n\n\tfor (i = 0; i < (fp_len - 1); i++)\n\t{\n\t\tsprintf_s(p, (fp_len - i) * 3, \"%02\" PRIx8 \":\", fp[i]);\n\t\tp = &fp_buffer[(i + 1) * 3];\n\t}\n\n\tsprintf_s(p, (fp_len - i) * 3, \"%02\" PRIx8 \"\", fp[i]);\nfail:\n\tfree(fp);\n\n\treturn fp_buffer;\n}",
  1559. "project": "FreeRDP",
  1560. "hash": 137722397787957957021174819917513700282,
  1561. "size": 29,
  1562. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1563. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1564. "target": 0,
  1565. "dataset": "other",
  1566. "idx": 473456
  1567. },
  1568. {
  1569. "func": "char* crypto_cert_fingerprint(X509* xcert)\n{\n\treturn crypto_cert_fingerprint_by_hash(xcert, \"sha256\");\n}",
  1570. "project": "FreeRDP",
  1571. "hash": 115650122252764947943603801708902861010,
  1572. "size": 4,
  1573. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1574. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1575. "target": 0,
  1576. "dataset": "other",
  1577. "idx": 473462
  1578. },
  1579. {
  1580. "func": "static int verify_cb(int ok, X509_STORE_CTX* csc)\n{\n\tif (ok != 1)\n\t{\n\t\tint err = X509_STORE_CTX_get_error(csc);\n\t\tint derr = X509_STORE_CTX_get_error_depth(csc);\n\t\tX509* where = X509_STORE_CTX_get_current_cert(csc);\n\t\tconst char* what = X509_verify_cert_error_string(err);\n\t\tchar* name = crypto_cert_subject(where);\n\n\t\tWLog_WARN(TAG, \"Certificate verification failure '%s (%d)' at stack position %d\", what, err,\n\t\t derr);\n\t\tWLog_WARN(TAG, \"%s\", name);\n\n\t\tfree(name);\n\t}\n\treturn ok;\n}",
  1581. "project": "FreeRDP",
  1582. "hash": 75265801506247543146779012995879849204,
  1583. "size": 18,
  1584. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1585. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1586. "target": 0,
  1587. "dataset": "other",
  1588. "idx": 473427
  1589. },
  1590. {
  1591. "func": "void crypto_cert_print_info(X509* xcert)\n{\n\tchar* fp;\n\tchar* issuer;\n\tchar* subject;\n\tsubject = crypto_cert_subject(xcert);\n\tissuer = crypto_cert_issuer(xcert);\n\tfp = crypto_cert_fingerprint(xcert);\n\n\tif (!fp)\n\t{\n\t\tWLog_ERR(TAG, \"error computing fingerprint\");\n\t\tgoto out_free_issuer;\n\t}\n\n\tWLog_INFO(TAG, \"Certificate details:\");\n\tWLog_INFO(TAG, \"\\tSubject: %s\", subject);\n\tWLog_INFO(TAG, \"\\tIssuer: %s\", issuer);\n\tWLog_INFO(TAG, \"\\tThumbprint: %s\", fp);\n\tWLog_INFO(TAG,\n\t \"The above X.509 certificate could not be verified, possibly because you do not have \"\n\t \"the CA certificate in your certificate store, or the certificate has expired. \"\n\t \"Please look at the OpenSSL documentation on how to add a private CA to the store.\");\n\tfree(fp);\nout_free_issuer:\n\tfree(issuer);\n\tfree(subject);\n}",
  1592. "project": "FreeRDP",
  1593. "hash": 64076208521481089131010558823372035251,
  1594. "size": 28,
  1595. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1596. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1597. "target": 0,
  1598. "dataset": "other",
  1599. "idx": 473432
  1600. },
  1601. {
  1602. "func": "char* crypto_cert_subject(X509* xcert)\n{\n\treturn crypto_print_name(X509_get_subject_name(xcert));\n}",
  1603. "project": "FreeRDP",
  1604. "hash": 177180604460491566370377171358096486095,
  1605. "size": 4,
  1606. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1607. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1608. "target": 0,
  1609. "dataset": "other",
  1610. "idx": 473454
  1611. },
  1612. {
  1613. "func": "rdpCertificateData* crypto_get_certificate_data(X509* xcert, const char* hostname, UINT16 port)\n{\n\tchar* issuer;\n\tchar* subject;\n\tchar* fp;\n\trdpCertificateData* certdata;\n\tfp = crypto_cert_fingerprint(xcert);\n\n\tif (!fp)\n\t\treturn NULL;\n\n\tissuer = crypto_cert_issuer(xcert);\n\tsubject = crypto_cert_subject(xcert);\n\tcertdata = certificate_data_new(hostname, port, issuer, subject, fp);\n\tfree(subject);\n\tfree(issuer);\n\tfree(fp);\n\treturn certdata;\n}",
  1614. "project": "FreeRDP",
  1615. "hash": 170554719668291881438898249097327745004,
  1616. "size": 19,
  1617. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1618. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1619. "target": 0,
  1620. "dataset": "other",
  1621. "idx": 473455
  1622. },
  1623. {
  1624. "func": "BYTE* crypto_cert_hash(X509* xcert, const char* hash, UINT32* length)\n{\n\tUINT32 fp_len = EVP_MAX_MD_SIZE;\n\tBYTE* fp;\n\tconst EVP_MD* md = EVP_get_digestbyname(hash);\n\tif (!md)\n\t\treturn NULL;\n\tif (!length)\n\t\treturn NULL;\n\tif (!xcert)\n\t\treturn NULL;\n\n\tfp = calloc(fp_len, sizeof(BYTE));\n\tif (!fp)\n\t\treturn NULL;\n\n\tif (X509_digest(xcert, md, fp, &fp_len) != 1)\n\t{\n\t\tfree(fp);\n\t\treturn NULL;\n\t}\n\n\t*length = fp_len;\n\treturn fp;\n}",
  1625. "project": "FreeRDP",
  1626. "hash": 258407869867369743474326334091914072928,
  1627. "size": 25,
  1628. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1629. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1630. "target": 0,
  1631. "dataset": "other",
  1632. "idx": 473451
  1633. },
  1634. {
  1635. "func": "static char* crypto_print_name(X509_NAME* name)\n{\n\tchar* buffer = NULL;\n\tBIO* outBIO = BIO_new(BIO_s_mem());\n\n\tif (X509_NAME_print_ex(outBIO, name, 0, XN_FLAG_ONELINE) > 0)\n\t{\n\t\tunsigned long size = BIO_number_written(outBIO);\n\t\tbuffer = calloc(1, size + 1);\n\n\t\tif (!buffer)\n\t\t\treturn NULL;\n\n\t\tBIO_read(outBIO, buffer, size);\n\t}\n\n\tBIO_free_all(outBIO);\n\treturn buffer;\n}",
  1636. "project": "FreeRDP",
  1637. "hash": 89260255256165807681288006501973762861,
  1638. "size": 19,
  1639. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  1640. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  1641. "target": 0,
  1642. "dataset": "other",
  1643. "idx": 473437
  1644. }
  1645. ]
  1646. },
  1647. {
  1648. "call_depth": 3,
  1649. "longest_call_chain": [
  1650. "parallel_thread_func",
  1651. "parallel_process_irp",
  1652. "parallel_process_irp_close"
  1653. ],
  1654. "group_size": 8,
  1655. "functions": [
  1656. {
  1657. "func": "static UINT parallel_process_irp_device_control(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tStream_Write_UINT32(irp->output, 0); /* OutputBufferLength */\n\treturn irp->Complete(irp);\n}",
  1658. "project": "FreeRDP",
  1659. "hash": 50777945177459684828193623428436628095,
  1660. "size": 5,
  1661. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1662. "message": "Fixed oob read in parallel_process_irp_create",
  1663. "target": 0,
  1664. "dataset": "other",
  1665. "idx": 403463
  1666. },
  1667. {
  1668. "func": "static UINT parallel_process_irp_close(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tif (close(parallel->file) < 0)\n\t{\n\t}\n\telse\n\t{\n\t}\n\n\tStream_Zero(irp->output, 5); /* Padding(5) */\n\treturn irp->Complete(irp);\n}",
  1669. "project": "FreeRDP",
  1670. "hash": 229960397322034469489633522376896104471,
  1671. "size": 12,
  1672. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1673. "message": "Fixed oob read in parallel_process_irp_create",
  1674. "target": 0,
  1675. "dataset": "other",
  1676. "idx": 403460
  1677. },
  1678. {
  1679. "func": "static UINT parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tchar* path = NULL;\n\tint status;\n\tUINT32 PathLength;\n\tStream_Seek(irp->input, 28);\n\t/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */\n\t/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */\n\tStream_Read_UINT32(irp->input, PathLength);\n\tstatus = ConvertFromUnicode(CP_UTF8, 0, (WCHAR*)Stream_Pointer(irp->input), PathLength / 2,\n\t &path, 0, NULL, NULL);\n\n\tif (status < 1)\n\t\tif (!(path = (char*)calloc(1, 1)))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"calloc failed!\");\n\t\t\treturn CHANNEL_RC_NO_MEMORY;\n\t\t}\n\n\tparallel->id = irp->devman->id_sequence++;\n\tparallel->file = open(parallel->path, O_RDWR);\n\n\tif (parallel->file < 0)\n\t{\n\t\tirp->IoStatus = STATUS_ACCESS_DENIED;\n\t\tparallel->id = 0;\n\t}\n\telse\n\t{\n\t\t/* all read and write operations should be non-blocking */\n\t\tif (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)\n\t\t{\n\t\t}\n\t}\n\n\tStream_Write_UINT32(irp->output, parallel->id);\n\tStream_Write_UINT8(irp->output, 0);\n\tfree(path);\n\treturn irp->Complete(irp);\n}",
  1680. "project": "FreeRDP",
  1681. "hash": 91654068438972054959889615095747233707,
  1682. "size": 40,
  1683. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1684. "message": "Fixed oob read in parallel_process_irp_create",
  1685. "target": 1,
  1686. "dataset": "other",
  1687. "idx": 207960
  1688. },
  1689. {
  1690. "func": "static UINT parallel_process_irp_create(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tchar* path = NULL;\n\tint status;\n\tWCHAR* ptr;\n\tUINT32 PathLength;\n\tif (!Stream_SafeSeek(irp->input, 28))\n\t\treturn ERROR_INVALID_DATA;\n\t/* DesiredAccess(4) AllocationSize(8), FileAttributes(4) */\n\t/* SharedAccess(4) CreateDisposition(4), CreateOptions(4) */\n\tif (Stream_GetRemainingLength(irp->input) < 4)\n\t\treturn ERROR_INVALID_DATA;\n\tStream_Read_UINT32(irp->input, PathLength);\n\tptr = (WCHAR*)Stream_Pointer(irp->input);\n\tif (!Stream_SafeSeek(irp->input, PathLength))\n\t\treturn ERROR_INVALID_DATA;\n\tstatus = ConvertFromUnicode(CP_UTF8, 0, ptr, PathLength / 2, &path, 0, NULL, NULL);\n\n\tif (status < 1)\n\t\tif (!(path = (char*)calloc(1, 1)))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"calloc failed!\");\n\t\t\treturn CHANNEL_RC_NO_MEMORY;\n\t\t}\n\n\tparallel->id = irp->devman->id_sequence++;\n\tparallel->file = open(parallel->path, O_RDWR);\n\n\tif (parallel->file < 0)\n\t{\n\t\tirp->IoStatus = STATUS_ACCESS_DENIED;\n\t\tparallel->id = 0;\n\t}\n\telse\n\t{\n\t\t/* all read and write operations should be non-blocking */\n\t\tif (fcntl(parallel->file, F_SETFL, O_NONBLOCK) == -1)\n\t\t{\n\t\t}\n\t}\n\n\tStream_Write_UINT32(irp->output, parallel->id);\n\tStream_Write_UINT8(irp->output, 0);\n\tfree(path);\n\treturn irp->Complete(irp);\n}",
  1691. "project": "FreeRDP",
  1692. "hash": 213401734041482676778583216895571372326,
  1693. "size": 46,
  1694. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1695. "message": "Fixed oob read in parallel_process_irp_create",
  1696. "target": 0,
  1697. "dataset": "other",
  1698. "idx": 403469
  1699. },
  1700. {
  1701. "func": "static UINT parallel_process_irp_write(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tUINT32 len;\n\tUINT32 Length;\n\tUINT64 Offset;\n\tssize_t status;\n\tvoid* ptr;\n\tif (Stream_GetRemainingLength(irp->input) > 12)\n\t\treturn ERROR_INVALID_DATA;\n\n\tStream_Read_UINT32(irp->input, Length);\n\tStream_Read_UINT64(irp->input, Offset);\n\tif (!Stream_SafeSeek(irp->input, 20)) /* Padding */\n\t\treturn ERROR_INVALID_DATA;\n\tptr = Stream_Pointer(irp->input);\n\tif (!Stream_SafeSeek(irp->input, Length))\n\t\treturn ERROR_INVALID_DATA;\n\tlen = Length;\n\n\twhile (len > 0)\n\t{\n\t\tstatus = write(parallel->file, ptr, len);\n\n\t\tif (status < 0)\n\t\t{\n\t\t\tirp->IoStatus = STATUS_UNSUCCESSFUL;\n\t\t\tLength = 0;\n\t\t\tbreak;\n\t\t}\n\n\t\tStream_Seek(irp->input, status);\n\t\tlen -= status;\n\t}\n\n\tStream_Write_UINT32(irp->output, Length);\n\tStream_Write_UINT8(irp->output, 0); /* Padding */\n\treturn irp->Complete(irp);\n}",
  1702. "project": "FreeRDP",
  1703. "hash": 124029001936116716333431833342807537455,
  1704. "size": 38,
  1705. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1706. "message": "Fixed oob read in parallel_process_irp_create",
  1707. "target": 0,
  1708. "dataset": "other",
  1709. "idx": 403462
  1710. },
  1711. {
  1712. "func": "static DWORD WINAPI parallel_thread_func(LPVOID arg)\n{\n\tIRP* irp;\n\twMessage message;\n\tPARALLEL_DEVICE* parallel = (PARALLEL_DEVICE*)arg;\n\tUINT error = CHANNEL_RC_OK;\n\n\twhile (1)\n\t{\n\t\tif (!MessageQueue_Wait(parallel->queue))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"MessageQueue_Wait failed!\");\n\t\t\terror = ERROR_INTERNAL_ERROR;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (!MessageQueue_Peek(parallel->queue, &message, TRUE))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"MessageQueue_Peek failed!\");\n\t\t\terror = ERROR_INTERNAL_ERROR;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (message.id == WMQ_QUIT)\n\t\t\tbreak;\n\n\t\tirp = (IRP*)message.wParam;\n\n\t\tif ((error = parallel_process_irp(parallel, irp)))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"parallel_process_irp failed with error %\" PRIu32 \"!\", error);\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (error && parallel->rdpcontext)\n\t\tsetChannelError(parallel->rdpcontext, error, \"parallel_thread_func reported an error\");\n\n\tExitThread(error);\n\treturn error;\n}",
  1713. "project": "FreeRDP",
  1714. "hash": 175202737362833470892243463098338728512,
  1715. "size": 41,
  1716. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1717. "message": "Fixed oob read in parallel_process_irp_create",
  1718. "target": 0,
  1719. "dataset": "other",
  1720. "idx": 403464
  1721. },
  1722. {
  1723. "func": "static UINT parallel_process_irp(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tUINT error;\n\n\tswitch (irp->MajorFunction)\n\t{\n\t\tcase IRP_MJ_CREATE:\n\t\t\tif ((error = parallel_process_irp_create(parallel, irp)))\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"parallel_process_irp_create failed with error %\" PRIu32 \"!\", error);\n\t\t\t\treturn error;\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase IRP_MJ_CLOSE:\n\t\t\tif ((error = parallel_process_irp_close(parallel, irp)))\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"parallel_process_irp_close failed with error %\" PRIu32 \"!\", error);\n\t\t\t\treturn error;\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase IRP_MJ_READ:\n\t\t\tif ((error = parallel_process_irp_read(parallel, irp)))\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"parallel_process_irp_read failed with error %\" PRIu32 \"!\", error);\n\t\t\t\treturn error;\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase IRP_MJ_WRITE:\n\t\t\tif ((error = parallel_process_irp_write(parallel, irp)))\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"parallel_process_irp_write failed with error %\" PRIu32 \"!\", error);\n\t\t\t\treturn error;\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tcase IRP_MJ_DEVICE_CONTROL:\n\t\t\tif ((error = parallel_process_irp_device_control(parallel, irp)))\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"parallel_process_irp_device_control failed with error %\" PRIu32 \"!\",\n\t\t\t\t error);\n\t\t\t\treturn error;\n\t\t\t}\n\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tirp->IoStatus = STATUS_NOT_SUPPORTED;\n\t\t\treturn irp->Complete(irp);\n\t\t\tbreak;\n\t}\n\n\treturn CHANNEL_RC_OK;\n}",
  1724. "project": "FreeRDP",
  1725. "hash": 152328085319883643300033889459899429830,
  1726. "size": 60,
  1727. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1728. "message": "Fixed oob read in parallel_process_irp_create",
  1729. "target": 0,
  1730. "dataset": "other",
  1731. "idx": 403465
  1732. },
  1733. {
  1734. "func": "static UINT parallel_process_irp_read(PARALLEL_DEVICE* parallel, IRP* irp)\n{\n\tUINT32 Length;\n\tUINT64 Offset;\n\tssize_t status;\n\tBYTE* buffer = NULL;\n\tif (Stream_GetRemainingLength(irp->input) < 12)\n\t\treturn ERROR_INVALID_DATA;\n\tStream_Read_UINT32(irp->input, Length);\n\tStream_Read_UINT64(irp->input, Offset);\n\tbuffer = (BYTE*)malloc(Length);\n\n\tif (!buffer)\n\t{\n\t\tWLog_ERR(TAG, \"malloc failed!\");\n\t\treturn CHANNEL_RC_NO_MEMORY;\n\t}\n\n\tstatus = read(parallel->file, buffer, Length);\n\n\tif (status < 0)\n\t{\n\t\tirp->IoStatus = STATUS_UNSUCCESSFUL;\n\t\tfree(buffer);\n\t\tbuffer = NULL;\n\t\tLength = 0;\n\t}\n\telse\n\t{\n\t}\n\n\tStream_Write_UINT32(irp->output, Length);\n\n\tif (Length > 0)\n\t{\n\t\tif (!Stream_EnsureRemainingCapacity(irp->output, Length))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"Stream_EnsureRemainingCapacity failed!\");\n\t\t\tfree(buffer);\n\t\t\treturn CHANNEL_RC_NO_MEMORY;\n\t\t}\n\n\t\tStream_Write(irp->output, buffer, Length);\n\t}\n\n\tfree(buffer);\n\treturn irp->Complete(irp);\n}",
  1735. "project": "FreeRDP",
  1736. "hash": 325410391065857413900691400019655670752,
  1737. "size": 48,
  1738. "commit_id": "795842f4096501fcefc1a7f535ccc8132feb31d7",
  1739. "message": "Fixed oob read in parallel_process_irp_create",
  1740. "target": 0,
  1741. "dataset": "other",
  1742. "idx": 403468
  1743. }
  1744. ]
  1745. },
  1746. {
  1747. "call_depth": 3,
  1748. "longest_call_chain": [
  1749. "rsi_indicate_pkt_to_os",
  1750. "rsi_fill_rx_status",
  1751. "rsi_perform_cqm"
  1752. ],
  1753. "group_size": 4,
  1754. "functions": [
  1755. {
  1756. "func": "static void rsi_perform_cqm(struct rsi_common *common,\n\t\t\t u8 *bssid,\n\t\t\t s8 rssi,\n\t\t\t struct ieee80211_vif *vif)\n{\n\ts8 last_event = common->cqm_info.last_cqm_event_rssi;\n\tint thold = common->cqm_info.rssi_thold;\n\tu32 hyst = common->cqm_info.rssi_hyst;\n\tenum nl80211_cqm_rssi_threshold_event event;\n\n\tif (rssi < thold && (last_event == 0 || rssi < (last_event - hyst)))\n\t\tevent = NL80211_CQM_RSSI_THRESHOLD_EVENT_LOW;\n\telse if (rssi > thold &&\n\t\t (last_event == 0 || rssi > (last_event + hyst)))\n\t\tevent = NL80211_CQM_RSSI_THRESHOLD_EVENT_HIGH;\n\telse\n\t\treturn;\n\n\tcommon->cqm_info.last_cqm_event_rssi = rssi;\n\trsi_dbg(INFO_ZONE, \"CQM: Notifying event: %d\\n\", event);\n\tieee80211_cqm_rssi_notify(vif, event, rssi, GFP_KERNEL);\n\n\treturn;\n}",
  1757. "project": "linux",
  1758. "hash": 114860442925680819795552771010927514880,
  1759. "size": 24,
  1760. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  1761. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  1762. "target": 0,
  1763. "dataset": "other",
  1764. "idx": 461645
  1765. },
  1766. {
  1767. "func": "bool rsi_is_cipher_wep(struct rsi_common *common)\n{\n\tif (((common->secinfo.gtk_cipher == WLAN_CIPHER_SUITE_WEP104) ||\n\t (common->secinfo.gtk_cipher == WLAN_CIPHER_SUITE_WEP40)) &&\n\t (!common->secinfo.ptk_cipher))\n\t\treturn true;\n\telse\n\t\treturn false;\n}",
  1768. "project": "linux",
  1769. "hash": 338508583178677526423454936430516132884,
  1770. "size": 9,
  1771. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  1772. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  1773. "target": 0,
  1774. "dataset": "other",
  1775. "idx": 461648
  1776. },
  1777. {
  1778. "func": "static void rsi_fill_rx_status(struct ieee80211_hw *hw,\n\t\t\t struct sk_buff *skb,\n\t\t\t struct rsi_common *common,\n\t\t\t struct ieee80211_rx_status *rxs)\n{\n\tstruct rsi_hw *adapter = common->priv;\n\tstruct ieee80211_vif *vif;\n\tstruct ieee80211_bss_conf *bss = NULL;\n\tstruct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);\n\tstruct skb_info *rx_params = (struct skb_info *)info->driver_data;\n\tstruct ieee80211_hdr *hdr;\n\tchar rssi = rx_params->rssi;\n\tu8 hdrlen = 0;\n\tu8 channel = rx_params->channel;\n\ts32 freq;\n\tint i;\n\n\thdr = ((struct ieee80211_hdr *)(skb->data));\n\thdrlen = ieee80211_hdrlen(hdr->frame_control);\n\n\tmemset(info, 0, sizeof(struct ieee80211_tx_info));\n\n\trxs->signal = -(rssi);\n\n\trxs->band = common->band;\n\n\tfreq = ieee80211_channel_to_frequency(channel, rxs->band);\n\n\tif (freq)\n\t\trxs->freq = freq;\n\n\tif (ieee80211_has_protected(hdr->frame_control)) {\n\t\tif (rsi_is_cipher_wep(common)) {\n\t\t\tmemmove(skb->data + 4, skb->data, hdrlen);\n\t\t\tskb_pull(skb, 4);\n\t\t} else {\n\t\t\tmemmove(skb->data + 8, skb->data, hdrlen);\n\t\t\tskb_pull(skb, 8);\n\t\t\trxs->flag |= RX_FLAG_MMIC_STRIPPED;\n\t\t}\n\t\trxs->flag |= RX_FLAG_DECRYPTED;\n\t\trxs->flag |= RX_FLAG_IV_STRIPPED;\n\t}\n\n\tfor (i = 0; i < RSI_MAX_VIFS; i++) {\n\t\tvif = adapter->vifs[i];\n\t\tif (!vif)\n\t\t\tcontinue;\n\t\tif (vif->type == NL80211_IFTYPE_STATION) {\n\t\t\tbss = &vif->bss_conf;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (!bss)\n\t\treturn;\n\t/* CQM only for connected AP beacons, the RSSI is a weighted avg */\n\tif (bss->assoc && !(memcmp(bss->bssid, hdr->addr2, ETH_ALEN))) {\n\t\tif (ieee80211_is_beacon(hdr->frame_control))\n\t\t\trsi_perform_cqm(common, hdr->addr2, rxs->signal, vif);\n\t}\n\n\treturn;\n}",
  1779. "project": "linux",
  1780. "hash": 233364692912996660136397716324401509067,
  1781. "size": 63,
  1782. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  1783. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  1784. "target": 0,
  1785. "dataset": "other",
  1786. "idx": 461634
  1787. },
  1788. {
  1789. "func": "void rsi_indicate_pkt_to_os(struct rsi_common *common,\n\t\t\t struct sk_buff *skb)\n{\n\tstruct rsi_hw *adapter = common->priv;\n\tstruct ieee80211_hw *hw = adapter->hw;\n\tstruct ieee80211_rx_status *rx_status = IEEE80211_SKB_RXCB(skb);\n\n\tif ((common->iface_down) || (!adapter->sc_nvifs)) {\n\t\tdev_kfree_skb(skb);\n\t\treturn;\n\t}\n\n\t/* filling in the ieee80211_rx_status flags */\n\trsi_fill_rx_status(hw, skb, common, rx_status);\n\n\tieee80211_rx_irqsafe(hw, skb);\n}",
  1790. "project": "linux",
  1791. "hash": 258292985604746670436233766317101138975,
  1792. "size": 17,
  1793. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  1794. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  1795. "target": 0,
  1796. "dataset": "other",
  1797. "idx": 461655
  1798. }
  1799. ]
  1800. },
  1801. {
  1802. "call_depth": 5,
  1803. "longest_call_chain": [
  1804. "usb_host_handle_packet",
  1805. "do_token_in",
  1806. "usb_host_handle_control",
  1807. "usb_host_set_config",
  1808. "usb_host_claim_interfaces"
  1809. ],
  1810. "group_size": 24,
  1811. "functions": [
  1812. {
  1813. "func": "static int usb_linux_update_endp_table(USBHostDevice *s)\n{\n uint8_t *descriptors;\n uint8_t devep, type, configuration, alt_interface;\n struct usb_ctrltransfer ct;\n int interface, ret, length, i;\n\n ct.bRequestType = USB_DIR_IN;\n ct.bRequest = USB_REQ_GET_CONFIGURATION;\n ct.wValue = 0;\n ct.wIndex = 0;\n ct.wLength = 1;\n ct.data = &configuration;\n ct.timeout = 50;\n\n ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);\n if (ret < 0) {\n perror(\"usb_linux_update_endp_table\");\n return 1;\n }\n\n /* in address state */\n if (configuration == 0)\n return 1;\n\n /* get the desired configuration, interface, and endpoint descriptors\n * from device description */\n descriptors = &s->descr[18];\n length = s->descr_len - 18;\n i = 0;\n\n if (descriptors[i + 1] != USB_DT_CONFIG ||\n descriptors[i + 5] != configuration) {\n dprintf(\"invalid descriptor data - configuration\\n\");\n return 1;\n }\n i += descriptors[i];\n\n while (i < length) {\n if (descriptors[i + 1] != USB_DT_INTERFACE ||\n (descriptors[i + 1] == USB_DT_INTERFACE &&\n descriptors[i + 4] == 0)) {\n i += descriptors[i];\n continue;\n }\n\n interface = descriptors[i + 2];\n\n ct.bRequestType = USB_DIR_IN | USB_RECIP_INTERFACE;\n ct.bRequest = USB_REQ_GET_INTERFACE;\n ct.wValue = 0;\n ct.wIndex = interface;\n ct.wLength = 1;\n ct.data = &alt_interface;\n ct.timeout = 50;\n\n ret = ioctl(s->fd, USBDEVFS_CONTROL, &ct);\n if (ret < 0) {\n alt_interface = interface;\n }\n\n /* the current interface descriptor is the active interface\n * and has endpoints */\n if (descriptors[i + 3] != alt_interface) {\n i += descriptors[i];\n continue;\n }\n\n /* advance to the endpoints */\n while (i < length && descriptors[i +1] != USB_DT_ENDPOINT)\n i += descriptors[i];\n\n if (i >= length)\n break;\n\n while (i < length) {\n if (descriptors[i + 1] != USB_DT_ENDPOINT)\n break;\n\n devep = descriptors[i + 2];\n switch (descriptors[i + 3] & 0x3) {\n case 0x00:\n type = USBDEVFS_URB_TYPE_CONTROL;\n break;\n case 0x01:\n type = USBDEVFS_URB_TYPE_ISO;\n break;\n case 0x02:\n type = USBDEVFS_URB_TYPE_BULK;\n break;\n case 0x03:\n type = USBDEVFS_URB_TYPE_INTERRUPT;\n break;\n default:\n dprintf(\"usb_host: malformed endpoint type\\n\");\n type = USBDEVFS_URB_TYPE_BULK;\n }\n s->endp_table[(devep & 0xf) - 1].type = type;\n s->endp_table[(devep & 0xf) - 1].halted = 0;\n\n i += descriptors[i];\n }\n }\n return 0;\n}",
  1814. "project": "qemu",
  1815. "hash": 294133560509132520784444631812479704822,
  1816. "size": 105,
  1817. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1818. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1819. "target": 0,
  1820. "dataset": "other",
  1821. "idx": 346310
  1822. },
  1823. {
  1824. "func": "static int usb_host_claim_interfaces(USBHostDevice *dev, int configuration)\n{\n int dev_descr_len, config_descr_len;\n int interface, nb_interfaces, nb_configurations;\n int ret, i;\n\n if (configuration == 0) /* address state - ignore */\n return 1;\n\n dprintf(\"husb: claiming interfaces. config %d\\n\", configuration);\n\n i = 0;\n dev_descr_len = dev->descr[0];\n if (dev_descr_len > dev->descr_len)\n goto fail;\n nb_configurations = dev->descr[17];\n\n i += dev_descr_len;\n while (i < dev->descr_len) {\n dprintf(\"husb: i is %d, descr_len is %d, dl %d, dt %d\\n\", i, dev->descr_len,\n dev->descr[i], dev->descr[i+1]);\n\n if (dev->descr[i+1] != USB_DT_CONFIG) {\n i += dev->descr[i];\n continue;\n }\n config_descr_len = dev->descr[i];\n\n\tprintf(\"husb: config #%d need %d\\n\", dev->descr[i + 5], configuration); \n\n if (configuration < 0 || configuration == dev->descr[i + 5]) {\n configuration = dev->descr[i + 5];\n break;\n }\n\n i += config_descr_len;\n }\n\n if (i >= dev->descr_len) {\n fprintf(stderr, \"husb: update iface failed. no matching configuration\\n\");\n goto fail;\n }\n nb_interfaces = dev->descr[i + 4];\n\n#ifdef USBDEVFS_DISCONNECT\n /* earlier Linux 2.4 do not support that */\n {\n struct usbdevfs_ioctl ctrl;\n for (interface = 0; interface < nb_interfaces; interface++) {\n ctrl.ioctl_code = USBDEVFS_DISCONNECT;\n ctrl.ifno = interface;\n ret = ioctl(dev->fd, USBDEVFS_IOCTL, &ctrl);\n if (ret < 0 && errno != ENODATA) {\n perror(\"USBDEVFS_DISCONNECT\");\n goto fail;\n }\n }\n }\n#endif\n\n /* XXX: only grab if all interfaces are free */\n for (interface = 0; interface < nb_interfaces; interface++) {\n ret = ioctl(dev->fd, USBDEVFS_CLAIMINTERFACE, &interface);\n if (ret < 0) {\n if (errno == EBUSY) {\n printf(\"husb: update iface. device already grabbed\\n\");\n } else {\n perror(\"husb: failed to claim interface\");\n }\n fail:\n return 0;\n }\n }\n\n printf(\"husb: %d interfaces claimed for configuration %d\\n\",\n nb_interfaces, configuration);\n\n dev->ninterfaces = nb_interfaces;\n dev->configuration = configuration;\n return 1;\n}",
  1825. "project": "qemu",
  1826. "hash": 153735582378435081792665043612689386780,
  1827. "size": 81,
  1828. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1829. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1830. "target": 0,
  1831. "dataset": "other",
  1832. "idx": 346283
  1833. },
  1834. {
  1835. "func": "static void set_halt(USBHostDevice *s, int ep)\n{\n s->endp_table[ep - 1].halted = 1;\n}",
  1836. "project": "qemu",
  1837. "hash": 247708798741636311330547718736677043664,
  1838. "size": 4,
  1839. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1840. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1841. "target": 0,
  1842. "dataset": "other",
  1843. "idx": 346295
  1844. },
  1845. {
  1846. "func": "static int usb_host_handle_packet(USBDevice *s, USBPacket *p)\n{\n switch(p->pid) {\n case USB_MSG_ATTACH:\n s->state = USB_STATE_ATTACHED;\n return 0;\n\n case USB_MSG_DETACH:\n s->state = USB_STATE_NOTATTACHED;\n return 0;\n\n case USB_MSG_RESET:\n s->remote_wakeup = 0;\n s->addr = 0;\n s->state = USB_STATE_DEFAULT;\n s->handle_reset(s);\n return 0;\n }\n\n /* Rest of the PIDs must match our address */\n if (s->state < USB_STATE_DEFAULT || p->devaddr != s->addr)\n return USB_RET_NODEV;\n\n switch (p->pid) {\n case USB_TOKEN_SETUP:\n return do_token_setup(s, p);\n\n case USB_TOKEN_IN:\n return do_token_in(s, p);\n\n case USB_TOKEN_OUT:\n return do_token_out(s, p);\n \n default:\n return USB_RET_STALL;\n }\n}",
  1847. "project": "qemu",
  1848. "hash": 337945081411076701300585326701484725167,
  1849. "size": 37,
  1850. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1851. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1852. "target": 0,
  1853. "dataset": "other",
  1854. "idx": 346317
  1855. },
  1856. {
  1857. "func": "static int do_token_setup(USBDevice *dev, USBPacket *p)\n{\n USBHostDevice *s = (USBHostDevice *) dev;\n int ret = 0;\n\n if (p->len != 8)\n return USB_RET_STALL;\n \n memcpy(&s->ctrl.req, p->data, 8);\n s->ctrl.len = le16_to_cpu(s->ctrl.req.wLength);\n s->ctrl.offset = 0;\n s->ctrl.state = CTRL_STATE_SETUP;\n\n if (s->ctrl.req.bRequestType & USB_DIR_IN) {\n ret = usb_host_handle_control(s, p);\n if (ret < 0)\n return ret;\n\n if (ret < s->ctrl.len)\n s->ctrl.len = ret;\n s->ctrl.state = CTRL_STATE_DATA;\n } else {\n if (s->ctrl.len == 0)\n s->ctrl.state = CTRL_STATE_ACK;\n else\n s->ctrl.state = CTRL_STATE_DATA;\n }\n\n return ret;\n}",
  1858. "project": "qemu",
  1859. "hash": 183077943275491077374975960370940318614,
  1860. "size": 30,
  1861. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1862. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1863. "target": 0,
  1864. "dataset": "other",
  1865. "idx": 346300
  1866. },
  1867. {
  1868. "func": "static void async_complete(void *opaque)\n{\n USBHostDevice *s = opaque;\n AsyncURB *aurb;\n\n while (1) {\n \tUSBPacket *p;\n\n\tint r = ioctl(s->fd, USBDEVFS_REAPURBNDELAY, &aurb);\n if (r < 0) {\n if (errno == EAGAIN)\n return;\n\n if (errno == ENODEV && !s->closing) {\n printf(\"husb: device %d.%d disconnected\\n\", s->bus_num, s->addr);\n\t usb_device_del_addr(0, s->dev.addr);\n return;\n }\n\n dprintf(\"husb: async. reap urb failed errno %d\\n\", errno);\n return;\n }\n\n p = aurb->packet;\n\n\tdprintf(\"husb: async completed. aurb %p status %d alen %d\\n\", \n aurb, aurb->urb.status, aurb->urb.actual_length);\n\n\tif (p) {\n switch (aurb->urb.status) {\n case 0:\n p->len = aurb->urb.actual_length;\n if (aurb->urb.type == USBDEVFS_URB_TYPE_CONTROL)\n async_complete_ctrl(s, p);\n break;\n\n case -EPIPE:\n set_halt(s, p->devep);\n /* fall through */\n default:\n p->len = USB_RET_NAK;\n break;\n }\n\n usb_packet_complete(p);\n\t}\n\n async_free(aurb);\n }\n}",
  1869. "project": "qemu",
  1870. "hash": 307285342249293311693830213041718549309,
  1871. "size": 50,
  1872. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1873. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1874. "target": 0,
  1875. "dataset": "other",
  1876. "idx": 346323
  1877. },
  1878. {
  1879. "func": "static int usb_host_handle_control(USBHostDevice *s, USBPacket *p)\n{\n struct usbdevfs_urb *urb;\n AsyncURB *aurb;\n int ret, value, index;\n\n /* \n * Process certain standard device requests.\n * These are infrequent and are processed synchronously.\n */\n value = le16_to_cpu(s->ctrl.req.wValue);\n index = le16_to_cpu(s->ctrl.req.wIndex);\n\n dprintf(\"husb: ctrl type 0x%x req 0x%x val 0x%x index %u len %u\\n\",\n s->ctrl.req.bRequestType, s->ctrl.req.bRequest, value, index, \n s->ctrl.len);\n\n if (s->ctrl.req.bRequestType == 0) {\n switch (s->ctrl.req.bRequest) {\n case USB_REQ_SET_ADDRESS:\n return usb_host_set_address(s, value);\n\n case USB_REQ_SET_CONFIGURATION:\n return usb_host_set_config(s, value & 0xff);\n }\n }\n\n if (s->ctrl.req.bRequestType == 1 &&\n s->ctrl.req.bRequest == USB_REQ_SET_INTERFACE)\n return usb_host_set_interface(s, index, value);\n\n /* The rest are asynchronous */\n\n aurb = async_alloc();\n aurb->hdev = s;\n aurb->packet = p;\n\n /* \n * Setup ctrl transfer.\n *\n * s->ctrl is layed out such that data buffer immediately follows\n * 'req' struct which is exactly what usbdevfs expects.\n */ \n urb = &aurb->urb;\n\n urb->type = USBDEVFS_URB_TYPE_CONTROL;\n urb->endpoint = p->devep;\n\n urb->buffer = &s->ctrl.req;\n urb->buffer_length = 8 + s->ctrl.len;\n\n urb->usercontext = s;\n\n ret = ioctl(s->fd, USBDEVFS_SUBMITURB, urb);\n\n dprintf(\"husb: submit ctrl. len %u aurb %p\\n\", urb->buffer_length, aurb);\n\n if (ret < 0) {\n dprintf(\"husb: submit failed. errno %d\\n\", errno);\n async_free(aurb);\n\n switch(errno) {\n case ETIMEDOUT:\n return USB_RET_NAK;\n case EPIPE:\n default:\n return USB_RET_STALL;\n }\n }\n\n usb_defer_packet(p, async_cancel, aurb);\n return USB_RET_ASYNC;\n}",
  1880. "project": "qemu",
  1881. "hash": 312416163750000928776897162836846138475,
  1882. "size": 73,
  1883. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1884. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1885. "target": 1,
  1886. "dataset": "other",
  1887. "idx": 203887
  1888. },
  1889. {
  1890. "func": "static int usb_host_handle_control(USBHostDevice *s, USBPacket *p)\n{\n struct usbdevfs_urb *urb;\n AsyncURB *aurb;\n int ret, value, index;\n int buffer_len;\n\n /* \n * Process certain standard device requests.\n * These are infrequent and are processed synchronously.\n */\n value = le16_to_cpu(s->ctrl.req.wValue);\n index = le16_to_cpu(s->ctrl.req.wIndex);\n\n dprintf(\"husb: ctrl type 0x%x req 0x%x val 0x%x index %u len %u\\n\",\n s->ctrl.req.bRequestType, s->ctrl.req.bRequest, value, index, \n s->ctrl.len);\n\n if (s->ctrl.req.bRequestType == 0) {\n switch (s->ctrl.req.bRequest) {\n case USB_REQ_SET_ADDRESS:\n return usb_host_set_address(s, value);\n\n case USB_REQ_SET_CONFIGURATION:\n return usb_host_set_config(s, value & 0xff);\n }\n }\n\n if (s->ctrl.req.bRequestType == 1 &&\n s->ctrl.req.bRequest == USB_REQ_SET_INTERFACE)\n return usb_host_set_interface(s, index, value);\n\n /* The rest are asynchronous */\n\n buffer_len = 8 + s->ctrl.len;\n if (buffer_len > sizeof(s->ctrl.buffer)) {\n\t fprintf(stderr, \"husb: ctrl buffer too small (%u > %lu)\\n\",\n\t\t buffer_len, sizeof(s->ctrl.buffer));\n\t return USB_RET_STALL;\n }\n\n aurb = async_alloc();\n aurb->hdev = s;\n aurb->packet = p;\n\n /* \n * Setup ctrl transfer.\n *\n * s->ctrl is layed out such that data buffer immediately follows\n * 'req' struct which is exactly what usbdevfs expects.\n */ \n urb = &aurb->urb;\n\n urb->type = USBDEVFS_URB_TYPE_CONTROL;\n urb->endpoint = p->devep;\n\n urb->buffer = &s->ctrl.req;\n urb->buffer_length = buffer_len;\n\n urb->usercontext = s;\n\n ret = ioctl(s->fd, USBDEVFS_SUBMITURB, urb);\n\n dprintf(\"husb: submit ctrl. len %u aurb %p\\n\", urb->buffer_length, aurb);\n\n if (ret < 0) {\n dprintf(\"husb: submit failed. errno %d\\n\", errno);\n async_free(aurb);\n\n switch(errno) {\n case ETIMEDOUT:\n return USB_RET_NAK;\n case EPIPE:\n default:\n return USB_RET_STALL;\n }\n }\n\n usb_defer_packet(p, async_cancel, aurb);\n return USB_RET_ASYNC;\n}",
  1891. "project": "qemu",
  1892. "hash": 135771876040172573855391231658010318081,
  1893. "size": 81,
  1894. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1895. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1896. "target": 0,
  1897. "dataset": "other",
  1898. "idx": 346299
  1899. },
  1900. {
  1901. "func": "static int usb_host_set_address(USBHostDevice *s, int addr)\n{\n dprintf(\"husb: ctrl set addr %u\\n\", addr);\n s->dev.addr = addr;\n return 0;\n}",
  1902. "project": "qemu",
  1903. "hash": 113370853030229899911807824336189717767,
  1904. "size": 6,
  1905. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1906. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1907. "target": 0,
  1908. "dataset": "other",
  1909. "idx": 346285
  1910. },
  1911. {
  1912. "func": "static int is_isoc(USBHostDevice *s, int ep)\n{\n return s->endp_table[ep - 1].type == USBDEVFS_URB_TYPE_ISO;\n}",
  1913. "project": "qemu",
  1914. "hash": 245743564542705731360863902738396199787,
  1915. "size": 4,
  1916. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1917. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1918. "target": 0,
  1919. "dataset": "other",
  1920. "idx": 346309
  1921. },
  1922. {
  1923. "func": "static void clear_halt(USBHostDevice *s, int ep)\n{\n s->endp_table[ep - 1].halted = 0;\n}",
  1924. "project": "qemu",
  1925. "hash": 155880021257183729490116277729697816473,
  1926. "size": 4,
  1927. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1928. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1929. "target": 0,
  1930. "dataset": "other",
  1931. "idx": 346297
  1932. },
  1933. {
  1934. "func": "static int is_halted(USBHostDevice *s, int ep)\n{\n return s->endp_table[ep - 1].halted;\n}",
  1935. "project": "qemu",
  1936. "hash": 11767855805536563648164313742639211905,
  1937. "size": 4,
  1938. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1939. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1940. "target": 0,
  1941. "dataset": "other",
  1942. "idx": 346305
  1943. },
  1944. {
  1945. "func": "static int ctrl_error(void)\n{\n if (errno == ETIMEDOUT)\n return USB_RET_NAK;\n else \n return USB_RET_STALL;\n}",
  1946. "project": "qemu",
  1947. "hash": 272773737625285826548635814501419541680,
  1948. "size": 7,
  1949. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1950. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1951. "target": 0,
  1952. "dataset": "other",
  1953. "idx": 346301
  1954. },
  1955. {
  1956. "func": "static void async_free(AsyncURB *aurb)\n{\n qemu_free(aurb);\n}",
  1957. "project": "qemu",
  1958. "hash": 89699221103379724954608670537657524735,
  1959. "size": 4,
  1960. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1961. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1962. "target": 0,
  1963. "dataset": "other",
  1964. "idx": 346313
  1965. },
  1966. {
  1967. "func": "static void usb_host_handle_reset(USBDevice *dev)\n{\n USBHostDevice *s = (USBHostDevice *) dev;\n\n dprintf(\"husb: reset device %u.%u\\n\", s->bus_num, s->addr);\n\n ioctl(s->fd, USBDEVFS_RESET);\n\n usb_host_claim_interfaces(s, s->configuration);\n}",
  1968. "project": "qemu",
  1969. "hash": 302977581251084120225864181457936049770,
  1970. "size": 10,
  1971. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1972. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1973. "target": 0,
  1974. "dataset": "other",
  1975. "idx": 346298
  1976. },
  1977. {
  1978. "func": "static int usb_host_set_interface(USBHostDevice *s, int iface, int alt)\n{\n struct usbdevfs_setinterface si;\n int ret;\n\n si.interface = iface;\n si.altsetting = alt;\n ret = ioctl(s->fd, USBDEVFS_SETINTERFACE, &si);\n \n dprintf(\"husb: ctrl set iface %d altset %d ret %d errno %d\\n\", \n \tiface, alt, ret, errno);\n \n if (ret < 0)\n return ctrl_error();\n\n usb_linux_update_endp_table(s);\n return 0;\n}",
  1979. "project": "qemu",
  1980. "hash": 230817216566451332220731094414568773639,
  1981. "size": 18,
  1982. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1983. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1984. "target": 0,
  1985. "dataset": "other",
  1986. "idx": 346306
  1987. },
  1988. {
  1989. "func": "static int do_token_in(USBDevice *dev, USBPacket *p)\n{\n USBHostDevice *s = (USBHostDevice *) dev;\n int ret = 0;\n\n if (p->devep != 0)\n return usb_host_handle_data(s, p);\n\n switch(s->ctrl.state) {\n case CTRL_STATE_ACK:\n if (!(s->ctrl.req.bRequestType & USB_DIR_IN)) {\n ret = usb_host_handle_control(s, p);\n if (ret == USB_RET_ASYNC)\n return USB_RET_ASYNC;\n\n s->ctrl.state = CTRL_STATE_IDLE;\n return ret > 0 ? 0 : ret;\n }\n\n return 0;\n\n case CTRL_STATE_DATA:\n if (s->ctrl.req.bRequestType & USB_DIR_IN) {\n int len = s->ctrl.len - s->ctrl.offset;\n if (len > p->len)\n len = p->len;\n memcpy(p->data, s->ctrl.buffer + s->ctrl.offset, len);\n s->ctrl.offset += len;\n if (s->ctrl.offset >= s->ctrl.len)\n s->ctrl.state = CTRL_STATE_ACK;\n return len;\n }\n\n s->ctrl.state = CTRL_STATE_IDLE;\n return USB_RET_STALL;\n\n default:\n return USB_RET_STALL;\n }\n}",
  1990. "project": "qemu",
  1991. "hash": 274624244059630894410186848673918387785,
  1992. "size": 40,
  1993. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  1994. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  1995. "target": 0,
  1996. "dataset": "other",
  1997. "idx": 346280
  1998. },
  1999. {
  2000. "func": "static void async_complete_ctrl(USBHostDevice *s, USBPacket *p)\n{\n switch(s->ctrl.state) {\n case CTRL_STATE_SETUP:\n if (p->len < s->ctrl.len)\n s->ctrl.len = p->len;\n s->ctrl.state = CTRL_STATE_DATA;\n p->len = 8;\n break;\n\n case CTRL_STATE_ACK:\n s->ctrl.state = CTRL_STATE_IDLE;\n p->len = 0;\n break;\n\n default:\n break;\n }\n}",
  2001. "project": "qemu",
  2002. "hash": 87659848107630241316717948393842358765,
  2003. "size": 19,
  2004. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  2005. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  2006. "target": 0,
  2007. "dataset": "other",
  2008. "idx": 346321
  2009. },
  2010. {
  2011. "func": "static int usb_host_release_interfaces(USBHostDevice *s)\n{\n int ret, i;\n\n dprintf(\"husb: releasing interfaces\\n\");\n\n for (i = 0; i < s->ninterfaces; i++) {\n ret = ioctl(s->fd, USBDEVFS_RELEASEINTERFACE, &i);\n if (ret < 0) {\n perror(\"husb: failed to release interface\");\n return 0;\n }\n }\n\n return 1;\n}",
  2012. "project": "qemu",
  2013. "hash": 265975219865408593507728601152949169306,
  2014. "size": 16,
  2015. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  2016. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  2017. "target": 0,
  2018. "dataset": "other",
  2019. "idx": 346312
  2020. },
  2021. {
  2022. "func": "static void hostdev_unlink(USBHostDevice *dev)\n{\n USBHostDevice *pdev = hostdev_list;\n USBHostDevice **prev = &hostdev_list;\n\n while (pdev) {\n\tif (pdev == dev) {\n *prev = dev->next;\n return;\n }\n\n prev = &pdev->next;\n pdev = pdev->next;\n }\n}",
  2023. "project": "qemu",
  2024. "hash": 77907681220802418117040092144753015476,
  2025. "size": 15,
  2026. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  2027. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  2028. "target": 0,
  2029. "dataset": "other",
  2030. "idx": 346302
  2031. },
  2032. {
  2033. "func": "static int usb_host_set_config(USBHostDevice *s, int config)\n{\n usb_host_release_interfaces(s);\n\n int ret = ioctl(s->fd, USBDEVFS_SETCONFIGURATION, &config);\n \n dprintf(\"husb: ctrl set config %d ret %d errno %d\\n\", config, ret, errno);\n \n if (ret < 0)\n return ctrl_error();\n \n usb_host_claim_interfaces(s, config);\n return 0;\n}",
  2034. "project": "qemu",
  2035. "hash": 77581754423656411130094475642397550764,
  2036. "size": 14,
  2037. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  2038. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  2039. "target": 0,
  2040. "dataset": "other",
  2041. "idx": 346294
  2042. },
  2043. {
  2044. "func": "static int usb_host_handle_data(USBHostDevice *s, USBPacket *p)\n{\n struct usbdevfs_urb *urb;\n AsyncURB *aurb;\n int ret;\n\n aurb = async_alloc();\n aurb->hdev = s;\n aurb->packet = p;\n\n urb = &aurb->urb;\n\n if (p->pid == USB_TOKEN_IN)\n \turb->endpoint = p->devep | 0x80;\n else\n \turb->endpoint = p->devep;\n\n if (is_halted(s, p->devep)) {\n\tret = ioctl(s->fd, USBDEVFS_CLEAR_HALT, &urb->endpoint);\n if (ret < 0) {\n dprintf(\"husb: failed to clear halt. ep 0x%x errno %d\\n\", \n urb->endpoint, errno);\n return USB_RET_NAK;\n }\n clear_halt(s, p->devep);\n }\n\n urb->buffer = p->data;\n urb->buffer_length = p->len;\n\n if (is_isoc(s, p->devep)) {\n /* Setup ISOC transfer */\n urb->type = USBDEVFS_URB_TYPE_ISO;\n urb->flags = USBDEVFS_URB_ISO_ASAP;\n urb->number_of_packets = 1;\n urb->iso_frame_desc[0].length = p->len;\n } else {\n /* Setup bulk transfer */\n urb->type = USBDEVFS_URB_TYPE_BULK;\n }\n\n urb->usercontext = s;\n\n ret = ioctl(s->fd, USBDEVFS_SUBMITURB, urb);\n\n dprintf(\"husb: data submit. ep 0x%x len %u aurb %p\\n\", urb->endpoint, p->len, aurb);\n\n if (ret < 0) {\n dprintf(\"husb: submit failed. errno %d\\n\", errno);\n async_free(aurb);\n\n switch(errno) {\n case ETIMEDOUT:\n return USB_RET_NAK;\n case EPIPE:\n default:\n return USB_RET_STALL;\n }\n }\n\n usb_defer_packet(p, async_cancel, aurb);\n return USB_RET_ASYNC;\n}",
  2045. "project": "qemu",
  2046. "hash": 260559233680984221214785940519308902612,
  2047. "size": 63,
  2048. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  2049. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  2050. "target": 0,
  2051. "dataset": "other",
  2052. "idx": 346278
  2053. },
  2054. {
  2055. "func": "static void usb_host_handle_destroy(USBDevice *dev)\n{\n USBHostDevice *s = (USBHostDevice *)dev;\n\n s->closing = 1;\n\n qemu_set_fd_handler(s->fd, NULL, NULL, NULL);\n\n hostdev_unlink(s);\n\n async_complete(s);\n\n if (s->fd >= 0)\n close(s->fd);\n\n qemu_free(s);\n}",
  2056. "project": "qemu",
  2057. "hash": 331783873263838536495355729159893109559,
  2058. "size": 17,
  2059. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  2060. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  2061. "target": 0,
  2062. "dataset": "other",
  2063. "idx": 346276
  2064. },
  2065. {
  2066. "func": "static int do_token_out(USBDevice *dev, USBPacket *p)\n{\n USBHostDevice *s = (USBHostDevice *) dev;\n\n if (p->devep != 0)\n return usb_host_handle_data(s, p);\n\n switch(s->ctrl.state) {\n case CTRL_STATE_ACK:\n if (s->ctrl.req.bRequestType & USB_DIR_IN) {\n s->ctrl.state = CTRL_STATE_IDLE;\n /* transfer OK */\n } else {\n /* ignore additional output */\n }\n return 0;\n\n case CTRL_STATE_DATA:\n if (!(s->ctrl.req.bRequestType & USB_DIR_IN)) {\n int len = s->ctrl.len - s->ctrl.offset;\n if (len > p->len)\n len = p->len;\n memcpy(s->ctrl.buffer + s->ctrl.offset, p->data, len);\n s->ctrl.offset += len;\n if (s->ctrl.offset >= s->ctrl.len)\n s->ctrl.state = CTRL_STATE_ACK;\n return len;\n }\n\n s->ctrl.state = CTRL_STATE_IDLE;\n return USB_RET_STALL;\n\n default:\n return USB_RET_STALL;\n }\n}",
  2067. "project": "qemu",
  2068. "hash": 102876530187197055695706708439996412226,
  2069. "size": 36,
  2070. "commit_id": "babd03fde68093482528010a5435c14ce9128e3f",
  2071. "message": "usb-linux.c: fix buffer overflow\n\nIn usb-linux.c:usb_host_handle_control, we pass a 1024-byte buffer and\nlength to the kernel. However, the length was provided by the caller\nof dev->handle_packet, and is not checked, so the kernel might provide\ntoo much data and overflow our buffer.\n\nFor example, hw/usb-uhci.c could set the length to 2047.\nhw/usb-ohci.c looks like it might go up to 4096 or 8192.\n\nThis causes a qemu crash, as reported here:\n http://www.mail-archive.com/kvm@vger.kernel.org/msg18447.html\n\nThis patch increases the usb-linux.c buffer size to 2048 to fix the\nspecific device reported, and adds a check to avoid the overflow in\nany case.\n\nSigned-off-by: Jim Paris <jim@jtan.com>\nSigned-off-by: Anthony Liguori <aliguori@us.ibm.com>",
  2072. "target": 0,
  2073. "dataset": "other",
  2074. "idx": 346282
  2075. }
  2076. ]
  2077. },
  2078. {
  2079. "call_depth": 3,
  2080. "longest_call_chain": [
  2081. "log",
  2082. "active",
  2083. "isXenonActive"
  2084. ],
  2085. "group_size": 6,
  2086. "functions": [
  2087. {
  2088. "func": "void onStrobelightSignal(int signo) {\n if (!RuntimeOption::StrobelightEnabled) {\n // Handle the signal so we don't crash, but do nothing.\n return;\n }\n\n if (signo == strobelight::kSignumCurrent) {\n // sets on only current thread\n if (rds::isFullyInitialized()) {\n // Ignore threads that are not serving requests, otherwise this segfaults\n if (!Strobelight::isXenonActive()) {\n // Do not set the flag if Xenon is actively profiling this request\n setSurpriseFlag(XenonSignalFlag);\n }\n }\n }\n\n // surpriseAll currently has an issue where the isXenonActive() check will\n // try to access s_xenonData->getIsProfiledRequest() to check if the current\n // request is profiling. The problem is that you really want to check if the\n // request t is profiling. The current thread may not even be a request thread.\n // If we ever want to start using this signal for profiling,\n // we will need to figure out how to work around that problem.\n // if (signo == strobelight::kSignumAll) {\n // // sets on ALL threads\n // Strobelight::getInstance().surpriseAll();\n // }\n}",
  2089. "project": "hhvm",
  2090. "hash": 275356761552801735383089492999709697288,
  2091. "size": 28,
  2092. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2093. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2094. "target": 0,
  2095. "dataset": "other",
  2096. "idx": 219168
  2097. },
  2098. {
  2099. "func": "void Strobelight::surpriseAll() {\n RequestInfo::ExecutePerRequest(\n [] (RequestInfo* t) {\n // TODO: get a dedicated surprise flag to avoid colliding with xenon\n // Set the strobelight flag to collect a sample\n // TODO: isXenonActive() needs to check the request thread and not the\n // current thread (which may not even be a request)\n if (!isXenonActive()) {\n // Xenon has first crack at profiling requests. If a request\n // is marked as being profiled, we do not allow strobelight to\n // interfere with Xenon's profiling. In practice, collisions\n // should be extremely rare.\n t->m_reqInjectionData.setFlag(XenonSignalFlag);\n }\n }\n );\n}",
  2100. "project": "hhvm",
  2101. "hash": 297838356118481566379107800693703058065,
  2102. "size": 17,
  2103. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2104. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2105. "target": 0,
  2106. "dataset": "other",
  2107. "idx": 219308
  2108. },
  2109. {
  2110. "func": "bool Strobelight::isXenonActive() {\n if (RuntimeOption::XenonForceAlwaysOn) {\n return true;\n }\n\n bool xenonProfiled = Xenon::getInstance().getIsProfiledRequest();\n if (xenonProfiled) {\n return true;\n }\n\n return false;\n}",
  2111. "project": "hhvm",
  2112. "hash": 297123363444453326010313011470616629324,
  2113. "size": 12,
  2114. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2115. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2116. "target": 0,
  2117. "dataset": "other",
  2118. "idx": 219684
  2119. },
  2120. {
  2121. "func": "void Strobelight::log(c_WaitableWaitHandle* wh) const {\n if (RuntimeOption::XenonForceAlwaysOn) {\n // Disable strobelight if Xenon forced on\n // TODO remove this when strobelight has its own surpriseFlag\n return;\n }\n\n if (getSurpriseFlag(XenonSignalFlag)) {\n // TODO remove this when strobelight has its own surpriseFlag\n clearSurpriseFlag(XenonSignalFlag);\n }\n\n TRACE(1, \"Strobelight::log\\n\");\n if (active()) {\n // TODO We should filter only to hhvm samples which directly\n // caused a PMU event to fire. This is doable by storing hhvm\n // request IDs in a bpf map and checking for an entry here.\n auto bt = createBacktrace(BacktraceArgs()\n .fromWaitHandle(wh)\n // TODO\n // .withMetadata()\n .ignoreArgs());\n logToUSDT(bt);\n }\n}",
  2122. "project": "hhvm",
  2123. "hash": 65802561629527027805702110319424733976,
  2124. "size": 25,
  2125. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2126. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2127. "target": 0,
  2128. "dataset": "other",
  2129. "idx": 219486
  2130. },
  2131. {
  2132. "func": "bool Strobelight::active() {\n if (rds::isFullyInitialized() && isXenonActive()) {\n // if Xenon owns this request, back off\n return false;\n }\n\n // return true if a USDT probe function is listening\n return FOLLY_SDT_IS_ENABLED(hhvm, hhvm_stack);\n}",
  2133. "project": "hhvm",
  2134. "hash": 237208956696650508551097277908650710808,
  2135. "size": 9,
  2136. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2137. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2138. "target": 0,
  2139. "dataset": "other",
  2140. "idx": 219288
  2141. },
  2142. {
  2143. "func": "bool logToUSDT(const Array& bt) {\n std::lock_guard<std::mutex> lock(usdt_mutex);\n\n memset(&bt_slab, 0, sizeof(bt_slab));\n\n int i = 0;\n IterateVNoInc(\n bt.get(),\n [&](TypedValue tv) -> bool {\n\n if (i >= strobelight::kMaxStackframes) {\n return true;\n }\n\n assertx(isArrayLikeType(type(tv)));\n ArrayData* bt_frame = val(tv).parr;\n strobelight::backtrace_frame_t* frame = &bt_slab.frames[i];\n\n auto const line = bt_frame->get(s_line.get());\n if (line.is_init()) {\n assertx(isIntType(type(line)));\n frame->line = val(line).num;\n }\n\n auto const file_name = bt_frame->get(s_file.get());\n if (file_name.is_init()) {\n assertx(isStringType(type(file_name)));\n strncpy(frame->file_name,\n val(file_name).pstr->data(),\n std::min<int64_t>(\n val(file_name).pstr->size(),\n strobelight::kFileNameMax\n ));\n frame->file_name[strobelight::kFileNameMax - 1] = '\\0';\n }\n\n auto const class_name = bt_frame->get(s_class.get());\n if (class_name.is_init()) {\n assertx(isStringType(type(class_name)));\n strncpy(frame->class_name,\n val(class_name).pstr->data(),\n std::min<int64_t>(\n val(class_name).pstr->size(),\n strobelight::kClassNameMax\n ));\n frame->class_name[strobelight::kClassNameMax - 1] = '\\0';\n }\n\n auto const function_name = bt_frame->get(s_function.get());\n if (function_name.is_init()) {\n assertx(isStringType(type(function_name)));\n strncpy(frame->function,\n val(function_name).pstr->data(),\n std::min<int64_t>(\n val(function_name).pstr->size(),\n strobelight::kFunctionMax\n ));\n frame->function[strobelight::kFunctionMax - 1] = '\\0';\n }\n\n i++;\n return false;\n }\n );\n bt_slab.len = i;\n\n // Allow BPF to read the now-formatted stacktrace\n FOLLY_SDT_WITH_SEMAPHORE(hhvm, hhvm_stack, &bt_slab);\n\n return true;\n}",
  2144. "project": "hhvm",
  2145. "hash": 255038990099362447895056929601605394109,
  2146. "size": 71,
  2147. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2148. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2149. "target": 0,
  2150. "dataset": "other",
  2151. "idx": 219687
  2152. }
  2153. ]
  2154. },
  2155. {
  2156. "call_depth": 4,
  2157. "longest_call_chain": [
  2158. "zend_throw_exception_object",
  2159. "zend_throw_exception_internal",
  2160. "zend_exception_error",
  2161. "zend_error_va"
  2162. ],
  2163. "group_size": 7,
  2164. "functions": [
  2165. {
  2166. "func": "ZEND_API void zend_exception_error(zval *exception, int severity TSRMLS_DC) /* {{{ */\n{\n\tzend_class_entry *ce_exception = Z_OBJCE_P(exception);\n\tif (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {\n\t\tzval *str, *file, *line;\n\n\t\tEG(exception) = NULL;\n\n\t\tzend_call_method_with_0_params(&exception, ce_exception, NULL, \"__tostring\", &str);\n\t\tif (!EG(exception)) {\n\t\t\tif (Z_TYPE_P(str) != IS_STRING) {\n\t\t\t\tzend_error(E_WARNING, \"%s::__toString() must return a string\", ce_exception->name);\n\t\t\t} else {\n\t\t\t\tzend_update_property_string(default_exception_ce, exception, \"string\", sizeof(\"string\")-1, EG(exception) ? ce_exception->name : Z_STRVAL_P(str) TSRMLS_CC);\n\t\t\t}\n\t\t}\n\t\tzval_ptr_dtor(&str);\n\n\t\tif (EG(exception)) {\n\t\t\t/* do the best we can to inform about the inner exception */\n\t\t\tif (instanceof_function(ce_exception, default_exception_ce TSRMLS_CC)) {\n\t\t\t\tfile = zend_read_property(default_exception_ce, EG(exception), \"file\", sizeof(\"file\")-1, 1 TSRMLS_CC);\n\t\t\t\tline = zend_read_property(default_exception_ce, EG(exception), \"line\", sizeof(\"line\")-1, 1 TSRMLS_CC);\n\n\t\t\t\tconvert_to_string(file);\n\t\t\t\tfile = (Z_STRLEN_P(file) > 0) ? file : NULL;\n\t\t\t\tline = (Z_TYPE_P(line) == IS_LONG) ? line : NULL;\n\t\t\t} else {\n\t\t\t\tfile = NULL;\n\t\t\t\tline = NULL;\n\t\t\t}\n\t\t\tzend_error_va(E_WARNING, file ? Z_STRVAL_P(file) : NULL, line ? Z_LVAL_P(line) : 0, \"Uncaught %s in exception handling during call to %s::__tostring()\", Z_OBJCE_P(EG(exception))->name, ce_exception->name);\n\t\t}\n\n\t\tstr = zend_read_property(default_exception_ce, exception, \"string\", sizeof(\"string\")-1, 1 TSRMLS_CC);\n\t\tfile = zend_read_property(default_exception_ce, exception, \"file\", sizeof(\"file\")-1, 1 TSRMLS_CC);\n\t\tline = zend_read_property(default_exception_ce, exception, \"line\", sizeof(\"line\")-1, 1 TSRMLS_CC);\n\n\t\tconvert_to_string(str);\n\t\tconvert_to_string(file);\n\t\tconvert_to_long(line);\n\n\t\tzend_error_va(severity, (Z_STRLEN_P(file) > 0) ? Z_STRVAL_P(file) : NULL, Z_LVAL_P(line), \"Uncaught %s\\n thrown\", Z_STRVAL_P(str));\n\t} else {\n\t\tzend_error(severity, \"Uncaught exception '%s'\", ce_exception->name);\n\t}\n}",
  2167. "project": "php-src",
  2168. "hash": 233019637263204593162642334084906168743,
  2169. "size": 47,
  2170. "commit_id": "a894a8155fab068d68a04bf181dbaddfa01ccbb0",
  2171. "message": "More fixes for bug #69152",
  2172. "target": 0,
  2173. "dataset": "other",
  2174. "idx": 374469
  2175. },
  2176. {
  2177. "func": "ZEND_API void zend_throw_exception_object(zval *exception TSRMLS_DC) /* {{{ */\n{\n\tzend_class_entry *exception_ce;\n\n\tif (exception == NULL || Z_TYPE_P(exception) != IS_OBJECT) {\n\t\tzend_error(E_ERROR, \"Need to supply an object when throwing an exception\");\n\t}\n\n\texception_ce = Z_OBJCE_P(exception);\n\n\tif (!exception_ce || !instanceof_function(exception_ce, default_exception_ce TSRMLS_CC)) {\n\t\tzend_error(E_ERROR, \"Exceptions must be valid objects derived from the Exception base class\");\n\t}\n\tzend_throw_exception_internal(exception TSRMLS_CC);\n}",
  2178. "project": "php-src",
  2179. "hash": 168358188494444651132316427800666457773,
  2180. "size": 15,
  2181. "commit_id": "a894a8155fab068d68a04bf181dbaddfa01ccbb0",
  2182. "message": "More fixes for bug #69152",
  2183. "target": 0,
  2184. "dataset": "other",
  2185. "idx": 374451
  2186. },
  2187. {
  2188. "func": "static void zend_error_va(int type, const char *file, uint lineno, const char *format, ...) /* {{{ */\n{\n\tva_list args;\n\n\tva_start(args, format);\n\tzend_error_cb(type, file, lineno, format, args);\n\tva_end(args);\n}",
  2189. "project": "php-src",
  2190. "hash": 313633724532951233240989058937036034067,
  2191. "size": 8,
  2192. "commit_id": "a894a8155fab068d68a04bf181dbaddfa01ccbb0",
  2193. "message": "More fixes for bug #69152",
  2194. "target": 0,
  2195. "dataset": "other",
  2196. "idx": 374463
  2197. },
  2198. {
  2199. "func": "void zend_exception_restore(TSRMLS_D) /* {{{ */\n{\n\tif (EG(prev_exception)) {\n\t\tif (EG(exception)) {\n\t\t\tzend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC);\n\t\t} else {\n\t\t\tEG(exception) = EG(prev_exception);\n\t\t}\n\t\tEG(prev_exception) = NULL;\n\t}\n}",
  2200. "project": "php-src",
  2201. "hash": 65940455749340376476088943638997947991,
  2202. "size": 11,
  2203. "commit_id": "a894a8155fab068d68a04bf181dbaddfa01ccbb0",
  2204. "message": "More fixes for bug #69152",
  2205. "target": 0,
  2206. "dataset": "other",
  2207. "idx": 374462
  2208. },
  2209. {
  2210. "func": "void zend_exception_set_previous(zval *exception, zval *add_previous TSRMLS_DC)\n{\n\tzval *previous;\n\n\tif (exception == add_previous || !add_previous || !exception) {\n\t\treturn;\n\t}\n\tif (Z_TYPE_P(add_previous) != IS_OBJECT && !instanceof_function(Z_OBJCE_P(add_previous), default_exception_ce TSRMLS_CC)) {\n\t\tzend_error(E_ERROR, \"Cannot set non exception as previous exception\");\n\t\treturn;\n\t}\n\twhile (exception && exception != add_previous && Z_OBJ_HANDLE_P(exception) != Z_OBJ_HANDLE_P(add_previous)) {\n\t\tprevious = zend_read_property(default_exception_ce, exception, \"previous\", sizeof(\"previous\")-1, 1 TSRMLS_CC);\n\t\tif (Z_TYPE_P(previous) == IS_NULL) {\n\t\t\tzend_update_property(default_exception_ce, exception, \"previous\", sizeof(\"previous\")-1, add_previous TSRMLS_CC);\n\t\t\tZ_DELREF_P(add_previous);\n\t\t\treturn;\n\t\t}\n\t\texception = previous;\n\t}\n}",
  2211. "project": "php-src",
  2212. "hash": 159666285129417513959591408876495337624,
  2213. "size": 21,
  2214. "commit_id": "a894a8155fab068d68a04bf181dbaddfa01ccbb0",
  2215. "message": "More fixes for bug #69152",
  2216. "target": 0,
  2217. "dataset": "other",
  2218. "idx": 374466
  2219. },
  2220. {
  2221. "func": "void zend_throw_exception_internal(zval *exception TSRMLS_DC) /* {{{ */\n{\n#ifdef HAVE_DTRACE\n\tif (DTRACE_EXCEPTION_THROWN_ENABLED()) {\n\t\tconst char *classname;\n\t\tzend_uint name_len;\n\n\t\tif (exception != NULL) {\n\t\t\tzend_get_object_classname(exception, &classname, &name_len TSRMLS_CC);\n\t\t\tDTRACE_EXCEPTION_THROWN((char *)classname);\n\t\t} else {\n\t\t\tDTRACE_EXCEPTION_THROWN(NULL);\n\t\t}\n\t}\n#endif /* HAVE_DTRACE */\n\n\tif (exception != NULL) {\n\t\tzval *previous = EG(exception);\n\t\tzend_exception_set_previous(exception, EG(exception) TSRMLS_CC);\n\t\tEG(exception) = exception;\n\t\tif (previous) {\n\t\t\treturn;\n\t\t}\n\t}\n\tif (!EG(current_execute_data)) {\n\t\tif(EG(exception)) {\n\t\t\tzend_exception_error(EG(exception), E_ERROR TSRMLS_CC);\n\t\t}\n\t\tzend_error(E_ERROR, \"Exception thrown without a stack frame\");\n\t}\n\n\tif (zend_throw_exception_hook) {\n\t\tzend_throw_exception_hook(exception TSRMLS_CC);\n\t}\n\n\tif (EG(current_execute_data)->opline == NULL ||\n\t (EG(current_execute_data)->opline+1)->opcode == ZEND_HANDLE_EXCEPTION) {\n\t\t/* no need to rethrow the exception */\n\t\treturn;\n\t}\n\tEG(opline_before_exception) = EG(current_execute_data)->opline;\n\tEG(current_execute_data)->opline = EG(exception_op);\n}",
  2222. "project": "php-src",
  2223. "hash": 247917911400170479938783393940056166910,
  2224. "size": 43,
  2225. "commit_id": "a894a8155fab068d68a04bf181dbaddfa01ccbb0",
  2226. "message": "More fixes for bug #69152",
  2227. "target": 0,
  2228. "dataset": "other",
  2229. "idx": 374455
  2230. },
  2231. {
  2232. "func": "void zend_exception_save(TSRMLS_D) /* {{{ */\n{\n\tif (EG(prev_exception)) {\n\t\tzend_exception_set_previous(EG(exception), EG(prev_exception) TSRMLS_CC);\n\t}\n\tif (EG(exception)) {\n\t\tEG(prev_exception) = EG(exception);\n\t}\n\tEG(exception) = NULL;\n}",
  2233. "project": "php-src",
  2234. "hash": 116066607902918107578657479066223949823,
  2235. "size": 10,
  2236. "commit_id": "a894a8155fab068d68a04bf181dbaddfa01ccbb0",
  2237. "message": "More fixes for bug #69152",
  2238. "target": 0,
  2239. "dataset": "other",
  2240. "idx": 374448
  2241. }
  2242. ]
  2243. },
  2244. {
  2245. "call_depth": 4,
  2246. "longest_call_chain": [
  2247. "Open_table_context",
  2248. "m_flags",
  2249. "Profiler",
  2250. "BindToCPU"
  2251. ],
  2252. "group_size": 13,
  2253. "functions": [
  2254. {
  2255. "func": "static long get_us_interval(struct timeval *start, struct timeval *end) {\n return (((end->tv_sec - start->tv_sec) * 1000000)\n + (end->tv_usec - start->tv_usec));\n}",
  2256. "project": "hhvm",
  2257. "hash": 226869654135616472232911777556010156798,
  2258. "size": 4,
  2259. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2260. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2261. "target": 0,
  2262. "dataset": "other",
  2263. "idx": 219250
  2264. },
  2265. {
  2266. "func": " MachineInfo() {\n m_cpu_num = sysconf(_SC_NPROCESSORS_CONF);\n m_cpu_frequencies = get_cpu_frequency_from_file(\"/proc/cpuinfo\", m_cpu_num);\n\n if (m_cpu_frequencies)\n return;\n\n m_cpu_frequencies = new int64_t[m_cpu_num];\n for (int i = 0; i < m_cpu_num; i++) {\n cpu_set_t prev_mask;\n GET_AFFINITY(0, sizeof(cpu_set_t), &prev_mask);\n BindToCPU(i);\n // Make sure the current process gets scheduled to the target cpu. This\n // might not be necessary though.\n usleep(0);\n m_cpu_frequencies[i] = get_cpu_frequency();\n SET_AFFINITY(0, sizeof(cpu_set_t), &prev_mask);\n }\n }",
  2267. "project": "hhvm",
  2268. "hash": 180263000948610311410935395853679103945,
  2269. "size": 19,
  2270. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2271. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2272. "target": 0,
  2273. "dataset": "other",
  2274. "idx": 219057
  2275. },
  2276. {
  2277. "func": "static int64_t* get_cpu_frequency_from_file(const char *file, int ncpus)\n{\n std::ifstream cpuinfo(file);\n if (cpuinfo.fail()) {\n return nullptr;\n }\n char line[MAX_LINELENGTH];\n int64_t* freqs = new int64_t[ncpus];\n for (int i = 0; i < ncpus; ++i) {\n freqs[i] = 0;\n }\n int processor = -1;\n\n while (cpuinfo.getline(line, sizeof(line))) {\n if (sscanf(line, \"processor : %d\", &processor) == 1) {\n continue;\n }\n float freq;\n if ((sscanf(line, \"cpu MHz : %f\", &freq) == 1) ||\n (sscanf(line, \"clock : %f\", &freq) == 1)) {\n if (processor != -1 && processor < ncpus) {\n freqs[processor] = nearbyint(freq);\n processor = -1;\n }\n }\n }\n for (int i = 0; i < ncpus; ++i) {\n if (freqs[i] == 0) {\n delete[] freqs;\n return nullptr;\n }\n }\n return freqs;\n}",
  2278. "project": "hhvm",
  2279. "hash": 248085455882707873436144105338088029488,
  2280. "size": 34,
  2281. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2282. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2283. "target": 0,
  2284. "dataset": "other",
  2285. "idx": 219292
  2286. },
  2287. {
  2288. "func": " static void BindToCPU(uint32_t cpu_id) {\n cpu_set_t new_mask;\n CPU_ZERO(&new_mask);\n CPU_SET(cpu_id, &new_mask);\n SET_AFFINITY(0, sizeof(cpu_set_t), &new_mask);\n }",
  2289. "project": "hhvm",
  2290. "hash": 252561999300798108266609964241078876025,
  2291. "size": 6,
  2292. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2293. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2294. "target": 0,
  2295. "dataset": "other",
  2296. "idx": 219879
  2297. },
  2298. {
  2299. "func": " explicit TraceProfiler(int flags)\n : Profiler(true)\n , m_traceBuffer(nullptr)\n , m_traceBufferSize(0)\n , m_nextTraceEntry(0)\n , m_traceBufferFilled(false)\n , m_maxTraceBuffer(0)\n , m_overflowCalls(0)\n , m_flags(flags)\n {\n if (!(m_flags & IHaveInfiniteMemory) && pthread_mutex_trylock(&s_inUse)) {\n // This profiler uses a very large amount of memory. Only allow\n // one in the process at any time.\n m_successful = false;\n } else {\n m_maxTraceBuffer = RuntimeOption::ProfilerMaxTraceBuffer;\n Extension* ext = ExtensionRegistry::get(s_hotprofiler);\n assertx(ext);\n IniSetting::Bind(ext, IniSetting::PHP_INI_ALL,\n \"profiler.max_trace_buffer\",\n &m_maxTraceBuffer);\n }\n }",
  2300. "project": "hhvm",
  2301. "hash": 97949173461319208565106839514492844861,
  2302. "size": 23,
  2303. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2304. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2305. "target": 0,
  2306. "dataset": "other",
  2307. "idx": 219466
  2308. },
  2309. {
  2310. "func": " explicit HierarchicalProfiler(int flags) : Profiler(true), m_flags(flags) {\n }",
  2311. "project": "hhvm",
  2312. "hash": 56700908204766941970227207576771894312,
  2313. "size": 2,
  2314. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2315. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2316. "target": 0,
  2317. "dataset": "other",
  2318. "idx": 219660
  2319. },
  2320. {
  2321. "func": "void Profiler::endAllFrames() {\n while (m_stack) {\n endFrame(nullptr, nullptr, true);\n }\n}",
  2322. "project": "hhvm",
  2323. "hash": 245415849160079604862531924084058340861,
  2324. "size": 5,
  2325. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2326. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2327. "target": 0,
  2328. "dataset": "other",
  2329. "idx": 219314
  2330. },
  2331. {
  2332. "func": " void endAllFrames() override {\n // Nothing to do for this profiler since all work is done as we go.\n }",
  2333. "project": "hhvm",
  2334. "hash": 150441449384399467871760114204802685380,
  2335. "size": 3,
  2336. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2337. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2338. "target": 0,
  2339. "dataset": "other",
  2340. "idx": 219864
  2341. },
  2342. {
  2343. "func": "Profiler::~Profiler() {\n if (m_has_affinity) {\n SET_AFFINITY(0, sizeof(cpu_set_t), &m_prev_mask);\n }\n\n endAllFrames();\n for (Frame *p = m_frame_free_list; p;) {\n Frame *cur = p;\n p = p->m_parent;\n delete cur;\n }\n}",
  2344. "project": "hhvm",
  2345. "hash": 218080934643076592466588935207842016775,
  2346. "size": 12,
  2347. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2348. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2349. "target": 0,
  2350. "dataset": "other",
  2351. "idx": 219479
  2352. },
  2353. {
  2354. "func": " explicit MemoProfiler(int /*flags*/) : Profiler(true) {}",
  2355. "project": "hhvm",
  2356. "hash": 76196938429753322405609073721382273498,
  2357. "size": 1,
  2358. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2359. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2360. "target": 0,
  2361. "dataset": "other",
  2362. "idx": 219768
  2363. },
  2364. {
  2365. "func": "static int64_t get_cpu_frequency() {\n struct timeval start;\n struct timeval end;\n\n if (gettimeofday(&start, 0)) {\n perror(\"gettimeofday\");\n return 0.0;\n }\n uint64_t tsc_start = cpuCycles();\n uint64_t tsc_end;\n volatile int i;\n // Busy loop for 5 miliseconds. Don't use usleep() here since it causes the\n // CPU to halt which will generate meaningless results.\n do {\n for (i = 0; i < 1000000; i++);\n if (gettimeofday(&end, 0)) {\n perror(\"gettimeofday\");\n return 0.0;\n }\n tsc_end = cpuCycles();\n } while (get_us_interval(&start, &end) < 5000);\n\n return nearbyint((tsc_end - tsc_start) * 1.0\n / (get_us_interval(&start, &end)));\n}",
  2366. "project": "hhvm",
  2367. "hash": 82995547803504983128639277702102155539,
  2368. "size": 25,
  2369. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2370. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2371. "target": 0,
  2372. "dataset": "other",
  2373. "idx": 219071
  2374. },
  2375. {
  2376. "func": "Profiler::Profiler(bool needCPUAffinity) : m_successful(true),\n m_stack(nullptr),\n m_frame_free_list(nullptr),\n m_has_affinity(needCPUAffinity) {\n if (!s_rand_initialized) {\n s_rand_initialized = true;\n srand(math_generate_seed());\n }\n\n if (m_has_affinity) {\n //\n // Bind to a random cpu so that we can use rdtsc instruction.\n //\n int cur_cpu_id = rand() % s_machine.m_cpu_num;\n GET_AFFINITY(0, sizeof(cpu_set_t), &m_prev_mask);\n MachineInfo::BindToCPU(cur_cpu_id);\n m_MHz = s_machine.m_cpu_frequencies[cur_cpu_id];\n } else {\n //\n // Take cpu0's speed as a proxy for all cpus.\n //\n m_MHz = s_machine.m_cpu_frequencies[0];\n }\n\n memset(m_func_hash_counters, 0, sizeof(m_func_hash_counters));\n}",
  2377. "project": "hhvm",
  2378. "hash": 228890197525810853672696827937472522779,
  2379. "size": 26,
  2380. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  2381. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  2382. "target": 0,
  2383. "dataset": "other",
  2384. "idx": 219669
  2385. },
  2386. {
  2387. "func": "Open_table_context::Open_table_context(THD *thd, uint flags)\n :m_thd(thd),\n m_failed_table(NULL),\n m_start_of_statement_svp(thd->mdl_context.mdl_savepoint()),\n m_timeout(flags & MYSQL_LOCK_IGNORE_TIMEOUT ?\n LONG_TIMEOUT : thd->variables.lock_wait_timeout),\n m_flags(flags),\n m_action(OT_NO_ACTION),\n m_has_locks(thd->mdl_context.has_locks()),\n m_has_protection_against_grl(0)\n{}",
  2388. "target": 0,
  2389. "cwe": [
  2390. "CWE-416"
  2391. ],
  2392. "project": "server",
  2393. "commit_id": "0beed9b5e933f0ff79b3bb346524f7a451d14e38",
  2394. "hash": 231716104947654513237673151084075997257,
  2395. "size": 11,
  2396. "message": "MDEV-28097 use-after-free when WHERE has subquery with an outer reference in HAVING\n\nwhen resolving WHERE and ON clauses, do not look in\nSELECT list/aliases.",
  2397. "dataset": "other",
  2398. "idx": 514562
  2399. }
  2400. ]
  2401. },
  2402. {
  2403. "call_depth": 4,
  2404. "longest_call_chain": [
  2405. "latm_dmx_process",
  2406. "latm_dmx_check_pid",
  2407. "latm_dmx_check_dur",
  2408. "latm_dmx_sync_frame_bs"
  2409. ],
  2410. "group_size": 6,
  2411. "functions": [
  2412. {
  2413. "func": "static void latm_dmx_check_pid(GF_Filter *filter, GF_LATMDmxCtx *ctx)\n{\n\tu8 *dsi_b;\n\tu32 dsi_s, sr, timescale=0;\n\tu32 codecid;\n\tif (!ctx->opid) {\n\t\tctx->opid = gf_filter_pid_new(filter);\n\t\tgf_filter_pid_copy_properties(ctx->opid, ctx->ipid);\n\t\tlatm_dmx_check_dur(filter, ctx);\n\t}\n\tif (!GF_M4ASampleRates[ctx->acfg.base_sr_index]) {\n\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, (\"[LATMDmx] Wrong sample rate in audio config, broken stream\\n\"));\n\t\tctx->in_error = GF_NON_COMPLIANT_BITSTREAM;\n\t\treturn;\n\t}\n\n\tif ((ctx->sr_idx == ctx->acfg.base_sr_index) && (ctx->nb_ch == ctx->acfg.nb_chan )\n\t\t&& (ctx->base_object_type == ctx->acfg.base_object_type) ) return;\n\n\tif (ctx->acfg.base_object_type==GF_M4A_USAC)\n\t\tcodecid = GF_CODECID_USAC;\n\telse\n\t\tcodecid = GF_CODECID_AAC_MPEG4;\n\t//copy properties at init or reconfig\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_STREAM_TYPE, & PROP_UINT( GF_STREAM_AUDIO));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_CODECID, & PROP_UINT( codecid));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_SAMPLES_PER_FRAME, & PROP_UINT(ctx->frame_size) );\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_UNFRAMED, & PROP_BOOL(GF_FALSE) );\n\tif (ctx->is_file && ctx->index) {\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_PLAYBACK_MODE, & PROP_UINT(GF_PLAYBACK_MODE_FASTFORWARD) );\n\t}\n\tif (ctx->duration.num)\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DURATION, & PROP_FRAC64(ctx->duration));\n\n\n\tctx->nb_ch = ctx->acfg.nb_chan;\n\tctx->base_object_type = ctx->acfg.base_object_type;\n\n\tsr = GF_M4ASampleRates[ctx->acfg.base_sr_index];\n\tif (!ctx->timescale) {\n\t\t//we change sample rate, change cts\n\t\tif (ctx->cts && (ctx->sr_idx != ctx->acfg.base_sr_index)) {\n\t\t\tctx->cts *= sr;\n\t\t\tctx->cts /= GF_M4ASampleRates[ctx->sr_idx];\n\t\t}\n\t}\n\tctx->sr_idx = ctx->acfg.base_sr_index;\n\n\tctx->dts_inc = ctx->frame_size;\n\tgf_m4a_write_config(&ctx->acfg, &dsi_b, &dsi_s);\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DECODER_CONFIG, & PROP_DATA_NO_COPY(dsi_b, dsi_s) );\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_PROFILE_LEVEL, & PROP_UINT (ctx->acfg.audioPL) );\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_SAMPLE_RATE, & PROP_UINT(sr));\n\n\ttimescale = sr;\n\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_TIMESCALE, & PROP_UINT(ctx->timescale ? ctx->timescale : timescale));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_NUM_CHANNELS, & PROP_UINT(ctx->nb_ch) );\n\n\tif (ctx->bitrate) {\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_BITRATE, & PROP_UINT(ctx->bitrate));\n\t}\n}",
  2414. "project": "gpac",
  2415. "hash": 165495346712678193500478445775721262302,
  2416. "size": 63,
  2417. "commit_id": "b2db2f99b4c30f96e17b9a14537c776da6cb5dca",
  2418. "message": "fixed #1728",
  2419. "target": 0,
  2420. "dataset": "other",
  2421. "idx": 271472
  2422. },
  2423. {
  2424. "func": "static GFINLINE void latm_dmx_update_cts(GF_LATMDmxCtx *ctx)\n{\n\tassert(ctx->dts_inc);\n\n\tif (ctx->timescale) {\n\t\tu64 inc = ctx->dts_inc;\n\t\tinc *= ctx->timescale;\n\t\tinc /= GF_M4ASampleRates[ctx->sr_idx];\n\t\tctx->cts += inc;\n\t} else {\n\t\tctx->cts += ctx->dts_inc;\n\t}\n}",
  2425. "project": "gpac",
  2426. "hash": 326400713483767484341063456654570434654,
  2427. "size": 13,
  2428. "commit_id": "b2db2f99b4c30f96e17b9a14537c776da6cb5dca",
  2429. "message": "fixed #1728",
  2430. "target": 0,
  2431. "dataset": "other",
  2432. "idx": 271475
  2433. },
  2434. {
  2435. "func": "static void latm_dmx_check_dur(GF_Filter *filter, GF_LATMDmxCtx *ctx)\n{\n\tFILE *stream;\n\tGF_BitStream *bs;\n\tGF_M4ADecSpecInfo acfg;\n\tu64 duration, cur_dur, cur_pos, rate;\n\ts32 sr_idx = -1;\n\tconst GF_PropertyValue *p;\n\tif (!ctx->opid || ctx->timescale || ctx->file_loaded) return;\n\n\tif (ctx->index<=0) {\n\t\tctx->file_loaded = GF_TRUE;\n\t\treturn;\n\t}\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_FILEPATH);\n\tif (!p || !p->value.string || !strncmp(p->value.string, \"gmem://\", 7)) {\n\t\tctx->is_file = GF_FALSE;\n\t\tctx->file_loaded = GF_TRUE;\n\t\treturn;\n\t}\n\tctx->is_file = GF_TRUE;\n\n\tstream = gf_fopen(p->value.string, \"rb\");\n\tif (!stream) return;\n\n\tctx->index_size = 0;\n\n\tmemset(&acfg, 0, sizeof(GF_M4ADecSpecInfo));\n\n\n\tbs = gf_bs_from_file(stream, GF_BITSTREAM_READ);\n\tduration = 0;\n\tcur_dur = 0;\n\tcur_pos = gf_bs_get_position(bs);\n\twhile (latm_dmx_sync_frame_bs(bs, &acfg, 0, NULL, NULL)) {\n\t\tif ((sr_idx>=0) && (sr_idx != acfg.base_sr_index)) {\n\t\t\tduration *= GF_M4ASampleRates[acfg.base_sr_index];\n\t\t\tduration /= GF_M4ASampleRates[sr_idx];\n\n\t\t\tcur_dur *= GF_M4ASampleRates[acfg.base_sr_index];\n\t\t\tcur_dur /= GF_M4ASampleRates[sr_idx];\n\t\t}\n\t\tsr_idx = acfg.base_sr_index;\n\t\tduration += ctx->frame_size;\n\t\tcur_dur += ctx->frame_size;\n\t\tif (cur_dur > ctx->index * GF_M4ASampleRates[sr_idx]) {\n\t\t\tif (!ctx->index_alloc_size) ctx->index_alloc_size = 10;\n\t\t\telse if (ctx->index_alloc_size == ctx->index_size) ctx->index_alloc_size *= 2;\n\t\t\tctx->indexes = gf_realloc(ctx->indexes, sizeof(LATMIdx)*ctx->index_alloc_size);\n\t\t\tctx->indexes[ctx->index_size].pos = cur_pos;\n\t\t\tctx->indexes[ctx->index_size].duration = (Double) duration;\n\t\t\tctx->indexes[ctx->index_size].duration /= GF_M4ASampleRates[sr_idx];\n\t\t\tctx->index_size ++;\n\t\t\tcur_dur = 0;\n\t\t}\n\n\t\tcur_pos = gf_bs_get_position(bs);\n\t}\n\trate = gf_bs_get_position(bs);\n\tgf_bs_del(bs);\n\tgf_fclose(stream);\n\n\tif (sr_idx>=0) {\n\t\tif (!ctx->duration.num || (ctx->duration.num * GF_M4ASampleRates[sr_idx] != duration * ctx->duration.den)) {\n\t\t\tctx->duration.num = (s32) duration;\n\t\t\tctx->duration.den = GF_M4ASampleRates[sr_idx];\n\n\t\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DURATION, & PROP_FRAC64(ctx->duration));\n\n\t\t\tif (duration && !gf_sys_is_test_mode() ) {\n\t\t\t\trate *= 8 * ctx->duration.den;\n\t\t\t\trate /= ctx->duration.num;\n\t\t\t\tctx->bitrate = (u32) rate;\n\t\t\t}\n\t\t}\n\t}\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_FILE_CACHED);\n\tif (p && p->value.boolean) ctx->file_loaded = GF_TRUE;\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_CAN_DATAREF, & PROP_BOOL(GF_TRUE ) );\n}",
  2436. "project": "gpac",
  2437. "hash": 268079972344018463318373147938902590521,
  2438. "size": 81,
  2439. "commit_id": "b2db2f99b4c30f96e17b9a14537c776da6cb5dca",
  2440. "message": "fixed #1728",
  2441. "target": 0,
  2442. "dataset": "other",
  2443. "idx": 271469
  2444. },
  2445. {
  2446. "func": "GF_Err latm_dmx_process(GF_Filter *filter)\n{\n\tGF_LATMDmxCtx *ctx = gf_filter_get_udta(filter);\n\tGF_FilterPacket *pck, *dst_pck;\n\tu32 pos;\n\tu8 *data, *output;\n\tu32 pck_size, prev_pck_size;\n\tu64 cts = GF_FILTER_NO_TS;\n\n\tif (ctx->in_error)\n\t\treturn ctx->in_error;\n\n\t//always reparse duration\n\tif (!ctx->duration.num)\n\t\tlatm_dmx_check_dur(filter, ctx);\n\n\tif (ctx->opid && !ctx->is_playing)\n\t\treturn GF_OK;\n\n\tpck = gf_filter_pid_get_packet(ctx->ipid);\n\tif (!pck) {\n\t\tif (gf_filter_pid_is_eos(ctx->ipid)) {\n\t\t\tif (!ctx->latm_buffer_size) {\n\t\t\t\tif (ctx->opid)\n\t\t\t\t\tgf_filter_pid_set_eos(ctx->opid);\n\t\t\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\t\t\tctx->src_pck = NULL;\n\t\t\t\treturn GF_EOS;\n\t\t\t}\n\t\t} else {\n\t\t\treturn GF_OK;\n\t\t}\n\t}\n\n\tdata = (char *) gf_filter_pck_get_data(pck, &pck_size);\n\n\t//input pid sets some timescale - we flushed pending data , update cts\n\tif (ctx->timescale && pck) {\n\t\tcts = gf_filter_pck_get_cts(pck);\n\t}\n\n\tprev_pck_size = ctx->latm_buffer_size;\n\n\tif (pck && !ctx->resume_from) {\n\t\tif (ctx->latm_buffer_size + pck_size > ctx->latm_buffer_alloc) {\n\t\t\tctx->latm_buffer_alloc = ctx->latm_buffer_size + pck_size;\n\t\t\tctx->latm_buffer = gf_realloc(ctx->latm_buffer, ctx->latm_buffer_alloc);\n\t\t}\n\t\tmemcpy(ctx->latm_buffer + ctx->latm_buffer_size, data, pck_size);\n\t\tctx->latm_buffer_size += pck_size;\n\t}\n\n\tif (!ctx->bs) ctx->bs = gf_bs_new(ctx->latm_buffer, ctx->latm_buffer_size, GF_BITSTREAM_READ);\n\telse gf_bs_reassign_buffer(ctx->bs, ctx->latm_buffer, ctx->latm_buffer_size);\n\n\tif (ctx->resume_from) {\n\t\tgf_bs_seek(ctx->bs, ctx->resume_from-1);\n\t\tctx->resume_from = 0;\n\t}\n\n\tif (cts == GF_FILTER_NO_TS)\n\t\tprev_pck_size = 0;\n\n\n\twhile (1) {\n\t\tpos = (u32) gf_bs_get_position(ctx->bs);\n\t\tu8 latm_buffer[4096];\n\t\tu32 latm_frame_size = 4096;\n\t\tif (!latm_dmx_sync_frame_bs(ctx->bs,&ctx->acfg, &latm_frame_size, latm_buffer, NULL)) break;\n\n\t\tif (ctx->in_seek) {\n\t\t\tu64 nb_samples_at_seek = (u64) (ctx->start_range * GF_M4ASampleRates[ctx->sr_idx]);\n\t\t\tif (ctx->cts + ctx->dts_inc >= nb_samples_at_seek) {\n\t\t\t\t//u32 samples_to_discard = (ctx->cts + ctx->dts_inc) - nb_samples_at_seek;\n\t\t\t\tctx->in_seek = GF_FALSE;\n\t\t\t}\n\t\t}\n\n\t\tlatm_dmx_check_pid(filter, ctx);\n\n\t\tif (!ctx->is_playing) {\n\t\t\tctx->resume_from = pos+1;\n\t\t\treturn GF_OK;\n\t\t}\n\n\t\tif (!ctx->in_seek) {\n\t\t\tGF_FilterSAPType sap = GF_FILTER_SAP_1;\n\n\t\t\tdst_pck = gf_filter_pck_new_alloc(ctx->opid, latm_frame_size, &output);\n\t\t\tif (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, dst_pck);\n\n\t\t\tmemcpy(output, latm_buffer, latm_frame_size);\n\n\t\t\tgf_filter_pck_set_cts(dst_pck, ctx->cts);\n\t\t\tgf_filter_pck_set_duration(dst_pck, ctx->dts_inc);\n\t\t\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_TRUE);\n\n\t\t\t/*xHE-AAC, check RAP*/\n\t\t\tif (ctx->acfg.base_object_type==GF_CODECID_USAC) {\n\t\t\t\tif (latm_frame_size && (output[0] & 0x80) && !ctx->prev_sap) {\n\t\t\t\t\tsap = GF_FILTER_SAP_1;\n\t\t\t\t\tctx->prev_sap = GF_TRUE;\n\t\t\t\t} else {\n\t\t\t\t\tsap = GF_FILTER_SAP_NONE;\n\t\t\t\t\tctx->prev_sap = GF_FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t\tgf_filter_pck_set_sap(dst_pck, sap);\n\n\t\t\tgf_filter_pck_send(dst_pck);\n\t\t}\n\t\tlatm_dmx_update_cts(ctx);\n\n\t\tif (prev_pck_size) {\n\t\t\tpos = (u32) gf_bs_get_position(ctx->bs);\n\t\t\tif (prev_pck_size<=pos) {\n\t\t\t\tprev_pck_size=0;\n\t\t\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\t\t\tctx->src_pck = pck;\n\t\t\t\tif (pck)\n\t\t\t\t\tgf_filter_pck_ref_props(&ctx->src_pck);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pck) {\n\t\tpos = (u32) gf_bs_get_position(ctx->bs);\n\t\tassert(ctx->latm_buffer_size >= pos);\n\t\tmemmove(ctx->latm_buffer, ctx->latm_buffer+pos, ctx->latm_buffer_size - pos);\n\t\tctx->latm_buffer_size -= pos;\n\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t\tassert(!ctx->resume_from);\n\t} else {\n\t\tctx->latm_buffer_size = 0;\n\t\treturn latm_dmx_process(filter);\n\t}\n\treturn GF_OK;\n}",
  2447. "project": "gpac",
  2448. "hash": 129393460693122238437209841613363417813,
  2449. "size": 138,
  2450. "commit_id": "b2db2f99b4c30f96e17b9a14537c776da6cb5dca",
  2451. "message": "fixed #1728",
  2452. "target": 1,
  2453. "dataset": "other",
  2454. "idx": 198278
  2455. },
  2456. {
  2457. "func": "GF_Err latm_dmx_process(GF_Filter *filter)\n{\n\tGF_LATMDmxCtx *ctx = gf_filter_get_udta(filter);\n\tGF_FilterPacket *pck, *dst_pck;\n\tu32 pos;\n\tu8 *data=NULL, *output;\n\tu32 pck_size=0, prev_pck_size;\n\tu64 cts = GF_FILTER_NO_TS;\n\n\tif (ctx->in_error)\n\t\treturn ctx->in_error;\n\n\t//always reparse duration\n\tif (!ctx->duration.num)\n\t\tlatm_dmx_check_dur(filter, ctx);\n\n\tif (ctx->opid && !ctx->is_playing)\n\t\treturn GF_OK;\n\n\tpck = gf_filter_pid_get_packet(ctx->ipid);\n\tif (!pck) {\n\t\tif (gf_filter_pid_is_eos(ctx->ipid)) {\n\t\t\tif (!ctx->latm_buffer_size) {\n\t\t\t\tif (ctx->opid)\n\t\t\t\t\tgf_filter_pid_set_eos(ctx->opid);\n\t\t\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\t\t\tctx->src_pck = NULL;\n\t\t\t\treturn GF_EOS;\n\t\t\t}\n\t\t} else {\n\t\t\treturn GF_OK;\n\t\t}\n\t} else {\n\t\tdata = (char *) gf_filter_pck_get_data(pck, &pck_size);\n\t}\n\n\t//input pid sets some timescale - we flushed pending data , update cts\n\tif (ctx->timescale && pck) {\n\t\tcts = gf_filter_pck_get_cts(pck);\n\t}\n\n\tprev_pck_size = ctx->latm_buffer_size;\n\n\tif (pck && !ctx->resume_from) {\n\t\tif (ctx->latm_buffer_size + pck_size > ctx->latm_buffer_alloc) {\n\t\t\tctx->latm_buffer_alloc = ctx->latm_buffer_size + pck_size;\n\t\t\tctx->latm_buffer = gf_realloc(ctx->latm_buffer, ctx->latm_buffer_alloc);\n\t\t}\n\t\tmemcpy(ctx->latm_buffer + ctx->latm_buffer_size, data, pck_size);\n\t\tctx->latm_buffer_size += pck_size;\n\t}\n\n\tif (!ctx->bs) ctx->bs = gf_bs_new(ctx->latm_buffer, ctx->latm_buffer_size, GF_BITSTREAM_READ);\n\telse gf_bs_reassign_buffer(ctx->bs, ctx->latm_buffer, ctx->latm_buffer_size);\n\n\tif (ctx->resume_from) {\n\t\tgf_bs_seek(ctx->bs, ctx->resume_from-1);\n\t\tctx->resume_from = 0;\n\t}\n\n\tif (cts == GF_FILTER_NO_TS)\n\t\tprev_pck_size = 0;\n\n\n\twhile (1) {\n\t\tpos = (u32) gf_bs_get_position(ctx->bs);\n\t\tu8 latm_buffer[4096];\n\t\tu32 latm_frame_size = 4096;\n\t\tif (!latm_dmx_sync_frame_bs(ctx->bs,&ctx->acfg, &latm_frame_size, latm_buffer, NULL)) break;\n\n\t\tif (ctx->in_seek) {\n\t\t\tu64 nb_samples_at_seek = (u64) (ctx->start_range * GF_M4ASampleRates[ctx->sr_idx]);\n\t\t\tif (ctx->cts + ctx->dts_inc >= nb_samples_at_seek) {\n\t\t\t\t//u32 samples_to_discard = (ctx->cts + ctx->dts_inc) - nb_samples_at_seek;\n\t\t\t\tctx->in_seek = GF_FALSE;\n\t\t\t}\n\t\t}\n\n\t\tlatm_dmx_check_pid(filter, ctx);\n\n\t\tif (!ctx->is_playing) {\n\t\t\tctx->resume_from = pos+1;\n\t\t\treturn GF_OK;\n\t\t}\n\n\t\tif (!ctx->in_seek) {\n\t\t\tGF_FilterSAPType sap = GF_FILTER_SAP_1;\n\n\t\t\tdst_pck = gf_filter_pck_new_alloc(ctx->opid, latm_frame_size, &output);\n\t\t\tif (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, dst_pck);\n\n\t\t\tmemcpy(output, latm_buffer, latm_frame_size);\n\n\t\t\tgf_filter_pck_set_cts(dst_pck, ctx->cts);\n\t\t\tgf_filter_pck_set_duration(dst_pck, ctx->dts_inc);\n\t\t\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_TRUE);\n\n\t\t\t/*xHE-AAC, check RAP*/\n\t\t\tif (ctx->acfg.base_object_type==GF_CODECID_USAC) {\n\t\t\t\tif (latm_frame_size && (output[0] & 0x80) && !ctx->prev_sap) {\n\t\t\t\t\tsap = GF_FILTER_SAP_1;\n\t\t\t\t\tctx->prev_sap = GF_TRUE;\n\t\t\t\t} else {\n\t\t\t\t\tsap = GF_FILTER_SAP_NONE;\n\t\t\t\t\tctx->prev_sap = GF_FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t\tgf_filter_pck_set_sap(dst_pck, sap);\n\n\t\t\tgf_filter_pck_send(dst_pck);\n\t\t}\n\t\tlatm_dmx_update_cts(ctx);\n\n\t\tif (prev_pck_size) {\n\t\t\tpos = (u32) gf_bs_get_position(ctx->bs);\n\t\t\tif (prev_pck_size<=pos) {\n\t\t\t\tprev_pck_size=0;\n\t\t\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\t\t\tctx->src_pck = pck;\n\t\t\t\tif (pck)\n\t\t\t\t\tgf_filter_pck_ref_props(&ctx->src_pck);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (pck) {\n\t\tpos = (u32) gf_bs_get_position(ctx->bs);\n\t\tassert(ctx->latm_buffer_size >= pos);\n\t\tmemmove(ctx->latm_buffer, ctx->latm_buffer+pos, ctx->latm_buffer_size - pos);\n\t\tctx->latm_buffer_size -= pos;\n\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t\tassert(!ctx->resume_from);\n\t} else {\n\t\tctx->latm_buffer_size = 0;\n\t\treturn latm_dmx_process(filter);\n\t}\n\treturn GF_OK;\n}",
  2458. "project": "gpac",
  2459. "hash": 10482263121380563115286320698149929915,
  2460. "size": 138,
  2461. "commit_id": "b2db2f99b4c30f96e17b9a14537c776da6cb5dca",
  2462. "message": "fixed #1728",
  2463. "target": 0,
  2464. "dataset": "other",
  2465. "idx": 271474
  2466. },
  2467. {
  2468. "func": "static Bool latm_dmx_sync_frame_bs(GF_BitStream *bs, GF_M4ADecSpecInfo *acfg, u32 *nb_bytes, u8 *buffer, u32 *nb_skipped)\n{\n\tu32 val, size;\n\tu64 pos, mux_size;\n\tif (nb_skipped) *nb_skipped = 0;\n\tif (!acfg) return 0;\n\n\twhile (gf_bs_available(bs)>3) {\n\t\tval = gf_bs_read_u8(bs);\n\t\tif (val!=0x56) {\n\t\t\tif (nb_skipped) (*nb_skipped) ++;\n\t\t\tcontinue;\n\t\t}\n\t\tval = gf_bs_read_int(bs, 3);\n\t\tif (val != 0x07) {\n\t\t\tgf_bs_read_int(bs, 5);\n\t\t\tif (nb_skipped) (*nb_skipped) ++;\n\t\t\tcontinue;\n\t\t}\n\t\tmux_size = gf_bs_read_int(bs, 13);\n\t\tpos = gf_bs_get_position(bs);\n\t\tif (mux_size>gf_bs_available(bs) ) {\n\t\t\tgf_bs_seek(bs, pos-3);\n\t\t\treturn GF_FALSE;\n\t\t}\n\n\t\t/*use same stream mux*/\n\t\tif (!gf_bs_read_int(bs, 1)) {\n\t\t\tBool amux_version, amux_versionA;\n\n\t\t\tamux_version = (Bool)gf_bs_read_int(bs, 1);\n\t\t\tamux_versionA = GF_FALSE;\n\t\t\tif (amux_version) amux_versionA = (Bool)gf_bs_read_int(bs, 1);\n\t\t\tif (!amux_versionA) {\n\t\t\t\tu32 i, allStreamsSameTimeFraming, numProgram;\n\t\t\t\tif (amux_version) gf_latm_get_value(bs);\n\n\t\t\t\tallStreamsSameTimeFraming = gf_bs_read_int(bs, 1);\n\t\t\t\t/*numSubFrames = */gf_bs_read_int(bs, 6);\n\t\t\t\tnumProgram = gf_bs_read_int(bs, 4);\n\t\t\t\tfor (i=0; i<=numProgram; i++) {\n\t\t\t\t\tu32 j, num_lay;\n\t\t\t\t\tnum_lay = gf_bs_read_int(bs, 3);\n\t\t\t\t\tfor (j=0; j<=num_lay; j++) {\n\t\t\t\t\t\tu32 frameLengthType;\n\t\t\t\t\t\tBool same_cfg = GF_FALSE;\n\t\t\t\t\t\tif (i || j) same_cfg = (Bool)gf_bs_read_int(bs, 1);\n\n\t\t\t\t\t\tif (!same_cfg) {\n\t\t\t\t\t\t\tif (amux_version==1) gf_latm_get_value(bs);\n\t\t\t\t\t\t\tgf_m4a_parse_config(bs, acfg, GF_FALSE);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tframeLengthType = gf_bs_read_int(bs, 3);\n\t\t\t\t\t\tif (!frameLengthType) {\n\t\t\t\t\t\t\t/*latmBufferFullness = */gf_bs_read_int(bs, 8);\n\t\t\t\t\t\t\tif (!allStreamsSameTimeFraming) {\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t/*not supported*/\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t}\n\t\t\t\t/*other data present*/\n\t\t\t\tif (gf_bs_read_int(bs, 1)) {\n//\t\t\t\t\tu32 k = 0;\n\t\t\t\t}\n\t\t\t\t/*CRCcheck present*/\n\t\t\t\tif (gf_bs_read_int(bs, 1)) {\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tsize = 0;\n\t\twhile (1) {\n\t\t\tu32 tmp = gf_bs_read_int(bs, 8);\n\t\t\tsize += tmp;\n\t\t\tif (tmp!=255) break;\n\t\t}\n\t\tif (gf_bs_available(bs) < size) {\n\t\t\tgf_bs_seek(bs, pos-3);\n\t\t\treturn GF_FALSE;\n\t\t}\n\n\t\tif (nb_bytes) {\n\t\t\t*nb_bytes = (u32) size;\n\t\t}\n\n\t\tif (buffer) {\n\t\t\tgf_bs_read_data(bs, (char *) buffer, size);\n\t\t} else {\n\t\t\twhile (size) {\n\t\t\t\tgf_bs_read_int(bs, 8);\n\t\t\t\tsize--;\n\t\t\t}\n\t\t}\n\n\t\t/*parse amux*/\n\t\tgf_bs_seek(bs, pos + mux_size);\n\n\t\tif ((gf_bs_available(bs)>2) && gf_bs_peek_bits(bs, 11, 0) != 0x2B7) {\n\t\t\tgf_bs_seek(bs, pos + 1);\n\t\t\tif (nb_skipped) (*nb_skipped) ++;\n\t\t\tcontinue;\n\t\t}\n\n\t\treturn GF_TRUE;\n\t}\n\treturn GF_FALSE;\n}",
  2469. "project": "gpac",
  2470. "hash": 156960673027032244624743319408540723268,
  2471. "size": 110,
  2472. "commit_id": "b2db2f99b4c30f96e17b9a14537c776da6cb5dca",
  2473. "message": "fixed #1728",
  2474. "target": 0,
  2475. "dataset": "other",
  2476. "idx": 271470
  2477. }
  2478. ]
  2479. },
  2480. {
  2481. "call_depth": 3,
  2482. "longest_call_chain": [
  2483. "mariadb_get_info",
  2484. "mariadb_get_infov",
  2485. "mariadb_connection"
  2486. ],
  2487. "group_size": 9,
  2488. "functions": [
  2489. {
  2490. "func": "my_bool STDCALL mariadb_get_info(MYSQL *mysql, enum mariadb_value value, void *arg)\n{\n return mariadb_get_infov(mysql, value, arg);\n}",
  2491. "project": "mariadb-connector-c",
  2492. "hash": 260222517558586894785283733852562791600,
  2493. "size": 4,
  2494. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2495. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2496. "target": 0,
  2497. "dataset": "other",
  2498. "idx": 429729
  2499. },
  2500. {
  2501. "func": "mysql_get_socket(MYSQL *mysql)\n{\n return mariadb_get_socket(mysql);\n}",
  2502. "project": "mariadb-connector-c",
  2503. "hash": 72239553276577952597504120876756915746,
  2504. "size": 4,
  2505. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2506. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2507. "target": 0,
  2508. "dataset": "other",
  2509. "idx": 429694
  2510. },
  2511. {
  2512. "func": "static my_socket mariadb_get_socket(MYSQL *mysql)\n{\n my_socket sock= INVALID_SOCKET;\n if (mysql->net.pvio)\n {\n ma_pvio_get_handle(mysql->net.pvio, &sock);\n\n }\n /* if an asynchronous connect is in progress, we need to obtain\n pvio handle from async_context until the connection was\n successfully established.\n */\n else if (mysql->options.extension && mysql->options.extension->async_context &&\n mysql->options.extension->async_context->pvio)\n {\n ma_pvio_get_handle(mysql->options.extension->async_context->pvio, &sock);\n }\n return sock;\n}",
  2513. "project": "mariadb-connector-c",
  2514. "hash": 315036384148822492369287916293424404609,
  2515. "size": 19,
  2516. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2517. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2518. "target": 0,
  2519. "dataset": "other",
  2520. "idx": 429745
  2521. },
  2522. {
  2523. "func": "my_bool STDCALL mariadb_connection(MYSQL *mysql)\n{\n return (strstr(mysql->server_version, \"MariaDB\") ||\n strstr(mysql->server_version, \"-maria-\"));\n}",
  2524. "project": "mariadb-connector-c",
  2525. "hash": 115443252438559440682462900203206671459,
  2526. "size": 5,
  2527. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2528. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2529. "target": 0,
  2530. "dataset": "other",
  2531. "idx": 429713
  2532. },
  2533. {
  2534. "func": "my_bool mariadb_get_infov(MYSQL *mysql, enum mariadb_value value, void *arg, ...)\n{\n va_list ap;\n\n va_start(ap, arg);\n\n switch(value) {\n case MARIADB_MAX_ALLOWED_PACKET:\n *((size_t *)arg)= (size_t)max_allowed_packet;\n break;\n case MARIADB_NET_BUFFER_LENGTH:\n *((size_t *)arg)= (size_t)net_buffer_length;\n break;\n case MARIADB_CONNECTION_ERROR_ID:\n if (!mysql)\n goto error;\n *((unsigned int *)arg)= mysql->net.last_errno;\n break;\n case MARIADB_CONNECTION_ERROR:\n if (!mysql)\n goto error;\n *((char **)arg)= mysql->net.last_error;\n break;\n case MARIADB_CONNECTION_SQLSTATE:\n if (!mysql)\n goto error;\n *((char **)arg)= mysql->net.sqlstate;\n break;\n case MARIADB_CONNECTION_TLS_VERSION:\n #ifdef HAVE_TLS\n if (mysql && mysql->net.pvio && mysql->net.pvio->ctls)\n *((char **)arg)= (char *)ma_pvio_tls_get_protocol_version(mysql->net.pvio->ctls);\n else\n #endif\n goto error;\n break;\n case MARIADB_CONNECTION_TLS_VERSION_ID:\n #ifdef HAVE_TLS\n if (mysql && mysql->net.pvio && mysql->net.pvio->ctls)\n *((unsigned int *)arg)= ma_pvio_tls_get_protocol_version_id(mysql->net.pvio->ctls);\n else\n #endif\n goto error;\n break;\n case MARIADB_TLS_LIBRARY:\n#ifdef HAVE_TLS\n *((const char **)arg)= tls_library_version;\n#else\n *((const char **)arg)= \"Off\";\n#endif\n break;\n case MARIADB_CLIENT_VERSION:\n *((const char **)arg)= MARIADB_CLIENT_VERSION_STR;\n break;\n case MARIADB_CLIENT_VERSION_ID:\n *((size_t *)arg)= MARIADB_VERSION_ID;\n break;\n case MARIADB_CONNECTION_SERVER_VERSION:\n if (mysql)\n *((char **)arg)= mysql->server_version;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_SERVER_TYPE:\n if (mysql)\n *((const char **)arg)= mariadb_connection(mysql) ? \"MariaDB\" : \"MySQL\";\n else\n goto error;\n break;\n case MARIADB_CONNECTION_SERVER_VERSION_ID:\n if (mysql)\n *((size_t *)arg)= mariadb_server_version_id(mysql);\n else\n goto error;\n break;\n case MARIADB_CONNECTION_PROTOCOL_VERSION_ID:\n if (mysql)\n *((unsigned int *)arg)= mysql->protocol_version;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_MARIADB_CHARSET_INFO:\n if (mysql)\n mariadb_get_charset_info(mysql, (MY_CHARSET_INFO *)arg);\n else\n goto error;\n break;\n case MARIADB_CONNECTION_SOCKET:\n if (mysql)\n *((my_socket *)arg)= mariadb_get_socket(mysql);\n else\n goto error;\n break;\n case MARIADB_CONNECTION_TYPE:\n if (mysql && mysql->net.pvio)\n *((int *)arg)= (int)mysql->net.pvio->type;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_ASYNC_TIMEOUT_MS:\n if (mysql && mysql->options.extension && mysql->options.extension->async_context)\n *((unsigned int *)arg)= mysql->options.extension->async_context->timeout_value;\n break;\n case MARIADB_CONNECTION_ASYNC_TIMEOUT:\n if (mysql && mysql->options.extension && mysql->options.extension->async_context)\n {\n unsigned int timeout= mysql->options.extension->async_context->timeout_value;\n if (timeout > UINT_MAX - 999)\n *((unsigned int *)arg)= (timeout - 1)/1000 + 1;\n else\n *((unsigned int *)arg)= (timeout+999)/1000;\n }\n break;\n case MARIADB_CHARSET_NAME:\n {\n char *name;\n name= va_arg(ap, char *);\n if (name)\n *((MARIADB_CHARSET_INFO **)arg)= (MARIADB_CHARSET_INFO *)mysql_find_charset_name(name);\n else\n goto error;\n }\n break;\n case MARIADB_CHARSET_ID:\n {\n unsigned int nr;\n nr= va_arg(ap, unsigned int);\n *((MARIADB_CHARSET_INFO **)arg)= (MARIADB_CHARSET_INFO *)mysql_find_charset_nr(nr);\n }\n break;\n case MARIADB_CONNECTION_SSL_CIPHER:\n #ifdef HAVE_TLS\n if (mysql && mysql->net.pvio && mysql->net.pvio->ctls)\n *((char **)arg)= (char *)ma_pvio_tls_cipher(mysql->net.pvio->ctls);\n else\n #endif\n goto error;\n break;\n case MARIADB_CLIENT_ERRORS:\n *((char ***)arg)= (char **)client_errors;\n break;\n case MARIADB_CONNECTION_INFO:\n if (mysql)\n *((char **)arg)= (char *)mysql->info;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_PVIO_TYPE:\n if (mysql && mysql->net.pvio)\n *((unsigned int *)arg)= (unsigned int)mysql->net.pvio->type;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_SCHEMA:\n if (mysql)\n *((char **)arg)= mysql->db;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_USER:\n if (mysql)\n *((char **)arg)= mysql->user;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_PORT:\n if (mysql)\n *((unsigned int *)arg)= mysql->port;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_UNIX_SOCKET:\n if (mysql)\n *((char **)arg)= mysql->unix_socket;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_HOST:\n if (mysql)\n *((char **)arg)= mysql->host;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_SERVER_STATUS:\n if (mysql)\n *((unsigned int *)arg)= mysql->server_status;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_SERVER_CAPABILITIES:\n if (mysql)\n *((unsigned long *)arg)= mysql->server_capabilities;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_EXTENDED_SERVER_CAPABILITIES:\n if (mysql)\n *((unsigned long *)arg)= mysql->extension->mariadb_server_capabilities;\n else\n goto error;\n break;\n case MARIADB_CONNECTION_CLIENT_CAPABILITIES:\n if (mysql)\n *((unsigned long *)arg)= mysql->client_flag;\n else\n goto error;\n break;\n default:\n va_end(ap);\n return(-1);\n }\n va_end(ap);\n return(0);\nerror:\n va_end(ap);\n return(-1);\n}",
  2535. "project": "mariadb-connector-c",
  2536. "hash": 169671727087038349126198218159280624326,
  2537. "size": 217,
  2538. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2539. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2540. "target": 0,
  2541. "dataset": "other",
  2542. "idx": 429678
  2543. },
  2544. {
  2545. "func": "void STDCALL mysql_get_character_set_info(MYSQL *mysql, MY_CHARSET_INFO *cs)\n{\n mariadb_get_charset_info(mysql, cs);\n}",
  2546. "project": "mariadb-connector-c",
  2547. "hash": 217164025069153547830281264000695896647,
  2548. "size": 4,
  2549. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2550. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2551. "target": 0,
  2552. "dataset": "other",
  2553. "idx": 429705
  2554. },
  2555. {
  2556. "func": "unsigned long STDCALL mysql_get_server_version(MYSQL *mysql)\n{\n return (unsigned long)mariadb_server_version_id(mysql);\n}",
  2557. "project": "mariadb-connector-c",
  2558. "hash": 122711105199939788046945873828848009668,
  2559. "size": 4,
  2560. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2561. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2562. "target": 0,
  2563. "dataset": "other",
  2564. "idx": 429708
  2565. },
  2566. {
  2567. "func": "static void mariadb_get_charset_info(MYSQL *mysql, MY_CHARSET_INFO *cs)\n{\n if (!cs)\n return;\n\n cs->number= mysql->charset->nr;\n cs->csname= mysql->charset->csname;\n cs->name= mysql->charset->name;\n cs->state= 0;\n cs->comment= NULL;\n cs->dir= NULL;\n cs->mbminlen= mysql->charset->char_minlen;\n cs->mbmaxlen= mysql->charset->char_maxlen;\n\n return;\n}",
  2568. "project": "mariadb-connector-c",
  2569. "hash": 234853578981854839530463108815494608239,
  2570. "size": 16,
  2571. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2572. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2573. "target": 0,
  2574. "dataset": "other",
  2575. "idx": 429695
  2576. },
  2577. {
  2578. "func": "static size_t mariadb_server_version_id(MYSQL *mysql)\n{\n size_t major, minor, patch;\n char *p;\n\n if (!(p = mysql->server_version)) {\n return 0;\n }\n\n major = strtol(p, &p, 10);\n p += 1; /* consume the dot */\n minor = strtol(p, &p, 10);\n p += 1; /* consume the dot */\n patch = strtol(p, &p, 10);\n\n return (major * 10000L + (unsigned long)(minor * 100L + patch));\n}",
  2579. "project": "mariadb-connector-c",
  2580. "hash": 313301315730600233929478529358826963028,
  2581. "size": 17,
  2582. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  2583. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  2584. "target": 0,
  2585. "dataset": "other",
  2586. "idx": 429739
  2587. }
  2588. ]
  2589. },
  2590. {
  2591. "call_depth": 4,
  2592. "longest_call_chain": [
  2593. "process_update",
  2594. "verify_signature",
  2595. "get_esl_cert",
  2596. "get_esl_signature_list"
  2597. ],
  2598. "group_size": 15,
  2599. "functions": [
  2600. {
  2601. "project": "skiboot",
  2602. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2603. "target": 0,
  2604. "func": "int check_timestamp(const char *key, const struct efi_time *timestamp,\n\t\t char *last_timestamp)\n{\n\tstruct efi_time *prev;\n\tuint64_t new;\n\tuint64_t last;\n\n\tprev = get_last_timestamp(key, last_timestamp);\n\tif (prev == NULL)\n\t\treturn OPAL_INTERNAL_ERROR;\n\n\tprlog(PR_DEBUG, \"timestamp year is %d month %d day %d\\n\",\n\t\t\tle16_to_cpu(timestamp->year), timestamp->month,\n\t\t\ttimestamp->day);\n\tprlog(PR_DEBUG, \"prev year is %d month %d day %d\\n\",\n\t\t\tle16_to_cpu(prev->year), prev->month, prev->day);\n\n\tnew = unpack_timestamp(timestamp);\n\tlast = unpack_timestamp(prev);\n\n\tif (new > last)\n\t\treturn OPAL_SUCCESS;\n\n\treturn OPAL_PERMISSION;\n}",
  2605. "idx": 521655,
  2606. "cwe": "CWE-681",
  2607. "hash": 71734921946669776012689805880040557221,
  2608. "dataset": "other"
  2609. },
  2610. {
  2611. "project": "skiboot",
  2612. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2613. "target": 0,
  2614. "func": "static int verify_signature(const struct efi_variable_authentication_2 *auth,\n\t\t\t const char *newcert, const size_t new_data_size,\n\t\t\t const struct secvar *avar)\n{\n\tmbedtls_pkcs7 *pkcs7 = NULL;\n\tmbedtls_x509_crt x509;\n\tchar *signing_cert = NULL;\n\tchar *x509_buf = NULL;\n\tint signing_cert_size;\n\tint rc = 0;\n\tchar *errbuf;\n\tint eslvarsize;\n\tint eslsize;\n\tint offset = 0;\n\n\tif (!auth)\n\t\treturn OPAL_PARAMETER;\n\n\t/* Extract the pkcs7 from the auth structure */\n\tpkcs7 = get_pkcs7(auth);\n\t/* Failure to parse pkcs7 implies bad input. */\n\tif (!pkcs7)\n\t\treturn OPAL_PARAMETER;\n\n\tprlog(PR_INFO, \"Load the signing certificate from the keystore\");\n\n\teslvarsize = avar->data_size;\n\n\t/* Variable is not empty */\n\twhile (eslvarsize > 0) {\n\t\tprlog(PR_DEBUG, \"esl var size size is %d offset is %d\\n\", eslvarsize, offset);\n\t\tif (eslvarsize < sizeof(EFI_SIGNATURE_LIST))\n\t\t\tbreak;\n\n\t\t/* Calculate the size of the ESL */\n\t\teslsize = get_esl_signature_list_size(avar->data + offset,\n\t\t\t\t\t\t eslvarsize);\n\t\t/* If could not extract the size */\n\t\tif (eslsize <= 0) {\n\t\t\trc = OPAL_PARAMETER;\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Extract the certificate from the ESL */\n\t\tsigning_cert_size = get_esl_cert(avar->data + offset,\n\t\t\t\t\t\t eslvarsize, &signing_cert);\n\t\tif (signing_cert_size < 0) {\n\t\t\trc = signing_cert_size;\n\t\t\tbreak;\n\t\t}\n\n\t\tmbedtls_x509_crt_init(&x509);\n\t\trc = mbedtls_x509_crt_parse(&x509,\n\t\t\t\t\t signing_cert,\n\t\t\t\t\t signing_cert_size);\n\n\t\t/* This should not happen, unless something corrupted in PNOR */\n\t\tif(rc) {\n\t\t\tprlog(PR_ERR, \"X509 certificate parsing failed %04x\\n\", rc);\n\t\t\trc = OPAL_INTERNAL_ERROR;\n\t\t\tbreak;\n\t\t}\n\n\t\tx509_buf = zalloc(CERT_BUFFER_SIZE);\n\t\trc = mbedtls_x509_crt_info(x509_buf,\n\t\t\t\t\t CERT_BUFFER_SIZE,\n\t\t\t\t\t \"CRT:\",\n\t\t\t\t\t &x509);\n\n\t\t/* This should not happen, unless something corrupted in PNOR */\n\t\tif (rc < 0) {\n\t\t\tfree(x509_buf);\n\t\t\trc = OPAL_INTERNAL_ERROR;\n\t\t\tbreak;\n\t\t}\n\n\t\tprlog(PR_INFO, \"%s \\n\", x509_buf);\n\t\tfree(x509_buf);\n\t\tx509_buf = NULL;\n\n\t\trc = mbedtls_pkcs7_signed_hash_verify(pkcs7, &x509, newcert, new_data_size);\n\n\t\t/* If you find a signing certificate, you are done */\n\t\tif (rc == 0) {\n\t\t\tprlog(PR_INFO, \"Signature Verification passed\\n\");\n\t\t\tmbedtls_x509_crt_free(&x509);\n\t\t\tbreak;\n\t\t} else {\n\t\t\terrbuf = zalloc(MBEDTLS_ERR_BUFFER_SIZE);\n\t\t\tmbedtls_strerror(rc, errbuf, MBEDTLS_ERR_BUFFER_SIZE);\n\t\t\tprlog(PR_ERR, \"Signature Verification failed %02x %s\\n\",\n\t\t\t\t\trc, errbuf);\n\t\t\tfree(errbuf);\n\t\t\trc = OPAL_PERMISSION;\n\t\t}\n\n\n\t\t/* Look for the next ESL */\n\t\toffset = offset + eslsize;\n\t\teslvarsize = eslvarsize - eslsize;\n\t\tmbedtls_x509_crt_free(&x509);\n\t\tfree(signing_cert);\n\t\t/* Since we are going to allocate again in the next iteration */\n\t\tsigning_cert = NULL;\n\n\t}\n\n\tfree(signing_cert);\n\tmbedtls_pkcs7_free(pkcs7);\n\tfree(pkcs7);\n\n\treturn rc;\n}",
  2615. "idx": 521654,
  2616. "cwe": "CWE-681",
  2617. "hash": 169175420840573290317758226120475277153,
  2618. "dataset": "other"
  2619. },
  2620. {
  2621. "project": "skiboot",
  2622. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2623. "target": 0,
  2624. "func": "int process_update(const struct secvar *update, char **newesl,\n\t\t int *new_data_size, struct efi_time *timestamp,\n\t\t struct list_head *bank, char *last_timestamp)\n{\n\tstruct efi_variable_authentication_2 *auth = NULL;\n\tvoid *auth_buffer = NULL;\n\tint auth_buffer_size = 0;\n\tconst char *key_authority[3];\n\tchar *tbhbuffer = NULL;\n\tsize_t tbhbuffersize = 0;\n\tstruct secvar *avar = NULL;\n\tint rc = 0;\n\tint i;\n\n\t/* We need to split data into authentication descriptor and new ESL */\n\tauth_buffer_size = get_auth_descriptor2(update->data,\n\t\t\t\t\t\tupdate->data_size,\n\t\t\t\t\t\t&auth_buffer);\n\tif ((auth_buffer_size < 0)\n\t || (update->data_size < auth_buffer_size)) {\n\t\tprlog(PR_ERR, \"Invalid auth buffer size\\n\");\n\t\trc = auth_buffer_size;\n\t\tgoto out;\n\t}\n\n\tauth = auth_buffer;\n\n\tif (!timestamp) {\n\t\trc = OPAL_INTERNAL_ERROR;\n\t\tgoto out;\n\t}\n\n\tmemcpy(timestamp, auth_buffer, sizeof(struct efi_time));\n\n\trc = check_timestamp(update->key, timestamp, last_timestamp);\n\t/* Failure implies probably an older command being resubmitted */\n\tif (rc != OPAL_SUCCESS) {\n\t\tprlog(PR_ERR, \"Timestamp verification failed for key %s\\n\", update->key);\n\t\tgoto out;\n\t}\n\n\t/* Calculate the size of new ESL data */\n\t*new_data_size = update->data_size - auth_buffer_size;\n\tif (*new_data_size < 0) {\n\t\tprlog(PR_ERR, \"Invalid new ESL (new data content) size\\n\");\n\t\trc = OPAL_PARAMETER;\n\t\tgoto out;\n\t}\n\t*newesl = zalloc(*new_data_size);\n\tif (!(*newesl)) {\n\t\trc = OPAL_NO_MEM;\n\t\tgoto out;\n\t}\n\tmemcpy(*newesl, update->data + auth_buffer_size, *new_data_size);\n\n\t/* Validate the new ESL is in right format */\n\trc = validate_esl_list(update->key, *newesl, *new_data_size);\n\tif (rc < 0) {\n\t\tprlog(PR_ERR, \"ESL validation failed for key %s with error %04x\\n\",\n\t\t update->key, rc);\n\t\tgoto out;\n\t}\n\n\tif (setup_mode) {\n\t\trc = OPAL_SUCCESS;\n\t\tgoto out;\n\t}\n\n\t/* Prepare the data to be verified */\n\ttbhbuffer = get_hash_to_verify(update->key, *newesl, *new_data_size,\n\t\t\t\ttimestamp);\n\tif (!tbhbuffer) {\n\t\trc = OPAL_INTERNAL_ERROR;\n\t\tgoto out;\n\t}\n\n\t/* Get the authority to verify the signature */\n\tget_key_authority(key_authority, update->key);\n\n\t/*\n\t * Try for all the authorities that are allowed to sign.\n\t * For eg. db/dbx can be signed by both PK or KEK\n\t */\n\tfor (i = 0; key_authority[i] != NULL; i++) {\n\t\tprlog(PR_DEBUG, \"key is %s\\n\", update->key);\n\t\tprlog(PR_DEBUG, \"key authority is %s\\n\", key_authority[i]);\n\t\tavar = find_secvar(key_authority[i],\n\t\t\t\t strlen(key_authority[i]) + 1,\n\t\t\t\t bank);\n\t\tif (!avar || !avar->data_size)\n\t\t\tcontinue;\n\n\t\t/* Verify the signature */\n\t\trc = verify_signature(auth, tbhbuffer, tbhbuffersize,\n\t\t\t\t avar);\n\n\t\t/* Break if signature verification is successful */\n\t\tif (rc == OPAL_SUCCESS) {\n\t\t\tprlog(PR_INFO, \"Key %s successfully verified by authority %s\\n\", update->key, key_authority[i]);\n\t\t\tbreak;\n\t\t}\n\t}\n\nout:\n\tfree(auth_buffer);\n\tfree(tbhbuffer);\n\n\treturn rc;\n}",
  2625. "idx": 521660,
  2626. "cwe": "CWE-681",
  2627. "hash": 178401092850407839532373766829369702237,
  2628. "dataset": "other"
  2629. },
  2630. {
  2631. "project": "skiboot",
  2632. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2633. "target": 1,
  2634. "func": "static uint64_t unpack_timestamp(const struct efi_time *timestamp)\n{\n\tuint64_t val = 0;\n\tuint16_t year = le32_to_cpu(timestamp->year);\n\n\t/* pad1, nanosecond, timezone, daylight and pad2 are meant to be zero */\n\tval |= ((uint64_t) timestamp->pad1 & 0xFF) << 0;\n\tval |= ((uint64_t) timestamp->second & 0xFF) << (1*8);\n\tval |= ((uint64_t) timestamp->minute & 0xFF) << (2*8);\n\tval |= ((uint64_t) timestamp->hour & 0xFF) << (3*8);\n\tval |= ((uint64_t) timestamp->day & 0xFF) << (4*8);\n\tval |= ((uint64_t) timestamp->month & 0xFF) << (5*8);\n\tval |= ((uint64_t) year) << (6*8);\n\n\treturn val;\n}",
  2635. "idx": 217514,
  2636. "cwe": "CWE-681",
  2637. "hash": 261903108962534180969470598132431142070,
  2638. "dataset": "other"
  2639. },
  2640. {
  2641. "project": "skiboot",
  2642. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2643. "target": 0,
  2644. "func": "static uint64_t unpack_timestamp(const struct efi_time *timestamp)\n{\n\tuint64_t val = 0;\n\tuint16_t year = le16_to_cpu(timestamp->year);\n\n\t/* pad1, nanosecond, timezone, daylight and pad2 are meant to be zero */\n\tval |= ((uint64_t) timestamp->pad1 & 0xFF) << 0;\n\tval |= ((uint64_t) timestamp->second & 0xFF) << (1*8);\n\tval |= ((uint64_t) timestamp->minute & 0xFF) << (2*8);\n\tval |= ((uint64_t) timestamp->hour & 0xFF) << (3*8);\n\tval |= ((uint64_t) timestamp->day & 0xFF) << (4*8);\n\tval |= ((uint64_t) timestamp->month & 0xFF) << (5*8);\n\tval |= ((uint64_t) year) << (6*8);\n\n\treturn val;\n}",
  2645. "idx": 521649,
  2646. "cwe": "CWE-681",
  2647. "hash": 337463125729458282018478225518421551092,
  2648. "dataset": "other"
  2649. },
  2650. {
  2651. "project": "skiboot",
  2652. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2653. "target": 0,
  2654. "func": "static size_t get_pkcs7_len(const struct efi_variable_authentication_2 *auth)\n{\n\tuint32_t dw_length;\n\tsize_t size;\n\n\tassert(auth != NULL);\n\n\tdw_length = le32_to_cpu(auth->auth_info.hdr.dw_length);\n\tsize = dw_length - (sizeof(auth->auth_info.hdr.dw_length)\n\t\t\t+ sizeof(auth->auth_info.hdr.w_revision)\n\t\t\t+ sizeof(auth->auth_info.hdr.w_certificate_type)\n\t\t\t+ sizeof(auth->auth_info.cert_type));\n\n\treturn size;\n}",
  2655. "idx": 521659,
  2656. "cwe": "CWE-681",
  2657. "hash": 250773754624625586965202166265104085065,
  2658. "dataset": "other"
  2659. },
  2660. {
  2661. "project": "skiboot",
  2662. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2663. "target": 0,
  2664. "func": "int get_auth_descriptor2(const void *buf, const size_t buflen, void **auth_buffer)\n{\n\tconst struct efi_variable_authentication_2 *auth = buf;\n\tint auth_buffer_size;\n\tsize_t len;\n\n\tassert(auth_buffer != NULL);\n\tif (buflen < sizeof(struct efi_variable_authentication_2)\n\t || !buf)\n\t\t\treturn OPAL_PARAMETER;\n\n\tlen = get_pkcs7_len(auth);\n\t/* pkcs7 content length cannot be greater than buflen */ \n\tif (len > buflen)\n\t\treturn OPAL_PARAMETER;\n\n\tauth_buffer_size = sizeof(auth->timestamp) + sizeof(auth->auth_info.hdr)\n\t\t\t + sizeof(auth->auth_info.cert_type) + len;\n\n\t*auth_buffer = zalloc(auth_buffer_size);\n\tif (!(*auth_buffer))\n\t\treturn OPAL_NO_MEM;\n\n\t/*\n\t * Data = auth descriptor + new ESL data.\n\t * Extracts only the auth descriptor from data.\n\t */\n\tmemcpy(*auth_buffer, buf, auth_buffer_size);\n\n\treturn auth_buffer_size;\n}",
  2665. "idx": 521656,
  2666. "cwe": "CWE-681",
  2667. "hash": 305644016089787436408464435206138914640,
  2668. "dataset": "other"
  2669. },
  2670. {
  2671. "project": "skiboot",
  2672. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2673. "target": 0,
  2674. "func": "static bool validate_hash(uuid_t type, int size)\n{\n if (uuid_equals(&type, &EFI_CERT_SHA1_GUID) && (size == 20))\n return true;\n\n if (uuid_equals(&type, &EFI_CERT_SHA224_GUID) && (size == 28))\n return true;\n\n if (uuid_equals(&type, &EFI_CERT_SHA256_GUID) && (size == 32))\n return true;\n\n if (uuid_equals(&type, &EFI_CERT_SHA384_GUID) && (size == 48))\n return true;\n\n if (uuid_equals(&type, &EFI_CERT_SHA512_GUID) && (size == 64))\n return true;\n\n return false;\n}",
  2675. "idx": 521657,
  2676. "cwe": "CWE-681",
  2677. "hash": 178128338452607838604171323429136382734,
  2678. "dataset": "other"
  2679. },
  2680. {
  2681. "project": "skiboot",
  2682. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2683. "target": 0,
  2684. "func": "static mbedtls_pkcs7* get_pkcs7(const struct efi_variable_authentication_2 *auth)\n{\n\tchar *checkpkcs7cert = NULL;\n\tsize_t len;\n\tmbedtls_pkcs7 *pkcs7 = NULL;\n\tint rc;\n\n\tlen = get_pkcs7_len(auth);\n\n\tpkcs7 = malloc(sizeof(struct mbedtls_pkcs7));\n\tif (!pkcs7)\n\t\treturn NULL;\n\n\tmbedtls_pkcs7_init(pkcs7);\n\trc = mbedtls_pkcs7_parse_der( auth->auth_info.cert_data, len, pkcs7);\n\tif (rc <= 0) {\n\t\tprlog(PR_ERR, \"Parsing pkcs7 failed %04x\\n\", rc);\n\t\tgoto out;\n\t}\n\n\tcheckpkcs7cert = zalloc(CERT_BUFFER_SIZE);\n\tif (!checkpkcs7cert)\n\t\tgoto out;\n\n\trc = mbedtls_x509_crt_info(checkpkcs7cert, CERT_BUFFER_SIZE, \"CRT:\",\n\t\t\t\t &(pkcs7->signed_data.certs));\n\tif (rc < 0) {\n\t\tprlog(PR_ERR, \"Failed to parse the certificate in PKCS7 structure\\n\");\n\t\tfree(checkpkcs7cert);\n\t\tgoto out;\n\t}\n\n\tprlog(PR_DEBUG, \"%s \\n\", checkpkcs7cert);\n\tfree(checkpkcs7cert);\n\treturn pkcs7;\n\nout:\n\tmbedtls_pkcs7_free(pkcs7);\n\tpkcs7 = NULL;\n\treturn pkcs7;\n}",
  2685. "idx": 521644,
  2686. "cwe": "CWE-681",
  2687. "hash": 285422590631529911090789466166025019210,
  2688. "dataset": "other"
  2689. },
  2690. {
  2691. "project": "skiboot",
  2692. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2693. "target": 0,
  2694. "func": "static void get_key_authority(const char *ret[3], const char *key)\n{\n\tint i = 0;\n\n\tif (key_equals(key, \"PK\")) {\n\t\tret[i++] = \"PK\";\n\t} else if (key_equals(key, \"KEK\")) {\n\t\tret[i++] = \"PK\";\n\t} else if (key_equals(key, \"db\") || key_equals(key, \"dbx\")) {\n\t\tret[i++] = \"KEK\";\n\t\tret[i++] = \"PK\";\n\t}\n\n\tret[i] = NULL;\n}",
  2695. "idx": 521642,
  2696. "cwe": "CWE-681",
  2697. "hash": 297738273191075284106162991641740642673,
  2698. "dataset": "other"
  2699. },
  2700. {
  2701. "project": "skiboot",
  2702. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2703. "target": 0,
  2704. "func": "static int32_t get_esl_signature_list_size(const char *buf, const size_t buflen)\n{\n\tEFI_SIGNATURE_LIST *list = get_esl_signature_list(buf, buflen);\n\n\tif (!list)\n\t\treturn OPAL_PARAMETER;\n\n\treturn le32_to_cpu(list->SignatureListSize);\n}",
  2705. "idx": 521643,
  2706. "cwe": "CWE-681",
  2707. "hash": 78060638800999667578112940727001384482,
  2708. "dataset": "other"
  2709. },
  2710. {
  2711. "project": "skiboot",
  2712. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2713. "target": 0,
  2714. "func": "static EFI_SIGNATURE_LIST* get_esl_signature_list(const char *buf, size_t buflen)\n{\n\tEFI_SIGNATURE_LIST *list = NULL;\n\n\tif (buflen < sizeof(EFI_SIGNATURE_LIST) || !buf)\n\t\treturn NULL;\n\n\tlist = (EFI_SIGNATURE_LIST *)buf;\n\n\treturn list;\n}",
  2715. "idx": 521652,
  2716. "cwe": "CWE-681",
  2717. "hash": 120387305635648549803864652788577802214,
  2718. "dataset": "other"
  2719. },
  2720. {
  2721. "project": "skiboot",
  2722. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2723. "target": 0,
  2724. "func": "static int get_esl_cert(const char *buf, const size_t buflen, char **cert)\n{\n\tsize_t sig_data_offset;\n\tsize_t size;\n\tEFI_SIGNATURE_LIST *list = get_esl_signature_list(buf, buflen);\n\n\tif (!list)\n\t\treturn OPAL_PARAMETER;\n\n\tassert(cert != NULL);\n\n\tsize = le32_to_cpu(list->SignatureSize) - sizeof(uuid_t);\n\n\tprlog(PR_DEBUG,\"size of signature list size is %u\\n\",\n\t\t\tle32_to_cpu(list->SignatureListSize));\n\tprlog(PR_DEBUG, \"size of signature header size is %u\\n\",\n\t\t\tle32_to_cpu(list->SignatureHeaderSize));\n\tprlog(PR_DEBUG, \"size of signature size is %u\\n\",\n\t\t\tle32_to_cpu(list->SignatureSize));\n\n\tsig_data_offset = sizeof(EFI_SIGNATURE_LIST)\n\t\t\t + le32_to_cpu(list->SignatureHeaderSize)\n\t\t\t + 16 * sizeof(uint8_t);\n\tif (sig_data_offset > buflen)\n\t\treturn OPAL_PARAMETER;\n\n\t*cert = zalloc(size);\n\tif (!(*cert))\n\t\treturn OPAL_NO_MEM;\n\n\t/* Since buf can have more than one ESL, copy only the size calculated\n\t * to return single ESL */\n\tmemcpy(*cert, buf + sig_data_offset, size);\n\n\treturn size;\n}",
  2725. "idx": 521650,
  2726. "cwe": "CWE-681",
  2727. "hash": 76056064316561882808219871420473489575,
  2728. "dataset": "other"
  2729. },
  2730. {
  2731. "project": "skiboot",
  2732. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2733. "target": 0,
  2734. "func": "static bool validate_cert(char *signing_cert, int signing_cert_size)\n{\n\tmbedtls_x509_crt x509;\n\tchar *x509_buf = NULL;\n\tint rc;\n\n\tmbedtls_x509_crt_init(&x509);\n\trc = mbedtls_x509_crt_parse(&x509, signing_cert, signing_cert_size);\n\n\t/* If failure in parsing the certificate, exit */\n\tif(rc) {\n\t\tprlog(PR_ERR, \"X509 certificate parsing failed %04x\\n\", rc);\n\t\treturn false;\n\t}\n\n\tx509_buf = zalloc(CERT_BUFFER_SIZE);\n\trc = mbedtls_x509_crt_info(x509_buf, CERT_BUFFER_SIZE, \"CRT:\", &x509);\n\n\tmbedtls_x509_crt_free(&x509);\n\tfree(x509_buf);\n\tx509_buf = NULL;\n\n\t/* If failure in reading the certificate, exit */\n\tif (rc < 0)\n\t\treturn false;\n\n\treturn true;\n}",
  2735. "idx": 521646,
  2736. "cwe": "CWE-681",
  2737. "hash": 89322362298830297891556293893589653635,
  2738. "dataset": "other"
  2739. },
  2740. {
  2741. "project": "skiboot",
  2742. "commit_id": "5be38b672c1410e2f10acd3ad2eecfdc81d5daf7",
  2743. "target": 0,
  2744. "func": "int validate_esl_list(const char *key, const char *esl, const size_t size)\n{\n\tint count = 0;\n\tint dsize;\n\tchar *data = NULL;\n\tint eslvarsize = size;\n\tint eslsize;\n\tint rc = OPAL_SUCCESS;\n\tint offset = 0;\n\tEFI_SIGNATURE_LIST *list = NULL;\n\n\twhile (eslvarsize > 0) {\n\t\tprlog(PR_DEBUG, \"esl var size size is %d offset is %d\\n\", eslvarsize, offset);\n\t\tif (eslvarsize < sizeof(EFI_SIGNATURE_LIST))\n\t\t\tbreak;\n\n\t\t/* Check Supported ESL Type */\n\t\tlist = get_esl_signature_list(esl, eslvarsize);\n\n\t\tif (!list)\n\t\t\treturn OPAL_PARAMETER;\n\n\t\t/* Calculate the size of the ESL */\n\t\teslsize = le32_to_cpu(list->SignatureListSize);\n\n\t\t/* If could not extract the size */\n\t\tif (eslsize <= 0) {\n\t\t\tprlog(PR_ERR, \"Invalid size of the ESL: %u\\n\",\n\t\t\t\t\tle32_to_cpu(list->SignatureListSize));\n\t\t\trc = OPAL_PARAMETER;\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Extract the certificate from the ESL */\n\t\tdsize = get_esl_cert(esl, eslvarsize, &data);\n\t\tif (dsize < 0) {\n\t\t\trc = dsize;\n\t\t\tbreak;\n\t\t}\n\n\t\tif (key_equals(key, \"dbx\")) {\n\t\t\tif (!validate_hash(list->SignatureType, dsize)) {\n\t\t\t\tprlog(PR_ERR, \"No valid hash is found\\n\");\n\t\t\t\trc = OPAL_PARAMETER;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t if (!uuid_equals(&list->SignatureType, &EFI_CERT_X509_GUID)\n\t\t\t || !validate_cert(data, dsize)) {\n\t\t\t\tprlog(PR_ERR, \"No valid cert is found\\n\");\n\t\t\t\trc = OPAL_PARAMETER;\n\t\t\t\tbreak;\n\t\t }\n\t\t}\n\n\t\tcount++;\n\n\t\t/* Look for the next ESL */\n\t\toffset = offset + eslsize;\n\t\teslvarsize = eslvarsize - eslsize;\n\t\tfree(data);\n\t\t/* Since we are going to allocate again in the next iteration */\n\t\tdata = NULL;\n\t}\n\n\tif (rc == OPAL_SUCCESS) {\n\t\tif (key_equals(key, \"PK\") && (count > 1)) {\n\t\t\tprlog(PR_ERR, \"PK can only be one\\n\");\n\t\t\trc = OPAL_PARAMETER;\n\t\t} else {\n\t\t\trc = count;\n\t\t}\n\t}\n\n\tfree(data);\n\n\tprlog(PR_INFO, \"Total ESLs are %d\\n\", rc);\n\treturn rc;\n}",
  2745. "idx": 521648,
  2746. "cwe": "CWE-681",
  2747. "hash": 135687032396769714616764529094035254125,
  2748. "dataset": "other"
  2749. }
  2750. ]
  2751. },
  2752. {
  2753. "call_depth": 3,
  2754. "longest_call_chain": [
  2755. "trace_vbprintk",
  2756. "ftrace_trace_stack",
  2757. "__ftrace_trace_stack"
  2758. ],
  2759. "group_size": 15,
  2760. "functions": [
  2761. {
  2762. "func": "int __trace_bputs(unsigned long ip, const char *str)\n{\n\tstruct ring_buffer_event *event;\n\tstruct ring_buffer *buffer;\n\tstruct bputs_entry *entry;\n\tunsigned long irq_flags;\n\tint size = sizeof(struct bputs_entry);\n\tint pc;\n\n\tif (!(global_trace.trace_flags & TRACE_ITER_PRINTK))\n\t\treturn 0;\n\n\tpc = preempt_count();\n\n\tif (unlikely(tracing_selftest_running || tracing_disabled))\n\t\treturn 0;\n\n\tlocal_save_flags(irq_flags);\n\tbuffer = global_trace.trace_buffer.buffer;\n\tevent = __trace_buffer_lock_reserve(buffer, TRACE_BPUTS, size,\n\t\t\t\t\t irq_flags, pc);\n\tif (!event)\n\t\treturn 0;\n\n\tentry = ring_buffer_event_data(event);\n\tentry->ip\t\t\t= ip;\n\tentry->str\t\t\t= str;\n\n\t__buffer_unlock_commit(buffer, event);\n\tftrace_trace_stack(&global_trace, buffer, irq_flags, 4, pc, NULL);\n\n\treturn 1;\n}",
  2763. "project": "linux",
  2764. "hash": 97935509873229655098639551909617223595,
  2765. "size": 33,
  2766. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2767. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2768. "target": 0,
  2769. "dataset": "other",
  2770. "idx": 445651
  2771. },
  2772. {
  2773. "func": "void __trace_stack(struct trace_array *tr, unsigned long flags, int skip,\n\t\t int pc)\n{\n\tstruct ring_buffer *buffer = tr->trace_buffer.buffer;\n\n\tif (rcu_is_watching()) {\n\t\t__ftrace_trace_stack(buffer, flags, skip, pc, NULL);\n\t\treturn;\n\t}\n\n\t/*\n\t * When an NMI triggers, RCU is enabled via rcu_nmi_enter(),\n\t * but if the above rcu_is_watching() failed, then the NMI\n\t * triggered someplace critical, and rcu_irq_enter() should\n\t * not be called from NMI.\n\t */\n\tif (unlikely(in_nmi()))\n\t\treturn;\n\n\t/*\n\t * It is possible that a function is being traced in a\n\t * location that RCU is not watching. A call to\n\t * rcu_irq_enter() will make sure that it is, but there's\n\t * a few internal rcu functions that could be traced\n\t * where that wont work either. In those cases, we just\n\t * do nothing.\n\t */\n\tif (unlikely(rcu_irq_enter_disabled()))\n\t\treturn;\n\n\trcu_irq_enter_irqson();\n\t__ftrace_trace_stack(buffer, flags, skip, pc, NULL);\n\trcu_irq_exit_irqson();\n}",
  2774. "project": "linux",
  2775. "hash": 148688729114021066957743413682696870780,
  2776. "size": 34,
  2777. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2778. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2779. "target": 0,
  2780. "dataset": "other",
  2781. "idx": 445686
  2782. },
  2783. {
  2784. "func": "trace_buffer_lock_reserve(struct ring_buffer *buffer,\n\t\t\t int type,\n\t\t\t unsigned long len,\n\t\t\t unsigned long flags, int pc)\n{\n\treturn __trace_buffer_lock_reserve(buffer, type, len, flags, pc);\n}",
  2785. "project": "linux",
  2786. "hash": 290494509004862626438777072381730768500,
  2787. "size": 7,
  2788. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2789. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2790. "target": 0,
  2791. "dataset": "other",
  2792. "idx": 445711
  2793. },
  2794. {
  2795. "func": "void trace_dump_stack(int skip)\n{\n\tunsigned long flags;\n\n\tif (tracing_disabled || tracing_selftest_running)\n\t\treturn;\n\n\tlocal_save_flags(flags);\n\n\t/*\n\t * Skip 3 more, seems to get us at the caller of\n\t * this function.\n\t */\n\tskip += 3;\n\t__ftrace_trace_stack(global_trace.trace_buffer.buffer,\n\t\t\t flags, skip, preempt_count(), NULL);\n}",
  2796. "project": "linux",
  2797. "hash": 209716427486737830029222622578390806861,
  2798. "size": 17,
  2799. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2800. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2801. "target": 0,
  2802. "dataset": "other",
  2803. "idx": 445554
  2804. },
  2805. {
  2806. "func": "static void __ftrace_trace_stack(struct ring_buffer *buffer,\n\t\t\t\t unsigned long flags,\n\t\t\t\t int skip, int pc, struct pt_regs *regs)\n{\n\tstruct trace_event_call *call = &event_kernel_stack;\n\tstruct ring_buffer_event *event;\n\tstruct stack_entry *entry;\n\tstruct stack_trace trace;\n\tint use_stack;\n\tint size = FTRACE_STACK_ENTRIES;\n\n\ttrace.nr_entries\t= 0;\n\ttrace.skip\t\t= skip;\n\n\t/*\n\t * Add two, for this function and the call to save_stack_trace()\n\t * If regs is set, then these functions will not be in the way.\n\t */\n\tif (!regs)\n\t\ttrace.skip += 2;\n\n\t/*\n\t * Since events can happen in NMIs there's no safe way to\n\t * use the per cpu ftrace_stacks. We reserve it and if an interrupt\n\t * or NMI comes in, it will just have to use the default\n\t * FTRACE_STACK_SIZE.\n\t */\n\tpreempt_disable_notrace();\n\n\tuse_stack = __this_cpu_inc_return(ftrace_stack_reserve);\n\t/*\n\t * We don't need any atomic variables, just a barrier.\n\t * If an interrupt comes in, we don't care, because it would\n\t * have exited and put the counter back to what we want.\n\t * We just need a barrier to keep gcc from moving things\n\t * around.\n\t */\n\tbarrier();\n\tif (use_stack == 1) {\n\t\ttrace.entries\t\t= this_cpu_ptr(ftrace_stack.calls);\n\t\ttrace.max_entries\t= FTRACE_STACK_MAX_ENTRIES;\n\n\t\tif (regs)\n\t\t\tsave_stack_trace_regs(regs, &trace);\n\t\telse\n\t\t\tsave_stack_trace(&trace);\n\n\t\tif (trace.nr_entries > size)\n\t\t\tsize = trace.nr_entries;\n\t} else\n\t\t/* From now on, use_stack is a boolean */\n\t\tuse_stack = 0;\n\n\tsize *= sizeof(unsigned long);\n\n\tevent = __trace_buffer_lock_reserve(buffer, TRACE_STACK,\n\t\t\t\t\t sizeof(*entry) + size, flags, pc);\n\tif (!event)\n\t\tgoto out;\n\tentry = ring_buffer_event_data(event);\n\n\tmemset(&entry->caller, 0, size);\n\n\tif (use_stack)\n\t\tmemcpy(&entry->caller, trace.entries,\n\t\t trace.nr_entries * sizeof(unsigned long));\n\telse {\n\t\ttrace.max_entries\t= FTRACE_STACK_ENTRIES;\n\t\ttrace.entries\t\t= entry->caller;\n\t\tif (regs)\n\t\t\tsave_stack_trace_regs(regs, &trace);\n\t\telse\n\t\t\tsave_stack_trace(&trace);\n\t}\n\n\tentry->size = trace.nr_entries;\n\n\tif (!call_filter_check_discard(call, entry, buffer, event))\n\t\t__buffer_unlock_commit(buffer, event);\n\n out:\n\t/* Again, don't let gcc optimize things here */\n\tbarrier();\n\t__this_cpu_dec(ftrace_stack_reserve);\n\tpreempt_enable_notrace();\n\n}",
  2807. "project": "linux",
  2808. "hash": 228181925911186695377319876003635852001,
  2809. "size": 87,
  2810. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2811. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2812. "target": 0,
  2813. "dataset": "other",
  2814. "idx": 445528
  2815. },
  2816. {
  2817. "func": "static inline void __ftrace_trace_stack(struct ring_buffer *buffer,\n\t\t\t\t\tunsigned long flags,\n\t\t\t\t\tint skip, int pc, struct pt_regs *regs)\n{\n}",
  2818. "project": "linux",
  2819. "hash": 326356546210729082046651620939364926726,
  2820. "size": 5,
  2821. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2822. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2823. "target": 0,
  2824. "dataset": "other",
  2825. "idx": 445804
  2826. },
  2827. {
  2828. "func": "static void put_trace_buf(void)\n{\n\t/* Don't let the decrement of nesting leak before this */\n\tbarrier();\n\tthis_cpu_dec(trace_percpu_buffer->nesting);\n}",
  2829. "project": "linux",
  2830. "hash": 151274970754355397862267931791174596447,
  2831. "size": 6,
  2832. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2833. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2834. "target": 0,
  2835. "dataset": "other",
  2836. "idx": 445718
  2837. },
  2838. {
  2839. "func": "trace_event_setup(struct ring_buffer_event *event,\n\t\t int type, unsigned long flags, int pc)\n{\n\tstruct trace_entry *ent = ring_buffer_event_data(event);\n\n\ttracing_generic_entry_update(ent, flags, pc);\n\tent->type = type;\n}",
  2840. "project": "linux",
  2841. "hash": 33661644687624186718785817022496531739,
  2842. "size": 8,
  2843. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2844. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2845. "target": 0,
  2846. "dataset": "other",
  2847. "idx": 445676
  2848. },
  2849. {
  2850. "func": "void trace_buffer_unlock_commit_regs(struct trace_array *tr,\n\t\t\t\t struct ring_buffer *buffer,\n\t\t\t\t struct ring_buffer_event *event,\n\t\t\t\t unsigned long flags, int pc,\n\t\t\t\t struct pt_regs *regs)\n{\n\t__buffer_unlock_commit(buffer, event);\n\n\t/*\n\t * If regs is not set, then skip the following callers:\n\t * trace_buffer_unlock_commit_regs\n\t * event_trigger_unlock_commit\n\t * trace_event_buffer_commit\n\t * trace_event_raw_event_sched_switch\n\t * Note, we can still get here via blktrace, wakeup tracer\n\t * and mmiotrace, but that's ok if they lose a function or\n\t * two. They are that meaningful.\n\t */\n\tftrace_trace_stack(tr, buffer, flags, regs ? 0 : 4, pc, regs);\n\tftrace_trace_userstack(buffer, flags, pc);\n}",
  2851. "project": "linux",
  2852. "hash": 286052656294965236812004646636467502665,
  2853. "size": 21,
  2854. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2855. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2856. "target": 0,
  2857. "dataset": "other",
  2858. "idx": 445619
  2859. },
  2860. {
  2861. "func": "static inline void ftrace_trace_stack(struct trace_array *tr,\n\t\t\t\t struct ring_buffer *buffer,\n\t\t\t\t unsigned long flags,\n\t\t\t\t int skip, int pc, struct pt_regs *regs)\n{\n}",
  2862. "project": "linux",
  2863. "hash": 12958771922969768168390039976616805710,
  2864. "size": 6,
  2865. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2866. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2867. "target": 0,
  2868. "dataset": "other",
  2869. "idx": 445697
  2870. },
  2871. {
  2872. "func": "static inline void ftrace_trace_stack(struct trace_array *tr,\n\t\t\t\t struct ring_buffer *buffer,\n\t\t\t\t unsigned long flags,\n\t\t\t\t int skip, int pc, struct pt_regs *regs)\n{\n\tif (!(tr->trace_flags & TRACE_ITER_STACKTRACE))\n\t\treturn;\n\n\t__ftrace_trace_stack(buffer, flags, skip, pc, regs);\n}",
  2873. "project": "linux",
  2874. "hash": 122015228433718164966279605143093293709,
  2875. "size": 10,
  2876. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2877. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2878. "target": 0,
  2879. "dataset": "other",
  2880. "idx": 445815
  2881. },
  2882. {
  2883. "func": "int __trace_puts(unsigned long ip, const char *str, int size)\n{\n\tstruct ring_buffer_event *event;\n\tstruct ring_buffer *buffer;\n\tstruct print_entry *entry;\n\tunsigned long irq_flags;\n\tint alloc;\n\tint pc;\n\n\tif (!(global_trace.trace_flags & TRACE_ITER_PRINTK))\n\t\treturn 0;\n\n\tpc = preempt_count();\n\n\tif (unlikely(tracing_selftest_running || tracing_disabled))\n\t\treturn 0;\n\n\talloc = sizeof(*entry) + size + 2; /* possible \\n added */\n\n\tlocal_save_flags(irq_flags);\n\tbuffer = global_trace.trace_buffer.buffer;\n\tevent = __trace_buffer_lock_reserve(buffer, TRACE_PRINT, alloc, \n\t\t\t\t\t irq_flags, pc);\n\tif (!event)\n\t\treturn 0;\n\n\tentry = ring_buffer_event_data(event);\n\tentry->ip = ip;\n\n\tmemcpy(&entry->buf, str, size);\n\n\t/* Add a newline if necessary */\n\tif (entry->buf[size - 1] != '\\n') {\n\t\tentry->buf[size] = '\\n';\n\t\tentry->buf[size + 1] = '\\0';\n\t} else\n\t\tentry->buf[size] = '\\0';\n\n\t__buffer_unlock_commit(buffer, event);\n\tftrace_trace_stack(&global_trace, buffer, irq_flags, 4, pc, NULL);\n\n\treturn size;\n}",
  2884. "project": "linux",
  2885. "hash": 333230938796332990582828767642145709691,
  2886. "size": 43,
  2887. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2888. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2889. "target": 0,
  2890. "dataset": "other",
  2891. "idx": 445537
  2892. },
  2893. {
  2894. "func": "__trace_buffer_lock_reserve(struct ring_buffer *buffer,\n\t\t\t int type,\n\t\t\t unsigned long len,\n\t\t\t unsigned long flags, int pc)\n{\n\tstruct ring_buffer_event *event;\n\n\tevent = ring_buffer_lock_reserve(buffer, len);\n\tif (event != NULL)\n\t\ttrace_event_setup(event, type, flags, pc);\n\n\treturn event;\n}",
  2895. "project": "linux",
  2896. "hash": 277862938369440085694307103004898588643,
  2897. "size": 13,
  2898. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2899. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2900. "target": 0,
  2901. "dataset": "other",
  2902. "idx": 445828
  2903. },
  2904. {
  2905. "func": "int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)\n{\n\tstruct trace_event_call *call = &event_bprint;\n\tstruct ring_buffer_event *event;\n\tstruct ring_buffer *buffer;\n\tstruct trace_array *tr = &global_trace;\n\tstruct bprint_entry *entry;\n\tunsigned long flags;\n\tchar *tbuffer;\n\tint len = 0, size, pc;\n\n\tif (unlikely(tracing_selftest_running || tracing_disabled))\n\t\treturn 0;\n\n\t/* Don't pollute graph traces with trace_vprintk internals */\n\tpause_graph_tracing();\n\n\tpc = preempt_count();\n\tpreempt_disable_notrace();\n\n\ttbuffer = get_trace_buf();\n\tif (!tbuffer) {\n\t\tlen = 0;\n\t\tgoto out_nobuffer;\n\t}\n\n\tlen = vbin_printf((u32 *)tbuffer, TRACE_BUF_SIZE/sizeof(int), fmt, args);\n\n\tif (len > TRACE_BUF_SIZE/sizeof(int) || len < 0)\n\t\tgoto out;\n\n\tlocal_save_flags(flags);\n\tsize = sizeof(*entry) + sizeof(u32) * len;\n\tbuffer = tr->trace_buffer.buffer;\n\tevent = __trace_buffer_lock_reserve(buffer, TRACE_BPRINT, size,\n\t\t\t\t\t flags, pc);\n\tif (!event)\n\t\tgoto out;\n\tentry = ring_buffer_event_data(event);\n\tentry->ip\t\t\t= ip;\n\tentry->fmt\t\t\t= fmt;\n\n\tmemcpy(entry->buf, tbuffer, sizeof(u32) * len);\n\tif (!call_filter_check_discard(call, entry, buffer, event)) {\n\t\t__buffer_unlock_commit(buffer, event);\n\t\tftrace_trace_stack(tr, buffer, flags, 6, pc, NULL);\n\t}\n\nout:\n\tput_trace_buf();\n\nout_nobuffer:\n\tpreempt_enable_notrace();\n\tunpause_graph_tracing();\n\n\treturn len;\n}",
  2906. "project": "linux",
  2907. "hash": 253947971610352669400134070783242158477,
  2908. "size": 57,
  2909. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2910. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2911. "target": 0,
  2912. "dataset": "other",
  2913. "idx": 445733
  2914. },
  2915. {
  2916. "func": "int call_filter_check_discard(struct trace_event_call *call, void *rec,\n\t\t\t struct ring_buffer *buffer,\n\t\t\t struct ring_buffer_event *event)\n{\n\tif (unlikely(call->flags & TRACE_EVENT_FL_FILTERED) &&\n\t !filter_match_preds(call->filter, rec)) {\n\t\t__trace_event_discard_commit(buffer, event);\n\t\treturn 1;\n\t}\n\n\treturn 0;\n}",
  2917. "project": "linux",
  2918. "hash": 295670194917690430799317477652109148509,
  2919. "size": 12,
  2920. "commit_id": "4397f04575c44e1440ec2e49b6302785c95fd2f8",
  2921. "message": "tracing: Fix possible double free on failure of allocating trace buffer\n\nJing Xia and Chunyan Zhang reported that on failing to allocate part of the\ntracing buffer, memory is freed, but the pointers that point to them are not\ninitialized back to NULL, and later paths may try to free the freed memory\nagain. Jing and Chunyan fixed one of the locations that does this, but\nmissed a spot.\n\nLink: http://lkml.kernel.org/r/20171226071253.8968-1-chunyan.zhang@spreadtrum.com\n\nCc: stable@vger.kernel.org\nFixes: 737223fbca3b1 (\"tracing: Consolidate buffer allocation code\")\nReported-by: Jing Xia <jing.xia@spreadtrum.com>\nReported-by: Chunyan Zhang <chunyan.zhang@spreadtrum.com>\nSigned-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>",
  2922. "target": 0,
  2923. "dataset": "other",
  2924. "idx": 445792
  2925. }
  2926. ]
  2927. },
  2928. {
  2929. "call_depth": 3,
  2930. "longest_call_chain": [
  2931. "HrReadHeaders",
  2932. "HrParseHeaders",
  2933. "HrGetHeaderValue"
  2934. ],
  2935. "group_size": 14,
  2936. "functions": [
  2937. {
  2938. "func": "HRESULT Http::HrFinalize()\n{\n\tHRESULT hr = hrSuccess;\n\n\tHrResponseHeader(\"Content-Length\", stringify(m_strRespBody.length()));\n\n\t// force chunked http for long size response, should check version >= 1.1 to disable chunking\n\tif (m_strRespBody.size() < HTTP_CHUNK_SIZE || m_strHttpVer != \"1.1\") {\n\t\thr = HrFlushHeaders();\n\t\tif (hr != hrSuccess && hr != MAPI_E_END_OF_SESSION) {\n\t\t\tec_log_debug(\"Http::HrFinalize flush fail %d\", hr);\n\t\t\tm_ulRetCode = 0;\n\t\t\treturn hr;\n\t\t}\n\t\tif (!m_strRespBody.empty()) {\n\t\t\tm_lpChannel->HrWriteString(m_strRespBody);\n\t\t\tec_log_debug(\"Response body:\\n%s\", m_strRespBody.c_str());\n\t\t}\n\t}\n\telse\n\t{\n\t\tconst char *lpstrBody = m_strRespBody.data();\n\t\tchar lpstrLen[10];\n\t\tauto szBodyLen = m_strRespBody.size(); // length of data to be sent to the client\n\t\tsize_t szBodyWritten = 0; // length of data sent to client\n\t\tunsigned int szPart = HTTP_CHUNK_SIZE;\t\t\t\t\t\t// default length of chunk data to be written\n\n\t\tHrResponseHeader(\"Transfer-Encoding\", \"chunked\");\n\t\thr = HrFlushHeaders();\n\t\tif (hr != hrSuccess && hr != MAPI_E_END_OF_SESSION) {\n\t\t\tec_log_debug(\"Http::HrFinalize flush fail(2) %d\", hr);\n\t\t\tm_ulRetCode = 0;\n\t\t\treturn hr;\n\t\t}\n\n\t\twhile (szBodyWritten < szBodyLen)\n\t\t{\n\t\t\tif ((szBodyWritten + HTTP_CHUNK_SIZE) > szBodyLen)\n\t\t\t\tszPart = szBodyLen - szBodyWritten;\t\t\t\t// change length of data for last chunk\n\t\t\t// send hex length of data and data part\n\t\t\tsnprintf(lpstrLen, sizeof(lpstrLen), \"%X\", szPart);\n\t\t\tm_lpChannel->HrWriteLine(lpstrLen);\n\t\t\tm_lpChannel->HrWriteLine(string_view(lpstrBody, szPart));\n\t\t\tszBodyWritten += szPart;\n\t\t\tlpstrBody += szPart;\n\t\t}\n\n\t\t// end of response\n\t\tsnprintf(lpstrLen, 10, \"0\\r\\n\");\n\t\tm_lpChannel->HrWriteLine(lpstrLen);\n\t\t// just the first part of the body in the log. header shows it's chunked.\n\t\tec_log_debug(\"%s\", m_strRespBody.c_str());\n\t}\n\n\t// if http_log_enable?\n\tchar szTime[32];\n\ttime_t now = time(NULL);\n\ttm local;\n\tstd::string strAgent;\n\tlocaltime_r(&now, &local);\n\t// @todo we're in C LC_TIME locale to get the correct (month) format, but the timezone will be GMT, which is not wanted.\n\tstrftime(szTime, ARRAY_SIZE(szTime), \"%d/%b/%Y:%H:%M:%S %z\", &local);\n\tHrGetHeaderValue(\"User-Agent\", &strAgent);\n\tec_log_notice(\"%s - %s [%s] \\\"%s\\\" %d %d \\\"-\\\" \\\"%s\\\"\", m_lpChannel->peer_addr(), m_strUser.empty() ? \"-\" : m_strUser.c_str(), szTime, m_strAction.c_str(), m_ulRetCode, (int)m_strRespBody.length(), strAgent.c_str());\n\tm_ulRetCode = 0;\n\treturn hr;\n}",
  2939. "project": "kopano-core",
  2940. "hash": 259595367262276487244267405280402291162,
  2941. "size": 67,
  2942. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  2943. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  2944. "target": 0,
  2945. "dataset": "other",
  2946. "idx": 412624
  2947. },
  2948. {
  2949. "func": "HRESULT Http::HrGetDepth(ULONG *ulDepth)\n{\n\tstd::string strDepth;\n\t/*\n\t * Valid input: [0, 1, infinity]\n\t */\n\tauto hr = HrGetHeaderValue(\"Depth\", &strDepth);\n\tif (hr != hrSuccess)\n\t\t*ulDepth = 0; /* Default is no subfolders. Default should become a parameter. It is action dependent. */\n\telse if (strDepth == \"infinity\")\n\t\t*ulDepth = 2;\n\telse {\n\t\t*ulDepth = atoi(strDepth.c_str());\n\t\tif (*ulDepth > 1)\n\t\t\t*ulDepth = 1;\n\t}\n\treturn hr;\n}",
  2950. "project": "kopano-core",
  2951. "hash": 217517827692339967634595091257873772062,
  2952. "size": 18,
  2953. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  2954. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  2955. "target": 0,
  2956. "dataset": "other",
  2957. "idx": 412614
  2958. },
  2959. {
  2960. "func": "HRESULT Http::HrReadBody()\n{\n\tstd::string strLength;\n\n\t// find the Content-Length\n\tif (HrGetHeaderValue(\"Content-Length\", &strLength) != hrSuccess) {\n\t\tec_log_debug(\"Http::HrReadBody content-length missing\");\n\t\treturn MAPI_E_NOT_FOUND;\n\t}\n\tauto ulContLength = atoi(strLength.c_str());\n\tif (ulContLength <= 0) {\n\t\tec_log_debug(\"Http::HrReadBody content-length invalid %d\", ulContLength);\n\t\treturn MAPI_E_NOT_FOUND;\n\t}\n\tauto hr = m_lpChannel->HrReadBytes(&m_strReqBody, ulContLength);\n\tif (!m_strUser.empty())\n\t\tec_log_debug(\"Request body:\\n%s\", m_strReqBody.c_str());\n\treturn hr;\n}",
  2961. "project": "kopano-core",
  2962. "hash": 113696208786814068339618293734508448744,
  2963. "size": 19,
  2964. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  2965. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  2966. "target": 0,
  2967. "dataset": "other",
  2968. "idx": 412634
  2969. },
  2970. {
  2971. "func": "HRESULT Http::HrRequestAuth(const std::string &strMsg)\n{\n\tauto hr = HrResponseHeader(401, \"Unauthorized\");\n\tif (hr != hrSuccess)\n\t\treturn hr;\n\treturn HrResponseHeader(\"WWW-Authenticate\", \"Basic realm=\\\"\" + strMsg + \"\\\"\");\n}",
  2972. "project": "kopano-core",
  2973. "hash": 326592081151301752571350035393463588511,
  2974. "size": 7,
  2975. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  2976. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  2977. "target": 0,
  2978. "dataset": "other",
  2979. "idx": 412626
  2980. },
  2981. {
  2982. "func": "HRESULT Http::HrReadHeaders()\n{\n\tHRESULT hr;\n\tstd::string strBuffer;\n\tULONG n = 0;\n\tstd::map<std::string, std::string>::iterator iHeader = mapHeaders.end();\n\n\tec_log_debug(\"Receiving headers:\");\n\tdo\n\t{\n\t\thr = m_lpChannel->HrReadLine(strBuffer);\n\t\tif (hr != hrSuccess)\n\t\t\treturn hr;\n\t\tif (strBuffer.empty())\n\t\t\tbreak;\n\n\t\tif (n == 0) {\n\t\t\tm_strAction = strBuffer;\n\t\t} else {\n\t\t\tauto pos = strBuffer.find(':');\n\t\t\tsize_t start = 0;\n\n\t\t\tif (strBuffer[0] == ' ' || strBuffer[0] == '\\t') {\n\t\t\t\tif (iHeader == mapHeaders.end())\n\t\t\t\t\tcontinue;\n\t\t\t\t// continue header\n\t\t\t\twhile (strBuffer[start] == ' ' || strBuffer[start] == '\\t')\n\t\t\t\t\t++start;\n\t\t\t\tiHeader->second += strBuffer.substr(start);\n\t\t\t} else {\n\t\t\t\t// new header\n\t\t\t\tauto r = mapHeaders.emplace(strBuffer.substr(0, pos), strBuffer.substr(pos + 2));\n\t\t\t\tiHeader = r.first;\n\t\t\t}\n\t\t}\n\n\t\tif (strBuffer.find(\"Authorization\") != std::string::npos)\n\t\t\tec_log_debug(\"< Authorization: <value hidden>\");\n\t\telse\n\t\t\tec_log_debug(\"< \"+strBuffer);\n\t\t++n;\n\t} while(hr == hrSuccess);\n\n\thr = HrParseHeaders();\n\tif (hr != hrSuccess)\n\t\thr_ldebug(hr, \"parsing headers failed\");\n\treturn hr;\n}",
  2983. "project": "kopano-core",
  2984. "hash": 252899856337214612444746933964237135309,
  2985. "size": 48,
  2986. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  2987. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  2988. "target": 1,
  2989. "dataset": "other",
  2990. "idx": 208547
  2991. },
  2992. {
  2993. "func": "HRESULT Http::HrReadHeaders()\n{\n\tHRESULT hr;\n\tstd::string strBuffer;\n\tULONG n = 0;\n\tstd::map<std::string, std::string>::iterator iHeader = mapHeaders.end();\n\tstatic constexpr std::size_t MAX_HEADER_LENGTH = 65536;\n\tstd::size_t numOfBytesRead = 0;\n\n\tec_log_debug(\"Receiving headers:\");\n\tdo\n\t{\n\t\thr = m_lpChannel->HrReadLine(strBuffer);\n\t\tif (hr != hrSuccess)\n\t\t\treturn hr;\n\t\tif (strBuffer.empty())\n\t\t\tbreak;\n\n\t\tnumOfBytesRead += strBuffer.size();\n\t\tif(numOfBytesRead > MAX_HEADER_LENGTH) {\n\t\t\treturn MAPI_E_TOO_BIG;\n\t\t}\n\n\t\tif (n == 0) {\n\t\t\tm_strAction = strBuffer;\n\t\t} else {\n\t\t\tauto pos = strBuffer.find(':');\n\t\t\tsize_t start = 0;\n\n\t\t\tif (strBuffer[0] == ' ' || strBuffer[0] == '\\t') {\n\t\t\t\tif (iHeader == mapHeaders.end())\n\t\t\t\t\tcontinue;\n\t\t\t\t// continue header\n\t\t\t\twhile (strBuffer[start] == ' ' || strBuffer[start] == '\\t')\n\t\t\t\t\t++start;\n\t\t\t\tiHeader->second += strBuffer.substr(start);\n\t\t\t} else {\n\t\t\t\t// new header\n\t\t\t\tauto r = mapHeaders.emplace(strBuffer.substr(0, pos), strBuffer.substr(pos + 2));\n\t\t\t\tiHeader = r.first;\n\t\t\t}\n\t\t}\n\n\t\tif (strBuffer.find(\"Authorization\") != std::string::npos)\n\t\t\tec_log_debug(\"< Authorization: <value hidden>\");\n\t\telse\n\t\t\tec_log_debug(\"< \"+strBuffer);\n\t\t++n;\n\t} while(hr == hrSuccess);\n\n\thr = HrParseHeaders();\n\tif (hr != hrSuccess)\n\t\thr_ldebug(hr, \"parsing headers failed\");\n\treturn hr;\n}",
  2994. "project": "kopano-core",
  2995. "hash": 80967487134144399005768631526292358142,
  2996. "size": 55,
  2997. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  2998. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  2999. "target": 0,
  3000. "dataset": "other",
  3001. "idx": 412620
  3002. },
  3003. {
  3004. "func": "HRESULT Http::HrGetDestination(std::string *strDestination)\n{\n\tstd::string strHost, strDest;\n\n\t// example: Host: server:port\n\tauto hr = HrGetHeaderValue(\"Host\", &strHost);\n\tif(hr != hrSuccess) {\n\t\tec_log_debug(\"Http::HrGetDestination host header missing\");\n\t\treturn hr;\n\t}\n\t// example: Destination: http://server:port/caldav/username/folderid/entry.ics\n\thr = HrGetHeaderValue(\"Destination\", &strDest);\n\tif (hr != hrSuccess) {\n\t\tec_log_debug(\"Http::HrGetDestination destination header missing\");\n\t\treturn hr;\n\t}\n\tauto pos = strDest.find(strHost);\n\tif (pos == std::string::npos) {\n\t\tec_log_err(\"Refusing to move calendar item from %s to different host on url %s\", strHost.c_str(), strDest.c_str());\n\t\treturn MAPI_E_CALL_FAILED;\n\t}\n\tstrDest.erase(0, pos + strHost.length());\n\t*strDestination = std::move(strDest);\n\treturn hrSuccess;\n}",
  3005. "project": "kopano-core",
  3006. "hash": 16316728809572534170415762015635437994,
  3007. "size": 25,
  3008. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3009. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3010. "target": 0,
  3011. "dataset": "other",
  3012. "idx": 412637
  3013. },
  3014. {
  3015. "func": "HRESULT Http::HrParseHeaders()\n{\n\tstd::string strAuthdata;\n\tstd::string strUserAgent;\n\n\tauto items = tokenize(m_strAction, ' ', true);\n\tif (items.size() != 3) {\n\t\tec_log_debug(\"HrParseHeaders invalid != 3 tokens\");\n\t\treturn MAPI_E_INVALID_PARAMETER;\n\t}\n\tm_strMethod = items[0];\n\tm_strURL = items[1];\n\tm_strHttpVer = items[2];\n\t// converts %20 -> ' '\n\tm_strPath = urlDecode(m_strURL);\n\n\t// find the content-type\n\t// Content-Type: text/xml;charset=UTF-8\n\tauto hr = HrGetHeaderValue(\"Content-Type\", &m_strCharSet);\n\tif (hr == hrSuccess)\n\t\tm_strCharSet = content_type_get_charset(m_strCharSet.c_str(), m_lpConfig->GetSetting(\"default_charset\"));\n\telse\n\t\tm_strCharSet = m_lpConfig->GetSetting(\"default_charset\"); // really should be UTF-8\n\n\thr = HrGetHeaderValue(\"User-Agent\", &strUserAgent);\n\tif (hr == hrSuccess) {\n\t\tsize_t space = strUserAgent.find(\" \");\n\n\t\tif (space != std::string::npos) {\n\t\t\tm_strUserAgent = strUserAgent.substr(0, space);\n\t\t\tm_strUserAgentVersion = strUserAgent.substr(space + 1);\n\t\t}\n\t\telse {\n\t\t\tm_strUserAgent = strUserAgent;\n\t\t}\n\t}\n\n\t// find the Authorisation data (Authorization: Basic wr8y273yr2y3r87y23ry7=)\n\thr = HrGetHeaderValue(\"Authorization\", &strAuthdata);\n\tif (hr != hrSuccess) {\n\t\thr = HrGetHeaderValue(\"WWW-Authenticate\", &strAuthdata);\n\t\tif (hr != hrSuccess)\n\t\t\treturn S_OK; /* ignore empty Authorization */\n\t}\n\n\titems = tokenize(strAuthdata, ' ', true);\n\t// we only support basic authentication\n\tif (items.size() != 2 || items[0] != \"Basic\") {\n\t\tec_log_debug(\"HrParseHeaders login failed\");\n\t\treturn MAPI_E_LOGON_FAILED;\n\t}\n\tauto user_pass = base64_decode(items[1]);\n\tauto colon_pos = user_pass.find(\":\");\n\tif (colon_pos == std::string::npos) {\n\t\tec_log_debug(\"HrParseHeaders password missing\");\n\t\treturn MAPI_E_LOGON_FAILED;\n\t}\n\n\tm_strUser = user_pass.substr(0, colon_pos);\n\tm_strPass = user_pass.substr(colon_pos+1, std::string::npos);\n\treturn hrSuccess;\n}",
  3016. "project": "kopano-core",
  3017. "hash": 160499996596065679693723483967338886598,
  3018. "size": 62,
  3019. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3020. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3021. "target": 0,
  3022. "dataset": "other",
  3023. "idx": 412631
  3024. },
  3025. {
  3026. "func": "HRESULT Http::HrResponseHeader(const std::string &strHeader, const std::string &strValue)\n{\n\tm_lstHeaders.emplace_back(strHeader + \": \" + strValue);\n\treturn hrSuccess;\n}",
  3027. "project": "kopano-core",
  3028. "hash": 43027752424028596896501914067857753536,
  3029. "size": 5,
  3030. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3031. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3032. "target": 0,
  3033. "dataset": "other",
  3034. "idx": 412622
  3035. },
  3036. {
  3037. "func": "HRESULT Http::HrResponseHeader(unsigned int ulCode, const std::string &strResponse)\n{\n\tm_ulRetCode = ulCode;\n\t// do not set headers if once set\n\tif (!m_strRespHeader.empty())\n\t\treturn MAPI_E_CALL_FAILED;\n\tm_strRespHeader = \"HTTP/1.1 \" + stringify(ulCode) + \" \" + strResponse;\n\treturn hrSuccess;\n}",
  3038. "project": "kopano-core",
  3039. "hash": 94039446103434651188289106409173390514,
  3040. "size": 9,
  3041. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3042. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3043. "target": 0,
  3044. "dataset": "other",
  3045. "idx": 412635
  3046. },
  3047. {
  3048. "func": "bool Http::CheckIfMatch(LPMAPIPROP lpProp)\n{\n\tbool ret = false, invert = false;\n\tstd::string strIf, strValue;\n\tmemory_ptr<SPropValue> ptrLastModTime;\n\n\tif (lpProp != nullptr &&\n\t HrGetOneProp(lpProp, PR_LAST_MODIFICATION_TIME, &~ptrLastModTime) == hrSuccess)\n\t\tstrValue = stringify_int64(FileTimeToUnixTime(ptrLastModTime->Value.ft), false);\n\n\tif (HrGetHeaderValue(\"If-Match\", &strIf) == hrSuccess) {\n\t\tif (strIf == \"*\" && ptrLastModTime == nullptr)\n\t\t\t// we have an object without a last mod time, not allowed\n\t\t\treturn false;\n\t} else if (HrGetHeaderValue(\"If-None-Match\", &strIf) == hrSuccess) {\n\t\tif (strIf == \"*\" && ptrLastModTime != nullptr)\n\t\t\t// we have an object which has a last mod time, not allowed\n\t\t\treturn false;\n\t\tinvert = true;\n\t} else {\n\t\treturn true;\n\t}\n\n\t// check all etags for a match\n\tfor (auto &i : tokenize(strIf, ',', true)) {\n\t\tif (i.at(0) == '\"' || i.at(0) == '\\'')\n\t\t\ti.assign(i.begin() + 1, i.end() - 1);\n\t\tif (i == strValue) {\n\t\t\tret = true;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (invert)\n\t\tret = !ret;\n\treturn ret;\n}",
  3049. "project": "kopano-core",
  3050. "hash": 20941424626266380182721228937115832815,
  3051. "size": 36,
  3052. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3053. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3054. "target": 0,
  3055. "dataset": "other",
  3056. "idx": 412617
  3057. },
  3058. {
  3059. "func": "HRESULT Http::HrToHTTPCode(HRESULT hr)\n{\n\tif (hr == hrSuccess)\n\t\treturn HrResponseHeader(200, \"Ok\");\n\telse if (hr == MAPI_E_NO_ACCESS)\n\t\treturn HrResponseHeader(403, \"Forbidden\");\n\telse if (hr == MAPI_E_NOT_FOUND)\n\t\treturn HrResponseHeader(404, \"Not Found\");\n\t// @todo other codes?\n\treturn HrResponseHeader(500, \"Unhanded error \" + stringify_hex(hr));\n}",
  3060. "project": "kopano-core",
  3061. "hash": 292016140630203762883778197098120421520,
  3062. "size": 11,
  3063. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3064. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3065. "target": 0,
  3066. "dataset": "other",
  3067. "idx": 412618
  3068. },
  3069. {
  3070. "func": "HRESULT Http::HrGetHeaderValue(const std::string &strHeader, std::string *strValue)\n{\n\tauto iHeader = mapHeaders.find(strHeader);\n\tif (iHeader == mapHeaders.cend())\n\t\treturn MAPI_E_NOT_FOUND;\n\t*strValue = iHeader->second;\n\treturn hrSuccess;\n}",
  3071. "project": "kopano-core",
  3072. "hash": 72639894483250812810845856289290598907,
  3073. "size": 8,
  3074. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3075. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3076. "target": 0,
  3077. "dataset": "other",
  3078. "idx": 412615
  3079. },
  3080. {
  3081. "func": "HRESULT Http::HrFlushHeaders()\n{\n\tHRESULT hr = hrSuccess;\n\tstd::string strOutput, strConnection;\n\tchar lpszChar[128];\n\n\tHrGetHeaderValue(\"Connection\", &strConnection);\n\t// Add misc. headers\n\tHrResponseHeader(\"Server\",\"Kopano\");\n\tstruct tm dummy;\n\tstrftime(lpszChar, 127, \"%a, %d %b %Y %H:%M:%S GMT\", gmtime_safe(time(nullptr), &dummy));\n\tHrResponseHeader(\"Date\", lpszChar);\n\tif (m_ulKeepAlive != 0 && strcasecmp(strConnection.c_str(), \"keep-alive\") == 0) {\n\t\tHrResponseHeader(\"Connection\", \"Keep-Alive\");\n\t\tHrResponseHeader(\"Keep-Alive\", stringify(m_ulKeepAlive));\n\t}\n\telse\n\t{\n\t\tHrResponseHeader(\"Connection\", \"close\");\n\t\thr = MAPI_E_END_OF_SESSION;\n\t}\n\n\t// create headers packet\n\tassert(m_ulRetCode != 0);\n\tif (m_ulRetCode == 0)\n\t\tHrResponseHeader(500, \"Request handled incorrectly\");\n\tec_log_debug(\"> \" + m_strRespHeader);\n\tstrOutput += m_strRespHeader + \"\\r\\n\";\n\tm_strRespHeader.clear();\n\tfor (const auto &h : m_lstHeaders) {\n\t\tec_log_debug(\"> \" + h);\n\t\tstrOutput += h + \"\\r\\n\";\n\t}\n\tm_lstHeaders.clear();\n\t//as last line has a CRLF. The HrWriteLine adds one more CRLF.\n\t//this means the End of headder.\n\tm_lpChannel->HrWriteLine(strOutput);\n\treturn hr;\n}",
  3082. "project": "kopano-core",
  3083. "hash": 287019352431824453208165934954791138515,
  3084. "size": 39,
  3085. "commit_id": "512457466b87039c6a8d25887fdaca6173619546",
  3086. "message": "Set limit on header size to prevent bad alloc\n\nThis sets a hard limit of 64 KiB to the header to prevent a memory\nallocation exception from being thrown during the parsing of the request\nheaders.",
  3087. "target": 0,
  3088. "dataset": "other",
  3089. "idx": 412621
  3090. }
  3091. ]
  3092. },
  3093. {
  3094. "call_depth": 3,
  3095. "longest_call_chain": [
  3096. "do_huge_pmd_anonymous_page",
  3097. "__do_huge_pmd_anonymous_page",
  3098. "maybe_pmd_mkwrite"
  3099. ],
  3100. "group_size": 13,
  3101. "functions": [
  3102. {
  3103. "func": "static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr,\n\t\tpmd_t *pmd, pfn_t pfn, pgprot_t prot, bool write,\n\t\tpgtable_t pgtable)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\tpmd_t entry;\n\tspinlock_t *ptl;\n\n\tptl = pmd_lock(mm, pmd);\n\tif (!pmd_none(*pmd)) {\n\t\tif (write) {\n\t\t\tif (pmd_pfn(*pmd) != pfn_t_to_pfn(pfn)) {\n\t\t\t\tWARN_ON_ONCE(!is_huge_zero_pmd(*pmd));\n\t\t\t\tgoto out_unlock;\n\t\t\t}\n\t\t\tentry = pmd_mkyoung(*pmd);\n\t\t\tentry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);\n\t\t\tif (pmdp_set_access_flags(vma, addr, pmd, entry, 1))\n\t\t\t\tupdate_mmu_cache_pmd(vma, addr, pmd);\n\t\t}\n\n\t\tgoto out_unlock;\n\t}\n\n\tentry = pmd_mkhuge(pfn_t_pmd(pfn, prot));\n\tif (pfn_t_devmap(pfn))\n\t\tentry = pmd_mkdevmap(entry);\n\tif (write) {\n\t\tentry = pmd_mkyoung(pmd_mkdirty(entry));\n\t\tentry = maybe_pmd_mkwrite(entry, vma);\n\t}\n\n\tif (pgtable) {\n\t\tpgtable_trans_huge_deposit(mm, pmd, pgtable);\n\t\tmm_inc_nr_ptes(mm);\n\t\tpgtable = NULL;\n\t}\n\n\tset_pmd_at(mm, addr, pmd, entry);\n\tupdate_mmu_cache_pmd(vma, addr, pmd);\n\nout_unlock:\n\tspin_unlock(ptl);\n\tif (pgtable)\n\t\tpte_free(mm, pgtable);\n}",
  3104. "project": "linux",
  3105. "hash": 52858789939630070314033604561150746297,
  3106. "size": 46,
  3107. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3108. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3109. "target": 0,
  3110. "dataset": "other",
  3111. "idx": 364139
  3112. },
  3113. {
  3114. "func": "static vm_fault_t do_huge_pmd_wp_page_fallback(struct vm_fault *vmf,\n\t\t\tpmd_t orig_pmd, struct page *page)\n{\n\tstruct vm_area_struct *vma = vmf->vma;\n\tunsigned long haddr = vmf->address & HPAGE_PMD_MASK;\n\tstruct mem_cgroup *memcg;\n\tpgtable_t pgtable;\n\tpmd_t _pmd;\n\tint i;\n\tvm_fault_t ret = 0;\n\tstruct page **pages;\n\tstruct mmu_notifier_range range;\n\n\tpages = kmalloc_array(HPAGE_PMD_NR, sizeof(struct page *),\n\t\t\t GFP_KERNEL);\n\tif (unlikely(!pages)) {\n\t\tret |= VM_FAULT_OOM;\n\t\tgoto out;\n\t}\n\n\tfor (i = 0; i < HPAGE_PMD_NR; i++) {\n\t\tpages[i] = alloc_page_vma_node(GFP_HIGHUSER_MOVABLE, vma,\n\t\t\t\t\t vmf->address, page_to_nid(page));\n\t\tif (unlikely(!pages[i] ||\n\t\t\t mem_cgroup_try_charge_delay(pages[i], vma->vm_mm,\n\t\t\t\t GFP_KERNEL, &memcg, false))) {\n\t\t\tif (pages[i])\n\t\t\t\tput_page(pages[i]);\n\t\t\twhile (--i >= 0) {\n\t\t\t\tmemcg = (void *)page_private(pages[i]);\n\t\t\t\tset_page_private(pages[i], 0);\n\t\t\t\tmem_cgroup_cancel_charge(pages[i], memcg,\n\t\t\t\t\t\tfalse);\n\t\t\t\tput_page(pages[i]);\n\t\t\t}\n\t\t\tkfree(pages);\n\t\t\tret |= VM_FAULT_OOM;\n\t\t\tgoto out;\n\t\t}\n\t\tset_page_private(pages[i], (unsigned long)memcg);\n\t}\n\n\tfor (i = 0; i < HPAGE_PMD_NR; i++) {\n\t\tcopy_user_highpage(pages[i], page + i,\n\t\t\t\t haddr + PAGE_SIZE * i, vma);\n\t\t__SetPageUptodate(pages[i]);\n\t\tcond_resched();\n\t}\n\n\tmmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm,\n\t\t\t\thaddr, haddr + HPAGE_PMD_SIZE);\n\tmmu_notifier_invalidate_range_start(&range);\n\n\tvmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);\n\tif (unlikely(!pmd_same(*vmf->pmd, orig_pmd)))\n\t\tgoto out_free_pages;\n\tVM_BUG_ON_PAGE(!PageHead(page), page);\n\n\t/*\n\t * Leave pmd empty until pte is filled note we must notify here as\n\t * concurrent CPU thread might write to new page before the call to\n\t * mmu_notifier_invalidate_range_end() happens which can lead to a\n\t * device seeing memory write in different order than CPU.\n\t *\n\t * See Documentation/vm/mmu_notifier.rst\n\t */\n\tpmdp_huge_clear_flush_notify(vma, haddr, vmf->pmd);\n\n\tpgtable = pgtable_trans_huge_withdraw(vma->vm_mm, vmf->pmd);\n\tpmd_populate(vma->vm_mm, &_pmd, pgtable);\n\n\tfor (i = 0; i < HPAGE_PMD_NR; i++, haddr += PAGE_SIZE) {\n\t\tpte_t entry;\n\t\tentry = mk_pte(pages[i], vma->vm_page_prot);\n\t\tentry = maybe_mkwrite(pte_mkdirty(entry), vma);\n\t\tmemcg = (void *)page_private(pages[i]);\n\t\tset_page_private(pages[i], 0);\n\t\tpage_add_new_anon_rmap(pages[i], vmf->vma, haddr, false);\n\t\tmem_cgroup_commit_charge(pages[i], memcg, false, false);\n\t\tlru_cache_add_active_or_unevictable(pages[i], vma);\n\t\tvmf->pte = pte_offset_map(&_pmd, haddr);\n\t\tVM_BUG_ON(!pte_none(*vmf->pte));\n\t\tset_pte_at(vma->vm_mm, haddr, vmf->pte, entry);\n\t\tpte_unmap(vmf->pte);\n\t}\n\tkfree(pages);\n\n\tsmp_wmb(); /* make pte visible before pmd */\n\tpmd_populate(vma->vm_mm, vmf->pmd, pgtable);\n\tpage_remove_rmap(page, true);\n\tspin_unlock(vmf->ptl);\n\n\t/*\n\t * No need to double call mmu_notifier->invalidate_range() callback as\n\t * the above pmdp_huge_clear_flush_notify() did already call it.\n\t */\n\tmmu_notifier_invalidate_range_only_end(&range);\n\n\tret |= VM_FAULT_WRITE;\n\tput_page(page);\n\nout:\n\treturn ret;\n\nout_free_pages:\n\tspin_unlock(vmf->ptl);\n\tmmu_notifier_invalidate_range_end(&range);\n\tfor (i = 0; i < HPAGE_PMD_NR; i++) {\n\t\tmemcg = (void *)page_private(pages[i]);\n\t\tset_page_private(pages[i], 0);\n\t\tmem_cgroup_cancel_charge(pages[i], memcg, false);\n\t\tput_page(pages[i]);\n\t}\n\tkfree(pages);\n\tgoto out;\n}",
  3115. "project": "linux",
  3116. "hash": 130300490822755964571089515210837497500,
  3117. "size": 116,
  3118. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3119. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3120. "target": 0,
  3121. "dataset": "other",
  3122. "idx": 364146
  3123. },
  3124. {
  3125. "func": "static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf,\n\t\t\tstruct page *page, gfp_t gfp)\n{\n\tstruct vm_area_struct *vma = vmf->vma;\n\tstruct mem_cgroup *memcg;\n\tpgtable_t pgtable;\n\tunsigned long haddr = vmf->address & HPAGE_PMD_MASK;\n\tvm_fault_t ret = 0;\n\n\tVM_BUG_ON_PAGE(!PageCompound(page), page);\n\n\tif (mem_cgroup_try_charge_delay(page, vma->vm_mm, gfp, &memcg, true)) {\n\t\tput_page(page);\n\t\tcount_vm_event(THP_FAULT_FALLBACK);\n\t\tcount_vm_event(THP_FAULT_FALLBACK_CHARGE);\n\t\treturn VM_FAULT_FALLBACK;\n\t}\n\n\tpgtable = pte_alloc_one(vma->vm_mm);\n\tif (unlikely(!pgtable)) {\n\t\tret = VM_FAULT_OOM;\n\t\tgoto release;\n\t}\n\n\tclear_huge_page(page, vmf->address, HPAGE_PMD_NR);\n\t/*\n\t * The memory barrier inside __SetPageUptodate makes sure that\n\t * clear_huge_page writes become visible before the set_pmd_at()\n\t * write.\n\t */\n\t__SetPageUptodate(page);\n\n\tvmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);\n\tif (unlikely(!pmd_none(*vmf->pmd))) {\n\t\tgoto unlock_release;\n\t} else {\n\t\tpmd_t entry;\n\n\t\tret = check_stable_address_space(vma->vm_mm);\n\t\tif (ret)\n\t\t\tgoto unlock_release;\n\n\t\t/* Deliver the page fault to userland */\n\t\tif (userfaultfd_missing(vma)) {\n\t\t\tvm_fault_t ret2;\n\n\t\t\tspin_unlock(vmf->ptl);\n\t\t\tmem_cgroup_cancel_charge(page, memcg, true);\n\t\t\tput_page(page);\n\t\t\tpte_free(vma->vm_mm, pgtable);\n\t\t\tret2 = handle_userfault(vmf, VM_UFFD_MISSING);\n\t\t\tVM_BUG_ON(ret2 & VM_FAULT_FALLBACK);\n\t\t\treturn ret2;\n\t\t}\n\n\t\tentry = mk_huge_pmd(page, vma->vm_page_prot);\n\t\tentry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);\n\t\tpage_add_new_anon_rmap(page, vma, haddr, true);\n\t\tmem_cgroup_commit_charge(page, memcg, false, true);\n\t\tlru_cache_add_active_or_unevictable(page, vma);\n\t\tpgtable_trans_huge_deposit(vma->vm_mm, vmf->pmd, pgtable);\n\t\tset_pmd_at(vma->vm_mm, haddr, vmf->pmd, entry);\n\t\tadd_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR);\n\t\tmm_inc_nr_ptes(vma->vm_mm);\n\t\tspin_unlock(vmf->ptl);\n\t\tcount_vm_event(THP_FAULT_ALLOC);\n\t\tcount_memcg_events(memcg, THP_FAULT_ALLOC, 1);\n\t}\n\n\treturn 0;\nunlock_release:\n\tspin_unlock(vmf->ptl);\nrelease:\n\tif (pgtable)\n\t\tpte_free(vma->vm_mm, pgtable);\n\tmem_cgroup_cancel_charge(page, memcg, true);\n\tput_page(page);\n\treturn ret;\n\n}",
  3126. "project": "linux",
  3127. "hash": 275114735309297372780902708916285798590,
  3128. "size": 80,
  3129. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3130. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3131. "target": 0,
  3132. "dataset": "other",
  3133. "idx": 364127
  3134. },
  3135. {
  3136. "func": "vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn,\n\t\t\t\t pgprot_t pgprot, bool write)\n{\n\tunsigned long addr = vmf->address & PMD_MASK;\n\tstruct vm_area_struct *vma = vmf->vma;\n\tpgtable_t pgtable = NULL;\n\n\t/*\n\t * If we had pmd_special, we could avoid all these restrictions,\n\t * but we need to be consistent with PTEs and architectures that\n\t * can't support a 'special' bit.\n\t */\n\tBUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) &&\n\t\t\t!pfn_t_devmap(pfn));\n\tBUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) ==\n\t\t\t\t\t\t(VM_PFNMAP|VM_MIXEDMAP));\n\tBUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags));\n\n\tif (addr < vma->vm_start || addr >= vma->vm_end)\n\t\treturn VM_FAULT_SIGBUS;\n\n\tif (arch_needs_pgtable_deposit()) {\n\t\tpgtable = pte_alloc_one(vma->vm_mm);\n\t\tif (!pgtable)\n\t\t\treturn VM_FAULT_OOM;\n\t}\n\n\ttrack_pfn_insert(vma, &pgprot, pfn);\n\n\tinsert_pfn_pmd(vma, addr, vmf->pmd, pfn, pgprot, write, pgtable);\n\treturn VM_FAULT_NOPAGE;\n}",
  3137. "project": "linux",
  3138. "hash": 170544210575966782036032329512632262586,
  3139. "size": 32,
  3140. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3141. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3142. "target": 0,
  3143. "dataset": "other",
  3144. "idx": 364205
  3145. },
  3146. {
  3147. "func": "pmd_t maybe_pmd_mkwrite(pmd_t pmd, struct vm_area_struct *vma)\n{\n\tif (likely(vma->vm_flags & VM_WRITE))\n\t\tpmd = pmd_mkwrite(pmd);\n\treturn pmd;\n}",
  3148. "project": "linux",
  3149. "hash": 74096385663612383266064894913746127235,
  3150. "size": 6,
  3151. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3152. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3153. "target": 0,
  3154. "dataset": "other",
  3155. "idx": 364167
  3156. },
  3157. {
  3158. "func": "vm_fault_t do_huge_pmd_wp_page(struct vm_fault *vmf, pmd_t orig_pmd)\n{\n\tstruct vm_area_struct *vma = vmf->vma;\n\tstruct page *page = NULL, *new_page;\n\tstruct mem_cgroup *memcg;\n\tunsigned long haddr = vmf->address & HPAGE_PMD_MASK;\n\tstruct mmu_notifier_range range;\n\tgfp_t huge_gfp;\t\t\t/* for allocation and charge */\n\tvm_fault_t ret = 0;\n\n\tvmf->ptl = pmd_lockptr(vma->vm_mm, vmf->pmd);\n\tVM_BUG_ON_VMA(!vma->anon_vma, vma);\n\tif (is_huge_zero_pmd(orig_pmd))\n\t\tgoto alloc;\n\tspin_lock(vmf->ptl);\n\tif (unlikely(!pmd_same(*vmf->pmd, orig_pmd)))\n\t\tgoto out_unlock;\n\n\tpage = pmd_page(orig_pmd);\n\tVM_BUG_ON_PAGE(!PageCompound(page) || !PageHead(page), page);\n\t/*\n\t * We can only reuse the page if nobody else maps the huge page or it's\n\t * part.\n\t */\n\tif (!trylock_page(page)) {\n\t\tget_page(page);\n\t\tspin_unlock(vmf->ptl);\n\t\tlock_page(page);\n\t\tspin_lock(vmf->ptl);\n\t\tif (unlikely(!pmd_same(*vmf->pmd, orig_pmd))) {\n\t\t\tunlock_page(page);\n\t\t\tput_page(page);\n\t\t\tgoto out_unlock;\n\t\t}\n\t\tput_page(page);\n\t}\n\tif (reuse_swap_page(page, NULL)) {\n\t\tpmd_t entry;\n\t\tentry = pmd_mkyoung(orig_pmd);\n\t\tentry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);\n\t\tif (pmdp_set_access_flags(vma, haddr, vmf->pmd, entry, 1))\n\t\t\tupdate_mmu_cache_pmd(vma, vmf->address, vmf->pmd);\n\t\tret |= VM_FAULT_WRITE;\n\t\tunlock_page(page);\n\t\tgoto out_unlock;\n\t}\n\tunlock_page(page);\n\tget_page(page);\n\tspin_unlock(vmf->ptl);\nalloc:\n\tif (__transparent_hugepage_enabled(vma) &&\n\t !transparent_hugepage_debug_cow()) {\n\t\thuge_gfp = alloc_hugepage_direct_gfpmask(vma);\n\t\tnew_page = alloc_hugepage_vma(huge_gfp, vma, haddr, HPAGE_PMD_ORDER);\n\t} else\n\t\tnew_page = NULL;\n\n\tif (likely(new_page)) {\n\t\tprep_transhuge_page(new_page);\n\t} else {\n\t\tif (!page) {\n\t\t\tsplit_huge_pmd(vma, vmf->pmd, vmf->address);\n\t\t\tret |= VM_FAULT_FALLBACK;\n\t\t} else {\n\t\t\tret = do_huge_pmd_wp_page_fallback(vmf, orig_pmd, page);\n\t\t\tif (ret & VM_FAULT_OOM) {\n\t\t\t\tsplit_huge_pmd(vma, vmf->pmd, vmf->address);\n\t\t\t\tret |= VM_FAULT_FALLBACK;\n\t\t\t}\n\t\t\tput_page(page);\n\t\t}\n\t\tcount_vm_event(THP_FAULT_FALLBACK);\n\t\tgoto out;\n\t}\n\n\tif (unlikely(mem_cgroup_try_charge_delay(new_page, vma->vm_mm,\n\t\t\t\t\thuge_gfp, &memcg, true))) {\n\t\tput_page(new_page);\n\t\tsplit_huge_pmd(vma, vmf->pmd, vmf->address);\n\t\tif (page)\n\t\t\tput_page(page);\n\t\tret |= VM_FAULT_FALLBACK;\n\t\tcount_vm_event(THP_FAULT_FALLBACK);\n\t\tcount_vm_event(THP_FAULT_FALLBACK_CHARGE);\n\t\tgoto out;\n\t}\n\n\tcount_vm_event(THP_FAULT_ALLOC);\n\tcount_memcg_events(memcg, THP_FAULT_ALLOC, 1);\n\n\tif (!page)\n\t\tclear_huge_page(new_page, vmf->address, HPAGE_PMD_NR);\n\telse\n\t\tcopy_user_huge_page(new_page, page, vmf->address,\n\t\t\t\t vma, HPAGE_PMD_NR);\n\t__SetPageUptodate(new_page);\n\n\tmmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm,\n\t\t\t\thaddr, haddr + HPAGE_PMD_SIZE);\n\tmmu_notifier_invalidate_range_start(&range);\n\n\tspin_lock(vmf->ptl);\n\tif (page)\n\t\tput_page(page);\n\tif (unlikely(!pmd_same(*vmf->pmd, orig_pmd))) {\n\t\tspin_unlock(vmf->ptl);\n\t\tmem_cgroup_cancel_charge(new_page, memcg, true);\n\t\tput_page(new_page);\n\t\tgoto out_mn;\n\t} else {\n\t\tpmd_t entry;\n\t\tentry = mk_huge_pmd(new_page, vma->vm_page_prot);\n\t\tentry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);\n\t\tpmdp_huge_clear_flush_notify(vma, haddr, vmf->pmd);\n\t\tpage_add_new_anon_rmap(new_page, vma, haddr, true);\n\t\tmem_cgroup_commit_charge(new_page, memcg, false, true);\n\t\tlru_cache_add_active_or_unevictable(new_page, vma);\n\t\tset_pmd_at(vma->vm_mm, haddr, vmf->pmd, entry);\n\t\tupdate_mmu_cache_pmd(vma, vmf->address, vmf->pmd);\n\t\tif (!page) {\n\t\t\tadd_mm_counter(vma->vm_mm, MM_ANONPAGES, HPAGE_PMD_NR);\n\t\t} else {\n\t\t\tVM_BUG_ON_PAGE(!PageHead(page), page);\n\t\t\tpage_remove_rmap(page, true);\n\t\t\tput_page(page);\n\t\t}\n\t\tret |= VM_FAULT_WRITE;\n\t}\n\tspin_unlock(vmf->ptl);\nout_mn:\n\t/*\n\t * No need to double call mmu_notifier->invalidate_range() callback as\n\t * the above pmdp_huge_clear_flush_notify() did already call it.\n\t */\n\tmmu_notifier_invalidate_range_only_end(&range);\nout:\n\treturn ret;\nout_unlock:\n\tspin_unlock(vmf->ptl);\n\treturn ret;\n}",
  3159. "project": "linux",
  3160. "hash": 251248643641509686843439954088131461450,
  3161. "size": 141,
  3162. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3163. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3164. "target": 0,
  3165. "dataset": "other",
  3166. "idx": 364165
  3167. },
  3168. {
  3169. "func": "int copy_huge_pmd(struct mm_struct *dst_mm, struct mm_struct *src_mm,\n\t\t pmd_t *dst_pmd, pmd_t *src_pmd, unsigned long addr,\n\t\t struct vm_area_struct *vma)\n{\n\tspinlock_t *dst_ptl, *src_ptl;\n\tstruct page *src_page;\n\tpmd_t pmd;\n\tpgtable_t pgtable = NULL;\n\tint ret = -ENOMEM;\n\n\t/* Skip if can be re-fill on fault */\n\tif (!vma_is_anonymous(vma))\n\t\treturn 0;\n\n\tpgtable = pte_alloc_one(dst_mm);\n\tif (unlikely(!pgtable))\n\t\tgoto out;\n\n\tdst_ptl = pmd_lock(dst_mm, dst_pmd);\n\tsrc_ptl = pmd_lockptr(src_mm, src_pmd);\n\tspin_lock_nested(src_ptl, SINGLE_DEPTH_NESTING);\n\n\tret = -EAGAIN;\n\tpmd = *src_pmd;\n\n\t/*\n\t * Make sure the _PAGE_UFFD_WP bit is cleared if the new VMA\n\t * does not have the VM_UFFD_WP, which means that the uffd\n\t * fork event is not enabled.\n\t */\n\tif (!(vma->vm_flags & VM_UFFD_WP))\n\t\tpmd = pmd_clear_uffd_wp(pmd);\n\n#ifdef CONFIG_ARCH_ENABLE_THP_MIGRATION\n\tif (unlikely(is_swap_pmd(pmd))) {\n\t\tswp_entry_t entry = pmd_to_swp_entry(pmd);\n\n\t\tVM_BUG_ON(!is_pmd_migration_entry(pmd));\n\t\tif (is_write_migration_entry(entry)) {\n\t\t\tmake_migration_entry_read(&entry);\n\t\t\tpmd = swp_entry_to_pmd(entry);\n\t\t\tif (pmd_swp_soft_dirty(*src_pmd))\n\t\t\t\tpmd = pmd_swp_mksoft_dirty(pmd);\n\t\t\tset_pmd_at(src_mm, addr, src_pmd, pmd);\n\t\t}\n\t\tadd_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR);\n\t\tmm_inc_nr_ptes(dst_mm);\n\t\tpgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable);\n\t\tset_pmd_at(dst_mm, addr, dst_pmd, pmd);\n\t\tret = 0;\n\t\tgoto out_unlock;\n\t}\n#endif\n\n\tif (unlikely(!pmd_trans_huge(pmd))) {\n\t\tpte_free(dst_mm, pgtable);\n\t\tgoto out_unlock;\n\t}\n\t/*\n\t * When page table lock is held, the huge zero pmd should not be\n\t * under splitting since we don't split the page itself, only pmd to\n\t * a page table.\n\t */\n\tif (is_huge_zero_pmd(pmd)) {\n\t\tstruct page *zero_page;\n\t\t/*\n\t\t * get_huge_zero_page() will never allocate a new page here,\n\t\t * since we already have a zero page to copy. It just takes a\n\t\t * reference.\n\t\t */\n\t\tzero_page = mm_get_huge_zero_page(dst_mm);\n\t\tset_huge_zero_page(pgtable, dst_mm, vma, addr, dst_pmd,\n\t\t\t\tzero_page);\n\t\tret = 0;\n\t\tgoto out_unlock;\n\t}\n\n\tsrc_page = pmd_page(pmd);\n\tVM_BUG_ON_PAGE(!PageHead(src_page), src_page);\n\tget_page(src_page);\n\tpage_dup_rmap(src_page, true);\n\tadd_mm_counter(dst_mm, MM_ANONPAGES, HPAGE_PMD_NR);\n\tmm_inc_nr_ptes(dst_mm);\n\tpgtable_trans_huge_deposit(dst_mm, dst_pmd, pgtable);\n\n\tpmdp_set_wrprotect(src_mm, addr, src_pmd);\n\tpmd = pmd_mkold(pmd_wrprotect(pmd));\n\tset_pmd_at(dst_mm, addr, dst_pmd, pmd);\n\n\tret = 0;\nout_unlock:\n\tspin_unlock(src_ptl);\n\tspin_unlock(dst_ptl);\nout:\n\treturn ret;\n}",
  3170. "project": "linux",
  3171. "hash": 103272740496478568545173712775090740691,
  3172. "size": 96,
  3173. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3174. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3175. "target": 0,
  3176. "dataset": "other",
  3177. "idx": 364174
  3178. },
  3179. {
  3180. "func": "void remove_migration_pmd(struct page_vma_mapped_walk *pvmw, struct page *new)\n{\n\tstruct vm_area_struct *vma = pvmw->vma;\n\tstruct mm_struct *mm = vma->vm_mm;\n\tunsigned long address = pvmw->address;\n\tunsigned long mmun_start = address & HPAGE_PMD_MASK;\n\tpmd_t pmde;\n\tswp_entry_t entry;\n\n\tif (!(pvmw->pmd && !pvmw->pte))\n\t\treturn;\n\n\tentry = pmd_to_swp_entry(*pvmw->pmd);\n\tget_page(new);\n\tpmde = pmd_mkold(mk_huge_pmd(new, vma->vm_page_prot));\n\tif (pmd_swp_soft_dirty(*pvmw->pmd))\n\t\tpmde = pmd_mksoft_dirty(pmde);\n\tif (is_write_migration_entry(entry))\n\t\tpmde = maybe_pmd_mkwrite(pmde, vma);\n\n\tflush_cache_range(vma, mmun_start, mmun_start + HPAGE_PMD_SIZE);\n\tif (PageAnon(new))\n\t\tpage_add_anon_rmap(new, vma, mmun_start, true);\n\telse\n\t\tpage_add_file_rmap(new, true);\n\tset_pmd_at(mm, mmun_start, pvmw->pmd, pmde);\n\tif ((vma->vm_flags & VM_LOCKED) && !PageDoubleMap(new))\n\t\tmlock_vma_page(new);\n\tupdate_mmu_cache_pmd(vma, address, pvmw->pmd);\n}",
  3181. "project": "linux",
  3182. "hash": 19287154360258264912542134856683106514,
  3183. "size": 30,
  3184. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3185. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3186. "target": 0,
  3187. "dataset": "other",
  3188. "idx": 364175
  3189. },
  3190. {
  3191. "func": "struct page *alloc_new_node_page(struct page *page, unsigned long node)\n{\n\tif (PageHuge(page))\n\t\treturn alloc_huge_page_node(page_hstate(compound_head(page)),\n\t\t\t\t\tnode);\n\telse if (PageTransHuge(page)) {\n\t\tstruct page *thp;\n\n\t\tthp = alloc_pages_node(node,\n\t\t\t(GFP_TRANSHUGE | __GFP_THISNODE),\n\t\t\tHPAGE_PMD_ORDER);\n\t\tif (!thp)\n\t\t\treturn NULL;\n\t\tprep_transhuge_page(thp);\n\t\treturn thp;\n\t} else\n\t\treturn __alloc_pages_node(node, GFP_HIGHUSER_MOVABLE |\n\t\t\t\t\t\t __GFP_THISNODE, 0);\n}",
  3192. "project": "linux",
  3193. "hash": 269550787845310994534123708151069293968,
  3194. "size": 19,
  3195. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  3196. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3197. "target": 0,
  3198. "dataset": "other",
  3199. "idx": 366733
  3200. },
  3201. {
  3202. "func": "static inline gfp_t alloc_hugepage_direct_gfpmask(struct vm_area_struct *vma)\n{\n\tconst bool vma_madvised = !!(vma->vm_flags & VM_HUGEPAGE);\n\n\t/* Always do synchronous compaction */\n\tif (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_DIRECT_FLAG, &transparent_hugepage_flags))\n\t\treturn GFP_TRANSHUGE | (vma_madvised ? 0 : __GFP_NORETRY);\n\n\t/* Kick kcompactd and fail quickly */\n\tif (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_FLAG, &transparent_hugepage_flags))\n\t\treturn GFP_TRANSHUGE_LIGHT | __GFP_KSWAPD_RECLAIM;\n\n\t/* Synchronous compaction if madvised, otherwise kick kcompactd */\n\tif (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_KSWAPD_OR_MADV_FLAG, &transparent_hugepage_flags))\n\t\treturn GFP_TRANSHUGE_LIGHT |\n\t\t\t(vma_madvised ? __GFP_DIRECT_RECLAIM :\n\t\t\t\t\t__GFP_KSWAPD_RECLAIM);\n\n\t/* Only do synchronous compaction if madvised */\n\tif (test_bit(TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG, &transparent_hugepage_flags))\n\t\treturn GFP_TRANSHUGE_LIGHT |\n\t\t (vma_madvised ? __GFP_DIRECT_RECLAIM : 0);\n\n\treturn GFP_TRANSHUGE_LIGHT;\n}",
  3203. "project": "linux",
  3204. "hash": 90840456381970735333293333930027885597,
  3205. "size": 25,
  3206. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3207. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3208. "target": 0,
  3209. "dataset": "other",
  3210. "idx": 364179
  3211. },
  3212. {
  3213. "func": "vm_fault_t do_huge_pmd_anonymous_page(struct vm_fault *vmf)\n{\n\tstruct vm_area_struct *vma = vmf->vma;\n\tgfp_t gfp;\n\tstruct page *page;\n\tunsigned long haddr = vmf->address & HPAGE_PMD_MASK;\n\n\tif (!transhuge_vma_suitable(vma, haddr))\n\t\treturn VM_FAULT_FALLBACK;\n\tif (unlikely(anon_vma_prepare(vma)))\n\t\treturn VM_FAULT_OOM;\n\tif (unlikely(khugepaged_enter(vma, vma->vm_flags)))\n\t\treturn VM_FAULT_OOM;\n\tif (!(vmf->flags & FAULT_FLAG_WRITE) &&\n\t\t\t!mm_forbids_zeropage(vma->vm_mm) &&\n\t\t\ttransparent_hugepage_use_zero_page()) {\n\t\tpgtable_t pgtable;\n\t\tstruct page *zero_page;\n\t\tbool set;\n\t\tvm_fault_t ret;\n\t\tpgtable = pte_alloc_one(vma->vm_mm);\n\t\tif (unlikely(!pgtable))\n\t\t\treturn VM_FAULT_OOM;\n\t\tzero_page = mm_get_huge_zero_page(vma->vm_mm);\n\t\tif (unlikely(!zero_page)) {\n\t\t\tpte_free(vma->vm_mm, pgtable);\n\t\t\tcount_vm_event(THP_FAULT_FALLBACK);\n\t\t\treturn VM_FAULT_FALLBACK;\n\t\t}\n\t\tvmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);\n\t\tret = 0;\n\t\tset = false;\n\t\tif (pmd_none(*vmf->pmd)) {\n\t\t\tret = check_stable_address_space(vma->vm_mm);\n\t\t\tif (ret) {\n\t\t\t\tspin_unlock(vmf->ptl);\n\t\t\t} else if (userfaultfd_missing(vma)) {\n\t\t\t\tspin_unlock(vmf->ptl);\n\t\t\t\tret = handle_userfault(vmf, VM_UFFD_MISSING);\n\t\t\t\tVM_BUG_ON(ret & VM_FAULT_FALLBACK);\n\t\t\t} else {\n\t\t\t\tset_huge_zero_page(pgtable, vma->vm_mm, vma,\n\t\t\t\t\t\t haddr, vmf->pmd, zero_page);\n\t\t\t\tspin_unlock(vmf->ptl);\n\t\t\t\tset = true;\n\t\t\t}\n\t\t} else\n\t\t\tspin_unlock(vmf->ptl);\n\t\tif (!set)\n\t\t\tpte_free(vma->vm_mm, pgtable);\n\t\treturn ret;\n\t}\n\tgfp = alloc_hugepage_direct_gfpmask(vma);\n\tpage = alloc_hugepage_vma(gfp, vma, haddr, HPAGE_PMD_ORDER);\n\tif (unlikely(!page)) {\n\t\tcount_vm_event(THP_FAULT_FALLBACK);\n\t\treturn VM_FAULT_FALLBACK;\n\t}\n\tprep_transhuge_page(page);\n\treturn __do_huge_pmd_anonymous_page(vmf, page, gfp);\n}",
  3214. "project": "linux",
  3215. "hash": 307922489138449253324634289520844340954,
  3216. "size": 61,
  3217. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3218. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3219. "target": 0,
  3220. "dataset": "other",
  3221. "idx": 364189
  3222. },
  3223. {
  3224. "func": "void prep_transhuge_page(struct page *page)\n{\n\t/*\n\t * we use page->mapping and page->indexlru in second tail page\n\t * as list_head: assuming THP order >= 2\n\t */\n\n\tINIT_LIST_HEAD(page_deferred_list(page));\n\tset_compound_page_dtor(page, TRANSHUGE_PAGE_DTOR);\n}",
  3225. "project": "linux",
  3226. "hash": 36251465554535299360952724868793398443,
  3227. "size": 10,
  3228. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3229. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3230. "target": 0,
  3231. "dataset": "other",
  3232. "idx": 364122
  3233. },
  3234. {
  3235. "func": "static bool set_huge_zero_page(pgtable_t pgtable, struct mm_struct *mm,\n\t\tstruct vm_area_struct *vma, unsigned long haddr, pmd_t *pmd,\n\t\tstruct page *zero_page)\n{\n\tpmd_t entry;\n\tif (!pmd_none(*pmd))\n\t\treturn false;\n\tentry = mk_pmd(zero_page, vma->vm_page_prot);\n\tentry = pmd_mkhuge(entry);\n\tif (pgtable)\n\t\tpgtable_trans_huge_deposit(mm, pmd, pgtable);\n\tset_pmd_at(mm, haddr, pmd, entry);\n\tmm_inc_nr_ptes(mm);\n\treturn true;\n}",
  3236. "project": "linux",
  3237. "hash": 214089667157610661978204254094844907808,
  3238. "size": 15,
  3239. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  3240. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  3241. "target": 0,
  3242. "dataset": "other",
  3243. "idx": 364135
  3244. }
  3245. ]
  3246. },
  3247. {
  3248. "call_depth": 3,
  3249. "longest_call_chain": [
  3250. "update_recv_secondary_order",
  3251. "update_read_cache_bitmap_v3_order",
  3252. "free_cache_bitmap_v3_order"
  3253. ],
  3254. "group_size": 13,
  3255. "functions": [
  3256. {
  3257. "func": "CACHE_BITMAP_V2_ORDER* copy_cache_bitmap_v2_order(rdpContext* context,\n const CACHE_BITMAP_V2_ORDER* order)\n{\n\tCACHE_BITMAP_V2_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_V2_ORDER));\n\n\tif (!dst || !order)\n\t\tgoto fail;\n\n\t*dst = *order;\n\n\tif (order->bitmapLength > 0)\n\t{\n\t\tdst->bitmapDataStream = malloc(order->bitmapLength);\n\n\t\tif (!dst->bitmapDataStream)\n\t\t\tgoto fail;\n\n\t\tmemcpy(dst->bitmapDataStream, order->bitmapDataStream, order->bitmapLength);\n\t}\n\n\treturn dst;\nfail:\n\tfree_cache_bitmap_v2_order(context, dst);\n\treturn NULL;\n}",
  3258. "project": "FreeRDP",
  3259. "hash": 296333061998125916548086785090753340020,
  3260. "size": 25,
  3261. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  3262. "message": "Fixed possible NULL dereference",
  3263. "target": 0,
  3264. "dataset": "other",
  3265. "idx": 269202
  3266. },
  3267. {
  3268. "func": "static CACHE_BITMAP_V3_ORDER* update_read_cache_bitmap_v3_order(rdpUpdate* update, wStream* s,\n UINT16 flags)\n{\n\tBYTE bitsPerPixelId;\n\tBITMAP_DATA_EX* bitmapData;\n\tUINT32 new_len;\n\tBYTE* new_data;\n\tCACHE_BITMAP_V3_ORDER* cache_bitmap_v3;\n\n\tif (!update || !s)\n\t\treturn NULL;\n\n\tcache_bitmap_v3 = calloc(1, sizeof(CACHE_BITMAP_V3_ORDER));\n\n\tif (!cache_bitmap_v3)\n\t\tgoto fail;\n\n\tcache_bitmap_v3->cacheId = flags & 0x00000003;\n\tcache_bitmap_v3->flags = (flags & 0x0000FF80) >> 7;\n\tbitsPerPixelId = (flags & 0x00000078) >> 3;\n\tcache_bitmap_v3->bpp = CBR23_BPP[bitsPerPixelId];\n\n\tif (Stream_GetRemainingLength(s) < 21)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, cache_bitmap_v3->cacheIndex); /* cacheIndex (2 bytes) */\n\tStream_Read_UINT32(s, cache_bitmap_v3->key1); /* key1 (4 bytes) */\n\tStream_Read_UINT32(s, cache_bitmap_v3->key2); /* key2 (4 bytes) */\n\tbitmapData = &cache_bitmap_v3->bitmapData;\n\tStream_Read_UINT8(s, bitmapData->bpp);\n\n\tif ((bitmapData->bpp < 1) || (bitmapData->bpp > 32))\n\t{\n\t\tWLog_Print(update->log, WLOG_ERROR, \"invalid bpp value %\" PRIu32 \"\", bitmapData->bpp);\n\t\tgoto fail;\n\t}\n\n\tStream_Seek_UINT8(s); /* reserved1 (1 byte) */\n\tStream_Seek_UINT8(s); /* reserved2 (1 byte) */\n\tStream_Read_UINT8(s, bitmapData->codecID); /* codecID (1 byte) */\n\tStream_Read_UINT16(s, bitmapData->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, bitmapData->height); /* height (2 bytes) */\n\tStream_Read_UINT32(s, new_len); /* length (4 bytes) */\n\n\tif (Stream_GetRemainingLength(s) < new_len)\n\t\tgoto fail;\n\n\tnew_data = (BYTE*)realloc(bitmapData->data, new_len);\n\n\tif (!new_data)\n\t\tgoto fail;\n\n\tbitmapData->data = new_data;\n\tbitmapData->length = new_len;\n\tStream_Read(s, bitmapData->data, bitmapData->length);\n\treturn cache_bitmap_v3;\nfail:\n\tfree_cache_bitmap_v3_order(update->context, cache_bitmap_v3);\n\treturn NULL;\n}",
  3269. "project": "FreeRDP",
  3270. "hash": 291583708128739086368313518907899263999,
  3271. "size": 60,
  3272. "commit_id": "67c2aa52b2ae0341d469071d1bc8aab91f8d2ed8",
  3273. "message": "Fixed #6013: Check new length is > 0",
  3274. "target": 1,
  3275. "dataset": "other",
  3276. "idx": 212441
  3277. },
  3278. {
  3279. "func": "static CACHE_BITMAP_V3_ORDER* update_read_cache_bitmap_v3_order(rdpUpdate* update, wStream* s,\n UINT16 flags)\n{\n\tBYTE bitsPerPixelId;\n\tBITMAP_DATA_EX* bitmapData;\n\tUINT32 new_len;\n\tBYTE* new_data;\n\tCACHE_BITMAP_V3_ORDER* cache_bitmap_v3;\n\n\tif (!update || !s)\n\t\treturn NULL;\n\n\tcache_bitmap_v3 = calloc(1, sizeof(CACHE_BITMAP_V3_ORDER));\n\n\tif (!cache_bitmap_v3)\n\t\tgoto fail;\n\n\tcache_bitmap_v3->cacheId = flags & 0x00000003;\n\tcache_bitmap_v3->flags = (flags & 0x0000FF80) >> 7;\n\tbitsPerPixelId = (flags & 0x00000078) >> 3;\n\tcache_bitmap_v3->bpp = CBR23_BPP[bitsPerPixelId];\n\n\tif (Stream_GetRemainingLength(s) < 21)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, cache_bitmap_v3->cacheIndex); /* cacheIndex (2 bytes) */\n\tStream_Read_UINT32(s, cache_bitmap_v3->key1); /* key1 (4 bytes) */\n\tStream_Read_UINT32(s, cache_bitmap_v3->key2); /* key2 (4 bytes) */\n\tbitmapData = &cache_bitmap_v3->bitmapData;\n\tStream_Read_UINT8(s, bitmapData->bpp);\n\n\tif ((bitmapData->bpp < 1) || (bitmapData->bpp > 32))\n\t{\n\t\tWLog_Print(update->log, WLOG_ERROR, \"invalid bpp value %\" PRIu32 \"\", bitmapData->bpp);\n\t\tgoto fail;\n\t}\n\n\tStream_Seek_UINT8(s); /* reserved1 (1 byte) */\n\tStream_Seek_UINT8(s); /* reserved2 (1 byte) */\n\tStream_Read_UINT8(s, bitmapData->codecID); /* codecID (1 byte) */\n\tStream_Read_UINT16(s, bitmapData->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, bitmapData->height); /* height (2 bytes) */\n\tStream_Read_UINT32(s, new_len); /* length (4 bytes) */\n\n\tif ((new_len == 0) || (Stream_GetRemainingLength(s) < new_len))\n\t\tgoto fail;\n\n\tnew_data = (BYTE*)realloc(bitmapData->data, new_len);\n\n\tif (!new_data)\n\t\tgoto fail;\n\n\tbitmapData->data = new_data;\n\tbitmapData->length = new_len;\n\tStream_Read(s, bitmapData->data, bitmapData->length);\n\treturn cache_bitmap_v3;\nfail:\n\tfree_cache_bitmap_v3_order(update->context, cache_bitmap_v3);\n\treturn NULL;\n}",
  3280. "project": "FreeRDP",
  3281. "hash": 77696160753710370793899447687850386826,
  3282. "size": 60,
  3283. "commit_id": "b8beb55913471952f92770c90c372139d78c16c0",
  3284. "message": "Fixed OOB read in update_read_cache_bitmap_v3_order\n\nCVE-2020-11096 thanks @antonio-morales for finding this.",
  3285. "target": 1,
  3286. "dataset": "other",
  3287. "idx": 213355
  3288. },
  3289. {
  3290. "func": "void free_cache_bitmap_v2_order(rdpContext* context, CACHE_BITMAP_V2_ORDER* order)\n{\n\tif (order)\n\t\tfree(order->bitmapDataStream);\n\n\tfree(order);\n}",
  3291. "project": "FreeRDP",
  3292. "hash": 221767611266004245152449704276202565310,
  3293. "size": 7,
  3294. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  3295. "message": "Fixed possible NULL dereference",
  3296. "target": 0,
  3297. "dataset": "other",
  3298. "idx": 269194
  3299. },
  3300. {
  3301. "func": "void free_cache_glyph_order(rdpContext* context, CACHE_GLYPH_ORDER* glyph)\n{\n\tif (glyph)\n\t{\n\t\tsize_t x;\n\n\t\tfor (x = 0; x < ARRAYSIZE(glyph->glyphData); x++)\n\t\t\tfree(glyph->glyphData[x].aj);\n\n\t\tfree(glyph->unicodeCharacters);\n\t}\n\n\tfree(glyph);\n}",
  3302. "project": "FreeRDP",
  3303. "hash": 205192972806593312026876061649317866446,
  3304. "size": 14,
  3305. "commit_id": "c0fd449ec0870b050d350d6d844b1ea6dad4bc7d",
  3306. "message": "Fixed Out-of-bound read in glyph_cache_put\n\nCVE-2020-11098 thanks to @antonio-morales for finding this.",
  3307. "target": 0,
  3308. "dataset": "other",
  3309. "idx": 432855
  3310. },
  3311. {
  3312. "func": "CACHE_GLYPH_V2_ORDER* copy_cache_glyph_v2_order(rdpContext* context,\n const CACHE_GLYPH_V2_ORDER* glyph)\n{\n\tsize_t x;\n\tCACHE_GLYPH_V2_ORDER* dst = calloc(1, sizeof(CACHE_GLYPH_V2_ORDER));\n\n\tif (!dst || !glyph)\n\t\tgoto fail;\n\n\t*dst = *glyph;\n\n\tfor (x = 0; x < glyph->cGlyphs; x++)\n\t{\n\t\tconst GLYPH_DATA_V2* src = &glyph->glyphData[x];\n\t\tGLYPH_DATA_V2* data = &dst->glyphData[x];\n\n\t\tif (src->aj)\n\t\t{\n\t\t\tconst size_t size = src->cb;\n\t\t\tdata->aj = malloc(size);\n\n\t\t\tif (!data->aj)\n\t\t\t\tgoto fail;\n\n\t\t\tmemcpy(data->aj, src->aj, size);\n\t\t}\n\t}\n\n\tif (glyph->unicodeCharacters)\n\t{\n\t\tif (glyph->cGlyphs == 0)\n\t\t\tgoto fail;\n\n\t\tdst->unicodeCharacters = calloc(glyph->cGlyphs, sizeof(WCHAR));\n\n\t\tif (!dst->unicodeCharacters)\n\t\t\tgoto fail;\n\n\t\tmemcpy(dst->unicodeCharacters, glyph->unicodeCharacters, sizeof(WCHAR) * glyph->cGlyphs);\n\t}\n\n\treturn dst;\nfail:\n\tfree_cache_glyph_v2_order(context, dst);\n\treturn NULL;\n}",
  3313. "project": "FreeRDP",
  3314. "hash": 332058525179374455367826884199598206629,
  3315. "size": 46,
  3316. "commit_id": "c0fd449ec0870b050d350d6d844b1ea6dad4bc7d",
  3317. "message": "Fixed Out-of-bound read in glyph_cache_put\n\nCVE-2020-11098 thanks to @antonio-morales for finding this.",
  3318. "target": 0,
  3319. "dataset": "other",
  3320. "idx": 432853
  3321. },
  3322. {
  3323. "func": "void free_cache_glyph_v2_order(rdpContext* context, CACHE_GLYPH_V2_ORDER* glyph)\n{\n\tif (glyph)\n\t{\n\t\tsize_t x;\n\n\t\tfor (x = 0; x < ARRAYSIZE(glyph->glyphData); x++)\n\t\t\tfree(glyph->glyphData[x].aj);\n\n\t\tfree(glyph->unicodeCharacters);\n\t}\n\n\tfree(glyph);\n}",
  3324. "project": "FreeRDP",
  3325. "hash": 95326473378522169881435832165778710407,
  3326. "size": 14,
  3327. "commit_id": "c0fd449ec0870b050d350d6d844b1ea6dad4bc7d",
  3328. "message": "Fixed Out-of-bound read in glyph_cache_put\n\nCVE-2020-11098 thanks to @antonio-morales for finding this.",
  3329. "target": 0,
  3330. "dataset": "other",
  3331. "idx": 432862
  3332. },
  3333. {
  3334. "func": "CACHE_BITMAP_ORDER* copy_cache_bitmap_order(rdpContext* context, const CACHE_BITMAP_ORDER* order)\n{\n\tCACHE_BITMAP_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_ORDER));\n\n\tif (!dst || !order)\n\t\tgoto fail;\n\n\t*dst = *order;\n\n\tif (order->bitmapLength > 0)\n\t{\n\t\tdst->bitmapDataStream = malloc(order->bitmapLength);\n\n\t\tif (!dst->bitmapDataStream)\n\t\t\tgoto fail;\n\n\t\tmemcpy(dst->bitmapDataStream, order->bitmapDataStream, order->bitmapLength);\n\t}\n\n\treturn dst;\nfail:\n\tfree_cache_bitmap_order(context, dst);\n\treturn NULL;\n}",
  3335. "project": "FreeRDP",
  3336. "hash": 194015093638480048603004532078545000067,
  3337. "size": 24,
  3338. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  3339. "message": "Fixed possible NULL dereference",
  3340. "target": 0,
  3341. "dataset": "other",
  3342. "idx": 269191
  3343. },
  3344. {
  3345. "func": "static BOOL update_recv_secondary_order(rdpUpdate* update, wStream* s, BYTE flags)\n{\n\tBOOL rc = FALSE;\n\tBYTE* next;\n\tBYTE orderType;\n\tUINT16 extraFlags;\n\tUINT16 orderLength;\n\trdpContext* context = update->context;\n\trdpSettings* settings = context->settings;\n\trdpSecondaryUpdate* secondary = update->secondary;\n\tconst char* name;\n\n\tif (Stream_GetRemainingLength(s) < 5)\n\t{\n\t\tWLog_Print(update->log, WLOG_ERROR, \"Stream_GetRemainingLength(s) < 5\");\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, orderLength); /* orderLength (2 bytes) */\n\tStream_Read_UINT16(s, extraFlags); /* extraFlags (2 bytes) */\n\tStream_Read_UINT8(s, orderType); /* orderType (1 byte) */\n\tnext = Stream_Pointer(s) + ((INT16)orderLength) + 7;\n\tname = secondary_order_string(orderType);\n\tWLog_Print(update->log, WLOG_DEBUG, \"Secondary Drawing Order %s\", name);\n\n\tif (!check_secondary_order_supported(update->log, settings, orderType, name))\n\t\treturn FALSE;\n\n\tswitch (orderType)\n\t{\n\t\tcase ORDER_TYPE_BITMAP_UNCOMPRESSED:\n\t\tcase ORDER_TYPE_CACHE_BITMAP_COMPRESSED:\n\t\t{\n\t\t\tconst BOOL compressed = (orderType == ORDER_TYPE_CACHE_BITMAP_COMPRESSED);\n\t\t\tCACHE_BITMAP_ORDER* order =\n\t\t\t update_read_cache_bitmap_order(update, s, compressed, extraFlags);\n\n\t\t\tif (order)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, secondary->CacheBitmap, context, order);\n\t\t\t\tfree_cache_bitmap_order(context, order);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase ORDER_TYPE_BITMAP_UNCOMPRESSED_V2:\n\t\tcase ORDER_TYPE_BITMAP_COMPRESSED_V2:\n\t\t{\n\t\t\tconst BOOL compressed = (orderType == ORDER_TYPE_BITMAP_COMPRESSED_V2);\n\t\t\tCACHE_BITMAP_V2_ORDER* order =\n\t\t\t update_read_cache_bitmap_v2_order(update, s, compressed, extraFlags);\n\n\t\t\tif (order)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, secondary->CacheBitmapV2, context, order);\n\t\t\t\tfree_cache_bitmap_v2_order(context, order);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase ORDER_TYPE_BITMAP_COMPRESSED_V3:\n\t\t{\n\t\t\tCACHE_BITMAP_V3_ORDER* order = update_read_cache_bitmap_v3_order(update, s, extraFlags);\n\n\t\t\tif (order)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, secondary->CacheBitmapV3, context, order);\n\t\t\t\tfree_cache_bitmap_v3_order(context, order);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase ORDER_TYPE_CACHE_COLOR_TABLE:\n\t\t{\n\t\t\tCACHE_COLOR_TABLE_ORDER* order =\n\t\t\t update_read_cache_color_table_order(update, s, extraFlags);\n\n\t\t\tif (order)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, secondary->CacheColorTable, context, order);\n\t\t\t\tfree_cache_color_table_order(context, order);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase ORDER_TYPE_CACHE_GLYPH:\n\t\t{\n\t\t\tswitch (settings->GlyphSupportLevel)\n\t\t\t{\n\t\t\t\tcase GLYPH_SUPPORT_PARTIAL:\n\t\t\t\tcase GLYPH_SUPPORT_FULL:\n\t\t\t\t{\n\t\t\t\t\tCACHE_GLYPH_ORDER* order = update_read_cache_glyph_order(update, s, extraFlags);\n\n\t\t\t\t\tif (order)\n\t\t\t\t\t{\n\t\t\t\t\t\trc = IFCALLRESULT(FALSE, secondary->CacheGlyph, context, order);\n\t\t\t\t\t\tfree_cache_glyph_order(context, order);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t\tcase GLYPH_SUPPORT_ENCODE:\n\t\t\t\t{\n\t\t\t\t\tCACHE_GLYPH_V2_ORDER* order =\n\t\t\t\t\t update_read_cache_glyph_v2_order(update, s, extraFlags);\n\n\t\t\t\t\tif (order)\n\t\t\t\t\t{\n\t\t\t\t\t\trc = IFCALLRESULT(FALSE, secondary->CacheGlyphV2, context, order);\n\t\t\t\t\t\tfree_cache_glyph_v2_order(context, order);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\t\tcase GLYPH_SUPPORT_NONE:\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase ORDER_TYPE_CACHE_BRUSH:\n\t\t\t/* [MS-RDPEGDI] 2.2.2.2.1.2.7 Cache Brush (CACHE_BRUSH_ORDER) */\n\t\t\t{\n\t\t\t\tCACHE_BRUSH_ORDER* order = update_read_cache_brush_order(update, s, extraFlags);\n\n\t\t\t\tif (order)\n\t\t\t\t{\n\t\t\t\t\trc = IFCALLRESULT(FALSE, secondary->CacheBrush, context, order);\n\t\t\t\t\tfree_cache_brush_order(context, order);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tWLog_Print(update->log, WLOG_WARN, \"SECONDARY ORDER %s not supported\", name);\n\t\t\tbreak;\n\t}\n\n\tif (!rc)\n\t{\n\t\tWLog_Print(update->log, WLOG_ERROR, \"SECONDARY ORDER %s failed\", name);\n\t}\n\n\tStream_SetPointer(s, next);\n\treturn rc;\n}",
  3346. "project": "FreeRDP",
  3347. "hash": 156867765287874217204946411442748727742,
  3348. "size": 148,
  3349. "commit_id": "192856cb59974ee4d7d3e72cbeafa676aa7565cf",
  3350. "message": "Fixed #6012: CVE-2020-11526: Out of bounds read in update_recv_orders\n\nThanks to @hac425xxx and Sunglin and HuanGMz from Knownsec 404",
  3351. "target": 1,
  3352. "dataset": "other",
  3353. "idx": 207756
  3354. },
  3355. {
  3356. "func": "CACHE_BITMAP_V3_ORDER* copy_cache_bitmap_v3_order(rdpContext* context,\n const CACHE_BITMAP_V3_ORDER* order)\n{\n\tCACHE_BITMAP_V3_ORDER* dst = calloc(1, sizeof(CACHE_BITMAP_V3_ORDER));\n\n\tif (!dst || !order)\n\t\tgoto fail;\n\n\t*dst = *order;\n\n\tif (order->bitmapData.length > 0)\n\t{\n\t\tdst->bitmapData.data = malloc(order->bitmapData.length);\n\n\t\tif (!dst->bitmapData.data)\n\t\t\tgoto fail;\n\n\t\tmemcpy(dst->bitmapData.data, order->bitmapData.data, order->bitmapData.length);\n\t}\n\n\treturn dst;\nfail:\n\tfree_cache_bitmap_v3_order(context, dst);\n\treturn NULL;\n}",
  3357. "project": "FreeRDP",
  3358. "hash": 210881049528549885989360453768631656819,
  3359. "size": 25,
  3360. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  3361. "message": "Fixed possible NULL dereference",
  3362. "target": 0,
  3363. "dataset": "other",
  3364. "idx": 269198
  3365. },
  3366. {
  3367. "func": "void free_cache_bitmap_order(rdpContext* context, CACHE_BITMAP_ORDER* order)\n{\n\tif (order)\n\t\tfree(order->bitmapDataStream);\n\n\tfree(order);\n}",
  3368. "project": "FreeRDP",
  3369. "hash": 37091885076933477361756036580488597291,
  3370. "size": 7,
  3371. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  3372. "message": "Fixed possible NULL dereference",
  3373. "target": 0,
  3374. "dataset": "other",
  3375. "idx": 269197
  3376. },
  3377. {
  3378. "func": "void free_cache_bitmap_v3_order(rdpContext* context, CACHE_BITMAP_V3_ORDER* order)\n{\n\tif (order)\n\t\tfree(order->bitmapData.data);\n\n\tfree(order);\n}",
  3379. "project": "FreeRDP",
  3380. "hash": 169573674798552902886578508623593668300,
  3381. "size": 7,
  3382. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  3383. "message": "Fixed possible NULL dereference",
  3384. "target": 0,
  3385. "dataset": "other",
  3386. "idx": 269193
  3387. },
  3388. {
  3389. "func": "CACHE_GLYPH_ORDER* copy_cache_glyph_order(rdpContext* context, const CACHE_GLYPH_ORDER* glyph)\n{\n\tsize_t x;\n\tCACHE_GLYPH_ORDER* dst = calloc(1, sizeof(CACHE_GLYPH_ORDER));\n\n\tif (!dst || !glyph)\n\t\tgoto fail;\n\n\t*dst = *glyph;\n\n\tfor (x = 0; x < glyph->cGlyphs; x++)\n\t{\n\t\tconst GLYPH_DATA* src = &glyph->glyphData[x];\n\t\tGLYPH_DATA* data = &dst->glyphData[x];\n\n\t\tif (src->aj)\n\t\t{\n\t\t\tconst size_t size = src->cb;\n\t\t\tdata->aj = malloc(size);\n\n\t\t\tif (!data->aj)\n\t\t\t\tgoto fail;\n\n\t\t\tmemcpy(data->aj, src->aj, size);\n\t\t}\n\t}\n\n\tif (glyph->unicodeCharacters)\n\t{\n\t\tif (glyph->cGlyphs == 0)\n\t\t\tgoto fail;\n\n\t\tdst->unicodeCharacters = calloc(glyph->cGlyphs, sizeof(WCHAR));\n\n\t\tif (!dst->unicodeCharacters)\n\t\t\tgoto fail;\n\n\t\tmemcpy(dst->unicodeCharacters, glyph->unicodeCharacters, sizeof(WCHAR) * glyph->cGlyphs);\n\t}\n\n\treturn dst;\nfail:\n\tfree_cache_glyph_order(context, dst);\n\treturn NULL;\n}",
  3390. "project": "FreeRDP",
  3391. "hash": 134562887397399806706260166032444547857,
  3392. "size": 45,
  3393. "commit_id": "c0fd449ec0870b050d350d6d844b1ea6dad4bc7d",
  3394. "message": "Fixed Out-of-bound read in glyph_cache_put\n\nCVE-2020-11098 thanks to @antonio-morales for finding this.",
  3395. "target": 0,
  3396. "dataset": "other",
  3397. "idx": 432865
  3398. }
  3399. ]
  3400. },
  3401. {
  3402. "call_depth": 4,
  3403. "longest_call_chain": [
  3404. "xdp_umem_release_deferred",
  3405. "xdp_umem_release",
  3406. "xdp_umem_clear_dev",
  3407. "xdp_clear_umem_at_qid"
  3408. ],
  3409. "group_size": 14,
  3410. "functions": [
  3411. {
  3412. "func": "static int xdp_umem_account_pages(struct xdp_umem *umem)\n{\n\tunsigned long lock_limit, new_npgs, old_npgs;\n\n\tif (capable(CAP_IPC_LOCK))\n\t\treturn 0;\n\n\tlock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;\n\tumem->user = get_uid(current_user());\n\n\tdo {\n\t\told_npgs = atomic_long_read(&umem->user->locked_vm);\n\t\tnew_npgs = old_npgs + umem->npgs;\n\t\tif (new_npgs > lock_limit) {\n\t\t\tfree_uid(umem->user);\n\t\t\tumem->user = NULL;\n\t\t\treturn -ENOBUFS;\n\t\t}\n\t} while (atomic_long_cmpxchg(&umem->user->locked_vm, old_npgs,\n\t\t\t\t new_npgs) != old_npgs);\n\treturn 0;\n}",
  3413. "project": "linux",
  3414. "hash": 268538672441488282436843170881902415474,
  3415. "size": 22,
  3416. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3417. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3418. "target": 0,
  3419. "dataset": "other",
  3420. "idx": 364111
  3421. },
  3422. {
  3423. "func": "static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)\n{\n\tbool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;\n\tu32 chunk_size = mr->chunk_size, headroom = mr->headroom;\n\tunsigned int chunks, chunks_per_page;\n\tu64 addr = mr->addr, size = mr->len;\n\tint size_chk, err;\n\n\tif (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {\n\t\t/* Strictly speaking we could support this, if:\n\t\t * - huge pages, or*\n\t\t * - using an IOMMU, or\n\t\t * - making sure the memory area is consecutive\n\t\t * but for now, we simply say \"computer says no\".\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif (mr->flags & ~(XDP_UMEM_UNALIGNED_CHUNK_FLAG |\n\t\t\tXDP_UMEM_USES_NEED_WAKEUP))\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks && !is_power_of_2(chunk_size))\n\t\treturn -EINVAL;\n\n\tif (!PAGE_ALIGNED(addr)) {\n\t\t/* Memory area has to be page size aligned. For\n\t\t * simplicity, this might change.\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif ((addr + size) < addr)\n\t\treturn -EINVAL;\n\n\tchunks = (unsigned int)div_u64(size, chunk_size);\n\tif (chunks == 0)\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks) {\n\t\tchunks_per_page = PAGE_SIZE / chunk_size;\n\t\tif (chunks < chunks_per_page || chunks % chunks_per_page)\n\t\t\treturn -EINVAL;\n\t}\n\n\tsize_chk = chunk_size - headroom - XDP_PACKET_HEADROOM;\n\tif (size_chk < 0)\n\t\treturn -EINVAL;\n\n\tumem->address = (unsigned long)addr;\n\tumem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK\n\t\t\t\t\t : ~((u64)chunk_size - 1);\n\tumem->size = size;\n\tumem->headroom = headroom;\n\tumem->chunk_size_nohr = chunk_size - headroom;\n\tumem->npgs = size / PAGE_SIZE;\n\tumem->pgs = NULL;\n\tumem->user = NULL;\n\tumem->flags = mr->flags;\n\tINIT_LIST_HEAD(&umem->xsk_list);\n\tspin_lock_init(&umem->xsk_list_lock);\n\n\trefcount_set(&umem->users, 1);\n\n\terr = xdp_umem_account_pages(umem);\n\tif (err)\n\t\treturn err;\n\n\terr = xdp_umem_pin_pages(umem);\n\tif (err)\n\t\tgoto out_account;\n\n\tumem->pages = kvcalloc(umem->npgs, sizeof(*umem->pages),\n\t\t\t GFP_KERNEL_ACCOUNT);\n\tif (!umem->pages) {\n\t\terr = -ENOMEM;\n\t\tgoto out_pin;\n\t}\n\n\terr = xdp_umem_map_pages(umem);\n\tif (!err)\n\t\treturn 0;\n\n\tkvfree(umem->pages);\n\nout_pin:\n\txdp_umem_unpin_pages(umem);\nout_account:\n\txdp_umem_unaccount_pages(umem);\n\treturn err;\n}",
  3424. "project": "linux",
  3425. "hash": 269028637877237764370672455302491205384,
  3426. "size": 91,
  3427. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3428. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3429. "target": 1,
  3430. "dataset": "other",
  3431. "idx": 204723
  3432. },
  3433. {
  3434. "func": "static int xdp_umem_reg(struct xdp_umem *umem, struct xdp_umem_reg *mr)\n{\n\tbool unaligned_chunks = mr->flags & XDP_UMEM_UNALIGNED_CHUNK_FLAG;\n\tu32 chunk_size = mr->chunk_size, headroom = mr->headroom;\n\tunsigned int chunks, chunks_per_page;\n\tu64 addr = mr->addr, size = mr->len;\n\tint err;\n\n\tif (chunk_size < XDP_UMEM_MIN_CHUNK_SIZE || chunk_size > PAGE_SIZE) {\n\t\t/* Strictly speaking we could support this, if:\n\t\t * - huge pages, or*\n\t\t * - using an IOMMU, or\n\t\t * - making sure the memory area is consecutive\n\t\t * but for now, we simply say \"computer says no\".\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif (mr->flags & ~(XDP_UMEM_UNALIGNED_CHUNK_FLAG |\n\t\t\tXDP_UMEM_USES_NEED_WAKEUP))\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks && !is_power_of_2(chunk_size))\n\t\treturn -EINVAL;\n\n\tif (!PAGE_ALIGNED(addr)) {\n\t\t/* Memory area has to be page size aligned. For\n\t\t * simplicity, this might change.\n\t\t */\n\t\treturn -EINVAL;\n\t}\n\n\tif ((addr + size) < addr)\n\t\treturn -EINVAL;\n\n\tchunks = (unsigned int)div_u64(size, chunk_size);\n\tif (chunks == 0)\n\t\treturn -EINVAL;\n\n\tif (!unaligned_chunks) {\n\t\tchunks_per_page = PAGE_SIZE / chunk_size;\n\t\tif (chunks < chunks_per_page || chunks % chunks_per_page)\n\t\t\treturn -EINVAL;\n\t}\n\n\tif (headroom >= chunk_size - XDP_PACKET_HEADROOM)\n\t\treturn -EINVAL;\n\n\tumem->address = (unsigned long)addr;\n\tumem->chunk_mask = unaligned_chunks ? XSK_UNALIGNED_BUF_ADDR_MASK\n\t\t\t\t\t : ~((u64)chunk_size - 1);\n\tumem->size = size;\n\tumem->headroom = headroom;\n\tumem->chunk_size_nohr = chunk_size - headroom;\n\tumem->npgs = size / PAGE_SIZE;\n\tumem->pgs = NULL;\n\tumem->user = NULL;\n\tumem->flags = mr->flags;\n\tINIT_LIST_HEAD(&umem->xsk_list);\n\tspin_lock_init(&umem->xsk_list_lock);\n\n\trefcount_set(&umem->users, 1);\n\n\terr = xdp_umem_account_pages(umem);\n\tif (err)\n\t\treturn err;\n\n\terr = xdp_umem_pin_pages(umem);\n\tif (err)\n\t\tgoto out_account;\n\n\tumem->pages = kvcalloc(umem->npgs, sizeof(*umem->pages),\n\t\t\t GFP_KERNEL_ACCOUNT);\n\tif (!umem->pages) {\n\t\terr = -ENOMEM;\n\t\tgoto out_pin;\n\t}\n\n\terr = xdp_umem_map_pages(umem);\n\tif (!err)\n\t\treturn 0;\n\n\tkvfree(umem->pages);\n\nout_pin:\n\txdp_umem_unpin_pages(umem);\nout_account:\n\txdp_umem_unaccount_pages(umem);\n\treturn err;\n}",
  3435. "project": "linux",
  3436. "hash": 42054657955985470671897377670619516821,
  3437. "size": 90,
  3438. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3439. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3440. "target": 0,
  3441. "dataset": "other",
  3442. "idx": 364107
  3443. },
  3444. {
  3445. "func": "static void xdp_umem_release(struct xdp_umem *umem)\n{\n\trtnl_lock();\n\txdp_umem_clear_dev(umem);\n\trtnl_unlock();\n\n\tida_simple_remove(&umem_ida, umem->id);\n\n\tif (umem->fq) {\n\t\txskq_destroy(umem->fq);\n\t\tumem->fq = NULL;\n\t}\n\n\tif (umem->cq) {\n\t\txskq_destroy(umem->cq);\n\t\tumem->cq = NULL;\n\t}\n\n\txsk_reuseq_destroy(umem);\n\n\txdp_umem_unmap_pages(umem);\n\txdp_umem_unpin_pages(umem);\n\n\tkvfree(umem->pages);\n\tumem->pages = NULL;\n\n\txdp_umem_unaccount_pages(umem);\n\tkfree(umem);\n}",
  3446. "project": "linux",
  3447. "hash": 217396931244922685619923757724925916399,
  3448. "size": 29,
  3449. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3450. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3451. "target": 0,
  3452. "dataset": "other",
  3453. "idx": 364104
  3454. },
  3455. {
  3456. "func": "static void xdp_umem_unaccount_pages(struct xdp_umem *umem)\n{\n\tif (umem->user) {\n\t\tatomic_long_sub(umem->npgs, &umem->user->locked_vm);\n\t\tfree_uid(umem->user);\n\t}\n}",
  3457. "project": "linux",
  3458. "hash": 247610559453453652885989910169467502202,
  3459. "size": 7,
  3460. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3461. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3462. "target": 0,
  3463. "dataset": "other",
  3464. "idx": 364102
  3465. },
  3466. {
  3467. "func": "int xdp_umem_assign_dev(struct xdp_umem *umem, struct net_device *dev,\n\t\t\tu16 queue_id, u16 flags)\n{\n\tbool force_zc, force_copy;\n\tstruct netdev_bpf bpf;\n\tint err = 0;\n\n\tASSERT_RTNL();\n\n\tforce_zc = flags & XDP_ZEROCOPY;\n\tforce_copy = flags & XDP_COPY;\n\n\tif (force_zc && force_copy)\n\t\treturn -EINVAL;\n\n\tif (xdp_get_umem_from_qid(dev, queue_id))\n\t\treturn -EBUSY;\n\n\terr = xdp_reg_umem_at_qid(dev, umem, queue_id);\n\tif (err)\n\t\treturn err;\n\n\tumem->dev = dev;\n\tumem->queue_id = queue_id;\n\n\tif (flags & XDP_USE_NEED_WAKEUP) {\n\t\tumem->flags |= XDP_UMEM_USES_NEED_WAKEUP;\n\t\t/* Tx needs to be explicitly woken up the first time.\n\t\t * Also for supporting drivers that do not implement this\n\t\t * feature. They will always have to call sendto().\n\t\t */\n\t\txsk_set_tx_need_wakeup(umem);\n\t}\n\n\tdev_hold(dev);\n\n\tif (force_copy)\n\t\t/* For copy-mode, we are done. */\n\t\treturn 0;\n\n\tif (!dev->netdev_ops->ndo_bpf || !dev->netdev_ops->ndo_xsk_wakeup) {\n\t\terr = -EOPNOTSUPP;\n\t\tgoto err_unreg_umem;\n\t}\n\n\tbpf.command = XDP_SETUP_XSK_UMEM;\n\tbpf.xsk.umem = umem;\n\tbpf.xsk.queue_id = queue_id;\n\n\terr = dev->netdev_ops->ndo_bpf(dev, &bpf);\n\tif (err)\n\t\tgoto err_unreg_umem;\n\n\tumem->zc = true;\n\treturn 0;\n\nerr_unreg_umem:\n\tif (!force_zc)\n\t\terr = 0; /* fallback to copy mode */\n\tif (err)\n\t\txdp_clear_umem_at_qid(dev, queue_id);\n\treturn err;\n}",
  3468. "project": "linux",
  3469. "hash": 126635444260904263682819293481218507053,
  3470. "size": 63,
  3471. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3472. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3473. "target": 0,
  3474. "dataset": "other",
  3475. "idx": 364110
  3476. },
  3477. {
  3478. "func": "static void xdp_umem_unpin_pages(struct xdp_umem *umem)\n{\n\tunpin_user_pages_dirty_lock(umem->pgs, umem->npgs, true);\n\n\tkfree(umem->pgs);\n\tumem->pgs = NULL;\n}",
  3479. "project": "linux",
  3480. "hash": 254606291712845223014071918045503359746,
  3481. "size": 7,
  3482. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3483. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3484. "target": 0,
  3485. "dataset": "other",
  3486. "idx": 364117
  3487. },
  3488. {
  3489. "func": "static void xdp_clear_umem_at_qid(struct net_device *dev, u16 queue_id)\n{\n\tif (queue_id < dev->real_num_rx_queues)\n\t\tdev->_rx[queue_id].umem = NULL;\n\tif (queue_id < dev->real_num_tx_queues)\n\t\tdev->_tx[queue_id].umem = NULL;\n}",
  3490. "project": "linux",
  3491. "hash": 104632601349284797194213397935015920102,
  3492. "size": 7,
  3493. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3494. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3495. "target": 0,
  3496. "dataset": "other",
  3497. "idx": 364103
  3498. },
  3499. {
  3500. "func": "static int xdp_umem_map_pages(struct xdp_umem *umem)\n{\n\tunsigned int i;\n\tvoid *addr;\n\n\tfor (i = 0; i < umem->npgs; i++) {\n\t\tif (PageHighMem(umem->pgs[i]))\n\t\t\taddr = vmap(&umem->pgs[i], 1, VM_MAP, PAGE_KERNEL);\n\t\telse\n\t\t\taddr = page_address(umem->pgs[i]);\n\n\t\tif (!addr) {\n\t\t\txdp_umem_unmap_pages(umem);\n\t\t\treturn -ENOMEM;\n\t\t}\n\n\t\tumem->pages[i].addr = addr;\n\t}\n\n\treturn 0;\n}",
  3501. "project": "linux",
  3502. "hash": 50613713072544451655542689635667364971,
  3503. "size": 21,
  3504. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3505. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3506. "target": 0,
  3507. "dataset": "other",
  3508. "idx": 364113
  3509. },
  3510. {
  3511. "func": "static void xdp_umem_release_deferred(struct work_struct *work)\n{\n\tstruct xdp_umem *umem = container_of(work, struct xdp_umem, work);\n\n\txdp_umem_release(umem);\n}",
  3512. "project": "linux",
  3513. "hash": 96177688199214672207149422695399068976,
  3514. "size": 6,
  3515. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3516. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3517. "target": 0,
  3518. "dataset": "other",
  3519. "idx": 364114
  3520. },
  3521. {
  3522. "func": "static int xdp_reg_umem_at_qid(struct net_device *dev, struct xdp_umem *umem,\n\t\t\t u16 queue_id)\n{\n\tif (queue_id >= max_t(unsigned int,\n\t\t\t dev->real_num_rx_queues,\n\t\t\t dev->real_num_tx_queues))\n\t\treturn -EINVAL;\n\n\tif (queue_id < dev->real_num_rx_queues)\n\t\tdev->_rx[queue_id].umem = umem;\n\tif (queue_id < dev->real_num_tx_queues)\n\t\tdev->_tx[queue_id].umem = umem;\n\n\treturn 0;\n}",
  3523. "project": "linux",
  3524. "hash": 234138038399570815048179683194141842007,
  3525. "size": 15,
  3526. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3527. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3528. "target": 0,
  3529. "dataset": "other",
  3530. "idx": 364101
  3531. },
  3532. {
  3533. "func": "static void xdp_umem_unmap_pages(struct xdp_umem *umem)\n{\n\tunsigned int i;\n\n\tfor (i = 0; i < umem->npgs; i++)\n\t\tif (PageHighMem(umem->pgs[i]))\n\t\t\tvunmap(umem->pages[i].addr);\n}",
  3534. "project": "linux",
  3535. "hash": 146591201870171263235681356786529738192,
  3536. "size": 8,
  3537. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3538. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3539. "target": 0,
  3540. "dataset": "other",
  3541. "idx": 364116
  3542. },
  3543. {
  3544. "func": "void xdp_umem_clear_dev(struct xdp_umem *umem)\n{\n\tstruct netdev_bpf bpf;\n\tint err;\n\n\tASSERT_RTNL();\n\n\tif (!umem->dev)\n\t\treturn;\n\n\tif (umem->zc) {\n\t\tbpf.command = XDP_SETUP_XSK_UMEM;\n\t\tbpf.xsk.umem = NULL;\n\t\tbpf.xsk.queue_id = umem->queue_id;\n\n\t\terr = umem->dev->netdev_ops->ndo_bpf(umem->dev, &bpf);\n\n\t\tif (err)\n\t\t\tWARN(1, \"failed to disable umem!\\n\");\n\t}\n\n\txdp_clear_umem_at_qid(umem->dev, umem->queue_id);\n\n\tdev_put(umem->dev);\n\tumem->dev = NULL;\n\tumem->zc = false;\n}",
  3545. "project": "linux",
  3546. "hash": 98411041127965363436279721513388452524,
  3547. "size": 27,
  3548. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3549. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3550. "target": 0,
  3551. "dataset": "other",
  3552. "idx": 364099
  3553. },
  3554. {
  3555. "func": "static int xdp_umem_pin_pages(struct xdp_umem *umem)\n{\n\tunsigned int gup_flags = FOLL_WRITE;\n\tlong npgs;\n\tint err;\n\n\tumem->pgs = kcalloc(umem->npgs, sizeof(*umem->pgs),\n\t\t\t GFP_KERNEL | __GFP_NOWARN);\n\tif (!umem->pgs)\n\t\treturn -ENOMEM;\n\n\tdown_read(&current->mm->mmap_sem);\n\tnpgs = pin_user_pages(umem->address, umem->npgs,\n\t\t\t gup_flags | FOLL_LONGTERM, &umem->pgs[0], NULL);\n\tup_read(&current->mm->mmap_sem);\n\n\tif (npgs != umem->npgs) {\n\t\tif (npgs >= 0) {\n\t\t\tumem->npgs = npgs;\n\t\t\terr = -ENOMEM;\n\t\t\tgoto out_pin;\n\t\t}\n\t\terr = npgs;\n\t\tgoto out_pgs;\n\t}\n\treturn 0;\n\nout_pin:\n\txdp_umem_unpin_pages(umem);\nout_pgs:\n\tkfree(umem->pgs);\n\tumem->pgs = NULL;\n\treturn err;\n}",
  3556. "project": "linux",
  3557. "hash": 313636902645447711638277821491787845349,
  3558. "size": 34,
  3559. "commit_id": "99e3a236dd43d06c65af0a2ef9cb44306aef6e02",
  3560. "message": "xsk: Add missing check on user supplied headroom size\n\nAdd a check that the headroom cannot be larger than the available\nspace in the chunk. In the current code, a malicious user can set the\nheadroom to a value larger than the chunk size minus the fixed XDP\nheadroom. That way packets with a length larger than the supported\nsize in the umem could get accepted and result in an out-of-bounds\nwrite.\n\nFixes: c0c77d8fb787 (\"xsk: add user memory registration support sockopt\")\nReported-by: Bui Quang Minh <minhquangbui99@gmail.com>\nSigned-off-by: Magnus Karlsson <magnus.karlsson@intel.com>\nSigned-off-by: Daniel Borkmann <daniel@iogearbox.net>\nLink: https://bugzilla.kernel.org/show_bug.cgi?id=207225\nLink: https://lore.kernel.org/bpf/1586849715-23490-1-git-send-email-magnus.karlsson@intel.com",
  3561. "target": 0,
  3562. "dataset": "other",
  3563. "idx": 364115
  3564. }
  3565. ]
  3566. },
  3567. {
  3568. "call_depth": 3,
  3569. "longest_call_chain": [
  3570. "strcpy",
  3571. "FPRINTF",
  3572. "int_error"
  3573. ],
  3574. "group_size": 11,
  3575. "functions": [
  3576. {
  3577. "func": "mk_env_string (name, value)\n const char *name, *value;\n{\n int name_len, value_len;\n char\t*p;\n\n name_len = strlen (name);\n value_len = STRLEN (value);\n p = (char *)xmalloc (2 + name_len + value_len);\n strcpy (p, name);\n p[name_len] = '=';\n if (value && *value)\n strcpy (p + name_len + 1, value);\n else\n p[name_len + 1] = '\\0';\n return (p);\n}",
  3578. "project": "bash",
  3579. "hash": 210912462216513730843145064806343527172,
  3580. "size": 17,
  3581. "commit_id": "863d31ae775d56b785dc5b0105b6d251515d81d5",
  3582. "message": "commit bash-20120224 snapshot",
  3583. "target": 0,
  3584. "dataset": "other",
  3585. "idx": 379374
  3586. },
  3587. {
  3588. "func": "put_gnu_argv_flags_into_env (pid, flags_string)\n intmax_t pid;\n char *flags_string;\n{\n char *dummy, *pbuf;\n int l, fl;\n\n pbuf = itos (pid);\n l = strlen (pbuf);\n\n fl = strlen (flags_string);\n\n dummy = (char *)xmalloc (l + fl + 30);\n dummy[0] = '_';\n strcpy (dummy + 1, pbuf);\n strcpy (dummy + 1 + l, \"_GNU_nonoption_argv_flags_\");\n dummy[l + 27] = '=';\n strcpy (dummy + l + 28, flags_string);\n\n free (pbuf);\n\n export_env = add_or_supercede_exported_var (dummy, 0);\n}",
  3589. "project": "bash",
  3590. "hash": 299609612077231472911037381966990061404,
  3591. "size": 23,
  3592. "commit_id": "863d31ae775d56b785dc5b0105b6d251515d81d5",
  3593. "message": "commit bash-20120224 snapshot",
  3594. "target": 0,
  3595. "dataset": "other",
  3596. "idx": 379483
  3597. },
  3598. {
  3599. "func": "update_export_env_inplace (env_prefix, preflen, value)\n char *env_prefix;\n int preflen;\n char *value;\n{\n char *evar;\n\n evar = (char *)xmalloc (STRLEN (value) + preflen + 1);\n strcpy (evar, env_prefix);\n if (value)\n strcpy (evar + preflen, value);\n export_env = add_or_supercede_exported_var (evar, 0);\n}",
  3600. "project": "bash",
  3601. "hash": 294853108275349592107125389728478073882,
  3602. "size": 13,
  3603. "commit_id": "863d31ae775d56b785dc5b0105b6d251515d81d5",
  3604. "message": "commit bash-20120224 snapshot",
  3605. "target": 0,
  3606. "dataset": "other",
  3607. "idx": 379569
  3608. },
  3609. {
  3610. "func": "assign_string (char **pvar, char *value)\n{\n char *p = xrealloc (*pvar, strlen (value) + 1);\n strcpy (p, value);\n *pvar = p;\n}",
  3611. "target": 0,
  3612. "cwe": [
  3613. "CWE-190"
  3614. ],
  3615. "project": "cpio",
  3616. "commit_id": "dd96882877721703e19272fe25034560b794061b",
  3617. "hash": 223890895103693535028760049566072890053,
  3618. "size": 6,
  3619. "message": "Rewrite dynamic string support.\n\n* src/dstring.c (ds_init): Take a single argument.\n(ds_free): New function.\n(ds_resize): Take a single argument. Use x2nrealloc to expand\nthe storage.\n(ds_reset,ds_append,ds_concat,ds_endswith): New function.\n(ds_fgetstr): Rewrite. In particular, this fixes integer overflow.\n* src/dstring.h (dynamic_string): Keep both the allocated length\n(ds_size) and index of the next free byte in the string (ds_idx).\n(ds_init,ds_resize): Change signature.\n(ds_len): New macro.\n(ds_free,ds_reset,ds_append,ds_concat,ds_endswith): New protos.\n* src/copyin.c: Use new ds_ functions.\n* src/copyout.c: Likewise.\n* src/copypass.c: Likewise.\n* src/util.c: Likewise.",
  3620. "dataset": "other",
  3621. "idx": 499708
  3622. },
  3623. {
  3624. "func": "stylefont(const char *fontname, TBOOLEAN isbold, TBOOLEAN isitalic)\n{\n int div;\n char *markup = gp_alloc( strlen(fontname) + 16, \"font markup\");\n strcpy(markup, fontname);\n /* base font name can be followed by ,<size> or :Variant */\n if ((div = strcspn(markup,\",:\")))\n\tmarkup[div] = '\\0';\n if (isbold)\n\tstrcat(markup, \":Bold\");\n if (isitalic)\n\tstrcat(markup, \":Italic\");\n\n FPRINTF((stderr, \"MARKUP FONT: %s -> %s\\n\", fontname, markup));\n return markup;\n}",
  3625. "target": 0,
  3626. "cwe": [
  3627. "CWE-787"
  3628. ],
  3629. "project": "gnuplot",
  3630. "commit_id": "963c7df3e0c5266efff260d0dff757dfe03d3632",
  3631. "hash": 221400835128564701357109709082557739196,
  3632. "size": 16,
  3633. "message": "Better error handling for faulty font syntax\n\nA missing close-quote in an enhanced text font specification could\ncause a segfault.\nBug #2303",
  3634. "dataset": "other",
  3635. "idx": 506583
  3636. },
  3637. {
  3638. "func": "term_start_multiplot()\n{\n FPRINTF((stderr, \"term_start_multiplot()\\n\"));\n multiplot_start();\n#ifdef USE_MOUSE\n UpdateStatusline();\n#endif\n}",
  3639. "target": 0,
  3640. "cwe": [
  3641. "CWE-787"
  3642. ],
  3643. "project": "gnuplot",
  3644. "commit_id": "963c7df3e0c5266efff260d0dff757dfe03d3632",
  3645. "hash": 58141844531723157650231985193655293573,
  3646. "size": 8,
  3647. "message": "Better error handling for faulty font syntax\n\nA missing close-quote in an enhanced text font specification could\ncause a segfault.\nBug #2303",
  3648. "dataset": "other",
  3649. "idx": 506582
  3650. },
  3651. {
  3652. "func": "term_check_multiplot_okay(TBOOLEAN f_interactive)\n{\n FPRINTF((stderr, \"term_multiplot_okay(%d)\\n\", f_interactive));\n\n if (!term_initialised)\n\treturn; /* they've not started yet */\n\n /* make sure that it is safe to issue an interactive prompt\n * it is safe if\n * it is not an interactive read, or\n * the terminal supports interactive multiplot, or\n * we are not writing to stdout and terminal doesn't\n * refuse multiplot outright\n */\n if (!f_interactive || (term->flags & TERM_CAN_MULTIPLOT) ||\n\t((gpoutfile != stdout) && !(term->flags & TERM_CANNOT_MULTIPLOT))\n\t) {\n\t/* it's okay to use multiplot here, but suspend first */\n\tterm_suspend();\n\treturn;\n }\n /* uh oh: they're not allowed to be in multiplot here */\n\n term_end_multiplot();\n\n /* at this point we know that it is interactive and that the\n * terminal can either only do multiplot when writing to\n * to a file, or it does not do multiplot at all\n */\n\n if (term->flags & TERM_CANNOT_MULTIPLOT)\n\tint_error(NO_CARET, \"This terminal does not support multiplot\");\n else\n\tint_error(NO_CARET, \"Must set output to a file or put all multiplot commands on one input line\");\n}",
  3653. "target": 0,
  3654. "cwe": [
  3655. "CWE-787"
  3656. ],
  3657. "project": "gnuplot",
  3658. "commit_id": "963c7df3e0c5266efff260d0dff757dfe03d3632",
  3659. "hash": 135695253295517626706309145417227311762,
  3660. "size": 35,
  3661. "message": "Better error handling for faulty font syntax\n\nA missing close-quote in an enhanced text font specification could\ncause a segfault.\nBug #2303",
  3662. "dataset": "other",
  3663. "idx": 506603
  3664. },
  3665. {
  3666. "func": "stats_command()\n{\n#ifdef USE_STATS\n statsrequest();\n#else\n int_error(NO_CARET,\"This copy of gnuplot was not configured with support for the stats command\");\n#endif\n}",
  3667. "target": 0,
  3668. "cwe": [
  3669. "CWE-415"
  3670. ],
  3671. "project": "gnuplot",
  3672. "commit_id": "052cbd17c3cbbc602ee080b2617d32a8417d7563",
  3673. "hash": 96749858619889230295498705379399258983,
  3674. "size": 8,
  3675. "message": "successive failures of \"set print <foo>\" could cause double-free\nBug #2312",
  3676. "dataset": "other",
  3677. "idx": 506517
  3678. },
  3679. {
  3680. "func": "update_command()\n{\n int_error(NO_CARET, \"DEPRECATED command 'update', please use 'save fit' instead\");\n}",
  3681. "target": 0,
  3682. "cwe": [
  3683. "CWE-415"
  3684. ],
  3685. "project": "gnuplot",
  3686. "commit_id": "052cbd17c3cbbc602ee080b2617d32a8417d7563",
  3687. "hash": 194252680971822072527739673533196355651,
  3688. "size": 4,
  3689. "message": "successive failures of \"set print <foo>\" could cause double-free\nBug #2312",
  3690. "dataset": "other",
  3691. "idx": 506553
  3692. },
  3693. {
  3694. "func": "null_scale(double x, double y)\n{\n (void) x; /* avoid -Wunused warning */\n (void) y;\n int_error(NO_CARET, \"Attempt to call deprecated terminal function\");\n return FALSE; /* can't be done */\n}",
  3695. "target": 0,
  3696. "cwe": [
  3697. "CWE-787"
  3698. ],
  3699. "project": "gnuplot",
  3700. "commit_id": "963c7df3e0c5266efff260d0dff757dfe03d3632",
  3701. "hash": 9300924069147076799766333577949355387,
  3702. "size": 7,
  3703. "message": "Better error handling for faulty font syntax\n\nA missing close-quote in an enhanced text font specification could\ncause a segfault.\nBug #2303",
  3704. "dataset": "other",
  3705. "idx": 506618
  3706. },
  3707. {
  3708. "func": "string_expand_macros()\n{\n\tif (expand_1level_macros() && expand_1level_macros()\n\t&& expand_1level_macros() && expand_1level_macros())\n\t int_error(NO_CARET, \"Macros nested too deeply\");\n}",
  3709. "target": 0,
  3710. "cwe": [
  3711. "CWE-415"
  3712. ],
  3713. "project": "gnuplot",
  3714. "commit_id": "052cbd17c3cbbc602ee080b2617d32a8417d7563",
  3715. "hash": 299807278727130784107005395103776063523,
  3716. "size": 6,
  3717. "message": "successive failures of \"set print <foo>\" could cause double-free\nBug #2312",
  3718. "dataset": "other",
  3719. "idx": 506542
  3720. }
  3721. ]
  3722. },
  3723. {
  3724. "call_depth": 3,
  3725. "longest_call_chain": [
  3726. "mwifiex_deauthenticate_all",
  3727. "mwifiex_deauthenticate",
  3728. "mwifiex_deauthenticate_infra"
  3729. ],
  3730. "group_size": 3,
  3731. "functions": [
  3732. {
  3733. "func": "int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac)\n{\n\tint ret = 0;\n\n\tif (!priv->media_connected)\n\t\treturn 0;\n\n\tswitch (priv->bss_mode) {\n\tcase NL80211_IFTYPE_STATION:\n\tcase NL80211_IFTYPE_P2P_CLIENT:\n\t\tret = mwifiex_deauthenticate_infra(priv, mac);\n\t\tif (ret)\n\t\t\tcfg80211_disconnected(priv->netdev, 0, NULL, 0,\n\t\t\t\t\t true, GFP_KERNEL);\n\t\tbreak;\n\tcase NL80211_IFTYPE_ADHOC:\n\t\treturn mwifiex_send_cmd(priv, HostCmd_CMD_802_11_AD_HOC_STOP,\n\t\t\t\t\tHostCmd_ACT_GEN_SET, 0, NULL, true);\n\tcase NL80211_IFTYPE_AP:\n\t\treturn mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_STOP,\n\t\t\t\t\tHostCmd_ACT_GEN_SET, 0, NULL, true);\n\tdefault:\n\t\tbreak;\n\t}\n\n\treturn ret;\n}",
  3734. "project": "linux",
  3735. "hash": 236807138668342781556278705542041524454,
  3736. "size": 27,
  3737. "commit_id": "5c455c5ab332773464d02ba17015acdca198f03d",
  3738. "message": "mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start\n\nmwifiex_cmd_802_11_ad_hoc_start() calls memcpy() without checking\nthe destination size may trigger a buffer overflower,\nwhich a local user could use to cause denial of service\nor the execution of arbitrary code.\nFix it by putting the length check before calling memcpy().\n\nSigned-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>\nLink: https://lore.kernel.org/r/20201206084801.26479-1-ruc_zhangxiaohui@163.com",
  3739. "target": 0,
  3740. "dataset": "other",
  3741. "idx": 444820
  3742. },
  3743. {
  3744. "func": "void mwifiex_deauthenticate_all(struct mwifiex_adapter *adapter)\n{\n\tstruct mwifiex_private *priv;\n\tint i;\n\n\tfor (i = 0; i < adapter->priv_num; i++) {\n\t\tpriv = adapter->priv[i];\n\t\tif (priv)\n\t\t\tmwifiex_deauthenticate(priv, NULL);\n\t}\n}",
  3745. "project": "linux",
  3746. "hash": 189959406002554123173285325117710338587,
  3747. "size": 11,
  3748. "commit_id": "5c455c5ab332773464d02ba17015acdca198f03d",
  3749. "message": "mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start\n\nmwifiex_cmd_802_11_ad_hoc_start() calls memcpy() without checking\nthe destination size may trigger a buffer overflower,\nwhich a local user could use to cause denial of service\nor the execution of arbitrary code.\nFix it by putting the length check before calling memcpy().\n\nSigned-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>\nLink: https://lore.kernel.org/r/20201206084801.26479-1-ruc_zhangxiaohui@163.com",
  3750. "target": 0,
  3751. "dataset": "other",
  3752. "idx": 444819
  3753. },
  3754. {
  3755. "func": "static int mwifiex_deauthenticate_infra(struct mwifiex_private *priv, u8 *mac)\n{\n\tu8 mac_address[ETH_ALEN];\n\tint ret;\n\n\tif (!mac || is_zero_ether_addr(mac))\n\t\tmemcpy(mac_address,\n\t\t priv->curr_bss_params.bss_descriptor.mac_address,\n\t\t ETH_ALEN);\n\telse\n\t\tmemcpy(mac_address, mac, ETH_ALEN);\n\n\tret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_DEAUTHENTICATE,\n\t\t\t HostCmd_ACT_GEN_SET, 0, mac_address, true);\n\n\treturn ret;\n}",
  3756. "project": "linux",
  3757. "hash": 159153326079788819329188692913654936904,
  3758. "size": 17,
  3759. "commit_id": "5c455c5ab332773464d02ba17015acdca198f03d",
  3760. "message": "mwifiex: Fix possible buffer overflows in mwifiex_cmd_802_11_ad_hoc_start\n\nmwifiex_cmd_802_11_ad_hoc_start() calls memcpy() without checking\nthe destination size may trigger a buffer overflower,\nwhich a local user could use to cause denial of service\nor the execution of arbitrary code.\nFix it by putting the length check before calling memcpy().\n\nSigned-off-by: Zhang Xiaohui <ruc_zhangxiaohui@163.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>\nLink: https://lore.kernel.org/r/20201206084801.26479-1-ruc_zhangxiaohui@163.com",
  3761. "target": 0,
  3762. "dataset": "other",
  3763. "idx": 444810
  3764. }
  3765. ]
  3766. },
  3767. {
  3768. "call_depth": 4,
  3769. "longest_call_chain": [
  3770. "cardos_create_file",
  3771. "cardos_construct_fcp",
  3772. "cardos_acl_to_bytes",
  3773. "acl_to_byte"
  3774. ],
  3775. "group_size": 65,
  3776. "functions": [
  3777. {
  3778. "func": "static int tcos_get_serialnr(sc_card_t *card, sc_serial_number_t *serial)\n{\n\tint r;\n\n\tif (!serial)\n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\n\t/* see if we have cached serial number */\n\tif (card->serialnr.len) {\n\t\tmemcpy(serial, &card->serialnr, sizeof(*serial));\n\t\treturn SC_SUCCESS;\n\t}\n\n\tcard->serialnr.len = sizeof card->serialnr.value;\n\tr = sc_parse_ef_gdo(card, card->serialnr.value, &card->serialnr.len, NULL, 0);\n\tif (r < 0) {\n\t\tcard->serialnr.len = 0;\n\t\treturn r;\n\t}\n\n\t/* copy and return serial number */\n\tmemcpy(serial, &card->serialnr, sizeof(*serial));\n\n\treturn SC_SUCCESS;\n}",
  3779. "project": "OpenSC",
  3780. "hash": 246565780126900044203384817876515447629,
  3781. "size": 25,
  3782. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3783. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3784. "target": 0,
  3785. "dataset": "other",
  3786. "idx": 453697
  3787. },
  3788. {
  3789. "func": "static int cardos_get_serialnr(sc_card_t *card, sc_serial_number_t *serial)\n{\n\tint r;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x81);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = 256;\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\tif (apdu.sw1 != 0x90 || apdu.sw2 != 0x00)\n\t\treturn SC_ERROR_INTERNAL;\n\tif ((apdu.resplen == 8) && (card->type == SC_CARD_TYPE_CARDOS_V5_0 || card->type == SC_CARD_TYPE_CARDOS_V5_3)) {\n\t\t/* cache serial number */\n\t\tmemcpy(card->serialnr.value, rbuf, 8);\n\t\tcard->serialnr.len = 8;\n\t} else if (apdu.resplen == 32) {\n\t\t/* cache serial number */\n\t\tmemcpy(card->serialnr.value, &rbuf[10], 6);\n\t\tcard->serialnr.len = 6;\n\t} else {\n\t\tsc_log(card->ctx, \"unexpected response to GET DATA serial\"\n\t\t\t\t\" number\\n\");\n\t\treturn SC_ERROR_INTERNAL;\n\t}\n\t/* copy and return serial number */\n\tmemcpy(serial, &card->serialnr, sizeof(*serial));\n\treturn SC_SUCCESS;\n}",
  3790. "project": "OpenSC",
  3791. "hash": 154421957446064598755895165006922596116,
  3792. "size": 31,
  3793. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3794. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3795. "target": 0,
  3796. "dataset": "other",
  3797. "idx": 270679
  3798. },
  3799. {
  3800. "func": "static int cardos_create_file(sc_card_t *card, sc_file_t *file)\n{\n\tint r;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\tif (card->type == SC_CARD_TYPE_CARDOS_GENERIC ||\n\t card->type == SC_CARD_TYPE_CARDOS_M4_01) {\n\t\tr = cardos_set_file_attributes(card, file);\n\t\tif (r != SC_SUCCESS)\n\t\t\treturn r;\n\t\treturn iso_ops->create_file(card, file);\n\t} else if (card->type == SC_CARD_TYPE_CARDOS_M4_2 ||\n\t card->type == SC_CARD_TYPE_CARDOS_M4_3 ||\n\t\t card->type == SC_CARD_TYPE_CARDOS_M4_2B ||\n\t card->type == SC_CARD_TYPE_CARDOS_M4_2C ||\n\t\t card->type == SC_CARD_TYPE_CARDOS_M4_4) {\n\t\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\t\tsize_t len = sizeof(sbuf);\n\t\tsc_apdu_t apdu;\n\n\t\tr = cardos_construct_fcp(card, file, sbuf, &len);\n\t\tif (r < 0) {\n\t\t\tsc_log(card->ctx, \"unable to create FCP\");\n\t\t\treturn r;\n\t\t}\n\t\n\t\tsc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE0, 0x00, 0x00);\n\t\tapdu.lc = len;\n\t\tapdu.datalen = len;\n\t\tapdu.data = sbuf;\n\n\t\tr = sc_transmit_apdu(card, &apdu);\n\t\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\t\treturn sc_check_sw(card, apdu.sw1, apdu.sw2);\n\t} else\n\t\treturn SC_ERROR_NOT_SUPPORTED;\n}",
  3801. "project": "OpenSC",
  3802. "hash": 288258945563116713298860710976484617827,
  3803. "size": 39,
  3804. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3805. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3806. "target": 0,
  3807. "dataset": "other",
  3808. "idx": 270696
  3809. },
  3810. {
  3811. "func": "static int tcos_create_file(sc_card_t *card, sc_file_t *file)\n{\n\tint r;\n\tsize_t len;\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tsc_apdu_t apdu;\n\n\tlen = SC_MAX_APDU_BUFFER_SIZE;\n\tr = tcos_construct_fci(file, sbuf, &len);\n\tLOG_TEST_RET(card->ctx, r, \"tcos_construct_fci() failed\");\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE0, 0x00, 0x00);\n\tapdu.cla |= 0x80; /* this is an proprietary extension */\n\tapdu.lc = len;\n\tapdu.datalen = len;\n\tapdu.data = sbuf;\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\treturn sc_check_sw(card, apdu.sw1, apdu.sw2);\n}",
  3812. "project": "OpenSC",
  3813. "hash": 87076920813955038984168861991618883272,
  3814. "size": 21,
  3815. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3816. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3817. "target": 0,
  3818. "dataset": "other",
  3819. "idx": 453692
  3820. },
  3821. {
  3822. "func": "static int tcos_compute_signature(sc_card_t *card, const u8 * data, size_t datalen, u8 * out, size_t outlen)\n{\n\tsize_t i, dlen=datalen;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tint tcos3, r;\n\n\tassert(card != NULL && data != NULL && out != NULL);\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\n\t// We can sign (key length / 8) bytes\n\tif (datalen > 256) SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_ARGUMENTS);\n\n\tif(((tcos_data *)card->drv_data)->next_sign) {\n\t\tif(datalen>48) {\n\t\t\tsc_log(card->ctx, \"Data to be signed is too long (TCOS supports max. 48 bytes)\\n\");\n\t\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_ARGUMENTS);\n\t\t}\n\t\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x9E, 0x9A);\n\t\tmemcpy(sbuf, data, datalen);\n\t\tdlen=datalen;\n\t} else {\n\t\tint keylen= tcos3 ? 256 : 128;\n\t\tsc_format_apdu(card, &apdu, keylen>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A,0x80,0x86);\n\t\tfor(i=0; i<sizeof(sbuf);++i) sbuf[i]=0xff;\n\t\tsbuf[0]=0x02; sbuf[1]=0x00; sbuf[2]=0x01; sbuf[keylen-datalen]=0x00;\n\t\tmemcpy(sbuf+keylen-datalen+1, data, datalen);\n\t\tdlen=keylen+1;\n\t}\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = tcos3 ? 256 : 128;\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = dlen;\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\tif (tcos3 && apdu.p1==0x80 && apdu.sw1==0x6A && apdu.sw2==0x87) {\n\t\tint keylen=128;\n\t\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A,0x80,0x86);\n\t\tfor(i=0; i<sizeof(sbuf);++i) sbuf[i]=0xff;\n\t\tsbuf[0]=0x02; sbuf[1]=0x00; sbuf[2]=0x01; sbuf[keylen-datalen]=0x00;\n\t\tmemcpy(sbuf+keylen-datalen+1, data, datalen);\n\t\tdlen=keylen+1;\n\n\t\tapdu.resp = rbuf;\n\t\tapdu.resplen = sizeof(rbuf);\n\t\tapdu.le = 128;\n\t\tapdu.data = sbuf;\n\t\tapdu.lc = apdu.datalen = dlen;\n\t\tr = sc_transmit_apdu(card, &apdu);\n\t\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\t}\n\tif (apdu.sw1==0x90 && apdu.sw2==0x00) {\n\t\tsize_t len = apdu.resplen>outlen ? outlen : apdu.resplen;\n\t\tmemcpy(out, apdu.resp, len);\n\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, len);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}",
  3823. "project": "OpenSC",
  3824. "hash": 296448152350111572857031665246126932505,
  3825. "size": 61,
  3826. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3827. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3828. "target": 0,
  3829. "dataset": "other",
  3830. "idx": 453704
  3831. },
  3832. {
  3833. "func": "static int tcos_setperm(sc_card_t *card, int enable_nullpin)\n{\n\tint r;\n\tsc_apdu_t apdu;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0xEE, 0x00, 0x00);\n\tapdu.cla |= 0x80;\n\tapdu.lc = 0;\n\tapdu.datalen = 0;\n\tapdu.data = NULL;\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\treturn sc_check_sw(card, apdu.sw1, apdu.sw2);\n}",
  3834. "project": "OpenSC",
  3835. "hash": 135071921926935975134723629067504187915,
  3836. "size": 16,
  3837. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3838. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3839. "target": 0,
  3840. "dataset": "other",
  3841. "idx": 453707
  3842. },
  3843. {
  3844. "func": "static int cardos_pass_algo_flags(sc_card_t *card, struct sc_cardctl_cardos_pass_algo_flags * ptr)\n{\n\tcardos_data_t * priv = (cardos_data_t *)card->drv_data;\n\tint r = 0;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\tswitch (ptr->pass) {\n\t\tcase 1:\n\t\t\tptr->card_flags = card->flags;\n\t\t\tptr->used_flags = priv->flags;\n\t\t\tptr->ec_flags = priv->ec_flags;\n\t\t\tptr->ext_flags = priv->ext_flags;\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\tr = cardos_add_algs(card,ptr->new_flags, ptr->ec_flags, ptr->ext_flags);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tsc_log(card->ctx, \"ptr->pass: %ul invalid\", ptr->pass);\n\t\t\tr = SC_ERROR_INTERNAL;\n\t}\n\tLOG_FUNC_RETURN(card->ctx, r);\n}",
  3845. "project": "OpenSC",
  3846. "hash": 322754554900044373761081908493363275949,
  3847. "size": 22,
  3848. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3849. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3850. "target": 0,
  3851. "dataset": "other",
  3852. "idx": 270678
  3853. },
  3854. {
  3855. "func": "static int tcos_set_security_env(sc_card_t *card, const sc_security_env_t *env, int se_num)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE], *p;\n\tint r, default_key, tcos3;\n\ttcos_data *data;\n\n\tassert(card != NULL && env != NULL);\n\tctx = card->ctx;\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\tdata=(tcos_data *)card->drv_data;\n\n\tif (se_num || (env->operation!=SC_SEC_OPERATION_DECIPHER && env->operation!=SC_SEC_OPERATION_SIGN)) {\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS);\n\t}\n\tif(!(env->flags & SC_SEC_ENV_KEY_REF_PRESENT))\n\t\tsc_log(ctx,\n\t\t\t\"No Key-Reference in SecEnvironment\\n\");\n\telse\n\t\tsc_log(ctx,\n\t\t\t\"Key-Reference %02X (len=%\"SC_FORMAT_LEN_SIZE_T\"u)\\n\",\n\t\t\tenv->key_ref[0], env->key_ref_len);\n\t/* Key-Reference 0x80 ?? */\n\tdefault_key= !(env->flags & SC_SEC_ENV_KEY_REF_PRESENT) || (env->key_ref_len==1 && env->key_ref[0]==0x80);\n\tsc_log(ctx,\n\t\t\"TCOS3:%d PKCS1:%d\\n\", tcos3,\n\t\t!!(env->algorithm_flags & SC_ALGORITHM_RSA_PAD_PKCS1));\n\n\tdata->pad_flags = env->algorithm_flags;\n\tdata->next_sign = default_key;\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x22, tcos3 ? 0x41 : 0xC1, 0xB8);\n\tp = sbuf;\n\tif (env->flags & SC_SEC_ENV_KEY_REF_PRESENT) {\n\t\t*p++ = (env->flags & SC_SEC_ENV_KEY_REF_SYMMETRIC) ? 0x83 : 0x84;\n\t\t*p++ = env->key_ref_len;\n\t\tmemcpy(p, env->key_ref, env->key_ref_len);\n\t\tp += env->key_ref_len;\n\t}\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = (p - sbuf);\n\n\tr=sc_transmit_apdu(card, &apdu);\n\tif (r) {\n\t\tsc_log(ctx,\n\t\t\t\"%s: APDU transmit failed\", sc_strerror(r));\n\t\treturn r;\n\t}\n\tif (apdu.sw1==0x6A && (apdu.sw2==0x81 || apdu.sw2==0x88)) {\n\t\tsc_log(ctx,\n\t\t\t\"Detected Signature-Only key\\n\");\n\t\tif (env->operation==SC_SEC_OPERATION_SIGN && default_key) return SC_SUCCESS;\n\t}\n\tSC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}",
  3856. "project": "OpenSC",
  3857. "hash": 46602344664369450852260308414175827075,
  3858. "size": 56,
  3859. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3860. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3861. "target": 0,
  3862. "dataset": "other",
  3863. "idx": 453705
  3864. },
  3865. {
  3866. "func": "static int tcos_card_ctl(sc_card_t *card, unsigned long cmd, void *ptr)\n{\n\tswitch (cmd) {\n\tcase SC_CARDCTL_TCOS_SETPERM:\n\t\treturn tcos_setperm(card, !!ptr);\n\tcase SC_CARDCTL_GET_SERIALNR:\n\t\treturn tcos_get_serialnr(card, (sc_serial_number_t *)ptr);\n\t}\n\treturn SC_ERROR_NOT_SUPPORTED;\n}",
  3867. "project": "OpenSC",
  3868. "hash": 144617548674885742297924822046400097296,
  3869. "size": 10,
  3870. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3871. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3872. "target": 0,
  3873. "dataset": "other",
  3874. "idx": 453698
  3875. },
  3876. {
  3877. "func": "static int iasecc_parse_ef_atr(struct sc_card *card)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_private_data *pdata = (struct iasecc_private_data *) card->drv_data;\n\tstruct iasecc_version *version = &pdata->version;\n\tstruct iasecc_io_buffer_sizes *sizes = &pdata->max_sizes;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\trv = sc_parse_ef_atr(card);\n\tLOG_TEST_RET(ctx, rv, \"MF selection error\");\n\n\tif (card->ef_atr->pre_issuing_len < 4)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Invalid pre-issuing data\");\n\n\tversion->ic_manufacturer =\tcard->ef_atr->pre_issuing[0];\n\tversion->ic_type =\t\tcard->ef_atr->pre_issuing[1];\n\tversion->os_version =\t\tcard->ef_atr->pre_issuing[2];\n\tversion->iasecc_version =\tcard->ef_atr->pre_issuing[3];\n\tsc_log(ctx, \"EF.ATR: IC manufacturer/type %X/%X, OS/IasEcc versions %X/%X\",\n\t\tversion->ic_manufacturer, version->ic_type, version->os_version, version->iasecc_version);\n\n\tif (card->ef_atr->issuer_data_len < 16)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Invalid issuer data\");\n\n\tsizes->send =\t card->ef_atr->issuer_data[2] * 0x100 + card->ef_atr->issuer_data[3];\n\tsizes->send_sc = card->ef_atr->issuer_data[6] * 0x100 + card->ef_atr->issuer_data[7];\n\tsizes->recv =\t card->ef_atr->issuer_data[10] * 0x100 + card->ef_atr->issuer_data[11];\n\tsizes->recv_sc = card->ef_atr->issuer_data[14] * 0x100 + card->ef_atr->issuer_data[15];\n\n\tcard->max_send_size = sizes->send;\n\tcard->max_recv_size = sizes->recv;\n\n\t/* Most of the card producers interpret 'send' values as \"maximum APDU data size\".\n\t * Oberthur strictly follows specification and interpret these values as \"maximum APDU command size\".\n\t * Here we need 'data size'.\n\t */\n\tif (card->max_send_size > 0xFF)\n\t\tcard->max_send_size -= 5;\n\n\tsc_log(ctx,\n\t \"EF.ATR: max send/recv sizes %\"SC_FORMAT_LEN_SIZE_T\"X/%\"SC_FORMAT_LEN_SIZE_T\"X\",\n\t card->max_send_size, card->max_recv_size);\n\n\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n}",
  3878. "project": "OpenSC",
  3879. "hash": 66128117229491948271469462797222185054,
  3880. "size": 46,
  3881. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  3882. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  3883. "target": 0,
  3884. "dataset": "other",
  3885. "idx": 263055
  3886. },
  3887. {
  3888. "func": "static int tcos_construct_fci(const sc_file_t *file,\n u8 *out, size_t *outlen)\n{\n\tu8 *p = out;\n\tu8 buf[64];\n\tsize_t n;\n\n\t/* FIXME: possible buffer overflow */\n\n\t*p++ = 0x6F; /* FCI */\n\tp++;\n\n\t/* File size */\n\tbuf[0] = (file->size >> 8) & 0xFF;\n\tbuf[1] = file->size & 0xFF;\n\tsc_asn1_put_tag(0x81, buf, 2, p, 16, &p);\n\n\t/* File descriptor */\n\tn = 0;\n\tbuf[n] = file->shareable ? 0x40 : 0;\n\tswitch (file->type) {\n\tcase SC_FILE_TYPE_WORKING_EF:\n\t\tbreak;\n\tcase SC_FILE_TYPE_DF:\n\t\tbuf[0] |= 0x38;\n\t\tbreak;\n\tdefault:\n\t\treturn SC_ERROR_NOT_SUPPORTED;\n\t}\n\tbuf[n++] |= file->ef_structure & 7;\n\tif ( (file->ef_structure & 7) > 1) {\n\t\t/* record structured file */\n\t\tbuf[n++] = 0x41; /* indicate 3rd byte */\n\t\tbuf[n++] = file->record_length;\n\t}\n\tsc_asn1_put_tag(0x82, buf, n, p, 8, &p);\n\n\t/* File identifier */\n\tbuf[0] = (file->id >> 8) & 0xFF;\n\tbuf[1] = file->id & 0xFF;\n\tsc_asn1_put_tag(0x83, buf, 2, p, 16, &p);\n\n\t/* Directory name */\n\tif (file->type == SC_FILE_TYPE_DF) {\n\t\tif (file->namelen) {\n\t\t\tsc_asn1_put_tag(0x84, file->name, file->namelen,\n p, 16, &p);\n\t\t} else {\n\t\t\t/* TCOS needs one, so we use a faked one */\n\t\t\tsnprintf ((char *) buf, sizeof(buf)-1, \"foo-%lu\",\n (unsigned long) time (NULL));\n\t\t\tsc_asn1_put_tag(0x84, buf, strlen ((char *) buf), p, 16, &p);\n\t\t}\n\t}\n\n\t/* File descriptor extension */\n\tif (file->prop_attr_len && file->prop_attr) {\n\t\tn = file->prop_attr_len;\n\t\tmemcpy(buf, file->prop_attr, n);\n\t} else {\n\t\tn = 0;\n\t\tbuf[n++] = 0x01; /* not invalidated, permanent */\n\t\tif (file->type == SC_FILE_TYPE_WORKING_EF)\n\t\t\tbuf[n++] = 0x00; /* generic data file */\n\t}\n\tsc_asn1_put_tag(0x85, buf, n, p, 16, &p);\n\n\t/* Security attributes */\n\tif (file->sec_attr_len && file->sec_attr) {\n\t\tmemcpy(buf, file->sec_attr, file->sec_attr_len);\n\t\tn = file->sec_attr_len;\n\t} else {\n\t\t/* no attributes given - fall back to default one */\n\t\tmemcpy (buf+ 0, \"\\xa4\\x00\\x00\\x00\\xff\\xff\", 6); /* select */\n\t\tmemcpy (buf+ 6, \"\\xb0\\x00\\x00\\x00\\xff\\xff\", 6); /* read bin */\n\t\tmemcpy (buf+12, \"\\xd6\\x00\\x00\\x00\\xff\\xff\", 6); /* upd bin */\n\t\tmemcpy (buf+18, \"\\x60\\x00\\x00\\x00\\xff\\xff\", 6); /* admin grp*/\n\t\tn = 24;\n\t}\n\tsc_asn1_put_tag(0x86, buf, n, p, sizeof (buf), &p);\n\n\n\t/* fixup length of FCI */\n\tout[1] = p - out - 2;\n\n\t*outlen = p - out;\n\treturn 0;\n}",
  3889. "project": "OpenSC",
  3890. "hash": 163425523657768046224170230800267043710,
  3891. "size": 88,
  3892. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3893. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3894. "target": 0,
  3895. "dataset": "other",
  3896. "idx": 453699
  3897. },
  3898. {
  3899. "func": "static int tcos_list_files(sc_card_t *card, u8 *buf, size_t buflen)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE], p1;\n\tint r, count = 0;\n\n\tassert(card != NULL);\n\tctx = card->ctx;\n\n\tfor (p1=1; p1<=2; p1++) {\n\t\tsc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xAA, p1, 0);\n\t\tapdu.cla = 0x80;\n\t\tapdu.resp = rbuf;\n\t\tapdu.resplen = sizeof(rbuf);\n\t\tapdu.le = 256;\n\t\tr = sc_transmit_apdu(card, &apdu);\n\t\tLOG_TEST_RET(ctx, r, \"APDU transmit failed\");\n\t\tif (apdu.sw1==0x6A && (apdu.sw2==0x82 || apdu.sw2==0x88)) continue;\n\t\tr = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\t\tLOG_TEST_RET(ctx, r, \"List Dir failed\");\n\t\tif (apdu.resplen > buflen) return SC_ERROR_BUFFER_TOO_SMALL;\n\t\tsc_log(ctx,\n\t\t\t\"got %\"SC_FORMAT_LEN_SIZE_T\"u %s-FileIDs\\n\",\n\t\t\tapdu.resplen / 2, p1 == 1 ? \"DF\" : \"EF\");\n\n\t\tmemcpy(buf, apdu.resp, apdu.resplen);\n\t\tbuf += apdu.resplen;\n\t\tbuflen -= apdu.resplen;\n\t\tcount += apdu.resplen;\n\t}\n\treturn count;\n}",
  3900. "project": "OpenSC",
  3901. "hash": 77871488236966928341429659826285412295,
  3902. "size": 33,
  3903. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3904. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3905. "target": 0,
  3906. "dataset": "other",
  3907. "idx": 453701
  3908. },
  3909. {
  3910. "func": "static int cardos_construct_fcp(sc_card_t *card, const sc_file_t *file,\n\tu8 *out, size_t *outlen)\n{\n\tu8 buf[64], *p = out;\n\tsize_t inlen = *outlen, len;\n\tint r;\n\n\tLOG_FUNC_CALLED(card->ctx);\n\n\tif (out == NULL || inlen < 64)\n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\t/* add FCP tag */\n\t*p++ = 0x62;\n\t/* we will add the length later */\n\tp++;\n\n\tmemset(buf, 0, sizeof(buf));\n\n\t/* set the length */\n\tbuf[0] = (file->size >> 8) & 0xff;\n\tbuf[1] = file->size & 0xff;\n\tif (file->type == SC_FILE_TYPE_DF)\n\t\tr = sc_asn1_put_tag(0x81, buf, 2, p, 4, &p);\n\telse\n\t\tr = sc_asn1_put_tag(0x80, buf, 2, p, 4, &p);\n\tif (r != SC_SUCCESS)\n\t\treturn r;\n\t/* set file type */\n\tif (file->shareable != 0)\n\t\tbuf[0] = 0x40;\n\telse\n\t\tbuf[0] = 0x00;\n\tif (file->type == SC_FILE_TYPE_WORKING_EF) {\n\t\tswitch (file->ef_structure) {\n\t\tcase SC_FILE_EF_TRANSPARENT:\n\t\t\tbuf[0] |= 0x01;\n\t\t\tbreak;\n\t\tcase SC_FILE_EF_LINEAR_VARIABLE_TLV:\n\t\t\tbuf[0] |= 0x05;\n\t\t\tbreak;\n\t\tcase SC_FILE_EF_LINEAR_FIXED:\n\t\t\tbuf[0] |= 0x02;\n\t\t\tbuf[1] |= 0x21;\n\t\t\tbuf[2] |= 0x00;\n\t\t\tbuf[3] |= (u8) file->record_length;\n\t\t\tbuf[4] |= (u8) file->record_count;\n\t\t\tbreak;\n\t\tcase SC_FILE_EF_CYCLIC:\n\t\t\tbuf[0] |= 0x06;\n\t\t\tbuf[1] |= 0x21;\n\t\t\tbuf[2] |= 0x00;\n\t\t\tbuf[3] |= (u8) file->record_length;\n\t\t\tbuf[4] |= (u8) file->record_count;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tsc_log(card->ctx, \"unknown EF type: %u\", file->type);\n\t\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\t\t}\n\t\tif (file->ef_structure == SC_FILE_EF_CYCLIC ||\n\t\t file->ef_structure == SC_FILE_EF_LINEAR_FIXED)\n\t\tr = sc_asn1_put_tag(0x82, buf, 5, p, 8, &p);\n\telse\n\t\tr = sc_asn1_put_tag(0x82, buf, 1, p, 8, &p);\n\t} else if (file->type == SC_FILE_TYPE_DF) {\n\t\tbuf[0] |= 0x38;\n\t\tr = sc_asn1_put_tag(0x82, buf, 1, p, 8, &p);\n\t} else\n\t\treturn SC_ERROR_NOT_SUPPORTED;\n\tif (r != SC_SUCCESS)\n\t\treturn r;\n\t/* set file id */\n\tbuf[0] = (file->id >> 8) & 0xff;\n\tbuf[1] = file->id & 0xff;\n\tr = sc_asn1_put_tag(0x83, buf, 2, p, 8, &p);\n\tif (r != SC_SUCCESS)\n\t\treturn r;\n\t/* set aid (for DF only) */\n\tif (file->type == SC_FILE_TYPE_DF && file->namelen != 0) {\n\t\tr = sc_asn1_put_tag(0x84, file->name, file->namelen, p, 20, &p);\n\t\tif (r != SC_SUCCESS)\n\t\t\treturn r;\n\t}\n\t/* set proprietary file attributes */\n\tbuf[0] = 0x00;\t\t/* use default values */\n\tif (file->type == SC_FILE_TYPE_DF)\n\t\tr = sc_asn1_put_tag(0x85, buf, 1, p, 8, &p);\n\telse {\n\t\tbuf[1] = 0x00;\n\t\tbuf[2] = 0x00;\n\t\tr = sc_asn1_put_tag(0x85, buf, 1, p, 8, &p);\n\t}\n\tif (r != SC_SUCCESS)\n\t\treturn r;\n\t/* set ACs */\n\tlen = 9;\n\tr = cardos_acl_to_bytes(card, file, buf, &len);\n\tif (r != SC_SUCCESS)\n\t\treturn r;\n\tr = sc_asn1_put_tag(0x86, buf, len, p, 18, &p);\n\tif (r != SC_SUCCESS)\n\t\treturn r;\n\t/* finally set the length of the FCP */\n\tout[1] = p - out - 2;\n\n\t*outlen = p - out;\n\n\treturn SC_SUCCESS;\n}",
  3911. "project": "OpenSC",
  3912. "hash": 42348384099158164533092156599026838044,
  3913. "size": 108,
  3914. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3915. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3916. "target": 0,
  3917. "dataset": "other",
  3918. "idx": 270675
  3919. },
  3920. {
  3921. "func": "static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\ttcos_data *data;\n\tint tcos3, r;\n\n\tassert(card != NULL && crgram != NULL && out != NULL);\n\tctx = card->ctx;\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\tdata=(tcos_data *)card->drv_data;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t\t\"TCOS3:%d PKCS1:%d\\n\",tcos3,\n\t\t!!(data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1));\n\n\tsc_format_apdu(card, &apdu, crgram_len>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = crgram_len;\n\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = crgram_len+1;\n\tsbuf[0] = tcos3 ? 0x00 : ((data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) ? 0x81 : 0x02);\n\tmemcpy(sbuf+1, crgram, crgram_len);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif (apdu.sw1==0x90 && apdu.sw2==0x00) {\n\t\tsize_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen;\n\t\tunsigned int offset=0;\n\t\tif(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2) {\n\t\t\toffset=2; while(offset<len && apdu.resp[offset]!=0) ++offset;\n\t\t\toffset=(offset<len-1) ? offset+1 : 0;\n\t\t}\n\t\tmemcpy(out, apdu.resp+offset, len-offset);\n\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, len-offset);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}",
  3922. "project": "OpenSC",
  3923. "hash": 35692446162590344930620836498368260919,
  3924. "size": 44,
  3925. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3926. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3927. "target": 1,
  3928. "dataset": "other",
  3929. "idx": 211948
  3930. },
  3931. {
  3932. "func": "static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\tu8 sbuf[SC_MAX_APDU_BUFFER_SIZE];\n\ttcos_data *data;\n\tint tcos3, r;\n\n\tassert(card != NULL && crgram != NULL && out != NULL);\n\tctx = card->ctx;\n\ttcos3=(card->type==SC_CARD_TYPE_TCOS_V3);\n\tdata=(tcos_data *)card->drv_data;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t\t\"TCOS3:%d PKCS1:%d\\n\",tcos3,\n\t\t!!(data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1));\n\n\tsc_format_apdu(card, &apdu, crgram_len>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = crgram_len;\n\n\tapdu.data = sbuf;\n\tapdu.lc = apdu.datalen = crgram_len+1;\n\tsbuf[0] = tcos3 ? 0x00 : ((data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) ? 0x81 : 0x02);\n\tif (sizeof sbuf - 1 < crgram_len)\n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\tmemcpy(sbuf+1, crgram, crgram_len);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif (apdu.sw1==0x90 && apdu.sw2==0x00) {\n\t\tsize_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen;\n\t\tunsigned int offset=0;\n\t\tif(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2) {\n\t\t\toffset=2; while(offset<len && apdu.resp[offset]!=0) ++offset;\n\t\t\toffset=(offset<len-1) ? offset+1 : 0;\n\t\t}\n\t\tmemcpy(out, apdu.resp+offset, len-offset);\n\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, len-offset);\n\t}\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}",
  3933. "project": "OpenSC",
  3934. "hash": 135428929269373710791680828572609443287,
  3935. "size": 46,
  3936. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  3937. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  3938. "target": 0,
  3939. "dataset": "other",
  3940. "idx": 453691
  3941. },
  3942. {
  3943. "func": "static int acl_to_byte(const sc_acl_entry_t *e)\n{\n\tif (e != NULL) {\n\t\tswitch (e->method) {\n\t\tcase SC_AC_NONE:\n\t\t\treturn 0x00;\n\t\tcase SC_AC_NEVER:\n\t\t\treturn 0xFF;\n\t\tcase SC_AC_CHV:\n\t\tcase SC_AC_TERM:\n\t\tcase SC_AC_AUT:\n\t\t\tif (e->key_ref == SC_AC_KEY_REF_NONE)\n\t\t\t\treturn -1;\n\t\t\tif (e->key_ref > 0x7F)\n\t\t\t\treturn -1;\n\t\t\treturn e->key_ref;\n\t\t}\n\t}\n return 0x00;\n}",
  3944. "project": "OpenSC",
  3945. "hash": 173709416336833647761968270085829929264,
  3946. "size": 20,
  3947. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3948. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3949. "target": 0,
  3950. "dataset": "other",
  3951. "idx": 270692
  3952. },
  3953. {
  3954. "func": "static int cardos_init(sc_card_t *card)\n{\n\tcardos_data_t * priv = NULL;\n\tunsigned long flags = 0;\n\tsize_t data_field_length;\n\tsc_apdu_t apdu;\n\tu8 rbuf[2];\n\tint r;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\tpriv = calloc(1, sizeof(cardos_data_t));\n\tif (!priv)\n\t\tLOG_FUNC_RETURN(card->ctx, SC_ERROR_OUT_OF_MEMORY);\n\tcard->drv_data = priv;\n\n\tcard->name = \"Atos CardOS\";\n\tcard->cla = 0x00;\n\n\t/* let user override flags and type from opensc.conf */\n\t/* user can override card->type too.*/\n\tif (card->flags) {\n\t flags = card->flags;\n\t} else {\n\n\t\t/* Set up algorithm info. */\n\t\tflags = 0;\n\t\tif (card->type == SC_CARD_TYPE_CARDOS_V5_0) {\n\t\t\tflags |= SC_ALGORITHM_RSA_PAD_PKCS1;\n\t\t} else if(card->type == SC_CARD_TYPE_CARDOS_V5_3) {\n\t\t\tflags |= SC_ALGORITHM_RSA_RAW\n\t\t\t\t| SC_ALGORITHM_RSA_HASH_NONE\n\t\t\t\t| SC_ALGORITHM_ONBOARD_KEY_GEN;\n\t\t} else {\n\t\t\tflags |= SC_ALGORITHM_RSA_RAW\n\t\t\t\t| SC_ALGORITHM_RSA_HASH_NONE\n\t\t\t\t| SC_ALGORITHM_NEED_USAGE\n\t\t\t\t| SC_ALGORITHM_ONBOARD_KEY_GEN;\n\t\t}\n\t}\n\n\tpriv->flags = flags;\n\n\tif (card->type == SC_CARD_TYPE_CARDOS_M4_2) {\n\t\tr = cardos_have_2048bit_package(card);\n\t\tif (r < 0) {\n\t\t\tr = SC_ERROR_INVALID_CARD;\n\t\t\tgoto err;\n\t\t}\n\t\tif (r == 1)\n\t\t\tpriv->rsa_2048 = 1;\n\t\tcard->caps |= SC_CARD_CAP_APDU_EXT;\n\t} else if (card->type == SC_CARD_TYPE_CARDOS_M4_3\n\t\t|| card->type == SC_CARD_TYPE_CARDOS_M4_2B\n\t\t|| card->type == SC_CARD_TYPE_CARDOS_M4_2C\n\t\t|| card->type == SC_CARD_TYPE_CARDOS_M4_4\n\t\t|| card->type == SC_CARD_TYPE_CARDOS_V5_0\n\t\t|| card->type == SC_CARD_TYPE_CARDOS_V5_3) {\n\t\tpriv->rsa_2048 = 1;\n\t\tcard->caps |= SC_CARD_CAP_APDU_EXT;\n\t\t/* TODO check this. EC only if in supported_algo */\n\t\tpriv->ext_flags = SC_ALGORITHM_EXT_EC_NAMEDCURVE | SC_ALGORITHM_EXT_EC_UNCOMPRESES;\n\t}\n\n\t/* probe DATA FIELD LENGTH with GET DATA */\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x8D);\n\tapdu.le = sizeof rbuf;\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tif (r < 0)\n\t\tLOG_TEST_GOTO_ERR(card->ctx,\n\t\t\t\tSC_ERROR_INVALID_CARD,\n\t\t\t\t\"APDU transmit failed\");\n\tr = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tif (r < 0)\n\t\tLOG_TEST_GOTO_ERR(card->ctx,\n\t\t\t\tSC_ERROR_INVALID_CARD,\n\t\t\t\t\"GET DATA command returned error\");\n\tif (apdu.resplen != 2) {\n\t\tr = SC_ERROR_INVALID_CARD;\n\t\tgoto err;\n\t}\n\tdata_field_length = ((rbuf[0] << 8) | rbuf[1]);\n\n\t/* TODO is this really needed? strip the length of possible Lc and Le bytes */\n\n\t/* Use Min card sizes and reader too. for V5_3 at least*/\n\n\tif (card->type == SC_CARD_TYPE_CARDOS_V5_0 || card->type == SC_CARD_TYPE_CARDOS_V5_3) {\n\t\tsc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, \"data_field_length:%\"SC_FORMAT_LEN_SIZE_T\"u \"\n\t\t\t\t\"card->reader->max_send_size:%\"SC_FORMAT_LEN_SIZE_T\"u \"\n\t\t\t\t\"card->reader->max_recv_size:%\"SC_FORMAT_LEN_SIZE_T\"u %s\",\n\t\t\t\tdata_field_length, card->reader->max_send_size, card->reader->max_recv_size,\n\t\t\t\t(card->caps & SC_CARD_CAP_APDU_EXT) ? \"SC_CARD_CAP_APDU_EXT\" : \" \");\n\n\t\tif (card->caps & SC_CARD_CAP_APDU_EXT) {\n\t\t\tcard->max_send_size = data_field_length - 6;\n#ifdef _WIN32\n\t\t\t/* Windows does not support PCSC PART_10 and may have forced reader to 255/256\n\t\t\t * https://github.com/OpenSC/OpenSC/commit/eddea6f3c2d3dafc2c09eba6695c745a61b5186f\n\t\t\t * may have reset this. if so, will override and force extended \n\t\t\t * Most, if not all, cardos cards do extended, but not chaining \n\t\t\t */\n\t\t\tif (card->reader->max_send_size == 255 && card->reader->max_recv_size == 256) {\n\t\t\t\tsc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, \"resetting reader to use data_field_length\");\n\t\t\t\tcard->reader->max_send_size = data_field_length - 6;\n\t\t\t\tcard->reader->max_recv_size = data_field_length - 3;\n\t\t\t}\n#endif\n\t\t} else\n\t\t\tcard->max_send_size = data_field_length - 3;\n\n\t\tcard->max_send_size = sc_get_max_send_size(card); /* include reader sizes and protocol */\n\t\tcard->max_recv_size = data_field_length - 2;\n\t\tcard->max_recv_size = sc_get_max_recv_size(card);\n\t} else {\n\t\t/* old way, disregards reader capabilities */\n\t\tif (card->caps & SC_CARD_CAP_APDU_EXT)\n\t\t\tcard->max_send_size = data_field_length - 6;\n\t\telse\n\t\t\tcard->max_send_size = data_field_length - 3;\n\t\t/* strip the length of SW bytes */\n\t\tcard->max_recv_size = data_field_length - 2;\n\t}\n\n\t/*for new cards, wait till after sc_pkcs15_bind_internal reads tokeninfo */\n\tif (card->type != SC_CARD_TYPE_CARDOS_V5_0 && card->type != SC_CARD_TYPE_CARDOS_V5_3) {\n\t\tr = cardos_add_algs(card, flags, 0, 0);\n\t}\n\nerr:\n\tif (r != SC_SUCCESS) {\n\t\tfree(priv);\n\t\tcard->drv_data = NULL;\n\t}\n\n\treturn r;\n}",
  3955. "project": "OpenSC",
  3956. "hash": 135725401098783659846816081236713466705,
  3957. "size": 140,
  3958. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3959. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3960. "target": 0,
  3961. "dataset": "other",
  3962. "idx": 270700
  3963. },
  3964. {
  3965. "func": "do_compute_signature(sc_card_t *card, const u8 *data, size_t datalen,\n\t\t u8 *out, size_t outlen)\n{\n\t/* cardos_data_t* priv = (cardos_data_t*)card->drv_dataa */;\n\tint r;\n\tsc_apdu_t apdu;\n\n\t/* INS: 0x2A PERFORM SECURITY OPERATION\n\t * P1: 0x9E Resp: Digital Signature\n\t * P2: 0x9A Cmd: Input for Digital Signature */\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4, 0x2A, 0x9E, 0x9A);\n\tapdu.resp = out;\n\tapdu.le = outlen;\n\tapdu.resplen = outlen;\n\n\tapdu.data = data;\n\tapdu.lc = datalen;\n\tapdu.datalen = datalen;\n\tfixup_transceive_length(card, &apdu);\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif (apdu.sw1 == 0x90 && apdu.sw2 == 0x00)\n\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, apdu.resplen);\n\telse\n\t\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2));\n}",
  3966. "project": "OpenSC",
  3967. "hash": 202624707865085526865329845707584797210,
  3968. "size": 27,
  3969. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3970. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3971. "target": 0,
  3972. "dataset": "other",
  3973. "idx": 270677
  3974. },
  3975. {
  3976. "func": "iasecc_select_aid(struct sc_card *card, struct sc_aid *aid, unsigned char *out, size_t *out_len)\n{\n\tstruct sc_apdu apdu;\n\tunsigned char apdu_resp[SC_MAX_APDU_BUFFER_SIZE];\n\tint rv;\n\n\t/* Select application (deselect previously selected application) */\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0x04, 0x00);\n\tapdu.lc = aid->len;\n\tapdu.data = aid->value;\n\tapdu.datalen = aid->len;\n\tapdu.resplen = sizeof(apdu_resp);\n\tapdu.resp = apdu_resp;\n\n\trv = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, rv, \"APDU transmit failed\");\n\trv = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(card->ctx, rv, \"Cannot select AID\");\n\n\tif (*out_len < apdu.resplen)\n\t\tLOG_TEST_RET(card->ctx, SC_ERROR_BUFFER_TOO_SMALL, \"Cannot select AID\");\n\tmemcpy(out, apdu.resp, apdu.resplen);\n\n\treturn SC_SUCCESS;\n}",
  3977. "project": "OpenSC",
  3978. "hash": 314375111371679731751921746163275144084,
  3979. "size": 25,
  3980. "commit_id": "03628449b75a93787eb2359412a3980365dda49b",
  3981. "message": "iasecc: fixed unbound recursion",
  3982. "target": 0,
  3983. "dataset": "other",
  3984. "idx": 477393
  3985. },
  3986. {
  3987. "func": "static int cardos_set_file_attributes(sc_card_t *card, sc_file_t *file)\n{\n\tint r;\n\n\tif (file->type_attr_len == 0) {\n\t\tu8 type[3];\n\n\t\tmemset(type, 0, sizeof(type));\n\t\ttype[0] = 0x00;\n\t\tswitch (file->type) {\n\t\tcase SC_FILE_TYPE_WORKING_EF:\n\t\t\tbreak;\n\t\tcase SC_FILE_TYPE_DF:\n\t\t\ttype[0] = 0x38;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn SC_ERROR_NOT_SUPPORTED;\n\t\t}\n\t\tif (file->type != SC_FILE_TYPE_DF) {\n\t\t\tswitch (file->ef_structure) {\n\t\t\tcase SC_FILE_EF_LINEAR_FIXED_TLV:\n\t\t\tcase SC_FILE_EF_LINEAR_VARIABLE:\n\t\t\tcase SC_FILE_EF_CYCLIC_TLV:\n\t\t\t\treturn SC_ERROR_NOT_SUPPORTED;\n\t\t\t\t/* No idea what this means, but it\n\t\t\t\t * seems to be required for key\n\t\t\t\t * generation. */\n\t\t\tcase SC_FILE_EF_LINEAR_VARIABLE_TLV:\n\t\t\t\ttype[1] = 0xff;\n\t\t\t\t/* fall through */\n\t\t\tdefault:\n\t\t\t\ttype[0] |= file->ef_structure & 7;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tr = sc_file_set_type_attr(file, type, sizeof(type));\n\t\tif (r != SC_SUCCESS)\n\t\t\treturn r;\n\t}\n\tif (file->prop_attr_len == 0) {\n\t\tu8 status[3];\n\n\t\tstatus[0] = 0x01;\n\t\tif (file->type == SC_FILE_TYPE_DF) {\n\t\t\tstatus[1] = (file->size >> 8) & 0xFF;\n\t\t\tstatus[2] = file->size & 0xFF;\n\t\t} else {\n\t\t\tstatus[1] = status[2] = 0x00; /* not used */\n\t\t}\n\t\tr = sc_file_set_prop_attr(file, status, sizeof(status));\n\t\tif (r != SC_SUCCESS)\n\t\t\treturn r;\n\t}\n\tif (file->sec_attr_len == 0) {\n\t\tu8 acl[9];\n\t\tsize_t blen = sizeof(acl);\n\n\t\tr = cardos_acl_to_bytes(card, file, acl, &blen);\n\t\tif (r != SC_SUCCESS)\n\t\t\treturn r;\n\t\tr = sc_file_set_sec_attr(file, acl, blen);\n\t\tif (r != SC_SUCCESS)\n\t\t\treturn r;\n\t}\n\treturn SC_SUCCESS;\n}",
  3988. "project": "OpenSC",
  3989. "hash": 8159461168753449454459203169536368628,
  3990. "size": 66,
  3991. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  3992. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  3993. "target": 0,
  3994. "dataset": "other",
  3995. "idx": 270674
  3996. },
  3997. {
  3998. "func": "sc_awp_parse_df(struct sc_pkcs15_card *p15card, struct sc_pkcs15_df *df)\n{\n\tstruct sc_context *ctx = p15card->card->ctx;\n\tunsigned char *buf = NULL;\n\tsize_t buf_len;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (df->type != SC_PKCS15_PRKDF && df->type != SC_PKCS15_DODF)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED);\n\n\tif (df->enumerated)\n\t\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n\n\trv = sc_oberthur_read_file(p15card, AWP_OBJECTS_LIST_PRV, &buf, &buf_len, 1);\n\tLOG_TEST_RET(ctx, rv, \"Parse DF: read private objects info failed\");\n\n\trv = sc_oberthur_parse_privateinfo(p15card, buf, buf_len, 0);\n\n\tif (buf)\n\t\tfree(buf);\n\n\tif (rv == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED)\n\t\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n\n\tLOG_TEST_RET(ctx, rv, \"Parse DF: private info parse error\");\n\tdf->enumerated = 1;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  3999. "project": "OpenSC",
  4000. "hash": 55332694305653857702712485092716248016,
  4001. "size": 30,
  4002. "commit_id": "1db88374bb7706a115d5c3617c6f16115c33bf27",
  4003. "message": "oberthur: Correctly check for return values\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28843",
  4004. "target": 0,
  4005. "dataset": "other",
  4006. "idx": 230099
  4007. },
  4008. {
  4009. "func": "sc_pkcs15emu_oberthur_init_ex(struct sc_pkcs15_card * p15card, struct sc_aid *aid)\n{\n\tint rv;\n\n\tLOG_FUNC_CALLED(p15card->card->ctx);\n\trv = oberthur_detect_card(p15card);\n\tif (!rv)\n\t\trv = sc_pkcs15emu_oberthur_init(p15card);\n\n\tLOG_FUNC_RETURN(p15card->card->ctx, rv);\n}",
  4010. "project": "OpenSC",
  4011. "hash": 245335353404583265920343713660703353903,
  4012. "size": 11,
  4013. "commit_id": "1db88374bb7706a115d5c3617c6f16115c33bf27",
  4014. "message": "oberthur: Correctly check for return values\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28843",
  4015. "target": 0,
  4016. "dataset": "other",
  4017. "idx": 230109
  4018. },
  4019. {
  4020. "func": "sc_oberthur_parse_tokeninfo (struct sc_pkcs15_card *p15card,\n\t\tunsigned char *buff, size_t len, int postpone_allowed)\n{\n\tstruct sc_context *ctx = p15card->card->ctx;\n\tchar label[0x21];\n\tunsigned flags;\n\tint ii;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (!buff || len < 0x24)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"Cannot parse token info\");\n\n\tmemset(label, 0, sizeof(label));\n\n\tmemcpy(label, buff, 0x20);\n\tii = 0x20;\n\twhile (*(label + --ii)==' ' && ii)\n\t\t;\n\t*(label + ii + 1) = '\\0';\n\n\tflags = *(buff + 0x22) * 0x100 + *(buff + 0x23);\n\n\tset_string(&p15card->tokeninfo->label, label);\n\tset_string(&p15card->tokeninfo->manufacturer_id, \"Oberthur/OpenSC\");\n\n\tif (flags & 0x01)\n\t\tp15card->tokeninfo->flags |= SC_PKCS15_TOKEN_PRN_GENERATION;\n\n\tsc_log(ctx, \"label %s\", p15card->tokeninfo->label);\n\tsc_log(ctx, \"manufacturer_id %s\", p15card->tokeninfo->manufacturer_id);\n\n\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n}",
  4021. "project": "OpenSC",
  4022. "hash": 73661682719962094701154276042337108222,
  4023. "size": 33,
  4024. "commit_id": "1db88374bb7706a115d5c3617c6f16115c33bf27",
  4025. "message": "oberthur: Correctly check for return values\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28843",
  4026. "target": 0,
  4027. "dataset": "other",
  4028. "idx": 230111
  4029. },
  4030. {
  4031. "func": "iasecc_sdo_get_data(struct sc_card *card, struct iasecc_sdo *sdo)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tint rv, sdo_tag;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tsdo_tag = iasecc_sdo_tag_from_class(sdo->sdo_class);\n\n\trv = iasecc_sdo_get_tagged_data(card, sdo_tag, sdo);\n\t/* When there is no public data 'GET DATA' returns error */\n\tif (rv != SC_ERROR_INCORRECT_PARAMETERS)\n\t\tLOG_TEST_RET(ctx, rv, \"cannot parse ECC SDO data\");\n\n\trv = iasecc_sdo_get_tagged_data(card, IASECC_DOCP_TAG, sdo);\n\tLOG_TEST_RET(ctx, rv, \"cannot parse ECC DOCP data\");\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4032. "project": "OpenSC",
  4033. "hash": 49310794631010853128006989686318405656,
  4034. "size": 19,
  4035. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4036. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4037. "target": 0,
  4038. "dataset": "other",
  4039. "idx": 263039
  4040. },
  4041. {
  4042. "func": "iasecc_erase_binary(struct sc_card *card, unsigned int offs, size_t count, unsigned long flags)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tunsigned char *tmp = NULL;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t \"iasecc_erase_binary(card:%p) count %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t card, count);\n\tif (!count)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"'ERASE BINARY' failed: invalid size to erase\");\n\n\ttmp = malloc(count);\n\tif (!tmp)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"Cannot allocate temporary buffer\");\n\tmemset(tmp, 0xFF, count);\n\n\trv = sc_update_binary(card, offs, tmp, count, flags);\n\tfree(tmp);\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4043. "project": "OpenSC",
  4044. "hash": 305103293588835110101823939097430484444,
  4045. "size": 23,
  4046. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4047. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4048. "target": 0,
  4049. "dataset": "other",
  4050. "idx": 263042
  4051. },
  4052. {
  4053. "func": "iasecc_get_chv_reference_from_se(struct sc_card *card, int *se_reference)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_se_info se;\n\tstruct sc_crt crt;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tif (!se_reference)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"Invalid arguments\");\n\n\tmemset(&se, 0, sizeof(se));\n\tse.reference = *se_reference;\n\n\trv = iasecc_se_get_info(card, &se);\n\tLOG_TEST_RET(ctx, rv, \"get SE info error\");\n\n\tmemset(&crt, 0, sizeof(crt));\n\tcrt.tag = IASECC_CRT_TAG_AT;\n\tcrt.usage = IASECC_UQB_AT_USER_PASSWORD;\n\n\trv = iasecc_se_get_crt(card, &se, &crt);\n\tLOG_TEST_RET(ctx, rv, \"Cannot get 'USER PASSWORD' authentication template\");\n\n\tsc_file_free(se.df);\n\tLOG_FUNC_RETURN(ctx, crt.refs[0]);\n}",
  4054. "project": "OpenSC",
  4055. "hash": 331721932546177784077675557689432422364,
  4056. "size": 28,
  4057. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4058. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4059. "target": 0,
  4060. "dataset": "other",
  4061. "idx": 263046
  4062. },
  4063. {
  4064. "func": "iasecc_chv_cache_is_verified(struct sc_card *card, struct sc_pin_cmd_data *pin_cmd)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_pin_status *current = NULL;\n\tunsigned char data_sha1[SHA_DIGEST_LENGTH];\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tif (pin_cmd->pin1.data)\n\t\tSHA1(pin_cmd->pin1.data, pin_cmd->pin1.len, data_sha1);\n\telse\n\t\tmemset(data_sha1, 0, SHA_DIGEST_LENGTH);\n\tsc_log_hex(ctx, \"data_sha1: %s\", data_sha1, SHA_DIGEST_LENGTH);\n\n\tfor(current = checked_pins; current; current = current->next)\n\t\tif (current->reference == pin_cmd->pin_reference)\n\t\t\tbreak;\n\n\tif (current && !memcmp(data_sha1, current->sha1, SHA_DIGEST_LENGTH)) {\n\t\tsc_log(ctx, \"PIN-%i status 'verified'\", pin_cmd->pin_reference);\n\t\treturn current;\n\t}\n\n\tsc_log(ctx, \"PIN-%i status 'not verified'\", pin_cmd->pin_reference);\n\treturn NULL;\n}",
  4065. "project": "OpenSC",
  4066. "hash": 100182165700546527777392159720951233771,
  4067. "size": 26,
  4068. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4069. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4070. "target": 0,
  4071. "dataset": "other",
  4072. "idx": 263056
  4073. },
  4074. {
  4075. "func": "iasecc_decipher(struct sc_card *card,\n\t\tconst unsigned char *in, size_t in_len,\n\t\tunsigned char *out, size_t out_len)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct sc_apdu apdu;\n\tunsigned char sbuf[0x200];\n\tunsigned char resp[SC_MAX_APDU_BUFFER_SIZE];\n\tsize_t offs;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(card->ctx,\n\t \"crgram_len %\"SC_FORMAT_LEN_SIZE_T\"u; outlen %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t in_len, out_len);\n\tif (!out || !out_len || in_len > SC_MAX_APDU_BUFFER_SIZE)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS);\n\n\toffs = 0;\n\tsbuf[offs++] = 0x81;\n\tmemcpy(sbuf + offs, in, in_len);\n\toffs += in_len;\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86);\n\tapdu.flags |= SC_APDU_FLAGS_CHAINING;\n\tapdu.data = sbuf;\n\tapdu.datalen = offs;\n\tapdu.lc = offs;\n\tapdu.resp = resp;\n\tapdu.resplen = sizeof(resp);\n\tapdu.le = 256;\n\n\trv = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(ctx, rv, \"APDU transmit failed\");\n\trv = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(ctx, rv, \"Card returned error\");\n\n\tif (out_len > apdu.resplen)\n\t\tout_len = apdu.resplen;\n\n\tmemcpy(out, apdu.resp, out_len);\n\trv = out_len;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4076. "project": "OpenSC",
  4077. "hash": 310842747367203805416055449723509140251,
  4078. "size": 45,
  4079. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4080. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4081. "target": 0,
  4082. "dataset": "other",
  4083. "idx": 263062
  4084. },
  4085. {
  4086. "func": "iasecc_sdo_get_tagged_data(struct sc_card *card, int sdo_tag, struct iasecc_sdo *sdo)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct sc_apdu apdu;\n\tunsigned char sbuf[0x100];\n\tsize_t offs = sizeof(sbuf) - 1;\n\tunsigned char rbuf[0x400];\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tsbuf[offs--] = 0x80;\n\tsbuf[offs--] = sdo_tag & 0xFF;\n\tif ((sdo_tag >> 8) & 0xFF)\n\t\tsbuf[offs--] = (sdo_tag >> 8) & 0xFF;\n\tsbuf[offs] = sizeof(sbuf) - offs - 1;\n\toffs--;\n\n\tsbuf[offs--] = sdo->sdo_ref & 0x9F;\n\tsbuf[offs--] = sdo->sdo_class | IASECC_OBJECT_REF_LOCAL;\n\tsbuf[offs--] = IASECC_SDO_TAG_HEADER;\n\n\tsbuf[offs] = sizeof(sbuf) - offs - 1;\n\toffs--;\n\tsbuf[offs--] = IASECC_SDO_TEMPLATE_TAG;\n\n\tsbuf[offs] = sizeof(sbuf) - offs - 1;\n\toffs--;\n\tsbuf[offs] = 0x4D;\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xCB, 0x3F, 0xFF);\n\tapdu.data = sbuf + offs;\n\tapdu.datalen = sizeof(sbuf) - offs;\n\tapdu.lc = sizeof(sbuf) - offs;\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.le = 0x100;\n\n\trv = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(ctx, rv, \"APDU transmit failed\");\n\trv = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(ctx, rv, \"SDO get data error\");\n\n\trv = iasecc_sdo_parse(card, apdu.resp, apdu.resplen, sdo);\n\tLOG_TEST_RET(ctx, rv, \"cannot parse SDO data\");\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4087. "project": "OpenSC",
  4088. "hash": 25529644230219156488265076316226132132,
  4089. "size": 48,
  4090. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4091. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4092. "target": 0,
  4093. "dataset": "other",
  4094. "idx": 263066
  4095. },
  4096. {
  4097. "func": "iasecc_pin_get_status(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct sc_pin_cmd_data info;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tif (data->pin_type != SC_AC_CHV)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, \"PIN type is not supported for status\");\n\n\tmemset(&info, 0, sizeof(info));\n\tinfo.cmd = SC_PIN_CMD_GET_INFO;\n\tinfo.pin_type = data->pin_type;\n\tinfo.pin_reference = data->pin_reference;\n\n\trv = iso_ops->pin_cmd(card, &info, tries_left);\n\tLOG_TEST_RET(ctx, rv, \"Failed to get PIN info\");\n\n\tdata->pin1.max_tries = info.pin1.max_tries;\n\tdata->pin1.tries_left = info.pin1.tries_left;\n\tdata->pin1.logged_in = info.pin1.logged_in;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4098. "project": "OpenSC",
  4099. "hash": 106841744387906902811671076600302558838,
  4100. "size": 25,
  4101. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4102. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4103. "target": 0,
  4104. "dataset": "other",
  4105. "idx": 263067
  4106. },
  4107. {
  4108. "func": "iasecc_sdo_delete(struct sc_card *card, struct iasecc_sdo *sdo)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct sc_apdu apdu;\n\tunsigned char data[6] = {\n\t\t0x70, 0x04, 0xBF, 0xFF, 0xFF, 0x00\n\t};\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (sdo->magic != SC_CARDCTL_IASECC_SDO_MAGIC)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Invalid SDO data\");\n\n\tdata[2] = IASECC_SDO_TAG_HEADER;\n\tdata[3] = sdo->sdo_class | 0x80;\n\tdata[4] = sdo->sdo_ref;\n\tsc_log(ctx, \"delete SDO %02X%02X%02X\", data[2], data[3], data[4]);\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xDB, 0x3F, 0xFF);\n\tapdu.data = data;\n\tapdu.datalen = sizeof(data);\n\tapdu.lc = sizeof(data);\n\tapdu.flags |= SC_APDU_FLAGS_CHAINING;\n\n\trv = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(ctx, rv, \"APDU transmit failed\");\n\trv = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(ctx, rv, \"delete SDO error\");\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4109. "project": "OpenSC",
  4110. "hash": 43258280201331597194492542871471416732,
  4111. "size": 31,
  4112. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4113. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4114. "target": 0,
  4115. "dataset": "other",
  4116. "idx": 263070
  4117. },
  4118. {
  4119. "func": "iasecc_get_challenge(struct sc_card *card, u8 * rnd, size_t len)\n{\n\t/* As IAS/ECC cannot handle other data length than 0x08 */\n\tu8 rbuf[8];\n\tsize_t out_len;\n\tint r;\n\n\tLOG_FUNC_CALLED(card->ctx);\n\n\tr = iso_ops->get_challenge(card, rbuf, sizeof rbuf);\n\tLOG_TEST_RET(card->ctx, r, \"GET CHALLENGE cmd failed\");\n\n\tif (len < (size_t) r) {\n\t\tout_len = len;\n\t} else {\n\t\tout_len = (size_t) r;\n\t}\n\tmemcpy(rnd, rbuf, out_len);\n\n\tLOG_FUNC_RETURN(card->ctx, (int) out_len);\n}",
  4120. "project": "OpenSC",
  4121. "hash": 261201501953976210586813636913118699689,
  4122. "size": 21,
  4123. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4124. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4125. "target": 0,
  4126. "dataset": "other",
  4127. "idx": 263071
  4128. },
  4129. {
  4130. "func": "iasecc_emulate_fcp(struct sc_context *ctx, struct sc_apdu *apdu)\n{\n\tunsigned char dummy_df_fcp[] = {\n\t\t0x62,0xFF,\n\t\t\t0x82,0x01,0x38,\n\t\t\t0x8A,0x01,0x05,\n\t\t\t0xA1,0x04,0x8C,0x02,0x02,0x00,\n\t\t\t0x84,0xFF,\n\t\t\t\t0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,\n\t\t\t\t0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF\n\t};\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tif (apdu->p1 != 0x04)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, \"FCP emulation supported only for the DF-NAME selection type\");\n\tif (apdu->datalen > 16)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Invalid DF-NAME length\");\n\tif (apdu->resplen < apdu->datalen + 16)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_BUFFER_TOO_SMALL, \"not enough space for FCP data\");\n\n\tmemcpy(dummy_df_fcp + 16, apdu->data, apdu->datalen);\n\tdummy_df_fcp[15] = apdu->datalen;\n\tdummy_df_fcp[1] = apdu->datalen + 14;\n\tmemcpy(apdu->resp, dummy_df_fcp, apdu->datalen + 16);\n\n\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n}",
  4131. "project": "OpenSC",
  4132. "hash": 176776630660953583824664816852844312503,
  4133. "size": 28,
  4134. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4135. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4136. "target": 0,
  4137. "dataset": "other",
  4138. "idx": 263075
  4139. },
  4140. {
  4141. "func": "iasecc_logout(struct sc_card *card)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct sc_path path;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (!card->ef_atr || !card->ef_atr->aid.len)\n\t\treturn SC_SUCCESS;\n\n\tmemset(&path, 0, sizeof(struct sc_path));\n\tpath.type = SC_PATH_TYPE_DF_NAME;\n\tmemcpy(path.value, card->ef_atr->aid.value, card->ef_atr->aid.len);\n\tpath.len = card->ef_atr->aid.len;\n\n\trv = iasecc_select_file(card, &path, NULL);\n\tsc_log(ctx, \"Select ECC ROOT with the AID from EF.ATR: rv %i\", rv);\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4142. "project": "OpenSC",
  4143. "hash": 148666483426494250974710574127556653719,
  4144. "size": 20,
  4145. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4146. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4147. "target": 0,
  4148. "dataset": "other",
  4149. "idx": 263081
  4150. },
  4151. {
  4152. "func": "iasecc_pin_get_info(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_pin_policy policy;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx, \"iasecc_pin_get_info(card:%p)\", card);\n\n\t/*\n\t * Get PIN status first and thereafter update with info from PIN policy, when available.\n\t * The first one is typically used for the PIN verification status and number of remaining\n\t * tries, and the second one for the maximum tries. If a field is present in both, the\n\t * policy takes precedence.\n\t */\n\trv = iasecc_pin_get_status(card, data, tries_left);\n\tLOG_TEST_RET(ctx, rv, \"Failed to get PIN status\");\n\n\trv = iasecc_pin_get_policy(card, data, &policy);\n\tLOG_TEST_RET(ctx, rv, \"Failed to get PIN policy\");\n\n\t/*\n\t * We only care about the tries_xxx fields in the PIN policy, since the other ones are not\n\t * commonly expected or used in a SC_PIN_CMD_GET_INFO response.\tNote that max_tries is\n\t * always taken from the policy, since it is never expected to be available in status (it\n\t * is set to -1 when not available in policy).\n\t */\n\tdata->pin1.max_tries = policy.tries_maximum;\n\tif (policy.tries_remaining >= 0)\n\t\tdata->pin1.tries_left = policy.tries_remaining;\n\n\tif (tries_left)\n\t\t*tries_left = data->pin1.tries_left;\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4153. "project": "OpenSC",
  4154. "hash": 132552394277754119898556595827787832900,
  4155. "size": 36,
  4156. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4157. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4158. "target": 0,
  4159. "dataset": "other",
  4160. "idx": 263082
  4161. },
  4162. {
  4163. "func": "iasecc_read_public_key(struct sc_card *card, unsigned type,\n\t\tstruct sc_path *key_path, unsigned ref, unsigned size,\n\t\tunsigned char **out, size_t *out_len)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_sdo sdo;\n\tstruct sc_pkcs15_bignum bn[2];\n\tstruct sc_pkcs15_pubkey_rsa rsa_key;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (type != SC_ALGORITHM_RSA)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED);\n\n\tsc_log(ctx, \"read public kay(ref:%i;size:%i)\", ref, size);\n\n\tmemset(&bn, 0, sizeof bn);\n\tmemset(&sdo, 0, sizeof(sdo));\n\tsdo.sdo_class = IASECC_SDO_CLASS_RSA_PUBLIC;\n\tsdo.sdo_ref = ref & ~IASECC_OBJECT_REF_LOCAL;\n\n\trv = iasecc_sdo_get_data(card, &sdo);\n\tLOG_TEST_GOTO_ERR(ctx, rv, \"failed to read public key: cannot get RSA SDO data\");\n\n\tif (out)\n\t\t*out = NULL;\n\tif (out_len)\n\t\t*out_len = 0;\n\n\tbn[0].data = (unsigned char *) malloc(sdo.data.pub_key.n.size);\n\tif (!bn[0].data)\n\t\tLOG_TEST_GOTO_ERR(ctx, SC_ERROR_OUT_OF_MEMORY, \"failed to read public key: cannot allocate modulus\");\n\tbn[0].len = sdo.data.pub_key.n.size;\n\tmemcpy(bn[0].data, sdo.data.pub_key.n.value, sdo.data.pub_key.n.size);\n\n\tbn[1].data = (unsigned char *) malloc(sdo.data.pub_key.e.size);\n\tif (!bn[1].data)\n\t\tLOG_TEST_GOTO_ERR(ctx, SC_ERROR_OUT_OF_MEMORY, \"failed to read public key: cannot allocate exponent\");\n\tbn[1].len = sdo.data.pub_key.e.size;\n\tmemcpy(bn[1].data, sdo.data.pub_key.e.value, sdo.data.pub_key.e.size);\n\n\trsa_key.modulus = bn[0];\n\trsa_key.exponent = bn[1];\n\n\trv = sc_pkcs15_encode_pubkey_rsa(ctx, &rsa_key, out, out_len);\n\tLOG_TEST_GOTO_ERR(ctx, rv, \"failed to read public key: cannot encode RSA public key\");\n\n\tif (out && out_len)\n\t\tsc_log(ctx, \"encoded public key: %s\", sc_dump_hex(*out, *out_len));\n\nerr:\n\tif (bn[0].data)\n\t\tfree(bn[0].data);\n\tif (bn[1].data)\n\t\tfree(bn[1].data);\n\n\tiasecc_sdo_free_fields(card, &sdo);\n\n\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n}",
  4164. "project": "OpenSC",
  4165. "hash": 315203167397516228462441843403656781758,
  4166. "size": 60,
  4167. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4168. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4169. "target": 0,
  4170. "dataset": "other",
  4171. "idx": 263083
  4172. },
  4173. {
  4174. "func": "iasecc_init_oberthur(struct sc_card *card)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tunsigned int flags;\n\tint rv = 0;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tflags = IASECC_CARD_DEFAULT_FLAGS;\n\n\t_sc_card_add_rsa_alg(card, 1024, flags, 0x10001);\n\t_sc_card_add_rsa_alg(card, 2048, flags, 0x10001);\n\n\tcard->caps = IASECC_CARD_DEFAULT_CAPS;\n\n\tiasecc_parse_ef_atr(card);\n\n\t/* if we fail to select CM, */\n\tif (gp_select_card_manager(card)) {\n\t\tgp_select_isd_rid(card);\n\t}\n\n\trv = iasecc_oberthur_match(card);\n\tLOG_TEST_RET(ctx, rv, \"unknown Oberthur's IAS/ECC card\");\n\n\trv = iasecc_select_mf(card, NULL);\n\tLOG_TEST_RET(ctx, rv, \"MF selection error\");\n\n\trv = iasecc_parse_ef_atr(card);\n\tLOG_TEST_RET(ctx, rv, \"EF.ATR read or parse error\");\n\n\tsc_log(ctx, \"EF.ATR(aid:'%s')\", sc_dump_hex(card->ef_atr->aid.value, card->ef_atr->aid.len));\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4175. "project": "OpenSC",
  4176. "hash": 205389055147630064158010606194876395963,
  4177. "size": 34,
  4178. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4179. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4180. "target": 0,
  4181. "dataset": "other",
  4182. "idx": 263085
  4183. },
  4184. {
  4185. "func": "iasecc_oberthur_match(struct sc_card *card)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tunsigned char *hist = card->reader->atr_info.hist_bytes;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tif (*hist != 0x80 || ((*(hist+1)&0xF0) != 0xF0))\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_OBJECT_NOT_FOUND);\n\n\tsc_log_hex(ctx, \"AID in historical_bytes\", hist + 2, *(hist+1) & 0x0F);\n\n\tif (memcmp(hist + 2, OberthurIASECC_AID.value, *(hist+1) & 0x0F))\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_RECORD_NOT_FOUND);\n\n\tif (!card->ef_atr)\n\t\tcard->ef_atr = calloc(1, sizeof(struct sc_ef_atr));\n\tif (!card->ef_atr)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY);\n\n\tmemcpy(card->ef_atr->aid.value, OberthurIASECC_AID.value, OberthurIASECC_AID.len);\n\tcard->ef_atr->aid.len = OberthurIASECC_AID.len;\n\n\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n}",
  4186. "project": "OpenSC",
  4187. "hash": 163712996260215261531884654967222438081,
  4188. "size": 25,
  4189. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4190. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4191. "target": 0,
  4192. "dataset": "other",
  4193. "idx": 263087
  4194. },
  4195. {
  4196. "func": "iasecc_mi_match(struct sc_card *card)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tunsigned char resp[0x100];\n\tsize_t resp_len;\n\tint rv = 0;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tresp_len = sizeof(resp);\n\trv = iasecc_select_aid(card, &MIIASECC_AID, resp, &resp_len);\n\tLOG_TEST_RET(ctx, rv, \"IASECC: failed to select MI IAS/ECC applet\");\n\n\tif (!card->ef_atr)\n\t\tcard->ef_atr = calloc(1, sizeof(struct sc_ef_atr));\n\tif (!card->ef_atr)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY);\n\n\tmemcpy(card->ef_atr->aid.value, MIIASECC_AID.value, MIIASECC_AID.len);\n\tcard->ef_atr->aid.len = MIIASECC_AID.len;\n\n\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n}",
  4197. "project": "OpenSC",
  4198. "hash": 95111025810445059847280487070484214495,
  4199. "size": 23,
  4200. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4201. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4202. "target": 0,
  4203. "dataset": "other",
  4204. "idx": 263092
  4205. },
  4206. {
  4207. "func": "iasecc_keyset_change(struct sc_card *card, struct sc_pin_cmd_data *data, int *tries_left)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_sdo_update update;\n\tstruct iasecc_sdo sdo;\n\tunsigned scb;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx, \"Change keyset(ref:%i,lengths:%i)\", data->pin_reference, data->pin2.len);\n\tif (!data->pin2.data || data->pin2.len < 32)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Needs at least 32 bytes for a new keyset value\");\n\n\tmemset(&sdo, 0, sizeof(sdo));\n\tsdo.sdo_class = IASECC_SDO_CLASS_KEYSET;\n\tsdo.sdo_ref = data->pin_reference;\n\n\trv = iasecc_sdo_get_data(card, &sdo);\n\tLOG_TEST_RET(ctx, rv, \"Cannot get keyset data\");\n\n\tif (sdo.docp.acls_contact.size == 0)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, \"Bewildered ... there are no ACLs\");\n\tscb = sdo.docp.scbs[IASECC_ACLS_KEYSET_PUT_DATA];\n\tiasecc_sdo_free_fields(card, &sdo);\n\n\tsc_log(ctx, \"SCB:0x%X\", scb);\n\tif (!(scb & IASECC_SCB_METHOD_SM))\n\t\tLOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, \"Other then protected by SM, the keyset change is not supported\");\n\n\tmemset(&update, 0, sizeof(update));\n\tupdate.magic = SC_CARDCTL_IASECC_SDO_MAGIC_PUT_DATA;\n\tupdate.sdo_class = sdo.sdo_class;\n\tupdate.sdo_ref = sdo.sdo_ref;\n\n\tupdate.fields[0].parent_tag = IASECC_SDO_KEYSET_TAG;\n\tupdate.fields[0].tag = IASECC_SDO_KEYSET_TAG_MAC;\n\t/* FIXME is it safe to modify the const value here? */\n\tupdate.fields[0].value = (unsigned char *) data->pin2.data;\n\tupdate.fields[0].size = 16;\n\n\tupdate.fields[1].parent_tag = IASECC_SDO_KEYSET_TAG;\n\tupdate.fields[1].tag = IASECC_SDO_KEYSET_TAG_ENC;\n\t/* FIXME is it safe to modify the const value here? */\n\tupdate.fields[1].value = (unsigned char *) data->pin2.data + 16;\n\tupdate.fields[1].size = 16;\n\n\trv = iasecc_sm_sdo_update(card, (scb & IASECC_SCB_METHOD_MASK_REF), &update);\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4208. "project": "OpenSC",
  4209. "hash": 204991041015945350884073502971386064385,
  4210. "size": 49,
  4211. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4212. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4213. "target": 0,
  4214. "dataset": "other",
  4215. "idx": 263101
  4216. },
  4217. {
  4218. "func": "iasecc_select_aid(struct sc_card *card, struct sc_aid *aid, unsigned char *out, size_t *out_len)\n{\n\tstruct sc_apdu apdu;\n\tunsigned char apdu_resp[SC_MAX_APDU_BUFFER_SIZE];\n\tint rv;\n\n\tLOG_FUNC_CALLED(card->ctx);\n\n\t/* Select application (deselect previously selected application) */\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0x04, 0x00);\n\tapdu.lc = aid->len;\n\tapdu.data = aid->value;\n\tapdu.datalen = aid->len;\n\tapdu.resplen = sizeof(apdu_resp);\n\tapdu.resp = apdu_resp;\n\n\trv = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, rv, \"APDU transmit failed\");\n\trv = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(card->ctx, rv, \"Cannot select AID\");\n\n\tif (*out_len < apdu.resplen)\n\t\tLOG_TEST_RET(card->ctx, SC_ERROR_BUFFER_TOO_SMALL, \"Cannot select AID\");\n\tmemcpy(out, apdu.resp, apdu.resplen);\n\n\tLOG_FUNC_RETURN(card->ctx, SC_SUCCESS);\n}",
  4219. "project": "OpenSC",
  4220. "hash": 21848766340836499823157684633773894841,
  4221. "size": 27,
  4222. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4223. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4224. "target": 0,
  4225. "dataset": "other",
  4226. "idx": 263102
  4227. },
  4228. {
  4229. "func": "iasecc_se_at_to_chv_reference(struct sc_card *card, unsigned reference,\n\t\tunsigned *chv_reference)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_se_info se;\n\tstruct sc_crt crt;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx, \"SE reference %i\", reference);\n\n\tif (reference > IASECC_SE_REF_MAX)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS);\n\n\tmemset(&se, 0, sizeof(se));\n\tse.reference = reference;\n\n\trv = iasecc_se_get_info(card, &se);\n\tLOG_TEST_RET(ctx, rv, \"SDO get data error\");\n\n\tmemset(&crt, 0, sizeof(crt));\n\tcrt.tag = IASECC_CRT_TAG_AT;\n\tcrt.usage = IASECC_UQB_AT_USER_PASSWORD;\n\n\trv = iasecc_se_get_crt(card, &se, &crt);\n\tLOG_TEST_RET(ctx, rv, \"no authentication template for USER PASSWORD\");\n\n\tif (chv_reference)\n\t\t*chv_reference = crt.refs[0];\n\n\tsc_file_free(se.df);\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4230. "project": "OpenSC",
  4231. "hash": 97041316709397951495231138749203507311,
  4232. "size": 34,
  4233. "commit_id": "ae1cf0be90396fb6c0be95829bf0d3eecbd2fd1c",
  4234. "message": "iasecc: Prevent stack buffer overflow when empty ACL is returned\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=30800",
  4235. "target": 0,
  4236. "dataset": "other",
  4237. "idx": 263103
  4238. },
  4239. {
  4240. "func": "cardos_pin_cmd(struct sc_card *card, struct sc_pin_cmd_data *data,\n\t\t int *tries_left)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tint rv;\n\n\tLOG_FUNC_CALLED(card->ctx);\n\n\tdata->flags |= SC_PIN_CMD_NEED_PADDING;\n\tdata->pin_reference |= 0x80;\n\n\tsc_log(ctx, \"PIN_CMD(cmd:%i, ref:%i)\", data->cmd, data->pin_reference);\n\tsc_log(ctx,\n\t \"PIN1(max:%\"SC_FORMAT_LEN_SIZE_T\"u, min:%\"SC_FORMAT_LEN_SIZE_T\"u)\",\n\t data->pin1.max_length, data->pin1.min_length);\n\tsc_log(ctx,\n\t \"PIN2(max:%\"SC_FORMAT_LEN_SIZE_T\"u, min:%\"SC_FORMAT_LEN_SIZE_T\"u)\",\n\t data->pin2.max_length, data->pin2.min_length);\n\n\t/* FIXME: the following values depend on what pin length was\n\t * used when creating the BS objects */\n\tif (data->pin1.max_length == 0)\n\t\tdata->pin1.max_length = 8;\n\tif (data->pin2.max_length == 0)\n\t\tdata->pin2.max_length = 8;\n\n\trv = iso_ops->pin_cmd(card, data, tries_left);\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4241. "project": "OpenSC",
  4242. "hash": 110217722918257014182321427742726906495,
  4243. "size": 29,
  4244. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4245. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4246. "target": 0,
  4247. "dataset": "other",
  4248. "idx": 270683
  4249. },
  4250. {
  4251. "func": "iasecc_init_oberthur(struct sc_card *card)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tunsigned int flags;\n\tint rv = 0;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tflags = IASECC_CARD_DEFAULT_FLAGS;\n\n\t_sc_card_add_rsa_alg(card, 1024, flags, 0x10001);\n\t_sc_card_add_rsa_alg(card, 2048, flags, 0x10001);\n\n\tcard->caps = SC_CARD_CAP_RNG;\n\tcard->caps |= SC_CARD_CAP_APDU_EXT;\n\tcard->caps |= SC_CARD_CAP_USE_FCI_AC;\n\n\tiasecc_parse_ef_atr(card);\n\n\t/* if we fail to select CM, */\n\tif (gp_select_card_manager(card)) {\n\t\tgp_select_isd_rid(card);\n\t}\n\n\trv = iasecc_oberthur_match(card);\n\tLOG_TEST_RET(ctx, rv, \"unknown Oberthur's IAS/ECC card\");\n\n\trv = iasecc_select_mf(card, NULL);\n\tLOG_TEST_RET(ctx, rv, \"MF selection error\");\n\n\trv = iasecc_parse_ef_atr(card);\n\tLOG_TEST_RET(ctx, rv, \"EF.ATR read or parse error\");\n\n\tsc_log(ctx, \"EF.ATR(aid:'%s')\", sc_dump_hex(card->ef_atr->aid.value, card->ef_atr->aid.len));\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4252. "project": "OpenSC",
  4253. "hash": 241877578292856038970382487397898662950,
  4254. "size": 36,
  4255. "commit_id": "03628449b75a93787eb2359412a3980365dda49b",
  4256. "message": "iasecc: fixed unbound recursion",
  4257. "target": 0,
  4258. "dataset": "other",
  4259. "idx": 477388
  4260. },
  4261. {
  4262. "func": "iasecc_erase_binary(struct sc_card *card, unsigned int offs, size_t count, unsigned long flags)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tunsigned char *tmp = NULL;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_log(ctx,\n\t \"iasecc_erase_binary(card:%p) count %\"SC_FORMAT_LEN_SIZE_T\"u\",\n\t card, count);\n\tif (!count)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_INVALID_ARGUMENTS, \"'ERASE BINARY' failed: invalid size to erase\");\n\n\ttmp = malloc(count);\n\tif (!tmp)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"Cannot allocate temporary buffer\");\n\tmemset(tmp, 0xFF, count);\n\n\trv = sc_update_binary(card, offs, tmp, count, flags);\n\tfree(tmp);\n\tLOG_TEST_RET(ctx, rv, \"iasecc_erase_binary() update binary error\");\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4263. "project": "OpenSC",
  4264. "hash": 286767445392702469437890767623375659064,
  4265. "size": 23,
  4266. "commit_id": "03628449b75a93787eb2359412a3980365dda49b",
  4267. "message": "iasecc: fixed unbound recursion",
  4268. "target": 0,
  4269. "dataset": "other",
  4270. "idx": 477391
  4271. },
  4272. {
  4273. "func": "iasecc_pin_is_verified(struct sc_card *card, struct sc_pin_cmd_data *pin_cmd_data,\n\t\tint *tries_left)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct sc_pin_cmd_data pin_cmd;\n struct sc_acl_entry acl = pin_cmd_data->pin1.acls[IASECC_ACLS_CHV_VERIFY];\n\tint rv = SC_ERROR_SECURITY_STATUS_NOT_SATISFIED;\n\n\tLOG_FUNC_CALLED(ctx);\n\n\tif (pin_cmd_data->pin_type != SC_AC_CHV)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_NOT_SUPPORTED, \"PIN type is not supported for the verification\");\n\n\tsc_log(ctx, \"Verify ACL(method:%X;ref:%X)\", acl.method, acl.key_ref);\n\tif (acl.method != IASECC_SCB_ALWAYS)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_SECURITY_STATUS_NOT_SATISFIED);\n\n\tpin_cmd = *pin_cmd_data;\n\tpin_cmd.pin1.data = (unsigned char *)\"\";\n\tpin_cmd.pin1.len = 0;\n\n\trv = iasecc_chv_verify(card, &pin_cmd, tries_left);\n\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4274. "project": "OpenSC",
  4275. "hash": 56839879132402598366734645598041357512,
  4276. "size": 25,
  4277. "commit_id": "03628449b75a93787eb2359412a3980365dda49b",
  4278. "message": "iasecc: fixed unbound recursion",
  4279. "target": 0,
  4280. "dataset": "other",
  4281. "idx": 477397
  4282. },
  4283. {
  4284. "func": "iasecc_delete_file(struct sc_card *card, const struct sc_path *path)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tconst struct sc_acl_entry *entry = NULL;\n\tstruct sc_apdu apdu;\n\tstruct sc_file *file = NULL;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tsc_print_cache(card);\n\n\trv = iasecc_select_file(card, path, &file);\n\tif (rv == SC_ERROR_FILE_NOT_FOUND)\n\t\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n\tLOG_TEST_RET(ctx, rv, \"Cannot select file to delete\");\n\n\tentry = sc_file_get_acl_entry(file, SC_AC_OP_DELETE);\n\tif (!entry)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OBJECT_NOT_FOUND, \"Cannot delete file: no 'DELETE' acl\");\n\n\tsc_log(ctx, \"DELETE method/reference %X/%X\", entry->method, entry->key_ref);\n\tif (entry->method == SC_AC_SCB && (entry->key_ref & IASECC_SCB_METHOD_SM)) {\n\t\tunsigned char se_num = (entry->method == SC_AC_SCB) ? (entry->key_ref & IASECC_SCB_METHOD_MASK_REF) : 0;\n\t\trv = iasecc_sm_delete_file(card, se_num, file->id);\n\t}\n\telse {\n\t\tsc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0xE4, 0x00, 0x00);\n\n\t\trv = sc_transmit_apdu(card, &apdu);\n\t\tLOG_TEST_RET(ctx, rv, \"APDU transmit failed\");\n\t\trv = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\t\tLOG_TEST_RET(ctx, rv, \"Delete file failed\");\n\n\t\tif (card->cache.valid)\n\t\t\tsc_file_free(card->cache.current_ef);\n\t\tcard->cache.current_ef = NULL;\n\t}\n\n\tsc_file_free(file);\n\tLOG_FUNC_RETURN(ctx, rv);\n}",
  4285. "project": "OpenSC",
  4286. "hash": 106435940525695054652280206737331373380,
  4287. "size": 41,
  4288. "commit_id": "03628449b75a93787eb2359412a3980365dda49b",
  4289. "message": "iasecc: fixed unbound recursion",
  4290. "target": 0,
  4291. "dataset": "other",
  4292. "idx": 477399
  4293. },
  4294. {
  4295. "func": "iasecc_read_public_key(struct sc_card *card, unsigned type,\n\t\tstruct sc_path *key_path, unsigned ref, unsigned size,\n\t\tunsigned char **out, size_t *out_len)\n{\n\tstruct sc_context *ctx = card->ctx;\n\tstruct iasecc_sdo sdo;\n\tstruct sc_pkcs15_bignum bn[2];\n\tstruct sc_pkcs15_pubkey_rsa rsa_key;\n\tint rv;\n\n\tLOG_FUNC_CALLED(ctx);\n\tif (type != SC_ALGORITHM_RSA)\n\t\tLOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED);\n\n\tsc_log(ctx, \"read public kay(ref:%i;size:%i)\", ref, size);\n\n\tmemset(&sdo, 0, sizeof(sdo));\n\tsdo.sdo_class = IASECC_SDO_CLASS_RSA_PUBLIC;\n\tsdo.sdo_ref = ref & ~IASECC_OBJECT_REF_LOCAL;\n\n\trv = iasecc_sdo_get_data(card, &sdo);\n\tLOG_TEST_RET(ctx, rv, \"failed to read public key: cannot get RSA SDO data\");\n\n\tif (out)\n\t\t*out = NULL;\n\tif (out_len)\n\t\t*out_len = 0;\n\n\tbn[0].data = (unsigned char *) malloc(sdo.data.pub_key.n.size);\n\tif (!bn[0].data)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"failed to read public key: cannot allocate modulus\");\n\tbn[0].len = sdo.data.pub_key.n.size;\n\tmemcpy(bn[0].data, sdo.data.pub_key.n.value, sdo.data.pub_key.n.size);\n\n\tbn[1].data = (unsigned char *) malloc(sdo.data.pub_key.e.size);\n\tif (!bn[1].data)\n\t\tLOG_TEST_RET(ctx, SC_ERROR_OUT_OF_MEMORY, \"failed to read public key: cannot allocate exponent\");\n\tbn[1].len = sdo.data.pub_key.e.size;\n\tmemcpy(bn[1].data, sdo.data.pub_key.e.value, sdo.data.pub_key.e.size);\n\n\trsa_key.modulus = bn[0];\n\trsa_key.exponent = bn[1];\n\n\trv = sc_pkcs15_encode_pubkey_rsa(ctx, &rsa_key, out, out_len);\n\tLOG_TEST_RET(ctx, rv, \"failed to read public key: cannot encode RSA public key\");\n\n\tif (out && out_len)\n\t\tsc_log(ctx, \"encoded public key: %s\", sc_dump_hex(*out, *out_len));\n\n\tif (bn[0].data)\n\t\tfree(bn[0].data);\n\tif (bn[1].data)\n\t\tfree(bn[1].data);\n\n\tiasecc_sdo_free_fields(card, &sdo);\n\n\tLOG_FUNC_RETURN(ctx, SC_SUCCESS);\n}",
  4296. "project": "OpenSC",
  4297. "hash": 249819631170925573129321638182432322482,
  4298. "size": 58,
  4299. "commit_id": "03628449b75a93787eb2359412a3980365dda49b",
  4300. "message": "iasecc: fixed unbound recursion",
  4301. "target": 0,
  4302. "dataset": "other",
  4303. "idx": 477409
  4304. },
  4305. {
  4306. "func": "static int cardos_match_card(sc_card_t *card)\n{\n\tunsigned char atr[SC_MAX_ATR_SIZE];\n\tint i;\n\n\ti = _sc_match_atr(card, cardos_atrs, &card->type);\n\tif (i < 0)\n\t\treturn 0;\n\n\tmemcpy(atr, card->atr.value, sizeof(atr));\n\n\t/* Do not change card type for CIE! */\n\tif (card->type == SC_CARD_TYPE_CARDOS_CIE_V1)\n\t\treturn 1;\n\tif (card->type == SC_CARD_TYPE_CARDOS_M4_4)\n\t\treturn 1;\n\tif (card->type == SC_CARD_TYPE_CARDOS_V5_0)\n\t\treturn 1;\n\tif (card->type == SC_CARD_TYPE_CARDOS_V5_3)\n\t\treturn 1;\n\tif (card->type == SC_CARD_TYPE_CARDOS_M4_2) {\n\t\tint rv;\n\t\tsc_apdu_t apdu;\n\t\tu8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n\t\t/* first check some additional ATR bytes */\n\t\tif ((atr[4] != 0xff && atr[4] != 0x02) ||\n\t\t (atr[6] != 0x10 && atr[6] != 0x0a) ||\n\t\t (atr[9] != 0x55 && atr[9] != 0x58))\n\t\t\treturn 0;\n\t\t/* get the os version using GET DATA and compare it with\n\t\t * version in the ATR */\n\t\tsc_log(card->ctx, \"checking cardos version ...\");\n\t\tsc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x82);\n\t\tapdu.resp = rbuf;\n\t\tapdu.resplen = sizeof(rbuf);\n\t\tapdu.le = 256;\n\t\tapdu.lc = 0;\n\t\trv = sc_transmit_apdu(card, &apdu);\n\t\tLOG_TEST_RET(card->ctx, rv, \"APDU transmit failed\");\n\t\tif (apdu.sw1 != 0x90 || apdu.sw2 != 0x00)\n\t\t\treturn 0;\n\t\tif (apdu.resp[0] != atr[10] ||\n\t\t apdu.resp[1] != atr[11])\n\t\t\t/* version mismatch */\n\t\t\treturn 0;\n\t\tif (atr[11] <= 0x04) {\n\t\t\tsc_log(card->ctx, \"found cardos m4.01\");\n\t\t\tcard->type = SC_CARD_TYPE_CARDOS_M4_01;\n\t\t} else if (atr[11] == 0x08) {\n\t\t\tsc_log(card->ctx, \"found cardos v4.3b\");\n\t\t\tcard->type = SC_CARD_TYPE_CARDOS_M4_3;\n\t\t} else if (atr[11] == 0x09) {\n\t\t\tsc_log(card->ctx, \"found cardos v4.2b\");\n\t\t\tcard->type = SC_CARD_TYPE_CARDOS_M4_2B;\n\t\t} else if (atr[11] >= 0x0B) {\n\t\t\tsc_log(card->ctx, \"found cardos v4.2c or higher\");\n\t\t\tcard->type = SC_CARD_TYPE_CARDOS_M4_2C;\n\t\t} else {\n\t\t\tsc_log(card->ctx, \"found cardos m4.2\");\n\t\t}\n\t}\n\treturn 1;\n}",
  4307. "project": "OpenSC",
  4308. "hash": 32307202605202363560520887583044093580,
  4309. "size": 63,
  4310. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4311. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4312. "target": 0,
  4313. "dataset": "other",
  4314. "idx": 270685
  4315. },
  4316. {
  4317. "func": "static int cardos_finish(sc_card_t *card)\n{\n\tint r = 0;\n\n\tif (card == NULL )\n\t\treturn 0;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\t/* free priv data */\n\tif (card->drv_data) { /* priv */\n\t\tfree(card->drv_data);\n\t\tcard->drv_data = NULL;\n\t}\n\n\tSC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r);\n}",
  4318. "project": "OpenSC",
  4319. "hash": 244173873168509094839430270510823033122,
  4320. "size": 17,
  4321. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4322. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4323. "target": 0,
  4324. "dataset": "other",
  4325. "idx": 270682
  4326. },
  4327. {
  4328. "func": "static int cardos_select_file(sc_card_t *card,\n\t\t\t const sc_path_t *in_path,\n\t\t\t sc_file_t **file)\n{\n\tint r;\n\t\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\tr = iso_ops->select_file(card, in_path, file);\n\tif (r >= 0 && file)\n\t\tparse_sec_attr((*file), (*file)->sec_attr, (*file)->sec_attr_len);\n\tLOG_FUNC_RETURN(card->ctx, r);\n}",
  4329. "project": "OpenSC",
  4330. "hash": 220167332415412336103533624089271004879,
  4331. "size": 12,
  4332. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4333. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4334. "target": 0,
  4335. "dataset": "other",
  4336. "idx": 270699
  4337. },
  4338. {
  4339. "func": "static int cardos_acl_to_bytes(sc_card_t *card, const sc_file_t *file,\n\tu8 *buf, size_t *outlen)\n{\n\tint i, byte;\n\tconst int *idx;\n\n\tif (buf == NULL || *outlen < 9)\n\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\n\tidx = (file->type == SC_FILE_TYPE_DF) ? df_acl : ef_acl;\n\tfor (i = 0; i < 9; i++) {\n\t\tif (idx[i] < 0)\n\t\t\tbyte = 0x00;\n\t\telse\n\t\t\tbyte = acl_to_byte(sc_file_get_acl_entry(file, idx[i]));\n\t\tif (byte < 0) {\n\t\t\tsc_log(card->ctx, \"Invalid ACL\\n\");\n\t\t\treturn SC_ERROR_INVALID_ARGUMENTS;\n\t\t}\n\t\tbuf[i] = byte;\n\t}\n\t*outlen = 9;\n\n\treturn SC_SUCCESS;\n}",
  4340. "project": "OpenSC",
  4341. "hash": 116603371760897077753850198424747802332,
  4342. "size": 25,
  4343. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4344. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4345. "target": 0,
  4346. "dataset": "other",
  4347. "idx": 270669
  4348. },
  4349. {
  4350. "func": "static int tcos_delete_file(sc_card_t *card, const sc_path_t *path)\n{\n\tint r;\n\tu8 sbuf[2];\n\tsc_apdu_t apdu;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\tif (path->type != SC_PATH_TYPE_FILE_ID && path->len != 2) {\n\t\tsc_log(card->ctx, \"File type has to be SC_PATH_TYPE_FILE_ID\\n\");\n\t\tLOG_FUNC_RETURN(card->ctx, SC_ERROR_INVALID_ARGUMENTS);\n\t}\n\tsbuf[0] = path->value[0];\n\tsbuf[1] = path->value[1];\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE4, 0x00, 0x00);\n\tapdu.cla |= 0x80;\n\tapdu.lc = 2;\n\tapdu.datalen = 2;\n\tapdu.data = sbuf;\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\treturn sc_check_sw(card, apdu.sw1, apdu.sw2);\n}",
  4351. "project": "OpenSC",
  4352. "hash": 321169854647165267216778895686755280248,
  4353. "size": 23,
  4354. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  4355. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  4356. "target": 0,
  4357. "dataset": "other",
  4358. "idx": 453696
  4359. },
  4360. {
  4361. "func": "static int cardos_list_files(sc_card_t *card, u8 *buf, size_t buflen)\n{\n\tsc_apdu_t apdu;\n\tu8 rbuf[256], offset = 0;\n\tconst u8 *p = rbuf, *q;\n\tint r;\n\tsize_t fids = 0, len;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\t/* 0x16: DIRECTORY */\n\t/* 0x02: list both DF and EF */\n\nget_next_part:\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0x16, 0x02, offset);\n\tapdu.cla = 0x80;\n\tapdu.le = 256;\n\tapdu.resplen = 256;\n\tapdu.resp = rbuf;\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\tr = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(card->ctx, r, \"DIRECTORY command returned error\");\n\n\tif (apdu.resplen > 256) {\n\t\tsc_log(card->ctx, \"directory listing > 256 bytes, cutting\");\n\t}\n\n\tlen = apdu.resplen;\n\twhile (len != 0) {\n\t\tsize_t tlen = 0, ilen = 0;\n\t\t/* is there a file information block (0x6f) ? */\n\t\tp = sc_asn1_find_tag(card->ctx, p, len, 0x6f, &tlen);\n\t\tif (p == NULL) {\n\t\t\tsc_log(card->ctx, \"directory tag missing\");\n\t\t\treturn SC_ERROR_INTERNAL;\n\t\t}\n\t\tif (tlen == 0)\n\t\t\t/* empty directory */\n\t\t\tbreak;\n\t\tq = sc_asn1_find_tag(card->ctx, p, tlen, 0x86, &ilen);\n\t\tif (q == NULL || ilen != 2) {\n\t\t\tsc_log(card->ctx, \"error parsing file id TLV object\");\n\t\t\treturn SC_ERROR_INTERNAL;\n\t\t}\n\t\t/* put file id in buf */\n\t\tif (buflen >= 2) {\n\t\t\tbuf[fids++] = q[0];\n\t\t\tbuf[fids++] = q[1];\n\t\t\tbuflen -= 2;\n\t\t} else\n\t\t\t/* not enough space left in buffer => break */\n\t\t\tbreak;\n\t\t/* extract next offset */\n\t\tq = sc_asn1_find_tag(card->ctx, p, tlen, 0x8a, &ilen);\n\t\tif (q != NULL && ilen == 1) {\n\t\t\toffset = (u8)ilen;\n\t\t\tgoto get_next_part;\n\t\t}\n\t\tlen -= tlen + 2;\n\t\tp += tlen;\n\t}\n\n\tr = fids;\n\n\tLOG_FUNC_RETURN(card->ctx, r);\n}",
  4362. "project": "OpenSC",
  4363. "hash": 256535442528642757002930638413340543712,
  4364. "size": 68,
  4365. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4366. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4367. "target": 0,
  4368. "dataset": "other",
  4369. "idx": 270687
  4370. },
  4371. {
  4372. "func": "static int cardos_add_algs(sc_card_t *card, unsigned long flags, unsigned long ec_flags, unsigned long ext_flags)\n{\n\n\tcardos_data_t * priv = (cardos_data_t *)card->drv_data;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\t_sc_card_add_rsa_alg(card, 512, flags, 0);\n\t_sc_card_add_rsa_alg(card, 768, flags, 0);\n\t_sc_card_add_rsa_alg(card, 1024, flags, 0);\n\tif (priv->rsa_2048 == 1) {\n\t\t_sc_card_add_rsa_alg(card, 1280, flags, 0);\n\t\t_sc_card_add_rsa_alg(card, 1536, flags, 0);\n\t\t_sc_card_add_rsa_alg(card, 1792, flags, 0);\n\t\t_sc_card_add_rsa_alg(card, 2048, flags, 0);\n\t}\n\n\tif (card->type == SC_CARD_TYPE_CARDOS_V5_0 || card->type == SC_CARD_TYPE_CARDOS_V5_3) {\n\t\t/* Starting with CardOS 5, the card supports PIN query commands */\n\t\tcard->caps |= SC_CARD_CAP_ISO7816_PIN_INFO;\n\t\t_sc_card_add_rsa_alg(card, 3072, flags, 0);\n\t\t_sc_card_add_rsa_alg(card, 4096, flags, 0);\n\t}\n\n\t/* TODO need to get sizes from supported_algos too */\n\tif (ec_flags != 0) {\n\t\t _sc_card_add_ec_alg(card, 256, ec_flags, priv->ext_flags, NULL);\n\t\t _sc_card_add_ec_alg(card, 384, ec_flags, priv->ext_flags, NULL);\n\t}\n\n\treturn 0;\n}",
  4373. "project": "OpenSC",
  4374. "hash": 64861983557475617371339454162084572131,
  4375. "size": 32,
  4376. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4377. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4378. "target": 0,
  4379. "dataset": "other",
  4380. "idx": 270686
  4381. },
  4382. {
  4383. "func": "static int tcos_select_file(sc_card_t *card,\n const sc_path_t *in_path,\n sc_file_t **file_out)\n{\n\tsc_context_t *ctx;\n\tsc_apdu_t apdu;\n\tsc_file_t *file=NULL;\n\tu8 buf[SC_MAX_APDU_BUFFER_SIZE], pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf;\n\tint r, pathlen;\n\n\tassert(card != NULL && in_path != NULL);\n\tctx=card->ctx;\n\tmemcpy(path, in_path->value, in_path->len);\n\tpathlen = in_path->len;\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0, 0x04);\n\n\tswitch (in_path->type) {\n\tcase SC_PATH_TYPE_FILE_ID:\n\t\tif (pathlen != 2) return SC_ERROR_INVALID_ARGUMENTS;\n\t\t/* fall through */\n\tcase SC_PATH_TYPE_FROM_CURRENT:\n\t\tapdu.p1 = 9;\n\t\tbreak;\n\tcase SC_PATH_TYPE_DF_NAME:\n\t\tapdu.p1 = 4;\n\t\tbreak;\n\tcase SC_PATH_TYPE_PATH:\n\t\tapdu.p1 = 8;\n\t\tif (pathlen >= 2 && memcmp(path, \"\\x3F\\x00\", 2) == 0) path += 2, pathlen -= 2;\n\t\tif (pathlen == 0) apdu.p1 = 0;\n\t\tbreak;\n\tcase SC_PATH_TYPE_PARENT:\n\t\tapdu.p1 = 3;\n\t\tpathlen = 0;\n\t\tbreak;\n\tdefault:\n\t\tSC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_INVALID_ARGUMENTS);\n\t}\n\tif( pathlen == 0 ) apdu.cse = SC_APDU_CASE_2_SHORT;\n\n\tapdu.lc = pathlen;\n\tapdu.data = path;\n\tapdu.datalen = pathlen;\n\n\tif (file_out != NULL) {\n\t\tapdu.resp = buf;\n\t\tapdu.resplen = sizeof(buf);\n\t\tapdu.le = 256;\n\t} else {\n\t\tapdu.resplen = 0;\n\t\tapdu.le = 0;\n\t\tapdu.p2 = 0x0C;\n\t\tapdu.cse = (pathlen == 0) ? SC_APDU_CASE_1 : SC_APDU_CASE_3_SHORT;\n\t}\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(ctx, r, \"APDU transmit failed\");\n\tr = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tif (r || file_out == NULL) SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, r);\n\n\tif (apdu.resplen < 1 || apdu.resp[0] != 0x62) {\n\t\tsc_log(ctx, \"received invalid template %02X\\n\", apdu.resp[0]);\n\t\tSC_FUNC_RETURN(ctx, SC_LOG_DEBUG_VERBOSE, SC_ERROR_UNKNOWN_DATA_RECEIVED);\n\t}\n\n\tfile = sc_file_new();\n\tif (file == NULL) LOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY);\n\t*file_out = file;\n\tfile->path = *in_path;\n\n\tiso_ops->process_fci(card, file, apdu.resp, apdu.resplen);\n\n\tparse_sec_attr(card, file, file->sec_attr, file->sec_attr_len);\n\n\treturn 0;\n}",
  4384. "project": "OpenSC",
  4385. "hash": 23889856979611356599779607889701841783,
  4386. "size": 77,
  4387. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  4388. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  4389. "target": 0,
  4390. "dataset": "other",
  4391. "idx": 453702
  4392. },
  4393. {
  4394. "func": "static int cardos_have_2048bit_package(sc_card_t *card)\n{\n\tsc_apdu_t apdu;\n u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n int r;\n\tconst u8 *p = rbuf, *q;\n\tsize_t len, tlen = 0, ilen = 0;\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x88);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.lc = 0;\n\tapdu.le = 256;\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif ((len = apdu.resplen) == 0)\n\t\t/* looks like no package has been installed */\n\t\treturn 0;\n\n\twhile (len != 0) {\n\t\tp = sc_asn1_find_tag(card->ctx, p, len, 0xe1, &tlen);\n\t\tif (p == NULL)\n\t\t\treturn 0;\n\t\tq = sc_asn1_find_tag(card->ctx, p, tlen, 0x01, &ilen);\n\t\tif (q == NULL || ilen != 4)\n\t\t\treturn 0;\n\t\tif (q[0] == 0x1c)\n\t\t\treturn 1;\n\t\tp += tlen;\n\t\tlen -= tlen + 2;\n\t}\n\n\treturn 0;\n}",
  4395. "project": "OpenSC",
  4396. "hash": 92357617617140958826267024638443033197,
  4397. "size": 35,
  4398. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4399. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4400. "target": 1,
  4401. "dataset": "other",
  4402. "idx": 198234
  4403. },
  4404. {
  4405. "func": "static int cardos_have_2048bit_package(sc_card_t *card)\n{\n\tsc_apdu_t apdu;\n u8 rbuf[SC_MAX_APDU_BUFFER_SIZE];\n int r;\n\tconst u8 *p = rbuf, *q, *pp;\n\tsize_t len, tlen = 0, ilen = 0;\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x88);\n\tapdu.resp = rbuf;\n\tapdu.resplen = sizeof(rbuf);\n\tapdu.lc = 0;\n\tapdu.le = 256;\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tif ((len = apdu.resplen) == 0)\n\t\t/* looks like no package has been installed */\n\t\treturn 0;\n\n\twhile (len != 0) {\n\t\tpp = sc_asn1_find_tag(card->ctx, p, len, 0xe1, &tlen);\n\t\tif (pp == NULL)\n\t\t\treturn 0;\n\t\tq = sc_asn1_find_tag(card->ctx, pp, tlen, 0x01, &ilen);\n\t\tif (q == NULL || ilen != 4)\n\t\t\treturn 0;\n\t\tif (q[0] == 0x1c)\n\t\t\treturn 1;\n\t\tp += tlen;\n\t\tlen -= tlen + 2;\n\t}\n\n\treturn 0;\n}",
  4406. "project": "OpenSC",
  4407. "hash": 331177212470604586059658277731450158649,
  4408. "size": 35,
  4409. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4410. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4411. "target": 0,
  4412. "dataset": "other",
  4413. "idx": 270673
  4414. },
  4415. {
  4416. "func": "static void parse_sec_attr(sc_file_t *file, const u8 *buf, size_t len)\n{\n\tsize_t i;\n\tconst int *idx;\n\n\tidx = (file->type == SC_FILE_TYPE_DF) ? df_acl : ef_acl;\n\n\t/* acl defaults to 0xFF if unspecified */\n\tfor (i = 0; i < 9; i++)\n\t\tif (idx[i] != -1)\n\t\t\tadd_acl_entry(file, idx[i], (u8)((i < len) ? buf[i] : 0xFF));\n}",
  4417. "project": "OpenSC",
  4418. "hash": 163767943676078759362856467431489935218,
  4419. "size": 12,
  4420. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4421. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4422. "target": 0,
  4423. "dataset": "other",
  4424. "idx": 270681
  4425. },
  4426. {
  4427. "func": "static void parse_sec_attr(sc_card_t *card,\n sc_file_t *file, const u8 *buf, size_t len)\n{\n\tunsigned int op;\n\n\t/* list directory is not covered by ACLs - so always add an entry */\n\tsc_file_add_acl_entry (file, SC_AC_OP_LIST_FILES,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t/* FIXME: check for what LOCK is used */\n\tsc_file_add_acl_entry (file, SC_AC_OP_LOCK,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\tfor (; len >= 6; len -= 6, buf += 6) {\n\t\t/* FIXME: temporary hacks */\n\t\tif (!memcmp(buf, \"\\xa4\\x00\\x00\\x00\\xff\\xff\", 6)) {/* select */\n\t\t\tsc_file_add_acl_entry (file, SC_AC_OP_SELECT,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t\t} else if (!memcmp(buf, \"\\xb0\\x00\\x00\\x00\\xff\\xff\", 6)) {/*read*/\n\t\t\tsc_file_add_acl_entry (file, SC_AC_OP_READ,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t\t} else if (!memcmp(buf, \"\\xd6\\x00\\x00\\x00\\xff\\xff\", 6)) {/*upd*/\n\t\t\tsc_file_add_acl_entry (file, SC_AC_OP_UPDATE,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t\t} else if (!memcmp(buf, \"\\x60\\x00\\x00\\x00\\xff\\xff\", 6)) {/*adm */\n\t\t\tsc_file_add_acl_entry (file, SC_AC_OP_WRITE,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t\t\tsc_file_add_acl_entry (file, SC_AC_OP_CREATE,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t\t\tsc_file_add_acl_entry (file, SC_AC_OP_INVALIDATE,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t\t\tsc_file_add_acl_entry (file, SC_AC_OP_REHABILITATE,\n SC_AC_NONE, SC_AC_KEY_REF_NONE);\n\t\t} else {\n\t\t\t/* the first byte tells use the command or the\n\t\t\t command group. We have to mask bit 0\n\t\t\t because this one distinguish between AND/OR\n\t\t\t combination of PINs*/\n\t\t\top = map_operations (buf[0]);\n\t\t\tif (op == (unsigned int)-1) {\n\t\t\t\tsc_log(card->ctx,\n\t\t\t\t\t\"Unknown security command byte %02x\\n\",\n\t\t\t\t\tbuf[0]);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (!buf[1])\n\t\t\t\tsc_file_add_acl_entry (file, op,\n SC_AC_NONE,\n SC_AC_KEY_REF_NONE);\n\t\t\telse\n\t\t\t\tsc_file_add_acl_entry (file, op,\n SC_AC_CHV, buf[1]);\n\n\t\t\tif (!buf[2] && !buf[3])\n\t\t\t\tsc_file_add_acl_entry (file, op,\n SC_AC_NONE,\n SC_AC_KEY_REF_NONE);\n\t\t\telse\n\t\t\t\tsc_file_add_acl_entry (file, op,\n SC_AC_TERM,\n (buf[2]<<8)|buf[3]);\n\t\t}\n\t}\n}",
  4428. "project": "OpenSC",
  4429. "hash": 284667084980065280010456910650927112728,
  4430. "size": 62,
  4431. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  4432. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  4433. "target": 0,
  4434. "dataset": "other",
  4435. "idx": 453694
  4436. },
  4437. {
  4438. "func": "oberthur_detect_card(struct sc_pkcs15_card * p15card)\n{\n\tstruct sc_card *card = p15card->card;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\tif (p15card->card->type != SC_CARD_TYPE_OBERTHUR_64K)\n\t\tLOG_FUNC_RETURN(p15card->card->ctx, SC_ERROR_WRONG_CARD);\n\tLOG_FUNC_RETURN(p15card->card->ctx, SC_SUCCESS);\n}",
  4439. "project": "OpenSC",
  4440. "hash": 1983533969969801423954953399161347915,
  4441. "size": 9,
  4442. "commit_id": "1db88374bb7706a115d5c3617c6f16115c33bf27",
  4443. "message": "oberthur: Correctly check for return values\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=28843",
  4444. "target": 0,
  4445. "dataset": "other",
  4446. "idx": 230101
  4447. },
  4448. {
  4449. "func": "cardos_put_data_oci(sc_card_t *card,\n\t\t\tstruct sc_cardctl_cardos_obj_info *args)\n{\n\tsc_apdu_t\tapdu;\n\tint\t\tr;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\tmemset(&apdu, 0, sizeof(apdu));\n\tapdu.cse = SC_APDU_CASE_3_SHORT;\n\tapdu.cla = 0x00;\n\tapdu.ins = 0xda;\n\tapdu.p1 = 0x01;\n\tapdu.p2 = 0x6e;\n\tapdu.lc = args->len;\n\tapdu.data = args->data;\n\tapdu.datalen = args->len;\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tr = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(card->ctx, r, \"Card returned error\");\n\n\tLOG_FUNC_RETURN(card->ctx, r);\n}",
  4450. "project": "OpenSC",
  4451. "hash": 50999835762767213036437079009335667961,
  4452. "size": 26,
  4453. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4454. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4455. "target": 0,
  4456. "dataset": "other",
  4457. "idx": 270676
  4458. },
  4459. {
  4460. "func": "cardos_lifecycle_set(sc_card_t *card, int *mode)\n{\n\tsc_apdu_t\tapdu;\n\tint\t\tr;\n\n\tint current;\n\tint target;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\ttarget = *mode;\n\n\tr = cardos_lifecycle_get(card, &current);\n\t\n\tif (r != SC_SUCCESS)\n\t\treturn r;\n\n\tif (current == target || current == SC_CARDCTRL_LIFECYCLE_OTHER)\n\t\treturn SC_SUCCESS;\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0x10, 0, 0);\n\tapdu.cla = 0x80;\n\tapdu.le = 0;\n\tapdu.resplen = 0;\n\tapdu.resp = NULL;\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tr = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(card->ctx, r, \"Card returned error\");\n\n\tLOG_FUNC_RETURN(card->ctx, r);\n}",
  4461. "project": "OpenSC",
  4462. "hash": 146465645650993959180142670245930613814,
  4463. "size": 34,
  4464. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4465. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4466. "target": 0,
  4467. "dataset": "other",
  4468. "idx": 270690
  4469. },
  4470. {
  4471. "func": "cardos_restore_security_env(sc_card_t *card, int se_num)\n{\n\tsc_apdu_t apdu;\n\tint\tr;\n\n\tSC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);\n\n\tsc_format_apdu(card, &apdu, SC_APDU_CASE_1, 0x22, 0, se_num);\n\tapdu.p1 = (card->type == SC_CARD_TYPE_CARDOS_CIE_V1 ? 0xF3 : 0x03);\n\n\tr = sc_transmit_apdu(card, &apdu);\n\tLOG_TEST_RET(card->ctx, r, \"APDU transmit failed\");\n\n\tr = sc_check_sw(card, apdu.sw1, apdu.sw2);\n\tLOG_TEST_RET(card->ctx, r, \"Card returned error\");\n\n\tLOG_FUNC_RETURN(card->ctx, r);\n}",
  4472. "project": "OpenSC",
  4473. "hash": 317882808282407343140909309524103511340,
  4474. "size": 18,
  4475. "commit_id": "1252aca9f10771ef5ba8405e73cf2da50827958f",
  4476. "message": "cardos: Correctly calculate the left bytes to avoid buffer overrun\n\nThanks oss-fuzz\n\nhttps://bugs.chromium.org/p/oss-fuzz/issues/detail?id=29912",
  4477. "target": 0,
  4478. "dataset": "other",
  4479. "idx": 270694
  4480. },
  4481. {
  4482. "func": "static unsigned int map_operations (int commandbyte)\n{\n\tunsigned int op = (unsigned int)-1;\n\n\tswitch ( (commandbyte & 0xfe) ) {\n\t\tcase 0xe2: /* append record */ op = SC_AC_OP_UPDATE; break;\n\t\tcase 0x24: /* change password */ op = SC_AC_OP_UPDATE; break;\n\t\tcase 0xe0: /* create */ op = SC_AC_OP_CREATE; break;\n\t\tcase 0xe4: /* delete */ op = SC_AC_OP_DELETE; break;\n\t\tcase 0xe8: /* exclude sfi */ op = SC_AC_OP_WRITE; break;\n\t\tcase 0x82: /* external auth */ op = SC_AC_OP_READ; break;\n\t\tcase 0xe6: /* include sfi */ op = SC_AC_OP_WRITE; break;\n\t\tcase 0x88: /* internal auth */ op = SC_AC_OP_READ; break;\n\t\tcase 0x04: /* invalidate */ op = SC_AC_OP_INVALIDATE; break;\n\t\tcase 0x2a: /* perform sec. op */ op = SC_AC_OP_SELECT; break;\n\t\tcase 0xb0: /* read binary */ op = SC_AC_OP_READ; break;\n\t\tcase 0xb2: /* read record */ op = SC_AC_OP_READ; break;\n\t\tcase 0x44: /* rehabilitate */ op = SC_AC_OP_REHABILITATE; break;\n\t\tcase 0xa4: /* select */ op = SC_AC_OP_SELECT; break;\n\t\tcase 0xee: /* set permanent */ op = SC_AC_OP_CREATE; break;\n\t\tcase 0x2c: /* unblock password */op = SC_AC_OP_WRITE; break;\n\t\tcase 0xd6: /* update binary */ op = SC_AC_OP_WRITE; break;\n\t\tcase 0xdc: /* update record */ op = SC_AC_OP_WRITE; break;\n\t\tcase 0x20: /* verify password */ op = SC_AC_OP_SELECT; break;\n\t\tcase 0x60: /* admin group */ op = SC_AC_OP_CREATE; break;\n\t}\n\treturn op;\n}",
  4483. "project": "OpenSC",
  4484. "hash": 107567217371536538402704324989314269568,
  4485. "size": 28,
  4486. "commit_id": "9d294de90d1cc66956389856e60b6944b27b4817",
  4487. "message": "prevent out of bounds write\n\nfixes https://oss-fuzz.com/testcase-detail/5226571123392512",
  4488. "target": 0,
  4489. "dataset": "other",
  4490. "idx": 453693
  4491. }
  4492. ]
  4493. },
  4494. {
  4495. "call_depth": 3,
  4496. "longest_call_chain": [
  4497. "clear_decompress",
  4498. "clear_decompress_glyph_data",
  4499. "convert_color"
  4500. ],
  4501. "group_size": 15,
  4502. "functions": [
  4503. {
  4504. "func": "static BOOL clear_decompress_nscodec(NSC_CONTEXT* nsc, UINT32 width, UINT32 height, wStream* s,\n UINT32 bitmapDataByteCount, BYTE* pDstData, UINT32 DstFormat,\n UINT32 nDstStep, UINT32 nXDstRel, UINT32 nYDstRel)\n{\n\tBOOL rc;\n\n\tif (Stream_GetRemainingLength(s) < bitmapDataByteCount)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [%\" PRIu32 \" expected]\",\n\t\t Stream_GetRemainingLength(s), bitmapDataByteCount);\n\t\treturn FALSE;\n\t}\n\n\trc = nsc_process_message(nsc, 32, width, height, Stream_Pointer(s), bitmapDataByteCount,\n\t pDstData, DstFormat, nDstStep, nXDstRel, nYDstRel, width, height,\n\t FREERDP_FLIP_NONE);\n\tStream_Seek(s, bitmapDataByteCount);\n\treturn rc;\n}",
  4505. "project": "FreeRDP",
  4506. "hash": 2561498304080266048116044689734629889,
  4507. "size": 19,
  4508. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4509. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4510. "target": 0,
  4511. "dataset": "other",
  4512. "idx": 448693
  4513. },
  4514. {
  4515. "func": "CLEAR_CONTEXT* clear_context_new(BOOL Compressor)\n{\n\tCLEAR_CONTEXT* clear;\n\tclear = (CLEAR_CONTEXT*)calloc(1, sizeof(CLEAR_CONTEXT));\n\n\tif (!clear)\n\t\treturn NULL;\n\n\tclear->Compressor = Compressor;\n\tclear->nsc = nsc_context_new();\n\n\tif (!clear->nsc)\n\t\tgoto error_nsc;\n\n\tif (!updateContextFormat(clear, PIXEL_FORMAT_BGRX32))\n\t\tgoto error_nsc;\n\n\tif (!clear_resize_buffer(clear, 512, 512))\n\t\tgoto error_nsc;\n\n\tif (!clear->TempBuffer)\n\t\tgoto error_nsc;\n\n\tif (!clear_context_reset(clear))\n\t\tgoto error_nsc;\n\n\treturn clear;\nerror_nsc:\n\tclear_context_free(clear);\n\treturn NULL;\n}",
  4516. "project": "FreeRDP",
  4517. "hash": 244644863767852592835138564581886404642,
  4518. "size": 31,
  4519. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4520. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4521. "target": 0,
  4522. "dataset": "other",
  4523. "idx": 448687
  4524. },
  4525. {
  4526. "func": "static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear, wStream* s, UINT32 bandsByteCount,\n UINT32 nWidth, UINT32 nHeight, BYTE* pDstData,\n UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,\n UINT32 nYDst)\n{\n\tUINT32 i, y;\n\tUINT32 count;\n\tUINT32 suboffset;\n\tUINT32 nXDstRel;\n\tUINT32 nYDstRel;\n\n\tif (Stream_GetRemainingLength(s) < bandsByteCount)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [11 expected]\", Stream_GetRemainingLength(s));\n\t\treturn FALSE;\n\t}\n\n\tsuboffset = 0;\n\n\twhile (suboffset < bandsByteCount)\n\t{\n\t\tBYTE r, g, b;\n\t\tUINT16 xStart;\n\t\tUINT16 xEnd;\n\t\tUINT16 yStart;\n\t\tUINT16 yEnd;\n\t\tUINT32 colorBkg;\n\t\tUINT16 vBarHeader;\n\t\tUINT16 vBarYOn;\n\t\tUINT16 vBarYOff;\n\t\tUINT32 vBarCount;\n\t\tUINT32 vBarPixelCount;\n\t\tUINT32 vBarShortPixelCount;\n\n\t\tif (Stream_GetRemainingLength(s) < 11)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [11 expected]\", Stream_GetRemainingLength(s));\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tStream_Read_UINT16(s, xStart);\n\t\tStream_Read_UINT16(s, xEnd);\n\t\tStream_Read_UINT16(s, yStart);\n\t\tStream_Read_UINT16(s, yEnd);\n\t\tStream_Read_UINT8(s, b);\n\t\tStream_Read_UINT8(s, g);\n\t\tStream_Read_UINT8(s, r);\n\t\tsuboffset += 11;\n\t\tcolorBkg = FreeRDPGetColor(clear->format, r, g, b, 0xFF);\n\n\t\tif (xEnd < xStart)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"xEnd %\" PRIu16 \" < xStart %\" PRIu16 \"\", xEnd, xStart);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (yEnd < yStart)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"yEnd %\" PRIu16 \" < yStart %\" PRIu16 \"\", yEnd, yStart);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tvBarCount = (xEnd - xStart) + 1;\n\n\t\tfor (i = 0; i < vBarCount; i++)\n\t\t{\n\t\t\tUINT32 vBarHeight;\n\t\t\tCLEAR_VBAR_ENTRY* vBarEntry = NULL;\n\t\t\tCLEAR_VBAR_ENTRY* vBarShortEntry;\n\t\t\tBOOL vBarUpdate = FALSE;\n\t\t\tconst BYTE* pSrcPixel;\n\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tStream_Read_UINT16(s, vBarHeader);\n\t\t\tsuboffset += 2;\n\t\t\tvBarHeight = (yEnd - yStart + 1);\n\n\t\t\tif (vBarHeight > 52)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"vBarHeight (%\" PRIu32 \") > 52\", vBarHeight);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tif ((vBarHeader & 0xC000) == 0x4000) /* SHORT_VBAR_CACHE_HIT */\n\t\t\t{\n\t\t\t\tconst UINT16 vBarIndex = (vBarHeader & 0x3FFF);\n\t\t\t\tvBarShortEntry = &(clear->ShortVBarStorage[vBarIndex]);\n\n\t\t\t\tif (!vBarShortEntry)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"missing vBarShortEntry %\" PRIu16 \"\", vBarIndex);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif (Stream_GetRemainingLength(s) < 1)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [1 expected]\",\n\t\t\t\t\t Stream_GetRemainingLength(s));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tStream_Read_UINT8(s, vBarYOn);\n\t\t\t\tsuboffset += 1;\n\t\t\t\tvBarShortPixelCount = vBarShortEntry->count;\n\t\t\t\tvBarUpdate = TRUE;\n\t\t\t}\n\t\t\telse if ((vBarHeader & 0xC000) == 0x0000) /* SHORT_VBAR_CACHE_MISS */\n\t\t\t{\n\t\t\t\tvBarYOn = (vBarHeader & 0xFF);\n\t\t\t\tvBarYOff = ((vBarHeader >> 8) & 0x3F);\n\n\t\t\t\tif (vBarYOff < vBarYOn)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"vBarYOff %\" PRIu16 \" < vBarYOn %\" PRIu16 \"\", vBarYOff, vBarYOn);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tvBarShortPixelCount = (vBarYOff - vBarYOn);\n\n\t\t\t\tif (vBarShortPixelCount > 52)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"vBarShortPixelCount %\" PRIu32 \" > 52\", vBarShortPixelCount);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif (Stream_GetRemainingLength(s) < (vBarShortPixelCount * 3))\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [%\" PRIu32 \" expected]\",\n\t\t\t\t\t Stream_GetRemainingLength(s), (vBarShortPixelCount * 3));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif (clear->ShortVBarStorageCursor >= CLEARCODEC_VBAR_SHORT_SIZE)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG,\n\t\t\t\t\t \"clear->ShortVBarStorageCursor %\" PRIu32\n\t\t\t\t\t \" >= CLEARCODEC_VBAR_SHORT_SIZE (%\" PRIu32 \")\",\n\t\t\t\t\t clear->ShortVBarStorageCursor, CLEARCODEC_VBAR_SHORT_SIZE);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tvBarShortEntry = &(clear->ShortVBarStorage[clear->ShortVBarStorageCursor]);\n\t\t\t\tvBarShortEntry->count = vBarShortPixelCount;\n\n\t\t\t\tif (!resize_vbar_entry(clear, vBarShortEntry))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tfor (y = 0; y < vBarShortPixelCount; y++)\n\t\t\t\t{\n\t\t\t\t\tBYTE r, g, b;\n\t\t\t\t\tBYTE* dstBuffer = &vBarShortEntry->pixels[y * GetBytesPerPixel(clear->format)];\n\t\t\t\t\tUINT32 color;\n\t\t\t\t\tStream_Read_UINT8(s, b);\n\t\t\t\t\tStream_Read_UINT8(s, g);\n\t\t\t\t\tStream_Read_UINT8(s, r);\n\t\t\t\t\tcolor = FreeRDPGetColor(clear->format, r, g, b, 0xFF);\n\n\t\t\t\t\tif (!WriteColor(dstBuffer, clear->format, color))\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tsuboffset += (vBarShortPixelCount * 3);\n\t\t\t\tclear->ShortVBarStorageCursor =\n\t\t\t\t (clear->ShortVBarStorageCursor + 1) % CLEARCODEC_VBAR_SHORT_SIZE;\n\t\t\t\tvBarUpdate = TRUE;\n\t\t\t}\n\t\t\telse if ((vBarHeader & 0x8000) == 0x8000) /* VBAR_CACHE_HIT */\n\t\t\t{\n\t\t\t\tconst UINT16 vBarIndex = (vBarHeader & 0x7FFF);\n\t\t\t\tvBarEntry = &(clear->VBarStorage[vBarIndex]);\n\n\t\t\t\t/* If the cache was reset we need to fill in some dummy data. */\n\t\t\t\tif (vBarEntry->size == 0)\n\t\t\t\t{\n\t\t\t\t\tWLog_WARN(TAG, \"Empty cache index %\" PRIu16 \", filling dummy data\", vBarIndex);\n\t\t\t\t\tvBarEntry->count = vBarHeight;\n\n\t\t\t\t\tif (!resize_vbar_entry(clear, vBarEntry))\n\t\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\t\t\t}\n\t\t\telse\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"invalid vBarHeader 0x%04\" PRIX16 \"\", vBarHeader);\n\t\t\t\treturn FALSE; /* invalid vBarHeader */\n\t\t\t}\n\n\t\t\tif (vBarUpdate)\n\t\t\t{\n\t\t\t\tUINT32 x;\n\t\t\t\tBYTE* pSrcPixel;\n\t\t\t\tBYTE* dstBuffer;\n\n\t\t\t\tif (clear->VBarStorageCursor >= CLEARCODEC_VBAR_SIZE)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG,\n\t\t\t\t\t \"clear->VBarStorageCursor %\" PRIu32 \" >= CLEARCODEC_VBAR_SIZE %\" PRIu32\n\t\t\t\t\t \"\",\n\t\t\t\t\t clear->VBarStorageCursor, CLEARCODEC_VBAR_SIZE);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tvBarEntry = &(clear->VBarStorage[clear->VBarStorageCursor]);\n\t\t\t\tvBarPixelCount = vBarHeight;\n\t\t\t\tvBarEntry->count = vBarPixelCount;\n\n\t\t\t\tif (!resize_vbar_entry(clear, vBarEntry))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tdstBuffer = vBarEntry->pixels;\n\t\t\t\t/* if (y < vBarYOn), use colorBkg */\n\t\t\t\ty = 0;\n\t\t\t\tcount = vBarYOn;\n\n\t\t\t\tif ((y + count) > vBarPixelCount)\n\t\t\t\t\tcount = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0;\n\n\t\t\t\twhile (count--)\n\t\t\t\t{\n\t\t\t\t\tWriteColor(dstBuffer, clear->format, colorBkg);\n\t\t\t\t\tdstBuffer += GetBytesPerPixel(clear->format);\n\t\t\t\t}\n\n\t\t\t\t/*\n\t\t\t\t * if ((y >= vBarYOn) && (y < (vBarYOn + vBarShortPixelCount))),\n\t\t\t\t * use vBarShortPixels at index (y - shortVBarYOn)\n\t\t\t\t */\n\t\t\t\ty = vBarYOn;\n\t\t\t\tcount = vBarShortPixelCount;\n\n\t\t\t\tif ((y + count) > vBarPixelCount)\n\t\t\t\t\tcount = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0;\n\n\t\t\t\tpSrcPixel =\n\t\t\t\t &vBarShortEntry->pixels[(y - vBarYOn) * GetBytesPerPixel(clear->format)];\n\n\t\t\t\tfor (x = 0; x < count; x++)\n\t\t\t\t{\n\t\t\t\t\tUINT32 color;\n\t\t\t\t\tcolor =\n\t\t\t\t\t ReadColor(&pSrcPixel[x * GetBytesPerPixel(clear->format)], clear->format);\n\n\t\t\t\t\tif (!WriteColor(dstBuffer, clear->format, color))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tdstBuffer += GetBytesPerPixel(clear->format);\n\t\t\t\t}\n\n\t\t\t\t/* if (y >= (vBarYOn + vBarShortPixelCount)), use colorBkg */\n\t\t\t\ty = vBarYOn + vBarShortPixelCount;\n\t\t\t\tcount = (vBarPixelCount > y) ? (vBarPixelCount - y) : 0;\n\n\t\t\t\twhile (count--)\n\t\t\t\t{\n\t\t\t\t\tif (!WriteColor(dstBuffer, clear->format, colorBkg))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tdstBuffer += GetBytesPerPixel(clear->format);\n\t\t\t\t}\n\n\t\t\t\tvBarEntry->count = vBarPixelCount;\n\t\t\t\tclear->VBarStorageCursor = (clear->VBarStorageCursor + 1) % CLEARCODEC_VBAR_SIZE;\n\t\t\t}\n\n\t\t\tif (vBarEntry->count != vBarHeight)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"vBarEntry->count %\" PRIu32 \" != vBarHeight %\" PRIu32 \"\",\n\t\t\t\t vBarEntry->count, vBarHeight);\n\t\t\t\tvBarEntry->count = vBarHeight;\n\n\t\t\t\tif (!resize_vbar_entry(clear, vBarEntry))\n\t\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tnXDstRel = nXDst + xStart;\n\t\t\tnYDstRel = nYDst + yStart;\n\t\t\tpSrcPixel = vBarEntry->pixels;\n\n\t\t\tif (i < nWidth)\n\t\t\t{\n\t\t\t\tcount = vBarEntry->count;\n\n\t\t\t\tif (count > nHeight)\n\t\t\t\t\tcount = nHeight;\n\n\t\t\t\tfor (y = 0; y < count; y++)\n\t\t\t\t{\n\t\t\t\t\tBYTE* pDstPixel8 = &pDstData[((nYDstRel + y) * nDstStep) +\n\t\t\t\t\t ((nXDstRel + i) * GetBytesPerPixel(DstFormat))];\n\t\t\t\t\tUINT32 color = ReadColor(pSrcPixel, clear->format);\n\t\t\t\t\tcolor = FreeRDPConvertColor(color, clear->format, DstFormat, NULL);\n\n\t\t\t\t\tif (!WriteColor(pDstPixel8, DstFormat, color))\n\t\t\t\t\t\treturn FALSE;\n\n\t\t\t\t\tpSrcPixel += GetBytesPerPixel(clear->format);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn TRUE;\n}",
  4527. "project": "FreeRDP",
  4528. "hash": 87336701581291969550785912604100068766,
  4529. "size": 308,
  4530. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4531. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4532. "target": 0,
  4533. "dataset": "other",
  4534. "idx": 448697
  4535. },
  4536. {
  4537. "func": "static BOOL clear_decompress_glyph_data(CLEAR_CONTEXT* clear, wStream* s, UINT32 glyphFlags,\n UINT32 nWidth, UINT32 nHeight, BYTE* pDstData,\n UINT32 DstFormat, UINT32 nDstStep, UINT32 nXDst,\n UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight,\n const gdiPalette* palette, BYTE** ppGlyphData)\n{\n\tUINT16 glyphIndex = 0;\n\n\tif (ppGlyphData)\n\t\t*ppGlyphData = NULL;\n\n\tif ((glyphFlags & CLEARCODEC_FLAG_GLYPH_HIT) && !(glyphFlags & CLEARCODEC_FLAG_GLYPH_INDEX))\n\t{\n\t\tWLog_ERR(TAG, \"Invalid glyph flags %08\" PRIX32 \"\", glyphFlags);\n\t\treturn FALSE;\n\t}\n\n\tif ((glyphFlags & CLEARCODEC_FLAG_GLYPH_INDEX) == 0)\n\t\treturn TRUE;\n\n\tif ((nWidth * nHeight) > (1024 * 1024))\n\t{\n\t\tWLog_ERR(TAG, \"glyph too large: %\" PRIu32 \"x%\" PRIu32 \"\", nWidth, nHeight);\n\t\treturn FALSE;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, glyphIndex);\n\n\tif (glyphIndex >= 4000)\n\t{\n\t\tWLog_ERR(TAG, \"Invalid glyphIndex %\" PRIu16 \"\", glyphIndex);\n\t\treturn FALSE;\n\t}\n\n\tif (glyphFlags & CLEARCODEC_FLAG_GLYPH_HIT)\n\t{\n\t\tUINT32 nSrcStep;\n\t\tCLEAR_GLYPH_ENTRY* glyphEntry = &(clear->GlyphCache[glyphIndex]);\n\t\tBYTE* glyphData;\n\n\t\tif (!glyphEntry)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"clear->GlyphCache[%\" PRIu16 \"]=NULL\", glyphIndex);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tglyphData = (BYTE*)glyphEntry->pixels;\n\n\t\tif (!glyphData)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"clear->GlyphCache[%\" PRIu16 \"]->pixels=NULL\", glyphIndex);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif ((nWidth * nHeight) > glyphEntry->count)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"(nWidth %\" PRIu32 \" * nHeight %\" PRIu32 \") > glyphEntry->count %\" PRIu32 \"\",\n\t\t\t nWidth, nHeight, glyphEntry->count);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tnSrcStep = nWidth * GetBytesPerPixel(clear->format);\n\t\treturn convert_color(pDstData, nDstStep, DstFormat, nXDst, nYDst, nWidth, nHeight,\n\t\t glyphData, nSrcStep, clear->format, nDstWidth, nDstHeight, palette);\n\t}\n\n\tif (glyphFlags & CLEARCODEC_FLAG_GLYPH_INDEX)\n\t{\n\t\tconst UINT32 bpp = GetBytesPerPixel(clear->format);\n\t\tCLEAR_GLYPH_ENTRY* glyphEntry = &(clear->GlyphCache[glyphIndex]);\n\t\tglyphEntry->count = nWidth * nHeight;\n\n\t\tif (glyphEntry->count > glyphEntry->size)\n\t\t{\n\t\t\tBYTE* tmp;\n\t\t\ttmp = realloc(glyphEntry->pixels, glyphEntry->count * bpp);\n\n\t\t\tif (!tmp)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"glyphEntry->pixels realloc %\" PRIu32 \" failed!\",\n\t\t\t\t glyphEntry->count * bpp);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tglyphEntry->size = glyphEntry->count;\n\t\t\tglyphEntry->pixels = (UINT32*)tmp;\n\t\t}\n\n\t\tif (!glyphEntry->pixels)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"glyphEntry->pixels=NULL\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (ppGlyphData)\n\t\t\t*ppGlyphData = (BYTE*)glyphEntry->pixels;\n\n\t\treturn TRUE;\n\t}\n\n\treturn TRUE;\n}",
  4538. "project": "FreeRDP",
  4539. "hash": 283254231141467108277168564924404272897,
  4540. "size": 109,
  4541. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4542. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4543. "target": 0,
  4544. "dataset": "other",
  4545. "idx": 448696
  4546. },
  4547. {
  4548. "func": "void clear_context_free(CLEAR_CONTEXT* clear)\n{\n\tint i;\n\n\tif (!clear)\n\t\treturn;\n\n\tnsc_context_free(clear->nsc);\n\tfree(clear->TempBuffer);\n\n\tfor (i = 0; i < 4000; i++)\n\t\tfree(clear->GlyphCache[i].pixels);\n\n\tfor (i = 0; i < 32768; i++)\n\t\tfree(clear->VBarStorage[i].pixels);\n\n\tfor (i = 0; i < 16384; i++)\n\t\tfree(clear->ShortVBarStorage[i].pixels);\n\n\tfree(clear);\n}",
  4549. "project": "FreeRDP",
  4550. "hash": 116257062296696634205420506715336677175,
  4551. "size": 21,
  4552. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4553. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4554. "target": 0,
  4555. "dataset": "other",
  4556. "idx": 448690
  4557. },
  4558. {
  4559. "func": "BOOL clear_context_reset(CLEAR_CONTEXT* clear)\n{\n\tif (!clear)\n\t\treturn FALSE;\n\n\tclear->seqNumber = 0;\n\treturn TRUE;\n}",
  4560. "project": "FreeRDP",
  4561. "hash": 20768051255935120331692178107164808422,
  4562. "size": 8,
  4563. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4564. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4565. "target": 0,
  4566. "dataset": "other",
  4567. "idx": 448700
  4568. },
  4569. {
  4570. "func": "static INLINE BOOL updateContextFormat(CLEAR_CONTEXT* clear, UINT32 DstFormat)\n{\n\tif (!clear || !clear->nsc)\n\t\treturn FALSE;\n\n\tclear->format = DstFormat;\n\treturn nsc_context_set_pixel_format(clear->nsc, DstFormat);\n}",
  4571. "project": "FreeRDP",
  4572. "hash": 227090566798061984309643416810198251718,
  4573. "size": 8,
  4574. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4575. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4576. "target": 0,
  4577. "dataset": "other",
  4578. "idx": 448698
  4579. },
  4580. {
  4581. "func": "static BOOL clear_resize_buffer(CLEAR_CONTEXT* clear, UINT32 width, UINT32 height)\n{\n\tUINT32 size;\n\n\tif (!clear)\n\t\treturn FALSE;\n\n\tsize = ((width + 16) * (height + 16) * GetBytesPerPixel(clear->format));\n\n\tif (size > clear->TempSize)\n\t{\n\t\tBYTE* tmp = (BYTE*)realloc(clear->TempBuffer, size);\n\n\t\tif (!tmp)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"clear->TempBuffer realloc failed for %\" PRIu32 \" bytes\", size);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tclear->TempSize = size;\n\t\tclear->TempBuffer = tmp;\n\t}\n\n\treturn TRUE;\n}",
  4582. "project": "FreeRDP",
  4583. "hash": 108165721946250695003546590227162442804,
  4584. "size": 25,
  4585. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4586. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4587. "target": 0,
  4588. "dataset": "other",
  4589. "idx": 448689
  4590. },
  4591. {
  4592. "func": "static BOOL clear_decompress_subcode_rlex(wStream* s, UINT32 bitmapDataByteCount, UINT32 width,\n UINT32 height, BYTE* pDstData, UINT32 DstFormat,\n UINT32 nDstStep, UINT32 nXDstRel, UINT32 nYDstRel,\n UINT32 nDstWidth, UINT32 nDstHeight)\n{\n\tUINT32 x = 0, y = 0;\n\tUINT32 i;\n\tUINT32 pixelCount;\n\tUINT32 bitmapDataOffset;\n\tUINT32 pixelIndex;\n\tUINT32 numBits;\n\tBYTE startIndex;\n\tBYTE stopIndex;\n\tBYTE suiteIndex;\n\tBYTE suiteDepth;\n\tBYTE paletteCount;\n\tUINT32 palette[128] = { 0 };\n\n\tif (Stream_GetRemainingLength(s) < bitmapDataByteCount)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [%\" PRIu32 \" expected]\",\n\t\t Stream_GetRemainingLength(s), bitmapDataByteCount);\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT8(s, paletteCount);\n\tbitmapDataOffset = 1 + (paletteCount * 3);\n\n\tif ((paletteCount > 127) || (paletteCount < 1))\n\t{\n\t\tWLog_ERR(TAG, \"paletteCount %\" PRIu8 \"\", paletteCount);\n\t\treturn FALSE;\n\t}\n\n\tfor (i = 0; i < paletteCount; i++)\n\t{\n\t\tBYTE r, g, b;\n\t\tStream_Read_UINT8(s, b);\n\t\tStream_Read_UINT8(s, g);\n\t\tStream_Read_UINT8(s, r);\n\t\tpalette[i] = FreeRDPGetColor(DstFormat, r, g, b, 0xFF);\n\t}\n\n\tpixelIndex = 0;\n\tpixelCount = width * height;\n\tnumBits = CLEAR_LOG2_FLOOR[paletteCount - 1] + 1;\n\n\twhile (bitmapDataOffset < bitmapDataByteCount)\n\t{\n\t\tUINT32 tmp;\n\t\tUINT32 color;\n\t\tUINT32 runLengthFactor;\n\n\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tStream_Read_UINT8(s, tmp);\n\t\tStream_Read_UINT8(s, runLengthFactor);\n\t\tbitmapDataOffset += 2;\n\t\tsuiteDepth = (tmp >> numBits) & CLEAR_8BIT_MASKS[(8 - numBits)];\n\t\tstopIndex = tmp & CLEAR_8BIT_MASKS[numBits];\n\t\tstartIndex = stopIndex - suiteDepth;\n\n\t\tif (runLengthFactor >= 0xFF)\n\t\t{\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tStream_Read_UINT16(s, runLengthFactor);\n\t\t\tbitmapDataOffset += 2;\n\n\t\t\tif (runLengthFactor >= 0xFFFF)\n\t\t\t{\n\t\t\t\tif (Stream_GetRemainingLength(s) < 4)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [4 expected]\",\n\t\t\t\t\t Stream_GetRemainingLength(s));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tStream_Read_UINT32(s, runLengthFactor);\n\t\t\t\tbitmapDataOffset += 4;\n\t\t\t}\n\t\t}\n\n\t\tif (startIndex >= paletteCount)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"startIndex %\" PRIu8 \" > paletteCount %\" PRIu8 \"]\", startIndex,\n\t\t\t paletteCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (stopIndex >= paletteCount)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stopIndex %\" PRIu8 \" > paletteCount %\" PRIu8 \"]\", stopIndex,\n\t\t\t paletteCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tsuiteIndex = startIndex;\n\n\t\tif (suiteIndex > 127)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"suiteIndex %\" PRIu8 \" > 127]\", suiteIndex);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tcolor = palette[suiteIndex];\n\n\t\tif ((pixelIndex + runLengthFactor) > pixelCount)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"pixelIndex %\" PRIu32 \" + runLengthFactor %\" PRIu32 \" > pixelCount %\" PRIu32\n\t\t\t \"\",\n\t\t\t pixelIndex, runLengthFactor, pixelCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tfor (i = 0; i < runLengthFactor; i++)\n\t\t{\n\t\t\tBYTE* pTmpData =\n\t\t\t &pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) + (nYDstRel + y) * nDstStep];\n\n\t\t\tif ((nXDstRel + x < nDstWidth) && (nYDstRel + y < nDstHeight))\n\t\t\t\tWriteColor(pTmpData, DstFormat, color);\n\n\t\t\tif (++x >= width)\n\t\t\t{\n\t\t\t\ty++;\n\t\t\t\tx = 0;\n\t\t\t}\n\t\t}\n\n\t\tpixelIndex += runLengthFactor;\n\n\t\tif ((pixelIndex + (suiteDepth + 1)) > pixelCount)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"pixelIndex %\" PRIu32 \" + suiteDepth %\" PRIu8 \" + 1 > pixelCount %\" PRIu32 \"\",\n\t\t\t pixelIndex, suiteDepth, pixelCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tfor (i = 0; i <= suiteDepth; i++)\n\t\t{\n\t\t\tBYTE* pTmpData =\n\t\t\t &pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) + (nYDstRel + y) * nDstStep];\n\t\t\tUINT32 color = palette[suiteIndex];\n\n\t\t\tif (suiteIndex > 127)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"suiteIndex %\" PRIu8 \" > 127\", suiteIndex);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tsuiteIndex++;\n\n\t\t\tif ((nXDstRel + x < nDstWidth) && (nYDstRel + y < nDstHeight))\n\t\t\t\tWriteColor(pTmpData, DstFormat, color);\n\n\t\t\tif (++x >= width)\n\t\t\t{\n\t\t\t\ty++;\n\t\t\t\tx = 0;\n\t\t\t}\n\t\t}\n\n\t\tpixelIndex += (suiteDepth + 1);\n\t}\n\n\tif (pixelIndex != pixelCount)\n\t{\n\t\tWLog_ERR(TAG, \"pixelIndex %\" PRIu32 \" != pixelCount %\" PRIu32 \"\", pixelIndex, pixelCount);\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  4593. "project": "FreeRDP",
  4594. "hash": 145478480184200339868644033923186345312,
  4595. "size": 184,
  4596. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4597. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4598. "target": 1,
  4599. "dataset": "other",
  4600. "idx": 211489
  4601. },
  4602. {
  4603. "func": "static BOOL clear_decompress_subcode_rlex(wStream* s, UINT32 bitmapDataByteCount, UINT32 width,\n UINT32 height, BYTE* pDstData, UINT32 DstFormat,\n UINT32 nDstStep, UINT32 nXDstRel, UINT32 nYDstRel,\n UINT32 nDstWidth, UINT32 nDstHeight)\n{\n\tUINT32 x = 0, y = 0;\n\tUINT32 i;\n\tUINT32 pixelCount;\n\tUINT32 bitmapDataOffset;\n\tsize_t pixelIndex;\n\tUINT32 numBits;\n\tBYTE startIndex;\n\tBYTE stopIndex;\n\tBYTE suiteIndex;\n\tBYTE suiteDepth;\n\tBYTE paletteCount;\n\tUINT32 palette[128] = { 0 };\n\n\tif (Stream_GetRemainingLength(s) < bitmapDataByteCount)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [%\" PRIu32 \" expected]\",\n\t\t Stream_GetRemainingLength(s), bitmapDataByteCount);\n\t\treturn FALSE;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 1)\n\t\treturn FALSE;\n\tStream_Read_UINT8(s, paletteCount);\n\tbitmapDataOffset = 1 + (paletteCount * 3);\n\n\tif ((paletteCount > 127) || (paletteCount < 1))\n\t{\n\t\tWLog_ERR(TAG, \"paletteCount %\" PRIu8 \"\", paletteCount);\n\t\treturn FALSE;\n\t}\n\n\tif (Stream_GetRemainingLength(s) < 3ULL * paletteCount)\n\t\treturn FALSE;\n\n\tfor (i = 0; i < paletteCount; i++)\n\t{\n\t\tBYTE r, g, b;\n\t\tStream_Read_UINT8(s, b);\n\t\tStream_Read_UINT8(s, g);\n\t\tStream_Read_UINT8(s, r);\n\t\tpalette[i] = FreeRDPGetColor(DstFormat, r, g, b, 0xFF);\n\t}\n\n\tpixelIndex = 0;\n\tpixelCount = width * height;\n\tnumBits = CLEAR_LOG2_FLOOR[paletteCount - 1] + 1;\n\n\twhile (bitmapDataOffset < bitmapDataByteCount)\n\t{\n\t\tUINT32 tmp;\n\t\tUINT32 color;\n\t\tUINT32 runLengthFactor;\n\n\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tStream_Read_UINT8(s, tmp);\n\t\tStream_Read_UINT8(s, runLengthFactor);\n\t\tbitmapDataOffset += 2;\n\t\tsuiteDepth = (tmp >> numBits) & CLEAR_8BIT_MASKS[(8 - numBits)];\n\t\tstopIndex = tmp & CLEAR_8BIT_MASKS[numBits];\n\t\tstartIndex = stopIndex - suiteDepth;\n\n\t\tif (runLengthFactor >= 0xFF)\n\t\t{\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tStream_Read_UINT16(s, runLengthFactor);\n\t\t\tbitmapDataOffset += 2;\n\n\t\t\tif (runLengthFactor >= 0xFFFF)\n\t\t\t{\n\t\t\t\tif (Stream_GetRemainingLength(s) < 4)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [4 expected]\",\n\t\t\t\t\t Stream_GetRemainingLength(s));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tStream_Read_UINT32(s, runLengthFactor);\n\t\t\t\tbitmapDataOffset += 4;\n\t\t\t}\n\t\t}\n\n\t\tif (startIndex >= paletteCount)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"startIndex %\" PRIu8 \" > paletteCount %\" PRIu8 \"]\", startIndex,\n\t\t\t paletteCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (stopIndex >= paletteCount)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stopIndex %\" PRIu8 \" > paletteCount %\" PRIu8 \"]\", stopIndex,\n\t\t\t paletteCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tsuiteIndex = startIndex;\n\n\t\tif (suiteIndex > 127)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"suiteIndex %\" PRIu8 \" > 127]\", suiteIndex);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tcolor = palette[suiteIndex];\n\n\t\tif ((pixelIndex + runLengthFactor) > pixelCount)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"pixelIndex %\" PRIu32 \" + runLengthFactor %\" PRIu32 \" > pixelCount %\" PRIu32\n\t\t\t \"\",\n\t\t\t pixelIndex, runLengthFactor, pixelCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tfor (i = 0; i < runLengthFactor; i++)\n\t\t{\n\t\t\tBYTE* pTmpData =\n\t\t\t &pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) + (nYDstRel + y) * nDstStep];\n\n\t\t\tif ((nXDstRel + x < nDstWidth) && (nYDstRel + y < nDstHeight))\n\t\t\t\tWriteColor(pTmpData, DstFormat, color);\n\n\t\t\tif (++x >= width)\n\t\t\t{\n\t\t\t\ty++;\n\t\t\t\tx = 0;\n\t\t\t}\n\t\t}\n\n\t\tpixelIndex += runLengthFactor;\n\n\t\tif ((pixelIndex + (suiteDepth + 1)) > pixelCount)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"pixelIndex %\" PRIu32 \" + suiteDepth %\" PRIu8 \" + 1 > pixelCount %\" PRIu32 \"\",\n\t\t\t pixelIndex, suiteDepth, pixelCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tfor (i = 0; i <= suiteDepth; i++)\n\t\t{\n\t\t\tBYTE* pTmpData =\n\t\t\t &pDstData[(nXDstRel + x) * GetBytesPerPixel(DstFormat) + (nYDstRel + y) * nDstStep];\n\t\t\tUINT32 color = palette[suiteIndex];\n\n\t\t\tif (suiteIndex > 127)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"suiteIndex %\" PRIu8 \" > 127\", suiteIndex);\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tsuiteIndex++;\n\n\t\t\tif ((nXDstRel + x < nDstWidth) && (nYDstRel + y < nDstHeight))\n\t\t\t\tWriteColor(pTmpData, DstFormat, color);\n\n\t\t\tif (++x >= width)\n\t\t\t{\n\t\t\t\ty++;\n\t\t\t\tx = 0;\n\t\t\t}\n\t\t}\n\n\t\tpixelIndex += (suiteDepth + 1);\n\t}\n\n\tif (pixelIndex != pixelCount)\n\t{\n\t\tWLog_ERR(TAG, \"pixelIndex %\" PRIdz \" != pixelCount %\" PRIu32 \"\", pixelIndex, pixelCount);\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  4604. "project": "FreeRDP",
  4605. "hash": 241001505274535680660475700376958696237,
  4606. "size": 189,
  4607. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4608. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4609. "target": 0,
  4610. "dataset": "other",
  4611. "idx": 448692
  4612. },
  4613. {
  4614. "func": "static BOOL resize_vbar_entry(CLEAR_CONTEXT* clear, CLEAR_VBAR_ENTRY* vBarEntry)\n{\n\tif (vBarEntry->count > vBarEntry->size)\n\t{\n\t\tconst UINT32 bpp = GetBytesPerPixel(clear->format);\n\t\tconst UINT32 oldPos = vBarEntry->size * bpp;\n\t\tconst UINT32 diffSize = (vBarEntry->count - vBarEntry->size) * bpp;\n\t\tBYTE* tmp;\n\t\tvBarEntry->size = vBarEntry->count;\n\t\ttmp = (BYTE*)realloc(vBarEntry->pixels, vBarEntry->count * bpp);\n\n\t\tif (!tmp)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"vBarEntry->pixels realloc %\" PRIu32 \" failed\", vBarEntry->count * bpp);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tmemset(&tmp[oldPos], 0, diffSize);\n\t\tvBarEntry->pixels = tmp;\n\t}\n\n\tif (!vBarEntry->pixels && vBarEntry->size)\n\t{\n\t\tWLog_ERR(TAG, \"vBarEntry->pixels is NULL but vBarEntry->size is %\" PRIu32 \"\",\n\t\t vBarEntry->size);\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  4615. "project": "FreeRDP",
  4616. "hash": 301666549911025748357340600681693137958,
  4617. "size": 30,
  4618. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4619. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4620. "target": 0,
  4621. "dataset": "other",
  4622. "idx": 448691
  4623. },
  4624. {
  4625. "func": "static BOOL clear_decompress_subcodecs_data(CLEAR_CONTEXT* clear, wStream* s,\n UINT32 subcodecByteCount, UINT32 nWidth, UINT32 nHeight,\n BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,\n UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,\n UINT32 nDstHeight, const gdiPalette* palette)\n{\n\tUINT16 xStart;\n\tUINT16 yStart;\n\tUINT16 width;\n\tUINT16 height;\n\tUINT32 bitmapDataByteCount;\n\tBYTE subcodecId;\n\tUINT32 suboffset;\n\n\tif (Stream_GetRemainingLength(s) < subcodecByteCount)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [%\" PRIu32 \" expected]\",\n\t\t Stream_GetRemainingLength(s), subcodecByteCount);\n\t\treturn FALSE;\n\t}\n\n\tsuboffset = 0;\n\n\twhile (suboffset < subcodecByteCount)\n\t{\n\t\tUINT32 nXDstRel;\n\t\tUINT32 nYDstRel;\n\n\t\tif (Stream_GetRemainingLength(s) < 13)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [13 expected]\", Stream_GetRemainingLength(s));\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tStream_Read_UINT16(s, xStart);\n\t\tStream_Read_UINT16(s, yStart);\n\t\tStream_Read_UINT16(s, width);\n\t\tStream_Read_UINT16(s, height);\n\t\tStream_Read_UINT32(s, bitmapDataByteCount);\n\t\tStream_Read_UINT8(s, subcodecId);\n\t\tsuboffset += 13;\n\n\t\tif (Stream_GetRemainingLength(s) < bitmapDataByteCount)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [%\" PRIu32 \" expected]\",\n\t\t\t Stream_GetRemainingLength(s), bitmapDataByteCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tnXDstRel = nXDst + xStart;\n\t\tnYDstRel = nYDst + yStart;\n\n\t\tif (width > nWidth)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"width %\" PRIu16 \" > nWidth %\" PRIu32 \"\", width, nWidth);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (height > nHeight)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"height %\" PRIu16 \" > nHeight %\" PRIu32 \"\", height, nHeight);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tif (!clear_resize_buffer(clear, width, height))\n\t\t\treturn FALSE;\n\n\t\tswitch (subcodecId)\n\t\t{\n\t\t\tcase 0: /* Uncompressed */\n\t\t\t{\n\t\t\t\tUINT32 nSrcStep = width * GetBytesPerPixel(PIXEL_FORMAT_BGR24);\n\t\t\t\tUINT32 nSrcSize = nSrcStep * height;\n\n\t\t\t\tif (bitmapDataByteCount != nSrcSize)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"bitmapDataByteCount %\" PRIu32 \" != nSrcSize %\" PRIu32 \"\",\n\t\t\t\t\t bitmapDataByteCount, nSrcSize);\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tif (!convert_color(pDstData, nDstStep, DstFormat, nXDstRel, nYDstRel, width, height,\n\t\t\t\t Stream_Pointer(s), nSrcStep, PIXEL_FORMAT_BGR24, nDstWidth,\n\t\t\t\t nDstHeight, palette))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tStream_Seek(s, bitmapDataByteCount);\n\t\t\t}\n\t\t\tbreak;\n\n\t\t\tcase 1: /* NSCodec */\n\t\t\t\tif (!clear_decompress_nscodec(clear->nsc, width, height, s, bitmapDataByteCount,\n\t\t\t\t pDstData, DstFormat, nDstStep, nXDstRel, nYDstRel))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tcase 2: /* CLEARCODEC_SUBCODEC_RLEX */\n\t\t\t\tif (!clear_decompress_subcode_rlex(s, bitmapDataByteCount, width, height, pDstData,\n\t\t\t\t DstFormat, nDstStep, nXDstRel, nYDstRel,\n\t\t\t\t nDstWidth, nDstHeight))\n\t\t\t\t\treturn FALSE;\n\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tWLog_ERR(TAG, \"Unknown subcodec ID %\" PRIu8 \"\", subcodecId);\n\t\t\t\treturn FALSE;\n\t\t}\n\n\t\tsuboffset += bitmapDataByteCount;\n\t}\n\n\treturn TRUE;\n}",
  4626. "project": "FreeRDP",
  4627. "hash": 94019142152375544956221959358843020228,
  4628. "size": 115,
  4629. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4630. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4631. "target": 0,
  4632. "dataset": "other",
  4633. "idx": 448695
  4634. },
  4635. {
  4636. "func": "INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData, UINT32 SrcSize, UINT32 nWidth,\n UINT32 nHeight, BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,\n UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight,\n const gdiPalette* palette)\n{\n\tINT32 rc = -1;\n\tBYTE seqNumber;\n\tBYTE glyphFlags;\n\tUINT32 residualByteCount;\n\tUINT32 bandsByteCount;\n\tUINT32 subcodecByteCount;\n\twStream* s;\n\tBYTE* glyphData = NULL;\n\n\tif (!pDstData)\n\t\treturn -1002;\n\n\tif ((nDstWidth == 0) || (nDstHeight == 0))\n\t\treturn -1022;\n\n\tif ((nWidth > 0xFFFF) || (nHeight > 0xFFFF))\n\t\treturn -1004;\n\n\ts = Stream_New((BYTE*)pSrcData, SrcSize);\n\n\tif (!s)\n\t\treturn -2005;\n\n\tStream_SetLength(s, SrcSize);\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\tgoto fail;\n\t}\n\n\tif (!updateContextFormat(clear, DstFormat))\n\t\tgoto fail;\n\n\tStream_Read_UINT8(s, glyphFlags);\n\tStream_Read_UINT8(s, seqNumber);\n\n\tif (!clear->seqNumber && seqNumber)\n\t\tclear->seqNumber = seqNumber;\n\n\tif (seqNumber != clear->seqNumber)\n\t{\n\t\tWLog_ERR(TAG, \"Sequence number unexpected %\" PRIu8 \" - %\" PRIu32 \"\", seqNumber,\n\t\t clear->seqNumber);\n\t\tWLog_ERR(TAG, \"seqNumber %\" PRIu8 \" != clear->seqNumber %\" PRIu32 \"\", seqNumber,\n\t\t clear->seqNumber);\n\t\tgoto fail;\n\t}\n\n\tclear->seqNumber = (seqNumber + 1) % 256;\n\n\tif (glyphFlags & CLEARCODEC_FLAG_CACHE_RESET)\n\t{\n\t\tclear->VBarStorageCursor = 0;\n\t\tclear->ShortVBarStorageCursor = 0;\n\t}\n\n\tif (!clear_decompress_glyph_data(clear, s, glyphFlags, nWidth, nHeight, pDstData, DstFormat,\n\t nDstStep, nXDst, nYDst, nDstWidth, nDstHeight, palette,\n\t &glyphData))\n\t{\n\t\tWLog_ERR(TAG, \"clear_decompress_glyph_data failed!\");\n\t\tgoto fail;\n\t}\n\n\t/* Read composition payload header parameters */\n\tif (Stream_GetRemainingLength(s) < 12)\n\t{\n\t\tconst UINT32 mask = (CLEARCODEC_FLAG_GLYPH_HIT | CLEARCODEC_FLAG_GLYPH_INDEX);\n\n\t\tif ((glyphFlags & mask) == mask)\n\t\t\tgoto finish;\n\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [12 expected]\", Stream_GetRemainingLength(s));\n\t\tgoto fail;\n\t}\n\n\tStream_Read_UINT32(s, residualByteCount);\n\tStream_Read_UINT32(s, bandsByteCount);\n\tStream_Read_UINT32(s, subcodecByteCount);\n\n\tif (residualByteCount > 0)\n\t{\n\t\tif (!clear_decompress_residual_data(clear, s, residualByteCount, nWidth, nHeight, pDstData,\n\t\t DstFormat, nDstStep, nXDst, nYDst, nDstWidth,\n\t\t nDstHeight, palette))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"clear_decompress_residual_data failed!\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\n\tif (bandsByteCount > 0)\n\t{\n\t\tif (!clear_decompress_bands_data(clear, s, bandsByteCount, nWidth, nHeight, pDstData,\n\t\t DstFormat, nDstStep, nXDst, nYDst))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"clear_decompress_bands_data failed!\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\n\tif (subcodecByteCount > 0)\n\t{\n\t\tif (!clear_decompress_subcodecs_data(clear, s, subcodecByteCount, nWidth, nHeight, pDstData,\n\t\t DstFormat, nDstStep, nXDst, nYDst, nDstWidth,\n\t\t nDstHeight, palette))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"clear_decompress_subcodecs_data failed!\");\n\t\t\tgoto fail;\n\t\t}\n\t}\n\n\tif (glyphData)\n\t{\n\t\tif (!freerdp_image_copy(glyphData, clear->format, 0, 0, 0, nWidth, nHeight, pDstData,\n\t\t DstFormat, nDstStep, nXDst, nYDst, palette, FREERDP_FLIP_NONE))\n\t\t\tgoto fail;\n\t}\n\nfinish:\n\trc = 0;\nfail:\n\tStream_Free(s, FALSE);\n\treturn rc;\n}",
  4637. "project": "FreeRDP",
  4638. "hash": 68296154578086025929012329809724926394,
  4639. "size": 131,
  4640. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4641. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4642. "target": 0,
  4643. "dataset": "other",
  4644. "idx": 448694
  4645. },
  4646. {
  4647. "func": "static BOOL clear_decompress_residual_data(CLEAR_CONTEXT* clear, wStream* s,\n UINT32 residualByteCount, UINT32 nWidth, UINT32 nHeight,\n BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,\n UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,\n UINT32 nDstHeight, const gdiPalette* palette)\n{\n\tUINT32 i;\n\tUINT32 nSrcStep;\n\tUINT32 suboffset;\n\tBYTE* dstBuffer;\n\tUINT32 pixelIndex;\n\tUINT32 pixelCount;\n\n\tif (Stream_GetRemainingLength(s) < residualByteCount)\n\t{\n\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [%\" PRIu32 \" expected]\",\n\t\t Stream_GetRemainingLength(s), residualByteCount);\n\t\treturn FALSE;\n\t}\n\n\tsuboffset = 0;\n\tpixelIndex = 0;\n\tpixelCount = nWidth * nHeight;\n\n\tif (!clear_resize_buffer(clear, nWidth, nHeight))\n\t\treturn FALSE;\n\n\tdstBuffer = clear->TempBuffer;\n\n\twhile (suboffset < residualByteCount)\n\t{\n\t\tBYTE r, g, b;\n\t\tUINT32 runLengthFactor;\n\t\tUINT32 color;\n\n\t\tif (Stream_GetRemainingLength(s) < 4)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [4 expected]\", Stream_GetRemainingLength(s));\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tStream_Read_UINT8(s, b);\n\t\tStream_Read_UINT8(s, g);\n\t\tStream_Read_UINT8(s, r);\n\t\tStream_Read_UINT8(s, runLengthFactor);\n\t\tsuboffset += 4;\n\t\tcolor = FreeRDPGetColor(clear->format, r, g, b, 0xFF);\n\n\t\tif (runLengthFactor >= 0xFF)\n\t\t{\n\t\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [2 expected]\", Stream_GetRemainingLength(s));\n\t\t\t\treturn FALSE;\n\t\t\t}\n\n\t\t\tStream_Read_UINT16(s, runLengthFactor);\n\t\t\tsuboffset += 2;\n\n\t\t\tif (runLengthFactor >= 0xFFFF)\n\t\t\t{\n\t\t\t\tif (Stream_GetRemainingLength(s) < 4)\n\t\t\t\t{\n\t\t\t\t\tWLog_ERR(TAG, \"stream short %\" PRIuz \" [4 expected]\",\n\t\t\t\t\t Stream_GetRemainingLength(s));\n\t\t\t\t\treturn FALSE;\n\t\t\t\t}\n\n\t\t\t\tStream_Read_UINT32(s, runLengthFactor);\n\t\t\t\tsuboffset += 4;\n\t\t\t}\n\t\t}\n\n\t\tif ((pixelIndex + runLengthFactor) > pixelCount)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"pixelIndex %\" PRIu32 \" + runLengthFactor %\" PRIu32 \" > pixelCount %\" PRIu32\n\t\t\t \"\",\n\t\t\t pixelIndex, runLengthFactor, pixelCount);\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tfor (i = 0; i < runLengthFactor; i++)\n\t\t{\n\t\t\tWriteColor(dstBuffer, clear->format, color);\n\t\t\tdstBuffer += GetBytesPerPixel(clear->format);\n\t\t}\n\n\t\tpixelIndex += runLengthFactor;\n\t}\n\n\tnSrcStep = nWidth * GetBytesPerPixel(clear->format);\n\n\tif (pixelIndex != pixelCount)\n\t{\n\t\tWLog_ERR(TAG, \"pixelIndex %\" PRIu32 \" != pixelCount %\" PRIu32 \"\", pixelIndex, pixelCount);\n\t\treturn FALSE;\n\t}\n\n\treturn convert_color(pDstData, nDstStep, DstFormat, nXDst, nYDst, nWidth, nHeight,\n\t clear->TempBuffer, nSrcStep, clear->format, nDstWidth, nDstHeight,\n\t palette);\n}",
  4648. "project": "FreeRDP",
  4649. "hash": 192281134689880918936980083906130543365,
  4650. "size": 103,
  4651. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4652. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4653. "target": 0,
  4654. "dataset": "other",
  4655. "idx": 448686
  4656. },
  4657. {
  4658. "func": "static BOOL convert_color(BYTE* dst, UINT32 nDstStep, UINT32 DstFormat, UINT32 nXDst, UINT32 nYDst,\n UINT32 nWidth, UINT32 nHeight, const BYTE* src, UINT32 nSrcStep,\n UINT32 SrcFormat, UINT32 nDstWidth, UINT32 nDstHeight,\n const gdiPalette* palette)\n{\n\tif (nWidth + nXDst > nDstWidth)\n\t\tnWidth = nDstWidth - nXDst;\n\n\tif (nHeight + nYDst > nDstHeight)\n\t\tnHeight = nDstHeight - nYDst;\n\n\treturn freerdp_image_copy(dst, DstFormat, nDstStep, nXDst, nYDst, nWidth, nHeight, src,\n\t SrcFormat, nSrcStep, 0, 0, palette, 0);\n}",
  4659. "project": "FreeRDP",
  4660. "hash": 234619938262544236369520415119142365098,
  4661. "size": 14,
  4662. "commit_id": "363d7046dfec4003b91aecf7867e3b05905f3843",
  4663. "message": "Fixed oob read in clear_decompress_subcode_rlex\n\nFixed length checks before stream read.\nThanks to hac425 CVE-2020-11040",
  4664. "target": 0,
  4665. "dataset": "other",
  4666. "idx": 448699
  4667. }
  4668. ]
  4669. },
  4670. {
  4671. "call_depth": 3,
  4672. "longest_call_chain": [
  4673. "cil_reset_constrain",
  4674. "cil_reset_classperms_list",
  4675. "cil_reset_classperms"
  4676. ],
  4677. "group_size": 8,
  4678. "functions": [
  4679. {
  4680. "func": "static void cil_reset_constrain(struct cil_constrain *con)\n{\n\tcil_reset_classperms_list(con->classperms);\n\tcil_list_destroy(&con->datum_expr, CIL_FALSE);\n}",
  4681. "project": "selinux",
  4682. "hash": 42046458994733929604009528193484766354,
  4683. "size": 5,
  4684. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4685. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4686. "target": 0,
  4687. "dataset": "other",
  4688. "idx": 416780
  4689. },
  4690. {
  4691. "func": "static inline void cil_reset_classperms_list(struct cil_list *cp_list)\n{\n\tstruct cil_list_item *curr;\n\n\tif (cp_list == NULL) {\n\t\treturn;\n\t}\n\n\tcil_list_for_each(curr, cp_list) {\n\t\tif (curr->flavor == CIL_CLASSPERMS) { /* KERNEL or MAP */\n\t\t\tcil_reset_classperms(curr->data);\n\t\t} else if (curr->flavor == CIL_CLASSPERMS_SET) { /* SET */\n\t\t\tcil_reset_classperms_set(curr->data);\n\t\t}\n\t}\n}",
  4692. "project": "selinux",
  4693. "hash": 316855638401060528974716351147820201392,
  4694. "size": 16,
  4695. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4696. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4697. "target": 0,
  4698. "dataset": "other",
  4699. "idx": 416755
  4700. },
  4701. {
  4702. "func": "static void cil_reset_classpermissionset(struct cil_classpermissionset *cps)\n{\n\tcil_reset_classperms_list(cps->classperms);\n}",
  4703. "project": "selinux",
  4704. "hash": 235137699480676414178363936394519566185,
  4705. "size": 4,
  4706. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4707. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4708. "target": 0,
  4709. "dataset": "other",
  4710. "idx": 416786
  4711. },
  4712. {
  4713. "func": "static void cil_reset_classperms_set(struct cil_classperms_set *cp_set)\n{\n\tcil_reset_classpermission(cp_set->set);\n}",
  4714. "project": "selinux",
  4715. "hash": 228898186887741153148874390102479645011,
  4716. "size": 4,
  4717. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4718. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4719. "target": 1,
  4720. "dataset": "other",
  4721. "idx": 208940
  4722. },
  4723. {
  4724. "func": "static void cil_reset_classperms_set(struct cil_classperms_set *cp_set)\n{\n\tif (cp_set == NULL) {\n\t\treturn;\n\t}\n\n\tcp_set->set = NULL;\n}",
  4725. "project": "selinux",
  4726. "hash": 312395514706607151530792670992877795844,
  4727. "size": 8,
  4728. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4729. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4730. "target": 0,
  4731. "dataset": "other",
  4732. "idx": 416787
  4733. },
  4734. {
  4735. "func": "static void cil_reset_classmapping(struct cil_classmapping *cm)\n{\n\tcil_reset_classperms_list(cm->classperms);\n}",
  4736. "project": "selinux",
  4737. "hash": 251512747502057207615297906506572828453,
  4738. "size": 4,
  4739. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4740. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4741. "target": 0,
  4742. "dataset": "other",
  4743. "idx": 416762
  4744. },
  4745. {
  4746. "func": "static inline void cil_reset_classperms(struct cil_classperms *cp)\n{\n\tif (cp == NULL) {\n\t\treturn;\n\t}\n\n\tcil_list_destroy(&cp->perms, CIL_FALSE);\n}",
  4747. "project": "selinux",
  4748. "hash": 21946602524898828460963963114849050471,
  4749. "size": 8,
  4750. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4751. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4752. "target": 0,
  4753. "dataset": "other",
  4754. "idx": 416798
  4755. },
  4756. {
  4757. "func": "static void cil_reset_avrule(struct cil_avrule *rule)\n{\n\tcil_reset_classperms_list(rule->perms.classperms);\n}",
  4758. "project": "selinux",
  4759. "hash": 251005912957380078455335345947156890607,
  4760. "size": 4,
  4761. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  4762. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  4763. "target": 0,
  4764. "dataset": "other",
  4765. "idx": 416754
  4766. }
  4767. ]
  4768. },
  4769. {
  4770. "call_depth": 3,
  4771. "longest_call_chain": [
  4772. "_php_iconv_strpos",
  4773. "php_iconv_string",
  4774. "iconv_close"
  4775. ],
  4776. "group_size": 7,
  4777. "functions": [
  4778. {
  4779. "func": "static php_iconv_err_t _php_iconv_strpos(size_t *pretval,\n\tconst char *haystk, size_t haystk_nbytes,\n\tconst char *ndl, size_t ndl_nbytes,\n\tzend_long offset, const char *enc)\n{\n\tchar buf[GENERIC_SUPERSET_NBYTES];\n\n\tphp_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;\n\n\ticonv_t cd;\n\n\tconst char *in_p;\n\tsize_t in_left;\n\n\tchar *out_p;\n\tsize_t out_left;\n\n\tsize_t cnt;\n\n\tzend_string *ndl_buf;\n\tconst char *ndl_buf_p;\n\tsize_t ndl_buf_left;\n\n\tsize_t match_ofs;\n\n\t*pretval = (size_t)-1;\n\n\terr = php_iconv_string(ndl, ndl_nbytes, &ndl_buf, GENERIC_SUPERSET_NAME, enc);\n\n\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\tif (ndl_buf != NULL) {\n\t\t\tzend_string_free(ndl_buf);\n\t\t}\n\t\treturn err;\n\t}\n\n\tcd = iconv_open(GENERIC_SUPERSET_NAME, enc);\n\n\tif (cd == (iconv_t)(-1)) {\n\t\tif (ndl_buf != NULL) {\n\t\t\tzend_string_free(ndl_buf);\n\t\t}\n#if ICONV_SUPPORTS_ERRNO\n\t\tif (errno == EINVAL) {\n\t\t\treturn PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t} else {\n\t\t\treturn PHP_ICONV_ERR_CONVERTER;\n\t\t}\n#else\n\t\treturn PHP_ICONV_ERR_UNKNOWN;\n#endif\n\t}\n\n\tndl_buf_p = ZSTR_VAL(ndl_buf);\n\tndl_buf_left = ZSTR_LEN(ndl_buf);\n\tmatch_ofs = (size_t)-1;\n\n\tfor (in_p = haystk, in_left = haystk_nbytes, cnt = 0; in_left > 0; ++cnt) {\n\t\tsize_t prev_in_left;\n\t\tout_p = buf;\n\t\tout_left = sizeof(buf);\n\n\t\tprev_in_left = in_left;\n\n\t\tif (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {\n\t\t\tif (prev_in_left == in_left) {\n#if ICONV_SUPPORTS_ERRNO\n\t\t\t\tswitch (errno) {\n\t\t\t\t\tcase EINVAL:\n\t\t\t\t\t\terr = PHP_ICONV_ERR_ILLEGAL_CHAR;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase EILSEQ:\n\t\t\t\t\t\terr = PHP_ICONV_ERR_ILLEGAL_SEQ;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase E2BIG:\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n#endif\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif (offset >= 0) {\n\t\t\tif (cnt >= (size_t)offset) {\n\t\t\t\tif (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) {\n\t\t\t\t\tif (match_ofs == (size_t)-1) {\n\t\t\t\t\t\tmatch_ofs = cnt;\n\t\t\t\t\t}\n\t\t\t\t\tndl_buf_p += GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\tndl_buf_left -= GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\tif (ndl_buf_left == 0) {\n\t\t\t\t\t\t*pretval = match_ofs;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tsize_t i, j, lim;\n\n\t\t\t\t\ti = 0;\n\t\t\t\t\tj = GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\tlim = (size_t)(ndl_buf_p - ZSTR_VAL(ndl_buf));\n\n\t\t\t\t\twhile (j < lim) {\n\t\t\t\t\t\tif (_php_iconv_memequal(&ZSTR_VAL(ndl_buf)[j], &ZSTR_VAL(ndl_buf)[i],\n\t\t\t\t\t\t GENERIC_SUPERSET_NBYTES)) {\n\t\t\t\t\t\t\ti += GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tj -= i;\n\t\t\t\t\t\t\ti = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tj += GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (_php_iconv_memequal(buf, &ZSTR_VAL(ndl_buf)[i], sizeof(buf))) {\n\t\t\t\t\t\tmatch_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\t\ti += GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\t\tndl_buf_p = &ZSTR_VAL(ndl_buf)[i];\n\t\t\t\t\t\tndl_buf_left = ZSTR_LEN(ndl_buf) - i;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tmatch_ofs = (size_t)-1;\n\t\t\t\t\t\tndl_buf_p = ZSTR_VAL(ndl_buf);\n\t\t\t\t\t\tndl_buf_left = ZSTR_LEN(ndl_buf);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} else {\n\t\t\tif (_php_iconv_memequal(buf, ndl_buf_p, sizeof(buf))) {\n\t\t\t\tif (match_ofs == (size_t)-1) {\n\t\t\t\t\tmatch_ofs = cnt;\n\t\t\t\t}\n\t\t\t\tndl_buf_p += GENERIC_SUPERSET_NBYTES;\n\t\t\t\tndl_buf_left -= GENERIC_SUPERSET_NBYTES;\n\t\t\t\tif (ndl_buf_left == 0) {\n\t\t\t\t\t*pretval = match_ofs;\n\t\t\t\t\tndl_buf_p = ZSTR_VAL(ndl_buf);\n\t\t\t\t\tndl_buf_left = ZSTR_LEN(ndl_buf);\n\t\t\t\t\tmatch_ofs = -1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsize_t i, j, lim;\n\n\t\t\t\ti = 0;\n\t\t\t\tj = GENERIC_SUPERSET_NBYTES;\n\t\t\t\tlim = (size_t)(ndl_buf_p - ZSTR_VAL(ndl_buf));\n\n\t\t\t\twhile (j < lim) {\n\t\t\t\t\tif (_php_iconv_memequal(&ZSTR_VAL(ndl_buf)[j], &ZSTR_VAL(ndl_buf)[i],\n\t\t\t\t\t\t\t GENERIC_SUPERSET_NBYTES)) {\n\t\t\t\t\t\ti += GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tj -= i;\n\t\t\t\t\t\ti = 0;\n\t\t\t\t\t}\n\t\t\t\t\tj += GENERIC_SUPERSET_NBYTES;\n\t\t\t\t}\n\n\t\t\t\tif (_php_iconv_memequal(buf, &ZSTR_VAL(ndl_buf)[i], sizeof(buf))) {\n\t\t\t\t\tmatch_ofs += (lim - i) / GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\ti += GENERIC_SUPERSET_NBYTES;\n\t\t\t\t\tndl_buf_p = &ZSTR_VAL(ndl_buf)[i];\n\t\t\t\t\tndl_buf_left = ZSTR_LEN(ndl_buf) - i;\n\t\t\t\t} else {\n\t\t\t\t\tmatch_ofs = (size_t)-1;\n\t\t\t\t\tndl_buf_p = ZSTR_VAL(ndl_buf);\n\t\t\t\t\tndl_buf_left = ZSTR_LEN(ndl_buf);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tif (ndl_buf) {\n\t\tzend_string_free(ndl_buf);\n\t}\n\n\ticonv_close(cd);\n\n\treturn err;\n}",
  4780. "project": "php-src",
  4781. "hash": 136705828539951720597151568353350696357,
  4782. "size": 182,
  4783. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  4784. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  4785. "target": 0,
  4786. "dataset": "other",
  4787. "idx": 382774
  4788. },
  4789. {
  4790. "func": "free_sconv_object(struct archive_string_conv *sc)\n{\n\tfree(sc->from_charset);\n\tfree(sc->to_charset);\n\tarchive_string_free(&sc->utftmp);\n#if HAVE_ICONV\n\tif (sc->cd != (iconv_t)-1)\n\t\ticonv_close(sc->cd);\n\tif (sc->cd_w != (iconv_t)-1)\n\t\ticonv_close(sc->cd_w);\n#endif\n\tfree(sc);\n}",
  4791. "project": "libarchive",
  4792. "hash": 32070168319061805060860024230826786,
  4793. "size": 13,
  4794. "commit_id": "4f085eea879e2be745f4d9bf57e8513ae48157f4",
  4795. "message": "Fix a possible heap-buffer-overflow in archive_string_append_from_wcs()\n\nWhen we grow the archive_string buffer, we have to make sure it fits\nat least one maximum-sized multibyte character in the current locale\nand the null character.\n\nFixes #1298",
  4796. "target": 0,
  4797. "dataset": "other",
  4798. "idx": 325886
  4799. },
  4800. {
  4801. "func": "PHP_ICONV_API php_iconv_err_t php_iconv_string(const char *in_p, size_t in_len, zend_string **out, const char *out_charset, const char *in_charset)\n{\n#if !ICONV_SUPPORTS_ERRNO\n\tsize_t in_size, out_size, out_left;\n\tchar *out_p;\n\ticonv_t cd;\n\tsize_t result;\n\tzend_string *ret, *out_buffer;\n\n\t*out = NULL;\n\n\t/*\n\t This is not the right way to get output size...\n\t This is not space efficient for large text.\n\t This is also problem for encoding like UTF-7/UTF-8/ISO-2022 which\n\t a single char can be more than 4 bytes.\n\t I added 15 extra bytes for safety. <yohgaki@php.net>\n\t*/\n\tout_size = in_len * sizeof(int) + 15;\n\tout_left = out_size;\n\n\tin_size = in_len;\n\n\tcd = iconv_open(out_charset, in_charset);\n\n\tif (cd == (iconv_t)(-1)) {\n\t\treturn PHP_ICONV_ERR_UNKNOWN;\n\t}\n\n\tout_buffer = zend_string_alloc(out_size, 0);\n\tout_p = ZSTR_VAL(out_buffer);\n\n#ifdef NETWARE\n\tresult = iconv(cd, (char **) &in_p, &in_size, (char **)\n#else\n\tresult = iconv(cd, (const char **) &in_p, &in_size, (char **)\n#endif\n\t\t\t\t&out_p, &out_left);\n\n\tif (result == (size_t)(-1)) {\n\t\tzend_string_free(out_buffer);\n\t\treturn PHP_ICONV_ERR_UNKNOWN;\n\t}\n\n\tif (out_left < 8) {\n\t\tsize_t pos = out_p - ZSTR_VAL(out_buffer);\n\t\tout_buffer = zend_string_extend(out_buffer, out_size + 8, 0);\n\t\tout_p = ZSTR_VAL(out_buffer) + pos;\n\t\tout_size += 7;\n\t\tout_left += 7;\n\t}\n\n\t/* flush the shift-out sequences */\n\tresult = iconv(cd, NULL, NULL, &out_p, &out_left);\n\n\tif (result == (size_t)(-1)) {\n\t\tzend_string_free(out_buffer);\n\t\treturn PHP_ICONV_ERR_UNKNOWN;\n\t}\n\n\tZSTR_VAL(out_buffer)[out_size - out_left] = '\\0';\n\tZSTR_LEN(out_buffer) = out_size - out_left;\n\n\ticonv_close(cd);\n\n\t*out = out_buffer;\n\treturn PHP_ICONV_ERR_SUCCESS;\n\n#else\n\t/*\n\t iconv supports errno. Handle it better way.\n\t*/\n\ticonv_t cd;\n\tsize_t in_left, out_size, out_left;\n\tchar *out_p;\n\tsize_t bsz, result = 0;\n\tphp_iconv_err_t retval = PHP_ICONV_ERR_SUCCESS;\n\tzend_string *out_buf;\n\tint ignore_ilseq = _php_check_ignore(out_charset);\n\n\t*out = NULL;\n\n\tcd = iconv_open(out_charset, in_charset);\n\n\tif (cd == (iconv_t)(-1)) {\n\t\tif (errno == EINVAL) {\n\t\t\treturn PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t} else {\n\t\t\treturn PHP_ICONV_ERR_CONVERTER;\n\t\t}\n\t}\n\tin_left= in_len;\n\tout_left = in_len + 32; /* Avoid realloc() most cases */\n\tout_size = 0;\n\tbsz = out_left;\n\tout_buf = zend_string_alloc(bsz, 0);\n\tout_p = ZSTR_VAL(out_buf);\n\n\twhile (in_left > 0) {\n\t\tresult = iconv(cd, (char **) &in_p, &in_left, (char **) &out_p, &out_left);\n\t\tout_size = bsz - out_left;\n\t\tif (result == (size_t)(-1)) {\n\t\t\tif (ignore_ilseq && errno == EILSEQ) {\n\t\t\t\tif (in_left <= 1) {\n\t\t\t\t\tresult = 0;\n\t\t\t\t} else {\n\t\t\t\t\terrno = 0;\n\t\t\t\t\tin_p++;\n\t\t\t\t\tin_left--;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (errno == E2BIG && in_left > 0) {\n\t\t\t\t/* converted string is longer than out buffer */\n\t\t\t\tbsz += in_len;\n\n\t\t\t\tout_buf = zend_string_extend(out_buf, bsz, 0);\n\t\t\t\tout_p = ZSTR_VAL(out_buf);\n\t\t\t\tout_p += out_size;\n\t\t\t\tout_left = bsz - out_size;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n\n\tif (result != (size_t)(-1)) {\n\t\t/* flush the shift-out sequences */\n\t\tfor (;;) {\n\t\t \tresult = iconv(cd, NULL, NULL, (char **) &out_p, &out_left);\n\t\t\tout_size = bsz - out_left;\n\n\t\t\tif (result != (size_t)(-1)) {\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (errno == E2BIG) {\n\t\t\t\tbsz += 16;\n\t\t\t\tout_buf = zend_string_extend(out_buf, bsz, 0);\n\t\t\t\tout_p = ZSTR_VAL(out_buf);\n\t\t\t\tout_p += out_size;\n\t\t\t\tout_left = bsz - out_size;\n\t\t\t} else {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\ticonv_close(cd);\n\n\tif (result == (size_t)(-1)) {\n\t\tswitch (errno) {\n\t\t\tcase EINVAL:\n\t\t\t\tretval = PHP_ICONV_ERR_ILLEGAL_CHAR;\n\t\t\t\tbreak;\n\n\t\t\tcase EILSEQ:\n\t\t\t\tretval = PHP_ICONV_ERR_ILLEGAL_SEQ;\n\t\t\t\tbreak;\n\n\t\t\tcase E2BIG:\n\t\t\t\t/* should not happen */\n\t\t\t\tretval = PHP_ICONV_ERR_TOO_BIG;\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\t/* other error */\n\t\t\t\tzend_string_free(out_buf);\n\t\t\t\treturn PHP_ICONV_ERR_UNKNOWN;\n\t\t}\n\t}\n\t*out_p = '\\0';\n\tZSTR_LEN(out_buf) = out_size;\n\t*out = out_buf;\n\treturn retval;\n#endif\n}",
  4802. "project": "php-src",
  4803. "hash": 28003817645662753023565888650021665285,
  4804. "size": 178,
  4805. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  4806. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  4807. "target": 0,
  4808. "dataset": "other",
  4809. "idx": 382778
  4810. },
  4811. {
  4812. "func": "static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode)\n{\n\tphp_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;\n\n\ticonv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);\n\n\tconst char *p1;\n\tsize_t str_left;\n\tunsigned int scan_stat = 0;\n\tconst char *csname = NULL;\n\tsize_t csname_len;\n\tconst char *encoded_text = NULL;\n\tsize_t encoded_text_len = 0;\n\tconst char *encoded_word = NULL;\n\tconst char *spaces = NULL;\n\n\tphp_iconv_enc_scheme_t enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64;\n\n\tif (next_pos != NULL) {\n\t\t*next_pos = NULL;\n\t}\n\n\tcd_pl = iconv_open(enc, ICONV_ASCII_ENCODING);\n\n\tif (cd_pl == (iconv_t)(-1)) {\n#if ICONV_SUPPORTS_ERRNO\n\t\tif (errno == EINVAL) {\n\t\t\terr = PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t} else {\n\t\t\terr = PHP_ICONV_ERR_CONVERTER;\n\t\t}\n#else\n\t\terr = PHP_ICONV_ERR_UNKNOWN;\n#endif\n\t\tgoto out;\n\t}\n\n\tp1 = str;\n\tfor (str_left = str_nbytes; str_left > 0; str_left--, p1++) {\n\t\tint eos = 0;\n\n\t\tswitch (scan_stat) {\n\t\t\tcase 0: /* expecting any character */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\tencoded_word = p1;\n\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ' ': case '\\t': /* a chunk of whitespaces */\n\t\t\t\t\t\tspaces = p1;\n\t\t\t\t\t\tscan_stat = 11;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault: /* first letter of a non-encoded word */\n\t\t\t\t\t\terr = _php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tif (mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR) {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_SUCCESS;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 1: /* expecting a delimiter */\n\t\t\t\tif (*p1 != '?') {\n\t\t\t\t\tif (*p1 == '\\r' || *p1 == '\\n') {\n\t\t\t\t\t\t--p1;\n\t\t\t\t\t}\n\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcsname = p1 + 1;\n\t\t\t\tscan_stat = 2;\n\t\t\t\tbreak;\n\n\t\t\tcase 2: /* expecting a charset name */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '?': /* normal delimiter: encoding scheme follows */\n\t\t\t\t\t\tscan_stat = 3;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '*': /* new style delimiter: locale id follows */\n\t\t\t\t\t\tscan_stat = 10;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\r': case '\\n': /* not an encoded-word */\n\t\t\t\t\t\t--p1;\n\t\t\t\t\t\t_php_iconv_appendc(pretval, '=', cd_pl);\n\t\t\t\t\t\t_php_iconv_appendc(pretval, '?', cd_pl);\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, csname, (size_t)((p1 + 1) - csname), cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcsname = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (scan_stat != 2) {\n\t\t\t\t\tchar tmpbuf[80];\n\n\t\t\t\t\tif (csname == NULL) {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\n\t\t\t\t\tcsname_len = (size_t)(p1 - csname);\n\n\t\t\t\t\tif (csname_len > sizeof(tmpbuf) - 1) {\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tmemcpy(tmpbuf, csname, csname_len);\n\t\t\t\t\ttmpbuf[csname_len] = '\\0';\n\n\t\t\t\t\tif (cd != (iconv_t)(-1)) {\n\t\t\t\t\t\ticonv_close(cd);\n\t\t\t\t\t}\n\n\t\t\t\t\tcd = iconv_open(enc, tmpbuf);\n\n\t\t\t\t\tif (cd == (iconv_t)(-1)) {\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\t/* Bad character set, but the user wants us to\n\t\t\t\t\t\t\t * press on. In this case, we'll just insert the\n\t\t\t\t\t\t\t * undecoded encoded word, since there isn't really\n\t\t\t\t\t\t\t * a more sensible behaviour available; the only\n\t\t\t\t\t\t\t * other options are to swallow the encoded word\n\t\t\t\t\t\t\t * entirely or decode it with an arbitrarily chosen\n\t\t\t\t\t\t\t * single byte encoding, both of which seem to have\n\t\t\t\t\t\t\t * a higher WTF factor than leaving it undecoded.\n\t\t\t\t\t\t\t *\n\t\t\t\t\t\t\t * Given this approach, we need to skip ahead to\n\t\t\t\t\t\t\t * the end of the encoded word. */\n\t\t\t\t\t\t\tint qmarks = 2;\n\t\t\t\t\t\t\twhile (qmarks > 0 && str_left > 1) {\n\t\t\t\t\t\t\t\tif (*(++p1) == '?') {\n\t\t\t\t\t\t\t\t\t--qmarks;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t--str_left;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* Look ahead to check for the terminating = that\n\t\t\t\t\t\t\t * should be there as well; if it's there, we'll\n\t\t\t\t\t\t\t * also include that. If it's not, there isn't much\n\t\t\t\t\t\t\t * we can do at this point. */\n\t\t\t\t\t\t\tif (*(p1 + 1) == '=') {\n\t\t\t\t\t\t\t\t++p1;\n\t\t\t\t\t\t\t\t--str_left;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* Let's go back and see if there are further\n\t\t\t\t\t\t\t * encoded words or bare content, and hope they\n\t\t\t\t\t\t\t * might actually have a valid character set. */\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n#if ICONV_SUPPORTS_ERRNO\n\t\t\t\t\t\t\tif (errno == EINVAL) {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_CONVERTER;\n\t\t\t\t\t\t\t}\n#else\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n#endif\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 3: /* expecting a encoding scheme specifier */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase 'b':\n\t\t\t\t\tcase 'B':\n\t\t\t\t\t\tenc_scheme = PHP_ICONV_ENC_SCHEME_BASE64;\n\t\t\t\t\t\tscan_stat = 4;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'q':\n\t\t\t\t\tcase 'Q':\n\t\t\t\t\t\tenc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT;\n\t\t\t\t\t\tscan_stat = 4;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 4: /* expecting a delimiter */\n\t\t\t\tif (*p1 != '?') {\n\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tencoded_text = p1 + 1;\n\t\t\t\tscan_stat = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 5: /* expecting an encoded portion */\n\t\t\t\tif (*p1 == '?') {\n\t\t\t\t\tencoded_text_len = (size_t)(p1 - encoded_text);\n\t\t\t\t\tscan_stat = 6;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 7: /* expecting a \"\\n\" character */\n\t\t\t\tif (*p1 == '\\n') {\n\t\t\t\t\tscan_stat = 8;\n\t\t\t\t} else {\n\t\t\t\t\t/* bare CR */\n\t\t\t\t\t_php_iconv_appendc(pretval, '\\r', cd_pl);\n\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\tscan_stat = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 8: /* checking whether the following line is part of a\n\t\t\t\t\t folded header */\n\t\t\t\tif (*p1 != ' ' && *p1 != '\\t') {\n\t\t\t\t\t--p1;\n\t\t\t\t\tstr_left = 1; /* quit_loop */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (encoded_word == NULL) {\n\t\t\t\t\t_php_iconv_appendc(pretval, ' ', cd_pl);\n\t\t\t\t}\n\t\t\t\tspaces = NULL;\n\t\t\t\tscan_stat = 11;\n\t\t\t\tbreak;\n\n\t\t\tcase 6: /* expecting a End-Of-Chunk character \"=\" */\n\t\t\t\tif (*p1 != '=') {\n\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscan_stat = 9;\n\t\t\t\tif (str_left == 1) {\n\t\t\t\t\teos = 1;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase 9: /* choice point, seeing what to do next.*/\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t/* Handle non-RFC-compliant formats\n\t\t\t\t\t\t *\n\t\t\t\t\t\t * RFC2047 requires the character that comes right\n\t\t\t\t\t\t * after an encoded word (chunk) to be a whitespace,\n\t\t\t\t\t\t * while there are lots of broken implementations that\n\t\t\t\t\t\t * generate such malformed headers that don't fulfill\n\t\t\t\t\t\t * that requirement.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!eos) {\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* break is omitted intentionally */\n\n\t\t\t\t\tcase '\\r': case '\\n': case ' ': case '\\t': {\n\t\t\t\t\t\tzend_string *decoded_text;\n\n\t\t\t\t\t\tswitch (enc_scheme) {\n\t\t\t\t\t\t\tcase PHP_ICONV_ENC_SCHEME_BASE64:\n\t\t\t\t\t\t\t\tdecoded_text = php_base64_decode((unsigned char*)encoded_text, encoded_text_len);\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase PHP_ICONV_ENC_SCHEME_QPRINT:\n\t\t\t\t\t\t\t\tdecoded_text = php_quot_print_decode((unsigned char*)encoded_text, encoded_text_len, 1);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tdecoded_text = NULL;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (decoded_text == NULL) {\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, ZSTR_VAL(decoded_text), ZSTR_LEN(decoded_text), cd);\n\t\t\t\t\t\tzend_string_release(decoded_text);\n\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)(p1 - encoded_word), cd_pl);\n\t\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (eos) { /* reached end-of-string. done. */\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tswitch (*p1) {\n\t\t\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase ' ': case '\\t': /* medial whitespaces */\n\t\t\t\t\t\t\t\tspaces = p1;\n\t\t\t\t\t\t\t\tscan_stat = 11;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault: /* first letter of a non-encoded word */\n\t\t\t\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} break;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 10: /* expects a language specifier. dismiss it for now */\n\t\t\t\tif (*p1 == '?') {\n\t\t\t\t\tscan_stat = 3;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 11: /* expecting a chunk of whitespaces */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\tif (spaces != NULL && encoded_word == NULL) {\n\t\t\t\t\t\t\t_php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl);\n\t\t\t\t\t\t\tspaces = NULL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = p1;\n\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ' ': case '\\t':\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault: /* first letter of a non-encoded word */\n\t\t\t\t\t\tif (spaces != NULL) {\n\t\t\t\t\t\t\t_php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl);\n\t\t\t\t\t\t\tspaces = NULL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 12: /* expecting a non-encoded word */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ' ': case '\\t':\n\t\t\t\t\t\tspaces = p1;\n\t\t\t\t\t\tscan_stat = 11;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\tif (!(mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tencoded_word = p1;\n\t\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* break is omitted intentionally */\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tswitch (scan_stat) {\n\t\tcase 0: case 8: case 11: case 12:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\tif (scan_stat == 1) {\n\t\t\t\t\t_php_iconv_appendc(pretval, '=', cd_pl);\n\t\t\t\t}\n\t\t\t\terr = PHP_ICONV_ERR_SUCCESS;\n\t\t\t} else {\n\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\tgoto out;\n\t\t\t}\n\t}\n\n\tif (next_pos != NULL) {\n\t\t*next_pos = p1;\n\t}\n\n\tsmart_str_0(pretval);\nout:\n\tif (cd != (iconv_t)(-1)) {\n\t\ticonv_close(cd);\n\t}\n\tif (cd_pl != (iconv_t)(-1)) {\n\t\ticonv_close(cd_pl);\n\t}\n\treturn err;\n}",
  4813. "project": "php-src",
  4814. "hash": 252711754502941885197887607368897836371,
  4815. "size": 549,
  4816. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  4817. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  4818. "target": 1,
  4819. "dataset": "other",
  4820. "idx": 206554
  4821. },
  4822. {
  4823. "func": "static php_iconv_err_t _php_iconv_mime_decode(smart_str *pretval, const char *str, size_t str_nbytes, const char *enc, const char **next_pos, int mode)\n{\n\tphp_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;\n\n\ticonv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);\n\n\tconst char *p1;\n\tsize_t str_left;\n\tunsigned int scan_stat = 0;\n\tconst char *csname = NULL;\n\tsize_t csname_len;\n\tconst char *encoded_text = NULL;\n\tsize_t encoded_text_len = 0;\n\tconst char *encoded_word = NULL;\n\tconst char *spaces = NULL;\n\n\tphp_iconv_enc_scheme_t enc_scheme = PHP_ICONV_ENC_SCHEME_BASE64;\n\n\tif (next_pos != NULL) {\n\t\t*next_pos = NULL;\n\t}\n\n\tcd_pl = iconv_open(enc, ICONV_ASCII_ENCODING);\n\n\tif (cd_pl == (iconv_t)(-1)) {\n#if ICONV_SUPPORTS_ERRNO\n\t\tif (errno == EINVAL) {\n\t\t\terr = PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t} else {\n\t\t\terr = PHP_ICONV_ERR_CONVERTER;\n\t\t}\n#else\n\t\terr = PHP_ICONV_ERR_UNKNOWN;\n#endif\n\t\tgoto out;\n\t}\n\n\tp1 = str;\n\tfor (str_left = str_nbytes; str_left > 0; str_left--, p1++) {\n\t\tint eos = 0;\n\n\t\tswitch (scan_stat) {\n\t\t\tcase 0: /* expecting any character */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\tencoded_word = p1;\n\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ' ': case '\\t': /* a chunk of whitespaces */\n\t\t\t\t\t\tspaces = p1;\n\t\t\t\t\t\tscan_stat = 11;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault: /* first letter of a non-encoded word */\n\t\t\t\t\t\terr = _php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tif (mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR) {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_SUCCESS;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 1: /* expecting a delimiter */\n\t\t\t\tif (*p1 != '?') {\n\t\t\t\t\tif (*p1 == '\\r' || *p1 == '\\n') {\n\t\t\t\t\t\t--p1;\n\t\t\t\t\t}\n\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcsname = p1 + 1;\n\t\t\t\tscan_stat = 2;\n\t\t\t\tbreak;\n\n\t\t\tcase 2: /* expecting a charset name */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '?': /* normal delimiter: encoding scheme follows */\n\t\t\t\t\t\tscan_stat = 3;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '*': /* new style delimiter: locale id follows */\n\t\t\t\t\t\tscan_stat = 10;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\r': case '\\n': /* not an encoded-word */\n\t\t\t\t\t\t--p1;\n\t\t\t\t\t\t_php_iconv_appendc(pretval, '=', cd_pl);\n\t\t\t\t\t\t_php_iconv_appendc(pretval, '?', cd_pl);\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, csname, (size_t)((p1 + 1) - csname), cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcsname = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t}\n\t\t\t\t\t\telse {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tif (scan_stat != 2) {\n\t\t\t\t\tchar tmpbuf[80];\n\n\t\t\t\t\tif (csname == NULL) {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\n\t\t\t\t\tcsname_len = (size_t)(p1 - csname);\n\n\t\t\t\t\tif (csname_len > sizeof(tmpbuf) - 1) {\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tmemcpy(tmpbuf, csname, csname_len);\n\t\t\t\t\ttmpbuf[csname_len] = '\\0';\n\n\t\t\t\t\tif (cd != (iconv_t)(-1)) {\n\t\t\t\t\t\ticonv_close(cd);\n\t\t\t\t\t}\n\n\t\t\t\t\tcd = iconv_open(enc, tmpbuf);\n\n\t\t\t\t\tif (cd == (iconv_t)(-1)) {\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\t/* Bad character set, but the user wants us to\n\t\t\t\t\t\t\t * press on. In this case, we'll just insert the\n\t\t\t\t\t\t\t * undecoded encoded word, since there isn't really\n\t\t\t\t\t\t\t * a more sensible behaviour available; the only\n\t\t\t\t\t\t\t * other options are to swallow the encoded word\n\t\t\t\t\t\t\t * entirely or decode it with an arbitrarily chosen\n\t\t\t\t\t\t\t * single byte encoding, both of which seem to have\n\t\t\t\t\t\t\t * a higher WTF factor than leaving it undecoded.\n\t\t\t\t\t\t\t *\n\t\t\t\t\t\t\t * Given this approach, we need to skip ahead to\n\t\t\t\t\t\t\t * the end of the encoded word. */\n\t\t\t\t\t\t\tint qmarks = 2;\n\t\t\t\t\t\t\twhile (qmarks > 0 && str_left > 1) {\n\t\t\t\t\t\t\t\tif (*(++p1) == '?') {\n\t\t\t\t\t\t\t\t\t--qmarks;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t--str_left;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* Look ahead to check for the terminating = that\n\t\t\t\t\t\t\t * should be there as well; if it's there, we'll\n\t\t\t\t\t\t\t * also include that. If it's not, there isn't much\n\t\t\t\t\t\t\t * we can do at this point. */\n\t\t\t\t\t\t\tif (*(p1 + 1) == '=') {\n\t\t\t\t\t\t\t\t++p1;\n\t\t\t\t\t\t\t\tif (str_left > 1) {\n\t\t\t\t\t\t\t\t\t--str_left;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t/* Let's go back and see if there are further\n\t\t\t\t\t\t\t * encoded words or bare content, and hope they\n\t\t\t\t\t\t\t * might actually have a valid character set. */\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n#if ICONV_SUPPORTS_ERRNO\n\t\t\t\t\t\t\tif (errno == EINVAL) {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_CONVERTER;\n\t\t\t\t\t\t\t}\n#else\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n#endif\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 3: /* expecting a encoding scheme specifier */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase 'b':\n\t\t\t\t\tcase 'B':\n\t\t\t\t\t\tenc_scheme = PHP_ICONV_ENC_SCHEME_BASE64;\n\t\t\t\t\t\tscan_stat = 4;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase 'q':\n\t\t\t\t\tcase 'Q':\n\t\t\t\t\t\tenc_scheme = PHP_ICONV_ENC_SCHEME_QPRINT;\n\t\t\t\t\t\tscan_stat = 4;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 4: /* expecting a delimiter */\n\t\t\t\tif (*p1 != '?') {\n\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tencoded_text = p1 + 1;\n\t\t\t\tscan_stat = 5;\n\t\t\t\tbreak;\n\n\t\t\tcase 5: /* expecting an encoded portion */\n\t\t\t\tif (*p1 == '?') {\n\t\t\t\t\tencoded_text_len = (size_t)(p1 - encoded_text);\n\t\t\t\t\tscan_stat = 6;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 7: /* expecting a \"\\n\" character */\n\t\t\t\tif (*p1 == '\\n') {\n\t\t\t\t\tscan_stat = 8;\n\t\t\t\t} else {\n\t\t\t\t\t/* bare CR */\n\t\t\t\t\t_php_iconv_appendc(pretval, '\\r', cd_pl);\n\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\tscan_stat = 0;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 8: /* checking whether the following line is part of a\n\t\t\t\t\t folded header */\n\t\t\t\tif (*p1 != ' ' && *p1 != '\\t') {\n\t\t\t\t\t--p1;\n\t\t\t\t\tstr_left = 1; /* quit_loop */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (encoded_word == NULL) {\n\t\t\t\t\t_php_iconv_appendc(pretval, ' ', cd_pl);\n\t\t\t\t}\n\t\t\t\tspaces = NULL;\n\t\t\t\tscan_stat = 11;\n\t\t\t\tbreak;\n\n\t\t\tcase 6: /* expecting a End-Of-Chunk character \"=\" */\n\t\t\t\tif (*p1 != '=') {\n\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t} else {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tscan_stat = 9;\n\t\t\t\tif (str_left == 1) {\n\t\t\t\t\teos = 1;\n\t\t\t\t} else {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\tcase 9: /* choice point, seeing what to do next.*/\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t/* Handle non-RFC-compliant formats\n\t\t\t\t\t\t *\n\t\t\t\t\t\t * RFC2047 requires the character that comes right\n\t\t\t\t\t\t * after an encoded word (chunk) to be a whitespace,\n\t\t\t\t\t\t * while there are lots of broken implementations that\n\t\t\t\t\t\t * generate such malformed headers that don't fulfill\n\t\t\t\t\t\t * that requirement.\n\t\t\t\t\t\t */\n\t\t\t\t\t\tif (!eos) {\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* break is omitted intentionally */\n\n\t\t\t\t\tcase '\\r': case '\\n': case ' ': case '\\t': {\n\t\t\t\t\t\tzend_string *decoded_text;\n\n\t\t\t\t\t\tswitch (enc_scheme) {\n\t\t\t\t\t\t\tcase PHP_ICONV_ENC_SCHEME_BASE64:\n\t\t\t\t\t\t\t\tdecoded_text = php_base64_decode((unsigned char*)encoded_text, encoded_text_len);\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase PHP_ICONV_ENC_SCHEME_QPRINT:\n\t\t\t\t\t\t\t\tdecoded_text = php_quot_print_decode((unsigned char*)encoded_text, encoded_text_len, 1);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\tdecoded_text = NULL;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (decoded_text == NULL) {\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)((p1 + 1) - encoded_word), cd_pl);\n\t\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\terr = _php_iconv_appendl(pretval, ZSTR_VAL(decoded_text), ZSTR_LEN(decoded_text), cd);\n\t\t\t\t\t\tzend_string_release(decoded_text);\n\n\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\t\t\t\t\t/* pass the entire chunk through the converter */\n\t\t\t\t\t\t\t\terr = _php_iconv_appendl(pretval, encoded_word, (size_t)(p1 - encoded_word), cd_pl);\n\t\t\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\t\t\tif (err != PHP_ICONV_ERR_SUCCESS) {\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (eos) { /* reached end-of-string. done. */\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tswitch (*p1) {\n\t\t\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tcase ' ': case '\\t': /* medial whitespaces */\n\t\t\t\t\t\t\t\tspaces = p1;\n\t\t\t\t\t\t\t\tscan_stat = 11;\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault: /* first letter of a non-encoded word */\n\t\t\t\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t} break;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 10: /* expects a language specifier. dismiss it for now */\n\t\t\t\tif (*p1 == '?') {\n\t\t\t\t\tscan_stat = 3;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 11: /* expecting a chunk of whitespaces */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\tif (spaces != NULL && encoded_word == NULL) {\n\t\t\t\t\t\t\t_php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl);\n\t\t\t\t\t\t\tspaces = NULL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tencoded_word = p1;\n\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ' ': case '\\t':\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tdefault: /* first letter of a non-encoded word */\n\t\t\t\t\t\tif (spaces != NULL) {\n\t\t\t\t\t\t\t_php_iconv_appendl(pretval, spaces, (size_t)(p1 - spaces), cd_pl);\n\t\t\t\t\t\t\tspaces = NULL;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\tencoded_word = NULL;\n\t\t\t\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tscan_stat = 12;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tscan_stat = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase 12: /* expecting a non-encoded word */\n\t\t\t\tswitch (*p1) {\n\t\t\t\t\tcase '\\r': /* part of an EOL sequence? */\n\t\t\t\t\t\tscan_stat = 7;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\t\tscan_stat = 8;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase ' ': case '\\t':\n\t\t\t\t\t\tspaces = p1;\n\t\t\t\t\t\tscan_stat = 11;\n\t\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '=': /* first letter of an encoded chunk */\n\t\t\t\t\t\tif (!(mode & PHP_ICONV_MIME_DECODE_STRICT)) {\n\t\t\t\t\t\t\tencoded_word = p1;\n\t\t\t\t\t\t\tscan_stat = 1;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* break is omitted intentionally */\n\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t_php_iconv_appendc(pretval, *p1, cd_pl);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n\tswitch (scan_stat) {\n\t\tcase 0: case 8: case 11: case 12:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tif ((mode & PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR)) {\n\t\t\t\tif (scan_stat == 1) {\n\t\t\t\t\t_php_iconv_appendc(pretval, '=', cd_pl);\n\t\t\t\t}\n\t\t\t\terr = PHP_ICONV_ERR_SUCCESS;\n\t\t\t} else {\n\t\t\t\terr = PHP_ICONV_ERR_MALFORMED;\n\t\t\t\tgoto out;\n\t\t\t}\n\t}\n\n\tif (next_pos != NULL) {\n\t\t*next_pos = p1;\n\t}\n\n\tsmart_str_0(pretval);\nout:\n\tif (cd != (iconv_t)(-1)) {\n\t\ticonv_close(cd);\n\t}\n\tif (cd_pl != (iconv_t)(-1)) {\n\t\ticonv_close(cd_pl);\n\t}\n\treturn err;\n}",
  4824. "project": "php-src",
  4825. "hash": 218325121010366491134849590402382438328,
  4826. "size": 551,
  4827. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  4828. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  4829. "target": 0,
  4830. "dataset": "other",
  4831. "idx": 382780
  4832. },
  4833. {
  4834. "func": "static int php_iconv_output_handler(void **nothing, php_output_context *output_context)\n{\n\tchar *s, *content_type, *mimetype = NULL;\n\tint output_status, mimetype_len = 0;\n\n\tif (output_context->op & PHP_OUTPUT_HANDLER_START) {\n\t\toutput_status = php_output_get_status();\n\t\tif (output_status & PHP_OUTPUT_SENT) {\n\t\t\treturn FAILURE;\n\t\t}\n\n\t\tif (SG(sapi_headers).mimetype && !strncasecmp(SG(sapi_headers).mimetype, \"text/\", 5)) {\n\t\t\tif ((s = strchr(SG(sapi_headers).mimetype,';')) == NULL){\n\t\t\t\tmimetype = SG(sapi_headers).mimetype;\n\t\t\t} else {\n\t\t\t\tmimetype = SG(sapi_headers).mimetype;\n\t\t\t\tmimetype_len = (int)(s - SG(sapi_headers).mimetype);\n\t\t\t}\n\t\t} else if (SG(sapi_headers).send_default_content_type) {\n\t\t\tmimetype = SG(default_mimetype) ? SG(default_mimetype) : SAPI_DEFAULT_MIMETYPE;\n\t\t}\n\n\t\tif (mimetype != NULL && !(output_context->op & PHP_OUTPUT_HANDLER_CLEAN)) {\n\t\t\tsize_t len;\n\t\t\tchar *p = strstr(get_output_encoding(), \"//\");\n\n\t\t\tif (p) {\n\t\t\t\tlen = spprintf(&content_type, 0, \"Content-Type:%.*s; charset=%.*s\", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int) (p - get_output_encoding()), get_output_encoding());\n\t\t\t} else {\n\t\t\t\tlen = spprintf(&content_type, 0, \"Content-Type:%.*s; charset=%s\", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, get_output_encoding());\n\t\t\t}\n\t\t\tif (content_type && SUCCESS == sapi_add_header(content_type, (uint)len, 0)) {\n\t\t\t\tSG(sapi_headers).send_default_content_type = 0;\n\t\t\t\tphp_output_handler_hook(PHP_OUTPUT_HANDLER_HOOK_IMMUTABLE, NULL);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (output_context->in.used) {\n\t\tzend_string *out;\n\t\toutput_context->out.free = 1;\n\t\t_php_iconv_show_error(php_iconv_string(output_context->in.data, output_context->in.used, &out, get_output_encoding(), get_internal_encoding()), get_output_encoding(), get_internal_encoding());\n\t\tif (out) {\n\t\t\toutput_context->out.data = estrndup(ZSTR_VAL(out), ZSTR_LEN(out));\n\t\t\toutput_context->out.used = ZSTR_LEN(out);\n\t\t\tzend_string_free(out);\n\t\t} else {\n\t\t\toutput_context->out.data = NULL;\n\t\t\toutput_context->out.used = 0;\n\t\t}\n\t}\n\n\treturn SUCCESS;\n}",
  4835. "project": "php-src",
  4836. "hash": 116875874944930120587567879165216714373,
  4837. "size": 54,
  4838. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  4839. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  4840. "target": 0,
  4841. "dataset": "other",
  4842. "idx": 382781
  4843. },
  4844. {
  4845. "func": "static php_iconv_err_t _php_iconv_mime_encode(smart_str *pretval, const char *fname, size_t fname_nbytes, const char *fval, size_t fval_nbytes, size_t max_line_len, const char *lfchars, php_iconv_enc_scheme_t enc_scheme, const char *out_charset, const char *enc)\n{\n\tphp_iconv_err_t err = PHP_ICONV_ERR_SUCCESS;\n\ticonv_t cd = (iconv_t)(-1), cd_pl = (iconv_t)(-1);\n\tsize_t char_cnt = 0;\n\tsize_t out_charset_len;\n\tsize_t lfchars_len;\n\tchar *buf = NULL;\n\tconst char *in_p;\n\tsize_t in_left;\n\tchar *out_p;\n\tsize_t out_left;\n\tzend_string *encoded = NULL;\n\tstatic int qp_table[256] = {\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x00 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x10 */\n\t\t3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x20 */\n\t\t1, 1, 1, 1, 1, 1, 1 ,1, 1, 1, 1, 1, 1, 3, 1, 3, /* 0x30 */\n\t\t1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x40 */\n\t\t1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, /* 0x50 */\n\t\t1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* 0x60 */\n\t\t1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 3, /* 0x70 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x80 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0x90 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xA0 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xB0 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xC0 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xD0 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, /* 0xE0 */\n\t\t3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3 /* 0xF0 */\n\t};\n\n\tout_charset_len = strlen(out_charset);\n\tlfchars_len = strlen(lfchars);\n\n\tif ((fname_nbytes + 2) >= max_line_len\n\t\t|| (out_charset_len + 12) >= max_line_len) {\n\t\t/* field name is too long */\n\t\terr = PHP_ICONV_ERR_TOO_BIG;\n\t\tgoto out;\n\t}\n\n\tcd_pl = iconv_open(ICONV_ASCII_ENCODING, enc);\n\tif (cd_pl == (iconv_t)(-1)) {\n#if ICONV_SUPPORTS_ERRNO\n\t\tif (errno == EINVAL) {\n\t\t\terr = PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t} else {\n\t\t\terr = PHP_ICONV_ERR_CONVERTER;\n\t\t}\n#else\n\t\terr = PHP_ICONV_ERR_UNKNOWN;\n#endif\n\t\tgoto out;\n\t}\n\n\tcd = iconv_open(out_charset, enc);\n\tif (cd == (iconv_t)(-1)) {\n#if ICONV_SUPPORTS_ERRNO\n\t\tif (errno == EINVAL) {\n\t\t\terr = PHP_ICONV_ERR_WRONG_CHARSET;\n\t\t} else {\n\t\t\terr = PHP_ICONV_ERR_CONVERTER;\n\t\t}\n#else\n\t\terr = PHP_ICONV_ERR_UNKNOWN;\n#endif\n\t\tgoto out;\n\t}\n\n\tbuf = safe_emalloc(1, max_line_len, 5);\n\n\tchar_cnt = max_line_len;\n\n\t_php_iconv_appendl(pretval, fname, fname_nbytes, cd_pl);\n\tchar_cnt -= fname_nbytes;\n\tsmart_str_appendl(pretval, \": \", sizeof(\": \") - 1);\n\tchar_cnt -= 2;\n\n\tin_p = fval;\n\tin_left = fval_nbytes;\n\n\tdo {\n\t\tsize_t prev_in_left;\n\t\tsize_t out_size;\n\n\t\tif (char_cnt < (out_charset_len + 12)) {\n\t\t\t/* lfchars must be encoded in ASCII here*/\n\t\t\tsmart_str_appendl(pretval, lfchars, lfchars_len);\n\t\t\tsmart_str_appendc(pretval, ' ');\n\t\t\tchar_cnt = max_line_len - 1;\n\t\t}\n\n\t\tsmart_str_appendl(pretval, \"=?\", sizeof(\"=?\") - 1);\n\t\tchar_cnt -= 2;\n\t\tsmart_str_appendl(pretval, out_charset, out_charset_len);\n\t\tchar_cnt -= out_charset_len;\n\t\tsmart_str_appendc(pretval, '?');\n\t\tchar_cnt --;\n\n\t\tswitch (enc_scheme) {\n\t\t\tcase PHP_ICONV_ENC_SCHEME_BASE64: {\n\t\t\t\tsize_t ini_in_left;\n\t\t\t\tconst char *ini_in_p;\n\t\t\t\tsize_t out_reserved = 4;\n\n\t\t\t\tsmart_str_appendc(pretval, 'B');\n\t\t\t\tchar_cnt--;\n\t\t\t\tsmart_str_appendc(pretval, '?');\n\t\t\t\tchar_cnt--;\n\n\t\t\t\tprev_in_left = ini_in_left = in_left;\n\t\t\t\tini_in_p = in_p;\n\n\t\t\t\tout_size = (char_cnt - 2) / 4 * 3;\n\n\t\t\t\tfor (;;) {\n\t\t\t\t\tout_p = buf;\n\n\t\t\t\t\tif (out_size <= out_reserved) {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_TOO_BIG;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\n\t\t\t\t\tout_left = out_size - out_reserved;\n\n\t\t\t\t\tif (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {\n#if ICONV_SUPPORTS_ERRNO\n\t\t\t\t\t\tswitch (errno) {\n\t\t\t\t\t\t\tcase EINVAL:\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_ILLEGAL_CHAR;\n\t\t\t\t\t\t\t\tgoto out;\n\n\t\t\t\t\t\t\tcase EILSEQ:\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_ILLEGAL_SEQ;\n\t\t\t\t\t\t\t\tgoto out;\n\n\t\t\t\t\t\t\tcase E2BIG:\n\t\t\t\t\t\t\t\tif (prev_in_left == in_left) {\n\t\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_TOO_BIG;\n\t\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#else\n\t\t\t\t\t\tif (prev_in_left == in_left) {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#endif\n\t\t\t\t\t}\n\n\t\t\t\t\tout_left += out_reserved;\n\n\t\t\t\t\tif (iconv(cd, NULL, NULL, (char **) &out_p, &out_left) == (size_t)-1) {\n#if ICONV_SUPPORTS_ERRNO\n\t\t\t\t\t\tif (errno != E2BIG) {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#else\n\t\t\t\t\t\tif (out_left != 0) {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#endif\n\t\t\t\t\t} else {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (iconv(cd, NULL, NULL, NULL, NULL) == (size_t)-1) {\n\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\tgoto out;\n\t\t\t\t\t}\n\n\t\t\t\t\tout_reserved += 4;\n\t\t\t\t\tin_left = ini_in_left;\n\t\t\t\t\tin_p = ini_in_p;\n\t\t\t\t}\n\n\t\t\t\tprev_in_left = in_left;\n\n\t\t\t\tencoded = php_base64_encode((unsigned char *) buf, (out_size - out_left));\n\n\t\t\t\tif (char_cnt < ZSTR_LEN(encoded)) {\n\t\t\t\t\t/* something went wrong! */\n\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\tgoto out;\n\t\t\t\t}\n\n\t\t\t\tsmart_str_appendl(pretval, ZSTR_VAL(encoded), ZSTR_LEN(encoded));\n\t\t\t\tchar_cnt -= ZSTR_LEN(encoded);\n\t\t\t\tsmart_str_appendl(pretval, \"?=\", sizeof(\"?=\") - 1);\n\t\t\t\tchar_cnt -= 2;\n\n\t\t\t\tzend_string_release(encoded);\n\t\t\t\tencoded = NULL;\n\t\t\t} break; /* case PHP_ICONV_ENC_SCHEME_BASE64: */\n\n\t\t\tcase PHP_ICONV_ENC_SCHEME_QPRINT: {\n\t\t\t\tsize_t ini_in_left;\n\t\t\t\tconst char *ini_in_p;\n\t\t\t\tconst unsigned char *p;\n\t\t\t\tsize_t nbytes_required;\n\n\t\t\t\tsmart_str_appendc(pretval, 'Q');\n\t\t\t\tchar_cnt--;\n\t\t\t\tsmart_str_appendc(pretval, '?');\n\t\t\t\tchar_cnt--;\n\n\t\t\t\tprev_in_left = ini_in_left = in_left;\n\t\t\t\tini_in_p = in_p;\n\n\t\t\t\tfor (out_size = (char_cnt - 2); out_size > 0;) {\n#if !ICONV_SUPPORTS_ERRNO\n\t\t\t\t\tsize_t prev_out_left;\n#endif\n\n\t\t\t\t\tnbytes_required = 0;\n\n\t\t\t\t\tout_p = buf;\n\t\t\t\t\tout_left = out_size;\n\n\t\t\t\t\tif (iconv(cd, (char **)&in_p, &in_left, (char **) &out_p, &out_left) == (size_t)-1) {\n#if ICONV_SUPPORTS_ERRNO\n\t\t\t\t\t\tswitch (errno) {\n\t\t\t\t\t\t\tcase EINVAL:\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_ILLEGAL_CHAR;\n\t\t\t\t\t\t\t\tgoto out;\n\n\t\t\t\t\t\t\tcase EILSEQ:\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_ILLEGAL_SEQ;\n\t\t\t\t\t\t\t\tgoto out;\n\n\t\t\t\t\t\t\tcase E2BIG:\n\t\t\t\t\t\t\t\tif (prev_in_left == in_left) {\n\t\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\n\t\t\t\t\t\t\tdefault:\n\t\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#else\n\t\t\t\t\t\tif (prev_in_left == in_left) {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#endif\n\t\t\t\t\t}\n#if !ICONV_SUPPORTS_ERRNO\n\t\t\t\t\tprev_out_left = out_left;\n#endif\n\t\t\t\t\tif (iconv(cd, NULL, NULL, (char **) &out_p, &out_left) == (size_t)-1) {\n#if ICONV_SUPPORTS_ERRNO\n\t\t\t\t\t\tif (errno != E2BIG) {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#else\n\t\t\t\t\t\tif (out_left == prev_out_left) {\n\t\t\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\t\t\tgoto out;\n\t\t\t\t\t\t}\n#endif\n\t\t\t\t\t}\n\n\t\t\t\t\tfor (p = (unsigned char *)buf; p < (unsigned char *)out_p; p++) {\n\t\t\t\t\t\tnbytes_required += qp_table[*p];\n\t\t\t\t\t}\n\n\t\t\t\t\tif (nbytes_required <= char_cnt - 2) {\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tout_size -= ((nbytes_required - (char_cnt - 2)) + 2) / 3;\n\t\t\t\t\tin_left = ini_in_left;\n\t\t\t\t\tin_p = ini_in_p;\n\t\t\t\t}\n\n\t\t\t\tfor (p = (unsigned char *)buf; p < (unsigned char *)out_p; p++) {\n\t\t\t\t\tif (qp_table[*p] == 1) {\n\t\t\t\t\t\tsmart_str_appendc(pretval, *(char *)p);\n\t\t\t\t\t\tchar_cnt--;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tstatic char qp_digits[] = \"0123456789ABCDEF\";\n\t\t\t\t\t\tsmart_str_appendc(pretval, '=');\n\t\t\t\t\t\tsmart_str_appendc(pretval, qp_digits[(*p >> 4) & 0x0f]);\n\t\t\t\t\t\tsmart_str_appendc(pretval, qp_digits[(*p & 0x0f)]);\n\t\t\t\t\t\tchar_cnt -= 3;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsmart_str_appendl(pretval, \"?=\", sizeof(\"?=\") - 1);\n\t\t\t\tchar_cnt -= 2;\n\n\t\t\t\tif (iconv(cd, NULL, NULL, NULL, NULL) == (size_t)-1) {\n\t\t\t\t\terr = PHP_ICONV_ERR_UNKNOWN;\n\t\t\t\t\tgoto out;\n\t\t\t\t}\n\n\t\t\t} break; /* case PHP_ICONV_ENC_SCHEME_QPRINT: */\n\t\t}\n\t} while (in_left > 0);\n\n\tsmart_str_0(pretval);\n\nout:\n\tif (cd != (iconv_t)(-1)) {\n\t\ticonv_close(cd);\n\t}\n\tif (cd_pl != (iconv_t)(-1)) {\n\t\ticonv_close(cd_pl);\n\t}\n\tif (encoded != NULL) {\n\t\tzend_string_release(encoded);\n\t}\n\tif (buf != NULL) {\n\t\tefree(buf);\n\t}\n\treturn err;\n}",
  4846. "project": "php-src",
  4847. "hash": 5466635189365711181839801820217943190,
  4848. "size": 328,
  4849. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  4850. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  4851. "target": 0,
  4852. "dataset": "other",
  4853. "idx": 382776
  4854. }
  4855. ]
  4856. },
  4857. {
  4858. "call_depth": 3,
  4859. "longest_call_chain": [
  4860. "vt_compat_ioctl",
  4861. "vt_ioctl",
  4862. "vc_allocate"
  4863. ],
  4864. "group_size": 9,
  4865. "functions": [
  4866. {
  4867. "func": "static int vt_disallocate(unsigned int vc_num)\n{\n\tstruct vc_data *vc = NULL;\n\tint ret = 0;\n\n\tconsole_lock();\n\tif (vt_busy(vc_num))\n\t\tret = -EBUSY;\n\telse if (vc_num)\n\t\tvc = vc_deallocate(vc_num);\n\tconsole_unlock();\n\n\tif (vc && vc_num >= MIN_NR_CONSOLES) {\n\t\ttty_port_destroy(&vc->port);\n\t\tkfree(vc);\n\t}\n\n\treturn ret;\n}",
  4868. "project": "linux",
  4869. "hash": 38463244511772680877703611945714587348,
  4870. "size": 19,
  4871. "commit_id": "ca4463bf8438b403596edd0ec961ca0d4fbe0220",
  4872. "message": "vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console\n\nThe VT_DISALLOCATE ioctl can free a virtual console while tty_release()\nis still running, causing a use-after-free in con_shutdown(). This\noccurs because VT_DISALLOCATE considers a virtual console's\n'struct vc_data' to be unused as soon as the corresponding tty's\nrefcount hits 0. But actually it may be still being closed.\n\nFix this by making vc_data be reference-counted via the embedded\n'struct tty_port'. A newly allocated virtual console has refcount 1.\nOpening it for the first time increments the refcount to 2. Closing it\nfor the last time decrements the refcount (in tty_operations::cleanup()\nso that it happens late enough), as does VT_DISALLOCATE.\n\nReproducer:\n\t#include <fcntl.h>\n\t#include <linux/vt.h>\n\t#include <sys/ioctl.h>\n\t#include <unistd.h>\n\n\tint main()\n\t{\n\t\tif (fork()) {\n\t\t\tfor (;;)\n\t\t\t\tclose(open(\"/dev/tty5\", O_RDWR));\n\t\t} else {\n\t\t\tint fd = open(\"/dev/tty10\", O_RDWR);\n\n\t\t\tfor (;;)\n\t\t\t\tioctl(fd, VT_DISALLOCATE, 5);\n\t\t}\n\t}\n\nKASAN report:\n\tBUG: KASAN: use-after-free in con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3278\n\tWrite of size 8 at addr ffff88806a4ec108 by task syz_vt/129\n\n\tCPU: 0 PID: 129 Comm: syz_vt Not tainted 5.6.0-rc2 #11\n\tHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20191223_100556-anatol 04/01/2014\n\tCall Trace:\n\t [...]\n\t con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3278\n\t release_tty+0xa8/0x410 drivers/tty/tty_io.c:1514\n\t tty_release_struct+0x34/0x50 drivers/tty/tty_io.c:1629\n\t tty_release+0x984/0xed0 drivers/tty/tty_io.c:1789\n\t [...]\n\n\tAllocated by task 129:\n\t [...]\n\t kzalloc include/linux/slab.h:669 [inline]\n\t vc_allocate drivers/tty/vt/vt.c:1085 [inline]\n\t vc_allocate+0x1ac/0x680 drivers/tty/vt/vt.c:1066\n\t con_install+0x4d/0x3f0 drivers/tty/vt/vt.c:3229\n\t tty_driver_install_tty drivers/tty/tty_io.c:1228 [inline]\n\t tty_init_dev+0x94/0x350 drivers/tty/tty_io.c:1341\n\t tty_open_by_driver drivers/tty/tty_io.c:1987 [inline]\n\t tty_open+0x3ca/0xb30 drivers/tty/tty_io.c:2035\n\t [...]\n\n\tFreed by task 130:\n\t [...]\n\t kfree+0xbf/0x1e0 mm/slab.c:3757\n\t vt_disallocate drivers/tty/vt/vt_ioctl.c:300 [inline]\n\t vt_ioctl+0x16dc/0x1e30 drivers/tty/vt/vt_ioctl.c:818\n\t tty_ioctl+0x9db/0x11b0 drivers/tty/tty_io.c:2660\n\t [...]\n\nFixes: 4001d7b7fc27 (\"vt: push down the tty lock so we can see what is left to tackle\")\nCc: <stable@vger.kernel.org> # v3.4+\nReported-by: syzbot+522643ab5729b0421998@syzkaller.appspotmail.com\nAcked-by: Jiri Slaby <jslaby@suse.cz>\nSigned-off-by: Eric Biggers <ebiggers@google.com>\nLink: https://lore.kernel.org/r/20200322034305.210082-2-ebiggers@kernel.org\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4873. "target": 1,
  4874. "dataset": "other",
  4875. "idx": 210536
  4876. },
  4877. {
  4878. "func": "static int vt_disallocate(unsigned int vc_num)\n{\n\tstruct vc_data *vc = NULL;\n\tint ret = 0;\n\n\tconsole_lock();\n\tif (VT_BUSY(vc_num))\n\t\tret = -EBUSY;\n\telse if (vc_num)\n\t\tvc = vc_deallocate(vc_num);\n\tconsole_unlock();\n\n\tif (vc && vc_num >= MIN_NR_CONSOLES) {\n\t\ttty_port_destroy(&vc->port);\n\t\tkfree(vc);\n\t}\n\n\treturn ret;\n}",
  4879. "project": "linux",
  4880. "hash": 80872964397264373033833941297370957398,
  4881. "size": 19,
  4882. "commit_id": "6cd1ed50efd88261298577cd92a14f2768eddeeb",
  4883. "message": "vt: vt_ioctl: fix race in VT_RESIZEX\n\nWe need to make sure vc_cons[i].d is not NULL after grabbing\nconsole_lock(), or risk a crash.\n\ngeneral protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN\nKASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]\nCPU: 1 PID: 19462 Comm: syz-executor.5 Not tainted 5.5.0-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n tty_ioctl+0xa37/0x14f0 drivers/tty/tty_io.c:2660\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0x123/0x180 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x45b399\nCode: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007f7d13c11c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 00007f7d13c126d4 RCX: 000000000045b399\nRDX: 0000000020000080 RSI: 000000000000560a RDI: 0000000000000003\nRBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff\nR13: 0000000000000666 R14: 00000000004c7f04 R15: 000000000075bf2c\nModules linked in:\n---[ end trace 80970faf7a67eb77 ]---\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\n\nFixes: 1da177e4c3f4 (\"Linux-2.6.12-rc2\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: stable <stable@vger.kernel.org>\nReported-by: syzbot <syzkaller@googlegroups.com>\nLink: https://lore.kernel.org/r/20200210190721.200418-1-edumazet@google.com\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4884. "target": 0,
  4885. "dataset": "other",
  4886. "idx": 458190
  4887. },
  4888. {
  4889. "func": "int vt_do_kdgkb_ioctl(int cmd, struct kbsentry __user *user_kdgkb, int perm)\n{\n\tstruct kbsentry *kbs;\n\tchar *p;\n\tu_char *q;\n\tu_char __user *up;\n\tint sz, fnw_sz;\n\tint delta;\n\tchar *first_free, *fj, *fnw;\n\tint i, j, k;\n\tint ret;\n\tunsigned long flags;\n\n\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\tperm = 0;\n\n\tkbs = kmalloc(sizeof(*kbs), GFP_KERNEL);\n\tif (!kbs) {\n\t\tret = -ENOMEM;\n\t\tgoto reterr;\n\t}\n\n\t/* we mostly copy too much here (512bytes), but who cares ;) */\n\tif (copy_from_user(kbs, user_kdgkb, sizeof(struct kbsentry))) {\n\t\tret = -EFAULT;\n\t\tgoto reterr;\n\t}\n\tkbs->kb_string[sizeof(kbs->kb_string)-1] = '\\0';\n\ti = array_index_nospec(kbs->kb_func, MAX_NR_FUNC);\n\n\tswitch (cmd) {\n\tcase KDGKBSENT:\n\t\tsz = sizeof(kbs->kb_string) - 1; /* sz should have been\n\t\t\t\t\t\t a struct member */\n\t\tup = user_kdgkb->kb_string;\n\t\tp = func_table[i];\n\t\tif(p)\n\t\t\tfor ( ; *p && sz; p++, sz--)\n\t\t\t\tif (put_user(*p, up++)) {\n\t\t\t\t\tret = -EFAULT;\n\t\t\t\t\tgoto reterr;\n\t\t\t\t}\n\t\tif (put_user('\\0', up)) {\n\t\t\tret = -EFAULT;\n\t\t\tgoto reterr;\n\t\t}\n\t\tkfree(kbs);\n\t\treturn ((p && *p) ? -EOVERFLOW : 0);\n\tcase KDSKBSENT:\n\t\tif (!perm) {\n\t\t\tret = -EPERM;\n\t\t\tgoto reterr;\n\t\t}\n\n\t\tfnw = NULL;\n\t\tfnw_sz = 0;\n\t\t/* race aginst other writers */\n\t\tagain:\n\t\tspin_lock_irqsave(&func_buf_lock, flags);\n\t\tq = func_table[i];\n\n\t\t/* fj pointer to next entry after 'q' */\n\t\tfirst_free = funcbufptr + (funcbufsize - funcbufleft);\n\t\tfor (j = i+1; j < MAX_NR_FUNC && !func_table[j]; j++)\n\t\t\t;\n\t\tif (j < MAX_NR_FUNC)\n\t\t\tfj = func_table[j];\n\t\telse\n\t\t\tfj = first_free;\n\t\t/* buffer usage increase by new entry */\n\t\tdelta = (q ? -strlen(q) : 1) + strlen(kbs->kb_string);\n\n\t\tif (delta <= funcbufleft) { \t/* it fits in current buf */\n\t\t if (j < MAX_NR_FUNC) {\n\t\t\t/* make enough space for new entry at 'fj' */\n\t\t\tmemmove(fj + delta, fj, first_free - fj);\n\t\t\tfor (k = j; k < MAX_NR_FUNC; k++)\n\t\t\t if (func_table[k])\n\t\t\t\tfunc_table[k] += delta;\n\t\t }\n\t\t if (!q)\n\t\t func_table[i] = fj;\n\t\t funcbufleft -= delta;\n\t\t} else {\t\t\t/* allocate a larger buffer */\n\t\t sz = 256;\n\t\t while (sz < funcbufsize - funcbufleft + delta)\n\t\t sz <<= 1;\n\t\t if (fnw_sz != sz) {\n\t\t spin_unlock_irqrestore(&func_buf_lock, flags);\n\t\t kfree(fnw);\n\t\t fnw = kmalloc(sz, GFP_KERNEL);\n\t\t fnw_sz = sz;\n\t\t if (!fnw) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto reterr;\n\t\t }\n\t\t goto again;\n\t\t }\n\n\t\t if (!q)\n\t\t func_table[i] = fj;\n\t\t /* copy data before insertion point to new location */\n\t\t if (fj > funcbufptr)\n\t\t\tmemmove(fnw, funcbufptr, fj - funcbufptr);\n\t\t for (k = 0; k < j; k++)\n\t\t if (func_table[k])\n\t\t\tfunc_table[k] = fnw + (func_table[k] - funcbufptr);\n\n\t\t /* copy data after insertion point to new location */\n\t\t if (first_free > fj) {\n\t\t\tmemmove(fnw + (fj - funcbufptr) + delta, fj, first_free - fj);\n\t\t\tfor (k = j; k < MAX_NR_FUNC; k++)\n\t\t\t if (func_table[k])\n\t\t\t func_table[k] = fnw + (func_table[k] - funcbufptr) + delta;\n\t\t }\n\t\t if (funcbufptr != func_buf)\n\t\t kfree(funcbufptr);\n\t\t funcbufptr = fnw;\n\t\t funcbufleft = funcbufleft - delta + sz - funcbufsize;\n\t\t funcbufsize = sz;\n\t\t}\n\t\t/* finally insert item itself */\n\t\tstrcpy(func_table[i], kbs->kb_string);\n\t\tspin_unlock_irqrestore(&func_buf_lock, flags);\n\t\tbreak;\n\t}\n\tret = 0;\nreterr:\n\tkfree(kbs);\n\treturn ret;\n}",
  4890. "project": "linux",
  4891. "hash": 264180744402252921977442661589697361235,
  4892. "size": 131,
  4893. "commit_id": "6ca03f90527e499dd5e32d6522909e2ad390896b",
  4894. "message": "vt: keyboard, simplify vt_kdgkbsent\n\nUse 'strlen' of the string, add one for NUL terminator and simply do\n'copy_to_user' instead of the explicit 'for' loop. This makes the\nKDGKBSENT case more compact.\n\nThe only thing we need to take care about is NULL 'func_table[i]'. Use\nan empty string in that case.\n\nThe original check for overflow could never trigger as the func_buf\nstrings are always shorter or equal to 'struct kbsentry's.\n\nCc: <stable@vger.kernel.org>\nSigned-off-by: Jiri Slaby <jslaby@suse.cz>\nLink: https://lore.kernel.org/r/20201019085517.10176-1-jslaby@suse.cz\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4895. "target": 1,
  4896. "dataset": "other",
  4897. "idx": 212910
  4898. },
  4899. {
  4900. "func": "int vc_allocate(unsigned int currcons)\t/* return 0 on success */\n{\n\tstruct vt_notifier_param param;\n\tstruct vc_data *vc;\n\n\tWARN_CONSOLE_UNLOCKED();\n\n\tif (currcons >= MAX_NR_CONSOLES)\n\t\treturn -ENXIO;\n\n\tif (vc_cons[currcons].d)\n\t\treturn 0;\n\n\t/* due to the granularity of kmalloc, we waste some memory here */\n\t/* the alloc is done in two steps, to optimize the common situation\n\t of a 25x80 console (structsize=216, screenbuf_size=4000) */\n\t/* although the numbers above are not valid since long ago, the\n\t point is still up-to-date and the comment still has its value\n\t even if only as a historical artifact. --mj, July 1998 */\n\tparam.vc = vc = kzalloc(sizeof(struct vc_data), GFP_KERNEL);\n\tif (!vc)\n\t\treturn -ENOMEM;\n\n\tvc_cons[currcons].d = vc;\n\ttty_port_init(&vc->port);\n\tvc->port.ops = &vc_port_ops;\n\tINIT_WORK(&vc_cons[currcons].SAK_work, vc_SAK);\n\n\tvisual_init(vc, currcons, 1);\n\n\tif (!*vc->vc_uni_pagedir_loc)\n\t\tcon_set_default_unimap(vc);\n\n\tvc->vc_screenbuf = kzalloc(vc->vc_screenbuf_size, GFP_KERNEL);\n\tif (!vc->vc_screenbuf)\n\t\tgoto err_free;\n\n\t/* If no drivers have overridden us and the user didn't pass a\n\t boot option, default to displaying the cursor */\n\tif (global_cursor_default == -1)\n\t\tglobal_cursor_default = 1;\n\n\tvc_init(vc, vc->vc_rows, vc->vc_cols, 1);\n\tvcs_make_sysfs(currcons);\n\tatomic_notifier_call_chain(&vt_notifier_list, VT_ALLOCATE, &param);\n\n\treturn 0;\nerr_free:\n\tvisual_deinit(vc);\n\tkfree(vc);\n\tvc_cons[currcons].d = NULL;\n\treturn -ENOMEM;\n}",
  4901. "project": "linux",
  4902. "hash": 117512636323690110067298175533028534015,
  4903. "size": 53,
  4904. "commit_id": "ca4463bf8438b403596edd0ec961ca0d4fbe0220",
  4905. "message": "vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console\n\nThe VT_DISALLOCATE ioctl can free a virtual console while tty_release()\nis still running, causing a use-after-free in con_shutdown(). This\noccurs because VT_DISALLOCATE considers a virtual console's\n'struct vc_data' to be unused as soon as the corresponding tty's\nrefcount hits 0. But actually it may be still being closed.\n\nFix this by making vc_data be reference-counted via the embedded\n'struct tty_port'. A newly allocated virtual console has refcount 1.\nOpening it for the first time increments the refcount to 2. Closing it\nfor the last time decrements the refcount (in tty_operations::cleanup()\nso that it happens late enough), as does VT_DISALLOCATE.\n\nReproducer:\n\t#include <fcntl.h>\n\t#include <linux/vt.h>\n\t#include <sys/ioctl.h>\n\t#include <unistd.h>\n\n\tint main()\n\t{\n\t\tif (fork()) {\n\t\t\tfor (;;)\n\t\t\t\tclose(open(\"/dev/tty5\", O_RDWR));\n\t\t} else {\n\t\t\tint fd = open(\"/dev/tty10\", O_RDWR);\n\n\t\t\tfor (;;)\n\t\t\t\tioctl(fd, VT_DISALLOCATE, 5);\n\t\t}\n\t}\n\nKASAN report:\n\tBUG: KASAN: use-after-free in con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3278\n\tWrite of size 8 at addr ffff88806a4ec108 by task syz_vt/129\n\n\tCPU: 0 PID: 129 Comm: syz_vt Not tainted 5.6.0-rc2 #11\n\tHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20191223_100556-anatol 04/01/2014\n\tCall Trace:\n\t [...]\n\t con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3278\n\t release_tty+0xa8/0x410 drivers/tty/tty_io.c:1514\n\t tty_release_struct+0x34/0x50 drivers/tty/tty_io.c:1629\n\t tty_release+0x984/0xed0 drivers/tty/tty_io.c:1789\n\t [...]\n\n\tAllocated by task 129:\n\t [...]\n\t kzalloc include/linux/slab.h:669 [inline]\n\t vc_allocate drivers/tty/vt/vt.c:1085 [inline]\n\t vc_allocate+0x1ac/0x680 drivers/tty/vt/vt.c:1066\n\t con_install+0x4d/0x3f0 drivers/tty/vt/vt.c:3229\n\t tty_driver_install_tty drivers/tty/tty_io.c:1228 [inline]\n\t tty_init_dev+0x94/0x350 drivers/tty/tty_io.c:1341\n\t tty_open_by_driver drivers/tty/tty_io.c:1987 [inline]\n\t tty_open+0x3ca/0xb30 drivers/tty/tty_io.c:2035\n\t [...]\n\n\tFreed by task 130:\n\t [...]\n\t kfree+0xbf/0x1e0 mm/slab.c:3757\n\t vt_disallocate drivers/tty/vt/vt_ioctl.c:300 [inline]\n\t vt_ioctl+0x16dc/0x1e30 drivers/tty/vt/vt_ioctl.c:818\n\t tty_ioctl+0x9db/0x11b0 drivers/tty/tty_io.c:2660\n\t [...]\n\nFixes: 4001d7b7fc27 (\"vt: push down the tty lock so we can see what is left to tackle\")\nCc: <stable@vger.kernel.org> # v3.4+\nReported-by: syzbot+522643ab5729b0421998@syzkaller.appspotmail.com\nAcked-by: Jiri Slaby <jslaby@suse.cz>\nSigned-off-by: Eric Biggers <ebiggers@google.com>\nLink: https://lore.kernel.org/r/20200322034305.210082-2-ebiggers@kernel.org\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4906. "target": 0,
  4907. "dataset": "other",
  4908. "idx": 437043
  4909. },
  4910. {
  4911. "func": "long vt_compat_ioctl(struct tty_struct *tty,\n\t unsigned int cmd, unsigned long arg)\n{\n\tstruct vc_data *vc = tty->driver_data;\n\tstruct console_font_op op;\t/* used in multiple places here */\n\tunsigned int console = vc->vc_num;\n\tvoid __user *up = compat_ptr(arg);\n\tint perm;\n\n\n\tif (!vc_cons_allocated(console)) \t/* impossible? */\n\t\treturn -ENOIOCTLCMD;\n\n\t/*\n\t * To have permissions to do most of the vt ioctls, we either have\n\t * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.\n\t */\n\tperm = 0;\n\tif (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))\n\t\tperm = 1;\n\n\tswitch (cmd) {\n\t/*\n\t * these need special handlers for incompatible data structures\n\t */\n\tcase PIO_FONTX:\n\tcase GIO_FONTX:\n\t\treturn compat_fontx_ioctl(cmd, up, perm, &op);\n\n\tcase KDFONTOP:\n\t\treturn compat_kdfontop_ioctl(up, perm, &op, vc);\n\n\tcase PIO_UNIMAP:\n\tcase GIO_UNIMAP:\n\t\treturn compat_unimap_ioctl(cmd, up, perm, vc);\n\n\t/*\n\t * all these treat 'arg' as an integer\n\t */\n\tcase KIOCSOUND:\n\tcase KDMKTONE:\n#ifdef CONFIG_X86\n\tcase KDADDIO:\n\tcase KDDELIO:\n#endif\n\tcase KDSETMODE:\n\tcase KDMAPDISP:\n\tcase KDUNMAPDISP:\n\tcase KDSKBMODE:\n\tcase KDSKBMETA:\n\tcase KDSKBLED:\n\tcase KDSETLED:\n\tcase KDSIGACCEPT:\n\tcase VT_ACTIVATE:\n\tcase VT_WAITACTIVE:\n\tcase VT_RELDISP:\n\tcase VT_DISALLOCATE:\n\tcase VT_RESIZE:\n\tcase VT_RESIZEX:\n\t\treturn vt_ioctl(tty, cmd, arg);\n\n\t/*\n\t * the rest has a compatible data structure behind arg,\n\t * but we have to convert it to a proper 64 bit pointer.\n\t */\n\tdefault:\n\t\treturn vt_ioctl(tty, cmd, (unsigned long)up);\n\t}\n}",
  4912. "project": "linux",
  4913. "hash": 192018643298579271829100810505147802074,
  4914. "size": 69,
  4915. "commit_id": "6cd1ed50efd88261298577cd92a14f2768eddeeb",
  4916. "message": "vt: vt_ioctl: fix race in VT_RESIZEX\n\nWe need to make sure vc_cons[i].d is not NULL after grabbing\nconsole_lock(), or risk a crash.\n\ngeneral protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN\nKASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]\nCPU: 1 PID: 19462 Comm: syz-executor.5 Not tainted 5.5.0-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n tty_ioctl+0xa37/0x14f0 drivers/tty/tty_io.c:2660\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0x123/0x180 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x45b399\nCode: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007f7d13c11c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 00007f7d13c126d4 RCX: 000000000045b399\nRDX: 0000000020000080 RSI: 000000000000560a RDI: 0000000000000003\nRBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff\nR13: 0000000000000666 R14: 00000000004c7f04 R15: 000000000075bf2c\nModules linked in:\n---[ end trace 80970faf7a67eb77 ]---\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\n\nFixes: 1da177e4c3f4 (\"Linux-2.6.12-rc2\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: stable <stable@vger.kernel.org>\nReported-by: syzbot <syzkaller@googlegroups.com>\nLink: https://lore.kernel.org/r/20200210190721.200418-1-edumazet@google.com\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4917. "target": 0,
  4918. "dataset": "other",
  4919. "idx": 458188
  4920. },
  4921. {
  4922. "func": "static void vt_disallocate_all(void)\n{\n\tstruct vc_data *vc[MAX_NR_CONSOLES];\n\tint i;\n\n\tconsole_lock();\n\tfor (i = 1; i < MAX_NR_CONSOLES; i++)\n\t\tif (!VT_BUSY(i))\n\t\t\tvc[i] = vc_deallocate(i);\n\t\telse\n\t\t\tvc[i] = NULL;\n\tconsole_unlock();\n\n\tfor (i = 1; i < MAX_NR_CONSOLES; i++) {\n\t\tif (vc[i] && i >= MIN_NR_CONSOLES) {\n\t\t\ttty_port_destroy(&vc[i]->port);\n\t\t\tkfree(vc[i]);\n\t\t}\n\t}\n}",
  4923. "project": "linux",
  4924. "hash": 285711189364176146888062077879526937291,
  4925. "size": 20,
  4926. "commit_id": "6cd1ed50efd88261298577cd92a14f2768eddeeb",
  4927. "message": "vt: vt_ioctl: fix race in VT_RESIZEX\n\nWe need to make sure vc_cons[i].d is not NULL after grabbing\nconsole_lock(), or risk a crash.\n\ngeneral protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN\nKASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]\nCPU: 1 PID: 19462 Comm: syz-executor.5 Not tainted 5.5.0-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n tty_ioctl+0xa37/0x14f0 drivers/tty/tty_io.c:2660\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0x123/0x180 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x45b399\nCode: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007f7d13c11c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 00007f7d13c126d4 RCX: 000000000045b399\nRDX: 0000000020000080 RSI: 000000000000560a RDI: 0000000000000003\nRBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff\nR13: 0000000000000666 R14: 00000000004c7f04 R15: 000000000075bf2c\nModules linked in:\n---[ end trace 80970faf7a67eb77 ]---\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\n\nFixes: 1da177e4c3f4 (\"Linux-2.6.12-rc2\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: stable <stable@vger.kernel.org>\nReported-by: syzbot <syzkaller@googlegroups.com>\nLink: https://lore.kernel.org/r/20200210190721.200418-1-edumazet@google.com\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4928. "target": 0,
  4929. "dataset": "other",
  4930. "idx": 458191
  4931. },
  4932. {
  4933. "func": "int vt_ioctl(struct tty_struct *tty,\n\t unsigned int cmd, unsigned long arg)\n{\n\tstruct vc_data *vc = tty->driver_data;\n\tstruct console_font_op op;\t/* used in multiple places here */\n\tunsigned int console;\n\tunsigned char ucval;\n\tunsigned int uival;\n\tvoid __user *up = (void __user *)arg;\n\tint i, perm;\n\tint ret = 0;\n\n\tconsole = vc->vc_num;\n\n\n\tif (!vc_cons_allocated(console)) { \t/* impossible? */\n\t\tret = -ENOIOCTLCMD;\n\t\tgoto out;\n\t}\n\n\n\t/*\n\t * To have permissions to do most of the vt ioctls, we either have\n\t * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.\n\t */\n\tperm = 0;\n\tif (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))\n\t\tperm = 1;\n \n\tswitch (cmd) {\n\tcase TIOCLINUX:\n\t\tret = tioclinux(tty, arg);\n\t\tbreak;\n\tcase KIOCSOUND:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\t/*\n\t\t * The use of PIT_TICK_RATE is historic, it used to be\n\t\t * the platform-dependent CLOCK_TICK_RATE between 2.6.12\n\t\t * and 2.6.36, which was a minor but unfortunate ABI\n\t\t * change. kd_mksound is locked by the input layer.\n\t\t */\n\t\tif (arg)\n\t\t\targ = PIT_TICK_RATE / arg;\n\t\tkd_mksound(arg, 0);\n\t\tbreak;\n\n\tcase KDMKTONE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t{\n\t\tunsigned int ticks, count;\n\t\t\n\t\t/*\n\t\t * Generate the tone for the appropriate number of ticks.\n\t\t * If the time is zero, turn off sound ourselves.\n\t\t */\n\t\tticks = msecs_to_jiffies((arg >> 16) & 0xffff);\n\t\tcount = ticks ? (arg & 0xffff) : 0;\n\t\tif (count)\n\t\t\tcount = PIT_TICK_RATE / count;\n\t\tkd_mksound(count, ticks);\n\t\tbreak;\n\t}\n\n\tcase KDGKBTYPE:\n\t\t/*\n\t\t * this is naïve.\n\t\t */\n\t\tucval = KB_101;\n\t\tret = put_user(ucval, (char __user *)arg);\n\t\tbreak;\n\n\t\t/*\n\t\t * These cannot be implemented on any machine that implements\n\t\t * ioperm() in user level (such as Alpha PCs) or not at all.\n\t\t *\n\t\t * XXX: you should never use these, just call ioperm directly..\n\t\t */\n#ifdef CONFIG_X86\n\tcase KDADDIO:\n\tcase KDDELIO:\n\t\t/*\n\t\t * KDADDIO and KDDELIO may be able to add ports beyond what\n\t\t * we reject here, but to be safe...\n\t\t *\n\t\t * These are locked internally via sys_ioperm\n\t\t */\n\t\tif (arg < GPFIRST || arg > GPLAST) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\t\tret = ksys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0;\n\t\tbreak;\n\n\tcase KDENABIO:\n\tcase KDDISABIO:\n\t\tret = ksys_ioperm(GPFIRST, GPNUM,\n\t\t\t\t (cmd == KDENABIO)) ? -ENXIO : 0;\n\t\tbreak;\n#endif\n\n\t/* Linux m68k/i386 interface for setting the keyboard delay/repeat rate */\n\t\t\n\tcase KDKBDREP:\n\t{\n\t\tstruct kbd_repeat kbrep;\n\t\t\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\n\t\tif (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tret = kbd_rate(&kbrep);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tif (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\tcase KDSETMODE:\n\t\t/*\n\t\t * currently, setting the mode from KD_TEXT to KD_GRAPHICS\n\t\t * doesn't do a whole lot. i'm not sure if it should do any\n\t\t * restoration of modes or what...\n\t\t *\n\t\t * XXX It should at least call into the driver, fbdev's definitely\n\t\t * need to restore their engine state. --BenH\n\t\t */\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tswitch (arg) {\n\t\tcase KD_GRAPHICS:\n\t\t\tbreak;\n\t\tcase KD_TEXT0:\n\t\tcase KD_TEXT1:\n\t\t\targ = KD_TEXT;\n\t\tcase KD_TEXT:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tret = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\t/* FIXME: this needs the console lock extending */\n\t\tif (vc->vc_mode == (unsigned char) arg)\n\t\t\tbreak;\n\t\tvc->vc_mode = (unsigned char) arg;\n\t\tif (console != fg_console)\n\t\t\tbreak;\n\t\t/*\n\t\t * explicitly blank/unblank the screen if switching modes\n\t\t */\n\t\tconsole_lock();\n\t\tif (arg == KD_TEXT)\n\t\t\tdo_unblank_screen(1);\n\t\telse\n\t\t\tdo_blank_screen(1);\n\t\tconsole_unlock();\n\t\tbreak;\n\n\tcase KDGETMODE:\n\t\tuival = vc->vc_mode;\n\t\tgoto setint;\n\n\tcase KDMAPDISP:\n\tcase KDUNMAPDISP:\n\t\t/*\n\t\t * these work like a combination of mmap and KDENABIO.\n\t\t * this could be easily finished.\n\t\t */\n\t\tret = -EINVAL;\n\t\tbreak;\n\n\tcase KDSKBMODE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tret = vt_do_kdskbmode(console, arg);\n\t\tif (ret == 0)\n\t\t\ttty_ldisc_flush(tty);\n\t\tbreak;\n\n\tcase KDGKBMODE:\n\t\tuival = vt_do_kdgkbmode(console);\n\t\tret = put_user(uival, (int __user *)arg);\n\t\tbreak;\n\n\t/* this could be folded into KDSKBMODE, but for compatibility\n\t reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */\n\tcase KDSKBMETA:\n\t\tret = vt_do_kdskbmeta(console, arg);\n\t\tbreak;\n\n\tcase KDGKBMETA:\n\t\t/* FIXME: should review whether this is worth locking */\n\t\tuival = vt_do_kdgkbmeta(console);\n\tsetint:\n\t\tret = put_user(uival, (int __user *)arg);\n\t\tbreak;\n\n\tcase KDGETKEYCODE:\n\tcase KDSETKEYCODE:\n\t\tif(!capable(CAP_SYS_TTY_CONFIG))\n\t\t\tperm = 0;\n\t\tret = vt_do_kbkeycode_ioctl(cmd, up, perm);\n\t\tbreak;\n\n\tcase KDGKBENT:\n\tcase KDSKBENT:\n\t\tret = vt_do_kdsk_ioctl(cmd, up, perm, console);\n\t\tbreak;\n\n\tcase KDGKBSENT:\n\tcase KDSKBSENT:\n\t\tret = vt_do_kdgkb_ioctl(cmd, up, perm);\n\t\tbreak;\n\n\t/* Diacritical processing. Handled in keyboard.c as it has\n\t to operate on the keyboard locks and structures */\n\tcase KDGKBDIACR:\n\tcase KDGKBDIACRUC:\n\tcase KDSKBDIACR:\n\tcase KDSKBDIACRUC:\n\t\tret = vt_do_diacrit(cmd, up, perm);\n\t\tbreak;\n\n\t/* the ioctls below read/set the flags usually shown in the leds */\n\t/* don't use them - they will go away without warning */\n\tcase KDGKBLED:\n\tcase KDSKBLED:\n\tcase KDGETLED:\n\tcase KDSETLED:\n\t\tret = vt_do_kdskled(console, cmd, arg, perm);\n\t\tbreak;\n\n\t/*\n\t * A process can indicate its willingness to accept signals\n\t * generated by pressing an appropriate key combination.\n\t * Thus, one can have a daemon that e.g. spawns a new console\n\t * upon a keypress and then changes to it.\n\t * See also the kbrequest field of inittab(5).\n\t */\n\tcase KDSIGACCEPT:\n\t{\n\t\tif (!perm || !capable(CAP_KILL))\n\t\t\treturn -EPERM;\n\t\tif (!valid_signal(arg) || arg < 1 || arg == SIGKILL)\n\t\t\tret = -EINVAL;\n\t\telse {\n\t\t\tspin_lock_irq(&vt_spawn_con.lock);\n\t\t\tput_pid(vt_spawn_con.pid);\n\t\t\tvt_spawn_con.pid = get_pid(task_pid(current));\n\t\t\tvt_spawn_con.sig = arg;\n\t\t\tspin_unlock_irq(&vt_spawn_con.lock);\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase VT_SETMODE:\n\t{\n\t\tstruct vt_mode tmp;\n\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (copy_from_user(&tmp, up, sizeof(struct vt_mode))) {\n\t\t\tret = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tif (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) {\n\t\t\tret = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\tconsole_lock();\n\t\tvc->vt_mode = tmp;\n\t\t/* the frsig is ignored, so we set it to 0 */\n\t\tvc->vt_mode.frsig = 0;\n\t\tput_pid(vc->vt_pid);\n\t\tvc->vt_pid = get_pid(task_pid(current));\n\t\t/* no switch is required -- saw@shade.msu.ru */\n\t\tvc->vt_newvt = -1;\n\t\tconsole_unlock();\n\t\tbreak;\n\t}\n\n\tcase VT_GETMODE:\n\t{\n\t\tstruct vt_mode tmp;\n\t\tint rc;\n\n\t\tconsole_lock();\n\t\tmemcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));\n\t\tconsole_unlock();\n\n\t\trc = copy_to_user(up, &tmp, sizeof(struct vt_mode));\n\t\tif (rc)\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\t/*\n\t * Returns global vt state. Note that VT 0 is always open, since\n\t * it's an alias for the current VT, and people can't use it here.\n\t * We cannot return state for more than 16 VTs, since v_state is short.\n\t */\n\tcase VT_GETSTATE:\n\t{\n\t\tstruct vt_stat __user *vtstat = up;\n\t\tunsigned short state, mask;\n\n\t\t/* Review: FIXME: Console lock ? */\n\t\tif (put_user(fg_console + 1, &vtstat->v_active))\n\t\t\tret = -EFAULT;\n\t\telse {\n\t\t\tstate = 1;\t/* /dev/tty0 is always open */\n\t\t\tfor (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;\n\t\t\t\t\t\t\t++i, mask <<= 1)\n\t\t\t\tif (VT_IS_IN_USE(i))\n\t\t\t\t\tstate |= mask;\n\t\t\tret = put_user(state, &vtstat->v_state);\n\t\t}\n\t\tbreak;\n\t}\n\n\t/*\n\t * Returns the first available (non-opened) console.\n\t */\n\tcase VT_OPENQRY:\n\t\t/* FIXME: locking ? - but then this is a stupid API */\n\t\tfor (i = 0; i < MAX_NR_CONSOLES; ++i)\n\t\t\tif (! VT_IS_IN_USE(i))\n\t\t\t\tbreak;\n\t\tuival = i < MAX_NR_CONSOLES ? (i+1) : -1;\n\t\tgoto setint;\t\t \n\n\t/*\n\t * ioctl(fd, VT_ACTIVATE, num) will cause us to switch to vt # num,\n\t * with num >= 1 (switches to vt 0, our console, are not allowed, just\n\t * to preserve sanity).\n\t */\n\tcase VT_ACTIVATE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (arg == 0 || arg > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse {\n\t\t\targ--;\n\t\t\tconsole_lock();\n\t\t\tret = vc_allocate(arg);\n\t\t\tconsole_unlock();\n\t\t\tif (ret)\n\t\t\t\tbreak;\n\t\t\tset_console(arg);\n\t\t}\n\t\tbreak;\n\n\tcase VT_SETACTIVATE:\n\t{\n\t\tstruct vt_setactivate vsa;\n\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n\t\tif (copy_from_user(&vsa, (struct vt_setactivate __user *)arg,\n\t\t\t\t\tsizeof(struct vt_setactivate))) {\n\t\t\tret = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tif (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse {\n\t\t\tvsa.console = array_index_nospec(vsa.console,\n\t\t\t\t\t\t\t MAX_NR_CONSOLES + 1);\n\t\t\tvsa.console--;\n\t\t\tconsole_lock();\n\t\t\tret = vc_allocate(vsa.console);\n\t\t\tif (ret == 0) {\n\t\t\t\tstruct vc_data *nvc;\n\t\t\t\t/* This is safe providing we don't drop the\n\t\t\t\t console sem between vc_allocate and\n\t\t\t\t finishing referencing nvc */\n\t\t\t\tnvc = vc_cons[vsa.console].d;\n\t\t\t\tnvc->vt_mode = vsa.mode;\n\t\t\t\tnvc->vt_mode.frsig = 0;\n\t\t\t\tput_pid(nvc->vt_pid);\n\t\t\t\tnvc->vt_pid = get_pid(task_pid(current));\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t\tif (ret)\n\t\t\t\tbreak;\n\t\t\t/* Commence switch and lock */\n\t\t\t/* Review set_console locks */\n\t\t\tset_console(vsa.console);\n\t\t}\n\t\tbreak;\n\t}\n\n\t/*\n\t * wait until the specified VT has been activated\n\t */\n\tcase VT_WAITACTIVE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (arg == 0 || arg > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse\n\t\t\tret = vt_waitactive(arg);\n\t\tbreak;\n\n\t/*\n\t * If a vt is under process control, the kernel will not switch to it\n\t * immediately, but postpone the operation until the process calls this\n\t * ioctl, allowing the switch to complete.\n\t *\n\t * According to the X sources this is the behavior:\n\t *\t0:\tpending switch-from not OK\n\t *\t1:\tpending switch-from OK\n\t *\t2:\tcompleted switch-to OK\n\t */\n\tcase VT_RELDISP:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n\t\tconsole_lock();\n\t\tif (vc->vt_mode.mode != VT_PROCESS) {\n\t\t\tconsole_unlock();\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\t\t/*\n\t\t * Switching-from response\n\t\t */\n\t\tif (vc->vt_newvt >= 0) {\n\t\t\tif (arg == 0)\n\t\t\t\t/*\n\t\t\t\t * Switch disallowed, so forget we were trying\n\t\t\t\t * to do it.\n\t\t\t\t */\n\t\t\t\tvc->vt_newvt = -1;\n\n\t\t\telse {\n\t\t\t\t/*\n\t\t\t\t * The current vt has been released, so\n\t\t\t\t * complete the switch.\n\t\t\t\t */\n\t\t\t\tint newvt;\n\t\t\t\tnewvt = vc->vt_newvt;\n\t\t\t\tvc->vt_newvt = -1;\n\t\t\t\tret = vc_allocate(newvt);\n\t\t\t\tif (ret) {\n\t\t\t\t\tconsole_unlock();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * When we actually do the console switch,\n\t\t\t\t * make sure we are atomic with respect to\n\t\t\t\t * other console switches..\n\t\t\t\t */\n\t\t\t\tcomplete_change_console(vc_cons[newvt].d);\n\t\t\t}\n\t\t} else {\n\t\t\t/*\n\t\t\t * Switched-to response\n\t\t\t */\n\t\t\t/*\n\t\t\t * If it's just an ACK, ignore it\n\t\t\t */\n\t\t\tif (arg != VT_ACKACQ)\n\t\t\t\tret = -EINVAL;\n\t\t}\n\t\tconsole_unlock();\n\t\tbreak;\n\n\t /*\n\t * Disallocate memory associated to VT (but leave VT1)\n\t */\n\t case VT_DISALLOCATE:\n\t\tif (arg > MAX_NR_CONSOLES) {\n\t\t\tret = -ENXIO;\n\t\t\tbreak;\n\t\t}\n\t\tif (arg == 0)\n\t\t\tvt_disallocate_all();\n\t\telse\n\t\t\tret = vt_disallocate(--arg);\n\t\tbreak;\n\n\tcase VT_RESIZE:\n\t{\n\t\tstruct vt_sizes __user *vtsizes = up;\n\t\tstruct vc_data *vc;\n\n\t\tushort ll,cc;\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (get_user(ll, &vtsizes->v_rows) ||\n\t\t get_user(cc, &vtsizes->v_cols))\n\t\t\tret = -EFAULT;\n\t\telse {\n\t\t\tconsole_lock();\n\t\t\tfor (i = 0; i < MAX_NR_CONSOLES; i++) {\n\t\t\t\tvc = vc_cons[i].d;\n\n\t\t\t\tif (vc) {\n\t\t\t\t\tvc->vc_resize_user = 1;\n\t\t\t\t\t/* FIXME: review v tty lock */\n\t\t\t\t\tvc_resize(vc_cons[i].d, cc, ll);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase VT_RESIZEX:\n\t{\n\t\tstruct vt_consize v;\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (copy_from_user(&v, up, sizeof(struct vt_consize)))\n\t\t\treturn -EFAULT;\n\t\t/* FIXME: Should check the copies properly */\n\t\tif (!v.v_vlin)\n\t\t\tv.v_vlin = vc->vc_scan_lines;\n\t\tif (v.v_clin) {\n\t\t\tint rows = v.v_vlin/v.v_clin;\n\t\t\tif (v.v_rows != rows) {\n\t\t\t\tif (v.v_rows) /* Parameters don't add up */\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\tv.v_rows = rows;\n\t\t\t}\n\t\t}\n\t\tif (v.v_vcol && v.v_ccol) {\n\t\t\tint cols = v.v_vcol/v.v_ccol;\n\t\t\tif (v.v_cols != cols) {\n\t\t\t\tif (v.v_cols)\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\tv.v_cols = cols;\n\t\t\t}\n\t\t}\n\n\t\tif (v.v_clin > 32)\n\t\t\treturn -EINVAL;\n\n\t\tfor (i = 0; i < MAX_NR_CONSOLES; i++) {\n\t\t\tif (!vc_cons[i].d)\n\t\t\t\tcontinue;\n\t\t\tconsole_lock();\n\t\t\tif (v.v_vlin)\n\t\t\t\tvc_cons[i].d->vc_scan_lines = v.v_vlin;\n\t\t\tif (v.v_clin)\n\t\t\t\tvc_cons[i].d->vc_font.height = v.v_clin;\n\t\t\tvc_cons[i].d->vc_resize_user = 1;\n\t\t\tvc_resize(vc_cons[i].d, v.v_cols, v.v_rows);\n\t\t\tconsole_unlock();\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase PIO_FONT: {\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\top.op = KD_FONT_OP_SET;\n\t\top.flags = KD_FONT_FLAG_OLD | KD_FONT_FLAG_DONT_RECALC;\t/* Compatibility */\n\t\top.width = 8;\n\t\top.height = 0;\n\t\top.charcount = 256;\n\t\top.data = up;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tbreak;\n\t}\n\n\tcase GIO_FONT: {\n\t\top.op = KD_FONT_OP_GET;\n\t\top.flags = KD_FONT_FLAG_OLD;\n\t\top.width = 8;\n\t\top.height = 32;\n\t\top.charcount = 256;\n\t\top.data = up;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tbreak;\n\t}\n\n\tcase PIO_CMAP:\n if (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t ret = con_set_cmap(up);\n\t\tbreak;\n\n\tcase GIO_CMAP:\n ret = con_get_cmap(up);\n\t\tbreak;\n\n\tcase PIO_FONTX:\n\tcase GIO_FONTX:\n\t\tret = do_fontx_ioctl(cmd, up, perm, &op);\n\t\tbreak;\n\n\tcase PIO_FONTRESET:\n\t{\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n#ifdef BROKEN_GRAPHICS_PROGRAMS\n\t\t/* With BROKEN_GRAPHICS_PROGRAMS defined, the default\n\t\t font is not saved. */\n\t\tret = -ENOSYS;\n\t\tbreak;\n#else\n\t\t{\n\t\top.op = KD_FONT_OP_SET_DEFAULT;\n\t\top.data = NULL;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tconsole_lock();\n\t\tcon_set_default_unimap(vc_cons[fg_console].d);\n\t\tconsole_unlock();\n\t\tbreak;\n\t\t}\n#endif\n\t}\n\n\tcase KDFONTOP: {\n\t\tif (copy_from_user(&op, up, sizeof(op))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tif (!perm && op.op != KD_FONT_OP_GET)\n\t\t\treturn -EPERM;\n\t\tret = con_font_op(vc, &op);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tif (copy_to_user(up, &op, sizeof(op)))\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\tcase PIO_SCRNMAP:\n\t\tif (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t\t\tret = con_set_trans_old(up);\n\t\tbreak;\n\n\tcase GIO_SCRNMAP:\n\t\tret = con_get_trans_old(up);\n\t\tbreak;\n\n\tcase PIO_UNISCRNMAP:\n\t\tif (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t\t\tret = con_set_trans_new(up);\n\t\tbreak;\n\n\tcase GIO_UNISCRNMAP:\n\t\tret = con_get_trans_new(up);\n\t\tbreak;\n\n\tcase PIO_UNIMAPCLR:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tcon_clear_unimap(vc);\n\t\tbreak;\n\n\tcase PIO_UNIMAP:\n\tcase GIO_UNIMAP:\n\t\tret = do_unimap_ioctl(cmd, up, perm, vc);\n\t\tbreak;\n\n\tcase VT_LOCKSWITCH:\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\t\tvt_dont_switch = 1;\n\t\tbreak;\n\tcase VT_UNLOCKSWITCH:\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\t\tvt_dont_switch = 0;\n\t\tbreak;\n\tcase VT_GETHIFONTMASK:\n\t\tret = put_user(vc->vc_hi_font_mask,\n\t\t\t\t\t(unsigned short __user *)arg);\n\t\tbreak;\n\tcase VT_WAITEVENT:\n\t\tret = vt_event_wait_ioctl((struct vt_event __user *)arg);\n\t\tbreak;\n\tdefault:\n\t\tret = -ENOIOCTLCMD;\n\t}\nout:\n\treturn ret;\n}",
  4934. "project": "linux",
  4935. "hash": 215976747485693149279929143438303006406,
  4936. "size": 696,
  4937. "commit_id": "6cd1ed50efd88261298577cd92a14f2768eddeeb",
  4938. "message": "vt: vt_ioctl: fix race in VT_RESIZEX\n\nWe need to make sure vc_cons[i].d is not NULL after grabbing\nconsole_lock(), or risk a crash.\n\ngeneral protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN\nKASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]\nCPU: 1 PID: 19462 Comm: syz-executor.5 Not tainted 5.5.0-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n tty_ioctl+0xa37/0x14f0 drivers/tty/tty_io.c:2660\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0x123/0x180 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x45b399\nCode: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007f7d13c11c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 00007f7d13c126d4 RCX: 000000000045b399\nRDX: 0000000020000080 RSI: 000000000000560a RDI: 0000000000000003\nRBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff\nR13: 0000000000000666 R14: 00000000004c7f04 R15: 000000000075bf2c\nModules linked in:\n---[ end trace 80970faf7a67eb77 ]---\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\n\nFixes: 1da177e4c3f4 (\"Linux-2.6.12-rc2\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: stable <stable@vger.kernel.org>\nReported-by: syzbot <syzkaller@googlegroups.com>\nLink: https://lore.kernel.org/r/20200210190721.200418-1-edumazet@google.com\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4939. "target": 1,
  4940. "dataset": "other",
  4941. "idx": 212365
  4942. },
  4943. {
  4944. "func": "int vt_ioctl(struct tty_struct *tty,\n\t unsigned int cmd, unsigned long arg)\n{\n\tstruct vc_data *vc = tty->driver_data;\n\tstruct console_font_op op;\t/* used in multiple places here */\n\tunsigned int console = vc->vc_num;\n\tunsigned char ucval;\n\tunsigned int uival;\n\tvoid __user *up = (void __user *)arg;\n\tint i, perm;\n\tint ret = 0;\n\n\t/*\n\t * To have permissions to do most of the vt ioctls, we either have\n\t * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.\n\t */\n\tperm = 0;\n\tif (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))\n\t\tperm = 1;\n \n\tswitch (cmd) {\n\tcase TIOCLINUX:\n\t\tret = tioclinux(tty, arg);\n\t\tbreak;\n\tcase KIOCSOUND:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\t/*\n\t\t * The use of PIT_TICK_RATE is historic, it used to be\n\t\t * the platform-dependent CLOCK_TICK_RATE between 2.6.12\n\t\t * and 2.6.36, which was a minor but unfortunate ABI\n\t\t * change. kd_mksound is locked by the input layer.\n\t\t */\n\t\tif (arg)\n\t\t\targ = PIT_TICK_RATE / arg;\n\t\tkd_mksound(arg, 0);\n\t\tbreak;\n\n\tcase KDMKTONE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t{\n\t\tunsigned int ticks, count;\n\t\t\n\t\t/*\n\t\t * Generate the tone for the appropriate number of ticks.\n\t\t * If the time is zero, turn off sound ourselves.\n\t\t */\n\t\tticks = msecs_to_jiffies((arg >> 16) & 0xffff);\n\t\tcount = ticks ? (arg & 0xffff) : 0;\n\t\tif (count)\n\t\t\tcount = PIT_TICK_RATE / count;\n\t\tkd_mksound(count, ticks);\n\t\tbreak;\n\t}\n\n\tcase KDGKBTYPE:\n\t\t/*\n\t\t * this is naïve.\n\t\t */\n\t\tucval = KB_101;\n\t\tret = put_user(ucval, (char __user *)arg);\n\t\tbreak;\n\n\t\t/*\n\t\t * These cannot be implemented on any machine that implements\n\t\t * ioperm() in user level (such as Alpha PCs) or not at all.\n\t\t *\n\t\t * XXX: you should never use these, just call ioperm directly..\n\t\t */\n#ifdef CONFIG_X86\n\tcase KDADDIO:\n\tcase KDDELIO:\n\t\t/*\n\t\t * KDADDIO and KDDELIO may be able to add ports beyond what\n\t\t * we reject here, but to be safe...\n\t\t *\n\t\t * These are locked internally via sys_ioperm\n\t\t */\n\t\tif (arg < GPFIRST || arg > GPLAST) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\t\tret = ksys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0;\n\t\tbreak;\n\n\tcase KDENABIO:\n\tcase KDDISABIO:\n\t\tret = ksys_ioperm(GPFIRST, GPNUM,\n\t\t\t\t (cmd == KDENABIO)) ? -ENXIO : 0;\n\t\tbreak;\n#endif\n\n\t/* Linux m68k/i386 interface for setting the keyboard delay/repeat rate */\n\t\t\n\tcase KDKBDREP:\n\t{\n\t\tstruct kbd_repeat kbrep;\n\t\t\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\n\t\tif (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tret = kbd_rate(&kbrep);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tif (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\tcase KDSETMODE:\n\t\t/*\n\t\t * currently, setting the mode from KD_TEXT to KD_GRAPHICS\n\t\t * doesn't do a whole lot. i'm not sure if it should do any\n\t\t * restoration of modes or what...\n\t\t *\n\t\t * XXX It should at least call into the driver, fbdev's definitely\n\t\t * need to restore their engine state. --BenH\n\t\t */\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tswitch (arg) {\n\t\tcase KD_GRAPHICS:\n\t\t\tbreak;\n\t\tcase KD_TEXT0:\n\t\tcase KD_TEXT1:\n\t\t\targ = KD_TEXT;\n\t\tcase KD_TEXT:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tret = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\t/* FIXME: this needs the console lock extending */\n\t\tif (vc->vc_mode == (unsigned char) arg)\n\t\t\tbreak;\n\t\tvc->vc_mode = (unsigned char) arg;\n\t\tif (console != fg_console)\n\t\t\tbreak;\n\t\t/*\n\t\t * explicitly blank/unblank the screen if switching modes\n\t\t */\n\t\tconsole_lock();\n\t\tif (arg == KD_TEXT)\n\t\t\tdo_unblank_screen(1);\n\t\telse\n\t\t\tdo_blank_screen(1);\n\t\tconsole_unlock();\n\t\tbreak;\n\n\tcase KDGETMODE:\n\t\tuival = vc->vc_mode;\n\t\tgoto setint;\n\n\tcase KDMAPDISP:\n\tcase KDUNMAPDISP:\n\t\t/*\n\t\t * these work like a combination of mmap and KDENABIO.\n\t\t * this could be easily finished.\n\t\t */\n\t\tret = -EINVAL;\n\t\tbreak;\n\n\tcase KDSKBMODE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tret = vt_do_kdskbmode(console, arg);\n\t\tif (ret == 0)\n\t\t\ttty_ldisc_flush(tty);\n\t\tbreak;\n\n\tcase KDGKBMODE:\n\t\tuival = vt_do_kdgkbmode(console);\n\t\tret = put_user(uival, (int __user *)arg);\n\t\tbreak;\n\n\t/* this could be folded into KDSKBMODE, but for compatibility\n\t reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */\n\tcase KDSKBMETA:\n\t\tret = vt_do_kdskbmeta(console, arg);\n\t\tbreak;\n\n\tcase KDGKBMETA:\n\t\t/* FIXME: should review whether this is worth locking */\n\t\tuival = vt_do_kdgkbmeta(console);\n\tsetint:\n\t\tret = put_user(uival, (int __user *)arg);\n\t\tbreak;\n\n\tcase KDGETKEYCODE:\n\tcase KDSETKEYCODE:\n\t\tif(!capable(CAP_SYS_TTY_CONFIG))\n\t\t\tperm = 0;\n\t\tret = vt_do_kbkeycode_ioctl(cmd, up, perm);\n\t\tbreak;\n\n\tcase KDGKBENT:\n\tcase KDSKBENT:\n\t\tret = vt_do_kdsk_ioctl(cmd, up, perm, console);\n\t\tbreak;\n\n\tcase KDGKBSENT:\n\tcase KDSKBSENT:\n\t\tret = vt_do_kdgkb_ioctl(cmd, up, perm);\n\t\tbreak;\n\n\t/* Diacritical processing. Handled in keyboard.c as it has\n\t to operate on the keyboard locks and structures */\n\tcase KDGKBDIACR:\n\tcase KDGKBDIACRUC:\n\tcase KDSKBDIACR:\n\tcase KDSKBDIACRUC:\n\t\tret = vt_do_diacrit(cmd, up, perm);\n\t\tbreak;\n\n\t/* the ioctls below read/set the flags usually shown in the leds */\n\t/* don't use them - they will go away without warning */\n\tcase KDGKBLED:\n\tcase KDSKBLED:\n\tcase KDGETLED:\n\tcase KDSETLED:\n\t\tret = vt_do_kdskled(console, cmd, arg, perm);\n\t\tbreak;\n\n\t/*\n\t * A process can indicate its willingness to accept signals\n\t * generated by pressing an appropriate key combination.\n\t * Thus, one can have a daemon that e.g. spawns a new console\n\t * upon a keypress and then changes to it.\n\t * See also the kbrequest field of inittab(5).\n\t */\n\tcase KDSIGACCEPT:\n\t{\n\t\tif (!perm || !capable(CAP_KILL))\n\t\t\treturn -EPERM;\n\t\tif (!valid_signal(arg) || arg < 1 || arg == SIGKILL)\n\t\t\tret = -EINVAL;\n\t\telse {\n\t\t\tspin_lock_irq(&vt_spawn_con.lock);\n\t\t\tput_pid(vt_spawn_con.pid);\n\t\t\tvt_spawn_con.pid = get_pid(task_pid(current));\n\t\t\tvt_spawn_con.sig = arg;\n\t\t\tspin_unlock_irq(&vt_spawn_con.lock);\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase VT_SETMODE:\n\t{\n\t\tstruct vt_mode tmp;\n\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (copy_from_user(&tmp, up, sizeof(struct vt_mode))) {\n\t\t\tret = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tif (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) {\n\t\t\tret = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\tconsole_lock();\n\t\tvc->vt_mode = tmp;\n\t\t/* the frsig is ignored, so we set it to 0 */\n\t\tvc->vt_mode.frsig = 0;\n\t\tput_pid(vc->vt_pid);\n\t\tvc->vt_pid = get_pid(task_pid(current));\n\t\t/* no switch is required -- saw@shade.msu.ru */\n\t\tvc->vt_newvt = -1;\n\t\tconsole_unlock();\n\t\tbreak;\n\t}\n\n\tcase VT_GETMODE:\n\t{\n\t\tstruct vt_mode tmp;\n\t\tint rc;\n\n\t\tconsole_lock();\n\t\tmemcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));\n\t\tconsole_unlock();\n\n\t\trc = copy_to_user(up, &tmp, sizeof(struct vt_mode));\n\t\tif (rc)\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\t/*\n\t * Returns global vt state. Note that VT 0 is always open, since\n\t * it's an alias for the current VT, and people can't use it here.\n\t * We cannot return state for more than 16 VTs, since v_state is short.\n\t */\n\tcase VT_GETSTATE:\n\t{\n\t\tstruct vt_stat __user *vtstat = up;\n\t\tunsigned short state, mask;\n\n\t\t/* Review: FIXME: Console lock ? */\n\t\tif (put_user(fg_console + 1, &vtstat->v_active))\n\t\t\tret = -EFAULT;\n\t\telse {\n\t\t\tstate = 1;\t/* /dev/tty0 is always open */\n\t\t\tfor (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;\n\t\t\t\t\t\t\t++i, mask <<= 1)\n\t\t\t\tif (vt_in_use(i))\n\t\t\t\t\tstate |= mask;\n\t\t\tret = put_user(state, &vtstat->v_state);\n\t\t}\n\t\tbreak;\n\t}\n\n\t/*\n\t * Returns the first available (non-opened) console.\n\t */\n\tcase VT_OPENQRY:\n\t\t/* FIXME: locking ? - but then this is a stupid API */\n\t\tfor (i = 0; i < MAX_NR_CONSOLES; ++i)\n\t\t\tif (!vt_in_use(i))\n\t\t\t\tbreak;\n\t\tuival = i < MAX_NR_CONSOLES ? (i+1) : -1;\n\t\tgoto setint;\t\t \n\n\t/*\n\t * ioctl(fd, VT_ACTIVATE, num) will cause us to switch to vt # num,\n\t * with num >= 1 (switches to vt 0, our console, are not allowed, just\n\t * to preserve sanity).\n\t */\n\tcase VT_ACTIVATE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (arg == 0 || arg > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse {\n\t\t\targ--;\n\t\t\tconsole_lock();\n\t\t\tret = vc_allocate(arg);\n\t\t\tconsole_unlock();\n\t\t\tif (ret)\n\t\t\t\tbreak;\n\t\t\tset_console(arg);\n\t\t}\n\t\tbreak;\n\n\tcase VT_SETACTIVATE:\n\t{\n\t\tstruct vt_setactivate vsa;\n\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n\t\tif (copy_from_user(&vsa, (struct vt_setactivate __user *)arg,\n\t\t\t\t\tsizeof(struct vt_setactivate))) {\n\t\t\tret = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tif (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse {\n\t\t\tvsa.console = array_index_nospec(vsa.console,\n\t\t\t\t\t\t\t MAX_NR_CONSOLES + 1);\n\t\t\tvsa.console--;\n\t\t\tconsole_lock();\n\t\t\tret = vc_allocate(vsa.console);\n\t\t\tif (ret == 0) {\n\t\t\t\tstruct vc_data *nvc;\n\t\t\t\t/* This is safe providing we don't drop the\n\t\t\t\t console sem between vc_allocate and\n\t\t\t\t finishing referencing nvc */\n\t\t\t\tnvc = vc_cons[vsa.console].d;\n\t\t\t\tnvc->vt_mode = vsa.mode;\n\t\t\t\tnvc->vt_mode.frsig = 0;\n\t\t\t\tput_pid(nvc->vt_pid);\n\t\t\t\tnvc->vt_pid = get_pid(task_pid(current));\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t\tif (ret)\n\t\t\t\tbreak;\n\t\t\t/* Commence switch and lock */\n\t\t\t/* Review set_console locks */\n\t\t\tset_console(vsa.console);\n\t\t}\n\t\tbreak;\n\t}\n\n\t/*\n\t * wait until the specified VT has been activated\n\t */\n\tcase VT_WAITACTIVE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (arg == 0 || arg > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse\n\t\t\tret = vt_waitactive(arg);\n\t\tbreak;\n\n\t/*\n\t * If a vt is under process control, the kernel will not switch to it\n\t * immediately, but postpone the operation until the process calls this\n\t * ioctl, allowing the switch to complete.\n\t *\n\t * According to the X sources this is the behavior:\n\t *\t0:\tpending switch-from not OK\n\t *\t1:\tpending switch-from OK\n\t *\t2:\tcompleted switch-to OK\n\t */\n\tcase VT_RELDISP:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n\t\tconsole_lock();\n\t\tif (vc->vt_mode.mode != VT_PROCESS) {\n\t\t\tconsole_unlock();\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\t\t/*\n\t\t * Switching-from response\n\t\t */\n\t\tif (vc->vt_newvt >= 0) {\n\t\t\tif (arg == 0)\n\t\t\t\t/*\n\t\t\t\t * Switch disallowed, so forget we were trying\n\t\t\t\t * to do it.\n\t\t\t\t */\n\t\t\t\tvc->vt_newvt = -1;\n\n\t\t\telse {\n\t\t\t\t/*\n\t\t\t\t * The current vt has been released, so\n\t\t\t\t * complete the switch.\n\t\t\t\t */\n\t\t\t\tint newvt;\n\t\t\t\tnewvt = vc->vt_newvt;\n\t\t\t\tvc->vt_newvt = -1;\n\t\t\t\tret = vc_allocate(newvt);\n\t\t\t\tif (ret) {\n\t\t\t\t\tconsole_unlock();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * When we actually do the console switch,\n\t\t\t\t * make sure we are atomic with respect to\n\t\t\t\t * other console switches..\n\t\t\t\t */\n\t\t\t\tcomplete_change_console(vc_cons[newvt].d);\n\t\t\t}\n\t\t} else {\n\t\t\t/*\n\t\t\t * Switched-to response\n\t\t\t */\n\t\t\t/*\n\t\t\t * If it's just an ACK, ignore it\n\t\t\t */\n\t\t\tif (arg != VT_ACKACQ)\n\t\t\t\tret = -EINVAL;\n\t\t}\n\t\tconsole_unlock();\n\t\tbreak;\n\n\t /*\n\t * Disallocate memory associated to VT (but leave VT1)\n\t */\n\t case VT_DISALLOCATE:\n\t\tif (arg > MAX_NR_CONSOLES) {\n\t\t\tret = -ENXIO;\n\t\t\tbreak;\n\t\t}\n\t\tif (arg == 0)\n\t\t\tvt_disallocate_all();\n\t\telse\n\t\t\tret = vt_disallocate(--arg);\n\t\tbreak;\n\n\tcase VT_RESIZE:\n\t{\n\t\tstruct vt_sizes __user *vtsizes = up;\n\t\tstruct vc_data *vc;\n\n\t\tushort ll,cc;\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (get_user(ll, &vtsizes->v_rows) ||\n\t\t get_user(cc, &vtsizes->v_cols))\n\t\t\tret = -EFAULT;\n\t\telse {\n\t\t\tconsole_lock();\n\t\t\tfor (i = 0; i < MAX_NR_CONSOLES; i++) {\n\t\t\t\tvc = vc_cons[i].d;\n\n\t\t\t\tif (vc) {\n\t\t\t\t\tvc->vc_resize_user = 1;\n\t\t\t\t\t/* FIXME: review v tty lock */\n\t\t\t\t\tvc_resize(vc_cons[i].d, cc, ll);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase VT_RESIZEX:\n\t{\n\t\tstruct vt_consize v;\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (copy_from_user(&v, up, sizeof(struct vt_consize)))\n\t\t\treturn -EFAULT;\n\t\t/* FIXME: Should check the copies properly */\n\t\tif (!v.v_vlin)\n\t\t\tv.v_vlin = vc->vc_scan_lines;\n\t\tif (v.v_clin) {\n\t\t\tint rows = v.v_vlin/v.v_clin;\n\t\t\tif (v.v_rows != rows) {\n\t\t\t\tif (v.v_rows) /* Parameters don't add up */\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\tv.v_rows = rows;\n\t\t\t}\n\t\t}\n\t\tif (v.v_vcol && v.v_ccol) {\n\t\t\tint cols = v.v_vcol/v.v_ccol;\n\t\t\tif (v.v_cols != cols) {\n\t\t\t\tif (v.v_cols)\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\tv.v_cols = cols;\n\t\t\t}\n\t\t}\n\n\t\tif (v.v_clin > 32)\n\t\t\treturn -EINVAL;\n\n\t\tfor (i = 0; i < MAX_NR_CONSOLES; i++) {\n\t\t\tstruct vc_data *vcp;\n\n\t\t\tif (!vc_cons[i].d)\n\t\t\t\tcontinue;\n\t\t\tconsole_lock();\n\t\t\tvcp = vc_cons[i].d;\n\t\t\tif (vcp) {\n\t\t\t\tif (v.v_vlin)\n\t\t\t\t\tvcp->vc_scan_lines = v.v_vlin;\n\t\t\t\tif (v.v_clin)\n\t\t\t\t\tvcp->vc_font.height = v.v_clin;\n\t\t\t\tvcp->vc_resize_user = 1;\n\t\t\t\tvc_resize(vcp, v.v_cols, v.v_rows);\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase PIO_FONT: {\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\top.op = KD_FONT_OP_SET;\n\t\top.flags = KD_FONT_FLAG_OLD | KD_FONT_FLAG_DONT_RECALC;\t/* Compatibility */\n\t\top.width = 8;\n\t\top.height = 0;\n\t\top.charcount = 256;\n\t\top.data = up;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tbreak;\n\t}\n\n\tcase GIO_FONT: {\n\t\top.op = KD_FONT_OP_GET;\n\t\top.flags = KD_FONT_FLAG_OLD;\n\t\top.width = 8;\n\t\top.height = 32;\n\t\top.charcount = 256;\n\t\top.data = up;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tbreak;\n\t}\n\n\tcase PIO_CMAP:\n if (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t ret = con_set_cmap(up);\n\t\tbreak;\n\n\tcase GIO_CMAP:\n ret = con_get_cmap(up);\n\t\tbreak;\n\n\tcase PIO_FONTX:\n\tcase GIO_FONTX:\n\t\tret = do_fontx_ioctl(cmd, up, perm, &op);\n\t\tbreak;\n\n\tcase PIO_FONTRESET:\n\t{\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n#ifdef BROKEN_GRAPHICS_PROGRAMS\n\t\t/* With BROKEN_GRAPHICS_PROGRAMS defined, the default\n\t\t font is not saved. */\n\t\tret = -ENOSYS;\n\t\tbreak;\n#else\n\t\t{\n\t\top.op = KD_FONT_OP_SET_DEFAULT;\n\t\top.data = NULL;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tconsole_lock();\n\t\tcon_set_default_unimap(vc_cons[fg_console].d);\n\t\tconsole_unlock();\n\t\tbreak;\n\t\t}\n#endif\n\t}\n\n\tcase KDFONTOP: {\n\t\tif (copy_from_user(&op, up, sizeof(op))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tif (!perm && op.op != KD_FONT_OP_GET)\n\t\t\treturn -EPERM;\n\t\tret = con_font_op(vc, &op);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tif (copy_to_user(up, &op, sizeof(op)))\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\tcase PIO_SCRNMAP:\n\t\tif (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t\t\tret = con_set_trans_old(up);\n\t\tbreak;\n\n\tcase GIO_SCRNMAP:\n\t\tret = con_get_trans_old(up);\n\t\tbreak;\n\n\tcase PIO_UNISCRNMAP:\n\t\tif (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t\t\tret = con_set_trans_new(up);\n\t\tbreak;\n\n\tcase GIO_UNISCRNMAP:\n\t\tret = con_get_trans_new(up);\n\t\tbreak;\n\n\tcase PIO_UNIMAPCLR:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tcon_clear_unimap(vc);\n\t\tbreak;\n\n\tcase PIO_UNIMAP:\n\tcase GIO_UNIMAP:\n\t\tret = do_unimap_ioctl(cmd, up, perm, vc);\n\t\tbreak;\n\n\tcase VT_LOCKSWITCH:\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\t\tvt_dont_switch = true;\n\t\tbreak;\n\tcase VT_UNLOCKSWITCH:\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\t\tvt_dont_switch = false;\n\t\tbreak;\n\tcase VT_GETHIFONTMASK:\n\t\tret = put_user(vc->vc_hi_font_mask,\n\t\t\t\t\t(unsigned short __user *)arg);\n\t\tbreak;\n\tcase VT_WAITEVENT:\n\t\tret = vt_event_wait_ioctl((struct vt_event __user *)arg);\n\t\tbreak;\n\tdefault:\n\t\tret = -ENOIOCTLCMD;\n\t}\nout:\n\treturn ret;\n}",
  4945. "project": "linux",
  4946. "hash": 72552578102473405630135883744841071721,
  4947. "size": 692,
  4948. "commit_id": "ca4463bf8438b403596edd0ec961ca0d4fbe0220",
  4949. "message": "vt: vt_ioctl: fix VT_DISALLOCATE freeing in-use virtual console\n\nThe VT_DISALLOCATE ioctl can free a virtual console while tty_release()\nis still running, causing a use-after-free in con_shutdown(). This\noccurs because VT_DISALLOCATE considers a virtual console's\n'struct vc_data' to be unused as soon as the corresponding tty's\nrefcount hits 0. But actually it may be still being closed.\n\nFix this by making vc_data be reference-counted via the embedded\n'struct tty_port'. A newly allocated virtual console has refcount 1.\nOpening it for the first time increments the refcount to 2. Closing it\nfor the last time decrements the refcount (in tty_operations::cleanup()\nso that it happens late enough), as does VT_DISALLOCATE.\n\nReproducer:\n\t#include <fcntl.h>\n\t#include <linux/vt.h>\n\t#include <sys/ioctl.h>\n\t#include <unistd.h>\n\n\tint main()\n\t{\n\t\tif (fork()) {\n\t\t\tfor (;;)\n\t\t\t\tclose(open(\"/dev/tty5\", O_RDWR));\n\t\t} else {\n\t\t\tint fd = open(\"/dev/tty10\", O_RDWR);\n\n\t\t\tfor (;;)\n\t\t\t\tioctl(fd, VT_DISALLOCATE, 5);\n\t\t}\n\t}\n\nKASAN report:\n\tBUG: KASAN: use-after-free in con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3278\n\tWrite of size 8 at addr ffff88806a4ec108 by task syz_vt/129\n\n\tCPU: 0 PID: 129 Comm: syz_vt Not tainted 5.6.0-rc2 #11\n\tHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20191223_100556-anatol 04/01/2014\n\tCall Trace:\n\t [...]\n\t con_shutdown+0x76/0x80 drivers/tty/vt/vt.c:3278\n\t release_tty+0xa8/0x410 drivers/tty/tty_io.c:1514\n\t tty_release_struct+0x34/0x50 drivers/tty/tty_io.c:1629\n\t tty_release+0x984/0xed0 drivers/tty/tty_io.c:1789\n\t [...]\n\n\tAllocated by task 129:\n\t [...]\n\t kzalloc include/linux/slab.h:669 [inline]\n\t vc_allocate drivers/tty/vt/vt.c:1085 [inline]\n\t vc_allocate+0x1ac/0x680 drivers/tty/vt/vt.c:1066\n\t con_install+0x4d/0x3f0 drivers/tty/vt/vt.c:3229\n\t tty_driver_install_tty drivers/tty/tty_io.c:1228 [inline]\n\t tty_init_dev+0x94/0x350 drivers/tty/tty_io.c:1341\n\t tty_open_by_driver drivers/tty/tty_io.c:1987 [inline]\n\t tty_open+0x3ca/0xb30 drivers/tty/tty_io.c:2035\n\t [...]\n\n\tFreed by task 130:\n\t [...]\n\t kfree+0xbf/0x1e0 mm/slab.c:3757\n\t vt_disallocate drivers/tty/vt/vt_ioctl.c:300 [inline]\n\t vt_ioctl+0x16dc/0x1e30 drivers/tty/vt/vt_ioctl.c:818\n\t tty_ioctl+0x9db/0x11b0 drivers/tty/tty_io.c:2660\n\t [...]\n\nFixes: 4001d7b7fc27 (\"vt: push down the tty lock so we can see what is left to tackle\")\nCc: <stable@vger.kernel.org> # v3.4+\nReported-by: syzbot+522643ab5729b0421998@syzkaller.appspotmail.com\nAcked-by: Jiri Slaby <jslaby@suse.cz>\nSigned-off-by: Eric Biggers <ebiggers@google.com>\nLink: https://lore.kernel.org/r/20200322034305.210082-2-ebiggers@kernel.org\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4950. "target": 0,
  4951. "dataset": "other",
  4952. "idx": 437046
  4953. },
  4954. {
  4955. "func": "int vt_ioctl(struct tty_struct *tty,\n\t unsigned int cmd, unsigned long arg)\n{\n\tstruct vc_data *vc = tty->driver_data;\n\tstruct console_font_op op;\t/* used in multiple places here */\n\tunsigned int console;\n\tunsigned char ucval;\n\tunsigned int uival;\n\tvoid __user *up = (void __user *)arg;\n\tint i, perm;\n\tint ret = 0;\n\n\tconsole = vc->vc_num;\n\n\n\tif (!vc_cons_allocated(console)) { \t/* impossible? */\n\t\tret = -ENOIOCTLCMD;\n\t\tgoto out;\n\t}\n\n\n\t/*\n\t * To have permissions to do most of the vt ioctls, we either have\n\t * to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.\n\t */\n\tperm = 0;\n\tif (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))\n\t\tperm = 1;\n \n\tswitch (cmd) {\n\tcase TIOCLINUX:\n\t\tret = tioclinux(tty, arg);\n\t\tbreak;\n\tcase KIOCSOUND:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\t/*\n\t\t * The use of PIT_TICK_RATE is historic, it used to be\n\t\t * the platform-dependent CLOCK_TICK_RATE between 2.6.12\n\t\t * and 2.6.36, which was a minor but unfortunate ABI\n\t\t * change. kd_mksound is locked by the input layer.\n\t\t */\n\t\tif (arg)\n\t\t\targ = PIT_TICK_RATE / arg;\n\t\tkd_mksound(arg, 0);\n\t\tbreak;\n\n\tcase KDMKTONE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t{\n\t\tunsigned int ticks, count;\n\t\t\n\t\t/*\n\t\t * Generate the tone for the appropriate number of ticks.\n\t\t * If the time is zero, turn off sound ourselves.\n\t\t */\n\t\tticks = msecs_to_jiffies((arg >> 16) & 0xffff);\n\t\tcount = ticks ? (arg & 0xffff) : 0;\n\t\tif (count)\n\t\t\tcount = PIT_TICK_RATE / count;\n\t\tkd_mksound(count, ticks);\n\t\tbreak;\n\t}\n\n\tcase KDGKBTYPE:\n\t\t/*\n\t\t * this is naïve.\n\t\t */\n\t\tucval = KB_101;\n\t\tret = put_user(ucval, (char __user *)arg);\n\t\tbreak;\n\n\t\t/*\n\t\t * These cannot be implemented on any machine that implements\n\t\t * ioperm() in user level (such as Alpha PCs) or not at all.\n\t\t *\n\t\t * XXX: you should never use these, just call ioperm directly..\n\t\t */\n#ifdef CONFIG_X86\n\tcase KDADDIO:\n\tcase KDDELIO:\n\t\t/*\n\t\t * KDADDIO and KDDELIO may be able to add ports beyond what\n\t\t * we reject here, but to be safe...\n\t\t *\n\t\t * These are locked internally via sys_ioperm\n\t\t */\n\t\tif (arg < GPFIRST || arg > GPLAST) {\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\t\tret = ksys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0;\n\t\tbreak;\n\n\tcase KDENABIO:\n\tcase KDDISABIO:\n\t\tret = ksys_ioperm(GPFIRST, GPNUM,\n\t\t\t\t (cmd == KDENABIO)) ? -ENXIO : 0;\n\t\tbreak;\n#endif\n\n\t/* Linux m68k/i386 interface for setting the keyboard delay/repeat rate */\n\t\t\n\tcase KDKBDREP:\n\t{\n\t\tstruct kbd_repeat kbrep;\n\t\t\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\n\t\tif (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tret = kbd_rate(&kbrep);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tif (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\tcase KDSETMODE:\n\t\t/*\n\t\t * currently, setting the mode from KD_TEXT to KD_GRAPHICS\n\t\t * doesn't do a whole lot. i'm not sure if it should do any\n\t\t * restoration of modes or what...\n\t\t *\n\t\t * XXX It should at least call into the driver, fbdev's definitely\n\t\t * need to restore their engine state. --BenH\n\t\t */\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tswitch (arg) {\n\t\tcase KD_GRAPHICS:\n\t\t\tbreak;\n\t\tcase KD_TEXT0:\n\t\tcase KD_TEXT1:\n\t\t\targ = KD_TEXT;\n\t\tcase KD_TEXT:\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tret = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\t/* FIXME: this needs the console lock extending */\n\t\tif (vc->vc_mode == (unsigned char) arg)\n\t\t\tbreak;\n\t\tvc->vc_mode = (unsigned char) arg;\n\t\tif (console != fg_console)\n\t\t\tbreak;\n\t\t/*\n\t\t * explicitly blank/unblank the screen if switching modes\n\t\t */\n\t\tconsole_lock();\n\t\tif (arg == KD_TEXT)\n\t\t\tdo_unblank_screen(1);\n\t\telse\n\t\t\tdo_blank_screen(1);\n\t\tconsole_unlock();\n\t\tbreak;\n\n\tcase KDGETMODE:\n\t\tuival = vc->vc_mode;\n\t\tgoto setint;\n\n\tcase KDMAPDISP:\n\tcase KDUNMAPDISP:\n\t\t/*\n\t\t * these work like a combination of mmap and KDENABIO.\n\t\t * this could be easily finished.\n\t\t */\n\t\tret = -EINVAL;\n\t\tbreak;\n\n\tcase KDSKBMODE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tret = vt_do_kdskbmode(console, arg);\n\t\tif (ret == 0)\n\t\t\ttty_ldisc_flush(tty);\n\t\tbreak;\n\n\tcase KDGKBMODE:\n\t\tuival = vt_do_kdgkbmode(console);\n\t\tret = put_user(uival, (int __user *)arg);\n\t\tbreak;\n\n\t/* this could be folded into KDSKBMODE, but for compatibility\n\t reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */\n\tcase KDSKBMETA:\n\t\tret = vt_do_kdskbmeta(console, arg);\n\t\tbreak;\n\n\tcase KDGKBMETA:\n\t\t/* FIXME: should review whether this is worth locking */\n\t\tuival = vt_do_kdgkbmeta(console);\n\tsetint:\n\t\tret = put_user(uival, (int __user *)arg);\n\t\tbreak;\n\n\tcase KDGETKEYCODE:\n\tcase KDSETKEYCODE:\n\t\tif(!capable(CAP_SYS_TTY_CONFIG))\n\t\t\tperm = 0;\n\t\tret = vt_do_kbkeycode_ioctl(cmd, up, perm);\n\t\tbreak;\n\n\tcase KDGKBENT:\n\tcase KDSKBENT:\n\t\tret = vt_do_kdsk_ioctl(cmd, up, perm, console);\n\t\tbreak;\n\n\tcase KDGKBSENT:\n\tcase KDSKBSENT:\n\t\tret = vt_do_kdgkb_ioctl(cmd, up, perm);\n\t\tbreak;\n\n\t/* Diacritical processing. Handled in keyboard.c as it has\n\t to operate on the keyboard locks and structures */\n\tcase KDGKBDIACR:\n\tcase KDGKBDIACRUC:\n\tcase KDSKBDIACR:\n\tcase KDSKBDIACRUC:\n\t\tret = vt_do_diacrit(cmd, up, perm);\n\t\tbreak;\n\n\t/* the ioctls below read/set the flags usually shown in the leds */\n\t/* don't use them - they will go away without warning */\n\tcase KDGKBLED:\n\tcase KDSKBLED:\n\tcase KDGETLED:\n\tcase KDSETLED:\n\t\tret = vt_do_kdskled(console, cmd, arg, perm);\n\t\tbreak;\n\n\t/*\n\t * A process can indicate its willingness to accept signals\n\t * generated by pressing an appropriate key combination.\n\t * Thus, one can have a daemon that e.g. spawns a new console\n\t * upon a keypress and then changes to it.\n\t * See also the kbrequest field of inittab(5).\n\t */\n\tcase KDSIGACCEPT:\n\t{\n\t\tif (!perm || !capable(CAP_KILL))\n\t\t\treturn -EPERM;\n\t\tif (!valid_signal(arg) || arg < 1 || arg == SIGKILL)\n\t\t\tret = -EINVAL;\n\t\telse {\n\t\t\tspin_lock_irq(&vt_spawn_con.lock);\n\t\t\tput_pid(vt_spawn_con.pid);\n\t\t\tvt_spawn_con.pid = get_pid(task_pid(current));\n\t\t\tvt_spawn_con.sig = arg;\n\t\t\tspin_unlock_irq(&vt_spawn_con.lock);\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase VT_SETMODE:\n\t{\n\t\tstruct vt_mode tmp;\n\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (copy_from_user(&tmp, up, sizeof(struct vt_mode))) {\n\t\t\tret = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tif (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) {\n\t\t\tret = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\tconsole_lock();\n\t\tvc->vt_mode = tmp;\n\t\t/* the frsig is ignored, so we set it to 0 */\n\t\tvc->vt_mode.frsig = 0;\n\t\tput_pid(vc->vt_pid);\n\t\tvc->vt_pid = get_pid(task_pid(current));\n\t\t/* no switch is required -- saw@shade.msu.ru */\n\t\tvc->vt_newvt = -1;\n\t\tconsole_unlock();\n\t\tbreak;\n\t}\n\n\tcase VT_GETMODE:\n\t{\n\t\tstruct vt_mode tmp;\n\t\tint rc;\n\n\t\tconsole_lock();\n\t\tmemcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));\n\t\tconsole_unlock();\n\n\t\trc = copy_to_user(up, &tmp, sizeof(struct vt_mode));\n\t\tif (rc)\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\t/*\n\t * Returns global vt state. Note that VT 0 is always open, since\n\t * it's an alias for the current VT, and people can't use it here.\n\t * We cannot return state for more than 16 VTs, since v_state is short.\n\t */\n\tcase VT_GETSTATE:\n\t{\n\t\tstruct vt_stat __user *vtstat = up;\n\t\tunsigned short state, mask;\n\n\t\t/* Review: FIXME: Console lock ? */\n\t\tif (put_user(fg_console + 1, &vtstat->v_active))\n\t\t\tret = -EFAULT;\n\t\telse {\n\t\t\tstate = 1;\t/* /dev/tty0 is always open */\n\t\t\tfor (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;\n\t\t\t\t\t\t\t++i, mask <<= 1)\n\t\t\t\tif (VT_IS_IN_USE(i))\n\t\t\t\t\tstate |= mask;\n\t\t\tret = put_user(state, &vtstat->v_state);\n\t\t}\n\t\tbreak;\n\t}\n\n\t/*\n\t * Returns the first available (non-opened) console.\n\t */\n\tcase VT_OPENQRY:\n\t\t/* FIXME: locking ? - but then this is a stupid API */\n\t\tfor (i = 0; i < MAX_NR_CONSOLES; ++i)\n\t\t\tif (! VT_IS_IN_USE(i))\n\t\t\t\tbreak;\n\t\tuival = i < MAX_NR_CONSOLES ? (i+1) : -1;\n\t\tgoto setint;\t\t \n\n\t/*\n\t * ioctl(fd, VT_ACTIVATE, num) will cause us to switch to vt # num,\n\t * with num >= 1 (switches to vt 0, our console, are not allowed, just\n\t * to preserve sanity).\n\t */\n\tcase VT_ACTIVATE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (arg == 0 || arg > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse {\n\t\t\targ--;\n\t\t\tconsole_lock();\n\t\t\tret = vc_allocate(arg);\n\t\t\tconsole_unlock();\n\t\t\tif (ret)\n\t\t\t\tbreak;\n\t\t\tset_console(arg);\n\t\t}\n\t\tbreak;\n\n\tcase VT_SETACTIVATE:\n\t{\n\t\tstruct vt_setactivate vsa;\n\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n\t\tif (copy_from_user(&vsa, (struct vt_setactivate __user *)arg,\n\t\t\t\t\tsizeof(struct vt_setactivate))) {\n\t\t\tret = -EFAULT;\n\t\t\tgoto out;\n\t\t}\n\t\tif (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse {\n\t\t\tvsa.console = array_index_nospec(vsa.console,\n\t\t\t\t\t\t\t MAX_NR_CONSOLES + 1);\n\t\t\tvsa.console--;\n\t\t\tconsole_lock();\n\t\t\tret = vc_allocate(vsa.console);\n\t\t\tif (ret == 0) {\n\t\t\t\tstruct vc_data *nvc;\n\t\t\t\t/* This is safe providing we don't drop the\n\t\t\t\t console sem between vc_allocate and\n\t\t\t\t finishing referencing nvc */\n\t\t\t\tnvc = vc_cons[vsa.console].d;\n\t\t\t\tnvc->vt_mode = vsa.mode;\n\t\t\t\tnvc->vt_mode.frsig = 0;\n\t\t\t\tput_pid(nvc->vt_pid);\n\t\t\t\tnvc->vt_pid = get_pid(task_pid(current));\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t\tif (ret)\n\t\t\t\tbreak;\n\t\t\t/* Commence switch and lock */\n\t\t\t/* Review set_console locks */\n\t\t\tset_console(vsa.console);\n\t\t}\n\t\tbreak;\n\t}\n\n\t/*\n\t * wait until the specified VT has been activated\n\t */\n\tcase VT_WAITACTIVE:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (arg == 0 || arg > MAX_NR_CONSOLES)\n\t\t\tret = -ENXIO;\n\t\telse\n\t\t\tret = vt_waitactive(arg);\n\t\tbreak;\n\n\t/*\n\t * If a vt is under process control, the kernel will not switch to it\n\t * immediately, but postpone the operation until the process calls this\n\t * ioctl, allowing the switch to complete.\n\t *\n\t * According to the X sources this is the behavior:\n\t *\t0:\tpending switch-from not OK\n\t *\t1:\tpending switch-from OK\n\t *\t2:\tcompleted switch-to OK\n\t */\n\tcase VT_RELDISP:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n\t\tconsole_lock();\n\t\tif (vc->vt_mode.mode != VT_PROCESS) {\n\t\t\tconsole_unlock();\n\t\t\tret = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\t\t/*\n\t\t * Switching-from response\n\t\t */\n\t\tif (vc->vt_newvt >= 0) {\n\t\t\tif (arg == 0)\n\t\t\t\t/*\n\t\t\t\t * Switch disallowed, so forget we were trying\n\t\t\t\t * to do it.\n\t\t\t\t */\n\t\t\t\tvc->vt_newvt = -1;\n\n\t\t\telse {\n\t\t\t\t/*\n\t\t\t\t * The current vt has been released, so\n\t\t\t\t * complete the switch.\n\t\t\t\t */\n\t\t\t\tint newvt;\n\t\t\t\tnewvt = vc->vt_newvt;\n\t\t\t\tvc->vt_newvt = -1;\n\t\t\t\tret = vc_allocate(newvt);\n\t\t\t\tif (ret) {\n\t\t\t\t\tconsole_unlock();\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/*\n\t\t\t\t * When we actually do the console switch,\n\t\t\t\t * make sure we are atomic with respect to\n\t\t\t\t * other console switches..\n\t\t\t\t */\n\t\t\t\tcomplete_change_console(vc_cons[newvt].d);\n\t\t\t}\n\t\t} else {\n\t\t\t/*\n\t\t\t * Switched-to response\n\t\t\t */\n\t\t\t/*\n\t\t\t * If it's just an ACK, ignore it\n\t\t\t */\n\t\t\tif (arg != VT_ACKACQ)\n\t\t\t\tret = -EINVAL;\n\t\t}\n\t\tconsole_unlock();\n\t\tbreak;\n\n\t /*\n\t * Disallocate memory associated to VT (but leave VT1)\n\t */\n\t case VT_DISALLOCATE:\n\t\tif (arg > MAX_NR_CONSOLES) {\n\t\t\tret = -ENXIO;\n\t\t\tbreak;\n\t\t}\n\t\tif (arg == 0)\n\t\t\tvt_disallocate_all();\n\t\telse\n\t\t\tret = vt_disallocate(--arg);\n\t\tbreak;\n\n\tcase VT_RESIZE:\n\t{\n\t\tstruct vt_sizes __user *vtsizes = up;\n\t\tstruct vc_data *vc;\n\n\t\tushort ll,cc;\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (get_user(ll, &vtsizes->v_rows) ||\n\t\t get_user(cc, &vtsizes->v_cols))\n\t\t\tret = -EFAULT;\n\t\telse {\n\t\t\tconsole_lock();\n\t\t\tfor (i = 0; i < MAX_NR_CONSOLES; i++) {\n\t\t\t\tvc = vc_cons[i].d;\n\n\t\t\t\tif (vc) {\n\t\t\t\t\tvc->vc_resize_user = 1;\n\t\t\t\t\t/* FIXME: review v tty lock */\n\t\t\t\t\tvc_resize(vc_cons[i].d, cc, ll);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase VT_RESIZEX:\n\t{\n\t\tstruct vt_consize v;\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tif (copy_from_user(&v, up, sizeof(struct vt_consize)))\n\t\t\treturn -EFAULT;\n\t\t/* FIXME: Should check the copies properly */\n\t\tif (!v.v_vlin)\n\t\t\tv.v_vlin = vc->vc_scan_lines;\n\t\tif (v.v_clin) {\n\t\t\tint rows = v.v_vlin/v.v_clin;\n\t\t\tif (v.v_rows != rows) {\n\t\t\t\tif (v.v_rows) /* Parameters don't add up */\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\tv.v_rows = rows;\n\t\t\t}\n\t\t}\n\t\tif (v.v_vcol && v.v_ccol) {\n\t\t\tint cols = v.v_vcol/v.v_ccol;\n\t\t\tif (v.v_cols != cols) {\n\t\t\t\tif (v.v_cols)\n\t\t\t\t\treturn -EINVAL;\n\t\t\t\tv.v_cols = cols;\n\t\t\t}\n\t\t}\n\n\t\tif (v.v_clin > 32)\n\t\t\treturn -EINVAL;\n\n\t\tfor (i = 0; i < MAX_NR_CONSOLES; i++) {\n\t\t\tstruct vc_data *vcp;\n\n\t\t\tif (!vc_cons[i].d)\n\t\t\t\tcontinue;\n\t\t\tconsole_lock();\n\t\t\tvcp = vc_cons[i].d;\n\t\t\tif (vcp) {\n\t\t\t\tif (v.v_vlin)\n\t\t\t\t\tvcp->vc_scan_lines = v.v_vlin;\n\t\t\t\tif (v.v_clin)\n\t\t\t\t\tvcp->vc_font.height = v.v_clin;\n\t\t\t\tvcp->vc_resize_user = 1;\n\t\t\t\tvc_resize(vcp, v.v_cols, v.v_rows);\n\t\t\t}\n\t\t\tconsole_unlock();\n\t\t}\n\t\tbreak;\n\t}\n\n\tcase PIO_FONT: {\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\top.op = KD_FONT_OP_SET;\n\t\top.flags = KD_FONT_FLAG_OLD | KD_FONT_FLAG_DONT_RECALC;\t/* Compatibility */\n\t\top.width = 8;\n\t\top.height = 0;\n\t\top.charcount = 256;\n\t\top.data = up;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tbreak;\n\t}\n\n\tcase GIO_FONT: {\n\t\top.op = KD_FONT_OP_GET;\n\t\top.flags = KD_FONT_FLAG_OLD;\n\t\top.width = 8;\n\t\top.height = 32;\n\t\top.charcount = 256;\n\t\top.data = up;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tbreak;\n\t}\n\n\tcase PIO_CMAP:\n if (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t ret = con_set_cmap(up);\n\t\tbreak;\n\n\tcase GIO_CMAP:\n ret = con_get_cmap(up);\n\t\tbreak;\n\n\tcase PIO_FONTX:\n\tcase GIO_FONTX:\n\t\tret = do_fontx_ioctl(cmd, up, perm, &op);\n\t\tbreak;\n\n\tcase PIO_FONTRESET:\n\t{\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\n#ifdef BROKEN_GRAPHICS_PROGRAMS\n\t\t/* With BROKEN_GRAPHICS_PROGRAMS defined, the default\n\t\t font is not saved. */\n\t\tret = -ENOSYS;\n\t\tbreak;\n#else\n\t\t{\n\t\top.op = KD_FONT_OP_SET_DEFAULT;\n\t\top.data = NULL;\n\t\tret = con_font_op(vc_cons[fg_console].d, &op);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tconsole_lock();\n\t\tcon_set_default_unimap(vc_cons[fg_console].d);\n\t\tconsole_unlock();\n\t\tbreak;\n\t\t}\n#endif\n\t}\n\n\tcase KDFONTOP: {\n\t\tif (copy_from_user(&op, up, sizeof(op))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tif (!perm && op.op != KD_FONT_OP_GET)\n\t\t\treturn -EPERM;\n\t\tret = con_font_op(vc, &op);\n\t\tif (ret)\n\t\t\tbreak;\n\t\tif (copy_to_user(up, &op, sizeof(op)))\n\t\t\tret = -EFAULT;\n\t\tbreak;\n\t}\n\n\tcase PIO_SCRNMAP:\n\t\tif (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t\t\tret = con_set_trans_old(up);\n\t\tbreak;\n\n\tcase GIO_SCRNMAP:\n\t\tret = con_get_trans_old(up);\n\t\tbreak;\n\n\tcase PIO_UNISCRNMAP:\n\t\tif (!perm)\n\t\t\tret = -EPERM;\n\t\telse\n\t\t\tret = con_set_trans_new(up);\n\t\tbreak;\n\n\tcase GIO_UNISCRNMAP:\n\t\tret = con_get_trans_new(up);\n\t\tbreak;\n\n\tcase PIO_UNIMAPCLR:\n\t\tif (!perm)\n\t\t\treturn -EPERM;\n\t\tcon_clear_unimap(vc);\n\t\tbreak;\n\n\tcase PIO_UNIMAP:\n\tcase GIO_UNIMAP:\n\t\tret = do_unimap_ioctl(cmd, up, perm, vc);\n\t\tbreak;\n\n\tcase VT_LOCKSWITCH:\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\t\tvt_dont_switch = 1;\n\t\tbreak;\n\tcase VT_UNLOCKSWITCH:\n\t\tif (!capable(CAP_SYS_TTY_CONFIG))\n\t\t\treturn -EPERM;\n\t\tvt_dont_switch = 0;\n\t\tbreak;\n\tcase VT_GETHIFONTMASK:\n\t\tret = put_user(vc->vc_hi_font_mask,\n\t\t\t\t\t(unsigned short __user *)arg);\n\t\tbreak;\n\tcase VT_WAITEVENT:\n\t\tret = vt_event_wait_ioctl((struct vt_event __user *)arg);\n\t\tbreak;\n\tdefault:\n\t\tret = -ENOIOCTLCMD;\n\t}\nout:\n\treturn ret;\n}",
  4956. "project": "linux",
  4957. "hash": 188901637298738474521041844492795398881,
  4958. "size": 701,
  4959. "commit_id": "6cd1ed50efd88261298577cd92a14f2768eddeeb",
  4960. "message": "vt: vt_ioctl: fix race in VT_RESIZEX\n\nWe need to make sure vc_cons[i].d is not NULL after grabbing\nconsole_lock(), or risk a crash.\n\ngeneral protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN\nKASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]\nCPU: 1 PID: 19462 Comm: syz-executor.5 Not tainted 5.5.0-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\nCall Trace:\n tty_ioctl+0xa37/0x14f0 drivers/tty/tty_io.c:2660\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0x123/0x180 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x45b399\nCode: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007f7d13c11c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 00007f7d13c126d4 RCX: 000000000045b399\nRDX: 0000000020000080 RSI: 000000000000560a RDI: 0000000000000003\nRBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff\nR13: 0000000000000666 R14: 00000000004c7f04 R15: 000000000075bf2c\nModules linked in:\n---[ end trace 80970faf7a67eb77 ]---\nRIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883\nCode: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40\nRSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202\nRAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000\nRDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340\nRBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d\nR10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d\nR13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f\nFS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000\nCS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033\nCR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0\nDR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000\nDR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400\n\nFixes: 1da177e4c3f4 (\"Linux-2.6.12-rc2\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: stable <stable@vger.kernel.org>\nReported-by: syzbot <syzkaller@googlegroups.com>\nLink: https://lore.kernel.org/r/20200210190721.200418-1-edumazet@google.com\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  4961. "target": 0,
  4962. "dataset": "other",
  4963. "idx": 458189
  4964. }
  4965. ]
  4966. },
  4967. {
  4968. "call_depth": 4,
  4969. "longest_call_chain": [
  4970. "removeServiceTable",
  4971. "freeService",
  4972. "freeSubscriptionList",
  4973. "freeSubscription"
  4974. ],
  4975. "group_size": 11,
  4976. "functions": [
  4977. {
  4978. "func": "DOMString getElementValue(IXML_Node *node)\n{\n\tIXML_Node *child = (IXML_Node *)ixmlNode_getFirstChild(node);\n\tconst DOMString temp = NULL;\n\n\tif (child && ixmlNode_getNodeType(child) == eTEXT_NODE) {\n\t\ttemp = ixmlNode_getNodeValue(child);\n\n\t\treturn ixmlCloneDOMString(temp);\n\t} else {\n\t\treturn NULL;\n\t}\n}",
  4979. "project": "pupnp",
  4980. "hash": 248963931478249921935728461291453646516,
  4981. "size": 13,
  4982. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  4983. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  4984. "target": 0,
  4985. "dataset": "other",
  4986. "idx": 269111
  4987. },
  4988. {
  4989. "func": "void freeServiceList(service_info *head)\n{\n\tservice_info *next = NULL;\n\n\twhile (head) {\n\t\tif (head->serviceType)\n\t\t\tixmlFreeDOMString(head->serviceType);\n\t\tif (head->serviceId)\n\t\t\tixmlFreeDOMString(head->serviceId);\n\t\tif (head->SCPDURL)\n\t\t\tfree(head->SCPDURL);\n\t\tif (head->controlURL)\n\t\t\tfree(head->controlURL);\n\t\tif (head->eventURL)\n\t\t\tfree(head->eventURL);\n\t\tif (head->UDN)\n\t\t\tixmlFreeDOMString(head->UDN);\n\t\tif (head->subscriptionList)\n\t\t\tfreeSubscriptionList(head->subscriptionList);\n\n\t\thead->TotalSubscriptions = 0;\n\t\tnext = head->next;\n\t\tfree(head);\n\t\thead = next;\n\t}\n}",
  4990. "project": "pupnp",
  4991. "hash": 135565784073126001774038307721809943269,
  4992. "size": 26,
  4993. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  4994. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  4995. "target": 0,
  4996. "dataset": "other",
  4997. "idx": 269098
  4998. },
  4999. {
  5000. "func": "void RemoveSubscriptionSID(Upnp_SID sid, service_info *service)\n{\n\tsubscription *finger = service->subscriptionList;\n\tsubscription *previous = NULL;\n\n\twhile (finger) {\n\t\tif (!strcmp(sid, finger->sid)) {\n\t\t\tif (previous) {\n\t\t\t\tprevious->next = finger->next;\n\t\t\t} else {\n\t\t\t\tservice->subscriptionList = finger->next;\n\t\t\t}\n\t\t\tfinger->next = NULL;\n\t\t\tfreeSubscriptionList(finger);\n\t\t\tfinger = NULL;\n\t\t\tservice->TotalSubscriptions--;\n\t\t} else {\n\t\t\tprevious = finger;\n\t\t\tfinger = finger->next;\n\t\t}\n\t}\n}",
  5001. "project": "pupnp",
  5002. "hash": 308857782096118505859637858428697989434,
  5003. "size": 22,
  5004. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5005. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5006. "target": 0,
  5007. "dataset": "other",
  5008. "idx": 269106
  5009. },
  5010. {
  5011. "func": "int getSubElement(const char *element_name, IXML_Node *node, IXML_Node **out)\n{\n\tconst DOMString NodeName = NULL;\n\tint found = 0;\n\tIXML_Node *child = (IXML_Node *)ixmlNode_getFirstChild(node);\n\n\t(*out) = NULL;\n\twhile (child && !found) {\n\t\tswitch (ixmlNode_getNodeType(child)) {\n\t\tcase eELEMENT_NODE:\n\t\t\tNodeName = ixmlNode_getNodeName(child);\n\t\t\tif (!strcmp(NodeName, element_name)) {\n\t\t\t\t(*out) = child;\n\t\t\t\tfound = 1;\n\t\t\t\treturn found;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t\tchild = (IXML_Node *)ixmlNode_getNextSibling(child);\n\t}\n\n\treturn found;\n}",
  5012. "project": "pupnp",
  5013. "hash": 130033586932793095968088401711419811378,
  5014. "size": 25,
  5015. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5016. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5017. "target": 0,
  5018. "dataset": "other",
  5019. "idx": 269103
  5020. },
  5021. {
  5022. "func": "void freeSubscriptionList(subscription *head)\n{\n\tsubscription *next = NULL;\n\n\twhile (head) {\n\t\tnext = head->next;\n\t\tfreeSubscription(head);\n\t\tfree(head);\n\t\thead = next;\n\t}\n}",
  5023. "project": "pupnp",
  5024. "hash": 273543639749319163163564002725204598084,
  5025. "size": 11,
  5026. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5027. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5028. "target": 0,
  5029. "dataset": "other",
  5030. "idx": 269110
  5031. },
  5032. {
  5033. "func": "void freeService(service_info *in)\n{\n\tif (in) {\n\t\tif (in->serviceType)\n\t\t\tixmlFreeDOMString(in->serviceType);\n\n\t\tif (in->serviceId)\n\t\t\tixmlFreeDOMString(in->serviceId);\n\n\t\tif (in->SCPDURL)\n\t\t\tfree(in->SCPDURL);\n\n\t\tif (in->controlURL)\n\t\t\tfree(in->controlURL);\n\n\t\tif (in->eventURL)\n\t\t\tfree(in->eventURL);\n\n\t\tif (in->UDN)\n\t\t\tixmlFreeDOMString(in->UDN);\n\n\t\tif (in->subscriptionList)\n\t\t\tfreeSubscriptionList(in->subscriptionList);\n\n\t\tin->TotalSubscriptions = 0;\n\t\tfree(in);\n\t}\n}",
  5034. "project": "pupnp",
  5035. "hash": 287091917212498406403175565134292375135,
  5036. "size": 28,
  5037. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5038. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5039. "target": 0,
  5040. "dataset": "other",
  5041. "idx": 269112
  5042. },
  5043. {
  5044. "func": "int getServiceTable(\n\tIXML_Node *node, service_table *out, const char *DefaultURLBase)\n{\n\tIXML_Node *root = NULL;\n\tIXML_Node *URLBase = NULL;\n\n\tif (getSubElement(\"root\", node, &root)) {\n\t\tif (getSubElement(\"URLBase\", root, &URLBase)) {\n\t\t\tout->URLBase = getElementValue(URLBase);\n\t\t} else {\n\t\t\tif (DefaultURLBase) {\n\t\t\t\tout->URLBase =\n\t\t\t\t\tixmlCloneDOMString(DefaultURLBase);\n\t\t\t} else {\n\t\t\t\tout->URLBase = ixmlCloneDOMString(\"\");\n\t\t\t}\n\t\t}\n\t\tout->serviceList = getAllServiceList(\n\t\t\troot, out->URLBase, &out->endServiceList);\n\t\tif (out->serviceList) {\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\treturn 0;\n}",
  5045. "project": "pupnp",
  5046. "hash": 310742550464226623180272532368275699227,
  5047. "size": 26,
  5048. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5049. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5050. "target": 0,
  5051. "dataset": "other",
  5052. "idx": 269115
  5053. },
  5054. {
  5055. "func": "int addServiceTable(\n\tIXML_Node *node, service_table *in, const char *DefaultURLBase)\n{\n\tIXML_Node *root = NULL;\n\tIXML_Node *URLBase = NULL;\n\tservice_info *tempEnd = NULL;\n\n\tif (in->URLBase) {\n\t\tfree(in->URLBase);\n\t\tin->URLBase = NULL;\n\t}\n\tif (getSubElement(\"root\", node, &root)) {\n\t\tif (getSubElement(\"URLBase\", root, &URLBase)) {\n\t\t\tin->URLBase = getElementValue(URLBase);\n\t\t} else {\n\t\t\tif (DefaultURLBase) {\n\t\t\t\tin->URLBase =\n\t\t\t\t\tixmlCloneDOMString(DefaultURLBase);\n\t\t\t} else {\n\t\t\t\tin->URLBase = ixmlCloneDOMString(\"\");\n\t\t\t}\n\t\t}\n\t\tif ((in->endServiceList->next = getAllServiceList(\n\t\t\t root, in->URLBase, &tempEnd))) {\n\t\t\tin->endServiceList = tempEnd;\n\t\t\treturn 1;\n\t\t}\n\t}\n\n\treturn 0;\n}",
  5056. "project": "pupnp",
  5057. "hash": 173558270051215024034795038958309722594,
  5058. "size": 31,
  5059. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5060. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5061. "target": 0,
  5062. "dataset": "other",
  5063. "idx": 269113
  5064. },
  5065. {
  5066. "func": "void freeSubscription(subscription *sub)\n{\n\tif (sub) {\n\t\tfree_URL_list(&sub->DeliveryURLs);\n\t\tfreeSubscriptionQueuedEvents(sub);\n\t}\n}",
  5067. "project": "pupnp",
  5068. "hash": 292329439855868910009566177099290783325,
  5069. "size": 7,
  5070. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5071. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5072. "target": 0,
  5073. "dataset": "other",
  5074. "idx": 269114
  5075. },
  5076. {
  5077. "func": "int removeServiceTable(IXML_Node *node, service_table *in)\n{\n\tIXML_Node *root = NULL;\n\tIXML_Node *currentUDN = NULL;\n\tDOMString UDN = NULL;\n\tIXML_NodeList *deviceList = NULL;\n\tservice_info *current_service = NULL;\n\tservice_info *start_search = NULL;\n\tservice_info *prev_service = NULL;\n\tlong unsigned int NumOfDevices = 0lu;\n\tlong unsigned int i = 0lu;\n\n\tif (getSubElement(\"root\", node, &root)) {\n\t\tstart_search = in->serviceList;\n\t\tdeviceList = ixmlElement_getElementsByTagName(\n\t\t\t(IXML_Element *)root, \"device\");\n\t\tif (deviceList) {\n\t\t\tNumOfDevices = ixmlNodeList_length(deviceList);\n\t\t\tfor (i = 0lu; i < NumOfDevices; i++) {\n\t\t\t\tif ((start_search) &&\n\t\t\t\t\t((getSubElement(\n\t\t\t\t\t\t \"UDN\", node, &currentUDN)) &&\n\t\t\t\t\t\t(UDN = getElementValue(\n\t\t\t\t\t\t\t currentUDN)))) {\n\t\t\t\t\tcurrent_service = start_search;\n\t\t\t\t\t/* Services are put in the service table\n\t\t\t\t\t * in the order in which they appear in\n\t\t\t\t\t * the description document, therefore\n\t\t\t\t\t * we go through the list only once to\n\t\t\t\t\t * remove a particular root device */\n\t\t\t\t\twhile ((current_service) &&\n\t\t\t\t\t\t(strcmp(current_service->UDN,\n\t\t\t\t\t\t\tUDN))) {\n\t\t\t\t\t\tcurrent_service =\n\t\t\t\t\t\t\tcurrent_service->next;\n\t\t\t\t\t\tif (current_service != NULL)\n\t\t\t\t\t\t\tprev_service =\n\t\t\t\t\t\t\t\tcurrent_service\n\t\t\t\t\t\t\t\t\t->next;\n\t\t\t\t\t}\n\t\t\t\t\twhile ((current_service) &&\n\t\t\t\t\t\t(!strcmp(current_service->UDN,\n\t\t\t\t\t\t\tUDN))) {\n\t\t\t\t\t\tif (prev_service) {\n\t\t\t\t\t\t\tprev_service->next =\n\t\t\t\t\t\t\t\tcurrent_service\n\t\t\t\t\t\t\t\t\t->next;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tin->serviceList =\n\t\t\t\t\t\t\t\tcurrent_service\n\t\t\t\t\t\t\t\t\t->next;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (current_service ==\n\t\t\t\t\t\t\tin->endServiceList)\n\t\t\t\t\t\t\tin->endServiceList =\n\t\t\t\t\t\t\t\tprev_service;\n\t\t\t\t\t\tstart_search =\n\t\t\t\t\t\t\tcurrent_service->next;\n\t\t\t\t\t\tfreeService(current_service);\n\t\t\t\t\t\tcurrent_service = start_search;\n\t\t\t\t\t}\n\t\t\t\t\tixmlFreeDOMString(UDN);\n\t\t\t\t\tUDN = NULL;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tixmlNodeList_free(deviceList);\n\t\t}\n\t}\n\treturn 1;\n}",
  5078. "project": "pupnp",
  5079. "hash": 31963404102913016798591168904916052274,
  5080. "size": 71,
  5081. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5082. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5083. "target": 0,
  5084. "dataset": "other",
  5085. "idx": 269099
  5086. },
  5087. {
  5088. "func": "void freeServiceTable(service_table *table)\n{\n\tixmlFreeDOMString(table->URLBase);\n\tfreeServiceList(table->serviceList);\n\ttable->serviceList = NULL;\n\ttable->endServiceList = NULL;\n}",
  5089. "project": "pupnp",
  5090. "hash": 319711546520869408852480328531628814913,
  5091. "size": 7,
  5092. "commit_id": "c805c1de1141cb22f74c0d94dd5664bda37398e0",
  5093. "message": "Fixes #177: NULL pointer dereference in FindServiceControlURLPath\n\nAlso fixes its dual bug in FindServiceEventURLPath.",
  5094. "target": 0,
  5095. "dataset": "other",
  5096. "idx": 269107
  5097. }
  5098. ]
  5099. },
  5100. {
  5101. "call_depth": 3,
  5102. "longest_call_chain": [
  5103. "svm_vm_init",
  5104. "avic_vm_init",
  5105. "avic_vm_destroy"
  5106. ],
  5107. "group_size": 3,
  5108. "functions": [
  5109. {
  5110. "func": "static int svm_vm_init(struct kvm *kvm)\n{\n\tif (avic) {\n\t\tint ret = avic_vm_init(kvm);\n\t\tif (ret)\n\t\t\treturn ret;\n\t}\n\n\tkvm_apicv_init(kvm, avic);\n\treturn 0;\n}",
  5111. "project": "linux",
  5112. "hash": 119231700638899789656496442858274257675,
  5113. "size": 11,
  5114. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5115. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5116. "target": 0,
  5117. "dataset": "other",
  5118. "idx": 432411
  5119. },
  5120. {
  5121. "func": "static void avic_vm_destroy(struct kvm *kvm)\n{\n\tunsigned long flags;\n\tstruct kvm_svm *kvm_svm = to_kvm_svm(kvm);\n\n\tif (!avic)\n\t\treturn;\n\n\tif (kvm_svm->avic_logical_id_table_page)\n\t\t__free_page(kvm_svm->avic_logical_id_table_page);\n\tif (kvm_svm->avic_physical_id_table_page)\n\t\t__free_page(kvm_svm->avic_physical_id_table_page);\n\n\tspin_lock_irqsave(&svm_vm_data_hash_lock, flags);\n\thash_del(&kvm_svm->hnode);\n\tspin_unlock_irqrestore(&svm_vm_data_hash_lock, flags);\n}",
  5122. "project": "linux",
  5123. "hash": 78672790564658728860700505660849588389,
  5124. "size": 17,
  5125. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5126. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5127. "target": 0,
  5128. "dataset": "other",
  5129. "idx": 432565
  5130. },
  5131. {
  5132. "func": "static int avic_vm_init(struct kvm *kvm)\n{\n\tunsigned long flags;\n\tint err = -ENOMEM;\n\tstruct kvm_svm *kvm_svm = to_kvm_svm(kvm);\n\tstruct kvm_svm *k2;\n\tstruct page *p_page;\n\tstruct page *l_page;\n\tu32 vm_id;\n\n\tif (!avic)\n\t\treturn 0;\n\n\t/* Allocating physical APIC ID table (4KB) */\n\tp_page = alloc_page(GFP_KERNEL_ACCOUNT);\n\tif (!p_page)\n\t\tgoto free_avic;\n\n\tkvm_svm->avic_physical_id_table_page = p_page;\n\tclear_page(page_address(p_page));\n\n\t/* Allocating logical APIC ID table (4KB) */\n\tl_page = alloc_page(GFP_KERNEL_ACCOUNT);\n\tif (!l_page)\n\t\tgoto free_avic;\n\n\tkvm_svm->avic_logical_id_table_page = l_page;\n\tclear_page(page_address(l_page));\n\n\tspin_lock_irqsave(&svm_vm_data_hash_lock, flags);\n again:\n\tvm_id = next_vm_id = (next_vm_id + 1) & AVIC_VM_ID_MASK;\n\tif (vm_id == 0) { /* id is 1-based, zero is not okay */\n\t\tnext_vm_id_wrapped = 1;\n\t\tgoto again;\n\t}\n\t/* Is it still in use? Only possible if wrapped at least once */\n\tif (next_vm_id_wrapped) {\n\t\thash_for_each_possible(svm_vm_data_hash, k2, hnode, vm_id) {\n\t\t\tif (k2->avic_vm_id == vm_id)\n\t\t\t\tgoto again;\n\t\t}\n\t}\n\tkvm_svm->avic_vm_id = vm_id;\n\thash_add(svm_vm_data_hash, &kvm_svm->hnode, kvm_svm->avic_vm_id);\n\tspin_unlock_irqrestore(&svm_vm_data_hash_lock, flags);\n\n\treturn 0;\n\nfree_avic:\n\tavic_vm_destroy(kvm);\n\treturn err;\n}",
  5133. "project": "linux",
  5134. "hash": 222672042186195717097421658155647046630,
  5135. "size": 53,
  5136. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5137. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5138. "target": 0,
  5139. "dataset": "other",
  5140. "idx": 432635
  5141. }
  5142. ]
  5143. },
  5144. {
  5145. "call_depth": 3,
  5146. "longest_call_chain": [
  5147. "init_module",
  5148. "sbni_init",
  5149. "request_region"
  5150. ],
  5151. "group_size": 4,
  5152. "functions": [
  5153. {
  5154. "func": "int __init init_module( void )\n{\n\tstruct net_device *dev;\n\tint err;\n\n\twhile( num < SBNI_MAX_NUM_CARDS ) {\n\t\tdev = alloc_netdev(sizeof(struct net_local), \n\t\t\t\t \"sbni%d\", sbni_devsetup);\n\t\tif( !dev)\n\t\t\tbreak;\n\n\t\tsprintf( dev->name, \"sbni%d\", num );\n\n\t\terr = sbni_init(dev);\n\t\tif (err) {\n\t\t\tfree_netdev(dev);\n\t\t\tbreak;\n\t\t}\n\n\t\tif( register_netdev( dev ) ) {\n\t\t\trelease_region( dev->base_addr, SBNI_IO_EXTENT );\n\t\t\tfree_netdev( dev );\n\t\t\tbreak;\n\t\t}\n\t}\n\n\treturn *sbni_cards ? 0 : -ENODEV;\n}",
  5155. "target": 0,
  5156. "cwe": [
  5157. "CWE-264"
  5158. ],
  5159. "project": "linux-2.6",
  5160. "commit_id": "f2455eb176ac87081bbfc9a44b21c7cd2bc1967e",
  5161. "hash": 181433901727487330964454453377713851548,
  5162. "size": 28,
  5163. "message": "wan: Missing capability checks in sbni_ioctl()\n\nThere are missing capability checks in the following code:\n\n1300 static int\n1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd)\n1302 {\n[...]\n1319 case SIOCDEVRESINSTATS :\n1320 if( current->euid != 0 ) /* root only */\n1321 return -EPERM;\n[...]\n1336 case SIOCDEVSHWSTATE :\n1337 if( current->euid != 0 ) /* root only */\n1338 return -EPERM;\n[...]\n1357 case SIOCDEVENSLAVE :\n1358 if( current->euid != 0 ) /* root only */\n1359 return -EPERM;\n[...]\n1372 case SIOCDEVEMANSIPATE :\n1373 if( current->euid != 0 ) /* root only */\n1374 return -EPERM;\n\nHere's my proposed fix:\n\nMissing capability checks.\n\nSigned-off-by: Eugene Teo <eugeneteo@kernel.sg>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  5164. "dataset": "other",
  5165. "idx": 488965
  5166. },
  5167. {
  5168. "func": "sbni_isa_probe( struct net_device *dev )\n{\n\tif( dev->base_addr > 0x1ff\n\t && request_region( dev->base_addr, SBNI_IO_EXTENT, dev->name )\n\t && sbni_probe1( dev, dev->base_addr, dev->irq ) )\n\n\t\treturn 0;\n\telse {\n\t\tprintk( KERN_ERR \"sbni: base address 0x%lx is busy, or adapter \"\n\t\t\t\"is malfunctional!\\n\", dev->base_addr );\n\t\treturn -ENODEV;\n\t}\n}",
  5169. "target": 0,
  5170. "cwe": [
  5171. "CWE-264"
  5172. ],
  5173. "project": "linux-2.6",
  5174. "commit_id": "f2455eb176ac87081bbfc9a44b21c7cd2bc1967e",
  5175. "hash": 23435996843988008996709935911737797945,
  5176. "size": 13,
  5177. "message": "wan: Missing capability checks in sbni_ioctl()\n\nThere are missing capability checks in the following code:\n\n1300 static int\n1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd)\n1302 {\n[...]\n1319 case SIOCDEVRESINSTATS :\n1320 if( current->euid != 0 ) /* root only */\n1321 return -EPERM;\n[...]\n1336 case SIOCDEVSHWSTATE :\n1337 if( current->euid != 0 ) /* root only */\n1338 return -EPERM;\n[...]\n1357 case SIOCDEVENSLAVE :\n1358 if( current->euid != 0 ) /* root only */\n1359 return -EPERM;\n[...]\n1372 case SIOCDEVEMANSIPATE :\n1373 if( current->euid != 0 ) /* root only */\n1374 return -EPERM;\n\nHere's my proposed fix:\n\nMissing capability checks.\n\nSigned-off-by: Eugene Teo <eugeneteo@kernel.sg>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  5178. "dataset": "other",
  5179. "idx": 488942
  5180. },
  5181. {
  5182. "func": "int __init sbni_probe(int unit)\n{\n\tstruct net_device *dev;\n\tstatic unsigned version_printed __initdata = 0;\n\tint err;\n\n\tdev = alloc_netdev(sizeof(struct net_local), \"sbni\", sbni_devsetup);\n\tif (!dev)\n\t\treturn -ENOMEM;\n\n\tsprintf(dev->name, \"sbni%d\", unit);\n\tnetdev_boot_setup_check(dev);\n\n\terr = sbni_init(dev);\n\tif (err) {\n\t\tfree_netdev(dev);\n\t\treturn err;\n\t}\n\n\terr = register_netdev(dev);\n\tif (err) {\n\t\trelease_region( dev->base_addr, SBNI_IO_EXTENT );\n\t\tfree_netdev(dev);\n\t\treturn err;\n\t}\n\tif( version_printed++ == 0 )\n\t\tprintk( KERN_INFO \"%s\", version );\n\treturn 0;\n}",
  5183. "target": 0,
  5184. "cwe": [
  5185. "CWE-264"
  5186. ],
  5187. "project": "linux-2.6",
  5188. "commit_id": "f2455eb176ac87081bbfc9a44b21c7cd2bc1967e",
  5189. "hash": 134865134009037356775699546668150350259,
  5190. "size": 29,
  5191. "message": "wan: Missing capability checks in sbni_ioctl()\n\nThere are missing capability checks in the following code:\n\n1300 static int\n1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd)\n1302 {\n[...]\n1319 case SIOCDEVRESINSTATS :\n1320 if( current->euid != 0 ) /* root only */\n1321 return -EPERM;\n[...]\n1336 case SIOCDEVSHWSTATE :\n1337 if( current->euid != 0 ) /* root only */\n1338 return -EPERM;\n[...]\n1357 case SIOCDEVENSLAVE :\n1358 if( current->euid != 0 ) /* root only */\n1359 return -EPERM;\n[...]\n1372 case SIOCDEVEMANSIPATE :\n1373 if( current->euid != 0 ) /* root only */\n1374 return -EPERM;\n\nHere's my proposed fix:\n\nMissing capability checks.\n\nSigned-off-by: Eugene Teo <eugeneteo@kernel.sg>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  5192. "dataset": "other",
  5193. "idx": 488946
  5194. },
  5195. {
  5196. "func": "static int __init sbni_init(struct net_device *dev)\n{\n\tint i;\n\tif( dev->base_addr )\n\t\treturn sbni_isa_probe( dev );\n\t/* otherwise we have to perform search our adapter */\n\n\tif( io[ num ] != -1 )\n\t\tdev->base_addr\t= io[ num ],\n\t\tdev->irq\t= irq[ num ];\n\telse if( scandone || io[ 0 ] != -1 )\n\t\treturn -ENODEV;\n\n\t/* if io[ num ] contains non-zero address, then that is on ISA bus */\n\tif( dev->base_addr )\n\t\treturn sbni_isa_probe( dev );\n\n\t/* ...otherwise - scan PCI first */\n\tif( !skip_pci_probe && !sbni_pci_probe( dev ) )\n\t\treturn 0;\n\n\tif( io[ num ] == -1 ) {\n\t\t/* Auto-scan will be stopped when first ISA card were found */\n\t\tscandone = 1;\n\t\tif( num > 0 )\n\t\t\treturn -ENODEV;\n\t}\n\n\tfor( i = 0; netcard_portlist[ i ]; ++i ) {\n\t\tint ioaddr = netcard_portlist[ i ];\n\t\tif( request_region( ioaddr, SBNI_IO_EXTENT, dev->name )\n\t\t && sbni_probe1( dev, ioaddr, 0 ))\n\t\t\treturn 0;\n\t}\n\n\treturn -ENODEV;\n}",
  5197. "target": 0,
  5198. "cwe": [
  5199. "CWE-264"
  5200. ],
  5201. "project": "linux-2.6",
  5202. "commit_id": "f2455eb176ac87081bbfc9a44b21c7cd2bc1967e",
  5203. "hash": 214086691161495212970362013776871450574,
  5204. "size": 37,
  5205. "message": "wan: Missing capability checks in sbni_ioctl()\n\nThere are missing capability checks in the following code:\n\n1300 static int\n1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd)\n1302 {\n[...]\n1319 case SIOCDEVRESINSTATS :\n1320 if( current->euid != 0 ) /* root only */\n1321 return -EPERM;\n[...]\n1336 case SIOCDEVSHWSTATE :\n1337 if( current->euid != 0 ) /* root only */\n1338 return -EPERM;\n[...]\n1357 case SIOCDEVENSLAVE :\n1358 if( current->euid != 0 ) /* root only */\n1359 return -EPERM;\n[...]\n1372 case SIOCDEVEMANSIPATE :\n1373 if( current->euid != 0 ) /* root only */\n1374 return -EPERM;\n\nHere's my proposed fix:\n\nMissing capability checks.\n\nSigned-off-by: Eugene Teo <eugeneteo@kernel.sg>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  5206. "dataset": "other",
  5207. "idx": 488947
  5208. }
  5209. ]
  5210. },
  5211. {
  5212. "call_depth": 3,
  5213. "longest_call_chain": [
  5214. "src_parser_cpp",
  5215. "src_parser_trans_stage_1_2_3",
  5216. "p_buf_push_tmp_char"
  5217. ],
  5218. "group_size": 8,
  5219. "functions": [
  5220. {
  5221. "project": "gilcc",
  5222. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5223. "target": 0,
  5224. "func": "int src_parser_cpp(const char *src, const struct trans_config cfg)\n{\n int tmp_fd;\n char fname[TMP_FILE_NAME_SIZE];\n\n strncpy(fname, TMP_FILE_NAME, TMP_FILE_NAME_SIZE);\n tmp_fd = mkstemp(fname);\n if (tmp_fd == -1) {\n fprintf(stderr, \"**Error: could not create a working file.\\n\");\n return -1;\n }\n\n src_parser_trans_stage_1_2_3(tmp_fd, src, cfg);\n\n print_file_full(tmp_fd);\n\n unlink(fname);\n}",
  5225. "idx": 519641,
  5226. "cwe": "CWE-120",
  5227. "hash": 271722396915397535572169577216631922211,
  5228. "dataset": "other"
  5229. },
  5230. {
  5231. "project": "gilcc",
  5232. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5233. "target": 0,
  5234. "func": "static inline int p_buf_write_f_char(struct parser_buf *buf, const int output_fd)\n{\n return write(output_fd, &buf->f_buf[buf->f_indx++], 1);\n}",
  5235. "idx": 519638,
  5236. "cwe": "CWE-120",
  5237. "hash": 11863702651619213404059498325548133161,
  5238. "dataset": "other"
  5239. },
  5240. {
  5241. "project": "gilcc",
  5242. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5243. "target": 1,
  5244. "func": "static int src_parser_trans_stage_1_2_3(const int tmp_fd, const char *src, const struct trans_config cfg)\n{\n struct parser_buf pbuf = {\n .f_indx = 0,\n .tmp_indx = 0,\n .f_read_size = 0\n };\n\n int write_count = 0;\n int src_fd;\n int p_state = P_STATE_CODE;\n\n src_fd = open(src, O_RDONLY);\n if (src_fd == -1) {\n fprintf(stderr, \"**Error: Could not open source file: %s.\\n\", src);\n return -1;\n }\n\n while (p_buf_refill(&pbuf, src_fd) > 0) {\n\n while (PBUF_F_REMD(pbuf)) {\n\n switch (p_state) {\n case P_STATE_COMMENT_C:\n\n switch (PBUF_F_CHAR(pbuf)) {\n case '*':\n p_buf_push_tmp_char(&pbuf, '*');\n continue;\n\n case '/':\n if (pbuf.tmp_indx && (PBUF_TMP_PREV_CHAR(pbuf) == '*')) {\n pbuf.tmp_indx--;\n p_state = P_STATE_CODE;\n }\n break;\n\n default:\n if (pbuf.tmp_indx && (PBUF_TMP_PREV_CHAR(pbuf) == '*'))\n pbuf.tmp_indx--;\n break;\n }\n\n pbuf.f_indx++;\n\n case P_STATE_CODE:\n default:\n\n /* TODO: add trigraph support */\n\n switch (PBUF_F_CHAR(pbuf)) {\n case ' ':\n case '\\t':\n if (pbuf.tmp_indx &&\n (PBUF_TMP_PREV_CHAR(pbuf) == ' ' || PBUF_TMP_PREV_CHAR(pbuf) == '\\t' ||\n PBUF_TMP_PREV_CHAR(pbuf) == '\\n'))\n pbuf.f_indx++;\n else\n p_buf_push_tmp_char(&pbuf, ' ');\n\n continue;\n\n case '\\r':\n case '\\n':\n if (pbuf.tmp_indx &&\n (PBUF_TMP_PREV_CHAR(pbuf) == ' ' || PBUF_TMP_PREV_CHAR(pbuf) == '\\t' ||\n PBUF_TMP_PREV_CHAR(pbuf) == '\\n')) {\n pbuf.f_indx++;\n } else if (pbuf.tmp_indx && \n (PBUF_TMP_PREV_CHAR(pbuf) == '\\\\')) {\n pbuf.tmp_indx--;\n pbuf.f_indx++;\n } else {\n p_buf_push_tmp_char(&pbuf, '\\n');\n }\n\n continue;\n\n case '\\\\':\n p_buf_push_tmp_char(&pbuf, '\\\\');\n continue;\n\n case '/':\n p_buf_push_tmp_char(&pbuf, '/');\n continue;\n\n case '*':\n if (pbuf.tmp_indx &&\n (PBUF_TMP_PREV_CHAR(pbuf) == '/')) {\n pbuf.tmp_indx--;\n pbuf.f_indx++;\n p_state = P_STATE_COMMENT_C;\n continue;\n }\n\n default:\n break;\n }\n\n /* TODO: check return values */\n p_buf_write_tmp(&pbuf, tmp_fd);\n p_buf_write_f_char(&pbuf, tmp_fd);\n }\n }\n }\n\n p_buf_write_tmp(&pbuf, tmp_fd);\n return 0;\n}",
  5245. "idx": 217253,
  5246. "cwe": "CWE-120",
  5247. "hash": 156243165944298433475865161512344109547,
  5248. "dataset": "other"
  5249. },
  5250. {
  5251. "project": "gilcc",
  5252. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5253. "target": 0,
  5254. "func": "static int src_parser_trans_stage_1_2_3(const int tmp_fd, const char *src, const struct trans_config cfg)\n{\n struct parser_buf pbuf = {\n .f_indx = 0,\n .tmp_indx = 0,\n .f_read_size = 0\n };\n\n int write_count = 0;\n int src_fd;\n int p_state = P_STATE_CODE;\n\n src_fd = open(src, O_RDONLY);\n if (src_fd == -1) {\n fprintf(stderr, \"**Error: Could not open source file: %s.\\n\", src);\n return -1;\n }\n\n while (p_buf_refill(&pbuf, src_fd) > 0) {\n\n while (PBUF_F_REMD(pbuf)) {\n\n switch (p_state) {\n case P_STATE_COMMENT_C:\n\n switch (PBUF_F_CHAR(pbuf)) {\n case '*':\n p_buf_push_tmp_char(&pbuf, '*');\n continue;\n\n case '/':\n if (pbuf.tmp_indx && (PBUF_TMP_PREV_CHAR(pbuf) == '*')) {\n pbuf.tmp_indx--;\n p_state = P_STATE_CODE;\n }\n break;\n\n default:\n if (pbuf.tmp_indx && (PBUF_TMP_PREV_CHAR(pbuf) == '*'))\n pbuf.tmp_indx--;\n break;\n }\n\n pbuf.f_indx++;\n\n case P_STATE_CODE:\n default:\n\n /* TODO: add trigraph support */\n\n switch (PBUF_F_CHAR(pbuf)) {\n case ' ':\n case '\\t':\n if (pbuf.tmp_indx &&\n (PBUF_TMP_PREV_CHAR(pbuf) == ' ' || PBUF_TMP_PREV_CHAR(pbuf) == '\\t' ||\n PBUF_TMP_PREV_CHAR(pbuf) == '\\n'))\n pbuf.f_indx++;\n else\n p_buf_push_tmp_char(&pbuf, ' ');\n\n continue;\n\n case '\\r':\n case '\\n':\n if (pbuf.tmp_indx &&\n (PBUF_TMP_PREV_CHAR(pbuf) == ' ' || PBUF_TMP_PREV_CHAR(pbuf) == '\\t' ||\n PBUF_TMP_PREV_CHAR(pbuf) == '\\n')) {\n pbuf.f_indx++;\n } else if (pbuf.tmp_indx &&\n (PBUF_TMP_PREV_CHAR(pbuf) == '\\\\')) {\n pbuf.tmp_indx--;\n pbuf.f_indx++;\n } else {\n p_buf_push_tmp_char(&pbuf, '\\n');\n }\n\n continue;\n\n case '\\\\':\n p_buf_write_tmp(&pbuf, tmp_fd);\n p_buf_push_tmp_char(&pbuf, '\\\\');\n continue;\n\n case '/':\n p_buf_write_tmp(&pbuf, tmp_fd);\n p_buf_push_tmp_char(&pbuf, '/');\n continue;\n\n case '*':\n if (pbuf.tmp_indx &&\n (PBUF_TMP_PREV_CHAR(pbuf) == '/')) {\n pbuf.tmp_indx--;\n pbuf.f_indx++;\n p_state = P_STATE_COMMENT_C;\n continue;\n }\n\n default:\n break;\n }\n\n /* TODO: check return values */\n p_buf_write_tmp(&pbuf, tmp_fd);\n p_buf_write_f_char(&pbuf, tmp_fd);\n }\n }\n }\n\n p_buf_write_tmp(&pbuf, tmp_fd);\n return 0;\n}",
  5255. "idx": 519639,
  5256. "cwe": "CWE-120",
  5257. "hash": 243330918601381518712115173837645650891,
  5258. "dataset": "other"
  5259. },
  5260. {
  5261. "project": "gilcc",
  5262. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5263. "target": 0,
  5264. "func": "static inline int p_buf_refill(struct parser_buf *buf, const int input_fd)\n{\n int read_size;\n\n read_size = read(input_fd, buf->f_buf, SRC_PARSER_F_BUF_SIZE);\n buf->f_indx = 0;\n buf->f_read_size = read_size;\n return read_size;\n}",
  5265. "idx": 519635,
  5266. "cwe": "CWE-120",
  5267. "hash": 94349456194879104248932935259912870119,
  5268. "dataset": "other"
  5269. },
  5270. {
  5271. "project": "gilcc",
  5272. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5273. "target": 0,
  5274. "func": "static inline int p_buf_write_tmp(struct parser_buf *buf, const int output_fd)\n{\n int write_size;\n\n if (!buf->tmp_indx)\n return 0;\n\n write_size = write(output_fd, buf->tmp_buf, buf->tmp_indx);\n buf->tmp_indx = 0;\n\n return write_size;\n}",
  5275. "idx": 519640,
  5276. "cwe": "CWE-120",
  5277. "hash": 288338974588502287384365659415156191144,
  5278. "dataset": "other"
  5279. },
  5280. {
  5281. "project": "gilcc",
  5282. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5283. "target": 0,
  5284. "func": "static inline int p_buf_push_tmp_char(struct parser_buf *buf, const char c)\n{\n buf->tmp_buf[buf->tmp_indx++] = c;\n buf->f_indx++;\n return buf->tmp_indx;\n}",
  5285. "idx": 519637,
  5286. "cwe": "CWE-120",
  5287. "hash": 148700069090498604089502369601794249104,
  5288. "dataset": "other"
  5289. },
  5290. {
  5291. "project": "gilcc",
  5292. "commit_id": "803969389ca9c06237075a7f8eeb1a19e6651759",
  5293. "target": 0,
  5294. "func": "static void print_file_full(int fd)\n{\n char f_buf[SRC_PARSER_F_BUF_SIZE];\n int read_size;\n\n if (lseek(fd, 0, SEEK_SET)) {\n fprintf(stderr, \"**Error: Could not set offset.\\n\");\n return;\n }\n\n while ((read_size = read(fd, f_buf, SRC_PARSER_F_BUF_SIZE)) > 0) {\n int read_indx = 0;\n\n while (read_indx < read_size)\n putchar(f_buf[read_indx++]);\n }\n}",
  5295. "idx": 519636,
  5296. "cwe": "CWE-120",
  5297. "hash": 188858436085828338784176103802441969941,
  5298. "dataset": "other"
  5299. }
  5300. ]
  5301. },
  5302. {
  5303. "call_depth": 4,
  5304. "longest_call_chain": [
  5305. "update_send_surface_frame_bits",
  5306. "update_force_flush",
  5307. "update_flush",
  5308. "update_begin_paint"
  5309. ],
  5310. "group_size": 25,
  5311. "functions": [
  5312. {
  5313. "func": "static void free_bitmap_data(BITMAP_DATA* data, size_t count)\n{\n\tsize_t x;\n\n\tif (!data)\n\t\treturn;\n\n\tfor (x = 0; x < count; x++)\n\t\tfree(data[x].bitmapDataStream);\n\n\tfree(data);\n}",
  5314. "project": "FreeRDP",
  5315. "hash": 83561454008892408570795373937698034714,
  5316. "size": 12,
  5317. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  5318. "message": "Fixed possible NULL dereference",
  5319. "target": 0,
  5320. "dataset": "other",
  5321. "idx": 269195
  5322. },
  5323. {
  5324. "func": "static void update_flush(rdpContext* context)\n{\n\trdpUpdate* update = context->update;\n\n\tif (update->numberOrders > 0)\n\t{\n\t\tupdate_end_paint(update);\n\t\tupdate_begin_paint(update);\n\t}\n}",
  5325. "project": "FreeRDP",
  5326. "hash": 48646700703847888200234582864219006834,
  5327. "size": 10,
  5328. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5329. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5330. "target": 0,
  5331. "dataset": "other",
  5332. "idx": 295104
  5333. },
  5334. {
  5335. "func": "void free_bitmap_update(rdpContext* context, BITMAP_UPDATE* pointer)\n{\n\tif (!pointer)\n\t\treturn;\n\n\tfree_bitmap_data(pointer->rectangles, pointer->number);\n\tfree(pointer);\n}",
  5336. "project": "FreeRDP",
  5337. "hash": 208939052026127177066053869993369151852,
  5338. "size": 8,
  5339. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  5340. "message": "Fixed possible NULL dereference",
  5341. "target": 0,
  5342. "dataset": "other",
  5343. "idx": 269192
  5344. },
  5345. {
  5346. "func": "static const char* update_type_to_string(UINT16 updateType)\n{\n\tif (updateType >= ARRAYSIZE(UPDATE_TYPE_STRINGS))\n\t\treturn \"UNKNOWN\";\n\n\treturn UPDATE_TYPE_STRINGS[updateType];\n}",
  5347. "project": "FreeRDP",
  5348. "hash": 159219454954151929240053594586134427915,
  5349. "size": 7,
  5350. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5351. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5352. "target": 0,
  5353. "dataset": "other",
  5354. "idx": 295037
  5355. },
  5356. {
  5357. "func": "static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData)\n{\n\tWINPR_UNUSED(update);\n\tif (Stream_GetRemainingLength(s) < 18)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, bitmapData->destLeft);\n\tStream_Read_UINT16(s, bitmapData->destTop);\n\tStream_Read_UINT16(s, bitmapData->destRight);\n\tStream_Read_UINT16(s, bitmapData->destBottom);\n\tStream_Read_UINT16(s, bitmapData->width);\n\tStream_Read_UINT16(s, bitmapData->height);\n\tStream_Read_UINT16(s, bitmapData->bitsPerPixel);\n\tStream_Read_UINT16(s, bitmapData->flags);\n\tStream_Read_UINT16(s, bitmapData->bitmapLength);\n\n\tif (bitmapData->flags & BITMAP_COMPRESSION)\n\t{\n\t\tif (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))\n\t\t{\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */\n\t\t\tStream_Read_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */\n\t\t\tbitmapData->bitmapLength = bitmapData->cbCompMainBodySize;\n\t\t}\n\n\t\tbitmapData->compressed = TRUE;\n\t}\n\telse\n\t\tbitmapData->compressed = FALSE;\n\n\tif (Stream_GetRemainingLength(s) < bitmapData->bitmapLength)\n\t\treturn FALSE;\n\n\tif (bitmapData->bitmapLength > 0)\n\t{\n\t\tbitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);\n\n\t\tif (!bitmapData->bitmapDataStream)\n\t\t\treturn FALSE;\n\n\t\tmemcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);\n\t\tStream_Seek(s, bitmapData->bitmapLength);\n\t}\n\n\treturn TRUE;\n}",
  5358. "project": "FreeRDP",
  5359. "hash": 118353352329739050106188835974278769803,
  5360. "size": 51,
  5361. "commit_id": "f8890a645c221823ac133dbf991f8a65ae50d637",
  5362. "message": "Fixed #6005: Bounds checks in update_read_bitmap_data",
  5363. "target": 1,
  5364. "dataset": "other",
  5365. "idx": 202811
  5366. },
  5367. {
  5368. "func": "static BOOL update_read_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData)\n{\n\tWINPR_UNUSED(update);\n\tif (Stream_GetRemainingLength(s) < 18)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, bitmapData->destLeft);\n\tStream_Read_UINT16(s, bitmapData->destTop);\n\tStream_Read_UINT16(s, bitmapData->destRight);\n\tStream_Read_UINT16(s, bitmapData->destBottom);\n\tStream_Read_UINT16(s, bitmapData->width);\n\tStream_Read_UINT16(s, bitmapData->height);\n\tStream_Read_UINT16(s, bitmapData->bitsPerPixel);\n\tStream_Read_UINT16(s, bitmapData->flags);\n\tStream_Read_UINT16(s, bitmapData->bitmapLength);\n\n\tif (bitmapData->flags & BITMAP_COMPRESSION)\n\t{\n\t\tif (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))\n\t\t{\n\t\t\tif (Stream_GetRemainingLength(s) < 8)\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */\n\t\t\tStream_Read_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */\n\t\t\tStream_Read_UINT16(s,\n\t\t\t bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */\n\t\t\tbitmapData->bitmapLength = bitmapData->cbCompMainBodySize;\n\t\t}\n\n\t\tbitmapData->compressed = TRUE;\n\t}\n\telse\n\t\tbitmapData->compressed = FALSE;\n\n\tif (Stream_GetRemainingLength(s) < bitmapData->bitmapLength)\n\t\treturn FALSE;\n\n\tif (bitmapData->bitmapLength > 0)\n\t{\n\t\tbitmapData->bitmapDataStream = malloc(bitmapData->bitmapLength);\n\n\t\tif (!bitmapData->bitmapDataStream)\n\t\t\treturn FALSE;\n\n\t\tmemcpy(bitmapData->bitmapDataStream, Stream_Pointer(s), bitmapData->bitmapLength);\n\t\tStream_Seek(s, bitmapData->bitmapLength);\n\t}\n\n\treturn TRUE;\n}",
  5369. "project": "FreeRDP",
  5370. "hash": 19434549241602046540304179152592702379,
  5371. "size": 54,
  5372. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5373. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5374. "target": 0,
  5375. "dataset": "other",
  5376. "idx": 295074
  5377. },
  5378. {
  5379. "func": "static BOOL update_write_bitmap_data(rdpUpdate* update, wStream* s, BITMAP_DATA* bitmapData)\n{\n\tif (!Stream_EnsureRemainingCapacity(s, 64 + bitmapData->bitmapLength))\n\t\treturn FALSE;\n\n\tif (update->autoCalculateBitmapData)\n\t{\n\t\tbitmapData->flags = 0;\n\t\tbitmapData->cbCompFirstRowSize = 0;\n\n\t\tif (bitmapData->compressed)\n\t\t\tbitmapData->flags |= BITMAP_COMPRESSION;\n\n\t\tif (update->context->settings->NoBitmapCompressionHeader)\n\t\t{\n\t\t\tbitmapData->flags |= NO_BITMAP_COMPRESSION_HDR;\n\t\t\tbitmapData->cbCompMainBodySize = bitmapData->bitmapLength;\n\t\t}\n\t}\n\n\tStream_Write_UINT16(s, bitmapData->destLeft);\n\tStream_Write_UINT16(s, bitmapData->destTop);\n\tStream_Write_UINT16(s, bitmapData->destRight);\n\tStream_Write_UINT16(s, bitmapData->destBottom);\n\tStream_Write_UINT16(s, bitmapData->width);\n\tStream_Write_UINT16(s, bitmapData->height);\n\tStream_Write_UINT16(s, bitmapData->bitsPerPixel);\n\tStream_Write_UINT16(s, bitmapData->flags);\n\tStream_Write_UINT16(s, bitmapData->bitmapLength);\n\n\tif (bitmapData->flags & BITMAP_COMPRESSION)\n\t{\n\t\tif (!(bitmapData->flags & NO_BITMAP_COMPRESSION_HDR))\n\t\t{\n\t\t\tStream_Write_UINT16(s,\n\t\t\t bitmapData->cbCompFirstRowSize); /* cbCompFirstRowSize (2 bytes) */\n\t\t\tStream_Write_UINT16(s,\n\t\t\t bitmapData->cbCompMainBodySize); /* cbCompMainBodySize (2 bytes) */\n\t\t\tStream_Write_UINT16(s, bitmapData->cbScanWidth); /* cbScanWidth (2 bytes) */\n\t\t\tStream_Write_UINT16(s,\n\t\t\t bitmapData->cbUncompressedSize); /* cbUncompressedSize (2 bytes) */\n\t\t}\n\n\t\tStream_Write(s, bitmapData->bitmapDataStream, bitmapData->bitmapLength);\n\t}\n\telse\n\t{\n\t\tStream_Write(s, bitmapData->bitmapDataStream, bitmapData->bitmapLength);\n\t}\n\n\treturn TRUE;\n}",
  5380. "project": "FreeRDP",
  5381. "hash": 150799345268186021110095569864090669993,
  5382. "size": 52,
  5383. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5384. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5385. "target": 0,
  5386. "dataset": "other",
  5387. "idx": 295067
  5388. },
  5389. {
  5390. "func": "BOOL update_begin_paint(rdpUpdate* update)\n{\n\tif (!update)\n\t\treturn FALSE;\n\n\tEnterCriticalSection(&update->mux);\n\n\tif (!update->BeginPaint)\n\t\treturn TRUE;\n\n\treturn update->BeginPaint(update->context);\n}",
  5391. "project": "FreeRDP",
  5392. "hash": 220278009081811703954206093061125416118,
  5393. "size": 12,
  5394. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5395. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5396. "target": 0,
  5397. "dataset": "other",
  5398. "idx": 295073
  5399. },
  5400. {
  5401. "func": "static BOOL update_send_bitmap_update(rdpContext* context, const BITMAP_UPDATE* bitmapUpdate)\n{\n\twStream* s;\n\trdpRdp* rdp = context->rdp;\n\trdpUpdate* update = context->update;\n\tBOOL ret = TRUE;\n\tupdate_force_flush(context);\n\ts = fastpath_update_pdu_init(rdp->fastpath);\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tif (!update_write_bitmap_update(update, s, bitmapUpdate) ||\n\t !fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_BITMAP, s,\n\t bitmapUpdate->skipCompression))\n\t{\n\t\tret = FALSE;\n\t\tgoto out_fail;\n\t}\n\n\tupdate_force_flush(context);\nout_fail:\n\tStream_Release(s);\n\treturn ret;\n}",
  5402. "project": "FreeRDP",
  5403. "hash": 259785527431013201702141036429401273574,
  5404. "size": 25,
  5405. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5406. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5407. "target": 0,
  5408. "dataset": "other",
  5409. "idx": 295090
  5410. },
  5411. {
  5412. "func": "static BOOL update_send_surface_frame_marker(rdpContext* context,\n const SURFACE_FRAME_MARKER* surfaceFrameMarker)\n{\n\twStream* s;\n\trdpRdp* rdp = context->rdp;\n\tBOOL ret = FALSE;\n\tupdate_force_flush(context);\n\ts = fastpath_update_pdu_init(rdp->fastpath);\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tif (!update_write_surfcmd_frame_marker(s, surfaceFrameMarker->frameAction,\n\t surfaceFrameMarker->frameId) ||\n\t !fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s, FALSE))\n\t\tgoto out_fail;\n\n\tupdate_force_flush(context);\n\tret = TRUE;\nout_fail:\n\tStream_Release(s);\n\treturn ret;\n}",
  5413. "project": "FreeRDP",
  5414. "hash": 14746646581806677941908773020690319643,
  5415. "size": 23,
  5416. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5417. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5418. "target": 0,
  5419. "dataset": "other",
  5420. "idx": 295048
  5421. },
  5422. {
  5423. "func": "BITMAP_UPDATE* copy_bitmap_update(rdpContext* context, const BITMAP_UPDATE* pointer)\n{\n\tBITMAP_UPDATE* dst = calloc(1, sizeof(BITMAP_UPDATE));\n\n\tif (!dst || !pointer)\n\t\tgoto fail;\n\n\t*dst = *pointer;\n\tdst->rectangles = copy_bitmap_data(pointer->rectangles, pointer->number);\n\n\tif (!dst->rectangles)\n\t\tgoto fail;\n\n\treturn dst;\nfail:\n\tfree_bitmap_update(context, dst);\n\treturn NULL;\n}",
  5424. "project": "FreeRDP",
  5425. "hash": 120969353999494657473109322312513246110,
  5426. "size": 18,
  5427. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  5428. "message": "Fixed possible NULL dereference",
  5429. "target": 0,
  5430. "dataset": "other",
  5431. "idx": 269196
  5432. },
  5433. {
  5434. "func": "BOOL update_end_paint(rdpUpdate* update)\n{\n\tBOOL rc = FALSE;\n\n\tif (!update)\n\t\treturn FALSE;\n\n\tif (update->EndPaint)\n\t\trc = update->EndPaint(update->context);\n\n\tLeaveCriticalSection(&update->mux);\n\treturn rc;\n}",
  5435. "project": "FreeRDP",
  5436. "hash": 281226130786164898487470841172171184793,
  5437. "size": 13,
  5438. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5439. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5440. "target": 0,
  5441. "dataset": "other",
  5442. "idx": 295042
  5443. },
  5444. {
  5445. "func": "PALETTE_UPDATE* update_read_palette(rdpUpdate* update, wStream* s)\n{\n\tint i;\n\tPALETTE_ENTRY* entry;\n\tPALETTE_UPDATE* palette_update = calloc(1, sizeof(PALETTE_UPDATE));\n\n\tif (!palette_update)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 6)\n\t\tgoto fail;\n\n\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\tStream_Read_UINT32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */\n\n\tif (palette_update->number > 256)\n\t\tpalette_update->number = 256;\n\n\tif (Stream_GetRemainingLength(s) < palette_update->number * 3)\n\t\tgoto fail;\n\n\t/* paletteEntries */\n\tfor (i = 0; i < (int)palette_update->number; i++)\n\t{\n\t\tentry = &palette_update->entries[i];\n\t\tStream_Read_UINT8(s, entry->red);\n\t\tStream_Read_UINT8(s, entry->green);\n\t\tStream_Read_UINT8(s, entry->blue);\n\t}\n\n\treturn palette_update;\nfail:\n\tfree_palette_update(update->context, palette_update);\n\treturn NULL;\n}",
  5446. "project": "FreeRDP",
  5447. "hash": 283340729672566557322005741550262330782,
  5448. "size": 35,
  5449. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5450. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5451. "target": 0,
  5452. "dataset": "other",
  5453. "idx": 295055
  5454. },
  5455. {
  5456. "func": "static void update_force_flush(rdpContext* context)\n{\n\tupdate_flush(context);\n}",
  5457. "project": "FreeRDP",
  5458. "hash": 256528792647568151068722085504517172170,
  5459. "size": 4,
  5460. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5461. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5462. "target": 0,
  5463. "dataset": "other",
  5464. "idx": 295107
  5465. },
  5466. {
  5467. "func": "static BOOL update_check_flush(rdpContext* context, int size)\n{\n\twStream* s;\n\trdpUpdate* update = context->update;\n\ts = update->us;\n\n\tif (!update->us)\n\t{\n\t\tupdate_begin_paint(update);\n\t\treturn FALSE;\n\t}\n\n\tif (Stream_GetPosition(s) + size + 64 >= 0x3FFF)\n\t{\n\t\tupdate_flush(context);\n\t\treturn TRUE;\n\t}\n\n\treturn FALSE;\n}",
  5468. "project": "FreeRDP",
  5469. "hash": 309124954730636076383571471676715976119,
  5470. "size": 20,
  5471. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5472. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5473. "target": 0,
  5474. "dataset": "other",
  5475. "idx": 295050
  5476. },
  5477. {
  5478. "func": "static BOOL update_recv_orders(rdpUpdate* update, wStream* s)\n{\n\tUINT16 numberOrders;\n\n\tif (Stream_GetRemainingLength(s) < 6)\n\t{\n\t\tWLog_ERR(TAG, \"Stream_GetRemainingLength(s) < 6\");\n\t\treturn FALSE;\n\t}\n\n\tStream_Seek_UINT16(s); /* pad2OctetsA (2 bytes) */\n\tStream_Read_UINT16(s, numberOrders); /* numberOrders (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2OctetsB (2 bytes) */\n\n\twhile (numberOrders > 0)\n\t{\n\t\tif (!update_recv_order(update, s))\n\t\t{\n\t\t\tWLog_ERR(TAG, \"update_recv_order() failed\");\n\t\t\treturn FALSE;\n\t\t}\n\n\t\tnumberOrders--;\n\t}\n\n\treturn TRUE;\n}",
  5479. "project": "FreeRDP",
  5480. "hash": 70322016649550153851599919894853004418,
  5481. "size": 27,
  5482. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5483. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5484. "target": 0,
  5485. "dataset": "other",
  5486. "idx": 295094
  5487. },
  5488. {
  5489. "func": "static BOOL _update_begin_paint(rdpContext* context)\n{\n\twStream* s;\n\trdpUpdate* update = context->update;\n\n\tif (update->us)\n\t{\n\t\tif (!update_end_paint(update))\n\t\t\treturn FALSE;\n\t}\n\n\ts = fastpath_update_pdu_init_new(context->rdp->fastpath);\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tStream_SealLength(s);\n\tStream_Seek(s, 2); /* numberOrders (2 bytes) */\n\tupdate->combineUpdates = TRUE;\n\tupdate->numberOrders = 0;\n\tupdate->us = s;\n\treturn TRUE;\n}",
  5490. "project": "FreeRDP",
  5491. "hash": 206165084711978400762292566521593991429,
  5492. "size": 23,
  5493. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5494. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5495. "target": 0,
  5496. "dataset": "other",
  5497. "idx": 295041
  5498. },
  5499. {
  5500. "func": "BOOL update_recv(rdpUpdate* update, wStream* s)\n{\n\tBOOL rc = FALSE;\n\tUINT16 updateType;\n\trdpContext* context = update->context;\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t{\n\t\tWLog_ERR(TAG, \"Stream_GetRemainingLength(s) < 2\");\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, updateType); /* updateType (2 bytes) */\n\tWLog_Print(update->log, WLOG_TRACE, \"%s Update Data PDU\", UPDATE_TYPE_STRINGS[updateType]);\n\n\tif (!update_begin_paint(update))\n\t\tgoto fail;\n\n\tswitch (updateType)\n\t{\n\t\tcase UPDATE_TYPE_ORDERS:\n\t\t\trc = update_recv_orders(update, s);\n\t\t\tbreak;\n\n\t\tcase UPDATE_TYPE_BITMAP:\n\t\t{\n\t\t\tBITMAP_UPDATE* bitmap_update = update_read_bitmap_update(update, s);\n\n\t\t\tif (!bitmap_update)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"UPDATE_TYPE_BITMAP - update_read_bitmap_update() failed\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\n\t\t\trc = IFCALLRESULT(FALSE, update->BitmapUpdate, context, bitmap_update);\n\t\t\tfree_bitmap_update(update->context, bitmap_update);\n\t\t}\n\t\tbreak;\n\n\t\tcase UPDATE_TYPE_PALETTE:\n\t\t{\n\t\t\tPALETTE_UPDATE* palette_update = update_read_palette(update, s);\n\n\t\t\tif (!palette_update)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"UPDATE_TYPE_PALETTE - update_read_palette() failed\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\n\t\t\trc = IFCALLRESULT(FALSE, update->Palette, context, palette_update);\n\t\t\tfree_palette_update(context, palette_update);\n\t\t}\n\t\tbreak;\n\n\t\tcase UPDATE_TYPE_SYNCHRONIZE:\n\t\t\tif (!update_read_synchronize(update, s))\n\t\t\t\tgoto fail;\n\t\t\trc = IFCALLRESULT(TRUE, update->Synchronize, context);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\nfail:\n\n\tif (!update_end_paint(update))\n\t\trc = FALSE;\n\n\tif (!rc)\n\t{\n\t\tWLog_ERR(TAG, \"UPDATE_TYPE %s [%\" PRIu16 \"] failed\", update_type_to_string(updateType),\n\t\t updateType);\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  5501. "project": "FreeRDP",
  5502. "hash": 241599745468172248070055396754810927395,
  5503. "size": 78,
  5504. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5505. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5506. "target": 1,
  5507. "dataset": "other",
  5508. "idx": 199894
  5509. },
  5510. {
  5511. "func": "BOOL update_recv(rdpUpdate* update, wStream* s)\n{\n\tBOOL rc = FALSE;\n\tUINT16 updateType;\n\trdpContext* context = update->context;\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t{\n\t\tWLog_ERR(TAG, \"Stream_GetRemainingLength(s) < 2\");\n\t\treturn FALSE;\n\t}\n\n\tStream_Read_UINT16(s, updateType); /* updateType (2 bytes) */\n\tWLog_Print(update->log, WLOG_TRACE, \"%s Update Data PDU\", update_type_to_string(updateType));\n\n\tif (!update_begin_paint(update))\n\t\tgoto fail;\n\n\tswitch (updateType)\n\t{\n\t\tcase UPDATE_TYPE_ORDERS:\n\t\t\trc = update_recv_orders(update, s);\n\t\t\tbreak;\n\n\t\tcase UPDATE_TYPE_BITMAP:\n\t\t{\n\t\t\tBITMAP_UPDATE* bitmap_update = update_read_bitmap_update(update, s);\n\n\t\t\tif (!bitmap_update)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"UPDATE_TYPE_BITMAP - update_read_bitmap_update() failed\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\n\t\t\trc = IFCALLRESULT(FALSE, update->BitmapUpdate, context, bitmap_update);\n\t\t\tfree_bitmap_update(update->context, bitmap_update);\n\t\t}\n\t\tbreak;\n\n\t\tcase UPDATE_TYPE_PALETTE:\n\t\t{\n\t\t\tPALETTE_UPDATE* palette_update = update_read_palette(update, s);\n\n\t\t\tif (!palette_update)\n\t\t\t{\n\t\t\t\tWLog_ERR(TAG, \"UPDATE_TYPE_PALETTE - update_read_palette() failed\");\n\t\t\t\tgoto fail;\n\t\t\t}\n\n\t\t\trc = IFCALLRESULT(FALSE, update->Palette, context, palette_update);\n\t\t\tfree_palette_update(context, palette_update);\n\t\t}\n\t\tbreak;\n\n\t\tcase UPDATE_TYPE_SYNCHRONIZE:\n\t\t\tif (!update_read_synchronize(update, s))\n\t\t\t\tgoto fail;\n\t\t\trc = IFCALLRESULT(TRUE, update->Synchronize, context);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\nfail:\n\n\tif (!update_end_paint(update))\n\t\trc = FALSE;\n\n\tif (!rc)\n\t{\n\t\tWLog_ERR(TAG, \"UPDATE_TYPE %s [%\" PRIu16 \"] failed\", update_type_to_string(updateType),\n\t\t updateType);\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  5512. "project": "FreeRDP",
  5513. "hash": 210712111577567156501672184535618537131,
  5514. "size": 78,
  5515. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5516. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5517. "target": 0,
  5518. "dataset": "other",
  5519. "idx": 295081
  5520. },
  5521. {
  5522. "func": "static BOOL update_read_synchronize(rdpUpdate* update, wStream* s)\n{\n\tWINPR_UNUSED(update);\n\treturn Stream_SafeSeek(s, 2); /* pad2Octets (2 bytes) */\n\t /**\n\t * The Synchronize Update is an artifact from the\n\t * T.128 protocol and should be ignored.\n\t */\n}",
  5523. "project": "FreeRDP",
  5524. "hash": 15521892922773362950883267377898803764,
  5525. "size": 9,
  5526. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5527. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5528. "target": 0,
  5529. "dataset": "other",
  5530. "idx": 295084
  5531. },
  5532. {
  5533. "func": "BITMAP_UPDATE* update_read_bitmap_update(rdpUpdate* update, wStream* s)\n{\n\tUINT32 i;\n\tBITMAP_UPDATE* bitmapUpdate = calloc(1, sizeof(BITMAP_UPDATE));\n\n\tif (!bitmapUpdate)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, bitmapUpdate->number); /* numberRectangles (2 bytes) */\n\tWLog_Print(update->log, WLOG_TRACE, \"BitmapUpdate: %\" PRIu32 \"\", bitmapUpdate->number);\n\n\tif (bitmapUpdate->number > bitmapUpdate->count)\n\t{\n\t\tUINT32 count = bitmapUpdate->number * 2;\n\t\tBITMAP_DATA* newdata =\n\t\t (BITMAP_DATA*)realloc(bitmapUpdate->rectangles, sizeof(BITMAP_DATA) * count);\n\n\t\tif (!newdata)\n\t\t\tgoto fail;\n\n\t\tbitmapUpdate->rectangles = newdata;\n\t\tZeroMemory(&bitmapUpdate->rectangles[bitmapUpdate->count],\n\t\t sizeof(BITMAP_DATA) * (count - bitmapUpdate->count));\n\t\tbitmapUpdate->count = count;\n\t}\n\n\t/* rectangles */\n\tfor (i = 0; i < bitmapUpdate->number; i++)\n\t{\n\t\tif (!update_read_bitmap_data(update, s, &bitmapUpdate->rectangles[i]))\n\t\t\tgoto fail;\n\t}\n\n\treturn bitmapUpdate;\nfail:\n\tfree_bitmap_update(update->context, bitmapUpdate);\n\treturn NULL;\n}",
  5534. "project": "FreeRDP",
  5535. "hash": 33813168314939692314756191926075884636,
  5536. "size": 41,
  5537. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5538. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5539. "target": 0,
  5540. "dataset": "other",
  5541. "idx": 295080
  5542. },
  5543. {
  5544. "func": "static BITMAP_DATA* copy_bitmap_data(const BITMAP_DATA* data, size_t count)\n{\n\tsize_t x;\n\tBITMAP_DATA* dst = (BITMAP_DATA*)calloc(count, sizeof(BITMAP_DATA));\n\n\tif (!dst)\n\t\tgoto fail;\n\n\tfor (x = 0; x < count; x++)\n\t{\n\t\tdst[x] = data[x];\n\n\t\tif (data[x].bitmapLength > 0)\n\t\t{\n\t\t\tdst[x].bitmapDataStream = malloc(data[x].bitmapLength);\n\n\t\t\tif (!dst[x].bitmapDataStream)\n\t\t\t\tgoto fail;\n\n\t\t\tmemcpy(dst[x].bitmapDataStream, data[x].bitmapDataStream, data[x].bitmapLength);\n\t\t}\n\t}\n\n\treturn dst;\nfail:\n\tfree_bitmap_data(dst, count);\n\treturn NULL;\n}",
  5545. "project": "FreeRDP",
  5546. "hash": 188655361286083133164433477309812156230,
  5547. "size": 28,
  5548. "commit_id": "58dc36b3c883fd460199cedb6d30e58eba58298c",
  5549. "message": "Fixed possible NULL dereference",
  5550. "target": 0,
  5551. "dataset": "other",
  5552. "idx": 269201
  5553. },
  5554. {
  5555. "func": "static BOOL update_write_bitmap_update(rdpUpdate* update, wStream* s,\n const BITMAP_UPDATE* bitmapUpdate)\n{\n\tint i;\n\n\tif (!Stream_EnsureRemainingCapacity(s, 32))\n\t\treturn FALSE;\n\n\tStream_Write_UINT16(s, UPDATE_TYPE_BITMAP); /* updateType */\n\tStream_Write_UINT16(s, bitmapUpdate->number); /* numberRectangles (2 bytes) */\n\n\t/* rectangles */\n\tfor (i = 0; i < (int)bitmapUpdate->number; i++)\n\t{\n\t\tif (!update_write_bitmap_data(update, s, &bitmapUpdate->rectangles[i]))\n\t\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  5556. "project": "FreeRDP",
  5557. "hash": 151834610885528242589531618165967839061,
  5558. "size": 20,
  5559. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5560. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5561. "target": 0,
  5562. "dataset": "other",
  5563. "idx": 295043
  5564. },
  5565. {
  5566. "func": "static BOOL update_send_surface_frame_bits(rdpContext* context, const SURFACE_BITS_COMMAND* cmd,\n BOOL first, BOOL last, UINT32 frameId)\n{\n\twStream* s;\n\trdpRdp* rdp = context->rdp;\n\tBOOL ret = FALSE;\n\tupdate_force_flush(context);\n\ts = fastpath_update_pdu_init(rdp->fastpath);\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tif (first)\n\t{\n\t\tif (!update_write_surfcmd_frame_marker(s, SURFACECMD_FRAMEACTION_BEGIN, frameId))\n\t\t\tgoto out_fail;\n\t}\n\n\tif (!update_write_surfcmd_surface_bits(s, cmd))\n\t\tgoto out_fail;\n\n\tif (last)\n\t{\n\t\tif (!update_write_surfcmd_frame_marker(s, SURFACECMD_FRAMEACTION_END, frameId))\n\t\t\tgoto out_fail;\n\t}\n\n\tret = fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s,\n\t cmd->skipCompression);\n\tupdate_force_flush(context);\nout_fail:\n\tStream_Release(s);\n\treturn ret;\n}",
  5567. "project": "FreeRDP",
  5568. "hash": 156186922337010680300695249917953025135,
  5569. "size": 34,
  5570. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5571. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5572. "target": 0,
  5573. "dataset": "other",
  5574. "idx": 295025
  5575. },
  5576. {
  5577. "func": "static BOOL update_send_surface_bits(rdpContext* context,\n const SURFACE_BITS_COMMAND* surfaceBitsCommand)\n{\n\twStream* s;\n\trdpRdp* rdp = context->rdp;\n\tBOOL ret = FALSE;\n\tupdate_force_flush(context);\n\ts = fastpath_update_pdu_init(rdp->fastpath);\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tif (!update_write_surfcmd_surface_bits(s, surfaceBitsCommand))\n\t\tgoto out_fail;\n\n\tif (!fastpath_send_update_pdu(rdp->fastpath, FASTPATH_UPDATETYPE_SURFCMDS, s,\n\t surfaceBitsCommand->skipCompression))\n\t\tgoto out_fail;\n\n\tupdate_force_flush(context);\n\tret = TRUE;\nout_fail:\n\tStream_Release(s);\n\treturn ret;\n}",
  5578. "project": "FreeRDP",
  5579. "hash": 262077567665186060034193325515015087867,
  5580. "size": 25,
  5581. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  5582. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  5583. "target": 0,
  5584. "dataset": "other",
  5585. "idx": 295075
  5586. }
  5587. ]
  5588. },
  5589. {
  5590. "call_depth": 3,
  5591. "longest_call_chain": [
  5592. "sst_donor_thread",
  5593. "sst_disallow_writes",
  5594. "run_sql_command"
  5595. ],
  5596. "group_size": 8,
  5597. "functions": [
  5598. {
  5599. "func": "static void* sst_joiner_thread (void* a)\n{\n sst_thread_arg* arg= (sst_thread_arg*) a;\n int err= 1;\n\n {\n const char magic[] = \"ready\";\n const size_t magic_len = sizeof(magic) - 1;\n const size_t out_len = 512;\n char out[out_len];\n\n WSREP_INFO(\"Running: '%s'\", arg->cmd);\n\n wsp::process proc (arg->cmd, \"r\", arg->env);\n\n if (proc.pipe() && !proc.error())\n {\n const char* tmp= my_fgets (out, out_len, proc.pipe());\n\n if (!tmp || strlen(tmp) < (magic_len + 2) ||\n strncasecmp (tmp, magic, magic_len))\n {\n WSREP_ERROR(\"Failed to read '%s <addr>' from: %s\\n\\tRead: '%s'\",\n magic, arg->cmd, tmp);\n proc.wait();\n if (proc.error()) err = proc.error();\n }\n else\n {\n err = 0;\n }\n }\n else\n {\n err = proc.error();\n WSREP_ERROR(\"Failed to execute: %s : %d (%s)\",\n arg->cmd, err, strerror(err));\n }\n\n // signal sst_prepare thread with ret code,\n // it will go on sending SST request\n mysql_mutex_lock (&arg->lock);\n if (!err)\n {\n arg->ret_str = strdup (out + magic_len + 1);\n if (!arg->ret_str) err = ENOMEM;\n }\n arg->err = -err;\n mysql_cond_signal (&arg->cond);\n mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that.\n\n if (err) return NULL; /* lp:808417 - return immediately, don't signal\n * initializer thread to ensure single thread of\n * shutdown. */\n\n wsrep_uuid_t ret_uuid = WSREP_UUID_UNDEFINED;\n wsrep_seqno_t ret_seqno = WSREP_SEQNO_UNDEFINED;\n\n // in case of successfull receiver start, wait for SST completion/end\n char* tmp = my_fgets (out, out_len, proc.pipe());\n\n proc.wait();\n err= EINVAL;\n\n if (!tmp)\n {\n WSREP_ERROR(\"Failed to read uuid:seqno from joiner script.\");\n if (proc.error()) err = proc.error();\n }\n else\n {\n err= sst_scan_uuid_seqno (out, &ret_uuid, &ret_seqno);\n }\n\n if (err)\n {\n ret_uuid= WSREP_UUID_UNDEFINED;\n ret_seqno= -err;\n }\n\n // Tell initializer thread that SST is complete\n wsrep_sst_complete (&ret_uuid, ret_seqno, true);\n }\n\n return NULL;\n}",
  5600. "project": "mysql-wsrep",
  5601. "hash": 217439709963457463119203737558761620939,
  5602. "size": 86,
  5603. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5604. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5605. "target": 0,
  5606. "dataset": "other",
  5607. "idx": 454798
  5608. },
  5609. {
  5610. "func": "static void* sst_donor_thread (void* a)\n{\n sst_thread_arg* arg= (sst_thread_arg*)a;\n\n WSREP_INFO(\"Running: '%s'\", arg->cmd);\n\n int err= 1;\n bool locked= false;\n\n const char* out= NULL;\n const size_t out_len= 128;\n char out_buf[out_len];\n\n wsrep_uuid_t ret_uuid= WSREP_UUID_UNDEFINED;\n wsrep_seqno_t ret_seqno= WSREP_SEQNO_UNDEFINED; // seqno of complete SST\n\n wsp::thd thd(FALSE); // we turn off wsrep_on for this THD so that it can\n // operate with wsrep_ready == OFF\n wsp::process proc(arg->cmd, \"r\", arg->env);\n\n err= proc.error();\n\n/* Inform server about SST script startup and release TO isolation */\n mysql_mutex_lock (&arg->lock);\n arg->err = -err;\n mysql_cond_signal (&arg->cond);\n mysql_mutex_unlock (&arg->lock); //! @note arg is unusable after that.\n\n if (proc.pipe() && !err)\n {\nwait_signal:\n out= my_fgets (out_buf, out_len, proc.pipe());\n\n if (out)\n {\n const char magic_flush[]= \"flush tables\";\n const char magic_cont[]= \"continue\";\n const char magic_done[]= \"done\";\n\n if (!strcasecmp (out, magic_flush))\n {\n err= sst_flush_tables (thd.ptr);\n if (!err)\n {\n sst_disallow_writes (thd.ptr, true);\n locked= true;\n goto wait_signal;\n }\n }\n else if (!strcasecmp (out, magic_cont))\n {\n if (locked)\n {\n sst_disallow_writes (thd.ptr, false);\n thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr);\n locked= false;\n }\n err= 0;\n goto wait_signal;\n }\n else if (!strncasecmp (out, magic_done, strlen(magic_done)))\n {\n err= sst_scan_uuid_seqno (out + strlen(magic_done) + 1,\n &ret_uuid, &ret_seqno);\n }\n else\n {\n WSREP_WARN(\"Received unknown signal: '%s'\", out);\n }\n }\n else\n {\n WSREP_ERROR(\"Failed to read from: %s\", proc.cmd());\n proc.wait();\n }\n if (!err && proc.error()) err= proc.error();\n }\n else\n {\n WSREP_ERROR(\"Failed to execute: %s : %d (%s)\",\n proc.cmd(), err, strerror(err));\n }\n\n if (locked) // don't forget to unlock server before return\n {\n sst_disallow_writes (thd.ptr, false);\n thd.ptr->global_read_lock.unlock_global_read_lock (thd.ptr);\n }\n\n // signal to donor that SST is over\n struct wsrep_gtid const state_id = {\n ret_uuid, err ? WSREP_SEQNO_UNDEFINED : ret_seqno\n };\n wsrep->sst_sent (wsrep, &state_id, -err);\n proc.wait();\n\n return NULL;\n}",
  5611. "project": "mysql-wsrep",
  5612. "hash": 38855360678351805483746364703237574356,
  5613. "size": 98,
  5614. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5615. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5616. "target": 0,
  5617. "dataset": "other",
  5618. "idx": 454815
  5619. },
  5620. {
  5621. "func": "static int run_sql_command(THD *thd, const char *query)\n{\n thd->set_query((char *)query, strlen(query));\n\n Parser_state ps;\n if (ps.init(thd, thd->query(), thd->query_length()))\n {\n WSREP_ERROR(\"SST query: %s failed\", query);\n return -1;\n }\n\n mysql_parse(thd, thd->query(), thd->query_length(), &ps);\n if (thd->is_error())\n {\n int const err= thd->get_stmt_da()->sql_errno();\n WSREP_WARN (\"error executing '%s': %d (%s)%s\",\n query, err, thd->get_stmt_da()->message(),\n err == ER_UNKNOWN_SYSTEM_VARIABLE ?\n \". Was mysqld built with --with-innodb-disallow-writes ?\" : \"\");\n thd->clear_error();\n return -1;\n }\n return 0;\n}",
  5622. "project": "mysql-wsrep",
  5623. "hash": 37295695973040892266835162114095774711,
  5624. "size": 24,
  5625. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5626. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5627. "target": 0,
  5628. "dataset": "other",
  5629. "idx": 454791
  5630. },
  5631. {
  5632. "func": "static void sst_disallow_writes (THD* thd, bool yes)\n{\n char query_str[64] = { 0, };\n ssize_t const query_max = sizeof(query_str) - 1;\n snprintf (query_str, query_max, \"SET GLOBAL innodb_disallow_writes=%d\",\n yes ? 1 : 0);\n\n if (run_sql_command(thd, query_str))\n {\n WSREP_ERROR(\"Failed to disallow InnoDB writes\");\n }\n}",
  5633. "project": "mysql-wsrep",
  5634. "hash": 300071219344737688107883953353829541766,
  5635. "size": 12,
  5636. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5637. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5638. "target": 0,
  5639. "dataset": "other",
  5640. "idx": 454794
  5641. },
  5642. {
  5643. "func": "void wsrep_sst_complete (const wsrep_uuid_t* sst_uuid,\n wsrep_seqno_t sst_seqno,\n bool needed)\n{\n if (mysql_mutex_lock (&LOCK_wsrep_sst)) abort();\n if (!sst_complete)\n {\n sst_complete = true;\n sst_needed = needed;\n local_uuid = *sst_uuid;\n local_seqno = sst_seqno;\n mysql_cond_signal (&COND_wsrep_sst);\n }\n else\n {\n /* This can happen when called from wsrep_synced_cb().\n At the moment there is no way to check there\n if main thread is still waiting for signal,\n so wsrep_sst_complete() is called from there\n each time wsrep_ready changes from FALSE -> TRUE.\n */\n WSREP_DEBUG(\"Nobody is waiting for SST.\");\n }\n mysql_mutex_unlock (&LOCK_wsrep_sst);\n}",
  5644. "project": "mysql-wsrep",
  5645. "hash": 261387592869957718631605446779087108833,
  5646. "size": 25,
  5647. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5648. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5649. "target": 0,
  5650. "dataset": "other",
  5651. "idx": 454812
  5652. },
  5653. {
  5654. "func": "static char* my_fgets (char* buf, size_t buf_len, FILE* stream)\n{\n char* ret= fgets (buf, buf_len, stream);\n\n if (ret)\n {\n size_t len = strlen(ret);\n if (len > 0 && ret[len - 1] == '\\n') ret[len - 1] = '\\0';\n }\n\n return ret;\n}",
  5655. "project": "mysql-wsrep",
  5656. "hash": 230996557064736561789330414529743929038,
  5657. "size": 12,
  5658. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5659. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5660. "target": 0,
  5661. "dataset": "other",
  5662. "idx": 454816
  5663. },
  5664. {
  5665. "func": "static int sst_scan_uuid_seqno (const char* str,\n wsrep_uuid_t* uuid, wsrep_seqno_t* seqno)\n{\n int offt = wsrep_uuid_scan (str, strlen(str), uuid);\n if (offt > 0 && strlen(str) > (unsigned int)offt && ':' == str[offt])\n {\n *seqno = strtoll (str + offt + 1, NULL, 10);\n if (*seqno != LLONG_MAX || errno != ERANGE)\n {\n return 0;\n }\n }\n\n WSREP_ERROR(\"Failed to parse uuid:seqno pair: '%s'\", str);\n return EINVAL;\n}",
  5666. "project": "mysql-wsrep",
  5667. "hash": 178394032981522595047583967498590201062,
  5668. "size": 16,
  5669. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5670. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5671. "target": 0,
  5672. "dataset": "other",
  5673. "idx": 454803
  5674. },
  5675. {
  5676. "func": "static int sst_flush_tables(THD* thd)\n{\n WSREP_INFO(\"Flushing tables for SST...\");\n\n int err;\n int not_used;\n if (run_sql_command(thd, \"FLUSH TABLES WITH READ LOCK\"))\n {\n WSREP_ERROR(\"Failed to flush and lock tables\");\n err = -1;\n }\n else\n {\n /* make sure logs are flushed after global read lock acquired */\n err= reload_acl_and_cache(thd, REFRESH_ENGINE_LOG | REFRESH_BINARY_LOG,\n\t\t\t (TABLE_LIST*) 0, &not_used);\n }\n\n if (err)\n {\n WSREP_ERROR(\"Failed to flush tables: %d (%s)\", err, strerror(err));\n }\n else\n {\n WSREP_INFO(\"Tables flushed.\");\n const char base_name[]= \"tables_flushed\";\n ssize_t const full_len= strlen(mysql_real_data_home) + strlen(base_name)+2;\n char *real_name = (char*) malloc(full_len);\n sprintf(real_name, \"%s/%s\", mysql_real_data_home, base_name);\n char *tmp_name = (char*) malloc(full_len + 4);\n sprintf(tmp_name, \"%s.tmp\", real_name);\n\n FILE* file= fopen(tmp_name, \"w+\");\n if (0 == file)\n {\n err= errno;\n WSREP_ERROR(\"Failed to open '%s': %d (%s)\", tmp_name, err,strerror(err));\n }\n else\n {\n fprintf(file, \"%s:%lld\\n\",\n wsrep_cluster_state_uuid, (long long)wsrep_locked_seqno);\n fsync(fileno(file));\n fclose(file);\n if (rename(tmp_name, real_name) == -1)\n {\n err= errno;\n WSREP_ERROR(\"Failed to rename '%s' to '%s': %d (%s)\",\n tmp_name, real_name, err,strerror(err));\n }\n }\n free(real_name);\n free(tmp_name);\n }\n\n return err;\n}",
  5677. "project": "mysql-wsrep",
  5678. "hash": 340238269756931424095419272594003794219,
  5679. "size": 57,
  5680. "commit_id": "4ea4b0c6a318209ac09b15aaa906c7b4a13b988c",
  5681. "message": "codership/mysql-wsrep-bugs#758 Donor uses invalid SST methods",
  5682. "target": 0,
  5683. "dataset": "other",
  5684. "idx": 454777
  5685. }
  5686. ]
  5687. },
  5688. {
  5689. "call_depth": 4,
  5690. "longest_call_chain": [
  5691. "APar_ExtractDetails",
  5692. "APar_ExtractTrackDetails",
  5693. "APar_Extract_esds_Info",
  5694. "APar_skip_filler"
  5695. ],
  5696. "group_size": 18,
  5697. "functions": [
  5698. {
  5699. "func": "uint16_t purge_extraneous_characters(char *data) {\n uint16_t purgings = 0;\n uint16_t str_len = strlen(data);\n for (uint16_t str_offset = 0; str_offset < str_len; str_offset++) {\n if (data[str_offset] < 32 || data[str_offset] == 127) {\n data[str_offset] = 19;\n purgings++;\n break;\n }\n }\n return purgings;\n}",
  5700. "project": "atomicparsley",
  5701. "hash": 101683490117903831020536704146633947144,
  5702. "size": 12,
  5703. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5704. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5705. "target": 0,
  5706. "dataset": "other",
  5707. "idx": 417014
  5708. },
  5709. {
  5710. "func": "uint8_t APar_skip_filler(FILE *isofile, uint32_t start_position) {\n uint8_t skip_bytes = 0;\n\n while (true) {\n uint8_t eval_byte = APar_read8(isofile, start_position + skip_bytes);\n\n if (eval_byte == 0x80 || eval_byte == 0x81 ||\n eval_byte == 0xFE) { // seems sometimes QT writes 0x81\n skip_bytes++;\n } else {\n break;\n }\n }\n return skip_bytes;\n}",
  5711. "project": "atomicparsley",
  5712. "hash": 62628116556512224921278752125499736093,
  5713. "size": 15,
  5714. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5715. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5716. "target": 0,
  5717. "dataset": "other",
  5718. "idx": 417016
  5719. },
  5720. {
  5721. "func": "void APar_Extract_devc_Info(FILE *isofile,\n short track_level_atom,\n TrackInfo *track_info) {\n uint64_t offset_into_devc = 8;\n APar_readX(track_info->encoder_name,\n isofile,\n parsedAtoms[track_level_atom].AtomicStart + offset_into_devc,\n 4);\n return;\n}",
  5722. "project": "atomicparsley",
  5723. "hash": 191832240744506458608612189209332629083,
  5724. "size": 10,
  5725. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5726. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5727. "target": 0,
  5728. "dataset": "other",
  5729. "idx": 417006
  5730. },
  5731. {
  5732. "func": "void APar_ExtractTrackDetails(char *uint32_buffer,\n FILE *isofile,\n Trackage *track,\n TrackInfo *track_info) {\n uint64_t _offset = 0;\n\n APar_TrackLevelInfo(track, \"tkhd\");\n if (APar_read8(isofile, parsedAtoms[track->track_atom].AtomicStart + 8) ==\n 0) {\n if (APar_read8(isofile, parsedAtoms[track->track_atom].AtomicStart + 11) &\n 1) {\n track_info->track_enabled = true;\n }\n track_info->creation_time =\n APar_read32(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + 12);\n track_info->modified_time =\n APar_read32(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + 16);\n track_info->duration =\n APar_read32(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + 28);\n } else {\n track_info->creation_time =\n APar_read64(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + 12);\n track_info->modified_time =\n APar_read64(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + 20);\n track_info->duration =\n APar_read64(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + 36);\n }\n\n // language code\n APar_TrackLevelInfo(track, \"mdhd\");\n memset(uint32_buffer, 0, 5);\n uint16_t packed_language = APar_read16(\n uint32_buffer, isofile, parsedAtoms[track->track_atom].AtomicStart + 28);\n memset(track_info->unpacked_lang, 0, 4);\n APar_UnpackLanguage(\n track_info->unpacked_lang,\n packed_language); // http://www.w3.org/WAI/ER/IG/ert/iso639.htm\n\n // track handler type\n APar_TrackLevelInfo(track, \"hdlr\");\n memset(uint32_buffer, 0, 5);\n track_info->track_type = APar_read32(\n uint32_buffer, isofile, parsedAtoms[track->track_atom].AtomicStart + 16);\n if (track_info->track_type == 0x736F756E) { // soun\n track_info->type_of_track = AUDIO_TRACK;\n } else if (track_info->track_type == 0x76696465) { // vide\n track_info->type_of_track = VIDEO_TRACK;\n }\n if (parsedAtoms[track->track_atom].AtomicLength > 34) {\n memset(track_info->track_hdlr_name, 0, sizeof(track_info->track_hdlr_name));\n APar_readX(track_info->track_hdlr_name,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + 32,\n std::min((uint64_t)sizeof(track_info->track_hdlr_name),\n parsedAtoms[track->track_atom].AtomicLength - 32));\n }\n\n // codec section\n APar_TrackLevelInfo(track, \"stsd\");\n memset(uint32_buffer, 0, 5);\n track_info->track_codec = APar_read32(\n uint32_buffer, isofile, parsedAtoms[track->track_atom].AtomicStart + 20);\n\n if (track_info->type_of_track & VIDEO_TRACK) { // vide\n track_info->video_width =\n APar_read16(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom + 1].AtomicStart + 32);\n track_info->video_height =\n APar_read16(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom + 1].AtomicStart + 34);\n track_info->macroblocks =\n (track_info->video_width / 16) * (track_info->video_height / 16);\n\n // avc profile & level\n if (track_info->track_codec == 0x61766331 ||\n track_info->track_codec == 0x64726D69) { // avc1 or drmi\n track_info->contains_esds = false;\n APar_TrackLevelInfo(track, \"avcC\");\n // get avc1 profile/level; atom 'avcC' is :\n // byte 1\tconfigurationVersion byte 2\tAVCProfileIndication byte 3\n // profile_compatibility byte 4\tAVCLevelIndication\n track_info->avc_version =\n APar_read8(isofile, parsedAtoms[track->track_atom].AtomicStart + 8);\n if (track_info->avc_version == 1) {\n track_info->profile =\n APar_read8(isofile, parsedAtoms[track->track_atom].AtomicStart + 9);\n // uint8_t profile_compatibility = APar_read8(isofile,\n // parsedAtoms[track.track_atom].AtomicStart + 10); /* is this reserved\n // ?? */\n track_info->level = APar_read8(\n isofile, parsedAtoms[track->track_atom].AtomicStart + 11);\n }\n\n // avc1 doesn't have a hardcoded bitrate, so calculate it (off of stsz\n // table summing) later\n } else if (track_info->track_codec == 0x73323633) { // s263\n APar_TrackLevelInfo(track, \"d263\");\n if (memcmp(parsedAtoms[track->track_atom].AtomicName, \"d263\", 4) == 0) {\n APar_Extract_d263_Info(\n uint32_buffer, isofile, track->track_atom, track_info);\n }\n\n } else { // mp4v\n APar_TrackLevelInfo(track, \"esds\");\n if (memcmp(parsedAtoms[track->track_atom].AtomicName, \"esds\", 4) == 0) {\n APar_Extract_esds_Info(\n uint32_buffer,\n isofile,\n track->track_atom - 1,\n track_info); // right, backtrack to the atom before 'esds' so we can\n // offset_into_stsd++\n } else if (track_info->track_codec == 0x73323633) { // s263\n track_info->type_of_track = VIDEO_TRACK;\n } else if (track_info->track_codec == 0x73616D72 ||\n track_info->track_codec == 0x73617762 ||\n track_info->track_codec == 0x73617770 ||\n track_info->track_codec ==\n 0x73766D72) { // samr, sawb, sawp & svmr\n track_info->type_of_track = AUDIO_TRACK;\n } else {\n track_info->type_of_track = OTHER_TRACK; // a 'jpeg' track will fall\n // here\n }\n }\n\n } else if (track_info->type_of_track & AUDIO_TRACK) {\n if (track_info->track_codec == 0x73616D72 ||\n track_info->track_codec == 0x73617762 ||\n track_info->track_codec == 0x73617770 ||\n track_info->track_codec ==\n 0x73766D72) { // samr,sawb, svmr (sawp doesn't contain modes)\n APar_Extract_AMR_Info(\n uint32_buffer, isofile, track->track_atom + 2, track_info);\n\n } else if (track_info->track_codec == 0x73657663) { // sevc\n APar_TrackLevelInfo(track, \"devc\");\n if (memcmp(parsedAtoms[track->track_atom].AtomicName, \"devc\", 4) == 0) {\n APar_Extract_devc_Info(isofile, track->track_atom, track_info);\n }\n\n } else if (track_info->track_codec == 0x73716370) { // sqcp\n APar_TrackLevelInfo(track, \"dqcp\");\n if (memcmp(parsedAtoms[track->track_atom].AtomicName, \"dqcp\", 4) == 0) {\n APar_Extract_devc_Info(isofile,\n track->track_atom,\n track_info); // its the same thing\n }\n\n } else if (track_info->track_codec == 0x73736D76) { // ssmv\n APar_TrackLevelInfo(track, \"dsmv\");\n if (memcmp(parsedAtoms[track->track_atom].AtomicName, \"dsmv\", 4) == 0) {\n APar_Extract_devc_Info(isofile,\n track->track_atom,\n track_info); // its the same thing\n }\n\n } else {\n APar_Extract_esds_Info(\n uint32_buffer, isofile, track->track_atom, track_info);\n }\n }\n\n // in case bitrate isn't found, manually determine it off of stsz summing\n if ((track_info->type_of_track & AUDIO_TRACK ||\n track_info->type_of_track & VIDEO_TRACK) &&\n track_info->avg_bitrate == 0) {\n if (track_info->track_codec == 0x616C6163) { // alac\n track_info->channels =\n APar_read16(uint32_buffer,\n isofile,\n parsedAtoms[track->track_atom + 1].AtomicStart + 24);\n }\n }\n\n APar_TrackLevelInfo(track, \"stsz\");\n if (memcmp(parsedAtoms[track->track_atom].AtomicName, \"stsz\", 4) == 0) {\n track_info->sample_aggregate =\n calcuate_sample_size(uint32_buffer, isofile, track->track_atom);\n }\n\n // get what exactly 'drmX' stands in for\n if (track_info->track_codec >= 0x64726D00 &&\n track_info->track_codec <= 0x64726DFF) {\n track_info->type_of_track += DRM_PROTECTED_TRACK;\n APar_TrackLevelInfo(track, \"frma\");\n memset(uint32_buffer, 0, 5);\n track_info->protected_codec = APar_read32(\n uint32_buffer, isofile, parsedAtoms[track->track_atom].AtomicStart + 8);\n }\n\n // Encoder string; occasionally, it appears under stsd for a video track; it\n // is typcally preceded by ' ' (1st char is unprintable) or 0x01B2\n if (track_info->contains_esds) {\n APar_TrackLevelInfo(track, \"esds\");\n\n // technically, user_data_start_code should be tested aginst 0x000001B2;\n // TODO: it should only be read up to section 3's length too\n _offset = APar_FindValueInAtom(\n uint32_buffer, isofile, track->track_atom, 24, 0x01B2);\n\n if (_offset > 0 && _offset < parsedAtoms[track->track_atom].AtomicLength) {\n _offset += 2;\n memset(track_info->encoder_name,\n 0,\n parsedAtoms[track->track_atom].AtomicLength - _offset);\n APar_readX(track_info->encoder_name,\n isofile,\n parsedAtoms[track->track_atom].AtomicStart + _offset,\n parsedAtoms[track->track_atom].AtomicLength - _offset);\n }\n }\n return;\n}",
  5733. "project": "atomicparsley",
  5734. "hash": 127721703970755291690436684429299715513,
  5735. "size": 227,
  5736. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5737. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5738. "target": 0,
  5739. "dataset": "other",
  5740. "idx": 417020
  5741. },
  5742. {
  5743. "func": "void APar_ExtractMovieDetails(char *uint32_buffer,\n FILE *isofile,\n AtomicInfo *mvhd_atom) {\n if (mvhd_atom->AtomicVerFlags & 0x01000000) {\n movie_info.creation_time =\n APar_read64(uint32_buffer, isofile, mvhd_atom->AtomicStart + 12);\n movie_info.modified_time =\n APar_read64(uint32_buffer, isofile, mvhd_atom->AtomicStart + 20);\n movie_info.timescale =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 28);\n movie_info.duration =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 32);\n movie_info.timescale =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 36);\n movie_info.duration =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 40);\n movie_info.playback_rate =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 44);\n movie_info.volume =\n APar_read16(uint32_buffer, isofile, mvhd_atom->AtomicStart + 48);\n } else {\n movie_info.creation_time = (uint64_t)APar_read32(\n uint32_buffer, isofile, mvhd_atom->AtomicStart + 12);\n movie_info.modified_time = (uint64_t)APar_read32(\n uint32_buffer, isofile, mvhd_atom->AtomicStart + 16);\n movie_info.timescale =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 20);\n movie_info.duration =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 24);\n movie_info.playback_rate =\n APar_read32(uint32_buffer, isofile, mvhd_atom->AtomicStart + 28);\n movie_info.volume =\n APar_read16(uint32_buffer, isofile, mvhd_atom->AtomicStart + 32);\n }\n\n movie_info.seconds = (float)movie_info.duration / (float)movie_info.timescale;\n#if defined(_MSC_VER)\n __int64 media_bits = (__int64)mdatData * 8;\n#else\n uint64_t media_bits = (uint64_t)mdatData * 8;\n#endif\n movie_info.simple_bitrate_calc =\n ((double)media_bits / movie_info.seconds) / 1000.0;\n\n return;\n}",
  5744. "project": "atomicparsley",
  5745. "hash": 42901587396681727887008920962788444091,
  5746. "size": 46,
  5747. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5748. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5749. "target": 0,
  5750. "dataset": "other",
  5751. "idx": 417005
  5752. },
  5753. {
  5754. "func": "void APar_TrackLevelInfo(Trackage *track, const char *track_search_atom_name) {\n uint8_t track_tally = 0;\n short iter = 0;\n\n while (parsedAtoms[iter].NextAtomNumber != 0) {\n\n if (strncmp(parsedAtoms[iter].AtomicName, \"trak\", 4) == 0) {\n track_tally += 1;\n if (track->track_num == 0) {\n track->total_tracks += 1;\n\n } else if (track->track_num == track_tally) {\n\n short next_atom = parsedAtoms[iter].NextAtomNumber;\n while (parsedAtoms[next_atom].AtomicLevel >\n parsedAtoms[iter].AtomicLevel) {\n\n if (strncmp(parsedAtoms[next_atom].AtomicName,\n track_search_atom_name,\n 4) == 0) {\n\n track->track_atom = parsedAtoms[next_atom].AtomicNumber;\n return;\n } else {\n next_atom = parsedAtoms[next_atom].NextAtomNumber;\n }\n if (parsedAtoms[next_atom].AtomicLevel ==\n parsedAtoms[iter].AtomicLevel) {\n track->track_atom = 0;\n }\n }\n }\n }\n iter = parsedAtoms[iter].NextAtomNumber;\n }\n return;\n}",
  5755. "project": "atomicparsley",
  5756. "hash": 122636019844906488610343867539066292935,
  5757. "size": 37,
  5758. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5759. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5760. "target": 0,
  5761. "dataset": "other",
  5762. "idx": 417011
  5763. },
  5764. {
  5765. "func": "void APar_ShowMPEG4VisualProfileInfo(TrackInfo *track_info) {\n fprintf(stdout, \" MPEG-4 Visual \");\n uint8_t mp4v_profile = 0;\n if (movie_info.contains_iods) {\n mp4v_profile = iods_info.video_profile_level;\n } else {\n mp4v_profile = track_info->m4v_profile;\n }\n\n // unparalleled joy - Annex G table g1 - a binary listing (this from\n // 14496-2:2001)\n if (mp4v_profile == 0x01) {\n fprintf(stdout, \"Simple Profile, Level 1\"); // 00000001\n } else if (mp4v_profile == 0x02) {\n fprintf(stdout, \"Simple Profile, Level 2\"); // 00000010\n } else if (mp4v_profile == 0x03) {\n fprintf(stdout,\n \"Simple Profile, Level 3\"); // most files will land here //00000011\n\n } else if (mp4v_profile == 0x08) { // Compressor can create these in 3gp files\n fprintf(stdout, \"Simple Profile, Level 0\"); // ISO 14496-2:2004(e)\n // //00001000\n\n // Reserved 00000100 - 00000111\n } else if (mp4v_profile == 0x10) {\n fprintf(stdout, \"Simple Scalable Profile, Level 0\"); // 00010000\n } else if (mp4v_profile == 0x11) {\n fprintf(stdout, \"Simple Scalable Profile, Level 1\"); // 00010001\n } else if (mp4v_profile == 0x12) {\n fprintf(stdout, \"Simple Scalable Profile, Level 2\"); // 00010010\n\n // Reserved 00010011 - 00100000\n } else if (mp4v_profile == 0x21) {\n fprintf(stdout, \"Core Profile, Level 1\"); // 00100001\n } else if (mp4v_profile == 0x22) {\n fprintf(stdout, \"Core Profile, Level 2\"); // 00100010\n\n // Reserved 00100011 - 00110001\n } else if (mp4v_profile == 0x32) {\n fprintf(stdout, \"Main Profile, Level 2\"); // 00110010\n } else if (mp4v_profile == 0x33) {\n fprintf(stdout, \"Main Profile, Level 3\"); // 00110011\n } else if (mp4v_profile == 0x34) {\n fprintf(stdout, \"Main Profile, Level 4\"); // 00110100\n\n // Reserved 00110101 - 01000001\n } else if (mp4v_profile == 0x42) {\n fprintf(stdout, \"N-bit Profile, Level 2\"); // 01000010\n\n // Reserved 01000011 - 01010000\n } else if (mp4v_profile == 0x51) {\n fprintf(stdout, \"Scalable Texture Profile, Level 1\"); // 01010001\n\n // Reserved 01010010 - 01100000\n } else if (mp4v_profile == 0x61) {\n fprintf(stdout, \"Simple Face Animation, Level 1\"); // 01100001\n } else if (mp4v_profile == 0x62) {\n fprintf(stdout, \"Simple Face Animation, Level 2\"); // 01100010\n\n } else if (mp4v_profile == 0x63) {\n fprintf(stdout, \"Simple FBA Profile, Level 1\"); // 01100011\n } else if (mp4v_profile == 0x64) {\n fprintf(stdout, \"Simple FBA Profile, Level 2\"); // 01100100\n\n // Reserved 01100101 - 01110000\n } else if (mp4v_profile == 0x71) {\n fprintf(stdout, \"Basic Animated Texture Profile, Level 1\"); // 01110001\n } else if (mp4v_profile == 0x72) {\n fprintf(stdout, \"Basic Animated Texture Profile, Level 2\"); // 01110010\n\n // Reserved 01110011 - 10000000\n } else if (mp4v_profile == 0x81) {\n fprintf(stdout, \"Hybrid Profile, Level 1\"); // 10000001\n } else if (mp4v_profile == 0x82) {\n fprintf(stdout, \"Hybrid Profile, Level 2\"); // 10000010\n\n // Reserved 10000011 - 10010000\n } else if (mp4v_profile == 0x91) {\n fprintf(stdout, \"Advanced Real Time Simple Profile, Level 1\"); // 10010001\n } else if (mp4v_profile == 0x92) {\n fprintf(stdout, \"Advanced Real Time Simple Profile, Level 2\"); // 10010010\n } else if (mp4v_profile == 0x93) {\n fprintf(stdout, \"Advanced Real Time Simple Profile, Level 3\"); // 10010011\n } else if (mp4v_profile == 0x94) {\n fprintf(stdout, \"Advanced Real Time Simple Profile, Level 4\"); // 10010100\n\n // Reserved 10010101 - 10100000\n } else if (mp4v_profile == 0xA1) {\n fprintf(stdout, \"Core Scalable Profile, Level 1\"); // 10100001\n } else if (mp4v_profile == 0xA2) {\n fprintf(stdout, \"Core Scalable Profile, Level 2\"); // 10100010\n } else if (mp4v_profile == 0xA3) {\n fprintf(stdout, \"Core Scalable Profile, Level 3\"); // 10100011\n\n // Reserved 10100100 - 10110000\n } else if (mp4v_profile == 0xB1) {\n fprintf(stdout, \"Advanced Coding Efficiency Profile, Level 1\"); // 10110001\n } else if (mp4v_profile == 0xB2) {\n fprintf(stdout, \"Advanced Coding Efficiency Profile, Level 2\"); // 10110010\n } else if (mp4v_profile == 0xB3) {\n fprintf(stdout, \"Advanced Coding Efficiency Profile, Level 3\"); // 10110011\n } else if (mp4v_profile == 0xB4) {\n fprintf(stdout, \"Advanced Coding Efficiency Profile, Level 4\"); // 10110100\n\n // Reserved 10110101 11000000\n } else if (mp4v_profile == 0xC1) {\n fprintf(stdout, \"Advanced Core Profile, Level 1\"); // 11000001\n } else if (mp4v_profile == 0xC2) {\n fprintf(stdout, \"Advanced Core Profile, Level 2\"); // 11000010\n\n // Reserved 11000011 11010000\n } else if (mp4v_profile == 0xD1) {\n fprintf(stdout, \"Advanced Scalable Texture, Level 1\"); // 11010001\n } else if (mp4v_profile == 0xD2) {\n fprintf(stdout, \"Advanced Scalable Texture, Level 2\"); // 11010010\n } else if (mp4v_profile == 0xD2) {\n fprintf(stdout, \"Advanced Scalable Texture, Level 3\"); // 11010011\n\n // from a draft document - 1999 (earlier than the 2000 above!!)\n } else if (mp4v_profile == 0xE1) {\n fprintf(stdout, \"Simple Studio Profile, Level 1\"); // 11100001\n } else if (mp4v_profile == 0xE2) {\n fprintf(stdout, \"Simple Studio Profile, Level 2\"); // 11100010\n } else if (mp4v_profile == 0xE3) {\n fprintf(stdout, \"Simple Studio Profile, Level 3\"); // 11100011\n } else if (mp4v_profile == 0xE4) {\n fprintf(stdout, \"Simple Studio Profile, Level 4\"); // 11100100\n\n } else if (mp4v_profile == 0xE5) {\n fprintf(stdout, \"Core Studio Profile, Level 1\"); // 11100101\n } else if (mp4v_profile == 0xE6) {\n fprintf(stdout, \"Core Studio Profile, Level 2\"); // 11100110\n } else if (mp4v_profile == 0xE7) {\n fprintf(stdout, \"Core Studio Profile, Level 3\"); // 11100111\n } else if (mp4v_profile == 0xE8) {\n fprintf(stdout, \"Core Studio Profile, Level 4\"); // 11101000\n\n // Reserved 11101001 - 11101111\n // ISO 14496-2:2004(e)\n } else if (mp4v_profile == 0xF0) {\n fprintf(stdout, \"Advanced Simple Profile, Level 0\"); // 11110000\n } else if (mp4v_profile == 0xF1) {\n fprintf(stdout, \"Advanced Simple Profile, Level 1\"); // 11110001\n } else if (mp4v_profile == 0xF2) {\n fprintf(\n stdout,\n \"Advanced Simple Profile, Level 2\"); // 11110010 ////3gp files that QT\n // says is H.263 have esds to 0xF2\n // & their ObjectType set to 0x20\n // (mpeg-4 visual)\n ////...and its been figured out -\n /// FILE EXTENSION of all things\n /// determines mpeg-4 ASP or H.263\n } else if (mp4v_profile == 0xF3) {\n fprintf(stdout, \"Advanced Simple Profile, Level 3\"); // 11110011\n } else if (mp4v_profile == 0xF4) {\n fprintf(stdout, \"Advanced Simple Profile, Level 4\"); // 11110100\n } else if (mp4v_profile == 0xF5) {\n fprintf(stdout, \"Advanced Simple Profile, Level 5\"); // 11110101\n\n // Reserved 11110110\n } else if (mp4v_profile == 0xF7) {\n fprintf(stdout, \"Advanced Simple Profile, Level 3b\"); // 11110111\n\n } else if (mp4v_profile == 0xF7) {\n fprintf(stdout, \"Fine Granularity Scalable Profile/Level 0\"); // 11111000\n } else if (mp4v_profile == 0xF7) {\n fprintf(stdout, \"Fine Granularity Scalable Profile/Level 1\"); // 11111001\n } else if (mp4v_profile == 0xF7) {\n fprintf(stdout, \"Fine Granularity Scalable Profile/Level 2\"); // 11111010\n } else if (mp4v_profile == 0xF7) {\n fprintf(stdout, \"Fine Granularity Scalable Profile/Level 3\"); // 11111011\n } else if (mp4v_profile == 0xF7) {\n fprintf(stdout, \"Fine Granularity Scalable Profile/Level 4\"); // 11111100\n } else if (mp4v_profile == 0xF7) {\n fprintf(stdout, \"Fine Granularity Scalable Profile/Level 5\"); // 11111101\n\n // Reserved 11111110\n // Reserved for Escape 11111111\n\n } else {\n fprintf(stdout, \"Unknown profile: 0x%X\", mp4v_profile);\n }\n return;\n}",
  5766. "project": "atomicparsley",
  5767. "hash": 266341568058411294601031432860065260063,
  5768. "size": 185,
  5769. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5770. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5771. "target": 0,
  5772. "dataset": "other",
  5773. "idx": 417022
  5774. },
  5775. {
  5776. "func": "uint8_t APar_ExtractChannelInfo(FILE *isofile, uint32_t pos) {\n uint8_t packed_channels = APar_read8(isofile, pos);\n uint8_t unpacked_channels =\n (packed_channels << 1); // just shift the first bit off the table\n unpacked_channels =\n (unpacked_channels >> 4); // and slide it on over back on the uint8_t\n return unpacked_channels;\n}",
  5777. "project": "atomicparsley",
  5778. "hash": 237421857616930203238808630521330313243,
  5779. "size": 8,
  5780. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5781. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5782. "target": 0,
  5783. "dataset": "other",
  5784. "idx": 417010
  5785. },
  5786. {
  5787. "func": "void APar_ShowMPEG4AACProfileInfo(TrackInfo *track_info) {\n if (track_info->descriptor_object_typeID == 1) {\n fprintf(stdout, \" MPEG-4 AAC Main Profile\");\n } else if (track_info->descriptor_object_typeID == 2) {\n fprintf(\n stdout,\n \" MPEG-4 AAC Low Complexity/LC Profile\"); // most files will land here\n } else if (track_info->descriptor_object_typeID == 3) {\n fprintf(stdout, \" MPEG-4 AAC Scaleable Sample Rate/SSR Profile\");\n } else if (track_info->descriptor_object_typeID == 4) {\n fprintf(stdout, \" MPEG-4 AAC Long Term Prediction Profile\");\n } else if (track_info->descriptor_object_typeID == 5) {\n fprintf(stdout, \" MPEG-4 AAC High Efficiency/HE Profile\");\n } else if (track_info->descriptor_object_typeID == 6) {\n fprintf(stdout, \" MPEG-4 AAC Scalable Profile\");\n } else if (track_info->descriptor_object_typeID == 7) {\n fprintf(stdout,\n \" MPEG-4 AAC Transform domain Weighted INterleave Vector \"\n \"Quantization/TwinVQ Profile\");\n } else if (track_info->descriptor_object_typeID == 8) {\n fprintf(stdout, \" MPEG-4 AAC Code Excited Linear Predictive/CELP Profile\");\n } else if (track_info->descriptor_object_typeID == 9) {\n fprintf(stdout, \" MPEG-4 AAC HVXC Profile\");\n\n } else if (track_info->descriptor_object_typeID == 12) {\n fprintf(stdout, \" MPEG-4 AAC TTSI Profile\");\n } else if (track_info->descriptor_object_typeID == 13) {\n fprintf(stdout, \" MPEG-4 AAC Main Synthesis Profile\");\n } else if (track_info->descriptor_object_typeID == 14) {\n fprintf(stdout, \" MPEG-4 AAC Wavetable Synthesis Profile\");\n } else if (track_info->descriptor_object_typeID == 15) {\n fprintf(stdout, \" MPEG-4 AAC General MIDI Profile\");\n } else if (track_info->descriptor_object_typeID == 16) {\n fprintf(stdout, \" MPEG-4 AAC Algorithmic Synthesis & Audio FX Profile\");\n } else if (track_info->descriptor_object_typeID == 17) {\n fprintf(stdout,\n \" MPEG-4 AAC AAC Low Complexity/LC (+error recovery) Profile\");\n\n } else if (track_info->descriptor_object_typeID == 19) {\n fprintf(stdout,\n \" MPEG-4 AAC Long Term Prediction (+error recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 20) {\n fprintf(stdout, \" MPEG-4 AAC Scalable (+error recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 21) {\n fprintf(stdout,\n \" MPEG-4 AAC Transform domain Weighted INterleave Vector \"\n \"Quantization/TwinVQ (+error recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 22) {\n fprintf(stdout,\n \" MPEG-4 AAC Bit Sliced Arithmetic Coding/BSAC (+error \"\n \"recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 23) {\n fprintf(stdout, \" MPEG-4 AAC Low Delay/LD (+error recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 24) {\n fprintf(stdout,\n \" MPEG-4 AAC Code Excited Linear Predictive/CELP (+error \"\n \"recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 25) {\n fprintf(stdout, \" MPEG-4 AAC HXVC (+error recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 26) {\n fprintf(stdout,\n \" MPEG-4 AAC Harmonic and Individual Lines plus \"\n \"Noise/HILN (+error recovery) Profile\");\n } else if (track_info->descriptor_object_typeID == 27) {\n fprintf(stdout, \" MPEG-4 AAC Parametric (+error recovery) Profile\");\n\n } else if (track_info->descriptor_object_typeID == 31) {\n fprintf(\n stdout,\n \" MPEG-4 ALS Audio Lossless Coding\"); // I think that mp4alsRM18 writes\n // the channels wrong after\n // objectedID: 0xF880 has 0\n // channels; 0xF890 is 2ch\n } else {\n fprintf(stdout,\n \" MPEG-4 Unknown profile: 0x%X\",\n track_info->descriptor_object_typeID);\n }\n return;\n}",
  5788. "project": "atomicparsley",
  5789. "hash": 165598504010110280304160833310444978647,
  5790. "size": 80,
  5791. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5792. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5793. "target": 0,
  5794. "dataset": "other",
  5795. "idx": 417019
  5796. },
  5797. {
  5798. "func": "void APar_ShowObjectProfileInfo(uint8_t track_type, TrackInfo *track_info) {\n if (track_info->contains_esds) {\n switch (track_info->ObjectTypeIndication) {\n // 0x00 es Lambada/Verboten/Forbidden\n case 0x01:\n case 0x02: {\n fprintf(stdout, \" MPEG-4 Systems (BIFS/ObjDesc)\");\n break;\n }\n case 0x03: {\n fprintf(stdout, \" Interaction Stream\");\n break;\n }\n case 0x04: {\n fprintf(stdout, \" MPEG-4 Systems Extended BIFS\");\n break;\n }\n case 0x05: {\n fprintf(stdout, \" MPEG-4 Systems AFX\");\n break;\n }\n case 0x06: {\n fprintf(stdout, \" Font Data Stream\");\n break;\n }\n case 0x08: {\n fprintf(stdout, \" Synthesized Texture Stream\");\n break;\n }\n case 0x07: {\n fprintf(stdout, \" Streaming Text Stream\");\n break;\n }\n // 0x09-0x1F reserved\n case 0x20: {\n APar_ShowMPEG4VisualProfileInfo(track_info);\n break;\n }\n\n case 0x40: { // vererable mpeg-4 aac\n APar_ShowMPEG4AACProfileInfo(track_info);\n break;\n }\n\n // 0x41-0x5F reserved\n case 0x60: {\n fprintf(stdout,\n \" MPEG-2 Visual Simple Profile\"); //'Visual ISO/IEC 13818-2\n // Simple Profile'\n break;\n }\n case 0x61: {\n fprintf(stdout, \" MPEG-2 Visual Main Profile\"); //'Visual ISO/IEC 13818-2\n // Main Profile'\n break;\n }\n case 0x62: {\n fprintf(\n stdout,\n \" MPEG-2 Visual SNR Profile\"); //'Visual ISO/IEC 13818-2 SNR Profile'\n break;\n }\n case 0x63: {\n fprintf(stdout,\n \" MPEG-2 Visual Spatial Profile\"); //'Visual ISO/IEC 13818-2\n // Spatial Profile'\n break;\n }\n case 0x64: {\n fprintf(stdout, \" MPEG-2 Visual High Profile\"); //'Visual ISO/IEC 13818-2\n // High Profile'\n break;\n }\n case 0x65: {\n fprintf(stdout, \" MPEG-2 Visual 4:2:2 Profile\"); //'Visual ISO/IEC\n // 13818-2 422 Profile'\n break;\n }\n case 0x66: {\n fprintf(\n stdout,\n \" MPEG-2 AAC Main Profile\"); //'Audio ISO/IEC 13818-7 Main Profile'\n break;\n }\n case 0x67: {\n fprintf(stdout,\n \" MPEG-2 AAC Low Complexity Profile\"); // Audio ISO/IEC 13818-7\n // LowComplexity Profile\n break;\n }\n case 0x68: {\n fprintf(\n stdout,\n \" MPEG-2 AAC Scaleable Sample Rate Profile\"); //'Audio ISO/IEC\n // 13818-7 Scaleable\n // Sampling Rate\n // Profile'\n break;\n }\n case 0x69: {\n fprintf(stdout, \" MPEG-2 Audio\"); //'Audio ISO/IEC 13818-3'\n break;\n }\n case 0x6A: {\n fprintf(stdout, \" MPEG-1 Visual\"); //'Visual ISO/IEC 11172-2'\n break;\n }\n case 0x6B: {\n fprintf(stdout, \" MPEG-1 Audio\"); //'Audio ISO/IEC 11172-3'\n break;\n }\n case 0x6C: {\n fprintf(stdout, \" JPEG\"); //'Visual ISO/IEC 10918-1'\n break;\n }\n case 0x6D: {\n fprintf(stdout, \" PNG\"); // http://www.mp4ra.org/object.html\n break;\n }\n case 0x6E: {\n fprintf(stdout, \" JPEG2000\"); //'Visual ISO/IEC 15444-1'\n break;\n }\n case 0xA0: {\n fprintf(stdout, \" 3GPP2 EVRC Voice\"); // http://www.mp4ra.org/object.html\n break;\n }\n case 0xA1: {\n fprintf(stdout, \" 3GPP2 SMV Voice\"); // http://www.mp4ra.org/object.html\n break;\n }\n case 0xA2: {\n fprintf(\n stdout,\n \" 3GPP2 Compact Multimedia Format\"); // http://www.mp4ra.org/object.html\n break;\n }\n\n // 0xC0-0xE0 user private\n case 0xE1: {\n fprintf(stdout,\n \" 3GPP2 QCELP (14K Voice)\"); // http://www.mp4ra.org/object.html\n break;\n }\n // 0xE2-0xFE user private\n // 0xFF no object type specified\n\n default: {\n // so many profiles, so little desire to list them all (in 14496-2 which I\n // don't have)\n if (movie_info.contains_iods && iods_info.audio_profile == 0xFE) {\n fprintf(stdout,\n \" Private user object: 0x%X\",\n track_info->ObjectTypeIndication);\n } else {\n fprintf(\n stdout,\n \" Object Type Indicator: 0x%X Description Ojbect Type ID: 0x%X\\n\",\n track_info->ObjectTypeIndication,\n track_info->descriptor_object_typeID);\n }\n break;\n }\n }\n\n } else if (track_type == AVC1_TRACK) {\n // profiles & levels are in the 14496-10 pdf (which I don't have access to),\n // so... http://lists.mpegif.org/pipermail/mp4-tech/2006-January/006255.html\n // http://iphome.hhi.de/suehring/tml/doc/lenc/html/configfile_8c-source.html\n // 66=baseline, 77=main, 88=extended; 100=High, 110=High 10, 122=High 4:2:2,\n // 144=High 4:4:4\n\n switch (track_info->profile) {\n case 66: {\n fprintf(stdout, \" AVC Baseline Profile\");\n break;\n }\n case 77: {\n fprintf(stdout, \" AVC Main Profile\");\n break;\n }\n case 88: {\n fprintf(stdout, \" AVC Extended Profile\");\n break;\n }\n case 100: {\n fprintf(stdout, \" AVC High Profile\");\n break;\n }\n case 110: {\n fprintf(stdout, \" AVC High 10 Profile\");\n break;\n }\n case 122: {\n fprintf(stdout, \" AVC High 4:2:2 Profile\");\n break;\n }\n case 144: {\n fprintf(stdout, \" AVC High 4:4:4 Profile\");\n break;\n }\n default: {\n fprintf(stdout, \" Unknown Profile: %u\", track_info->profile);\n break;\n }\n } // end profile switch\n\n // Don't have access to levels either, but working off of:\n // http://iphome.hhi.de/suehring/tml/doc/lenc/html/configfile_8c-source.html\n\n // and the 15 levels it says here:\n // http://www.chiariglione.org/mpeg/technologies/mp04-avc/index.htm (1b in\n // http://en.wikipedia.org/wiki/H.264 seems nonsensical) working backwards,\n // we get... a simple 2 digit number (with '20' just drop the 0; with 21,\n // put in a decimal)\n if (track_info->level > 0) {\n switch (track_info->level) {\n case 10:\n case 20:\n case 30:\n case 40:\n case 50: {\n fprintf(stdout, \", Level %u\", track_info->level / 10);\n break;\n }\n case 11:\n case 12:\n case 13:\n case 21:\n case 22:\n case 31:\n case 32:\n case 41:\n case 42:\n case 51: {\n fprintf(stdout,\n \", Level %u.%u\",\n track_info->level / 10,\n track_info->level % 10);\n break;\n }\n default: {\n fprintf(stdout,\n \", Unknown level %u.%u\",\n track_info->level / 10,\n track_info->level % 10);\n }\n\n } // end switch\n } // end level if\n } else if (track_type == S_AMR_TRACK) {\n char amr_modes[500] = {};\n if (track_info->track_codec == 0x73616D72 ||\n track_info->track_codec == 0x73617762) {\n if (track_info->amr_modes & 0x0001)\n mem_append(\"0\", amr_modes);\n if (track_info->amr_modes & 0x0002)\n mem_append(\"1\", amr_modes);\n if (track_info->amr_modes & 0x0004)\n mem_append(\"2\", amr_modes);\n if (track_info->amr_modes & 0x0008)\n mem_append(\"3\", amr_modes);\n if (track_info->amr_modes & 0x0010)\n mem_append(\"4\", amr_modes);\n if (track_info->amr_modes & 0x0020)\n mem_append(\"5\", amr_modes);\n if (track_info->amr_modes & 0x0040)\n mem_append(\"6\", amr_modes);\n if (track_info->amr_modes & 0x0080)\n mem_append(\"7\", amr_modes);\n if (track_info->amr_modes & 0x0100)\n mem_append(\"8\", amr_modes);\n if (strlen(amr_modes) == 0)\n memcpy(amr_modes, \"none\", 4);\n } else if (track_info->track_codec == 0x73766D72) {\n if (track_info->amr_modes & 0x0001)\n mem_append(\"VMR-WB Mode 0, \", amr_modes);\n if (track_info->amr_modes & 0x0002)\n mem_append(\"VMR-WB Mode 1, \", amr_modes);\n if (track_info->amr_modes & 0x0004)\n mem_append(\"VMR-WB Mode 2, \", amr_modes);\n if (track_info->amr_modes & 0x0008)\n mem_append(\"VMR-WB Mode 3 (AMR-WB interoperable mode), \", amr_modes);\n if (track_info->amr_modes & 0x0010)\n mem_append(\"VMR-WB Mode 4, \", amr_modes);\n if (track_info->amr_modes & 0x0020)\n mem_append(\"VMR-WB Mode 2 with maximum half-rate, \", amr_modes);\n if (track_info->amr_modes & 0x0040)\n mem_append(\"VMR-WB Mode 4 with maximum half-rate, \", amr_modes);\n uint16_t amr_modes_len = strlen(amr_modes);\n if (amr_modes_len > 0)\n memset(amr_modes + (amr_modes_len - 1), 0, 2);\n }\n\n if (track_info->track_codec == 0x73616D72) { // samr\n fprintf(stdout,\n \" AMR Narrow-Band. Modes: %s. Encoder vendor code: %s\\n\",\n amr_modes,\n track_info->encoder_name);\n } else if (track_info->track_codec == 0x73617762) { // sawb\n fprintf(stdout,\n \" AMR Wide-Band. Modes: %s. Encoder vendor code: %s\\n\",\n amr_modes,\n track_info->encoder_name);\n } else if (track_info->track_codec == 0x73617770) { // sawp\n fprintf(stdout,\n \" AMR Wide-Band WB+. Encoder vendor code: %s\\n\",\n track_info->encoder_name);\n } else if (track_info->track_codec == 0x73766D72) { // svmr\n fprintf(stdout,\n \" AMR VBR Wide-Band. Encoder vendor code: %s\\n\",\n track_info->encoder_name);\n }\n } else if (track_type == EVRC_TRACK) {\n fprintf(stdout,\n \" EVRC (Enhanced Variable Rate Coder). Encoder vendor code: %s\\n\",\n track_info->encoder_name);\n\n } else if (track_type == QCELP_TRACK) {\n fprintf(stdout,\n \" QCELP (Qualcomm Code Excited Linear Prediction). Encoder vendor \"\n \"code: %s\\n\",\n track_info->encoder_name);\n\n } else if (track_type == S263_TRACK) {\n if (track_info->profile == 0) {\n fprintf(stdout,\n \" H.263 Baseline Profile, Level %u. Encoder vendor code: %s\",\n track_info->level,\n track_info->encoder_name);\n } else {\n fprintf(stdout,\n \" H.263 Profile: %u, Level %u. Encoder vendor code: %s\",\n track_info->profile,\n track_info->level,\n track_info->encoder_name);\n }\n }\n if (track_type == AUDIO_TRACK) {\n if (track_info->section5_length == 0) {\n fprintf(stdout, \" channels: (%u)\\n\", track_info->channels);\n } else {\n fprintf(stdout, \" channels: [%u]\\n\", track_info->channels);\n }\n }\n}",
  5799. "project": "atomicparsley",
  5800. "hash": 124350642846074410248190708765891059001,
  5801. "size": 346,
  5802. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5803. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5804. "target": 0,
  5805. "dataset": "other",
  5806. "idx": 417012
  5807. },
  5808. {
  5809. "func": "void APar_Extract_iods_Info(FILE *isofile, AtomicInfo *iods_atom) {\n uint64_t iods_offset = iods_atom->AtomicStart + 8;\n if (iods_atom->AtomicVerFlags == 0 &&\n APar_read8(isofile, iods_offset + 4) == 0x10) {\n iods_offset += 5;\n iods_offset += APar_skip_filler(isofile, iods_offset);\n uint8_t iods_objdescrip_len = APar_read8(isofile, iods_offset);\n iods_offset++;\n if (iods_objdescrip_len >= 7) {\n iods_info.od_profile_level = APar_read8(isofile, iods_offset + 2);\n iods_info.scene_profile_level = APar_read8(isofile, iods_offset + 3);\n iods_info.audio_profile = APar_read8(isofile, iods_offset + 4);\n iods_info.video_profile_level = APar_read8(isofile, iods_offset + 5);\n iods_info.graphics_profile_level = APar_read8(isofile, iods_offset + 6);\n }\n }\n return;\n}",
  5810. "project": "atomicparsley",
  5811. "hash": 277384074896141257014460403709543671039,
  5812. "size": 18,
  5813. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5814. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5815. "target": 0,
  5816. "dataset": "other",
  5817. "idx": 417015
  5818. },
  5819. {
  5820. "func": "void mem_append(const char *add_string, char *dest_string) {\n uint8_t str_len = strlen(dest_string);\n if (str_len > 0) {\n memcpy(dest_string + str_len, \", \", 2);\n memcpy(dest_string + str_len + 2, add_string, strlen(add_string));\n } else {\n memcpy(dest_string, add_string, strlen(add_string));\n }\n return;\n}",
  5821. "project": "atomicparsley",
  5822. "hash": 60652369648347309681691534134780812327,
  5823. "size": 10,
  5824. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5825. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5826. "target": 0,
  5827. "dataset": "other",
  5828. "idx": 417013
  5829. },
  5830. {
  5831. "func": "void APar_Print_TrackDetails(TrackInfo *track_info) {\n if (track_info->max_bitrate > 0 && track_info->avg_bitrate > 0) {\n fprintf(stdout, \" %.2f kbp/s\", (float)track_info->avg_bitrate / 1000.0);\n } else { // some ffmpeg encodings have avg_bitrate set to 0, but an inexact\n // max_bitrate - actually, their esds seems a mess to me\n#if defined(_MSC_VER)\n fprintf(stdout,\n \" %.2lf* kbp/s\",\n ((double)((__int64)track_info->sample_aggregate) /\n ((double)((__int64)track_info->duration) /\n (double)((__int64)movie_info.timescale))) /\n 1000.0 * 8);\n fprintf(stdout,\n \" %.3f sec\",\n (float)track_info->duration / (float)movie_info.timescale);\n#else\n fprintf(stdout,\n \" %.2lf* kbp/s\",\n ((double)track_info->sample_aggregate /\n ((double)track_info->duration / (double)movie_info.timescale)) /\n 1000.0 * 8);\n fprintf(stdout,\n \" %.3f sec\",\n (float)track_info->duration / (float)movie_info.timescale);\n#endif\n }\n\n if (track_info->track_codec == 0x6D703476) { // mp4v profile\n APar_ShowObjectProfileInfo(MP4V_TRACK, track_info);\n } else if (track_info->track_codec == 0x6D703461 ||\n track_info->protected_codec == 0x6D703461) { // mp4a profile\n APar_ShowObjectProfileInfo(AUDIO_TRACK, track_info);\n } else if (track_info->track_codec ==\n 0x616C6163) { // alac - can't figure out a hardcoded bitrate either\n fprintf(\n stdout, \" Apple Lossless channels: [%u]\\n\", track_info->channels);\n } else if (track_info->track_codec == 0x61766331 ||\n track_info->protected_codec == 0x61766331) {\n if (track_info->avc_version == 1) { // avc profile & level\n APar_ShowObjectProfileInfo(AVC1_TRACK, track_info);\n }\n } else if (track_info->track_codec == 0x73323633) { // s263 in 3gp\n APar_ShowObjectProfileInfo(S263_TRACK, track_info);\n } else if (track_info->track_codec == 0x73616D72 ||\n track_info->track_codec == 0x73617762 ||\n track_info->track_codec == 0x73617770 ||\n track_info->track_codec ==\n 0x73766D72) { // samr,sawb,sawp & svmr in 3gp\n track_info->type_of_track = S_AMR_TRACK;\n APar_ShowObjectProfileInfo(track_info->type_of_track, track_info);\n } else if (track_info->track_codec == 0x73657663) { // evrc in 3gp\n track_info->type_of_track = EVRC_TRACK;\n APar_ShowObjectProfileInfo(track_info->type_of_track, track_info);\n } else if (track_info->track_codec == 0x73716370) { // qcelp in 3gp\n track_info->type_of_track = QCELP_TRACK;\n APar_ShowObjectProfileInfo(track_info->type_of_track, track_info);\n } else if (track_info->track_codec == 0x73736D76) { // smv in 3gp\n track_info->type_of_track = SMV_TRACK;\n APar_ShowObjectProfileInfo(track_info->type_of_track, track_info);\n } else { // unknown everything, 0 hardcoded bitrate\n APar_ShowObjectProfileInfo(track_info->type_of_track, track_info);\n fprintf(stdout, \"\\n\");\n }\n\n if (track_info->type_of_track & VIDEO_TRACK &&\n ((track_info->max_bitrate > 0 &&\n track_info->ObjectTypeIndication == 0x20) ||\n track_info->avc_version == 1 || track_info->protected_codec != 0)) {\n fprintf(stdout,\n \" %ux%u (%\" PRIu32 \" macroblocks)\\n\",\n track_info->video_width,\n track_info->video_height,\n track_info->macroblocks);\n } else if (track_info->type_of_track & VIDEO_TRACK) {\n fprintf(stdout, \"\\n\");\n }\n return;\n}",
  5832. "project": "atomicparsley",
  5833. "hash": 312415387240572110707737637139613228674,
  5834. "size": 78,
  5835. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5836. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5837. "target": 0,
  5838. "dataset": "other",
  5839. "idx": 417021
  5840. },
  5841. {
  5842. "func": "void APar_Extract_d263_Info(char *uint32_buffer,\n FILE *isofile,\n short track_level_atom,\n TrackInfo *track_info) {\n uint64_t offset_into_d263 = 8;\n APar_readX(track_info->encoder_name,\n isofile,\n parsedAtoms[track_level_atom].AtomicStart + offset_into_d263,\n 4);\n track_info->level = APar_read8(isofile,\n parsedAtoms[track_level_atom].AtomicStart +\n offset_into_d263 + 4 + 1);\n track_info->profile = APar_read8(isofile,\n parsedAtoms[track_level_atom].AtomicStart +\n offset_into_d263 + 4 + 2);\n // possible 'bitr' bitrate box afterwards\n return;\n}",
  5843. "project": "atomicparsley",
  5844. "hash": 170389225265527118918192526862948718799,
  5845. "size": 18,
  5846. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5847. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5848. "target": 0,
  5849. "dataset": "other",
  5850. "idx": 417008
  5851. },
  5852. {
  5853. "func": "void APar_Extract_AMR_Info(char *uint32_buffer,\n FILE *isofile,\n short track_level_atom,\n TrackInfo *track_info) {\n uint32_t amr_specific_offet = 8;\n APar_readX(track_info->encoder_name,\n isofile,\n parsedAtoms[track_level_atom].AtomicStart + amr_specific_offet,\n 4);\n if (track_info->track_codec == 0x73616D72 ||\n track_info->track_codec == 0x73617762 ||\n track_info->track_codec ==\n 0x73766D72) { // samr,sawb & svmr contain modes only\n track_info->amr_modes = APar_read16(\n uint32_buffer,\n isofile,\n parsedAtoms[track_level_atom].AtomicStart + amr_specific_offet + 4 + 1);\n }\n return;\n}",
  5854. "project": "atomicparsley",
  5855. "hash": 120362767435234697194582042432714238529,
  5856. "size": 20,
  5857. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5858. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5859. "target": 0,
  5860. "dataset": "other",
  5861. "idx": 417024
  5862. },
  5863. {
  5864. "func": "void APar_ExtractDetails(FILE *isofile, uint8_t optional_output) {\n char uint32_buffer[5];\n Trackage track = {0};\n\n AtomicInfo *mvhdAtom = APar_FindAtom(\"moov.mvhd\", false, VERSIONED_ATOM, 0);\n if (mvhdAtom != NULL) {\n APar_ExtractMovieDetails(uint32_buffer, isofile, mvhdAtom);\n fprintf(stdout,\n \"Movie duration: %.3lf seconds (%s) - %.2lf* kbp/sec bitrate \"\n \"(*=approximate)\\n\",\n movie_info.seconds,\n secsTOtime(movie_info.seconds),\n movie_info.simple_bitrate_calc);\n if (optional_output & SHOW_DATE_INFO) {\n fprintf(stdout,\n \" Presentation Creation Date (UTC): %s\\n\",\n APar_extract_UTC(movie_info.creation_time));\n fprintf(stdout,\n \" Presentation Modification Date (UTC): %s\\n\",\n APar_extract_UTC(movie_info.modified_time));\n }\n }\n\n AtomicInfo *iodsAtom = APar_FindAtom(\"moov.iods\", false, VERSIONED_ATOM, 0);\n if (iodsAtom != NULL) {\n movie_info.contains_iods = true;\n APar_Extract_iods_Info(isofile, iodsAtom);\n }\n\n if (optional_output & SHOW_TRACK_INFO) {\n APar_TrackLevelInfo(&track,\n NULL); // With track_num set to 0, it will return the\n // total trak atom into total_tracks here.\n\n fprintf(\n stdout, \"Low-level details. Total tracks: %u\\n\", track.total_tracks);\n fprintf(stdout,\n \"Trk Type Handler Kind Lang Bytes\\n\");\n\n if (track.total_tracks > 0) {\n while (track.total_tracks > track.track_num) {\n track.track_num += 1;\n TrackInfo track_info = {0};\n\n // tracknum, handler type, handler name\n APar_ExtractTrackDetails(uint32_buffer, isofile, &track, &track_info);\n uint16_t more_whitespace =\n purge_extraneous_characters(track_info.track_hdlr_name);\n\n if (strlen(track_info.track_hdlr_name) == 0) {\n memcpy(track_info.track_hdlr_name, \"[none listed]\", 13);\n }\n fprintf(stdout,\n \"%u %s %s\",\n track.track_num,\n uint32tochar4(track_info.track_type, uint32_buffer),\n track_info.track_hdlr_name);\n\n uint16_t handler_len = strlen(track_info.track_hdlr_name);\n if (handler_len < 25 + more_whitespace) {\n for (uint16_t i = handler_len; i < 25 + more_whitespace; i++) {\n fprintf(stdout, \" \");\n }\n }\n\n // codec, language\n fprintf(stdout,\n \" %s %s %\" PRIu64,\n uint32tochar4(track_info.track_codec, uint32_buffer),\n track_info.unpacked_lang,\n track_info.sample_aggregate);\n\n if (track_info.encoder_name[0] != 0 && track_info.contains_esds) {\n purge_extraneous_characters(track_info.encoder_name);\n fprintf(stdout, \" Encoder: %s\", track_info.encoder_name);\n }\n if (track_info.type_of_track & DRM_PROTECTED_TRACK) {\n fprintf(stdout,\n \" (protected %s)\",\n uint32tochar4(track_info.protected_codec, uint32_buffer));\n }\n\n fprintf(stdout, \"\\n\");\n /*---------------------------------*/\n\n if (track_info.type_of_track & VIDEO_TRACK ||\n track_info.type_of_track & AUDIO_TRACK) {\n APar_Print_TrackDetails(&track_info);\n }\n\n if (optional_output & SHOW_DATE_INFO) {\n fprintf(stdout,\n \" Creation Date (UTC): %s\\n\",\n APar_extract_UTC(track_info.creation_time));\n fprintf(stdout,\n \" Modification Date (UTC): %s\\n\",\n APar_extract_UTC(track_info.modified_time));\n }\n }\n }\n }\n}",
  5865. "project": "atomicparsley",
  5866. "hash": 235760196453077041717585104526456578938,
  5867. "size": 102,
  5868. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5869. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5870. "target": 1,
  5871. "dataset": "other",
  5872. "idx": 208981
  5873. },
  5874. {
  5875. "func": "void APar_ExtractDetails(FILE *isofile, uint8_t optional_output) {\n char uint32_buffer[8];\n Trackage track = {0};\n\n AtomicInfo *mvhdAtom = APar_FindAtom(\"moov.mvhd\", false, VERSIONED_ATOM, 0);\n if (mvhdAtom != NULL) {\n APar_ExtractMovieDetails(uint32_buffer, isofile, mvhdAtom);\n fprintf(stdout,\n \"Movie duration: %.3lf seconds (%s) - %.2lf* kbp/sec bitrate \"\n \"(*=approximate)\\n\",\n movie_info.seconds,\n secsTOtime(movie_info.seconds),\n movie_info.simple_bitrate_calc);\n if (optional_output & SHOW_DATE_INFO) {\n fprintf(stdout,\n \" Presentation Creation Date (UTC): %s\\n\",\n APar_extract_UTC(movie_info.creation_time));\n fprintf(stdout,\n \" Presentation Modification Date (UTC): %s\\n\",\n APar_extract_UTC(movie_info.modified_time));\n }\n }\n\n AtomicInfo *iodsAtom = APar_FindAtom(\"moov.iods\", false, VERSIONED_ATOM, 0);\n if (iodsAtom != NULL) {\n movie_info.contains_iods = true;\n APar_Extract_iods_Info(isofile, iodsAtom);\n }\n\n if (optional_output & SHOW_TRACK_INFO) {\n APar_TrackLevelInfo(&track,\n NULL); // With track_num set to 0, it will return the\n // total trak atom into total_tracks here.\n\n fprintf(\n stdout, \"Low-level details. Total tracks: %u\\n\", track.total_tracks);\n fprintf(stdout,\n \"Trk Type Handler Kind Lang Bytes\\n\");\n\n if (track.total_tracks > 0) {\n while (track.total_tracks > track.track_num) {\n track.track_num += 1;\n TrackInfo track_info = {0};\n\n // tracknum, handler type, handler name\n APar_ExtractTrackDetails(uint32_buffer, isofile, &track, &track_info);\n uint16_t more_whitespace =\n purge_extraneous_characters(track_info.track_hdlr_name);\n\n if (strlen(track_info.track_hdlr_name) == 0) {\n memcpy(track_info.track_hdlr_name, \"[none listed]\", 13);\n }\n fprintf(stdout,\n \"%u %s %s\",\n track.track_num,\n uint32tochar4(track_info.track_type, uint32_buffer),\n track_info.track_hdlr_name);\n\n uint16_t handler_len = strlen(track_info.track_hdlr_name);\n if (handler_len < 25 + more_whitespace) {\n for (uint16_t i = handler_len; i < 25 + more_whitespace; i++) {\n fprintf(stdout, \" \");\n }\n }\n\n // codec, language\n fprintf(stdout,\n \" %s %s %\" PRIu64,\n uint32tochar4(track_info.track_codec, uint32_buffer),\n track_info.unpacked_lang,\n track_info.sample_aggregate);\n\n if (track_info.encoder_name[0] != 0 && track_info.contains_esds) {\n purge_extraneous_characters(track_info.encoder_name);\n fprintf(stdout, \" Encoder: %s\", track_info.encoder_name);\n }\n if (track_info.type_of_track & DRM_PROTECTED_TRACK) {\n fprintf(stdout,\n \" (protected %s)\",\n uint32tochar4(track_info.protected_codec, uint32_buffer));\n }\n\n fprintf(stdout, \"\\n\");\n /*---------------------------------*/\n\n if (track_info.type_of_track & VIDEO_TRACK ||\n track_info.type_of_track & AUDIO_TRACK) {\n APar_Print_TrackDetails(&track_info);\n }\n\n if (optional_output & SHOW_DATE_INFO) {\n fprintf(stdout,\n \" Creation Date (UTC): %s\\n\",\n APar_extract_UTC(track_info.creation_time));\n fprintf(stdout,\n \" Modification Date (UTC): %s\\n\",\n APar_extract_UTC(track_info.modified_time));\n }\n }\n }\n }\n}",
  5876. "project": "atomicparsley",
  5877. "hash": 27305014511647361793546293488526992046,
  5878. "size": 102,
  5879. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5880. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5881. "target": 0,
  5882. "dataset": "other",
  5883. "idx": 417017
  5884. },
  5885. {
  5886. "func": "void APar_Extract_esds_Info(char *uint32_buffer,\n FILE *isofile,\n short track_level_atom,\n TrackInfo *track_info) {\n uint64_t offset_into_stsd = 0;\n\n while (offset_into_stsd < parsedAtoms[track_level_atom].AtomicLength) {\n offset_into_stsd++;\n if (APar_read32(uint32_buffer,\n isofile,\n parsedAtoms[track_level_atom].AtomicStart +\n offset_into_stsd) == 0x65736473) {\n track_info->contains_esds = true;\n\n uint64_t esds_start =\n parsedAtoms[track_level_atom].AtomicStart + offset_into_stsd - 4;\n uint64_t esds_length = APar_read32(uint32_buffer, isofile, esds_start);\n uint64_t offset_into_esds =\n 12; // 4bytes length + 4 bytes name + 4bytes null\n\n if (APar_read8(isofile, esds_start + offset_into_esds) == 0x03) {\n offset_into_esds++;\n offset_into_esds +=\n APar_skip_filler(isofile, esds_start + offset_into_esds);\n }\n\n uint8_t section3_length =\n APar_read8(isofile, esds_start + offset_into_esds);\n if (section3_length <= esds_length && section3_length != 0) {\n track_info->section3_length = section3_length;\n } else {\n break;\n }\n\n // for whatever reason, when mp4box muxes in ogg into an mp4 container,\n // section 3 gets a 0x9D byte (which doesn't fall inline with what AP\n // considers 'filler') then again, I haven't *completely* read the ISO\n // specifications, so I could just be missing it the the ->voluminous<-\n // 14496-X specifications.\n uint8_t test_byte =\n APar_read8(isofile, esds_start + offset_into_esds + 1);\n if (test_byte != 0) {\n offset_into_esds++;\n }\n\n offset_into_esds += 4; // 1 bytes section 0x03 length + 2 bytes + 1 byte\n\n if (APar_read8(isofile, esds_start + offset_into_esds) == 0x04) {\n offset_into_esds++;\n offset_into_esds +=\n APar_skip_filler(isofile, esds_start + offset_into_esds);\n }\n\n uint8_t section4_length =\n APar_read8(isofile, esds_start + offset_into_esds);\n if (section4_length <= section3_length && section4_length != 0) {\n track_info->section4_length = section4_length;\n\n if (section4_length == 0x9D)\n offset_into_esds++; // upper limit? when gpac puts an ogg in, section\n // 3 is 9D - so is sec4 (section 4 real length\n // with ogg = 0x0E86)\n\n offset_into_esds++;\n track_info->ObjectTypeIndication =\n APar_read8(isofile, esds_start + offset_into_esds);\n\n // this is just so that ogg in mp4 won't have some bizarre high bitrate\n // of like 2.8megabits/sec\n uint8_t a_v_flag =\n APar_read8(isofile,\n esds_start + offset_into_esds +\n 1); // mp4box with ogg will set this to DD,\n // mp4a has it as 0x40, mp4v has 0x20\n\n if (track_info->ObjectTypeIndication < 0xC0 &&\n a_v_flag < 0xA0) { // 0xC0 marks user streams; but things below that\n // might still be wrong (like 0x6D - png)\n offset_into_esds += 5;\n track_info->max_bitrate = APar_read32(\n uint32_buffer, isofile, esds_start + offset_into_esds);\n offset_into_esds += 4;\n track_info->avg_bitrate = APar_read32(\n uint32_buffer, isofile, esds_start + offset_into_esds);\n offset_into_esds += 4;\n }\n } else {\n break;\n }\n\n if (APar_read8(isofile, esds_start + offset_into_esds) == 0x05) {\n offset_into_esds++;\n offset_into_esds +=\n APar_skip_filler(isofile, esds_start + offset_into_esds);\n\n uint8_t section5_length =\n APar_read8(isofile, esds_start + offset_into_esds);\n if ((section5_length <= section4_length || section4_length == 1) &&\n section5_length != 0) {\n track_info->section5_length = section5_length;\n offset_into_esds += 1;\n\n if (track_info->type_of_track & AUDIO_TRACK) {\n uint8_t packed_objID = APar_read8(\n isofile,\n esds_start + offset_into_esds); // its packed with channel, but\n // channel is fetched separately\n track_info->descriptor_object_typeID = packed_objID >> 3;\n offset_into_esds += 1;\n\n track_info->channels = (uint16_t)APar_ExtractChannelInfo(\n isofile, esds_start + offset_into_esds);\n\n } else if (track_info->type_of_track & VIDEO_TRACK) {\n // technically, visual_object_sequence_start_code should be tested\n // aginst 0x000001B0\n if (APar_read16(uint32_buffer,\n isofile,\n esds_start + offset_into_esds + 2) == 0x01B0) {\n track_info->m4v_profile =\n APar_read8(isofile, esds_start + offset_into_esds + 2 + 2);\n }\n }\n }\n break; // uh, I've extracted the pertinent info\n }\n }\n if (offset_into_stsd > parsedAtoms[track_level_atom].AtomicLength) {\n break;\n }\n }\n if ((track_info->section5_length == 0 &&\n track_info->type_of_track & AUDIO_TRACK) ||\n track_info->channels == 0) {\n track_info->channels = APar_read16(\n uint32_buffer, isofile, parsedAtoms[track_level_atom].AtomicStart + 40);\n }\n return;\n}",
  5887. "project": "atomicparsley",
  5888. "hash": 338529420259989405369420107226016196272,
  5889. "size": 139,
  5890. "commit_id": "d72ccf06c98259d7261e0f3ac4fd8717778782c1",
  5891. "message": "Avoid stack overflow\n\nrefs: https://github.com/wez/atomicparsley/issues/32",
  5892. "target": 0,
  5893. "dataset": "other",
  5894. "idx": 417018
  5895. }
  5896. ]
  5897. },
  5898. {
  5899. "call_depth": 5,
  5900. "longest_call_chain": [
  5901. "svm_refresh_apicv_exec_ctrl",
  5902. "avic_post_state_restore",
  5903. "avic_handle_apic_id_update",
  5904. "avic_handle_ldr_update",
  5905. "avic_invalidate_logical_id_entry"
  5906. ],
  5907. "group_size": 15,
  5908. "functions": [
  5909. {
  5910. "func": "static void avic_invalidate_logical_id_entry(struct kvm_vcpu *vcpu)\n{\n\tstruct vcpu_svm *svm = to_svm(vcpu);\n\tbool flat = svm->dfr_reg == APIC_DFR_FLAT;\n\tu32 *entry = avic_get_logical_id_entry(vcpu, svm->ldr_reg, flat);\n\n\tif (entry)\n\t\tclear_bit(AVIC_LOGICAL_ID_ENTRY_VALID_BIT, (unsigned long *)entry);\n}",
  5911. "project": "linux",
  5912. "hash": 114357630180844998872360052660897220958,
  5913. "size": 9,
  5914. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5915. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5916. "target": 0,
  5917. "dataset": "other",
  5918. "idx": 432560
  5919. },
  5920. {
  5921. "func": "static inline void avic_post_state_restore(struct kvm_vcpu *vcpu)\n{\n\tif (avic_handle_apic_id_update(vcpu) != 0)\n\t\treturn;\n\tavic_handle_dfr_update(vcpu);\n\tavic_handle_ldr_update(vcpu);\n}",
  5922. "project": "linux",
  5923. "hash": 195561001580473228900395420022605266505,
  5924. "size": 7,
  5925. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5926. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5927. "target": 0,
  5928. "dataset": "other",
  5929. "idx": 432502
  5930. },
  5931. {
  5932. "func": "static void svm_ir_list_del(struct vcpu_svm *svm, struct amd_iommu_pi_data *pi)\n{\n\tunsigned long flags;\n\tstruct amd_svm_iommu_ir *cur;\n\n\tspin_lock_irqsave(&svm->ir_list_lock, flags);\n\tlist_for_each_entry(cur, &svm->ir_list, node) {\n\t\tif (cur->data != pi->ir_data)\n\t\t\tcontinue;\n\t\tlist_del(&cur->node);\n\t\tkfree(cur);\n\t\tbreak;\n\t}\n\tspin_unlock_irqrestore(&svm->ir_list_lock, flags);\n}",
  5933. "project": "linux",
  5934. "hash": 330101540998642652877669102020815133255,
  5935. "size": 15,
  5936. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5937. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5938. "target": 0,
  5939. "dataset": "other",
  5940. "idx": 432498
  5941. },
  5942. {
  5943. "func": "static int avic_ldr_write(struct kvm_vcpu *vcpu, u8 g_physical_id, u32 ldr)\n{\n\tbool flat;\n\tu32 *entry, new_entry;\n\n\tflat = kvm_lapic_get_reg(vcpu->arch.apic, APIC_DFR) == APIC_DFR_FLAT;\n\tentry = avic_get_logical_id_entry(vcpu, ldr, flat);\n\tif (!entry)\n\t\treturn -EINVAL;\n\n\tnew_entry = READ_ONCE(*entry);\n\tnew_entry &= ~AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK;\n\tnew_entry |= (g_physical_id & AVIC_LOGICAL_ID_ENTRY_GUEST_PHYSICAL_ID_MASK);\n\tnew_entry |= AVIC_LOGICAL_ID_ENTRY_VALID_MASK;\n\tWRITE_ONCE(*entry, new_entry);\n\n\treturn 0;\n}",
  5944. "project": "linux",
  5945. "hash": 119525709928038156792618314889839906227,
  5946. "size": 18,
  5947. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5948. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5949. "target": 0,
  5950. "dataset": "other",
  5951. "idx": 432638
  5952. },
  5953. {
  5954. "func": "static int svm_set_pi_irte_mode(struct kvm_vcpu *vcpu, bool activate)\n{\n\tint ret = 0;\n\tunsigned long flags;\n\tstruct amd_svm_iommu_ir *ir;\n\tstruct vcpu_svm *svm = to_svm(vcpu);\n\n\tif (!kvm_arch_has_assigned_device(vcpu->kvm))\n\t\treturn 0;\n\n\t/*\n\t * Here, we go through the per-vcpu ir_list to update all existing\n\t * interrupt remapping table entry targeting this vcpu.\n\t */\n\tspin_lock_irqsave(&svm->ir_list_lock, flags);\n\n\tif (list_empty(&svm->ir_list))\n\t\tgoto out;\n\n\tlist_for_each_entry(ir, &svm->ir_list, node) {\n\t\tif (activate)\n\t\t\tret = amd_iommu_activate_guest_mode(ir->data);\n\t\telse\n\t\t\tret = amd_iommu_deactivate_guest_mode(ir->data);\n\t\tif (ret)\n\t\t\tbreak;\n\t}\nout:\n\tspin_unlock_irqrestore(&svm->ir_list_lock, flags);\n\treturn ret;\n}",
  5955. "project": "linux",
  5956. "hash": 275241649554292843302718847016310701132,
  5957. "size": 31,
  5958. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5959. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5960. "target": 0,
  5961. "dataset": "other",
  5962. "idx": 432451
  5963. },
  5964. {
  5965. "func": "static void svm_refresh_apicv_exec_ctrl(struct kvm_vcpu *vcpu)\n{\n\tstruct vcpu_svm *svm = to_svm(vcpu);\n\tstruct vmcb *vmcb = svm->vmcb;\n\tbool activated = kvm_vcpu_apicv_active(vcpu);\n\n\tif (!avic)\n\t\treturn;\n\n\tif (activated) {\n\t\t/**\n\t\t * During AVIC temporary deactivation, guest could update\n\t\t * APIC ID, DFR and LDR registers, which would not be trapped\n\t\t * by avic_unaccelerated_access_interception(). In this case,\n\t\t * we need to check and update the AVIC logical APIC ID table\n\t\t * accordingly before re-activating.\n\t\t */\n\t\tavic_post_state_restore(vcpu);\n\t\tvmcb->control.int_ctl |= AVIC_ENABLE_MASK;\n\t} else {\n\t\tvmcb->control.int_ctl &= ~AVIC_ENABLE_MASK;\n\t}\n\tmark_dirty(vmcb, VMCB_AVIC);\n\n\tsvm_set_pi_irte_mode(vcpu, activated);\n}",
  5966. "project": "linux",
  5967. "hash": 30038570026472557891286636352891763742,
  5968. "size": 26,
  5969. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5970. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5971. "target": 0,
  5972. "dataset": "other",
  5973. "idx": 432508
  5974. },
  5975. {
  5976. "func": "static void avic_handle_dfr_update(struct kvm_vcpu *vcpu)\n{\n\tstruct vcpu_svm *svm = to_svm(vcpu);\n\tu32 dfr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_DFR);\n\n\tif (svm->dfr_reg == dfr)\n\t\treturn;\n\n\tavic_invalidate_logical_id_entry(vcpu);\n\tsvm->dfr_reg = dfr;\n}",
  5977. "project": "linux",
  5978. "hash": 339179177992598638756627890988173320050,
  5979. "size": 11,
  5980. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5981. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5982. "target": 0,
  5983. "dataset": "other",
  5984. "idx": 432395
  5985. },
  5986. {
  5987. "func": "static int svm_update_pi_irte(struct kvm *kvm, unsigned int host_irq,\n\t\t\t uint32_t guest_irq, bool set)\n{\n\tstruct kvm_kernel_irq_routing_entry *e;\n\tstruct kvm_irq_routing_table *irq_rt;\n\tint idx, ret = -EINVAL;\n\n\tif (!kvm_arch_has_assigned_device(kvm) ||\n\t !irq_remapping_cap(IRQ_POSTING_CAP))\n\t\treturn 0;\n\n\tpr_debug(\"SVM: %s: host_irq=%#x, guest_irq=%#x, set=%#x\\n\",\n\t\t __func__, host_irq, guest_irq, set);\n\n\tidx = srcu_read_lock(&kvm->irq_srcu);\n\tirq_rt = srcu_dereference(kvm->irq_routing, &kvm->irq_srcu);\n\tWARN_ON(guest_irq >= irq_rt->nr_rt_entries);\n\n\thlist_for_each_entry(e, &irq_rt->map[guest_irq], link) {\n\t\tstruct vcpu_data vcpu_info;\n\t\tstruct vcpu_svm *svm = NULL;\n\n\t\tif (e->type != KVM_IRQ_ROUTING_MSI)\n\t\t\tcontinue;\n\n\t\t/**\n\t\t * Here, we setup with legacy mode in the following cases:\n\t\t * 1. When cannot target interrupt to a specific vcpu.\n\t\t * 2. Unsetting posted interrupt.\n\t\t * 3. APIC virtialization is disabled for the vcpu.\n\t\t * 4. IRQ has incompatible delivery mode (SMI, INIT, etc)\n\t\t */\n\t\tif (!get_pi_vcpu_info(kvm, e, &vcpu_info, &svm) && set &&\n\t\t kvm_vcpu_apicv_active(&svm->vcpu)) {\n\t\t\tstruct amd_iommu_pi_data pi;\n\n\t\t\t/* Try to enable guest_mode in IRTE */\n\t\t\tpi.base = __sme_set(page_to_phys(svm->avic_backing_page) &\n\t\t\t\t\t AVIC_HPA_MASK);\n\t\t\tpi.ga_tag = AVIC_GATAG(to_kvm_svm(kvm)->avic_vm_id,\n\t\t\t\t\t\t svm->vcpu.vcpu_id);\n\t\t\tpi.is_guest_mode = true;\n\t\t\tpi.vcpu_data = &vcpu_info;\n\t\t\tret = irq_set_vcpu_affinity(host_irq, &pi);\n\n\t\t\t/**\n\t\t\t * Here, we successfully setting up vcpu affinity in\n\t\t\t * IOMMU guest mode. Now, we need to store the posted\n\t\t\t * interrupt information in a per-vcpu ir_list so that\n\t\t\t * we can reference to them directly when we update vcpu\n\t\t\t * scheduling information in IOMMU irte.\n\t\t\t */\n\t\t\tif (!ret && pi.is_guest_mode)\n\t\t\t\tsvm_ir_list_add(svm, &pi);\n\t\t} else {\n\t\t\t/* Use legacy mode in IRTE */\n\t\t\tstruct amd_iommu_pi_data pi;\n\n\t\t\t/**\n\t\t\t * Here, pi is used to:\n\t\t\t * - Tell IOMMU to use legacy mode for this interrupt.\n\t\t\t * - Retrieve ga_tag of prior interrupt remapping data.\n\t\t\t */\n\t\t\tpi.is_guest_mode = false;\n\t\t\tret = irq_set_vcpu_affinity(host_irq, &pi);\n\n\t\t\t/**\n\t\t\t * Check if the posted interrupt was previously\n\t\t\t * setup with the guest_mode by checking if the ga_tag\n\t\t\t * was cached. If so, we need to clean up the per-vcpu\n\t\t\t * ir_list.\n\t\t\t */\n\t\t\tif (!ret && pi.prev_ga_tag) {\n\t\t\t\tint id = AVIC_GATAG_TO_VCPUID(pi.prev_ga_tag);\n\t\t\t\tstruct kvm_vcpu *vcpu;\n\n\t\t\t\tvcpu = kvm_get_vcpu_by_id(kvm, id);\n\t\t\t\tif (vcpu)\n\t\t\t\t\tsvm_ir_list_del(to_svm(vcpu), &pi);\n\t\t\t}\n\t\t}\n\n\t\tif (!ret && svm) {\n\t\t\ttrace_kvm_pi_irte_update(host_irq, svm->vcpu.vcpu_id,\n\t\t\t\t\t\t e->gsi, vcpu_info.vector,\n\t\t\t\t\t\t vcpu_info.pi_desc_addr, set);\n\t\t}\n\n\t\tif (ret < 0) {\n\t\t\tpr_err(\"%s: failed to update PI IRTE\\n\", __func__);\n\t\t\tgoto out;\n\t\t}\n\t}\n\n\tret = 0;\nout:\n\tsrcu_read_unlock(&kvm->irq_srcu, idx);\n\treturn ret;\n}",
  5988. "project": "linux",
  5989. "hash": 318085719864330516266383533570991474878,
  5990. "size": 99,
  5991. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  5992. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  5993. "target": 0,
  5994. "dataset": "other",
  5995. "idx": 432530
  5996. },
  5997. {
  5998. "func": "static bool is_avic_unaccelerated_access_trap(u32 offset)\n{\n\tbool ret = false;\n\n\tswitch (offset) {\n\tcase APIC_ID:\n\tcase APIC_EOI:\n\tcase APIC_RRR:\n\tcase APIC_LDR:\n\tcase APIC_DFR:\n\tcase APIC_SPIV:\n\tcase APIC_ESR:\n\tcase APIC_ICR:\n\tcase APIC_LVTT:\n\tcase APIC_LVTTHMR:\n\tcase APIC_LVTPC:\n\tcase APIC_LVT0:\n\tcase APIC_LVT1:\n\tcase APIC_LVTERR:\n\tcase APIC_TMICT:\n\tcase APIC_TDCR:\n\t\tret = true;\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\treturn ret;\n}",
  5999. "project": "linux",
  6000. "hash": 60203129318047945632968468677207001869,
  6001. "size": 28,
  6002. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  6003. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  6004. "target": 0,
  6005. "dataset": "other",
  6006. "idx": 432536
  6007. },
  6008. {
  6009. "func": "static int avic_unaccel_trap_write(struct vcpu_svm *svm)\n{\n\tstruct kvm_lapic *apic = svm->vcpu.arch.apic;\n\tu32 offset = svm->vmcb->control.exit_info_1 &\n\t\t\t\tAVIC_UNACCEL_ACCESS_OFFSET_MASK;\n\n\tswitch (offset) {\n\tcase APIC_ID:\n\t\tif (avic_handle_apic_id_update(&svm->vcpu))\n\t\t\treturn 0;\n\t\tbreak;\n\tcase APIC_LDR:\n\t\tif (avic_handle_ldr_update(&svm->vcpu))\n\t\t\treturn 0;\n\t\tbreak;\n\tcase APIC_DFR:\n\t\tavic_handle_dfr_update(&svm->vcpu);\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\n\tkvm_lapic_reg_write(apic, offset, kvm_lapic_get_reg(apic, offset));\n\n\treturn 1;\n}",
  6010. "project": "linux",
  6011. "hash": 106232661564080307493698138402044433619,
  6012. "size": 26,
  6013. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  6014. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  6015. "target": 0,
  6016. "dataset": "other",
  6017. "idx": 432472
  6018. },
  6019. {
  6020. "func": "static int avic_handle_ldr_update(struct kvm_vcpu *vcpu)\n{\n\tint ret = 0;\n\tstruct vcpu_svm *svm = to_svm(vcpu);\n\tu32 ldr = kvm_lapic_get_reg(vcpu->arch.apic, APIC_LDR);\n\tu32 id = kvm_xapic_id(vcpu->arch.apic);\n\n\tif (ldr == svm->ldr_reg)\n\t\treturn 0;\n\n\tavic_invalidate_logical_id_entry(vcpu);\n\n\tif (ldr)\n\t\tret = avic_ldr_write(vcpu, id, ldr);\n\n\tif (!ret)\n\t\tsvm->ldr_reg = ldr;\n\n\treturn ret;\n}",
  6021. "project": "linux",
  6022. "hash": 234317427710984396719900651698846146729,
  6023. "size": 20,
  6024. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  6025. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  6026. "target": 0,
  6027. "dataset": "other",
  6028. "idx": 432544
  6029. },
  6030. {
  6031. "func": "static int avic_handle_apic_id_update(struct kvm_vcpu *vcpu)\n{\n\tu64 *old, *new;\n\tstruct vcpu_svm *svm = to_svm(vcpu);\n\tu32 id = kvm_xapic_id(vcpu->arch.apic);\n\n\tif (vcpu->vcpu_id == id)\n\t\treturn 0;\n\n\told = avic_get_physical_id_entry(vcpu, vcpu->vcpu_id);\n\tnew = avic_get_physical_id_entry(vcpu, id);\n\tif (!new || !old)\n\t\treturn 1;\n\n\t/* We need to move physical_id_entry to new offset */\n\t*new = *old;\n\t*old = 0ULL;\n\tto_svm(vcpu)->avic_physical_id_cache = new;\n\n\t/*\n\t * Also update the guest physical APIC ID in the logical\n\t * APIC ID table entry if already setup the LDR.\n\t */\n\tif (svm->ldr_reg)\n\t\tavic_handle_ldr_update(vcpu);\n\n\treturn 0;\n}",
  6032. "project": "linux",
  6033. "hash": 121011130733983555787294718049649763766,
  6034. "size": 28,
  6035. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  6036. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  6037. "target": 0,
  6038. "dataset": "other",
  6039. "idx": 432606
  6040. },
  6041. {
  6042. "func": "static int avic_unaccelerated_access_interception(struct vcpu_svm *svm)\n{\n\tint ret = 0;\n\tu32 offset = svm->vmcb->control.exit_info_1 &\n\t\t AVIC_UNACCEL_ACCESS_OFFSET_MASK;\n\tu32 vector = svm->vmcb->control.exit_info_2 &\n\t\t AVIC_UNACCEL_ACCESS_VECTOR_MASK;\n\tbool write = (svm->vmcb->control.exit_info_1 >> 32) &\n\t\t AVIC_UNACCEL_ACCESS_WRITE_MASK;\n\tbool trap = is_avic_unaccelerated_access_trap(offset);\n\n\ttrace_kvm_avic_unaccelerated_access(svm->vcpu.vcpu_id, offset,\n\t\t\t\t\t trap, write, vector);\n\tif (trap) {\n\t\t/* Handling Trap */\n\t\tWARN_ONCE(!write, \"svm: Handling trap read.\\n\");\n\t\tret = avic_unaccel_trap_write(svm);\n\t} else {\n\t\t/* Handling Fault */\n\t\tret = kvm_emulate_instruction(&svm->vcpu, 0);\n\t}\n\n\treturn ret;\n}",
  6043. "project": "linux",
  6044. "hash": 81436319974277451152718179696270566677,
  6045. "size": 24,
  6046. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  6047. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  6048. "target": 0,
  6049. "dataset": "other",
  6050. "idx": 432513
  6051. },
  6052. {
  6053. "func": "static inline bool kvm_arch_has_assigned_device(struct kvm *kvm)\n{\n\treturn false;\n}",
  6054. "project": "linux",
  6055. "hash": 32850749792732072862793558309876279082,
  6056. "size": 4,
  6057. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  6058. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  6059. "target": 0,
  6060. "dataset": "other",
  6061. "idx": 354798
  6062. },
  6063. {
  6064. "func": "static int svm_ir_list_add(struct vcpu_svm *svm, struct amd_iommu_pi_data *pi)\n{\n\tint ret = 0;\n\tunsigned long flags;\n\tstruct amd_svm_iommu_ir *ir;\n\n\t/**\n\t * In some cases, the existing irte is updaed and re-set,\n\t * so we need to check here if it's already been * added\n\t * to the ir_list.\n\t */\n\tif (pi->ir_data && (pi->prev_ga_tag != 0)) {\n\t\tstruct kvm *kvm = svm->vcpu.kvm;\n\t\tu32 vcpu_id = AVIC_GATAG_TO_VCPUID(pi->prev_ga_tag);\n\t\tstruct kvm_vcpu *prev_vcpu = kvm_get_vcpu_by_id(kvm, vcpu_id);\n\t\tstruct vcpu_svm *prev_svm;\n\n\t\tif (!prev_vcpu) {\n\t\t\tret = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\n\t\tprev_svm = to_svm(prev_vcpu);\n\t\tsvm_ir_list_del(prev_svm, pi);\n\t}\n\n\t/**\n\t * Allocating new amd_iommu_pi_data, which will get\n\t * add to the per-vcpu ir_list.\n\t */\n\tir = kzalloc(sizeof(struct amd_svm_iommu_ir), GFP_KERNEL_ACCOUNT);\n\tif (!ir) {\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\tir->data = pi->ir_data;\n\n\tspin_lock_irqsave(&svm->ir_list_lock, flags);\n\tlist_add(&ir->node, &svm->ir_list);\n\tspin_unlock_irqrestore(&svm->ir_list_lock, flags);\nout:\n\treturn ret;\n}",
  6065. "project": "linux",
  6066. "hash": 57031397710267844333495764165285579751,
  6067. "size": 43,
  6068. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  6069. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  6070. "target": 0,
  6071. "dataset": "other",
  6072. "idx": 432454
  6073. }
  6074. ]
  6075. },
  6076. {
  6077. "call_depth": 3,
  6078. "longest_call_chain": [
  6079. "fanout_add",
  6080. "fanout_find_new_id",
  6081. "__fanout_id_is_free"
  6082. ],
  6083. "group_size": 3,
  6084. "functions": [
  6085. {
  6086. "func": "static int fanout_add(struct sock *sk, u16 id, u16 type_flags)\n{\n\tstruct packet_rollover *rollover = NULL;\n\tstruct packet_sock *po = pkt_sk(sk);\n\tstruct packet_fanout *f, *match;\n\tu8 type = type_flags & 0xff;\n\tu8 flags = type_flags >> 8;\n\tint err;\n\n\tswitch (type) {\n\tcase PACKET_FANOUT_ROLLOVER:\n\t\tif (type_flags & PACKET_FANOUT_FLAG_ROLLOVER)\n\t\t\treturn -EINVAL;\n\tcase PACKET_FANOUT_HASH:\n\tcase PACKET_FANOUT_LB:\n\tcase PACKET_FANOUT_CPU:\n\tcase PACKET_FANOUT_RND:\n\tcase PACKET_FANOUT_QM:\n\tcase PACKET_FANOUT_CBPF:\n\tcase PACKET_FANOUT_EBPF:\n\t\tbreak;\n\tdefault:\n\t\treturn -EINVAL;\n\t}\n\n\tmutex_lock(&fanout_mutex);\n\n\terr = -EALREADY;\n\tif (po->fanout)\n\t\tgoto out;\n\n\tif (type == PACKET_FANOUT_ROLLOVER ||\n\t (type_flags & PACKET_FANOUT_FLAG_ROLLOVER)) {\n\t\terr = -ENOMEM;\n\t\trollover = kzalloc(sizeof(*rollover), GFP_KERNEL);\n\t\tif (!rollover)\n\t\t\tgoto out;\n\t\tatomic_long_set(&rollover->num, 0);\n\t\tatomic_long_set(&rollover->num_huge, 0);\n\t\tatomic_long_set(&rollover->num_failed, 0);\n\t}\n\n\tif (type_flags & PACKET_FANOUT_FLAG_UNIQUEID) {\n\t\tif (id != 0) {\n\t\t\terr = -EINVAL;\n\t\t\tgoto out;\n\t\t}\n\t\tif (!fanout_find_new_id(sk, &id)) {\n\t\t\terr = -ENOMEM;\n\t\t\tgoto out;\n\t\t}\n\t\t/* ephemeral flag for the first socket in the group: drop it */\n\t\tflags &= ~(PACKET_FANOUT_FLAG_UNIQUEID >> 8);\n\t}\n\n\tmatch = NULL;\n\tlist_for_each_entry(f, &fanout_list, list) {\n\t\tif (f->id == id &&\n\t\t read_pnet(&f->net) == sock_net(sk)) {\n\t\t\tmatch = f;\n\t\t\tbreak;\n\t\t}\n\t}\n\terr = -EINVAL;\n\tif (match && match->flags != flags)\n\t\tgoto out;\n\tif (!match) {\n\t\terr = -ENOMEM;\n\t\tmatch = kzalloc(sizeof(*match), GFP_KERNEL);\n\t\tif (!match)\n\t\t\tgoto out;\n\t\twrite_pnet(&match->net, sock_net(sk));\n\t\tmatch->id = id;\n\t\tmatch->type = type;\n\t\tmatch->flags = flags;\n\t\tINIT_LIST_HEAD(&match->list);\n\t\tspin_lock_init(&match->lock);\n\t\trefcount_set(&match->sk_ref, 0);\n\t\tfanout_init_data(match);\n\t\tmatch->prot_hook.type = po->prot_hook.type;\n\t\tmatch->prot_hook.dev = po->prot_hook.dev;\n\t\tmatch->prot_hook.func = packet_rcv_fanout;\n\t\tmatch->prot_hook.af_packet_priv = match;\n\t\tmatch->prot_hook.id_match = match_fanout_group;\n\t\tlist_add(&match->list, &fanout_list);\n\t}\n\terr = -EINVAL;\n\n\tspin_lock(&po->bind_lock);\n\tif (po->running &&\n\t match->type == type &&\n\t match->prot_hook.type == po->prot_hook.type &&\n\t match->prot_hook.dev == po->prot_hook.dev) {\n\t\terr = -ENOSPC;\n\t\tif (refcount_read(&match->sk_ref) < PACKET_FANOUT_MAX) {\n\t\t\t__dev_remove_pack(&po->prot_hook);\n\t\t\tpo->fanout = match;\n\t\t\tpo->rollover = rollover;\n\t\t\trollover = NULL;\n\t\t\trefcount_set(&match->sk_ref, refcount_read(&match->sk_ref) + 1);\n\t\t\t__fanout_link(sk, po);\n\t\t\terr = 0;\n\t\t}\n\t}\n\tspin_unlock(&po->bind_lock);\n\n\tif (err && !refcount_read(&match->sk_ref)) {\n\t\tlist_del(&match->list);\n\t\tkfree(match);\n\t}\n\nout:\n\tkfree(rollover);\n\tmutex_unlock(&fanout_mutex);\n\treturn err;\n}",
  6087. "project": "linux",
  6088. "hash": 199983393709727263839366359142730932433,
  6089. "size": 116,
  6090. "commit_id": "acf69c946233259ab4d64f8869d4037a198c7f06",
  6091. "message": "net/packet: fix overflow in tpacket_rcv\n\nUsing tp_reserve to calculate netoff can overflow as\ntp_reserve is unsigned int and netoff is unsigned short.\n\nThis may lead to macoff receving a smaller value then\nsizeof(struct virtio_net_hdr), and if po->has_vnet_hdr\nis set, an out-of-bounds write will occur when\ncalling virtio_net_hdr_from_skb.\n\nThe bug is fixed by converting netoff to unsigned int\nand checking if it exceeds USHRT_MAX.\n\nThis addresses CVE-2020-14386\n\nFixes: 8913336a7e8d (\"packet: add PACKET_RESERVE sockopt\")\nSigned-off-by: Or Cohen <orcohen@paloaltonetworks.com>\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  6092. "target": 0,
  6093. "dataset": "other",
  6094. "idx": 330380
  6095. },
  6096. {
  6097. "func": "static bool fanout_find_new_id(struct sock *sk, u16 *new_id)\n{\n\tu16 id = fanout_next_id;\n\n\tdo {\n\t\tif (__fanout_id_is_free(sk, id)) {\n\t\t\t*new_id = id;\n\t\t\tfanout_next_id = id + 1;\n\t\t\treturn true;\n\t\t}\n\n\t\tid++;\n\t} while (id != fanout_next_id);\n\n\treturn false;\n}",
  6098. "project": "linux",
  6099. "hash": 307272190883856057212126550315472654801,
  6100. "size": 16,
  6101. "commit_id": "acf69c946233259ab4d64f8869d4037a198c7f06",
  6102. "message": "net/packet: fix overflow in tpacket_rcv\n\nUsing tp_reserve to calculate netoff can overflow as\ntp_reserve is unsigned int and netoff is unsigned short.\n\nThis may lead to macoff receving a smaller value then\nsizeof(struct virtio_net_hdr), and if po->has_vnet_hdr\nis set, an out-of-bounds write will occur when\ncalling virtio_net_hdr_from_skb.\n\nThe bug is fixed by converting netoff to unsigned int\nand checking if it exceeds USHRT_MAX.\n\nThis addresses CVE-2020-14386\n\nFixes: 8913336a7e8d (\"packet: add PACKET_RESERVE sockopt\")\nSigned-off-by: Or Cohen <orcohen@paloaltonetworks.com>\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  6103. "target": 0,
  6104. "dataset": "other",
  6105. "idx": 330382
  6106. },
  6107. {
  6108. "func": "static bool __fanout_id_is_free(struct sock *sk, u16 candidate_id)\n{\n\tstruct packet_fanout *f;\n\n\tlist_for_each_entry(f, &fanout_list, list) {\n\t\tif (f->id == candidate_id &&\n\t\t read_pnet(&f->net) == sock_net(sk)) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}",
  6109. "project": "linux",
  6110. "hash": 469944124276933757549113293725692021,
  6111. "size": 12,
  6112. "commit_id": "acf69c946233259ab4d64f8869d4037a198c7f06",
  6113. "message": "net/packet: fix overflow in tpacket_rcv\n\nUsing tp_reserve to calculate netoff can overflow as\ntp_reserve is unsigned int and netoff is unsigned short.\n\nThis may lead to macoff receving a smaller value then\nsizeof(struct virtio_net_hdr), and if po->has_vnet_hdr\nis set, an out-of-bounds write will occur when\ncalling virtio_net_hdr_from_skb.\n\nThe bug is fixed by converting netoff to unsigned int\nand checking if it exceeds USHRT_MAX.\n\nThis addresses CVE-2020-14386\n\nFixes: 8913336a7e8d (\"packet: add PACKET_RESERVE sockopt\")\nSigned-off-by: Or Cohen <orcohen@paloaltonetworks.com>\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  6114. "target": 0,
  6115. "dataset": "other",
  6116. "idx": 330372
  6117. }
  6118. ]
  6119. },
  6120. {
  6121. "call_depth": 3,
  6122. "longest_call_chain": [
  6123. "rdp_recv_autodetect_request_packet",
  6124. "autodetect_recv_rtt_measure_request",
  6125. "autodetect_send_rtt_measure_response"
  6126. ],
  6127. "group_size": 8,
  6128. "functions": [
  6129. {
  6130. "func": "static BOOL autodetect_recv_bandwidth_measure_payload(rdpRdp* rdp, wStream* s,\n AUTODETECT_REQ_PDU* autodetectReqPdu)\n{\n\tUINT16 payloadLength;\n\n\tif (autodetectReqPdu->headerLength != 0x08)\n\t\treturn FALSE;\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, payloadLength); /* payloadLength (2 bytes) */\n\tif (!Stream_SafeSeek(s, payloadLength))\n\t\treturn FALSE;\n\tWLog_DBG(AUTODETECT_TAG, \"received Bandwidth Measure Payload PDU -> payloadLength=%\" PRIu16 \"\",\n\t payloadLength);\n\t/* Add the payload length to the bandwidth measurement parameters */\n\trdp->autodetect->bandwidthMeasureByteCount += payloadLength;\n\treturn TRUE;\n}",
  6131. "project": "FreeRDP",
  6132. "hash": 337919979129268049322478099158481414289,
  6133. "size": 20,
  6134. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6135. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6136. "target": 0,
  6137. "dataset": "other",
  6138. "idx": 434152
  6139. },
  6140. {
  6141. "func": "static BOOL autodetect_send_bandwidth_measure_results(rdpRdp* rdp, UINT16 responseType,\n UINT16 sequenceNumber)\n{\n\tBOOL success = TRUE;\n\twStream* s;\n\tUINT64 timeDelta;\n\t/* Compute the total time */\n\ttimeDelta = GetTickCount64() - rdp->autodetect->bandwidthMeasureStartTime;\n\t/* Send the result PDU to the server */\n\ts = rdp_message_channel_pdu_init(rdp);\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG,\n\t \"sending Bandwidth Measure Results PDU -> timeDelta=%\" PRIu32 \", byteCount=%\" PRIu32\n\t \"\",\n\t timeDelta, rdp->autodetect->bandwidthMeasureByteCount);\n\tStream_Write_UINT8(s, 0x0E); /* headerLength (1 byte) */\n\tStream_Write_UINT8(s, TYPE_ID_AUTODETECT_RESPONSE); /* headerTypeId (1 byte) */\n\tStream_Write_UINT16(s, sequenceNumber); /* sequenceNumber (2 bytes) */\n\tStream_Write_UINT16(s, responseType); /* responseType (1 byte) */\n\tStream_Write_UINT32(s, timeDelta); /* timeDelta (4 bytes) */\n\tStream_Write_UINT32(s, rdp->autodetect->bandwidthMeasureByteCount); /* byteCount (4 bytes) */\n\tIFCALLRET(rdp->autodetect->ClientBandwidthMeasureResult, success, rdp->context,\n\t rdp->autodetect);\n\n\tif (!success)\n\t\treturn FALSE;\n\n\treturn rdp_send_message_channel_pdu(rdp, s, SEC_AUTODETECT_RSP);\n}",
  6142. "project": "FreeRDP",
  6143. "hash": 322009467810762472454222490766962838779,
  6144. "size": 32,
  6145. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6146. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6147. "target": 0,
  6148. "dataset": "other",
  6149. "idx": 434138
  6150. },
  6151. {
  6152. "func": "static BOOL autodetect_send_rtt_measure_response(rdpRdp* rdp, UINT16 sequenceNumber)\n{\n\twStream* s;\n\t/* Send the response PDU to the server */\n\ts = rdp_message_channel_pdu_init(rdp);\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"sending RTT Measure Response PDU\");\n\tStream_Write_UINT8(s, 0x06); /* headerLength (1 byte) */\n\tStream_Write_UINT8(s, TYPE_ID_AUTODETECT_RESPONSE); /* headerTypeId (1 byte) */\n\tStream_Write_UINT16(s, sequenceNumber); /* sequenceNumber (2 bytes) */\n\tStream_Write_UINT16(s, RDP_RTT_RESPONSE_TYPE); /* responseType (1 byte) */\n\treturn rdp_send_message_channel_pdu(rdp, s, SEC_AUTODETECT_RSP);\n}",
  6153. "project": "FreeRDP",
  6154. "hash": 300752517779421708413144763955333017631,
  6155. "size": 16,
  6156. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6157. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6158. "target": 0,
  6159. "dataset": "other",
  6160. "idx": 434139
  6161. },
  6162. {
  6163. "func": "static BOOL autodetect_recv_bandwidth_measure_start(rdpRdp* rdp, wStream* s,\n AUTODETECT_REQ_PDU* autodetectReqPdu)\n{\n\tif (autodetectReqPdu->headerLength != 0x06)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"received Bandwidth Measure Start PDU - time=%\" PRIu64 \"\",\n\t GetTickCount64());\n\t/* Initialize bandwidth measurement parameters */\n\trdp->autodetect->bandwidthMeasureStartTime = GetTickCount64();\n\trdp->autodetect->bandwidthMeasureByteCount = 0;\n\n\t/* Continuous Auto-Detection: mark the start of the measurement */\n\tif (autodetectReqPdu->requestType == RDP_BW_START_REQUEST_TYPE_CONTINUOUS)\n\t{\n\t\trdp->autodetect->bandwidthMeasureStarted = TRUE;\n\t}\n\n\treturn TRUE;\n}",
  6164. "project": "FreeRDP",
  6165. "hash": 29583987632282141180988489404379919590,
  6166. "size": 20,
  6167. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6168. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6169. "target": 0,
  6170. "dataset": "other",
  6171. "idx": 434148
  6172. },
  6173. {
  6174. "func": "static BOOL autodetect_recv_bandwidth_measure_stop(rdpRdp* rdp, wStream* s,\n AUTODETECT_REQ_PDU* autodetectReqPdu)\n{\n\tUINT16 payloadLength;\n\tUINT16 responseType;\n\n\tif (autodetectReqPdu->requestType == RDP_BW_STOP_REQUEST_TYPE_CONNECTTIME)\n\t{\n\t\tif (autodetectReqPdu->headerLength != 0x08)\n\t\t\treturn FALSE;\n\n\t\tif (Stream_GetRemainingLength(s) < 2)\n\t\t\treturn FALSE;\n\n\t\tStream_Read_UINT16(s, payloadLength); /* payloadLength (2 bytes) */\n\t}\n\telse\n\t{\n\t\tif (autodetectReqPdu->headerLength != 0x06)\n\t\t\treturn FALSE;\n\n\t\tpayloadLength = 0;\n\t}\n\n\tif (!Stream_SafeSeek(s, payloadLength))\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"received Bandwidth Measure Stop PDU -> payloadLength=%\" PRIu16 \"\",\n\t payloadLength);\n\t/* Add the payload length to the bandwidth measurement parameters */\n\trdp->autodetect->bandwidthMeasureByteCount += payloadLength;\n\n\t/* Continuous Auto-Detection: mark the stop of the measurement */\n\tif (autodetectReqPdu->requestType == RDP_BW_STOP_REQUEST_TYPE_CONTINUOUS)\n\t{\n\t\trdp->autodetect->bandwidthMeasureStarted = FALSE;\n\t}\n\n\t/* Send a response the server */\n\tresponseType = autodetectReqPdu->requestType == RDP_BW_STOP_REQUEST_TYPE_CONNECTTIME\n\t ? RDP_BW_RESULTS_RESPONSE_TYPE_CONNECTTIME\n\t : RDP_BW_RESULTS_RESPONSE_TYPE_CONTINUOUS;\n\treturn autodetect_send_bandwidth_measure_results(rdp, responseType,\n\t autodetectReqPdu->sequenceNumber);\n}",
  6175. "project": "FreeRDP",
  6176. "hash": 71042584829967519040970981149564740055,
  6177. "size": 45,
  6178. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6179. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6180. "target": 0,
  6181. "dataset": "other",
  6182. "idx": 434157
  6183. },
  6184. {
  6185. "func": "int rdp_recv_autodetect_request_packet(rdpRdp* rdp, wStream* s)\n{\n\tAUTODETECT_REQ_PDU autodetectReqPdu;\n\tBOOL success = FALSE;\n\n\tif (Stream_GetRemainingLength(s) < 6)\n\t\treturn -1;\n\n\tStream_Read_UINT8(s, autodetectReqPdu.headerLength); /* headerLength (1 byte) */\n\tStream_Read_UINT8(s, autodetectReqPdu.headerTypeId); /* headerTypeId (1 byte) */\n\tStream_Read_UINT16(s, autodetectReqPdu.sequenceNumber); /* sequenceNumber (2 bytes) */\n\tStream_Read_UINT16(s, autodetectReqPdu.requestType); /* requestType (2 bytes) */\n\tWLog_VRB(AUTODETECT_TAG,\n\t \"rdp_recv_autodetect_request_packet: headerLength=%\" PRIu8 \", headerTypeId=%\" PRIu8\n\t \", sequenceNumber=%\" PRIu16 \", requestType=%04\" PRIx16 \"\",\n\t autodetectReqPdu.headerLength, autodetectReqPdu.headerTypeId,\n\t autodetectReqPdu.sequenceNumber, autodetectReqPdu.requestType);\n\n\tif (autodetectReqPdu.headerTypeId != TYPE_ID_AUTODETECT_REQUEST)\n\t\treturn -1;\n\n\tswitch (autodetectReqPdu.requestType)\n\t{\n\t\tcase RDP_RTT_REQUEST_TYPE_CONTINUOUS:\n\t\tcase RDP_RTT_REQUEST_TYPE_CONNECTTIME:\n\t\t\t/* RTT Measure Request (RDP_RTT_REQUEST) - MS-RDPBCGR 2.2.14.1.1 */\n\t\t\tsuccess = autodetect_recv_rtt_measure_request(rdp, s, &autodetectReqPdu);\n\t\t\tbreak;\n\n\t\tcase RDP_BW_START_REQUEST_TYPE_CONTINUOUS:\n\t\tcase RDP_BW_START_REQUEST_TYPE_TUNNEL:\n\t\tcase RDP_BW_START_REQUEST_TYPE_CONNECTTIME:\n\t\t\t/* Bandwidth Measure Start (RDP_BW_START) - MS-RDPBCGR 2.2.14.1.2 */\n\t\t\tsuccess = autodetect_recv_bandwidth_measure_start(rdp, s, &autodetectReqPdu);\n\t\t\tbreak;\n\n\t\tcase RDP_BW_PAYLOAD_REQUEST_TYPE:\n\t\t\t/* Bandwidth Measure Payload (RDP_BW_PAYLOAD) - MS-RDPBCGR 2.2.14.1.3 */\n\t\t\tsuccess = autodetect_recv_bandwidth_measure_payload(rdp, s, &autodetectReqPdu);\n\t\t\tbreak;\n\n\t\tcase RDP_BW_STOP_REQUEST_TYPE_CONNECTTIME:\n\t\tcase RDP_BW_STOP_REQUEST_TYPE_CONTINUOUS:\n\t\tcase RDP_BW_STOP_REQUEST_TYPE_TUNNEL:\n\t\t\t/* Bandwidth Measure Stop (RDP_BW_STOP) - MS-RDPBCGR 2.2.14.1.4 */\n\t\t\tsuccess = autodetect_recv_bandwidth_measure_stop(rdp, s, &autodetectReqPdu);\n\t\t\tbreak;\n\n\t\tcase 0x0840:\n\t\tcase 0x0880:\n\t\tcase 0x08C0:\n\t\t\t/* Network Characteristics Result (RDP_NETCHAR_RESULT) - MS-RDPBCGR 2.2.14.1.5 */\n\t\t\tsuccess = autodetect_recv_netchar_result(rdp, s, &autodetectReqPdu);\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\treturn success ? 0 : -1;\n}",
  6186. "project": "FreeRDP",
  6187. "hash": 39594371236478491083915817460705255754,
  6188. "size": 61,
  6189. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6190. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6191. "target": 0,
  6192. "dataset": "other",
  6193. "idx": 434140
  6194. },
  6195. {
  6196. "func": "static BOOL autodetect_recv_netchar_result(rdpRdp* rdp, wStream* s,\n AUTODETECT_REQ_PDU* autodetectReqPdu)\n{\n\tBOOL success = TRUE;\n\n\tswitch (autodetectReqPdu->requestType)\n\t{\n\t\tcase 0x0840:\n\n\t\t\t/* baseRTT and averageRTT fields are present (bandwidth field is not) */\n\t\t\tif ((autodetectReqPdu->headerLength != 0x0E) || (Stream_GetRemainingLength(s) < 8))\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT32(s, rdp->autodetect->netCharBaseRTT); /* baseRTT (4 bytes) */\n\t\t\tStream_Read_UINT32(s, rdp->autodetect->netCharAverageRTT); /* averageRTT (4 bytes) */\n\t\t\tbreak;\n\n\t\tcase 0x0880:\n\n\t\t\t/* bandwidth and averageRTT fields are present (baseRTT field is not) */\n\t\t\tif ((autodetectReqPdu->headerLength != 0x0E) || (Stream_GetRemainingLength(s) < 8))\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT32(s, rdp->autodetect->netCharBandwidth); /* bandwidth (4 bytes) */\n\t\t\tStream_Read_UINT32(s, rdp->autodetect->netCharAverageRTT); /* averageRTT (4 bytes) */\n\t\t\tbreak;\n\n\t\tcase 0x08C0:\n\n\t\t\t/* baseRTT, bandwidth, and averageRTT fields are present */\n\t\t\tif ((autodetectReqPdu->headerLength != 0x12) || (Stream_GetRemainingLength(s) < 12))\n\t\t\t\treturn FALSE;\n\n\t\t\tStream_Read_UINT32(s, rdp->autodetect->netCharBaseRTT); /* baseRTT (4 bytes) */\n\t\t\tStream_Read_UINT32(s, rdp->autodetect->netCharBandwidth); /* bandwidth (4 bytes) */\n\t\t\tStream_Read_UINT32(s, rdp->autodetect->netCharAverageRTT); /* averageRTT (4 bytes) */\n\t\t\tbreak;\n\t}\n\n\tWLog_VRB(AUTODETECT_TAG,\n\t \"received Network Characteristics Result PDU -> baseRTT=%\" PRIu32\n\t \", bandwidth=%\" PRIu32 \", averageRTT=%\" PRIu32 \"\",\n\t rdp->autodetect->netCharBaseRTT, rdp->autodetect->netCharBandwidth,\n\t rdp->autodetect->netCharAverageRTT);\n\tIFCALLRET(rdp->autodetect->NetworkCharacteristicsResult, success, rdp->context,\n\t autodetectReqPdu->sequenceNumber);\n\treturn success;\n}",
  6197. "project": "FreeRDP",
  6198. "hash": 129515073967912796909780175736799164859,
  6199. "size": 48,
  6200. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6201. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6202. "target": 0,
  6203. "dataset": "other",
  6204. "idx": 434133
  6205. },
  6206. {
  6207. "func": "static BOOL autodetect_recv_rtt_measure_request(rdpRdp* rdp, wStream* s,\n AUTODETECT_REQ_PDU* autodetectReqPdu)\n{\n\tif (autodetectReqPdu->headerLength != 0x06)\n\t\treturn FALSE;\n\n\tWLog_VRB(AUTODETECT_TAG, \"received RTT Measure Request PDU\");\n\t/* Send a response to the server */\n\treturn autodetect_send_rtt_measure_response(rdp, autodetectReqPdu->sequenceNumber);\n}",
  6208. "project": "FreeRDP",
  6209. "hash": 193019547130700004675180444091938847103,
  6210. "size": 10,
  6211. "commit_id": "f5e73cc7c9cd973b516a618da877c87b80950b65",
  6212. "message": "Fixed #6009: Bounds checks in autodetect_recv_bandwidth_measure_results",
  6213. "target": 0,
  6214. "dataset": "other",
  6215. "idx": 434151
  6216. }
  6217. ]
  6218. },
  6219. {
  6220. "call_depth": 4,
  6221. "longest_call_chain": [
  6222. "v4l_enumstd",
  6223. "v4l_video_std_enumstd",
  6224. "v4l2_video_std_construct",
  6225. "v4l2_video_std_frame_period"
  6226. ],
  6227. "group_size": 21,
  6228. "functions": [
  6229. {
  6230. "func": "static int v4l_dqbuf(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_buffer *p = arg;\n\tint ret = check_fmt(file, p->type);\n\n\treturn ret ? ret : ops->vidioc_dqbuf(file, fh, p);\n}",
  6231. "project": "linux",
  6232. "hash": 52691748936560615690582291522302673890,
  6233. "size": 8,
  6234. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6235. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6236. "target": 0,
  6237. "dataset": "other",
  6238. "idx": 381470
  6239. },
  6240. {
  6241. "func": "static int v4l_create_bufs(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_create_buffers *create = arg;\n\tint ret = check_fmt(file, create->format.type);\n\n\tif (ret)\n\t\treturn ret;\n\n\tCLEAR_AFTER_FIELD(create, capabilities);\n\n\tv4l_sanitize_format(&create->format);\n\n\tret = ops->vidioc_create_bufs(file, fh, create);\n\n\tif (create->format.type == V4L2_BUF_TYPE_VIDEO_CAPTURE ||\n\t create->format.type == V4L2_BUF_TYPE_VIDEO_OUTPUT)\n\t\tcreate->format.fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\n\treturn ret;\n}",
  6242. "project": "linux",
  6243. "hash": 62121059000265789082663182956814599375,
  6244. "size": 21,
  6245. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6246. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6247. "target": 0,
  6248. "dataset": "other",
  6249. "idx": 381476
  6250. },
  6251. {
  6252. "func": "static int v4l_prepare_buf(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_buffer *b = arg;\n\tint ret = check_fmt(file, b->type);\n\n\treturn ret ? ret : ops->vidioc_prepare_buf(file, fh, b);\n}",
  6253. "project": "linux",
  6254. "hash": 93593508668867886508753059939189803048,
  6255. "size": 8,
  6256. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6257. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6258. "target": 0,
  6259. "dataset": "other",
  6260. "idx": 381446
  6261. },
  6262. {
  6263. "func": "static int v4l_g_parm(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_streamparm *p = arg;\n\tv4l2_std_id std;\n\tint ret = check_fmt(file, p->type);\n\n\tif (ret)\n\t\treturn ret;\n\tif (ops->vidioc_g_parm)\n\t\treturn ops->vidioc_g_parm(file, fh, p);\n\tif (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&\n\t p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE)\n\t\treturn -EINVAL;\n\tp->parm.capture.readbuffers = 2;\n\tret = ops->vidioc_g_std(file, fh, &std);\n\tif (ret == 0)\n\t\tv4l2_video_std_frame_period(std, &p->parm.capture.timeperframe);\n\treturn ret;\n}",
  6264. "project": "linux",
  6265. "hash": 285217389858183627080514663830040305361,
  6266. "size": 20,
  6267. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6268. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6269. "target": 0,
  6270. "dataset": "other",
  6271. "idx": 381463
  6272. },
  6273. {
  6274. "func": "static int v4l_reqbufs(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_requestbuffers *p = arg;\n\tint ret = check_fmt(file, p->type);\n\n\tif (ret)\n\t\treturn ret;\n\n\tCLEAR_AFTER_FIELD(p, capabilities);\n\n\treturn ops->vidioc_reqbufs(file, fh, p);\n}",
  6275. "project": "linux",
  6276. "hash": 240349342782416093504801919514051773914,
  6277. "size": 13,
  6278. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6279. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6280. "target": 0,
  6281. "dataset": "other",
  6282. "idx": 381542
  6283. },
  6284. {
  6285. "func": "int v4l2_video_std_construct(struct v4l2_standard *vs,\n\t\t\t int id, const char *name)\n{\n\tvs->id = id;\n\tv4l2_video_std_frame_period(id, &vs->frameperiod);\n\tvs->framelines = (id & V4L2_STD_525_60) ? 525 : 625;\n\tstrscpy(vs->name, name, sizeof(vs->name));\n\treturn 0;\n}",
  6286. "project": "linux",
  6287. "hash": 120352557544698135776876024147406169370,
  6288. "size": 9,
  6289. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6290. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6291. "target": 0,
  6292. "dataset": "other",
  6293. "idx": 381439
  6294. },
  6295. {
  6296. "func": "int v4l_video_std_enumstd(struct v4l2_standard *vs, v4l2_std_id id)\n{\n\tv4l2_std_id curr_id = 0;\n\tunsigned int index = vs->index, i, j = 0;\n\tconst char *descr = \"\";\n\n\t/* Return -ENODATA if the id for the current input\n\t or output is 0, meaning that it doesn't support this API. */\n\tif (id == 0)\n\t\treturn -ENODATA;\n\n\t/* Return norm array in a canonical way */\n\tfor (i = 0; i <= index && id; i++) {\n\t\t/* last std value in the standards array is 0, so this\n\t\t while always ends there since (id & 0) == 0. */\n\t\twhile ((id & standards[j].std) != standards[j].std)\n\t\t\tj++;\n\t\tcurr_id = standards[j].std;\n\t\tdescr = standards[j].descr;\n\t\tj++;\n\t\tif (curr_id == 0)\n\t\t\tbreak;\n\t\tif (curr_id != V4L2_STD_PAL &&\n\t\t\t\tcurr_id != V4L2_STD_SECAM &&\n\t\t\t\tcurr_id != V4L2_STD_NTSC)\n\t\t\tid &= ~curr_id;\n\t}\n\tif (i <= index)\n\t\treturn -EINVAL;\n\n\tv4l2_video_std_construct(vs, curr_id, descr);\n\treturn 0;\n}",
  6297. "project": "linux",
  6298. "hash": 178397725439587788310168144641963259498,
  6299. "size": 33,
  6300. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6301. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6302. "target": 0,
  6303. "dataset": "other",
  6304. "idx": 381433
  6305. },
  6306. {
  6307. "func": "void v4l2_video_std_frame_period(int id, struct v4l2_fract *frameperiod)\n{\n\tif (id & V4L2_STD_525_60) {\n\t\tframeperiod->numerator = 1001;\n\t\tframeperiod->denominator = 30000;\n\t} else {\n\t\tframeperiod->numerator = 1;\n\t\tframeperiod->denominator = 25;\n\t}\n}",
  6308. "project": "linux",
  6309. "hash": 148089183722148806808021314289397622229,
  6310. "size": 10,
  6311. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6312. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6313. "target": 0,
  6314. "dataset": "other",
  6315. "idx": 381520
  6316. },
  6317. {
  6318. "func": "static int v4l_qbuf(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_buffer *p = arg;\n\tint ret = check_fmt(file, p->type);\n\n\treturn ret ? ret : ops->vidioc_qbuf(file, fh, p);\n}",
  6319. "project": "linux",
  6320. "hash": 157222351844404168784673082968847329956,
  6321. "size": 8,
  6322. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6323. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6324. "target": 0,
  6325. "dataset": "other",
  6326. "idx": 381445
  6327. },
  6328. {
  6329. "func": "static int v4l_g_sliced_vbi_cap(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_sliced_vbi_cap *p = arg;\n\tint ret = check_fmt(file, p->type);\n\n\tif (ret)\n\t\treturn ret;\n\n\t/* Clear up to type, everything after type is zeroed already */\n\tmemset(p, 0, offsetof(struct v4l2_sliced_vbi_cap, type));\n\n\treturn ops->vidioc_g_sliced_vbi_cap(file, fh, p);\n}",
  6330. "project": "linux",
  6331. "hash": 329128045205648246809876828593763808289,
  6332. "size": 14,
  6333. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6334. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6335. "target": 0,
  6336. "dataset": "other",
  6337. "idx": 381454
  6338. },
  6339. {
  6340. "func": "static void v4l_pix_format_touch(struct v4l2_pix_format *p)\n{\n\t/*\n\t * The v4l2_pix_format structure contains fields that make no sense for\n\t * touch. Set them to default values in this case.\n\t */\n\n\tp->field = V4L2_FIELD_NONE;\n\tp->colorspace = V4L2_COLORSPACE_RAW;\n\tp->flags = 0;\n\tp->ycbcr_enc = 0;\n\tp->quantization = 0;\n\tp->xfer_func = 0;\n}",
  6341. "project": "linux",
  6342. "hash": 137219025372022743751639520916036802044,
  6343. "size": 14,
  6344. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6345. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6346. "target": 0,
  6347. "dataset": "other",
  6348. "idx": 381474
  6349. },
  6350. {
  6351. "func": "static int v4l_enum_fmt(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct video_device *vdev = video_devdata(file);\n\tstruct v4l2_fmtdesc *p = arg;\n\tint ret = check_fmt(file, p->type);\n\tu32 mbus_code;\n\tu32 cap_mask;\n\n\tif (ret)\n\t\treturn ret;\n\tret = -EINVAL;\n\n\tif (!(vdev->device_caps & V4L2_CAP_IO_MC))\n\t\tp->mbus_code = 0;\n\n\tmbus_code = p->mbus_code;\n\tCLEAR_AFTER_FIELD(p, type);\n\tp->mbus_code = mbus_code;\n\n\tswitch (p->type) {\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE:\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:\n\t\tcap_mask = V4L2_CAP_VIDEO_CAPTURE_MPLANE |\n\t\t\t V4L2_CAP_VIDEO_M2M_MPLANE;\n\t\tif (!!(vdev->device_caps & cap_mask) !=\n\t\t (p->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE))\n\t\t\tbreak;\n\n\t\tif (unlikely(!ops->vidioc_enum_fmt_vid_cap))\n\t\t\tbreak;\n\t\tret = ops->vidioc_enum_fmt_vid_cap(file, fh, arg);\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VIDEO_OVERLAY:\n\t\tif (unlikely(!ops->vidioc_enum_fmt_vid_overlay))\n\t\t\tbreak;\n\t\tret = ops->vidioc_enum_fmt_vid_overlay(file, fh, arg);\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT:\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:\n\t\tcap_mask = V4L2_CAP_VIDEO_OUTPUT_MPLANE |\n\t\t\t V4L2_CAP_VIDEO_M2M_MPLANE;\n\t\tif (!!(vdev->device_caps & cap_mask) !=\n\t\t (p->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE))\n\t\t\tbreak;\n\n\t\tif (unlikely(!ops->vidioc_enum_fmt_vid_out))\n\t\t\tbreak;\n\t\tret = ops->vidioc_enum_fmt_vid_out(file, fh, arg);\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_SDR_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_enum_fmt_sdr_cap))\n\t\t\tbreak;\n\t\tret = ops->vidioc_enum_fmt_sdr_cap(file, fh, arg);\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_SDR_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_enum_fmt_sdr_out))\n\t\t\tbreak;\n\t\tret = ops->vidioc_enum_fmt_sdr_out(file, fh, arg);\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_META_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_enum_fmt_meta_cap))\n\t\t\tbreak;\n\t\tret = ops->vidioc_enum_fmt_meta_cap(file, fh, arg);\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_META_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_enum_fmt_meta_out))\n\t\t\tbreak;\n\t\tret = ops->vidioc_enum_fmt_meta_out(file, fh, arg);\n\t\tbreak;\n\t}\n\tif (ret == 0)\n\t\tv4l_fill_fmtdesc(p);\n\treturn ret;\n}",
  6352. "project": "linux",
  6353. "hash": 90328786900484574553755598205915494385,
  6354. "size": 75,
  6355. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6356. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6357. "target": 0,
  6358. "dataset": "other",
  6359. "idx": 381443
  6360. },
  6361. {
  6362. "func": "static void v4l_sanitize_format(struct v4l2_format *fmt)\n{\n\tunsigned int offset;\n\n\t/* Make sure num_planes is not bogus */\n\tif (fmt->type == V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE ||\n\t fmt->type == V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE)\n\t\tfmt->fmt.pix_mp.num_planes = min_t(u32, fmt->fmt.pix_mp.num_planes,\n\t\t\t\t\t VIDEO_MAX_PLANES);\n\n\t/*\n\t * The v4l2_pix_format structure has been extended with fields that were\n\t * not previously required to be set to zero by applications. The priv\n\t * field, when set to a magic value, indicates the the extended fields\n\t * are valid. Otherwise they will contain undefined values. To simplify\n\t * the API towards drivers zero the extended fields and set the priv\n\t * field to the magic value when the extended pixel format structure\n\t * isn't used by applications.\n\t */\n\n\tif (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&\n\t fmt->type != V4L2_BUF_TYPE_VIDEO_OUTPUT)\n\t\treturn;\n\n\tif (fmt->fmt.pix.priv == V4L2_PIX_FMT_PRIV_MAGIC)\n\t\treturn;\n\n\tfmt->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\n\toffset = offsetof(struct v4l2_pix_format, priv)\n\t + sizeof(fmt->fmt.pix.priv);\n\tmemset(((void *)&fmt->fmt.pix) + offset, 0,\n\t sizeof(fmt->fmt.pix) - offset);\n}",
  6363. "project": "linux",
  6364. "hash": 25238072194471410135196938329748927821,
  6365. "size": 34,
  6366. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6367. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6368. "target": 0,
  6369. "dataset": "other",
  6370. "idx": 381536
  6371. },
  6372. {
  6373. "func": "static int v4l_querybuf(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_buffer *p = arg;\n\tint ret = check_fmt(file, p->type);\n\n\treturn ret ? ret : ops->vidioc_querybuf(file, fh, p);\n}",
  6374. "project": "linux",
  6375. "hash": 249838897503378101136415139617656208493,
  6376. "size": 8,
  6377. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6378. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6379. "target": 0,
  6380. "dataset": "other",
  6381. "idx": 381466
  6382. },
  6383. {
  6384. "func": "static int v4l_enumstd(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct video_device *vfd = video_devdata(file);\n\tstruct v4l2_standard *p = arg;\n\n\treturn v4l_video_std_enumstd(p, vfd->tvnorms);\n}",
  6385. "project": "linux",
  6386. "hash": 159782614002686590299693129890328166837,
  6387. "size": 8,
  6388. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6389. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6390. "target": 0,
  6391. "dataset": "other",
  6392. "idx": 381486
  6393. },
  6394. {
  6395. "func": "static int v4l_g_fmt(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_format *p = arg;\n\tstruct video_device *vfd = video_devdata(file);\n\tint ret = check_fmt(file, p->type);\n\n\tif (ret)\n\t\treturn ret;\n\n\t/*\n\t * fmt can't be cleared for these overlay types due to the 'clips'\n\t * 'clipcount' and 'bitmap' pointers in struct v4l2_window.\n\t * Those are provided by the user. So handle these two overlay types\n\t * first, and then just do a simple memset for the other types.\n\t */\n\tswitch (p->type) {\n\tcase V4L2_BUF_TYPE_VIDEO_OVERLAY:\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY: {\n\t\tstruct v4l2_clip *clips = p->fmt.win.clips;\n\t\tu32 clipcount = p->fmt.win.clipcount;\n\t\tvoid __user *bitmap = p->fmt.win.bitmap;\n\n\t\tmemset(&p->fmt, 0, sizeof(p->fmt));\n\t\tp->fmt.win.clips = clips;\n\t\tp->fmt.win.clipcount = clipcount;\n\t\tp->fmt.win.bitmap = bitmap;\n\t\tbreak;\n\t}\n\tdefault:\n\t\tmemset(&p->fmt, 0, sizeof(p->fmt));\n\t\tbreak;\n\t}\n\n\tswitch (p->type) {\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_g_fmt_vid_cap))\n\t\t\tbreak;\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\tret = ops->vidioc_g_fmt_vid_cap(file, fh, arg);\n\t\t/* just in case the driver zeroed it again */\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\tif (vfd->vfl_type == VFL_TYPE_TOUCH)\n\t\t\tv4l_pix_format_touch(&p->fmt.pix);\n\t\treturn ret;\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:\n\t\treturn ops->vidioc_g_fmt_vid_cap_mplane(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OVERLAY:\n\t\treturn ops->vidioc_g_fmt_vid_overlay(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VBI_CAPTURE:\n\t\treturn ops->vidioc_g_fmt_vbi_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:\n\t\treturn ops->vidioc_g_fmt_sliced_vbi_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_g_fmt_vid_out))\n\t\t\tbreak;\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\tret = ops->vidioc_g_fmt_vid_out(file, fh, arg);\n\t\t/* just in case the driver zeroed it again */\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\treturn ret;\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:\n\t\treturn ops->vidioc_g_fmt_vid_out_mplane(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:\n\t\treturn ops->vidioc_g_fmt_vid_out_overlay(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VBI_OUTPUT:\n\t\treturn ops->vidioc_g_fmt_vbi_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:\n\t\treturn ops->vidioc_g_fmt_sliced_vbi_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SDR_CAPTURE:\n\t\treturn ops->vidioc_g_fmt_sdr_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SDR_OUTPUT:\n\t\treturn ops->vidioc_g_fmt_sdr_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_META_CAPTURE:\n\t\treturn ops->vidioc_g_fmt_meta_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_META_OUTPUT:\n\t\treturn ops->vidioc_g_fmt_meta_out(file, fh, arg);\n\t}\n\treturn -EINVAL;\n}",
  6396. "project": "linux",
  6397. "hash": 235318075384291975866263478208759487946,
  6398. "size": 80,
  6399. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6400. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6401. "target": 0,
  6402. "dataset": "other",
  6403. "idx": 381427
  6404. },
  6405. {
  6406. "func": "static void v4l_fill_fmtdesc(struct v4l2_fmtdesc *fmt)\n{\n\tconst unsigned sz = sizeof(fmt->description);\n\tconst char *descr = NULL;\n\tu32 flags = 0;\n\n\t/*\n\t * We depart from the normal coding style here since the descriptions\n\t * should be aligned so it is easy to see which descriptions will be\n\t * longer than 31 characters (the max length for a description).\n\t * And frankly, this is easier to read anyway.\n\t *\n\t * Note that gcc will use O(log N) comparisons to find the right case.\n\t */\n\tswitch (fmt->pixelformat) {\n\t/* Max description length mask:\tdescr = \"0123456789012345678901234567890\" */\n\tcase V4L2_PIX_FMT_RGB332:\tdescr = \"8-bit RGB 3-3-2\"; break;\n\tcase V4L2_PIX_FMT_RGB444:\tdescr = \"16-bit A/XRGB 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_ARGB444:\tdescr = \"16-bit ARGB 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_XRGB444:\tdescr = \"16-bit XRGB 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_RGBA444:\tdescr = \"16-bit RGBA 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_RGBX444:\tdescr = \"16-bit RGBX 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_ABGR444:\tdescr = \"16-bit ABGR 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_XBGR444:\tdescr = \"16-bit XBGR 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_BGRA444:\tdescr = \"16-bit BGRA 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_BGRX444:\tdescr = \"16-bit BGRX 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_RGB555:\tdescr = \"16-bit A/XRGB 1-5-5-5\"; break;\n\tcase V4L2_PIX_FMT_ARGB555:\tdescr = \"16-bit ARGB 1-5-5-5\"; break;\n\tcase V4L2_PIX_FMT_XRGB555:\tdescr = \"16-bit XRGB 1-5-5-5\"; break;\n\tcase V4L2_PIX_FMT_ABGR555:\tdescr = \"16-bit ABGR 1-5-5-5\"; break;\n\tcase V4L2_PIX_FMT_XBGR555:\tdescr = \"16-bit XBGR 1-5-5-5\"; break;\n\tcase V4L2_PIX_FMT_RGBA555:\tdescr = \"16-bit RGBA 5-5-5-1\"; break;\n\tcase V4L2_PIX_FMT_RGBX555:\tdescr = \"16-bit RGBX 5-5-5-1\"; break;\n\tcase V4L2_PIX_FMT_BGRA555:\tdescr = \"16-bit BGRA 5-5-5-1\"; break;\n\tcase V4L2_PIX_FMT_BGRX555:\tdescr = \"16-bit BGRX 5-5-5-1\"; break;\n\tcase V4L2_PIX_FMT_RGB565:\tdescr = \"16-bit RGB 5-6-5\"; break;\n\tcase V4L2_PIX_FMT_RGB555X:\tdescr = \"16-bit A/XRGB 1-5-5-5 BE\"; break;\n\tcase V4L2_PIX_FMT_ARGB555X:\tdescr = \"16-bit ARGB 1-5-5-5 BE\"; break;\n\tcase V4L2_PIX_FMT_XRGB555X:\tdescr = \"16-bit XRGB 1-5-5-5 BE\"; break;\n\tcase V4L2_PIX_FMT_RGB565X:\tdescr = \"16-bit RGB 5-6-5 BE\"; break;\n\tcase V4L2_PIX_FMT_BGR666:\tdescr = \"18-bit BGRX 6-6-6-14\"; break;\n\tcase V4L2_PIX_FMT_BGR24:\tdescr = \"24-bit BGR 8-8-8\"; break;\n\tcase V4L2_PIX_FMT_RGB24:\tdescr = \"24-bit RGB 8-8-8\"; break;\n\tcase V4L2_PIX_FMT_BGR32:\tdescr = \"32-bit BGRA/X 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_ABGR32:\tdescr = \"32-bit BGRA 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_XBGR32:\tdescr = \"32-bit BGRX 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_RGB32:\tdescr = \"32-bit A/XRGB 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_ARGB32:\tdescr = \"32-bit ARGB 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_XRGB32:\tdescr = \"32-bit XRGB 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_BGRA32:\tdescr = \"32-bit ABGR 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_BGRX32:\tdescr = \"32-bit XBGR 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_RGBA32:\tdescr = \"32-bit RGBA 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_RGBX32:\tdescr = \"32-bit RGBX 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_GREY:\t\tdescr = \"8-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y4:\t\tdescr = \"4-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y6:\t\tdescr = \"6-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y10:\t\tdescr = \"10-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y12:\t\tdescr = \"12-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y14:\t\tdescr = \"14-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y16:\t\tdescr = \"16-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y16_BE:\tdescr = \"16-bit Greyscale BE\"; break;\n\tcase V4L2_PIX_FMT_Y10BPACK:\tdescr = \"10-bit Greyscale (Packed)\"; break;\n\tcase V4L2_PIX_FMT_Y10P:\t\tdescr = \"10-bit Greyscale (MIPI Packed)\"; break;\n\tcase V4L2_PIX_FMT_Y8I:\t\tdescr = \"Interleaved 8-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Y12I:\t\tdescr = \"Interleaved 12-bit Greyscale\"; break;\n\tcase V4L2_PIX_FMT_Z16:\t\tdescr = \"16-bit Depth\"; break;\n\tcase V4L2_PIX_FMT_INZI:\t\tdescr = \"Planar 10:16 Greyscale Depth\"; break;\n\tcase V4L2_PIX_FMT_CNF4:\t\tdescr = \"4-bit Depth Confidence (Packed)\"; break;\n\tcase V4L2_PIX_FMT_PAL8:\t\tdescr = \"8-bit Palette\"; break;\n\tcase V4L2_PIX_FMT_UV8:\t\tdescr = \"8-bit Chrominance UV 4-4\"; break;\n\tcase V4L2_PIX_FMT_YVU410:\tdescr = \"Planar YVU 4:1:0\"; break;\n\tcase V4L2_PIX_FMT_YVU420:\tdescr = \"Planar YVU 4:2:0\"; break;\n\tcase V4L2_PIX_FMT_YUYV:\t\tdescr = \"YUYV 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_YYUV:\t\tdescr = \"YYUV 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_YVYU:\t\tdescr = \"YVYU 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_UYVY:\t\tdescr = \"UYVY 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_VYUY:\t\tdescr = \"VYUY 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_YUV422P:\tdescr = \"Planar YUV 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_YUV411P:\tdescr = \"Planar YUV 4:1:1\"; break;\n\tcase V4L2_PIX_FMT_Y41P:\t\tdescr = \"YUV 4:1:1 (Packed)\"; break;\n\tcase V4L2_PIX_FMT_YUV444:\tdescr = \"16-bit A/XYUV 4-4-4-4\"; break;\n\tcase V4L2_PIX_FMT_YUV555:\tdescr = \"16-bit A/XYUV 1-5-5-5\"; break;\n\tcase V4L2_PIX_FMT_YUV565:\tdescr = \"16-bit YUV 5-6-5\"; break;\n\tcase V4L2_PIX_FMT_YUV32:\tdescr = \"32-bit A/XYUV 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_AYUV32:\tdescr = \"32-bit AYUV 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_XYUV32:\tdescr = \"32-bit XYUV 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_VUYA32:\tdescr = \"32-bit VUYA 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_VUYX32:\tdescr = \"32-bit VUYX 8-8-8-8\"; break;\n\tcase V4L2_PIX_FMT_YUV410:\tdescr = \"Planar YUV 4:1:0\"; break;\n\tcase V4L2_PIX_FMT_YUV420:\tdescr = \"Planar YUV 4:2:0\"; break;\n\tcase V4L2_PIX_FMT_HI240:\tdescr = \"8-bit Dithered RGB (BTTV)\"; break;\n\tcase V4L2_PIX_FMT_HM12:\t\tdescr = \"YUV 4:2:0 (16x16 Macroblocks)\"; break;\n\tcase V4L2_PIX_FMT_M420:\t\tdescr = \"YUV 4:2:0 (M420)\"; break;\n\tcase V4L2_PIX_FMT_NV12:\t\tdescr = \"Y/CbCr 4:2:0\"; break;\n\tcase V4L2_PIX_FMT_NV21:\t\tdescr = \"Y/CrCb 4:2:0\"; break;\n\tcase V4L2_PIX_FMT_NV16:\t\tdescr = \"Y/CbCr 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_NV61:\t\tdescr = \"Y/CrCb 4:2:2\"; break;\n\tcase V4L2_PIX_FMT_NV24:\t\tdescr = \"Y/CbCr 4:4:4\"; break;\n\tcase V4L2_PIX_FMT_NV42:\t\tdescr = \"Y/CrCb 4:4:4\"; break;\n\tcase V4L2_PIX_FMT_NV12M:\tdescr = \"Y/CbCr 4:2:0 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_NV21M:\tdescr = \"Y/CrCb 4:2:0 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_NV16M:\tdescr = \"Y/CbCr 4:2:2 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_NV61M:\tdescr = \"Y/CrCb 4:2:2 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_NV12MT:\tdescr = \"Y/CbCr 4:2:0 (64x32 MB, N-C)\"; break;\n\tcase V4L2_PIX_FMT_NV12MT_16X16:\tdescr = \"Y/CbCr 4:2:0 (16x16 MB, N-C)\"; break;\n\tcase V4L2_PIX_FMT_YUV420M:\tdescr = \"Planar YUV 4:2:0 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_YVU420M:\tdescr = \"Planar YVU 4:2:0 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_YUV422M:\tdescr = \"Planar YUV 4:2:2 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_YVU422M:\tdescr = \"Planar YVU 4:2:2 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_YUV444M:\tdescr = \"Planar YUV 4:4:4 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_YVU444M:\tdescr = \"Planar YVU 4:4:4 (N-C)\"; break;\n\tcase V4L2_PIX_FMT_SBGGR8:\tdescr = \"8-bit Bayer BGBG/GRGR\"; break;\n\tcase V4L2_PIX_FMT_SGBRG8:\tdescr = \"8-bit Bayer GBGB/RGRG\"; break;\n\tcase V4L2_PIX_FMT_SGRBG8:\tdescr = \"8-bit Bayer GRGR/BGBG\"; break;\n\tcase V4L2_PIX_FMT_SRGGB8:\tdescr = \"8-bit Bayer RGRG/GBGB\"; break;\n\tcase V4L2_PIX_FMT_SBGGR10:\tdescr = \"10-bit Bayer BGBG/GRGR\"; break;\n\tcase V4L2_PIX_FMT_SGBRG10:\tdescr = \"10-bit Bayer GBGB/RGRG\"; break;\n\tcase V4L2_PIX_FMT_SGRBG10:\tdescr = \"10-bit Bayer GRGR/BGBG\"; break;\n\tcase V4L2_PIX_FMT_SRGGB10:\tdescr = \"10-bit Bayer RGRG/GBGB\"; break;\n\tcase V4L2_PIX_FMT_SBGGR10P:\tdescr = \"10-bit Bayer BGBG/GRGR Packed\"; break;\n\tcase V4L2_PIX_FMT_SGBRG10P:\tdescr = \"10-bit Bayer GBGB/RGRG Packed\"; break;\n\tcase V4L2_PIX_FMT_SGRBG10P:\tdescr = \"10-bit Bayer GRGR/BGBG Packed\"; break;\n\tcase V4L2_PIX_FMT_SRGGB10P:\tdescr = \"10-bit Bayer RGRG/GBGB Packed\"; break;\n\tcase V4L2_PIX_FMT_IPU3_SBGGR10: descr = \"10-bit bayer BGGR IPU3 Packed\"; break;\n\tcase V4L2_PIX_FMT_IPU3_SGBRG10: descr = \"10-bit bayer GBRG IPU3 Packed\"; break;\n\tcase V4L2_PIX_FMT_IPU3_SGRBG10: descr = \"10-bit bayer GRBG IPU3 Packed\"; break;\n\tcase V4L2_PIX_FMT_IPU3_SRGGB10: descr = \"10-bit bayer RGGB IPU3 Packed\"; break;\n\tcase V4L2_PIX_FMT_SBGGR10ALAW8:\tdescr = \"8-bit Bayer BGBG/GRGR (A-law)\"; break;\n\tcase V4L2_PIX_FMT_SGBRG10ALAW8:\tdescr = \"8-bit Bayer GBGB/RGRG (A-law)\"; break;\n\tcase V4L2_PIX_FMT_SGRBG10ALAW8:\tdescr = \"8-bit Bayer GRGR/BGBG (A-law)\"; break;\n\tcase V4L2_PIX_FMT_SRGGB10ALAW8:\tdescr = \"8-bit Bayer RGRG/GBGB (A-law)\"; break;\n\tcase V4L2_PIX_FMT_SBGGR10DPCM8:\tdescr = \"8-bit Bayer BGBG/GRGR (DPCM)\"; break;\n\tcase V4L2_PIX_FMT_SGBRG10DPCM8:\tdescr = \"8-bit Bayer GBGB/RGRG (DPCM)\"; break;\n\tcase V4L2_PIX_FMT_SGRBG10DPCM8:\tdescr = \"8-bit Bayer GRGR/BGBG (DPCM)\"; break;\n\tcase V4L2_PIX_FMT_SRGGB10DPCM8:\tdescr = \"8-bit Bayer RGRG/GBGB (DPCM)\"; break;\n\tcase V4L2_PIX_FMT_SBGGR12:\tdescr = \"12-bit Bayer BGBG/GRGR\"; break;\n\tcase V4L2_PIX_FMT_SGBRG12:\tdescr = \"12-bit Bayer GBGB/RGRG\"; break;\n\tcase V4L2_PIX_FMT_SGRBG12:\tdescr = \"12-bit Bayer GRGR/BGBG\"; break;\n\tcase V4L2_PIX_FMT_SRGGB12:\tdescr = \"12-bit Bayer RGRG/GBGB\"; break;\n\tcase V4L2_PIX_FMT_SBGGR12P:\tdescr = \"12-bit Bayer BGBG/GRGR Packed\"; break;\n\tcase V4L2_PIX_FMT_SGBRG12P:\tdescr = \"12-bit Bayer GBGB/RGRG Packed\"; break;\n\tcase V4L2_PIX_FMT_SGRBG12P:\tdescr = \"12-bit Bayer GRGR/BGBG Packed\"; break;\n\tcase V4L2_PIX_FMT_SRGGB12P:\tdescr = \"12-bit Bayer RGRG/GBGB Packed\"; break;\n\tcase V4L2_PIX_FMT_SBGGR14:\tdescr = \"14-bit Bayer BGBG/GRGR\"; break;\n\tcase V4L2_PIX_FMT_SGBRG14:\tdescr = \"14-bit Bayer GBGB/RGRG\"; break;\n\tcase V4L2_PIX_FMT_SGRBG14:\tdescr = \"14-bit Bayer GRGR/BGBG\"; break;\n\tcase V4L2_PIX_FMT_SRGGB14:\tdescr = \"14-bit Bayer RGRG/GBGB\"; break;\n\tcase V4L2_PIX_FMT_SBGGR14P:\tdescr = \"14-bit Bayer BGBG/GRGR Packed\"; break;\n\tcase V4L2_PIX_FMT_SGBRG14P:\tdescr = \"14-bit Bayer GBGB/RGRG Packed\"; break;\n\tcase V4L2_PIX_FMT_SGRBG14P:\tdescr = \"14-bit Bayer GRGR/BGBG Packed\"; break;\n\tcase V4L2_PIX_FMT_SRGGB14P:\tdescr = \"14-bit Bayer RGRG/GBGB Packed\"; break;\n\tcase V4L2_PIX_FMT_SBGGR16:\tdescr = \"16-bit Bayer BGBG/GRGR\"; break;\n\tcase V4L2_PIX_FMT_SGBRG16:\tdescr = \"16-bit Bayer GBGB/RGRG\"; break;\n\tcase V4L2_PIX_FMT_SGRBG16:\tdescr = \"16-bit Bayer GRGR/BGBG\"; break;\n\tcase V4L2_PIX_FMT_SRGGB16:\tdescr = \"16-bit Bayer RGRG/GBGB\"; break;\n\tcase V4L2_PIX_FMT_SN9C20X_I420:\tdescr = \"GSPCA SN9C20X I420\"; break;\n\tcase V4L2_PIX_FMT_SPCA501:\tdescr = \"GSPCA SPCA501\"; break;\n\tcase V4L2_PIX_FMT_SPCA505:\tdescr = \"GSPCA SPCA505\"; break;\n\tcase V4L2_PIX_FMT_SPCA508:\tdescr = \"GSPCA SPCA508\"; break;\n\tcase V4L2_PIX_FMT_STV0680:\tdescr = \"GSPCA STV0680\"; break;\n\tcase V4L2_PIX_FMT_TM6000:\tdescr = \"A/V + VBI Mux Packet\"; break;\n\tcase V4L2_PIX_FMT_CIT_YYVYUY:\tdescr = \"GSPCA CIT YYVYUY\"; break;\n\tcase V4L2_PIX_FMT_KONICA420:\tdescr = \"GSPCA KONICA420\"; break;\n\tcase V4L2_PIX_FMT_HSV24:\tdescr = \"24-bit HSV 8-8-8\"; break;\n\tcase V4L2_PIX_FMT_HSV32:\tdescr = \"32-bit XHSV 8-8-8-8\"; break;\n\tcase V4L2_SDR_FMT_CU8:\t\tdescr = \"Complex U8\"; break;\n\tcase V4L2_SDR_FMT_CU16LE:\tdescr = \"Complex U16LE\"; break;\n\tcase V4L2_SDR_FMT_CS8:\t\tdescr = \"Complex S8\"; break;\n\tcase V4L2_SDR_FMT_CS14LE:\tdescr = \"Complex S14LE\"; break;\n\tcase V4L2_SDR_FMT_RU12LE:\tdescr = \"Real U12LE\"; break;\n\tcase V4L2_SDR_FMT_PCU16BE:\tdescr = \"Planar Complex U16BE\"; break;\n\tcase V4L2_SDR_FMT_PCU18BE:\tdescr = \"Planar Complex U18BE\"; break;\n\tcase V4L2_SDR_FMT_PCU20BE:\tdescr = \"Planar Complex U20BE\"; break;\n\tcase V4L2_TCH_FMT_DELTA_TD16:\tdescr = \"16-bit Signed Deltas\"; break;\n\tcase V4L2_TCH_FMT_DELTA_TD08:\tdescr = \"8-bit Signed Deltas\"; break;\n\tcase V4L2_TCH_FMT_TU16:\t\tdescr = \"16-bit Unsigned Touch Data\"; break;\n\tcase V4L2_TCH_FMT_TU08:\t\tdescr = \"8-bit Unsigned Touch Data\"; break;\n\tcase V4L2_META_FMT_VSP1_HGO:\tdescr = \"R-Car VSP1 1-D Histogram\"; break;\n\tcase V4L2_META_FMT_VSP1_HGT:\tdescr = \"R-Car VSP1 2-D Histogram\"; break;\n\tcase V4L2_META_FMT_UVC:\t\tdescr = \"UVC Payload Header Metadata\"; break;\n\tcase V4L2_META_FMT_D4XX:\tdescr = \"Intel D4xx UVC Metadata\"; break;\n\tcase V4L2_META_FMT_VIVID: descr = \"Vivid Metadata\"; break;\n\tcase V4L2_META_FMT_RK_ISP1_PARAMS:\tdescr = \"Rockchip ISP1 3A Parameters\"; break;\n\tcase V4L2_META_FMT_RK_ISP1_STAT_3A:\tdescr = \"Rockchip ISP1 3A Statistics\"; break;\n\n\tdefault:\n\t\t/* Compressed formats */\n\t\tflags = V4L2_FMT_FLAG_COMPRESSED;\n\t\tswitch (fmt->pixelformat) {\n\t\t/* Max description length mask:\tdescr = \"0123456789012345678901234567890\" */\n\t\tcase V4L2_PIX_FMT_MJPEG:\tdescr = \"Motion-JPEG\"; break;\n\t\tcase V4L2_PIX_FMT_JPEG:\t\tdescr = \"JFIF JPEG\"; break;\n\t\tcase V4L2_PIX_FMT_DV:\t\tdescr = \"1394\"; break;\n\t\tcase V4L2_PIX_FMT_MPEG:\t\tdescr = \"MPEG-1/2/4\"; break;\n\t\tcase V4L2_PIX_FMT_H264:\t\tdescr = \"H.264\"; break;\n\t\tcase V4L2_PIX_FMT_H264_NO_SC:\tdescr = \"H.264 (No Start Codes)\"; break;\n\t\tcase V4L2_PIX_FMT_H264_MVC:\tdescr = \"H.264 MVC\"; break;\n\t\tcase V4L2_PIX_FMT_H264_SLICE:\tdescr = \"H.264 Parsed Slice Data\"; break;\n\t\tcase V4L2_PIX_FMT_H263:\t\tdescr = \"H.263\"; break;\n\t\tcase V4L2_PIX_FMT_MPEG1:\tdescr = \"MPEG-1 ES\"; break;\n\t\tcase V4L2_PIX_FMT_MPEG2:\tdescr = \"MPEG-2 ES\"; break;\n\t\tcase V4L2_PIX_FMT_MPEG2_SLICE:\tdescr = \"MPEG-2 Parsed Slice Data\"; break;\n\t\tcase V4L2_PIX_FMT_MPEG4:\tdescr = \"MPEG-4 Part 2 ES\"; break;\n\t\tcase V4L2_PIX_FMT_XVID:\t\tdescr = \"Xvid\"; break;\n\t\tcase V4L2_PIX_FMT_VC1_ANNEX_G:\tdescr = \"VC-1 (SMPTE 412M Annex G)\"; break;\n\t\tcase V4L2_PIX_FMT_VC1_ANNEX_L:\tdescr = \"VC-1 (SMPTE 412M Annex L)\"; break;\n\t\tcase V4L2_PIX_FMT_VP8:\t\tdescr = \"VP8\"; break;\n\t\tcase V4L2_PIX_FMT_VP8_FRAME: descr = \"VP8 Frame\"; break;\n\t\tcase V4L2_PIX_FMT_VP9:\t\tdescr = \"VP9\"; break;\n\t\tcase V4L2_PIX_FMT_HEVC:\t\tdescr = \"HEVC\"; break; /* aka H.265 */\n\t\tcase V4L2_PIX_FMT_HEVC_SLICE:\tdescr = \"HEVC Parsed Slice Data\"; break;\n\t\tcase V4L2_PIX_FMT_FWHT:\t\tdescr = \"FWHT\"; break; /* used in vicodec */\n\t\tcase V4L2_PIX_FMT_FWHT_STATELESS:\tdescr = \"FWHT Stateless\"; break; /* used in vicodec */\n\t\tcase V4L2_PIX_FMT_CPIA1:\tdescr = \"GSPCA CPiA YUV\"; break;\n\t\tcase V4L2_PIX_FMT_WNVA:\t\tdescr = \"WNVA\"; break;\n\t\tcase V4L2_PIX_FMT_SN9C10X:\tdescr = \"GSPCA SN9C10X\"; break;\n\t\tcase V4L2_PIX_FMT_PWC1:\t\tdescr = \"Raw Philips Webcam Type (Old)\"; break;\n\t\tcase V4L2_PIX_FMT_PWC2:\t\tdescr = \"Raw Philips Webcam Type (New)\"; break;\n\t\tcase V4L2_PIX_FMT_ET61X251:\tdescr = \"GSPCA ET61X251\"; break;\n\t\tcase V4L2_PIX_FMT_SPCA561:\tdescr = \"GSPCA SPCA561\"; break;\n\t\tcase V4L2_PIX_FMT_PAC207:\tdescr = \"GSPCA PAC207\"; break;\n\t\tcase V4L2_PIX_FMT_MR97310A:\tdescr = \"GSPCA MR97310A\"; break;\n\t\tcase V4L2_PIX_FMT_JL2005BCD:\tdescr = \"GSPCA JL2005BCD\"; break;\n\t\tcase V4L2_PIX_FMT_SN9C2028:\tdescr = \"GSPCA SN9C2028\"; break;\n\t\tcase V4L2_PIX_FMT_SQ905C:\tdescr = \"GSPCA SQ905C\"; break;\n\t\tcase V4L2_PIX_FMT_PJPG:\t\tdescr = \"GSPCA PJPG\"; break;\n\t\tcase V4L2_PIX_FMT_OV511:\tdescr = \"GSPCA OV511\"; break;\n\t\tcase V4L2_PIX_FMT_OV518:\tdescr = \"GSPCA OV518\"; break;\n\t\tcase V4L2_PIX_FMT_JPGL:\t\tdescr = \"JPEG Lite\"; break;\n\t\tcase V4L2_PIX_FMT_SE401:\tdescr = \"GSPCA SE401\"; break;\n\t\tcase V4L2_PIX_FMT_S5C_UYVY_JPG:\tdescr = \"S5C73MX interleaved UYVY/JPEG\"; break;\n\t\tcase V4L2_PIX_FMT_MT21C:\tdescr = \"Mediatek Compressed Format\"; break;\n\t\tcase V4L2_PIX_FMT_SUNXI_TILED_NV12: descr = \"Sunxi Tiled NV12 Format\"; break;\n\t\tdefault:\n\t\t\tif (fmt->description[0])\n\t\t\t\treturn;\n\t\t\tWARN(1, \"Unknown pixelformat 0x%08x\\n\", fmt->pixelformat);\n\t\t\tflags = 0;\n\t\t\tsnprintf(fmt->description, sz, \"%c%c%c%c%s\",\n\t\t\t\t\t(char)(fmt->pixelformat & 0x7f),\n\t\t\t\t\t(char)((fmt->pixelformat >> 8) & 0x7f),\n\t\t\t\t\t(char)((fmt->pixelformat >> 16) & 0x7f),\n\t\t\t\t\t(char)((fmt->pixelformat >> 24) & 0x7f),\n\t\t\t\t\t(fmt->pixelformat & (1UL << 31)) ? \"-BE\" : \"\");\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (descr)\n\t\tWARN_ON(strscpy(fmt->description, descr, sz) < 0);\n\tfmt->flags |= flags;\n}",
  6407. "project": "linux",
  6408. "hash": 304550767409001950021568096384696210436,
  6409. "size": 252,
  6410. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6411. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6412. "target": 0,
  6413. "dataset": "other",
  6414. "idx": 381456
  6415. },
  6416. {
  6417. "func": "static int v4l_try_fmt(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_format *p = arg;\n\tstruct video_device *vfd = video_devdata(file);\n\tint ret = check_fmt(file, p->type);\n\tunsigned int i;\n\n\tif (ret)\n\t\treturn ret;\n\n\tv4l_sanitize_format(p);\n\n\tswitch (p->type) {\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vid_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix);\n\t\tret = ops->vidioc_try_fmt_vid_cap(file, fh, arg);\n\t\t/* just in case the driver zeroed it again */\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\tif (vfd->vfl_type == VFL_TYPE_TOUCH)\n\t\t\tv4l_pix_format_touch(&p->fmt.pix);\n\t\treturn ret;\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vid_cap_mplane))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);\n\t\tfor (i = 0; i < p->fmt.pix_mp.num_planes; i++)\n\t\t\tCLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],\n\t\t\t\t\t bytesperline);\n\t\treturn ops->vidioc_try_fmt_vid_cap_mplane(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OVERLAY:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vid_overlay))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.win);\n\t\treturn ops->vidioc_try_fmt_vid_overlay(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VBI_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vbi_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.vbi.flags);\n\t\treturn ops->vidioc_try_fmt_vbi_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_try_fmt_sliced_vbi_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sliced.io_size);\n\t\treturn ops->vidioc_try_fmt_sliced_vbi_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vid_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix);\n\t\tret = ops->vidioc_try_fmt_vid_out(file, fh, arg);\n\t\t/* just in case the driver zeroed it again */\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\treturn ret;\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vid_out_mplane))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);\n\t\tfor (i = 0; i < p->fmt.pix_mp.num_planes; i++)\n\t\t\tCLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],\n\t\t\t\t\t bytesperline);\n\t\treturn ops->vidioc_try_fmt_vid_out_mplane(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vid_out_overlay))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.win);\n\t\treturn ops->vidioc_try_fmt_vid_out_overlay(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VBI_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_try_fmt_vbi_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.vbi.flags);\n\t\treturn ops->vidioc_try_fmt_vbi_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_try_fmt_sliced_vbi_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sliced.io_size);\n\t\treturn ops->vidioc_try_fmt_sliced_vbi_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SDR_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_try_fmt_sdr_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);\n\t\treturn ops->vidioc_try_fmt_sdr_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SDR_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_try_fmt_sdr_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);\n\t\treturn ops->vidioc_try_fmt_sdr_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_META_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_try_fmt_meta_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.meta);\n\t\treturn ops->vidioc_try_fmt_meta_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_META_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_try_fmt_meta_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.meta);\n\t\treturn ops->vidioc_try_fmt_meta_out(file, fh, arg);\n\t}\n\treturn -EINVAL;\n}",
  6418. "project": "linux",
  6419. "hash": 251677547459383194768234227378707781497,
  6420. "size": 101,
  6421. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6422. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6423. "target": 0,
  6424. "dataset": "other",
  6425. "idx": 381442
  6426. },
  6427. {
  6428. "func": "static int v4l_s_fmt(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_format *p = arg;\n\tstruct video_device *vfd = video_devdata(file);\n\tint ret = check_fmt(file, p->type);\n\tunsigned int i;\n\n\tif (ret)\n\t\treturn ret;\n\n\tret = v4l_enable_media_source(vfd);\n\tif (ret)\n\t\treturn ret;\n\tv4l_sanitize_format(p);\n\n\tswitch (p->type) {\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vid_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix);\n\t\tret = ops->vidioc_s_fmt_vid_cap(file, fh, arg);\n\t\t/* just in case the driver zeroed it again */\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\tif (vfd->vfl_type == VFL_TYPE_TOUCH)\n\t\t\tv4l_pix_format_touch(&p->fmt.pix);\n\t\treturn ret;\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vid_cap_mplane))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);\n\t\tfor (i = 0; i < p->fmt.pix_mp.num_planes; i++)\n\t\t\tCLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],\n\t\t\t\t\t bytesperline);\n\t\treturn ops->vidioc_s_fmt_vid_cap_mplane(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OVERLAY:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vid_overlay))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.win);\n\t\treturn ops->vidioc_s_fmt_vid_overlay(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VBI_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vbi_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.vbi.flags);\n\t\treturn ops->vidioc_s_fmt_vbi_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_s_fmt_sliced_vbi_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sliced.io_size);\n\t\treturn ops->vidioc_s_fmt_sliced_vbi_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vid_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix);\n\t\tret = ops->vidioc_s_fmt_vid_out(file, fh, arg);\n\t\t/* just in case the driver zeroed it again */\n\t\tp->fmt.pix.priv = V4L2_PIX_FMT_PRIV_MAGIC;\n\t\treturn ret;\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vid_out_mplane))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.pix_mp.xfer_func);\n\t\tfor (i = 0; i < p->fmt.pix_mp.num_planes; i++)\n\t\t\tCLEAR_AFTER_FIELD(&p->fmt.pix_mp.plane_fmt[i],\n\t\t\t\t\t bytesperline);\n\t\treturn ops->vidioc_s_fmt_vid_out_mplane(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vid_out_overlay))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.win);\n\t\treturn ops->vidioc_s_fmt_vid_out_overlay(file, fh, arg);\n\tcase V4L2_BUF_TYPE_VBI_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_s_fmt_vbi_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.vbi.flags);\n\t\treturn ops->vidioc_s_fmt_vbi_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_s_fmt_sliced_vbi_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sliced.io_size);\n\t\treturn ops->vidioc_s_fmt_sliced_vbi_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SDR_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_s_fmt_sdr_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);\n\t\treturn ops->vidioc_s_fmt_sdr_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_SDR_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_s_fmt_sdr_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.sdr.buffersize);\n\t\treturn ops->vidioc_s_fmt_sdr_out(file, fh, arg);\n\tcase V4L2_BUF_TYPE_META_CAPTURE:\n\t\tif (unlikely(!ops->vidioc_s_fmt_meta_cap))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.meta);\n\t\treturn ops->vidioc_s_fmt_meta_cap(file, fh, arg);\n\tcase V4L2_BUF_TYPE_META_OUTPUT:\n\t\tif (unlikely(!ops->vidioc_s_fmt_meta_out))\n\t\t\tbreak;\n\t\tCLEAR_AFTER_FIELD(p, fmt.meta);\n\t\treturn ops->vidioc_s_fmt_meta_out(file, fh, arg);\n\t}\n\treturn -EINVAL;\n}",
  6429. "project": "linux",
  6430. "hash": 211174988759662803706465165093416971314,
  6431. "size": 104,
  6432. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6433. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6434. "target": 0,
  6435. "dataset": "other",
  6436. "idx": 381434
  6437. },
  6438. {
  6439. "func": "static int check_fmt(struct file *file, enum v4l2_buf_type type)\n{\n\tconst u32 vid_caps = V4L2_CAP_VIDEO_CAPTURE |\n\t\t\t V4L2_CAP_VIDEO_CAPTURE_MPLANE |\n\t\t\t V4L2_CAP_VIDEO_OUTPUT |\n\t\t\t V4L2_CAP_VIDEO_OUTPUT_MPLANE |\n\t\t\t V4L2_CAP_VIDEO_M2M | V4L2_CAP_VIDEO_M2M_MPLANE;\n\tconst u32 meta_caps = V4L2_CAP_META_CAPTURE |\n\t\t\t V4L2_CAP_META_OUTPUT;\n\tstruct video_device *vfd = video_devdata(file);\n\tconst struct v4l2_ioctl_ops *ops = vfd->ioctl_ops;\n\tbool is_vid = vfd->vfl_type == VFL_TYPE_VIDEO &&\n\t\t (vfd->device_caps & vid_caps);\n\tbool is_vbi = vfd->vfl_type == VFL_TYPE_VBI;\n\tbool is_sdr = vfd->vfl_type == VFL_TYPE_SDR;\n\tbool is_tch = vfd->vfl_type == VFL_TYPE_TOUCH;\n\tbool is_meta = vfd->vfl_type == VFL_TYPE_VIDEO &&\n\t\t (vfd->device_caps & meta_caps);\n\tbool is_rx = vfd->vfl_dir != VFL_DIR_TX;\n\tbool is_tx = vfd->vfl_dir != VFL_DIR_RX;\n\n\tif (ops == NULL)\n\t\treturn -EINVAL;\n\n\tswitch (type) {\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE:\n\t\tif ((is_vid || is_tch) && is_rx &&\n\t\t (ops->vidioc_g_fmt_vid_cap || ops->vidioc_g_fmt_vid_cap_mplane))\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:\n\t\tif ((is_vid || is_tch) && is_rx && ops->vidioc_g_fmt_vid_cap_mplane)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VIDEO_OVERLAY:\n\t\tif (is_vid && is_rx && ops->vidioc_g_fmt_vid_overlay)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT:\n\t\tif (is_vid && is_tx &&\n\t\t (ops->vidioc_g_fmt_vid_out || ops->vidioc_g_fmt_vid_out_mplane))\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:\n\t\tif (is_vid && is_tx && ops->vidioc_g_fmt_vid_out_mplane)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VIDEO_OUTPUT_OVERLAY:\n\t\tif (is_vid && is_tx && ops->vidioc_g_fmt_vid_out_overlay)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VBI_CAPTURE:\n\t\tif (is_vbi && is_rx && ops->vidioc_g_fmt_vbi_cap)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_VBI_OUTPUT:\n\t\tif (is_vbi && is_tx && ops->vidioc_g_fmt_vbi_out)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_SLICED_VBI_CAPTURE:\n\t\tif (is_vbi && is_rx && ops->vidioc_g_fmt_sliced_vbi_cap)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_SLICED_VBI_OUTPUT:\n\t\tif (is_vbi && is_tx && ops->vidioc_g_fmt_sliced_vbi_out)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_SDR_CAPTURE:\n\t\tif (is_sdr && is_rx && ops->vidioc_g_fmt_sdr_cap)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_SDR_OUTPUT:\n\t\tif (is_sdr && is_tx && ops->vidioc_g_fmt_sdr_out)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_META_CAPTURE:\n\t\tif (is_meta && is_rx && ops->vidioc_g_fmt_meta_cap)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase V4L2_BUF_TYPE_META_OUTPUT:\n\t\tif (is_meta && is_tx && ops->vidioc_g_fmt_meta_out)\n\t\t\treturn 0;\n\t\tbreak;\n\tdefault:\n\t\tbreak;\n\t}\n\treturn -EINVAL;\n}",
  6440. "project": "linux",
  6441. "hash": 112015074752453142575913723608615365673,
  6442. "size": 88,
  6443. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6444. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6445. "target": 0,
  6446. "dataset": "other",
  6447. "idx": 381468
  6448. },
  6449. {
  6450. "func": "static int v4l_s_parm(const struct v4l2_ioctl_ops *ops,\n\t\t\t\tstruct file *file, void *fh, void *arg)\n{\n\tstruct v4l2_streamparm *p = arg;\n\tint ret = check_fmt(file, p->type);\n\n\tif (ret)\n\t\treturn ret;\n\n\t/* Note: extendedmode is never used in drivers */\n\tif (V4L2_TYPE_IS_OUTPUT(p->type)) {\n\t\tmemset(p->parm.output.reserved, 0,\n\t\t sizeof(p->parm.output.reserved));\n\t\tp->parm.output.extendedmode = 0;\n\t\tp->parm.output.outputmode &= V4L2_MODE_HIGHQUALITY;\n\t} else {\n\t\tmemset(p->parm.capture.reserved, 0,\n\t\t sizeof(p->parm.capture.reserved));\n\t\tp->parm.capture.extendedmode = 0;\n\t\tp->parm.capture.capturemode &= V4L2_MODE_HIGHQUALITY;\n\t}\n\treturn ops->vidioc_s_parm(file, fh, p);\n}",
  6451. "project": "linux",
  6452. "hash": 27353891032889472259832183470436911914,
  6453. "size": 23,
  6454. "commit_id": "fb18802a338b36f675a388fc03d2aa504a0d0899",
  6455. "message": "media: v4l: ioctl: Fix memory leak in video_usercopy\n\nWhen an IOCTL with argument size larger than 128 that also used array\narguments were handled, two memory allocations were made but alas, only\nthe latter one of them was released. This happened because there was only\na single local variable to hold such a temporary allocation.\n\nFix this by adding separate variables to hold the pointers to the\ntemporary allocations.\n\nReported-by: Arnd Bergmann <arnd@kernel.org>\nReported-by: syzbot+1115e79c8df6472c612b@syzkaller.appspotmail.com\nFixes: d14e6d76ebf7 (\"[media] v4l: Add multi-planar ioctl handling code\")\nCc: stable@vger.kernel.org\nSigned-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>\nAcked-by: Arnd Bergmann <arnd@arndb.de>\nAcked-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nReviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  6456. "target": 0,
  6457. "dataset": "other",
  6458. "idx": 381462
  6459. }
  6460. ]
  6461. },
  6462. {
  6463. "call_depth": 4,
  6464. "longest_call_chain": [
  6465. "do_rt_sigqueueinfo",
  6466. "__copy_siginfo_from_user32",
  6467. "post_copy_siginfo_from_user32",
  6468. "siginfo_layout"
  6469. ],
  6470. "group_size": 16,
  6471. "functions": [
  6472. {
  6473. "func": "int copy_siginfo_from_user32(struct kernel_siginfo *to,\n\t\t\t const struct compat_siginfo __user *ufrom)\n{\n\tstruct compat_siginfo from;\n\n\tif (copy_from_user(&from, ufrom, sizeof(struct compat_siginfo)))\n\t\treturn -EFAULT;\n\n\treturn post_copy_siginfo_from_user32(to, &from);\n}",
  6474. "project": "linux",
  6475. "hash": 134574228271886297296357745617865034674,
  6476. "size": 10,
  6477. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6478. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6479. "target": 0,
  6480. "dataset": "other",
  6481. "idx": 375302
  6482. },
  6483. {
  6484. "func": "static int post_copy_siginfo_from_user(kernel_siginfo_t *info,\n\t\t\t\t const siginfo_t __user *from)\n{\n\tif (unlikely(!known_siginfo_layout(info->si_signo, info->si_code))) {\n\t\tchar __user *expansion = si_expansion(from);\n\t\tchar buf[SI_EXPANSION_SIZE];\n\t\tint i;\n\t\t/*\n\t\t * An unknown si_code might need more than\n\t\t * sizeof(struct kernel_siginfo) bytes. Verify all of the\n\t\t * extra bytes are 0. This guarantees copy_siginfo_to_user\n\t\t * will return this data to userspace exactly.\n\t\t */\n\t\tif (copy_from_user(&buf, expansion, SI_EXPANSION_SIZE))\n\t\t\treturn -EFAULT;\n\t\tfor (i = 0; i < SI_EXPANSION_SIZE; i++) {\n\t\t\tif (buf[i] != 0)\n\t\t\t\treturn -E2BIG;\n\t\t}\n\t}\n\treturn 0;\n}",
  6485. "project": "linux",
  6486. "hash": 55060182503102099690780687840941700041,
  6487. "size": 22,
  6488. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6489. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6490. "target": 0,
  6491. "dataset": "other",
  6492. "idx": 375326
  6493. },
  6494. {
  6495. "func": "static int __copy_siginfo_from_user(int signo, kernel_siginfo_t *to,\n\t\t\t\t const siginfo_t __user *from)\n{\n\tif (copy_from_user(to, from, sizeof(struct kernel_siginfo)))\n\t\treturn -EFAULT;\n\tto->si_signo = signo;\n\treturn post_copy_siginfo_from_user(to, from);\n}",
  6496. "project": "linux",
  6497. "hash": 102542278264639564529155079165514057120,
  6498. "size": 8,
  6499. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6500. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6501. "target": 0,
  6502. "dataset": "other",
  6503. "idx": 375267
  6504. },
  6505. {
  6506. "func": "static int do_rt_sigqueueinfo(pid_t pid, int sig, kernel_siginfo_t *info)\n{\n\t/* Not even root can pretend to send signals from the kernel.\n\t * Nor can they impersonate a kill()/tgkill(), which adds source info.\n\t */\n\tif ((info->si_code >= 0 || info->si_code == SI_TKILL) &&\n\t (task_pid_vnr(current) != pid))\n\t\treturn -EPERM;\n\n\t/* POSIX.1b doesn't mention process groups. */\n\treturn kill_proc_info(sig, info, pid);\n}",
  6507. "project": "linux",
  6508. "hash": 48458042341210538429166068446592037897,
  6509. "size": 12,
  6510. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6511. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6512. "target": 0,
  6513. "dataset": "other",
  6514. "idx": 375176
  6515. },
  6516. {
  6517. "func": "SYSCALL_DEFINE3(rt_sigqueueinfo, pid_t, pid, int, sig,\n\t\tsiginfo_t __user *, uinfo)\n{\n\tkernel_siginfo_t info;\n\tint ret = __copy_siginfo_from_user(sig, &info, uinfo);\n\tif (unlikely(ret))\n\t\treturn ret;\n\treturn do_rt_sigqueueinfo(pid, sig, &info);\n}",
  6518. "project": "linux",
  6519. "hash": 322302222265666934385751767273215607712,
  6520. "size": 9,
  6521. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6522. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6523. "target": 0,
  6524. "dataset": "other",
  6525. "idx": 375240
  6526. },
  6527. {
  6528. "func": "COMPAT_SYSCALL_DEFINE3(rt_sigqueueinfo,\n\t\t\tcompat_pid_t, pid,\n\t\t\tint, sig,\n\t\t\tstruct compat_siginfo __user *, uinfo)\n{\n\tkernel_siginfo_t info;\n\tint ret = __copy_siginfo_from_user32(sig, &info, uinfo);\n\tif (unlikely(ret))\n\t\treturn ret;\n\treturn do_rt_sigqueueinfo(pid, sig, &info);\n}",
  6529. "project": "linux",
  6530. "hash": 65988940899178370911489318588231214916,
  6531. "size": 11,
  6532. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6533. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6534. "target": 0,
  6535. "dataset": "other",
  6536. "idx": 375253
  6537. },
  6538. {
  6539. "func": "static inline bool has_si_pid_and_uid(struct kernel_siginfo *info)\n{\n\tbool ret = false;\n\tswitch (siginfo_layout(info->si_signo, info->si_code)) {\n\tcase SIL_KILL:\n\tcase SIL_CHLD:\n\tcase SIL_RT:\n\t\tret = true;\n\t\tbreak;\n\tcase SIL_TIMER:\n\tcase SIL_POLL:\n\tcase SIL_FAULT:\n\tcase SIL_FAULT_MCEERR:\n\tcase SIL_FAULT_BNDERR:\n\tcase SIL_FAULT_PKUERR:\n\tcase SIL_SYS:\n\t\tret = false;\n\t\tbreak;\n\t}\n\treturn ret;\n}",
  6540. "project": "linux",
  6541. "hash": 121501169807631765073914300583175770846,
  6542. "size": 21,
  6543. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6544. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6545. "target": 0,
  6546. "dataset": "other",
  6547. "idx": 375303
  6548. },
  6549. {
  6550. "func": "static bool known_siginfo_layout(unsigned sig, int si_code)\n{\n\tif (si_code == SI_KERNEL)\n\t\treturn true;\n\telse if ((si_code > SI_USER)) {\n\t\tif (sig_specific_sicodes(sig)) {\n\t\t\tif (si_code <= sig_sicodes[sig].limit)\n\t\t\t\treturn true;\n\t\t}\n\t\telse if (si_code <= NSIGPOLL)\n\t\t\treturn true;\n\t}\n\telse if (si_code >= SI_DETHREAD)\n\t\treturn true;\n\telse if (si_code == SI_ASYNCNL)\n\t\treturn true;\n\treturn false;\n}",
  6551. "project": "linux",
  6552. "hash": 36307247290948407761413240940045488122,
  6553. "size": 18,
  6554. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6555. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6556. "target": 0,
  6557. "dataset": "other",
  6558. "idx": 375221
  6559. },
  6560. {
  6561. "func": "static int __copy_siginfo_from_user32(int signo, struct kernel_siginfo *to,\n\t\t\t\t const struct compat_siginfo __user *ufrom)\n{\n\tstruct compat_siginfo from;\n\n\tif (copy_from_user(&from, ufrom, sizeof(struct compat_siginfo)))\n\t\treturn -EFAULT;\n\n\tfrom.si_signo = signo;\n\treturn post_copy_siginfo_from_user32(to, &from);\n}",
  6562. "project": "linux",
  6563. "hash": 124247512926836462060108247314911283729,
  6564. "size": 11,
  6565. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6566. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6567. "target": 0,
  6568. "dataset": "other",
  6569. "idx": 375181
  6570. },
  6571. {
  6572. "func": "int copy_siginfo_from_user(kernel_siginfo_t *to, const siginfo_t __user *from)\n{\n\tif (copy_from_user(to, from, sizeof(struct kernel_siginfo)))\n\t\treturn -EFAULT;\n\treturn post_copy_siginfo_from_user(to, from);\n}",
  6573. "project": "linux",
  6574. "hash": 124625986354863302893265354423885863625,
  6575. "size": 6,
  6576. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6577. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6578. "target": 0,
  6579. "dataset": "other",
  6580. "idx": 375134
  6581. },
  6582. {
  6583. "func": "static int do_rt_tgsigqueueinfo(pid_t tgid, pid_t pid, int sig, kernel_siginfo_t *info)\n{\n\t/* This is only valid for single tasks */\n\tif (pid <= 0 || tgid <= 0)\n\t\treturn -EINVAL;\n\n\t/* Not even root can pretend to send signals from the kernel.\n\t * Nor can they impersonate a kill()/tgkill(), which adds source info.\n\t */\n\tif ((info->si_code >= 0 || info->si_code == SI_TKILL) &&\n\t (task_pid_vnr(current) != pid))\n\t\treturn -EPERM;\n\n\treturn do_send_specific(tgid, pid, sig, info);\n}",
  6584. "project": "linux",
  6585. "hash": 277171545470617207900572637566811702249,
  6586. "size": 15,
  6587. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6588. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6589. "target": 0,
  6590. "dataset": "other",
  6591. "idx": 375241
  6592. },
  6593. {
  6594. "func": "COMPAT_SYSCALL_DEFINE4(rt_tgsigqueueinfo,\n\t\t\tcompat_pid_t, tgid,\n\t\t\tcompat_pid_t, pid,\n\t\t\tint, sig,\n\t\t\tstruct compat_siginfo __user *, uinfo)\n{\n\tkernel_siginfo_t info;\n\tint ret = __copy_siginfo_from_user32(sig, &info, uinfo);\n\tif (unlikely(ret))\n\t\treturn ret;\n\treturn do_rt_tgsigqueueinfo(tgid, pid, sig, &info);\n}",
  6595. "project": "linux",
  6596. "hash": 129110984812650198519765204128016640632,
  6597. "size": 12,
  6598. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6599. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6600. "target": 0,
  6601. "dataset": "other",
  6602. "idx": 375277
  6603. },
  6604. {
  6605. "func": "SYSCALL_DEFINE4(rt_tgsigqueueinfo, pid_t, tgid, pid_t, pid, int, sig,\n\t\tsiginfo_t __user *, uinfo)\n{\n\tkernel_siginfo_t info;\n\tint ret = __copy_siginfo_from_user(sig, &info, uinfo);\n\tif (unlikely(ret))\n\t\treturn ret;\n\treturn do_rt_tgsigqueueinfo(tgid, pid, sig, &info);\n}",
  6606. "project": "linux",
  6607. "hash": 325930772512610538513707827592825328742,
  6608. "size": 9,
  6609. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6610. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6611. "target": 0,
  6612. "dataset": "other",
  6613. "idx": 375280
  6614. },
  6615. {
  6616. "func": "static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, siginfo_t *info)\n{\n#ifdef CONFIG_COMPAT\n\t/*\n\t * Avoid hooking up compat syscalls and instead handle necessary\n\t * conversions here. Note, this is a stop-gap measure and should not be\n\t * considered a generic solution.\n\t */\n\tif (in_compat_syscall())\n\t\treturn copy_siginfo_from_user32(\n\t\t\tkinfo, (struct compat_siginfo __user *)info);\n#endif\n\treturn copy_siginfo_from_user(kinfo, info);\n}",
  6617. "project": "linux",
  6618. "hash": 151402371257721093837308914835718232254,
  6619. "size": 14,
  6620. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6621. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6622. "target": 0,
  6623. "dataset": "other",
  6624. "idx": 375167
  6625. },
  6626. {
  6627. "func": "static int post_copy_siginfo_from_user32(kernel_siginfo_t *to,\n\t\t\t\t\t const struct compat_siginfo *from)\n{\n\tclear_siginfo(to);\n\tto->si_signo = from->si_signo;\n\tto->si_errno = from->si_errno;\n\tto->si_code = from->si_code;\n\tswitch(siginfo_layout(from->si_signo, from->si_code)) {\n\tcase SIL_KILL:\n\t\tto->si_pid = from->si_pid;\n\t\tto->si_uid = from->si_uid;\n\t\tbreak;\n\tcase SIL_TIMER:\n\t\tto->si_tid = from->si_tid;\n\t\tto->si_overrun = from->si_overrun;\n\t\tto->si_int = from->si_int;\n\t\tbreak;\n\tcase SIL_POLL:\n\t\tto->si_band = from->si_band;\n\t\tto->si_fd = from->si_fd;\n\t\tbreak;\n\tcase SIL_FAULT:\n\t\tto->si_addr = compat_ptr(from->si_addr);\n#ifdef __ARCH_SI_TRAPNO\n\t\tto->si_trapno = from->si_trapno;\n#endif\n\t\tbreak;\n\tcase SIL_FAULT_MCEERR:\n\t\tto->si_addr = compat_ptr(from->si_addr);\n#ifdef __ARCH_SI_TRAPNO\n\t\tto->si_trapno = from->si_trapno;\n#endif\n\t\tto->si_addr_lsb = from->si_addr_lsb;\n\t\tbreak;\n\tcase SIL_FAULT_BNDERR:\n\t\tto->si_addr = compat_ptr(from->si_addr);\n#ifdef __ARCH_SI_TRAPNO\n\t\tto->si_trapno = from->si_trapno;\n#endif\n\t\tto->si_lower = compat_ptr(from->si_lower);\n\t\tto->si_upper = compat_ptr(from->si_upper);\n\t\tbreak;\n\tcase SIL_FAULT_PKUERR:\n\t\tto->si_addr = compat_ptr(from->si_addr);\n#ifdef __ARCH_SI_TRAPNO\n\t\tto->si_trapno = from->si_trapno;\n#endif\n\t\tto->si_pkey = from->si_pkey;\n\t\tbreak;\n\tcase SIL_CHLD:\n\t\tto->si_pid = from->si_pid;\n\t\tto->si_uid = from->si_uid;\n\t\tto->si_status = from->si_status;\n#ifdef CONFIG_X86_X32_ABI\n\t\tif (in_x32_syscall()) {\n\t\t\tto->si_utime = from->_sifields._sigchld_x32._utime;\n\t\t\tto->si_stime = from->_sifields._sigchld_x32._stime;\n\t\t} else\n#endif\n\t\t{\n\t\t\tto->si_utime = from->si_utime;\n\t\t\tto->si_stime = from->si_stime;\n\t\t}\n\t\tbreak;\n\tcase SIL_RT:\n\t\tto->si_pid = from->si_pid;\n\t\tto->si_uid = from->si_uid;\n\t\tto->si_int = from->si_int;\n\t\tbreak;\n\tcase SIL_SYS:\n\t\tto->si_call_addr = compat_ptr(from->si_call_addr);\n\t\tto->si_syscall = from->si_syscall;\n\t\tto->si_arch = from->si_arch;\n\t\tbreak;\n\t}\n\treturn 0;\n}",
  6628. "project": "linux",
  6629. "hash": 254289020798927830663748991786288110989,
  6630. "size": 77,
  6631. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6632. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6633. "target": 0,
  6634. "dataset": "other",
  6635. "idx": 375166
  6636. },
  6637. {
  6638. "func": "enum siginfo_layout siginfo_layout(unsigned sig, int si_code)\n{\n\tenum siginfo_layout layout = SIL_KILL;\n\tif ((si_code > SI_USER) && (si_code < SI_KERNEL)) {\n\t\tif ((sig < ARRAY_SIZE(sig_sicodes)) &&\n\t\t (si_code <= sig_sicodes[sig].limit)) {\n\t\t\tlayout = sig_sicodes[sig].layout;\n\t\t\t/* Handle the exceptions */\n\t\t\tif ((sig == SIGBUS) &&\n\t\t\t (si_code >= BUS_MCEERR_AR) && (si_code <= BUS_MCEERR_AO))\n\t\t\t\tlayout = SIL_FAULT_MCEERR;\n\t\t\telse if ((sig == SIGSEGV) && (si_code == SEGV_BNDERR))\n\t\t\t\tlayout = SIL_FAULT_BNDERR;\n#ifdef SEGV_PKUERR\n\t\t\telse if ((sig == SIGSEGV) && (si_code == SEGV_PKUERR))\n\t\t\t\tlayout = SIL_FAULT_PKUERR;\n#endif\n\t\t}\n\t\telse if (si_code <= NSIGPOLL)\n\t\t\tlayout = SIL_POLL;\n\t} else {\n\t\tif (si_code == SI_TIMER)\n\t\t\tlayout = SIL_TIMER;\n\t\telse if (si_code == SI_SIGIO)\n\t\t\tlayout = SIL_POLL;\n\t\telse if (si_code < 0)\n\t\t\tlayout = SIL_RT;\n\t}\n\treturn layout;\n}",
  6639. "project": "linux",
  6640. "hash": 45926953882594310783656867328119504000,
  6641. "size": 30,
  6642. "commit_id": "d1e7fd6462ca9fc76650fbe6ca800e35b24267da",
  6643. "message": "signal: Extend exec_id to 64bits\n\nReplace the 32bit exec_id with a 64bit exec_id to make it impossible\nto wrap the exec_id counter. With care an attacker can cause exec_id\nwrap and send arbitrary signals to a newly exec'd parent. This\nbypasses the signal sending checks if the parent changes their\ncredentials during exec.\n\nThe severity of this problem can been seen that in my limited testing\nof a 32bit exec_id it can take as little as 19s to exec 65536 times.\nWhich means that it can take as little as 14 days to wrap a 32bit\nexec_id. Adam Zabrocki has succeeded wrapping the self_exe_id in 7\ndays. Even my slower timing is in the uptime of a typical server.\nWhich means self_exec_id is simply a speed bump today, and if exec\ngets noticably faster self_exec_id won't even be a speed bump.\n\nExtending self_exec_id to 64bits introduces a problem on 32bit\narchitectures where reading self_exec_id is no longer atomic and can\ntake two read instructions. Which means that is is possible to hit\na window where the read value of exec_id does not match the written\nvalue. So with very lucky timing after this change this still\nremains expoiltable.\n\nI have updated the update of exec_id on exec to use WRITE_ONCE\nand the read of exec_id in do_notify_parent to use READ_ONCE\nto make it clear that there is no locking between these two\nlocations.\n\nLink: https://lore.kernel.org/kernel-hardening/20200324215049.GA3710@pi3.com.pl\nFixes: 2.3.23pre2\nCc: stable@vger.kernel.org\nSigned-off-by: \"Eric W. Biederman\" <ebiederm@xmission.com>",
  6644. "target": 0,
  6645. "dataset": "other",
  6646. "idx": 375222
  6647. }
  6648. ]
  6649. },
  6650. {
  6651. "call_depth": 4,
  6652. "longest_call_chain": [
  6653. "udev_util_replace_chars",
  6654. "utf8_encoded_valid_unichar",
  6655. "utf8_encoded_to_unichar",
  6656. "utf8_encoded_expected_len"
  6657. ],
  6658. "group_size": 8,
  6659. "functions": [
  6660. {
  6661. "func": "int udev_util_replace_chars(char *str, const char *white)\n{\n\tsize_t i = 0;\n\tint replaced = 0;\n\n\twhile (str[i] != '\\0') {\n\t\tint len;\n\n\t\tif (is_whitelisted(str[i], white)) {\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* accept hex encoding */\n\t\tif (str[i] == '\\\\' && str[i+1] == 'x') {\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* accept valid utf8 */\n\t\tlen = utf8_encoded_valid_unichar(&str[i]);\n\t\tif (len > 1) {\n\t\t\ti += len;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* if space is allowed, replace whitespace with ordinary space */\n\t\tif (isspace(str[i]) && white != NULL && strchr(white, ' ') != NULL) {\n\t\t\tstr[i] = ' ';\n\t\t\ti++;\n\t\t\treplaced++;\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* everything else is replaced with '_' */\n\t\tstr[i] = '_';\n\t\ti++;\n\t\treplaced++;\n\t}\n\treturn replaced;\n}",
  6662. "target": 0,
  6663. "cwe": [
  6664. "CWE-120"
  6665. ],
  6666. "project": "udev",
  6667. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6668. "hash": 5405405786316417121901887607525383556,
  6669. "size": 41,
  6670. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6671. "dataset": "other",
  6672. "idx": 490332
  6673. },
  6674. {
  6675. "func": "static int utf8_encoded_to_unichar(const char *str)\n{\n\tint unichar;\n\tint len;\n\tint i;\n\n\tlen = utf8_encoded_expected_len(str);\n\tswitch (len) {\n\tcase 1:\n\t\treturn (int)str[0];\n\tcase 2:\n\t\tunichar = str[0] & 0x1f;\n\t\tbreak;\n\tcase 3:\n\t\tunichar = (int)str[0] & 0x0f;\n\t\tbreak;\n\tcase 4:\n\t\tunichar = (int)str[0] & 0x07;\n\t\tbreak;\n\tcase 5:\n\t\tunichar = (int)str[0] & 0x03;\n\t\tbreak;\n\tcase 6:\n\t\tunichar = (int)str[0] & 0x01;\n\t\tbreak;\n\tdefault:\n\t\treturn -1;\n\t}\n\n\tfor (i = 1; i < len; i++) {\n\t\tif (((int)str[i] & 0xc0) != 0x80)\n\t\t\treturn -1;\n\t\tunichar <<= 6;\n\t\tunichar |= (int)str[i] & 0x3f;\n\t}\n\n\treturn unichar;\n}",
  6676. "target": 0,
  6677. "cwe": [
  6678. "CWE-120"
  6679. ],
  6680. "project": "udev",
  6681. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6682. "hash": 206051964674283888462618593096782618800,
  6683. "size": 38,
  6684. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6685. "dataset": "other",
  6686. "idx": 490338
  6687. },
  6688. {
  6689. "func": "static int utf8_encoded_valid_unichar(const char *str)\n{\n\tint len;\n\tint unichar;\n\tint i;\n\n\tlen = utf8_encoded_expected_len(str);\n\tif (len == 0)\n\t\treturn -1;\n\n\t/* ascii is valid */\n\tif (len == 1)\n\t\treturn 1;\n\n\t/* check if expected encoded chars are available */\n\tfor (i = 0; i < len; i++)\n\t\tif ((str[i] & 0x80) != 0x80)\n\t\t\treturn -1;\n\n\tunichar = utf8_encoded_to_unichar(str);\n\n\t/* check if encoded length matches encoded value */\n\tif (utf8_unichar_to_encoded_len(unichar) != len)\n\t\treturn -1;\n\n\t/* check if value has valid range */\n\tif (!utf8_unichar_valid_range(unichar))\n\t\treturn -1;\n\n\treturn len;\n}",
  6690. "target": 0,
  6691. "cwe": [
  6692. "CWE-120"
  6693. ],
  6694. "project": "udev",
  6695. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6696. "hash": 206053476377274378364373590995660911050,
  6697. "size": 31,
  6698. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6699. "dataset": "other",
  6700. "idx": 490329
  6701. },
  6702. {
  6703. "func": "static int is_whitelisted(char c, const char *white)\n{\n\tif ((c >= '0' && c <= '9') ||\n\t (c >= 'A' && c <= 'Z') ||\n\t (c >= 'a' && c <= 'z') ||\n\t strchr(\"#+-.:=@_\", c) != NULL ||\n\t (white != NULL && strchr(white, c) != NULL))\n\t\treturn 1;\n\treturn 0;\n}",
  6704. "target": 0,
  6705. "cwe": [
  6706. "CWE-120"
  6707. ],
  6708. "project": "udev",
  6709. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6710. "hash": 301965509586629387251827066972038220926,
  6711. "size": 10,
  6712. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6713. "dataset": "other",
  6714. "idx": 490346
  6715. },
  6716. {
  6717. "func": "int udev_util_encode_string(const char *str, char *str_enc, size_t len)\n{\n\tsize_t i, j;\n\n\tif (str == NULL || str_enc == NULL || len == 0)\n\t\treturn -1;\n\n\tstr_enc[0] = '\\0';\n\tfor (i = 0, j = 0; str[i] != '\\0'; i++) {\n\t\tint seqlen;\n\n\t\tseqlen = utf8_encoded_valid_unichar(&str[i]);\n\t\tif (seqlen > 1) {\n\t\t\tmemcpy(&str_enc[j], &str[i], seqlen);\n\t\t\tj += seqlen;\n\t\t\ti += (seqlen-1);\n\t\t} else if (str[i] == '\\\\' || !is_whitelisted(str[i], NULL)) {\n\t\t\tsprintf(&str_enc[j], \"\\\\x%02x\", (unsigned char) str[i]);\n\t\t\tj += 4;\n\t\t} else {\n\t\t\tstr_enc[j] = str[i];\n\t\t\tj++;\n\t\t}\n\t\tif (j+3 >= len)\n\t\t\tgoto err;\n\t}\n\tstr_enc[j] = '\\0';\n\treturn 0;\nerr:\n\treturn -1;\n}",
  6718. "target": 0,
  6719. "cwe": [
  6720. "CWE-120"
  6721. ],
  6722. "project": "udev",
  6723. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6724. "hash": 128389350005845428979590129521706681485,
  6725. "size": 31,
  6726. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6727. "dataset": "other",
  6728. "idx": 490331
  6729. },
  6730. {
  6731. "func": "static int utf8_encoded_expected_len(const char *str)\n{\n\tunsigned char c = (unsigned char)str[0];\n\n\tif (c < 0x80)\n\t\treturn 1;\n\tif ((c & 0xe0) == 0xc0)\n\t\treturn 2;\n\tif ((c & 0xf0) == 0xe0)\n\t\treturn 3;\n\tif ((c & 0xf8) == 0xf0)\n\t\treturn 4;\n\tif ((c & 0xfc) == 0xf8)\n\t\treturn 5;\n\tif ((c & 0xfe) == 0xfc)\n\t\treturn 6;\n\treturn 0;\n}",
  6732. "target": 0,
  6733. "cwe": [
  6734. "CWE-120"
  6735. ],
  6736. "project": "udev",
  6737. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6738. "hash": 256127015334813263581801085103652188798,
  6739. "size": 18,
  6740. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6741. "dataset": "other",
  6742. "idx": 490327
  6743. },
  6744. {
  6745. "func": "static int utf8_unichar_valid_range(int unichar)\n{\n\tif (unichar > 0x10ffff)\n\t\treturn 0;\n\tif ((unichar & 0xfffff800) == 0xd800)\n\t\treturn 0;\n\tif ((unichar > 0xfdcf) && (unichar < 0xfdf0))\n\t\treturn 0;\n\tif ((unichar & 0xffff) == 0xffff)\n\t\treturn 0;\n\treturn 1;\n}",
  6746. "target": 0,
  6747. "cwe": [
  6748. "CWE-120"
  6749. ],
  6750. "project": "udev",
  6751. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6752. "hash": 195740263550096629321937696988533578169,
  6753. "size": 12,
  6754. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6755. "dataset": "other",
  6756. "idx": 490344
  6757. },
  6758. {
  6759. "func": "static int utf8_unichar_to_encoded_len(int unichar)\n{\n\tif (unichar < 0x80)\n\t\treturn 1;\n\tif (unichar < 0x800)\n\t\treturn 2;\n\tif (unichar < 0x10000)\n\t\treturn 3;\n\tif (unichar < 0x200000)\n\t\treturn 4;\n\tif (unichar < 0x4000000)\n\t\treturn 5;\n\treturn 6;\n}",
  6760. "target": 0,
  6761. "cwe": [
  6762. "CWE-120"
  6763. ],
  6764. "project": "udev",
  6765. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  6766. "hash": 176663044449808812580689980385047039729,
  6767. "size": 14,
  6768. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  6769. "dataset": "other",
  6770. "idx": 490341
  6771. }
  6772. ]
  6773. },
  6774. {
  6775. "call_depth": 3,
  6776. "longest_call_chain": [
  6777. "unzzip_print",
  6778. "unzzip_cat",
  6779. "unzzip_cat_file"
  6780. ],
  6781. "group_size": 5,
  6782. "functions": [
  6783. {
  6784. "func": "int unzzip_extract (int argc, char ** argv)\n{\n return unzzip_cat(argc, argv, 1);\n}",
  6785. "project": "zziplib",
  6786. "hash": 22916655569920147582655971729848876003,
  6787. "size": 4,
  6788. "commit_id": "ac9ae39ef419e9f0f83da1e583314d8c7cda34a6",
  6789. "message": "#68 ssize_t return value of zzip_file_read is a signed value being possibly -1",
  6790. "target": 0,
  6791. "dataset": "other",
  6792. "idx": 282824
  6793. },
  6794. {
  6795. "func": "int unzzip_print (int argc, char ** argv)\n{\n return unzzip_cat(argc, argv, 0);\n}",
  6796. "project": "zziplib",
  6797. "hash": 145330942703612534238755868724745065473,
  6798. "size": 4,
  6799. "commit_id": "ac9ae39ef419e9f0f83da1e583314d8c7cda34a6",
  6800. "message": "#68 ssize_t return value of zzip_file_read is a signed value being possibly -1",
  6801. "target": 0,
  6802. "dataset": "other",
  6803. "idx": 282821
  6804. },
  6805. {
  6806. "func": "static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out)\n{\n ZZIP_FILE* file = zzip_file_open (disk, name, 0);\n if (file) \n {\n\tchar buffer[1024]; int len;\n\twhile ((len = zzip_file_read (file, buffer, 1024))) \n\t{\n\t fwrite (buffer, 1, len, out);\n\t}\n\t\n\tzzip_file_close (file);\n }\n}",
  6807. "project": "zziplib",
  6808. "hash": 213540364375667917653366276803369040606,
  6809. "size": 14,
  6810. "commit_id": "ac9ae39ef419e9f0f83da1e583314d8c7cda34a6",
  6811. "message": "#68 ssize_t return value of zzip_file_read is a signed value being possibly -1",
  6812. "target": 1,
  6813. "dataset": "other",
  6814. "idx": 198733
  6815. },
  6816. {
  6817. "func": "static void unzzip_cat_file(ZZIP_DIR* disk, char* name, FILE* out)\n{\n ZZIP_FILE* file = zzip_file_open (disk, name, 0);\n if (file) \n {\n\tchar buffer[1024]; int len;\n\twhile (0 < (len = zzip_file_read (file, buffer, 1024))) \n\t{\n\t fwrite (buffer, 1, len, out);\n\t}\n\t\n\tzzip_file_close (file);\n }\n}",
  6818. "project": "zziplib",
  6819. "hash": 253924670115102704045568268367383544838,
  6820. "size": 14,
  6821. "commit_id": "ac9ae39ef419e9f0f83da1e583314d8c7cda34a6",
  6822. "message": "#68 ssize_t return value of zzip_file_read is a signed value being possibly -1",
  6823. "target": 0,
  6824. "dataset": "other",
  6825. "idx": 282823
  6826. },
  6827. {
  6828. "func": "static int unzzip_cat (int argc, char ** argv, int extract)\n{\n int done = 0;\n int argn;\n ZZIP_DIR* disk;\n zzip_error_t error;\n \n if (argc == 1)\n {\n printf (__FILE__ \" version \" ZZIP_PACKAGE_NAME \" \" ZZIP_PACKAGE_VERSION \"\\n\");\n return EXIT_OK; /* better provide an archive argument */\n }\n \n disk = zzip_dir_open (argv[1], &error);\n if (! disk) {\n\tfprintf(stderr, \"%s: %s\\n\", argv[1], zzip_strerror(error));\n\treturn exitcode(error);\n }\n\n if (argc == 2)\n { /* list all */\n\tZZIP_DIRENT entry;\n\twhile(zzip_dir_read(disk, &entry))\n\t{\n\t char* name = entry.d_name;\n\t FILE* out = stdout;\n\t if (extract) out = create_fopen(name, \"wb\", 1);\n\t if (! out) {\n\t\tDBG3(\"fopen' %s : %s\", name, strerror(errno));\n\t if (errno != EISDIR) done = EXIT_ERRORS;\n\t continue;\n\t }\n\t unzzip_cat_file (disk, name, out);\n\t if (extract) fclose(out);\n\t}\n }\n else\n { /* list only the matching entries - in order of zip directory */\n\tZZIP_DIRENT entry;\n\twhile(zzip_dir_read(disk, &entry))\n\t{\n\t char* name = entry.d_name;\n\t for (argn=1; argn < argc; argn++)\n\t {\n\t\tif (! _zzip_fnmatch (argv[argn], name, \n\t\t _zzip_FNM_NOESCAPE|_zzip_FNM_PATHNAME|_zzip_FNM_PERIOD))\n\t {\n\t FILE* out = stdout;\n\t if (extract) out = create_fopen(name, \"wb\", 1);\n\t\t if (! out) {\n\t\t\tDBG3(\"fopen. %s : %s\", name, strerror(errno));\n\t\t if (errno != EISDIR) done = EXIT_ERRORS;\n\t\t continue;\n\t\t }\n\t unzzip_cat_file (disk, name, out);\n\t if (extract) fclose(out);\n\t\t break; /* match loop */\n\t }\n\t }\n\t}\n }\n zzip_dir_close(disk);\n return done;\n} ",
  6829. "project": "zziplib",
  6830. "hash": 176436902326764428383332283239598055138,
  6831. "size": 64,
  6832. "commit_id": "ac9ae39ef419e9f0f83da1e583314d8c7cda34a6",
  6833. "message": "#68 ssize_t return value of zzip_file_read is a signed value being possibly -1",
  6834. "target": 0,
  6835. "dataset": "other",
  6836. "idx": 282822
  6837. }
  6838. ]
  6839. },
  6840. {
  6841. "call_depth": 3,
  6842. "longest_call_chain": [
  6843. "decode_frame",
  6844. "decode_header",
  6845. "check_header_variable"
  6846. ],
  6847. "group_size": 5,
  6848. "functions": [
  6849. {
  6850. "func": "static int decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n EXRContext *s = avctx->priv_data;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n uint8_t *ptr;\n\n int i, y, ret, ymax;\n int planes;\n int out_line_size;\n int nb_blocks; /* nb scanline or nb tile */\n uint64_t start_offset_table;\n uint64_t start_next_scanline;\n PutByteContext offset_table_writer;\n\n bytestream2_init(&s->gb, avpkt->data, avpkt->size);\n\n if ((ret = decode_header(s, picture)) < 0)\n return ret;\n\n switch (s->pixel_type) {\n case EXR_FLOAT:\n case EXR_HALF:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n } else {\n /* todo: change this when a floating point pixel format with luma with alpha is implemented */\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRPF32;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAYF32;\n }\n }\n break;\n case EXR_UINT:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGBA64;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_YA16;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGB48;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAY16;\n }\n }\n break;\n default:\n av_log(avctx, AV_LOG_ERROR, \"Missing channel list.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)\n avctx->color_trc = s->apply_trc_type;\n\n switch (s->compression) {\n case EXR_RAW:\n case EXR_RLE:\n case EXR_ZIP1:\n s->scan_lines_per_block = 1;\n break;\n case EXR_PXR24:\n case EXR_ZIP16:\n s->scan_lines_per_block = 16;\n break;\n case EXR_PIZ:\n case EXR_B44:\n case EXR_B44A:\n s->scan_lines_per_block = 32;\n break;\n default:\n avpriv_report_missing_feature(avctx, \"Compression %d\", s->compression);\n return AVERROR_PATCHWELCOME;\n }\n\n /* Verify the xmin, xmax, ymin and ymax before setting the actual image size.\n * It's possible for the data window can larger or outside the display window */\n if (s->xmin > s->xmax || s->ymin > s->ymax ||\n s->ydelta == 0xFFFFFFFF || s->xdelta == 0xFFFFFFFF) {\n av_log(avctx, AV_LOG_ERROR, \"Wrong or missing size information.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)\n return ret;\n\n s->desc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if (!s->desc)\n return AVERROR_INVALIDDATA;\n\n if (s->desc->flags & AV_PIX_FMT_FLAG_FLOAT) {\n planes = s->desc->nb_components;\n out_line_size = avctx->width * 4;\n } else {\n planes = 1;\n out_line_size = avctx->width * 2 * s->desc->nb_components;\n }\n\n if (s->is_tile) {\n nb_blocks = ((s->xdelta + s->tile_attr.xSize - 1) / s->tile_attr.xSize) *\n ((s->ydelta + s->tile_attr.ySize - 1) / s->tile_attr.ySize);\n } else { /* scanline */\n nb_blocks = (s->ydelta + s->scan_lines_per_block - 1) /\n s->scan_lines_per_block;\n }\n\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n return ret;\n\n if (bytestream2_get_bytes_left(&s->gb)/8 < nb_blocks)\n return AVERROR_INVALIDDATA;\n\n // check offset table and recreate it if need\n if (!s->is_tile && bytestream2_peek_le64(&s->gb) == 0) {\n av_log(s->avctx, AV_LOG_DEBUG, \"recreating invalid scanline offset table\\n\");\n\n start_offset_table = bytestream2_tell(&s->gb);\n start_next_scanline = start_offset_table + nb_blocks * 8;\n bytestream2_init_writer(&offset_table_writer, &avpkt->data[start_offset_table], nb_blocks * 8);\n\n for (y = 0; y < nb_blocks; y++) {\n /* write offset of prev scanline in offset table */\n bytestream2_put_le64(&offset_table_writer, start_next_scanline);\n\n /* get len of next scanline */\n bytestream2_seek(&s->gb, start_next_scanline + 4, SEEK_SET);/* skip line number */\n start_next_scanline += (bytestream2_get_le32(&s->gb) + 8);\n }\n bytestream2_seek(&s->gb, start_offset_table, SEEK_SET);\n }\n\n // save pointer we are going to use in decode_block\n s->buf = avpkt->data;\n s->buf_size = avpkt->size;\n\n // Zero out the start if ymin is not 0\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i];\n for (y = 0; y < s->ymin; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n s->picture = picture;\n\n avctx->execute2(avctx, decode_block, s->thread_data, NULL, nb_blocks);\n\n ymax = FFMAX(0, s->ymax + 1);\n // Zero out the end if ymax+1 is not h\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i] + (ymax * picture->linesize[i]);\n for (y = ymax; y < avctx->height; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n picture->pict_type = AV_PICTURE_TYPE_I;\n *got_frame = 1;\n\n return avpkt->size;\n}",
  6851. "project": "FFmpeg",
  6852. "hash": 206532618456884129741435132538316190900,
  6853. "size": 170,
  6854. "commit_id": "3e5959b3457f7f1856d997261e6ac672bba49e8b",
  6855. "message": "avcodec/exr: Check ymin vs. h\n\nFixes: out of array access\nFixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344\nFixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136\n\nFound-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg\nSigned-off-by: Michael Niedermayer <michael@niedermayer.cc>",
  6856. "target": 1,
  6857. "dataset": "other",
  6858. "idx": 197567
  6859. },
  6860. {
  6861. "func": "static int decode_frame(AVCodecContext *avctx, void *data,\n int *got_frame, AVPacket *avpkt)\n{\n EXRContext *s = avctx->priv_data;\n GetByteContext *gb = &s->gb;\n ThreadFrame frame = { .f = data };\n AVFrame *picture = data;\n uint8_t *ptr;\n\n int i, y, ret, ymax;\n int planes;\n int out_line_size;\n int nb_blocks; /* nb scanline or nb tile */\n uint64_t start_offset_table;\n uint64_t start_next_scanline;\n PutByteContext offset_table_writer;\n\n bytestream2_init(gb, avpkt->data, avpkt->size);\n\n if ((ret = decode_header(s, picture)) < 0)\n return ret;\n\n if ((s->compression == EXR_DWAA || s->compression == EXR_DWAB) &&\n s->pixel_type == EXR_HALF) {\n s->current_channel_offset *= 2;\n for (int i = 0; i < 4; i++)\n s->channel_offsets[i] *= 2;\n }\n\n switch (s->pixel_type) {\n case EXR_FLOAT:\n case EXR_HALF:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n } else {\n /* todo: change this when a floating point pixel format with luma with alpha is implemented */\n avctx->pix_fmt = AV_PIX_FMT_GBRAPF32;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_GBRPF32;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAYF32;\n }\n }\n break;\n case EXR_UINT:\n if (s->channel_offsets[3] >= 0) {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGBA64;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_YA16;\n }\n } else {\n if (!s->is_luma) {\n avctx->pix_fmt = AV_PIX_FMT_RGB48;\n } else {\n avctx->pix_fmt = AV_PIX_FMT_GRAY16;\n }\n }\n break;\n default:\n av_log(avctx, AV_LOG_ERROR, \"Missing channel list.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if (s->apply_trc_type != AVCOL_TRC_UNSPECIFIED)\n avctx->color_trc = s->apply_trc_type;\n\n switch (s->compression) {\n case EXR_RAW:\n case EXR_RLE:\n case EXR_ZIP1:\n s->scan_lines_per_block = 1;\n break;\n case EXR_PXR24:\n case EXR_ZIP16:\n s->scan_lines_per_block = 16;\n break;\n case EXR_PIZ:\n case EXR_B44:\n case EXR_B44A:\n case EXR_DWAA:\n s->scan_lines_per_block = 32;\n break;\n case EXR_DWAB:\n s->scan_lines_per_block = 256;\n break;\n default:\n avpriv_report_missing_feature(avctx, \"Compression %d\", s->compression);\n return AVERROR_PATCHWELCOME;\n }\n\n /* Verify the xmin, xmax, ymin and ymax before setting the actual image size.\n * It's possible for the data window can larger or outside the display window */\n if (s->xmin > s->xmax || s->ymin > s->ymax ||\n s->ydelta == 0xFFFFFFFF || s->xdelta == 0xFFFFFFFF) {\n av_log(avctx, AV_LOG_ERROR, \"Wrong or missing size information.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n if ((ret = ff_set_dimensions(avctx, s->w, s->h)) < 0)\n return ret;\n\n ff_set_sar(s->avctx, av_d2q(av_int2float(s->sar), 255));\n\n s->desc = av_pix_fmt_desc_get(avctx->pix_fmt);\n if (!s->desc)\n return AVERROR_INVALIDDATA;\n\n if (s->desc->flags & AV_PIX_FMT_FLAG_FLOAT) {\n planes = s->desc->nb_components;\n out_line_size = avctx->width * 4;\n } else {\n planes = 1;\n out_line_size = avctx->width * 2 * s->desc->nb_components;\n }\n\n if (s->is_tile) {\n nb_blocks = ((s->xdelta + s->tile_attr.xSize - 1) / s->tile_attr.xSize) *\n ((s->ydelta + s->tile_attr.ySize - 1) / s->tile_attr.ySize);\n } else { /* scanline */\n nb_blocks = (s->ydelta + s->scan_lines_per_block - 1) /\n s->scan_lines_per_block;\n }\n\n if ((ret = ff_thread_get_buffer(avctx, &frame, 0)) < 0)\n return ret;\n\n if (bytestream2_get_bytes_left(gb)/8 < nb_blocks)\n return AVERROR_INVALIDDATA;\n\n // check offset table and recreate it if need\n if (!s->is_tile && bytestream2_peek_le64(gb) == 0) {\n av_log(s->avctx, AV_LOG_DEBUG, \"recreating invalid scanline offset table\\n\");\n\n start_offset_table = bytestream2_tell(gb);\n start_next_scanline = start_offset_table + nb_blocks * 8;\n bytestream2_init_writer(&offset_table_writer, &avpkt->data[start_offset_table], nb_blocks * 8);\n\n for (y = 0; y < nb_blocks; y++) {\n /* write offset of prev scanline in offset table */\n bytestream2_put_le64(&offset_table_writer, start_next_scanline);\n\n /* get len of next scanline */\n bytestream2_seek(gb, start_next_scanline + 4, SEEK_SET);/* skip line number */\n start_next_scanline += (bytestream2_get_le32(gb) + 8);\n }\n bytestream2_seek(gb, start_offset_table, SEEK_SET);\n }\n\n // save pointer we are going to use in decode_block\n s->buf = avpkt->data;\n s->buf_size = avpkt->size;\n\n // Zero out the start if ymin is not 0\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i];\n for (y = 0; y < FFMIN(s->ymin, s->h); y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n s->picture = picture;\n\n avctx->execute2(avctx, decode_block, s->thread_data, NULL, nb_blocks);\n\n ymax = FFMAX(0, s->ymax + 1);\n // Zero out the end if ymax+1 is not h\n if (ymax < avctx->height)\n for (i = 0; i < planes; i++) {\n ptr = picture->data[i] + (ymax * picture->linesize[i]);\n for (y = ymax; y < avctx->height; y++) {\n memset(ptr, 0, out_line_size);\n ptr += picture->linesize[i];\n }\n }\n\n picture->pict_type = AV_PICTURE_TYPE_I;\n *got_frame = 1;\n\n return avpkt->size;\n}",
  6862. "project": "FFmpeg",
  6863. "hash": 330286888782902150079930713180808864531,
  6864. "size": 185,
  6865. "commit_id": "26d3c81bc5ef2f8c3f09d45eaeacfb4b1139a777",
  6866. "message": "avcodec/exr: More strictly check dc_count\n\nFixes: out of array access\nFixes: exr/deneme\n\nFound-by: Burak Çarıkçı <burakcarikci@crypttech.com>\nSigned-off-by: Michael Niedermayer <michael@niedermayer.cc>",
  6867. "target": 0,
  6868. "dataset": "other",
  6869. "idx": 262689
  6870. },
  6871. {
  6872. "func": "static void skip_header_chunk(EXRContext *s)\n{\n GetByteContext *gb = &s->gb;\n\n while (bytestream2_get_bytes_left(gb) > 0) {\n if (!bytestream2_peek_byte(gb))\n break;\n\n // Process unknown variables\n for (int i = 0; i < 2; i++) // value_name and value_type\n while (bytestream2_get_byte(gb) != 0);\n\n // Skip variable length\n bytestream2_skip(gb, bytestream2_get_le32(gb));\n }\n}",
  6873. "project": "FFmpeg",
  6874. "hash": 19272837122676011976404639411214305373,
  6875. "size": 16,
  6876. "commit_id": "26d3c81bc5ef2f8c3f09d45eaeacfb4b1139a777",
  6877. "message": "avcodec/exr: More strictly check dc_count\n\nFixes: out of array access\nFixes: exr/deneme\n\nFound-by: Burak Çarıkçı <burakcarikci@crypttech.com>\nSigned-off-by: Michael Niedermayer <michael@niedermayer.cc>",
  6878. "target": 0,
  6879. "dataset": "other",
  6880. "idx": 262679
  6881. },
  6882. {
  6883. "func": "static int check_header_variable(EXRContext *s,\n const char *value_name,\n const char *value_type,\n unsigned int minimum_length)\n{\n GetByteContext *gb = &s->gb;\n int var_size = -1;\n\n if (bytestream2_get_bytes_left(gb) >= minimum_length &&\n !strcmp(gb->buffer, value_name)) {\n // found value_name, jump to value_type (null terminated strings)\n gb->buffer += strlen(value_name) + 1;\n if (!strcmp(gb->buffer, value_type)) {\n gb->buffer += strlen(value_type) + 1;\n var_size = bytestream2_get_le32(gb);\n // don't go read past boundaries\n if (var_size > bytestream2_get_bytes_left(gb))\n var_size = 0;\n } else {\n // value_type not found, reset the buffer\n gb->buffer -= strlen(value_name) + 1;\n av_log(s->avctx, AV_LOG_WARNING,\n \"Unknown data type %s for header variable %s.\\n\",\n value_type, value_name);\n }\n }\n\n return var_size;\n}",
  6884. "project": "FFmpeg",
  6885. "hash": 289516014085258602214466823964869426494,
  6886. "size": 29,
  6887. "commit_id": "26d3c81bc5ef2f8c3f09d45eaeacfb4b1139a777",
  6888. "message": "avcodec/exr: More strictly check dc_count\n\nFixes: out of array access\nFixes: exr/deneme\n\nFound-by: Burak Çarıkçı <burakcarikci@crypttech.com>\nSigned-off-by: Michael Niedermayer <michael@niedermayer.cc>",
  6889. "target": 0,
  6890. "dataset": "other",
  6891. "idx": 262685
  6892. },
  6893. {
  6894. "func": "static int decode_header(EXRContext *s, AVFrame *frame)\n{\n AVDictionary *metadata = NULL;\n GetByteContext *gb = &s->gb;\n int magic_number, version, flags;\n int layer_match = 0;\n int ret;\n int dup_channels = 0;\n\n s->current_channel_offset = 0;\n s->xmin = ~0;\n s->xmax = ~0;\n s->ymin = ~0;\n s->ymax = ~0;\n s->xdelta = ~0;\n s->ydelta = ~0;\n s->channel_offsets[0] = -1;\n s->channel_offsets[1] = -1;\n s->channel_offsets[2] = -1;\n s->channel_offsets[3] = -1;\n s->pixel_type = EXR_UNKNOWN;\n s->compression = EXR_UNKN;\n s->nb_channels = 0;\n s->w = 0;\n s->h = 0;\n s->tile_attr.xSize = -1;\n s->tile_attr.ySize = -1;\n s->is_tile = 0;\n s->is_multipart = 0;\n s->is_luma = 0;\n s->current_part = 0;\n\n if (bytestream2_get_bytes_left(gb) < 10) {\n av_log(s->avctx, AV_LOG_ERROR, \"Header too short to parse.\\n\");\n return AVERROR_INVALIDDATA;\n }\n\n magic_number = bytestream2_get_le32(gb);\n if (magic_number != 20000630) {\n /* As per documentation of OpenEXR, it is supposed to be\n * int 20000630 little-endian */\n av_log(s->avctx, AV_LOG_ERROR, \"Wrong magic number %d.\\n\", magic_number);\n return AVERROR_INVALIDDATA;\n }\n\n version = bytestream2_get_byte(gb);\n if (version != 2) {\n avpriv_report_missing_feature(s->avctx, \"Version %d\", version);\n return AVERROR_PATCHWELCOME;\n }\n\n flags = bytestream2_get_le24(gb);\n\n if (flags & 0x02)\n s->is_tile = 1;\n if (flags & 0x10)\n s->is_multipart = 1;\n if (flags & 0x08) {\n avpriv_report_missing_feature(s->avctx, \"deep data\");\n return AVERROR_PATCHWELCOME;\n }\n\n // Parse the header\n while (bytestream2_get_bytes_left(gb) > 0) {\n int var_size;\n\n while (s->is_multipart && s->current_part < s->selected_part &&\n bytestream2_get_bytes_left(gb) > 0) {\n if (bytestream2_peek_byte(gb)) {\n skip_header_chunk(s);\n } else {\n bytestream2_skip(gb, 1);\n if (!bytestream2_peek_byte(gb))\n break;\n }\n bytestream2_skip(gb, 1);\n s->current_part++;\n }\n\n if (!bytestream2_peek_byte(gb)) {\n if (!s->is_multipart)\n break;\n bytestream2_skip(gb, 1);\n if (s->current_part == s->selected_part) {\n while (bytestream2_get_bytes_left(gb) > 0) {\n if (bytestream2_peek_byte(gb)) {\n skip_header_chunk(s);\n } else {\n bytestream2_skip(gb, 1);\n if (!bytestream2_peek_byte(gb))\n break;\n }\n }\n }\n if (!bytestream2_peek_byte(gb))\n break;\n s->current_part++;\n }\n\n if ((var_size = check_header_variable(s, \"channels\",\n \"chlist\", 38)) >= 0) {\n GetByteContext ch_gb;\n if (!var_size) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n bytestream2_init(&ch_gb, gb->buffer, var_size);\n\n while (bytestream2_get_bytes_left(&ch_gb) >= 19) {\n EXRChannel *channel;\n enum ExrPixelType current_pixel_type;\n int channel_index = -1;\n int xsub, ysub;\n\n if (strcmp(s->layer, \"\") != 0) {\n if (strncmp(ch_gb.buffer, s->layer, strlen(s->layer)) == 0) {\n layer_match = 1;\n av_log(s->avctx, AV_LOG_INFO,\n \"Channel match layer : %s.\\n\", ch_gb.buffer);\n ch_gb.buffer += strlen(s->layer);\n if (*ch_gb.buffer == '.')\n ch_gb.buffer++; /* skip dot if not given */\n } else {\n layer_match = 0;\n av_log(s->avctx, AV_LOG_INFO,\n \"Channel doesn't match layer : %s.\\n\", ch_gb.buffer);\n }\n } else {\n layer_match = 1;\n }\n\n if (layer_match) { /* only search channel if the layer match is valid */\n if (!av_strcasecmp(ch_gb.buffer, \"R\") ||\n !av_strcasecmp(ch_gb.buffer, \"X\") ||\n !av_strcasecmp(ch_gb.buffer, \"U\")) {\n channel_index = 0;\n s->is_luma = 0;\n } else if (!av_strcasecmp(ch_gb.buffer, \"G\") ||\n !av_strcasecmp(ch_gb.buffer, \"V\")) {\n channel_index = 1;\n s->is_luma = 0;\n } else if (!av_strcasecmp(ch_gb.buffer, \"Y\")) {\n channel_index = 1;\n s->is_luma = 1;\n } else if (!av_strcasecmp(ch_gb.buffer, \"B\") ||\n !av_strcasecmp(ch_gb.buffer, \"Z\") ||\n !av_strcasecmp(ch_gb.buffer, \"W\")) {\n channel_index = 2;\n s->is_luma = 0;\n } else if (!av_strcasecmp(ch_gb.buffer, \"A\")) {\n channel_index = 3;\n } else {\n av_log(s->avctx, AV_LOG_WARNING,\n \"Unsupported channel %.256s.\\n\", ch_gb.buffer);\n }\n }\n\n /* skip until you get a 0 */\n while (bytestream2_get_bytes_left(&ch_gb) > 0 &&\n bytestream2_get_byte(&ch_gb))\n continue;\n\n if (bytestream2_get_bytes_left(&ch_gb) < 4) {\n av_log(s->avctx, AV_LOG_ERROR, \"Incomplete header.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n current_pixel_type = bytestream2_get_le32(&ch_gb);\n if (current_pixel_type >= EXR_UNKNOWN) {\n avpriv_report_missing_feature(s->avctx, \"Pixel type %d\",\n current_pixel_type);\n ret = AVERROR_PATCHWELCOME;\n goto fail;\n }\n\n bytestream2_skip(&ch_gb, 4);\n xsub = bytestream2_get_le32(&ch_gb);\n ysub = bytestream2_get_le32(&ch_gb);\n\n if (xsub != 1 || ysub != 1) {\n avpriv_report_missing_feature(s->avctx,\n \"Subsampling %dx%d\",\n xsub, ysub);\n ret = AVERROR_PATCHWELCOME;\n goto fail;\n }\n\n if (channel_index >= 0 && s->channel_offsets[channel_index] == -1) { /* channel has not been previously assigned */\n if (s->pixel_type != EXR_UNKNOWN &&\n s->pixel_type != current_pixel_type) {\n av_log(s->avctx, AV_LOG_ERROR,\n \"RGB channels not of the same depth.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n s->pixel_type = current_pixel_type;\n s->channel_offsets[channel_index] = s->current_channel_offset;\n } else if (channel_index >= 0) {\n av_log(s->avctx, AV_LOG_WARNING,\n \"Multiple channels with index %d.\\n\", channel_index);\n if (++dup_channels > 10) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n }\n\n s->channels = av_realloc(s->channels,\n ++s->nb_channels * sizeof(EXRChannel));\n if (!s->channels) {\n ret = AVERROR(ENOMEM);\n goto fail;\n }\n channel = &s->channels[s->nb_channels - 1];\n channel->pixel_type = current_pixel_type;\n channel->xsub = xsub;\n channel->ysub = ysub;\n\n if (current_pixel_type == EXR_HALF) {\n s->current_channel_offset += 2;\n } else {/* Float or UINT32 */\n s->current_channel_offset += 4;\n }\n }\n\n /* Check if all channels are set with an offset or if the channels\n * are causing an overflow */\n if (!s->is_luma) {/* if we expected to have at least 3 channels */\n if (FFMIN3(s->channel_offsets[0],\n s->channel_offsets[1],\n s->channel_offsets[2]) < 0) {\n if (s->channel_offsets[0] < 0)\n av_log(s->avctx, AV_LOG_ERROR, \"Missing red channel.\\n\");\n if (s->channel_offsets[1] < 0)\n av_log(s->avctx, AV_LOG_ERROR, \"Missing green channel.\\n\");\n if (s->channel_offsets[2] < 0)\n av_log(s->avctx, AV_LOG_ERROR, \"Missing blue channel.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n }\n\n // skip one last byte and update main gb\n gb->buffer = ch_gb.buffer + 1;\n continue;\n } else if ((var_size = check_header_variable(s, \"dataWindow\", \"box2i\",\n 31)) >= 0) {\n int xmin, ymin, xmax, ymax;\n if (!var_size) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n xmin = bytestream2_get_le32(gb);\n ymin = bytestream2_get_le32(gb);\n xmax = bytestream2_get_le32(gb);\n ymax = bytestream2_get_le32(gb);\n\n if (xmin > xmax || ymin > ymax ||\n ymax == INT_MAX || xmax == INT_MAX ||\n (unsigned)xmax - xmin >= INT_MAX ||\n (unsigned)ymax - ymin >= INT_MAX) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n s->xmin = xmin;\n s->xmax = xmax;\n s->ymin = ymin;\n s->ymax = ymax;\n s->xdelta = (s->xmax - s->xmin) + 1;\n s->ydelta = (s->ymax - s->ymin) + 1;\n\n continue;\n } else if ((var_size = check_header_variable(s, \"displayWindow\",\n \"box2i\", 34)) >= 0) {\n int32_t sx, sy, dx, dy;\n\n if (!var_size) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n sx = bytestream2_get_le32(gb);\n sy = bytestream2_get_le32(gb);\n dx = bytestream2_get_le32(gb);\n dy = bytestream2_get_le32(gb);\n\n s->w = dx - sx + 1;\n s->h = dy - sy + 1;\n\n continue;\n } else if ((var_size = check_header_variable(s, \"lineOrder\",\n \"lineOrder\", 25)) >= 0) {\n int line_order;\n if (!var_size) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n line_order = bytestream2_get_byte(gb);\n av_log(s->avctx, AV_LOG_DEBUG, \"line order: %d.\\n\", line_order);\n if (line_order > 2) {\n av_log(s->avctx, AV_LOG_ERROR, \"Unknown line order.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n continue;\n } else if ((var_size = check_header_variable(s, \"pixelAspectRatio\",\n \"float\", 31)) >= 0) {\n if (!var_size) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n s->sar = bytestream2_get_le32(gb);\n\n continue;\n } else if ((var_size = check_header_variable(s, \"compression\",\n \"compression\", 29)) >= 0) {\n if (!var_size) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n if (s->compression == EXR_UNKN)\n s->compression = bytestream2_get_byte(gb);\n else {\n bytestream2_skip(gb, 1);\n av_log(s->avctx, AV_LOG_WARNING,\n \"Found more than one compression attribute.\\n\");\n }\n\n continue;\n } else if ((var_size = check_header_variable(s, \"tiles\",\n \"tiledesc\", 22)) >= 0) {\n char tileLevel;\n\n if (!s->is_tile)\n av_log(s->avctx, AV_LOG_WARNING,\n \"Found tile attribute and scanline flags. Exr will be interpreted as scanline.\\n\");\n\n s->tile_attr.xSize = bytestream2_get_le32(gb);\n s->tile_attr.ySize = bytestream2_get_le32(gb);\n\n tileLevel = bytestream2_get_byte(gb);\n s->tile_attr.level_mode = tileLevel & 0x0f;\n s->tile_attr.level_round = (tileLevel >> 4) & 0x0f;\n\n if (s->tile_attr.level_mode >= EXR_TILE_LEVEL_UNKNOWN) {\n avpriv_report_missing_feature(s->avctx, \"Tile level mode %d\",\n s->tile_attr.level_mode);\n ret = AVERROR_PATCHWELCOME;\n goto fail;\n }\n\n if (s->tile_attr.level_round >= EXR_TILE_ROUND_UNKNOWN) {\n avpriv_report_missing_feature(s->avctx, \"Tile level round %d\",\n s->tile_attr.level_round);\n ret = AVERROR_PATCHWELCOME;\n goto fail;\n }\n\n continue;\n } else if ((var_size = check_header_variable(s, \"writer\",\n \"string\", 1)) >= 0) {\n uint8_t key[256] = { 0 };\n\n bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, var_size));\n av_dict_set(&metadata, \"writer\", key, 0);\n\n continue;\n } else if ((var_size = check_header_variable(s, \"framesPerSecond\",\n \"rational\", 33)) >= 0) {\n if (!var_size) {\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n s->avctx->framerate.num = bytestream2_get_le32(gb);\n s->avctx->framerate.den = bytestream2_get_le32(gb);\n\n continue;\n } else if ((var_size = check_header_variable(s, \"chunkCount\",\n \"int\", 23)) >= 0) {\n\n s->chunk_count = bytestream2_get_le32(gb);\n\n continue;\n } else if ((var_size = check_header_variable(s, \"type\",\n \"string\", 16)) >= 0) {\n uint8_t key[256] = { 0 };\n\n bytestream2_get_buffer(gb, key, FFMIN(sizeof(key) - 1, var_size));\n if (strncmp(\"scanlineimage\", key, var_size) &&\n strncmp(\"tiledimage\", key, var_size))\n return AVERROR_PATCHWELCOME;\n\n continue;\n } else if ((var_size = check_header_variable(s, \"preview\",\n \"preview\", 16)) >= 0) {\n uint32_t pw = bytestream2_get_le32(gb);\n uint32_t ph = bytestream2_get_le32(gb);\n int64_t psize = 4LL * pw * ph;\n\n if (psize >= bytestream2_get_bytes_left(gb))\n return AVERROR_INVALIDDATA;\n\n bytestream2_skip(gb, psize);\n\n continue;\n }\n\n // Check if there are enough bytes for a header\n if (bytestream2_get_bytes_left(gb) <= 9) {\n av_log(s->avctx, AV_LOG_ERROR, \"Incomplete header\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n // Process unknown variables\n {\n uint8_t name[256] = { 0 };\n uint8_t type[256] = { 0 };\n uint8_t value[256] = { 0 };\n int i = 0, size;\n\n while (bytestream2_get_bytes_left(gb) > 0 &&\n bytestream2_peek_byte(gb) && i < 255) {\n name[i++] = bytestream2_get_byte(gb);\n }\n\n bytestream2_skip(gb, 1);\n i = 0;\n while (bytestream2_get_bytes_left(gb) > 0 &&\n bytestream2_peek_byte(gb) && i < 255) {\n type[i++] = bytestream2_get_byte(gb);\n }\n bytestream2_skip(gb, 1);\n size = bytestream2_get_le32(gb);\n\n bytestream2_get_buffer(gb, value, FFMIN(sizeof(value) - 1, size));\n if (!strcmp(type, \"string\"))\n av_dict_set(&metadata, name, value, 0);\n }\n }\n\n if (s->compression == EXR_UNKN) {\n av_log(s->avctx, AV_LOG_ERROR, \"Missing compression attribute.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n if (s->is_tile) {\n if (s->tile_attr.xSize < 1 || s->tile_attr.ySize < 1) {\n av_log(s->avctx, AV_LOG_ERROR, \"Invalid tile attribute.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n }\n\n if (bytestream2_get_bytes_left(gb) <= 0) {\n av_log(s->avctx, AV_LOG_ERROR, \"Incomplete frame.\\n\");\n ret = AVERROR_INVALIDDATA;\n goto fail;\n }\n\n frame->metadata = metadata;\n\n // aaand we are done\n bytestream2_skip(gb, 1);\n return 0;\nfail:\n av_dict_free(&metadata);\n return ret;\n}",
  6895. "project": "FFmpeg",
  6896. "hash": 101409097968203521848128535463886770814,
  6897. "size": 477,
  6898. "commit_id": "26d3c81bc5ef2f8c3f09d45eaeacfb4b1139a777",
  6899. "message": "avcodec/exr: More strictly check dc_count\n\nFixes: out of array access\nFixes: exr/deneme\n\nFound-by: Burak Çarıkçı <burakcarikci@crypttech.com>\nSigned-off-by: Michael Niedermayer <michael@niedermayer.cc>",
  6900. "target": 0,
  6901. "dataset": "other",
  6902. "idx": 262682
  6903. }
  6904. ]
  6905. },
  6906. {
  6907. "call_depth": 3,
  6908. "longest_call_chain": [
  6909. "j2k_dump",
  6910. "j2k_dump_image_header",
  6911. "j2k_dump_image_comp_header"
  6912. ],
  6913. "group_size": 6,
  6914. "functions": [
  6915. {
  6916. "func": "static void opj_j2k_dump_tile_info(opj_tcp_t * l_default_tile,\n OPJ_INT32 numcomps, FILE* out_stream)\n{\n if (l_default_tile) {\n OPJ_INT32 compno;\n\n fprintf(out_stream, \"\\t default tile {\\n\");\n fprintf(out_stream, \"\\t\\t csty=%#x\\n\", l_default_tile->csty);\n fprintf(out_stream, \"\\t\\t prg=%#x\\n\", l_default_tile->prg);\n fprintf(out_stream, \"\\t\\t numlayers=%d\\n\", l_default_tile->numlayers);\n fprintf(out_stream, \"\\t\\t mct=%x\\n\", l_default_tile->mct);\n\n for (compno = 0; compno < numcomps; compno++) {\n opj_tccp_t *l_tccp = &(l_default_tile->tccps[compno]);\n OPJ_UINT32 resno;\n OPJ_INT32 bandno, numbands;\n\n /* coding style*/\n fprintf(out_stream, \"\\t\\t comp %d {\\n\", compno);\n fprintf(out_stream, \"\\t\\t\\t csty=%#x\\n\", l_tccp->csty);\n fprintf(out_stream, \"\\t\\t\\t numresolutions=%d\\n\", l_tccp->numresolutions);\n fprintf(out_stream, \"\\t\\t\\t cblkw=2^%d\\n\", l_tccp->cblkw);\n fprintf(out_stream, \"\\t\\t\\t cblkh=2^%d\\n\", l_tccp->cblkh);\n fprintf(out_stream, \"\\t\\t\\t cblksty=%#x\\n\", l_tccp->cblksty);\n fprintf(out_stream, \"\\t\\t\\t qmfbid=%d\\n\", l_tccp->qmfbid);\n\n fprintf(out_stream, \"\\t\\t\\t preccintsize (w,h)=\");\n for (resno = 0; resno < l_tccp->numresolutions; resno++) {\n fprintf(out_stream, \"(%d,%d) \", l_tccp->prcw[resno], l_tccp->prch[resno]);\n }\n fprintf(out_stream, \"\\n\");\n\n /* quantization style*/\n fprintf(out_stream, \"\\t\\t\\t qntsty=%d\\n\", l_tccp->qntsty);\n fprintf(out_stream, \"\\t\\t\\t numgbits=%d\\n\", l_tccp->numgbits);\n fprintf(out_stream, \"\\t\\t\\t stepsizes (m,e)=\");\n numbands = (l_tccp->qntsty == J2K_CCP_QNTSTY_SIQNT) ? 1 :\n (OPJ_INT32)l_tccp->numresolutions * 3 - 2;\n for (bandno = 0; bandno < numbands; bandno++) {\n fprintf(out_stream, \"(%d,%d) \", l_tccp->stepsizes[bandno].mant,\n l_tccp->stepsizes[bandno].expn);\n }\n fprintf(out_stream, \"\\n\");\n\n /* RGN value*/\n fprintf(out_stream, \"\\t\\t\\t roishift=%d\\n\", l_tccp->roishift);\n\n fprintf(out_stream, \"\\t\\t }\\n\");\n } /*end of component of default tile*/\n fprintf(out_stream, \"\\t }\\n\"); /*end of default tile*/\n }\n}",
  6917. "project": "openjpeg",
  6918. "hash": 51607478772090798622835946927947547776,
  6919. "size": 52,
  6920. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  6921. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  6922. "target": 0,
  6923. "dataset": "other",
  6924. "idx": 357433
  6925. },
  6926. {
  6927. "func": "void j2k_dump(opj_j2k_t* p_j2k, OPJ_INT32 flag, FILE* out_stream)\n{\n /* Check if the flag is compatible with j2k file*/\n if ((flag & OPJ_JP2_INFO) || (flag & OPJ_JP2_IND)) {\n fprintf(out_stream, \"Wrong flag\\n\");\n return;\n }\n\n /* Dump the image_header */\n if (flag & OPJ_IMG_INFO) {\n if (p_j2k->m_private_image) {\n j2k_dump_image_header(p_j2k->m_private_image, 0, out_stream);\n }\n }\n\n /* Dump the codestream info from main header */\n if (flag & OPJ_J2K_MH_INFO) {\n if (p_j2k->m_private_image) {\n opj_j2k_dump_MH_info(p_j2k, out_stream);\n }\n }\n /* Dump all tile/codestream info */\n if (flag & OPJ_J2K_TCH_INFO) {\n OPJ_UINT32 l_nb_tiles = p_j2k->m_cp.th * p_j2k->m_cp.tw;\n OPJ_UINT32 i;\n opj_tcp_t * l_tcp = p_j2k->m_cp.tcps;\n if (p_j2k->m_private_image) {\n for (i = 0; i < l_nb_tiles; ++i) {\n opj_j2k_dump_tile_info(l_tcp, (OPJ_INT32)p_j2k->m_private_image->numcomps,\n out_stream);\n ++l_tcp;\n }\n }\n }\n\n /* Dump the codestream info of the current tile */\n if (flag & OPJ_J2K_TH_INFO) {\n\n }\n\n /* Dump the codestream index from main header */\n if (flag & OPJ_J2K_MH_IND) {\n opj_j2k_dump_MH_index(p_j2k, out_stream);\n }\n\n /* Dump the codestream index of the current tile */\n if (flag & OPJ_J2K_TH_IND) {\n\n }\n\n}",
  6928. "project": "openjpeg",
  6929. "hash": 17856137946455148866793740336225951354,
  6930. "size": 51,
  6931. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  6932. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  6933. "target": 0,
  6934. "dataset": "other",
  6935. "idx": 357301
  6936. },
  6937. {
  6938. "func": "void j2k_dump_image_header(opj_image_t* img_header, OPJ_BOOL dev_dump_flag,\n FILE* out_stream)\n{\n char tab[2];\n\n if (dev_dump_flag) {\n fprintf(stdout, \"[DEV] Dump an image_header struct {\\n\");\n tab[0] = '\\0';\n } else {\n fprintf(out_stream, \"Image info {\\n\");\n tab[0] = '\\t';\n tab[1] = '\\0';\n }\n\n fprintf(out_stream, \"%s x0=%d, y0=%d\\n\", tab, img_header->x0, img_header->y0);\n fprintf(out_stream, \"%s x1=%d, y1=%d\\n\", tab, img_header->x1,\n img_header->y1);\n fprintf(out_stream, \"%s numcomps=%d\\n\", tab, img_header->numcomps);\n\n if (img_header->comps) {\n OPJ_UINT32 compno;\n for (compno = 0; compno < img_header->numcomps; compno++) {\n fprintf(out_stream, \"%s\\t component %d {\\n\", tab, compno);\n j2k_dump_image_comp_header(&(img_header->comps[compno]), dev_dump_flag,\n out_stream);\n fprintf(out_stream, \"%s}\\n\", tab);\n }\n }\n\n fprintf(out_stream, \"}\\n\");\n}",
  6939. "project": "openjpeg",
  6940. "hash": 11902064534528171501747539889597312753,
  6941. "size": 31,
  6942. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  6943. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  6944. "target": 0,
  6945. "dataset": "other",
  6946. "idx": 357331
  6947. },
  6948. {
  6949. "func": "static void opj_j2k_dump_MH_info(opj_j2k_t* p_j2k, FILE* out_stream)\n{\n\n fprintf(out_stream, \"Codestream info from main header: {\\n\");\n\n fprintf(out_stream, \"\\t tx0=%d, ty0=%d\\n\", p_j2k->m_cp.tx0, p_j2k->m_cp.ty0);\n fprintf(out_stream, \"\\t tdx=%d, tdy=%d\\n\", p_j2k->m_cp.tdx, p_j2k->m_cp.tdy);\n fprintf(out_stream, \"\\t tw=%d, th=%d\\n\", p_j2k->m_cp.tw, p_j2k->m_cp.th);\n opj_j2k_dump_tile_info(p_j2k->m_specific_param.m_decoder.m_default_tcp,\n (OPJ_INT32)p_j2k->m_private_image->numcomps, out_stream);\n fprintf(out_stream, \"}\\n\");\n}",
  6950. "project": "openjpeg",
  6951. "hash": 67278379867667648901937234503624904387,
  6952. "size": 12,
  6953. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  6954. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  6955. "target": 0,
  6956. "dataset": "other",
  6957. "idx": 357443
  6958. },
  6959. {
  6960. "func": "static void opj_j2k_dump_MH_index(opj_j2k_t* p_j2k, FILE* out_stream)\n{\n opj_codestream_index_t* cstr_index = p_j2k->cstr_index;\n OPJ_UINT32 it_marker, it_tile, it_tile_part;\n\n fprintf(out_stream, \"Codestream index from main header: {\\n\");\n\n fprintf(out_stream, \"\\t Main header start position=%\" PRIi64 \"\\n\"\n \"\\t Main header end position=%\" PRIi64 \"\\n\",\n cstr_index->main_head_start, cstr_index->main_head_end);\n\n fprintf(out_stream, \"\\t Marker list: {\\n\");\n\n if (cstr_index->marker) {\n for (it_marker = 0; it_marker < cstr_index->marknum ; it_marker++) {\n fprintf(out_stream, \"\\t\\t type=%#x, pos=%\" PRIi64 \", len=%d\\n\",\n cstr_index->marker[it_marker].type,\n cstr_index->marker[it_marker].pos,\n cstr_index->marker[it_marker].len);\n }\n }\n\n fprintf(out_stream, \"\\t }\\n\");\n\n if (cstr_index->tile_index) {\n\n /* Simple test to avoid to write empty information*/\n OPJ_UINT32 l_acc_nb_of_tile_part = 0;\n for (it_tile = 0; it_tile < cstr_index->nb_of_tiles ; it_tile++) {\n l_acc_nb_of_tile_part += cstr_index->tile_index[it_tile].nb_tps;\n }\n\n if (l_acc_nb_of_tile_part) {\n fprintf(out_stream, \"\\t Tile index: {\\n\");\n\n for (it_tile = 0; it_tile < cstr_index->nb_of_tiles ; it_tile++) {\n OPJ_UINT32 nb_of_tile_part = cstr_index->tile_index[it_tile].nb_tps;\n\n fprintf(out_stream, \"\\t\\t nb of tile-part in tile [%d]=%d\\n\", it_tile,\n nb_of_tile_part);\n\n if (cstr_index->tile_index[it_tile].tp_index) {\n for (it_tile_part = 0; it_tile_part < nb_of_tile_part; it_tile_part++) {\n fprintf(out_stream, \"\\t\\t\\t tile-part[%d]: star_pos=%\" PRIi64 \", end_header=%\"\n PRIi64 \", end_pos=%\" PRIi64 \".\\n\",\n it_tile_part,\n cstr_index->tile_index[it_tile].tp_index[it_tile_part].start_pos,\n cstr_index->tile_index[it_tile].tp_index[it_tile_part].end_header,\n cstr_index->tile_index[it_tile].tp_index[it_tile_part].end_pos);\n }\n }\n\n if (cstr_index->tile_index[it_tile].marker) {\n for (it_marker = 0; it_marker < cstr_index->tile_index[it_tile].marknum ;\n it_marker++) {\n fprintf(out_stream, \"\\t\\t type=%#x, pos=%\" PRIi64 \", len=%d\\n\",\n cstr_index->tile_index[it_tile].marker[it_marker].type,\n cstr_index->tile_index[it_tile].marker[it_marker].pos,\n cstr_index->tile_index[it_tile].marker[it_marker].len);\n }\n }\n }\n fprintf(out_stream, \"\\t }\\n\");\n }\n }\n\n fprintf(out_stream, \"}\\n\");\n\n}",
  6961. "project": "openjpeg",
  6962. "hash": 2401832381883037027900156978202737645,
  6963. "size": 69,
  6964. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  6965. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  6966. "target": 0,
  6967. "dataset": "other",
  6968. "idx": 357391
  6969. },
  6970. {
  6971. "func": "void j2k_dump_image_comp_header(opj_image_comp_t* comp_header,\n OPJ_BOOL dev_dump_flag, FILE* out_stream)\n{\n char tab[3];\n\n if (dev_dump_flag) {\n fprintf(stdout, \"[DEV] Dump an image_comp_header struct {\\n\");\n tab[0] = '\\0';\n } else {\n tab[0] = '\\t';\n tab[1] = '\\t';\n tab[2] = '\\0';\n }\n\n fprintf(out_stream, \"%s dx=%d, dy=%d\\n\", tab, comp_header->dx, comp_header->dy);\n fprintf(out_stream, \"%s prec=%d\\n\", tab, comp_header->prec);\n fprintf(out_stream, \"%s sgnd=%d\\n\", tab, comp_header->sgnd);\n\n if (dev_dump_flag) {\n fprintf(out_stream, \"}\\n\");\n }\n}",
  6972. "project": "openjpeg",
  6973. "hash": 329127559965974685019870250929135179467,
  6974. "size": 22,
  6975. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  6976. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  6977. "target": 0,
  6978. "dataset": "other",
  6979. "idx": 357277
  6980. }
  6981. ]
  6982. },
  6983. {
  6984. "call_depth": 5,
  6985. "longest_call_chain": [
  6986. "rtnl_talk_suppress_rtnl_errmsg",
  6987. "__rtnl_talk",
  6988. "__rtnl_talk_iov",
  6989. "rtnl_talk_error",
  6990. "nl_dump_ext_ack"
  6991. ],
  6992. "group_size": 15,
  6993. "functions": [
  6994. {
  6995. "func": "int rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iovec, size_t iovlen,\n\t\t struct nlmsghdr **answer)\n{\n\treturn __rtnl_talk_iov(rtnl, iovec, iovlen, answer, true, NULL);\n}",
  6996. "project": "iproute2",
  6997. "hash": 75126113650359112333002503747350893451,
  6998. "size": 5,
  6999. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7000. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7001. "target": 0,
  7002. "dataset": "other",
  7003. "idx": 318210
  7004. },
  7005. {
  7006. "func": "int rtnl_talk_suppress_rtnl_errmsg(struct rtnl_handle *rtnl, struct nlmsghdr *n,\n\t\t\t\t struct nlmsghdr **answer)\n{\n\treturn __rtnl_talk(rtnl, n, answer, false, NULL);\n}",
  7007. "project": "iproute2",
  7008. "hash": 276177257538643753720790986623527364950,
  7009. "size": 5,
  7010. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7011. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7012. "target": 0,
  7013. "dataset": "other",
  7014. "idx": 318246
  7015. },
  7016. {
  7017. "func": "static int __rtnl_talk_iov(struct rtnl_handle *rtnl, struct iovec *iov,\n\t\t\t size_t iovlen, struct nlmsghdr **answer,\n\t\t\t bool show_rtnl_err, nl_ext_ack_fn_t errfn)\n{\n\tstruct sockaddr_nl nladdr = { .nl_family = AF_NETLINK };\n\tstruct iovec riov;\n\tstruct msghdr msg = {\n\t\t.msg_name = &nladdr,\n\t\t.msg_namelen = sizeof(nladdr),\n\t\t.msg_iov = iov,\n\t\t.msg_iovlen = iovlen,\n\t};\n\tunsigned int seq = 0;\n\tstruct nlmsghdr *h;\n\tint i, status;\n\tchar *buf;\n\n\tfor (i = 0; i < iovlen; i++) {\n\t\th = iov[i].iov_base;\n\t\th->nlmsg_seq = seq = ++rtnl->seq;\n\t\tif (answer == NULL)\n\t\t\th->nlmsg_flags |= NLM_F_ACK;\n\t}\n\n\tstatus = sendmsg(rtnl->fd, &msg, 0);\n\tif (status < 0) {\n\t\tperror(\"Cannot talk to rtnetlink\");\n\t\treturn -1;\n\t}\n\n\t/* change msg to use the response iov */\n\tmsg.msg_iov = &riov;\n\tmsg.msg_iovlen = 1;\n\ti = 0;\n\twhile (1) {\n\t\tstatus = rtnl_recvmsg(rtnl->fd, &msg, &buf);\n\t\t++i;\n\n\t\tif (status < 0)\n\t\t\treturn status;\n\n\t\tif (msg.msg_namelen != sizeof(nladdr)) {\n\t\t\tfprintf(stderr,\n\t\t\t\t\"sender address length == %d\\n\",\n\t\t\t\tmsg.msg_namelen);\n\t\t\texit(1);\n\t\t}\n\t\tfor (h = (struct nlmsghdr *)buf; status >= sizeof(*h); ) {\n\t\t\tint len = h->nlmsg_len;\n\t\t\tint l = len - sizeof(*h);\n\n\t\t\tif (l < 0 || len > status) {\n\t\t\t\tif (msg.msg_flags & MSG_TRUNC) {\n\t\t\t\t\tfprintf(stderr, \"Truncated message\\n\");\n\t\t\t\t\tfree(buf);\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\t\t\t\tfprintf(stderr,\n\t\t\t\t\t\"!!!malformed message: len=%d\\n\",\n\t\t\t\t\tlen);\n\t\t\t\texit(1);\n\t\t\t}\n\n\t\t\tif (nladdr.nl_pid != 0 ||\n\t\t\t h->nlmsg_pid != rtnl->local.nl_pid ||\n\t\t\t h->nlmsg_seq > seq || h->nlmsg_seq < seq - iovlen) {\n\t\t\t\t/* Don't forget to skip that message. */\n\t\t\t\tstatus -= NLMSG_ALIGN(len);\n\t\t\t\th = (struct nlmsghdr *)((char *)h + NLMSG_ALIGN(len));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif (h->nlmsg_type == NLMSG_ERROR) {\n\t\t\t\tstruct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(h);\n\n\t\t\t\tif (l < sizeof(struct nlmsgerr)) {\n\t\t\t\t\tfprintf(stderr, \"ERROR truncated\\n\");\n\t\t\t\t\tfree(buf);\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\tif (!err->error)\n\t\t\t\t\t/* check messages from kernel */\n\t\t\t\t\tnl_dump_ext_ack(h, errfn);\n\n\t\t\t\tif (rtnl->proto != NETLINK_SOCK_DIAG &&\n\t\t\t\t show_rtnl_err)\n\t\t\t\t\trtnl_talk_error(h, err, errfn);\n\n\t\t\t\terrno = -err->error;\n\t\t\t\tif (answer)\n\t\t\t\t\t*answer = (struct nlmsghdr *)buf;\n\t\t\t\telse\n\t\t\t\t\tfree(buf);\n\t\t\t\treturn -i;\n\t\t\t}\n\n\t\t\tif (answer) {\n\t\t\t\t*answer = (struct nlmsghdr *)buf;\n\t\t\t\treturn 0;\n\t\t\t}\n\n\t\t\tfprintf(stderr, \"Unexpected reply!!!\\n\");\n\n\t\t\tstatus -= NLMSG_ALIGN(len);\n\t\t\th = (struct nlmsghdr *)((char *)h + NLMSG_ALIGN(len));\n\t\t}\n\t\tfree(buf);\n\n\t\tif (msg.msg_flags & MSG_TRUNC) {\n\t\t\tfprintf(stderr, \"Message truncated\\n\");\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (status) {\n\t\t\tfprintf(stderr, \"!!!Remnant of size %d\\n\", status);\n\t\t\texit(1);\n\t\t}\n\t}\n}",
  7018. "project": "iproute2",
  7019. "hash": 92142101603136768225931051509924523570,
  7020. "size": 120,
  7021. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7022. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7023. "target": 1,
  7024. "dataset": "other",
  7025. "idx": 201365
  7026. },
  7027. {
  7028. "func": "static int __rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,\n\t\t struct nlmsghdr **answer,\n\t\t bool show_rtnl_err, nl_ext_ack_fn_t errfn)\n{\n\tstruct iovec iov = {\n\t\t.iov_base = n,\n\t\t.iov_len = n->nlmsg_len\n\t};\n\n\treturn __rtnl_talk_iov(rtnl, &iov, 1, answer, show_rtnl_err, errfn);\n}",
  7029. "project": "iproute2",
  7030. "hash": 258357111139890241141530940901744848252,
  7031. "size": 11,
  7032. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7033. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7034. "target": 0,
  7035. "dataset": "other",
  7036. "idx": 318243
  7037. },
  7038. {
  7039. "func": "int rtnl_talk(struct rtnl_handle *rtnl, struct nlmsghdr *n,\n\t struct nlmsghdr **answer)\n{\n\treturn __rtnl_talk(rtnl, n, answer, true, NULL);\n}",
  7040. "project": "iproute2",
  7041. "hash": 282123356199083406582312983221270494907,
  7042. "size": 5,
  7043. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7044. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7045. "target": 0,
  7046. "dataset": "other",
  7047. "idx": 318254
  7048. },
  7049. {
  7050. "func": "static void rtnl_talk_error(struct nlmsghdr *h, struct nlmsgerr *err,\n\t\t\t nl_ext_ack_fn_t errfn)\n{\n\tif (nl_dump_ext_ack(h, errfn))\n\t\treturn;\n\n\tfprintf(stderr, \"RTNETLINK answers: %s\\n\",\n\t\tstrerror(-err->error));\n}",
  7051. "project": "iproute2",
  7052. "hash": 70030816660616229372553035022519381719,
  7053. "size": 9,
  7054. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7055. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7056. "target": 0,
  7057. "dataset": "other",
  7058. "idx": 318227
  7059. },
  7060. {
  7061. "func": "int rtnl_dump_filter_l(struct rtnl_handle *rth,\n\t\t const struct rtnl_dump_filter_arg *arg)\n{\n\tstruct sockaddr_nl nladdr;\n\tstruct iovec iov;\n\tstruct msghdr msg = {\n\t\t.msg_name = &nladdr,\n\t\t.msg_namelen = sizeof(nladdr),\n\t\t.msg_iov = &iov,\n\t\t.msg_iovlen = 1,\n\t};\n\tchar *buf;\n\tint dump_intr = 0;\n\n\twhile (1) {\n\t\tint status;\n\t\tconst struct rtnl_dump_filter_arg *a;\n\t\tint found_done = 0;\n\t\tint msglen = 0;\n\n\t\tstatus = rtnl_recvmsg(rth->fd, &msg, &buf);\n\t\tif (status < 0)\n\t\t\treturn status;\n\n\t\tif (rth->dump_fp)\n\t\t\tfwrite(buf, 1, NLMSG_ALIGN(status), rth->dump_fp);\n\n\t\tfor (a = arg; a->filter; a++) {\n\t\t\tstruct nlmsghdr *h = (struct nlmsghdr *)buf;\n\n\t\t\tmsglen = status;\n\n\t\t\twhile (NLMSG_OK(h, msglen)) {\n\t\t\t\tint err = 0;\n\n\t\t\t\th->nlmsg_flags &= ~a->nc_flags;\n\n\t\t\t\tif (nladdr.nl_pid != 0 ||\n\t\t\t\t h->nlmsg_pid != rth->local.nl_pid ||\n\t\t\t\t h->nlmsg_seq != rth->dump)\n\t\t\t\t\tgoto skip_it;\n\n\t\t\t\tif (h->nlmsg_flags & NLM_F_DUMP_INTR)\n\t\t\t\t\tdump_intr = 1;\n\n\t\t\t\tif (h->nlmsg_type == NLMSG_DONE) {\n\t\t\t\t\terr = rtnl_dump_done(h);\n\t\t\t\t\tif (err < 0) {\n\t\t\t\t\t\tfree(buf);\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\n\t\t\t\t\tfound_done = 1;\n\t\t\t\t\tbreak; /* process next filter */\n\t\t\t\t}\n\n\t\t\t\tif (h->nlmsg_type == NLMSG_ERROR) {\n\t\t\t\t\trtnl_dump_error(rth, h);\n\t\t\t\t\tfree(buf);\n\t\t\t\t\treturn -1;\n\t\t\t\t}\n\n\t\t\t\tif (!rth->dump_fp) {\n\t\t\t\t\terr = a->filter(&nladdr, h, a->arg1);\n\t\t\t\t\tif (err < 0) {\n\t\t\t\t\t\tfree(buf);\n\t\t\t\t\t\treturn err;\n\t\t\t\t\t}\n\t\t\t\t}\n\nskip_it:\n\t\t\t\th = NLMSG_NEXT(h, msglen);\n\t\t\t}\n\t\t}\n\t\tfree(buf);\n\n\t\tif (found_done) {\n\t\t\tif (dump_intr)\n\t\t\t\tfprintf(stderr,\n\t\t\t\t\t\"Dump was interrupted and may be inconsistent.\\n\");\n\t\t\treturn 0;\n\t\t}\n\n\t\tif (msg.msg_flags & MSG_TRUNC) {\n\t\t\tfprintf(stderr, \"Message truncated\\n\");\n\t\t\tcontinue;\n\t\t}\n\t\tif (msglen) {\n\t\t\tfprintf(stderr, \"!!!Remnant of size %d\\n\", msglen);\n\t\t\texit(1);\n\t\t}\n\t}\n}",
  7062. "project": "iproute2",
  7063. "hash": 166921226395054266878638469800187184412,
  7064. "size": 93,
  7065. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7066. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7067. "target": 0,
  7068. "dataset": "other",
  7069. "idx": 318215
  7070. },
  7071. {
  7072. "func": "int rtnl_talk_extack(struct rtnl_handle *rtnl, struct nlmsghdr *n,\n\t\t struct nlmsghdr **answer,\n\t\t nl_ext_ack_fn_t errfn)\n{\n\treturn __rtnl_talk(rtnl, n, answer, true, errfn);\n}",
  7073. "project": "iproute2",
  7074. "hash": 264744638057171992891412528702997048696,
  7075. "size": 6,
  7076. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7077. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7078. "target": 0,
  7079. "dataset": "other",
  7080. "idx": 318240
  7081. },
  7082. {
  7083. "func": "static int rtnl_recvmsg(int fd, struct msghdr *msg, char **answer)\n{\n\tstruct iovec *iov = msg->msg_iov;\n\tchar *buf;\n\tint len;\n\n\tiov->iov_base = NULL;\n\tiov->iov_len = 0;\n\n\tlen = __rtnl_recvmsg(fd, msg, MSG_PEEK | MSG_TRUNC);\n\tif (len < 0)\n\t\treturn len;\n\n\tbuf = malloc(len);\n\tif (!buf) {\n\t\tfprintf(stderr, \"malloc error: not enough buffer\\n\");\n\t\treturn -ENOMEM;\n\t}\n\n\tiov->iov_base = buf;\n\tiov->iov_len = len;\n\n\tlen = __rtnl_recvmsg(fd, msg, 0);\n\tif (len < 0) {\n\t\tfree(buf);\n\t\treturn len;\n\t}\n\n\tif (answer)\n\t\t*answer = buf;\n\telse\n\t\tfree(buf);\n\n\treturn len;\n}",
  7084. "project": "iproute2",
  7085. "hash": 130784246103898234782440326940795739483,
  7086. "size": 35,
  7087. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7088. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7089. "target": 0,
  7090. "dataset": "other",
  7091. "idx": 318228
  7092. },
  7093. {
  7094. "func": "static int rtnl_dump_done(struct nlmsghdr *h)\n{\n\tint len = *(int *)NLMSG_DATA(h);\n\n\tif (h->nlmsg_len < NLMSG_LENGTH(sizeof(int))) {\n\t\tfprintf(stderr, \"DONE truncated\\n\");\n\t\treturn -1;\n\t}\n\n\tif (len < 0) {\n\t\terrno = -len;\n\t\tswitch (errno) {\n\t\tcase ENOENT:\n\t\tcase EOPNOTSUPP:\n\t\t\treturn -1;\n\t\tcase EMSGSIZE:\n\t\t\tfprintf(stderr,\n\t\t\t\t\"Error: Buffer too small for object.\\n\");\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tperror(\"RTNETLINK answers\");\n\t\t}\n\t\treturn len;\n\t}\n\n\t/* check for any messages returned from kernel */\n\tnl_dump_ext_ack(h, NULL);\n\n\treturn 0;\n}",
  7095. "project": "iproute2",
  7096. "hash": 277082411931981204017671150617698319440,
  7097. "size": 30,
  7098. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7099. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7100. "target": 0,
  7101. "dataset": "other",
  7102. "idx": 318259
  7103. },
  7104. {
  7105. "func": "static int __rtnl_recvmsg(int fd, struct msghdr *msg, int flags)\n{\n\tint len;\n\n\tdo {\n\t\tlen = recvmsg(fd, msg, flags);\n\t} while (len < 0 && (errno == EINTR || errno == EAGAIN));\n\n\tif (len < 0) {\n\t\tfprintf(stderr, \"netlink receive error %s (%d)\\n\",\n\t\t\tstrerror(errno), errno);\n\t\treturn -errno;\n\t}\n\n\tif (len == 0) {\n\t\tfprintf(stderr, \"EOF on netlink\\n\");\n\t\treturn -ENODATA;\n\t}\n\n\treturn len;\n}",
  7106. "project": "iproute2",
  7107. "hash": 4321026708248301105542426191233231815,
  7108. "size": 21,
  7109. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7110. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7111. "target": 0,
  7112. "dataset": "other",
  7113. "idx": 318255
  7114. },
  7115. {
  7116. "func": "static void rtnl_dump_error(const struct rtnl_handle *rth,\n\t\t\t struct nlmsghdr *h)\n{\n\n\tif (h->nlmsg_len < NLMSG_LENGTH(sizeof(struct nlmsgerr))) {\n\t\tfprintf(stderr, \"ERROR truncated\\n\");\n\t} else {\n\t\tconst struct nlmsgerr *err = (struct nlmsgerr *)NLMSG_DATA(h);\n\n\t\terrno = -err->error;\n\t\tif (rth->proto == NETLINK_SOCK_DIAG &&\n\t\t (errno == ENOENT ||\n\t\t errno == EOPNOTSUPP))\n\t\t\treturn;\n\n\t\tif (!(rth->flags & RTNL_HANDLE_F_SUPPRESS_NLERR))\n\t\t\tperror(\"RTNETLINK answers\");\n\t}\n}",
  7117. "project": "iproute2",
  7118. "hash": 191557476382986932474280775943643105300,
  7119. "size": 19,
  7120. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7121. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7122. "target": 0,
  7123. "dataset": "other",
  7124. "idx": 318235
  7125. },
  7126. {
  7127. "func": "int nl_dump_ext_ack(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn)\n{\n\tstruct nlattr *tb[NLMSGERR_ATTR_MAX + 1] = {};\n\tconst struct nlmsgerr *err = mnl_nlmsg_get_payload(nlh);\n\tconst struct nlmsghdr *err_nlh = NULL;\n\tunsigned int hlen = sizeof(*err);\n\tconst char *msg = NULL;\n\tuint32_t off = 0;\n\n\t/* no TLVs, nothing to do here */\n\tif (!(nlh->nlmsg_flags & NLM_F_ACK_TLVS))\n\t\treturn 0;\n\n\t/* if NLM_F_CAPPED is set then the inner err msg was capped */\n\tif (!(nlh->nlmsg_flags & NLM_F_CAPPED))\n\t\thlen += mnl_nlmsg_get_payload_len(&err->msg);\n\n\tif (mnl_attr_parse(nlh, hlen, err_attr_cb, tb) != MNL_CB_OK)\n\t\treturn 0;\n\n\tif (tb[NLMSGERR_ATTR_MSG])\n\t\tmsg = mnl_attr_get_str(tb[NLMSGERR_ATTR_MSG]);\n\n\tif (tb[NLMSGERR_ATTR_OFFS]) {\n\t\toff = mnl_attr_get_u32(tb[NLMSGERR_ATTR_OFFS]);\n\n\t\tif (off > nlh->nlmsg_len) {\n\t\t\tfprintf(stderr,\n\t\t\t\t\"Invalid offset for NLMSGERR_ATTR_OFFS\\n\");\n\t\t\toff = 0;\n\t\t} else if (!(nlh->nlmsg_flags & NLM_F_CAPPED))\n\t\t\terr_nlh = &err->msg;\n\t}\n\n\tif (errfn)\n\t\treturn errfn(msg, off, err_nlh);\n\n\tif (msg && *msg != '\\0') {\n\t\tbool is_err = !!err->error;\n\n\t\tfprintf(stderr, \"%s: %s\",\n\t\t\tis_err ? \"Error\" : \"Warning\", msg);\n\t\tif (msg[strlen(msg) - 1] != '.')\n\t\t\tfprintf(stderr, \".\");\n\t\tfprintf(stderr, \"\\n\");\n\n\t\treturn is_err ? 1 : 0;\n\t}\n\n\treturn 0;\n}",
  7128. "project": "iproute2",
  7129. "hash": 300270387770507140375902767365134012826,
  7130. "size": 51,
  7131. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7132. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7133. "target": 0,
  7134. "dataset": "other",
  7135. "idx": 318229
  7136. },
  7137. {
  7138. "func": "int nl_dump_ext_ack(const struct nlmsghdr *nlh, nl_ext_ack_fn_t errfn)\n{\n\treturn 0;\n}",
  7139. "project": "iproute2",
  7140. "hash": 147008708141629430933019260862799517880,
  7141. "size": 4,
  7142. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7143. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7144. "target": 0,
  7145. "dataset": "other",
  7146. "idx": 318233
  7147. },
  7148. {
  7149. "func": "int rtnl_dump_filter_nc(struct rtnl_handle *rth,\n\t\t rtnl_filter_t filter,\n\t\t void *arg1, __u16 nc_flags)\n{\n\tconst struct rtnl_dump_filter_arg a[2] = {\n\t\t{ .filter = filter, .arg1 = arg1, .nc_flags = nc_flags, },\n\t\t{ .filter = NULL, .arg1 = NULL, .nc_flags = 0, },\n\t};\n\n\treturn rtnl_dump_filter_l(rth, a);\n}",
  7150. "project": "iproute2",
  7151. "hash": 53752171441152340212005918815825810107,
  7152. "size": 11,
  7153. "commit_id": "b45e300024bb0936a41821ad75117dc08b65669f",
  7154. "message": "libnetlink: don't return error on success\n\nChange to error handling broke normal code.\n\nFixes: c60389e4f9ea (\"libnetlink: fix leak and using unused memory on error\")\nReported-by: David Ahern <dsahern@gmail.com>\nSigned-off-by: Stephen Hemminger <stephen@networkplumber.org>",
  7155. "target": 0,
  7156. "dataset": "other",
  7157. "idx": 318225
  7158. }
  7159. ]
  7160. },
  7161. {
  7162. "call_depth": 4,
  7163. "longest_call_chain": [
  7164. "bcf_readrec",
  7165. "bcf_record_check",
  7166. "bcf_dec_size_safe",
  7167. "bcf_dec_typed_int1_safe"
  7168. ],
  7169. "group_size": 8,
  7170. "functions": [
  7171. {
  7172. "func": "int bcf_readrec(BGZF *fp, void *null, void *vv, int *tid, hts_pos_t *beg, hts_pos_t *end)\n{\n bcf1_t *v = (bcf1_t *) vv;\n int ret = bcf_read1_core(fp, v);\n if (ret == 0) ret = bcf_record_check(NULL, v);\n if (ret >= 0)\n *tid = v->rid, *beg = v->pos, *end = v->pos + v->rlen;\n return ret;\n}",
  7173. "project": "htslib",
  7174. "hash": 33818452448365810705567639192787771876,
  7175. "size": 9,
  7176. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7177. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7178. "target": 0,
  7179. "dataset": "other",
  7180. "idx": 402249
  7181. },
  7182. {
  7183. "func": "static int bcf_dec_size_safe(uint8_t *p, uint8_t *end, uint8_t **q,\n int *num, int *type) {\n int r;\n if (p >= end) return -1;\n *type = *p & 0xf;\n if (*p>>4 != 15) {\n *q = p + 1;\n *num = *p >> 4;\n return 0;\n }\n r = bcf_dec_typed_int1_safe(p + 1, end, q, num);\n if (r) return r;\n return *num >= 0 ? 0 : -1;\n}",
  7184. "project": "htslib",
  7185. "hash": 141373285537262292830683104823021389913,
  7186. "size": 14,
  7187. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7188. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7189. "target": 0,
  7190. "dataset": "other",
  7191. "idx": 402201
  7192. },
  7193. {
  7194. "func": "static int bcf_dec_typed_int1_safe(uint8_t *p, uint8_t *end, uint8_t **q,\n int32_t *val) {\n uint32_t t;\n if (end - p < 2) return -1;\n t = *p++ & 0xf;\n /* Use if .. else if ... else instead of switch to force order. Assumption\n is that small integers are more frequent than big ones. */\n if (t == BCF_BT_INT8) {\n *q = p + 1;\n *val = *(int8_t *) p;\n } else if (t == BCF_BT_INT16) {\n if (end - p < 2) return -1;\n *q = p + 2;\n *val = le_to_i16(p);\n } else if (t == BCF_BT_INT32) {\n if (end - p < 4) return -1;\n *q = p + 4;\n *val = le_to_i32(p);\n#ifdef VCF_ALLOW_INT64\n } else if (t == BCF_BT_INT64) {\n // This case should never happen because there should be no 64-bit BCFs\n // at all, definitely not coming from htslib\n if (end - p < 8) return -1;\n *q = p + 8;\n *val = le_to_i64(p);\n#endif\n } else {\n return -1;\n }\n return 0;\n}",
  7195. "project": "htslib",
  7196. "hash": 234731386941793576194670991723107717916,
  7197. "size": 31,
  7198. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7199. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7200. "target": 0,
  7201. "dataset": "other",
  7202. "idx": 402180
  7203. },
  7204. {
  7205. "func": "static inline int bcf_read1_core(BGZF *fp, bcf1_t *v)\n{\n uint8_t x[32];\n ssize_t ret;\n uint32_t shared_len, indiv_len;\n if ((ret = bgzf_read(fp, x, 32)) != 32) {\n if (ret == 0) return -1;\n return -2;\n }\n bcf_clear1(v);\n shared_len = le_to_u32(x);\n if (shared_len < 24) return -2;\n shared_len -= 24; // to exclude six 32-bit integers\n if (ks_resize(&v->shared, shared_len) != 0) return -2;\n indiv_len = le_to_u32(x + 4);\n if (ks_resize(&v->indiv, indiv_len) != 0) return -2;\n v->rid = le_to_i32(x + 8);\n v->pos = le_to_u32(x + 12);\n v->rlen = le_to_i32(x + 16);\n v->qual = le_to_float(x + 20);\n v->n_info = le_to_u16(x + 24);\n v->n_allele = le_to_u16(x + 26);\n v->n_sample = le_to_u32(x + 28) & 0xffffff;\n v->n_fmt = x[31];\n v->shared.l = shared_len;\n v->indiv.l = indiv_len;\n // silent fix of broken BCFs produced by earlier versions of bcf_subset, prior to and including bd6ed8b4\n if ( (!v->indiv.l || !v->n_sample) && v->n_fmt ) v->n_fmt = 0;\n\n if (bgzf_read(fp, v->shared.s, v->shared.l) != v->shared.l) return -2;\n if (bgzf_read(fp, v->indiv.s, v->indiv.l) != v->indiv.l) return -2;\n return 0;\n}",
  7206. "project": "htslib",
  7207. "hash": 12751460557049634954365934146773465993,
  7208. "size": 33,
  7209. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7210. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7211. "target": 0,
  7212. "dataset": "other",
  7213. "idx": 402240
  7214. },
  7215. {
  7216. "func": "static int bcf_record_check(const bcf_hdr_t *hdr, bcf1_t *rec) {\n uint8_t *ptr, *end;\n size_t bytes;\n uint32_t err = 0;\n int type = 0;\n int num = 0;\n int reflen = 0;\n uint32_t i, reports;\n const uint32_t is_integer = ((1 << BCF_BT_INT8) |\n (1 << BCF_BT_INT16) |\n#ifdef VCF_ALLOW_INT64\n (1 << BCF_BT_INT64) |\n#endif\n (1 << BCF_BT_INT32));\n const uint32_t is_valid_type = (is_integer |\n (1 << BCF_BT_NULL) |\n (1 << BCF_BT_FLOAT) |\n (1 << BCF_BT_CHAR));\n int32_t max_id = hdr ? hdr->n[BCF_DT_ID] : 0;\n\n // Check for valid contig ID\n if (rec->rid < 0\n || (hdr && (rec->rid >= hdr->n[BCF_DT_CTG]\n || hdr->id[BCF_DT_CTG][rec->rid].key == NULL))) {\n hts_log_warning(\"Bad BCF record at %\"PRIhts_pos\": Invalid %s id %d\", rec->pos+1, \"CONTIG\", rec->rid);\n err |= BCF_ERR_CTG_INVALID;\n }\n\n // Check ID\n ptr = (uint8_t *) rec->shared.s;\n end = ptr + rec->shared.l;\n if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared;\n if (type != BCF_BT_CHAR) {\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"ID\", type, get_type_name(type));\n err |= BCF_ERR_TAG_INVALID;\n }\n bytes = (size_t) num << bcf_type_shift[type];\n if (end - ptr < bytes) goto bad_shared;\n ptr += bytes;\n\n // Check REF and ALT\n reports = 0;\n for (i = 0; i < rec->n_allele; i++) {\n if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared;\n if (type != BCF_BT_CHAR) {\n if (!reports++ || hts_verbose >= HTS_LOG_DEBUG)\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"REF/ALT\", type, get_type_name(type));\n err |= BCF_ERR_CHAR;\n }\n if (i == 0) reflen = num;\n bytes = (size_t) num << bcf_type_shift[type];\n if (end - ptr < bytes) goto bad_shared;\n ptr += bytes;\n }\n\n // Check FILTER\n reports = 0;\n if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared;\n if (num > 0) {\n bytes = (size_t) num << bcf_type_shift[type];\n if (((1 << type) & is_integer) == 0) {\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FILTER\", type, get_type_name(type));\n err |= BCF_ERR_TAG_INVALID;\n if (end - ptr < bytes) goto bad_shared;\n ptr += bytes;\n } else {\n if (end - ptr < bytes) goto bad_shared;\n for (i = 0; i < num; i++) {\n int32_t key = bcf_dec_int1(ptr, type, &ptr);\n if (key < 0\n || (hdr && (key >= max_id\n || hdr->id[BCF_DT_ID][key].key == NULL))) {\n if (!reports++ || hts_verbose >= HTS_LOG_DEBUG)\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s id %d\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FILTER\", key);\n err |= BCF_ERR_TAG_UNDEF;\n }\n }\n }\n }\n\n // Check INFO\n reports = 0;\n for (i = 0; i < rec->n_info; i++) {\n int32_t key = -1;\n if (bcf_dec_typed_int1_safe(ptr, end, &ptr, &key) != 0) goto bad_shared;\n if (key < 0 || (hdr && (key >= max_id\n || hdr->id[BCF_DT_ID][key].key == NULL))) {\n if (!reports++ || hts_verbose >= HTS_LOG_DEBUG)\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s id %d\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"INFO\", key);\n err |= BCF_ERR_TAG_UNDEF;\n }\n if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_shared;\n if (((1 << type) & is_valid_type) == 0) {\n if (!reports++ || hts_verbose >= HTS_LOG_DEBUG)\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"INFO\", type, get_type_name(type));\n err |= BCF_ERR_TAG_INVALID;\n }\n bytes = (size_t) num << bcf_type_shift[type];\n if (end - ptr < bytes) goto bad_shared;\n ptr += bytes;\n }\n\n // Check FORMAT and individual information\n ptr = (uint8_t *) rec->indiv.s;\n end = ptr + rec->indiv.l;\n reports = 0;\n for (i = 0; i < rec->n_fmt; i++) {\n int32_t key = -1;\n if (bcf_dec_typed_int1_safe(ptr, end, &ptr, &key) != 0) goto bad_indiv;\n if (key < 0\n || (hdr && (key >= max_id\n || hdr->id[BCF_DT_ID][key].key == NULL))) {\n if (!reports++ || hts_verbose >= HTS_LOG_DEBUG)\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s id %d\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FORMAT\", key);\n err |= BCF_ERR_TAG_UNDEF;\n }\n if (bcf_dec_size_safe(ptr, end, &ptr, &num, &type) != 0) goto bad_indiv;\n if (((1 << type) & is_valid_type) == 0) {\n if (!reports++ || hts_verbose >= HTS_LOG_DEBUG)\n hts_log_warning(\"Bad BCF record at %s:%\"PRIhts_pos\": Invalid %s type %d (%s)\", bcf_seqname_safe(hdr,rec), rec->pos+1, \"FORMAT\", type, get_type_name(type));\n err |= BCF_ERR_TAG_INVALID;\n }\n bytes = ((size_t) num << bcf_type_shift[type]) * rec->n_sample;\n if (end - ptr < bytes) goto bad_indiv;\n ptr += bytes;\n }\n\n if (!err && rec->rlen < 0) {\n // Treat bad rlen as a warning instead of an error, and try to\n // fix up by using the length of the stored REF allele.\n static int warned = 0;\n if (!warned) {\n hts_log_warning(\"BCF record at %s:%\"PRIhts_pos\" has invalid RLEN (%\"PRIhts_pos\"). \"\n \"Only one invalid RLEN will be reported.\",\n bcf_seqname_safe(hdr,rec), rec->pos+1, rec->rlen);\n warned = 1;\n }\n rec->rlen = reflen >= 0 ? reflen : 0;\n }\n\n rec->errcode |= err;\n\n return err ? -2 : 0; // Return -2 so bcf_read() reports an error\n\n bad_shared:\n hts_log_error(\"Bad BCF record at %s:%\"PRIhts_pos\" - shared section malformed or too short\", bcf_seqname_safe(hdr,rec), rec->pos+1);\n return -2;\n\n bad_indiv:\n hts_log_error(\"Bad BCF record at %s:%\"PRIhts_pos\" - individuals section malformed or too short\", bcf_seqname_safe(hdr,rec), rec->pos+1);\n return -2;\n}",
  7217. "project": "htslib",
  7218. "hash": 13043732940354638373013501762813051039,
  7219. "size": 152,
  7220. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7221. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7222. "target": 0,
  7223. "dataset": "other",
  7224. "idx": 402177
  7225. },
  7226. {
  7227. "func": "int vcf_read(htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)\n{\n int ret;\n ret = hts_getline(fp, KS_SEP_LINE, &fp->line);\n if (ret < 0) return ret;\n return vcf_parse1(&fp->line, h, v);\n}",
  7228. "project": "htslib",
  7229. "hash": 18430956208465103548864436074290095431,
  7230. "size": 7,
  7231. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7232. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7233. "target": 0,
  7234. "dataset": "other",
  7235. "idx": 402182
  7236. },
  7237. {
  7238. "func": "int bcf_subset_format(const bcf_hdr_t *hdr, bcf1_t *rec)\n{\n if ( !hdr->keep_samples ) return 0;\n if ( !bcf_hdr_nsamples(hdr) )\n {\n rec->indiv.l = rec->n_sample = 0;\n return 0;\n }\n\n int i, j;\n uint8_t *ptr = (uint8_t*)rec->indiv.s, *dst = NULL, *src;\n bcf_dec_t *dec = &rec->d;\n hts_expand(bcf_fmt_t, rec->n_fmt, dec->m_fmt, dec->fmt);\n for (i=0; i<dec->m_fmt; ++i) dec->fmt[i].p_free = 0;\n\n for (i=0; i<rec->n_fmt; i++)\n {\n ptr = bcf_unpack_fmt_core1(ptr, rec->n_sample, &dec->fmt[i]);\n src = dec->fmt[i].p - dec->fmt[i].size;\n if ( dst )\n {\n memmove(dec->fmt[i-1].p + dec->fmt[i-1].p_len, dec->fmt[i].p - dec->fmt[i].p_off, dec->fmt[i].p_off);\n dec->fmt[i].p = dec->fmt[i-1].p + dec->fmt[i-1].p_len + dec->fmt[i].p_off;\n }\n dst = dec->fmt[i].p;\n for (j=0; j<hdr->nsamples_ori; j++)\n {\n src += dec->fmt[i].size;\n if ( !bit_array_test(hdr->keep_samples,j) ) continue;\n memmove(dst, src, dec->fmt[i].size);\n dst += dec->fmt[i].size;\n }\n rec->indiv.l -= dec->fmt[i].p_len - (dst - dec->fmt[i].p);\n dec->fmt[i].p_len = dst - dec->fmt[i].p;\n }\n rec->unpacked |= BCF_UN_FMT;\n\n rec->n_sample = bcf_hdr_nsamples(hdr);\n return 0;\n}",
  7239. "project": "htslib",
  7240. "hash": 313869283831717057726771406159143661219,
  7241. "size": 40,
  7242. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7243. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7244. "target": 0,
  7245. "dataset": "other",
  7246. "idx": 402194
  7247. },
  7248. {
  7249. "func": "int bcf_read(htsFile *fp, const bcf_hdr_t *h, bcf1_t *v)\n{\n if (fp->format.format == vcf) return vcf_read(fp,h,v);\n int ret = bcf_read1_core(fp->fp.bgzf, v);\n if (ret == 0) ret = bcf_record_check(h, v);\n if ( ret!=0 || !h->keep_samples ) return ret;\n return bcf_subset_format(h,v);\n}",
  7250. "project": "htslib",
  7251. "hash": 59715034301581063666044249619776521944,
  7252. "size": 8,
  7253. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  7254. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  7255. "target": 0,
  7256. "dataset": "other",
  7257. "idx": 402164
  7258. }
  7259. ]
  7260. },
  7261. {
  7262. "call_depth": 3,
  7263. "longest_call_chain": [
  7264. "util_get_sys_driver",
  7265. "get_sys_link",
  7266. "util_strlcpy"
  7267. ],
  7268. "group_size": 6,
  7269. "functions": [
  7270. {
  7271. "func": "static ssize_t get_sys_link(struct udev *udev, const char *slink, const char *syspath, char *value, size_t size)\n{\n\tchar path[UTIL_PATH_SIZE];\n\tssize_t len;\n\tconst char *pos;\n\n\tutil_strlcpy(path, syspath, sizeof(path));\n\tutil_strlcat(path, \"/\", sizeof(path));\n\tutil_strlcat(path, slink, sizeof(path));\n\tlen = readlink(path, path, sizeof(path));\n\tif (len < 0 || len >= (ssize_t) sizeof(path))\n\t\treturn -1;\n\tpath[len] = '\\0';\n\tpos = strrchr(path, '/');\n\tif (pos == NULL)\n\t\treturn -1;\n\tpos = &pos[1];\n\tdbg(udev, \"resolved link to: '%s'\\n\", pos);\n\treturn util_strlcpy(value, pos, size);\n}",
  7272. "target": 0,
  7273. "cwe": [
  7274. "CWE-120"
  7275. ],
  7276. "project": "udev",
  7277. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  7278. "hash": 170706486389395120822766530533024339126,
  7279. "size": 20,
  7280. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  7281. "dataset": "other",
  7282. "idx": 490337
  7283. },
  7284. {
  7285. "func": "size_t util_strlcpy(char *dst, const char *src, size_t size)\n{\n\tsize_t bytes = 0;\n\tchar *q = dst;\n\tconst char *p = src;\n\tchar ch;\n\n\twhile ((ch = *p++)) {\n\t\tif (bytes+1 < size)\n\t\t\t*q++ = ch;\n\t\tbytes++;\n\t}\n\n\t/* If size == 0 there is no space for a final null... */\n\tif (size)\n\t\t*q = '\\0';\n\treturn bytes;\n}",
  7286. "target": 0,
  7287. "cwe": [
  7288. "CWE-120"
  7289. ],
  7290. "project": "udev",
  7291. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  7292. "hash": 59372724724277103526580946639086123403,
  7293. "size": 18,
  7294. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  7295. "dataset": "other",
  7296. "idx": 490330
  7297. },
  7298. {
  7299. "func": "int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)\n{\n\tchar link_target[UTIL_PATH_SIZE];\n\n\tint len;\n\tint i;\n\tint back;\n\n\tlen = readlink(syspath, link_target, sizeof(link_target));\n\tif (len <= 0)\n\t\treturn -1;\n\tlink_target[len] = '\\0';\n\tdbg(udev, \"path link '%s' points to '%s'\\n\", syspath, link_target);\n\n\tfor (back = 0; strncmp(&link_target[back * 3], \"../\", 3) == 0; back++)\n\t\t;\n\tdbg(udev, \"base '%s', tail '%s', back %i\\n\", syspath, &link_target[back * 3], back);\n\tfor (i = 0; i <= back; i++) {\n\t\tchar *pos = strrchr(syspath, '/');\n\n\t\tif (pos == NULL)\n\t\t\treturn -1;\n\t\tpos[0] = '\\0';\n\t}\n\tdbg(udev, \"after moving back '%s'\\n\", syspath);\n\tutil_strlcat(syspath, \"/\", size);\n\tutil_strlcat(syspath, &link_target[back * 3], size);\n\treturn 0;\n}",
  7300. "target": 0,
  7301. "cwe": [
  7302. "CWE-120"
  7303. ],
  7304. "project": "udev",
  7305. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  7306. "hash": 245499895849437487231202101375366456480,
  7307. "size": 29,
  7308. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  7309. "dataset": "other",
  7310. "idx": 490343
  7311. },
  7312. {
  7313. "func": "ssize_t util_get_sys_subsystem(struct udev *udev, const char *syspath, char *subsystem, size_t size)\n{\n\treturn get_sys_link(udev, \"subsystem\", syspath, subsystem, size);\n}",
  7314. "target": 0,
  7315. "cwe": [
  7316. "CWE-120"
  7317. ],
  7318. "project": "udev",
  7319. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  7320. "hash": 59667652336681995129715824807812589835,
  7321. "size": 4,
  7322. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  7323. "dataset": "other",
  7324. "idx": 490340
  7325. },
  7326. {
  7327. "func": "size_t util_strlcat(char *dst, const char *src, size_t size)\n{\n\tsize_t bytes = 0;\n\tchar *q = dst;\n\tconst char *p = src;\n\tchar ch;\n\n\twhile (bytes < size && *q) {\n\t\tq++;\n\t\tbytes++;\n\t}\n\tif (bytes == size)\n\t\treturn (bytes + strlen(src));\n\n\twhile ((ch = *p++)) {\n\t\tif (bytes+1 < size)\n\t\t*q++ = ch;\n\t\tbytes++;\n\t}\n\n\t*q = '\\0';\n\treturn bytes;\n}",
  7328. "target": 0,
  7329. "cwe": [
  7330. "CWE-120"
  7331. ],
  7332. "project": "udev",
  7333. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  7334. "hash": 30325727257915378446130966860726349935,
  7335. "size": 23,
  7336. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  7337. "dataset": "other",
  7338. "idx": 490334
  7339. },
  7340. {
  7341. "func": "ssize_t util_get_sys_driver(struct udev *udev, const char *syspath, char *driver, size_t size)\n{\n\treturn get_sys_link(udev, \"driver\", syspath, driver, size);\n}",
  7342. "target": 0,
  7343. "cwe": [
  7344. "CWE-120"
  7345. ],
  7346. "project": "udev",
  7347. "commit_id": "662c3110803bd8c1aedacc36788e6fd028944314",
  7348. "hash": 238852136861315201702598224768757912017,
  7349. "size": 4,
  7350. "message": "path_encode: fix max length calculation\n\nSebastian Krahmer wrote:\n> it should reserve 4 times not 3 times len :)",
  7351. "dataset": "other",
  7352. "idx": 490335
  7353. }
  7354. ]
  7355. },
  7356. {
  7357. "call_depth": 5,
  7358. "longest_call_chain": [
  7359. "kvm_s390_init",
  7360. "kvm_init",
  7361. "kvm_arch_init",
  7362. "kvm_s390_cpu_feat_init",
  7363. "plo_test_bit"
  7364. ],
  7365. "group_size": 19,
  7366. "functions": [
  7367. {
  7368. "func": "void kvm_arch_hardware_unsetup(void)\n{\n\tgmap_unregister_pte_notifier(&gmap_notifier);\n\tgmap_unregister_pte_notifier(&vsie_gmap_notifier);\n\tatomic_notifier_chain_unregister(&s390_epoch_delta_notifier,\n\t\t\t\t\t &kvm_clock_notifier);\n}",
  7369. "project": "linux",
  7370. "hash": 118410648668929952188309157932227420309,
  7371. "size": 7,
  7372. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7373. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7374. "target": 0,
  7375. "dataset": "other",
  7376. "idx": 354646
  7377. },
  7378. {
  7379. "func": "static void allow_cpu_feat(unsigned long nr)\n{\n\tset_bit_inv(nr, kvm_s390_available_cpu_feat);\n}",
  7380. "project": "linux",
  7381. "hash": 58534131025806512193431115757019879069,
  7382. "size": 4,
  7383. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7384. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7385. "target": 0,
  7386. "dataset": "other",
  7387. "idx": 354813
  7388. },
  7389. {
  7390. "func": "void kvm_exit(void)\n{\n\tdebugfs_remove_recursive(kvm_debugfs_dir);\n\tmisc_deregister(&kvm_dev);\n\tkmem_cache_destroy(kvm_vcpu_cache);\n\tkvm_async_pf_deinit();\n\tunregister_syscore_ops(&kvm_syscore_ops);\n\tunregister_reboot_notifier(&kvm_reboot_notifier);\n\tcpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING);\n\ton_each_cpu(hardware_disable_nolock, NULL, 1);\n\tkvm_arch_hardware_unsetup();\n\tkvm_arch_exit();\n\tkvm_irqfd_exit();\n\tfree_cpumask_var(cpus_hardware_enabled);\n\tkvm_vfio_ops_exit();\n}",
  7391. "project": "linux",
  7392. "hash": 110360090557712778110742486871748305796,
  7393. "size": 16,
  7394. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7395. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7396. "target": 0,
  7397. "dataset": "other",
  7398. "idx": 354697
  7399. },
  7400. {
  7401. "func": "int kvm_register_device_ops(const struct kvm_device_ops *ops, u32 type)\n{\n\tif (type >= ARRAY_SIZE(kvm_device_ops_table))\n\t\treturn -ENOSPC;\n\n\tif (kvm_device_ops_table[type] != NULL)\n\t\treturn -EEXIST;\n\n\tkvm_device_ops_table[type] = ops;\n\treturn 0;\n}",
  7402. "project": "linux",
  7403. "hash": 232948124377679066507315942381763154126,
  7404. "size": 11,
  7405. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7406. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7407. "target": 0,
  7408. "dataset": "other",
  7409. "idx": 354574
  7410. },
  7411. {
  7412. "func": "static int __init kvm_s390_init(void)\n{\n\tint i;\n\n\tif (!sclp.has_sief2) {\n\t\tpr_info(\"SIE is not available\\n\");\n\t\treturn -ENODEV;\n\t}\n\n\tif (nested && hpage) {\n\t\tpr_info(\"A KVM host that supports nesting cannot back its KVM guests with huge pages\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tfor (i = 0; i < 16; i++)\n\t\tkvm_s390_fac_base[i] |=\n\t\t\tS390_lowcore.stfle_fac_list[i] & nonhyp_mask(i);\n\n\treturn kvm_init(NULL, sizeof(struct kvm_vcpu), 0, THIS_MODULE);\n}",
  7413. "project": "linux",
  7414. "hash": 288670679547903781264614562238410701976,
  7415. "size": 20,
  7416. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7417. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7418. "target": 0,
  7419. "dataset": "other",
  7420. "idx": 354599
  7421. },
  7422. {
  7423. "func": "static void __exit kvm_s390_exit(void)\n{\n\tkvm_exit();\n}",
  7424. "project": "linux",
  7425. "hash": 248698086826202118304438027615529929353,
  7426. "size": 4,
  7427. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7428. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7429. "target": 0,
  7430. "dataset": "other",
  7431. "idx": 354771
  7432. },
  7433. {
  7434. "func": "int kvm_arch_hardware_setup(void)\n{\n\tgmap_notifier.notifier_call = kvm_gmap_notifier;\n\tgmap_register_pte_notifier(&gmap_notifier);\n\tvsie_gmap_notifier.notifier_call = kvm_s390_vsie_gmap_notifier;\n\tgmap_register_pte_notifier(&vsie_gmap_notifier);\n\tatomic_notifier_chain_register(&s390_epoch_delta_notifier,\n\t\t\t\t &kvm_clock_notifier);\n\treturn 0;\n}",
  7435. "project": "linux",
  7436. "hash": 324031969922159705961758940599685394203,
  7437. "size": 10,
  7438. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7439. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7440. "target": 0,
  7441. "dataset": "other",
  7442. "idx": 354759
  7443. },
  7444. {
  7445. "func": "static void kvm_init_debug(void)\n{\n\tstruct kvm_stats_debugfs_item *p;\n\n\tkvm_debugfs_dir = debugfs_create_dir(\"kvm\", NULL);\n\n\tkvm_debugfs_num_entries = 0;\n\tfor (p = debugfs_entries; p->name; ++p, kvm_debugfs_num_entries++) {\n\t\tdebugfs_create_file(p->name, KVM_DBGFS_GET_MODE(p),\n\t\t\t\t kvm_debugfs_dir, (void *)(long)p->offset,\n\t\t\t\t stat_fops[p->kind]);\n\t}\n}",
  7446. "project": "linux",
  7447. "hash": 284594237410303027503162658836886958191,
  7448. "size": 13,
  7449. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7450. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7451. "target": 0,
  7452. "dataset": "other",
  7453. "idx": 354499
  7454. },
  7455. {
  7456. "func": "int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,\n\t\t struct module *module)\n{\n\tint r;\n\tint cpu;\n\n\tr = kvm_arch_init(opaque);\n\tif (r)\n\t\tgoto out_fail;\n\n\t/*\n\t * kvm_arch_init makes sure there's at most one caller\n\t * for architectures that support multiple implementations,\n\t * like intel and amd on x86.\n\t * kvm_arch_init must be called before kvm_irqfd_init to avoid creating\n\t * conflicts in case kvm is already setup for another implementation.\n\t */\n\tr = kvm_irqfd_init();\n\tif (r)\n\t\tgoto out_irqfd;\n\n\tif (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) {\n\t\tr = -ENOMEM;\n\t\tgoto out_free_0;\n\t}\n\n\tr = kvm_arch_hardware_setup();\n\tif (r < 0)\n\t\tgoto out_free_1;\n\n\tfor_each_online_cpu(cpu) {\n\t\tsmp_call_function_single(cpu, check_processor_compat, &r, 1);\n\t\tif (r < 0)\n\t\t\tgoto out_free_2;\n\t}\n\n\tr = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_STARTING, \"kvm/cpu:starting\",\n\t\t\t\t kvm_starting_cpu, kvm_dying_cpu);\n\tif (r)\n\t\tgoto out_free_2;\n\tregister_reboot_notifier(&kvm_reboot_notifier);\n\n\t/* A kmem cache lets us meet the alignment requirements of fx_save. */\n\tif (!vcpu_align)\n\t\tvcpu_align = __alignof__(struct kvm_vcpu);\n\tkvm_vcpu_cache =\n\t\tkmem_cache_create_usercopy(\"kvm_vcpu\", vcpu_size, vcpu_align,\n\t\t\t\t\t SLAB_ACCOUNT,\n\t\t\t\t\t offsetof(struct kvm_vcpu, arch),\n\t\t\t\t\t sizeof_field(struct kvm_vcpu, arch),\n\t\t\t\t\t NULL);\n\tif (!kvm_vcpu_cache) {\n\t\tr = -ENOMEM;\n\t\tgoto out_free_3;\n\t}\n\n\tr = kvm_async_pf_init();\n\tif (r)\n\t\tgoto out_free;\n\n\tkvm_chardev_ops.owner = module;\n\tkvm_vm_fops.owner = module;\n\tkvm_vcpu_fops.owner = module;\n\n\tr = misc_register(&kvm_dev);\n\tif (r) {\n\t\tpr_err(\"kvm: misc device register failed\\n\");\n\t\tgoto out_unreg;\n\t}\n\n\tregister_syscore_ops(&kvm_syscore_ops);\n\n\tkvm_preempt_ops.sched_in = kvm_sched_in;\n\tkvm_preempt_ops.sched_out = kvm_sched_out;\n\n\tkvm_init_debug();\n\n\tr = kvm_vfio_ops_init();\n\tWARN_ON(r);\n\n\treturn 0;\n\nout_unreg:\n\tkvm_async_pf_deinit();\nout_free:\n\tkmem_cache_destroy(kvm_vcpu_cache);\nout_free_3:\n\tunregister_reboot_notifier(&kvm_reboot_notifier);\n\tcpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING);\nout_free_2:\n\tkvm_arch_hardware_unsetup();\nout_free_1:\n\tfree_cpumask_var(cpus_hardware_enabled);\nout_free_0:\n\tkvm_irqfd_exit();\nout_irqfd:\n\tkvm_arch_exit();\nout_fail:\n\treturn r;\n}",
  7457. "project": "linux",
  7458. "hash": 340188414203951212590925148914986464449,
  7459. "size": 100,
  7460. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7461. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7462. "target": 0,
  7463. "dataset": "other",
  7464. "idx": 354653
  7465. },
  7466. {
  7467. "func": "int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align,\n\t\t struct module *module)\n{\n\tstruct kvm_cpu_compat_check c;\n\tint r;\n\tint cpu;\n\n\tr = kvm_arch_init(opaque);\n\tif (r)\n\t\tgoto out_fail;\n\n\t/*\n\t * kvm_arch_init makes sure there's at most one caller\n\t * for architectures that support multiple implementations,\n\t * like intel and amd on x86.\n\t * kvm_arch_init must be called before kvm_irqfd_init to avoid creating\n\t * conflicts in case kvm is already setup for another implementation.\n\t */\n\tr = kvm_irqfd_init();\n\tif (r)\n\t\tgoto out_irqfd;\n\n\tif (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) {\n\t\tr = -ENOMEM;\n\t\tgoto out_free_0;\n\t}\n\n\tr = kvm_arch_hardware_setup(opaque);\n\tif (r < 0)\n\t\tgoto out_free_1;\n\n\tc.ret = &r;\n\tc.opaque = opaque;\n\tfor_each_online_cpu(cpu) {\n\t\tsmp_call_function_single(cpu, check_processor_compat, &c, 1);\n\t\tif (r < 0)\n\t\t\tgoto out_free_2;\n\t}\n\n\tr = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_STARTING, \"kvm/cpu:starting\",\n\t\t\t\t kvm_starting_cpu, kvm_dying_cpu);\n\tif (r)\n\t\tgoto out_free_2;\n\tregister_reboot_notifier(&kvm_reboot_notifier);\n\n\t/* A kmem cache lets us meet the alignment requirements of fx_save. */\n\tif (!vcpu_align)\n\t\tvcpu_align = __alignof__(struct kvm_vcpu);\n\tkvm_vcpu_cache =\n\t\tkmem_cache_create_usercopy(\"kvm_vcpu\", vcpu_size, vcpu_align,\n\t\t\t\t\t SLAB_ACCOUNT,\n\t\t\t\t\t offsetof(struct kvm_vcpu, arch),\n\t\t\t\t\t sizeof_field(struct kvm_vcpu, arch),\n\t\t\t\t\t NULL);\n\tif (!kvm_vcpu_cache) {\n\t\tr = -ENOMEM;\n\t\tgoto out_free_3;\n\t}\n\n\tr = kvm_async_pf_init();\n\tif (r)\n\t\tgoto out_free;\n\n\tkvm_chardev_ops.owner = module;\n\tkvm_vm_fops.owner = module;\n\tkvm_vcpu_fops.owner = module;\n\n\tr = misc_register(&kvm_dev);\n\tif (r) {\n\t\tpr_err(\"kvm: misc device register failed\\n\");\n\t\tgoto out_unreg;\n\t}\n\n\tregister_syscore_ops(&kvm_syscore_ops);\n\n\tkvm_preempt_ops.sched_in = kvm_sched_in;\n\tkvm_preempt_ops.sched_out = kvm_sched_out;\n\n\tkvm_init_debug();\n\n\tr = kvm_vfio_ops_init();\n\tWARN_ON(r);\n\n\treturn 0;\n\nout_unreg:\n\tkvm_async_pf_deinit();\nout_free:\n\tkmem_cache_destroy(kvm_vcpu_cache);\nout_free_3:\n\tunregister_reboot_notifier(&kvm_reboot_notifier);\n\tcpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING);\nout_free_2:\n\tkvm_arch_hardware_unsetup();\nout_free_1:\n\tfree_cpumask_var(cpus_hardware_enabled);\nout_free_0:\n\tkvm_irqfd_exit();\nout_irqfd:\n\tkvm_arch_exit();\nout_fail:\n\treturn r;\n}",
  7468. "project": "linux",
  7469. "hash": 176440226956519822303124770590062821303,
  7470. "size": 103,
  7471. "commit_id": "f8be156be163a052a067306417cd0ff679068c97",
  7472. "message": "KVM: do not allow mapping valid but non-reference-counted pages\n\nIt's possible to create a region which maps valid but non-refcounted\npages (e.g., tail pages of non-compound higher order allocations). These\nhost pages can then be returned by gfn_to_page, gfn_to_pfn, etc., family\nof APIs, which take a reference to the page, which takes it from 0 to 1.\nWhen the reference is dropped, this will free the page incorrectly.\n\nFix this by only taking a reference on valid pages if it was non-zero,\nwhich indicates it is participating in normal refcounting (and can be\nreleased with put_page).\n\nThis addresses CVE-2021-22543.\n\nSigned-off-by: Nicholas Piggin <npiggin@gmail.com>\nTested-by: Paolo Bonzini <pbonzini@redhat.com>\nCc: stable@vger.kernel.org\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7473. "target": 0,
  7474. "dataset": "other",
  7475. "idx": 404089
  7476. },
  7477. {
  7478. "func": "static inline int plo_test_bit(unsigned char nr)\n{\n\tregister unsigned long r0 asm(\"0\") = (unsigned long) nr | 0x100;\n\tint cc;\n\n\tasm volatile(\n\t\t/* Parameter registers are ignored for \"test bit\" */\n\t\t\"\tplo\t0,0,0,0(0)\\n\"\n\t\t\"\tipm\t%0\\n\"\n\t\t\"\tsrl\t%0,28\\n\"\n\t\t: \"=d\" (cc)\n\t\t: \"d\" (r0)\n\t\t: \"cc\");\n\treturn cc == 0;\n}",
  7479. "project": "linux",
  7480. "hash": 178528055475595019807452522195902906438,
  7481. "size": 15,
  7482. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7483. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7484. "target": 0,
  7485. "dataset": "other",
  7486. "idx": 354520
  7487. },
  7488. {
  7489. "func": "static __always_inline void __insn32_query(unsigned int opcode, u8 *query)\n{\n\tregister unsigned long r0 asm(\"0\") = 0;\t/* query function */\n\tregister unsigned long r1 asm(\"1\") = (unsigned long) query;\n\n\tasm volatile(\n\t\t/* Parameter regs are ignored */\n\t\t\"\t.insn\trrf,%[opc] << 16,2,4,6,0\\n\"\n\t\t:\n\t\t: \"d\" (r0), \"a\" (r1), [opc] \"i\" (opcode)\n\t\t: \"cc\", \"memory\");\n}",
  7490. "project": "linux",
  7491. "hash": 332085282912820967174711196860279370154,
  7492. "size": 12,
  7493. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7494. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7495. "target": 0,
  7496. "dataset": "other",
  7497. "idx": 354586
  7498. },
  7499. {
  7500. "func": "void kvm_arch_exit(void)\n{\n\tkvm_s390_gib_destroy();\n\tdebug_unregister(kvm_s390_dbf);\n\tdebug_unregister(kvm_s390_dbf_uv);\n}",
  7501. "project": "linux",
  7502. "hash": 50746226886408816541434632809114833964,
  7503. "size": 6,
  7504. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7505. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7506. "target": 0,
  7507. "dataset": "other",
  7508. "idx": 354444
  7509. },
  7510. {
  7511. "func": "static inline void kvm_irqfd_exit(void)\n{\n}",
  7512. "project": "linux",
  7513. "hash": 339205263512552737760374083186741470629,
  7514. "size": 3,
  7515. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7516. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7517. "target": 0,
  7518. "dataset": "other",
  7519. "idx": 354691
  7520. },
  7521. {
  7522. "func": "static inline unsigned long nonhyp_mask(int i)\n{\n\tunsigned int nonhyp_fai = (sclp.hmfai << i * 2) >> 30;\n\n\treturn 0x0000ffffffffffffUL >> (nonhyp_fai << 4);\n}",
  7523. "project": "linux",
  7524. "hash": 105008827821000088978521093673141842577,
  7525. "size": 6,
  7526. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7527. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7528. "target": 0,
  7529. "dataset": "other",
  7530. "idx": 354719
  7531. },
  7532. {
  7533. "func": "static void kvm_s390_cpu_feat_init(void)\n{\n\tint i;\n\n\tfor (i = 0; i < 256; ++i) {\n\t\tif (plo_test_bit(i))\n\t\t\tkvm_s390_available_subfunc.plo[i >> 3] |= 0x80 >> (i & 7);\n\t}\n\n\tif (test_facility(28)) /* TOD-clock steering */\n\t\tptff(kvm_s390_available_subfunc.ptff,\n\t\t sizeof(kvm_s390_available_subfunc.ptff),\n\t\t PTFF_QAF);\n\n\tif (test_facility(17)) { /* MSA */\n\t\t__cpacf_query(CPACF_KMAC, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kmac);\n\t\t__cpacf_query(CPACF_KMC, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kmc);\n\t\t__cpacf_query(CPACF_KM, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.km);\n\t\t__cpacf_query(CPACF_KIMD, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kimd);\n\t\t__cpacf_query(CPACF_KLMD, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.klmd);\n\t}\n\tif (test_facility(76)) /* MSA3 */\n\t\t__cpacf_query(CPACF_PCKMO, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.pckmo);\n\tif (test_facility(77)) { /* MSA4 */\n\t\t__cpacf_query(CPACF_KMCTR, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kmctr);\n\t\t__cpacf_query(CPACF_KMF, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kmf);\n\t\t__cpacf_query(CPACF_KMO, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kmo);\n\t\t__cpacf_query(CPACF_PCC, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.pcc);\n\t}\n\tif (test_facility(57)) /* MSA5 */\n\t\t__cpacf_query(CPACF_PRNO, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.ppno);\n\n\tif (test_facility(146)) /* MSA8 */\n\t\t__cpacf_query(CPACF_KMA, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kma);\n\n\tif (test_facility(155)) /* MSA9 */\n\t\t__cpacf_query(CPACF_KDSA, (cpacf_mask_t *)\n\t\t\t kvm_s390_available_subfunc.kdsa);\n\n\tif (test_facility(150)) /* SORTL */\n\t\t__insn32_query(INSN_SORTL, kvm_s390_available_subfunc.sortl);\n\n\tif (test_facility(151)) /* DFLTCC */\n\t\t__insn32_query(INSN_DFLTCC, kvm_s390_available_subfunc.dfltcc);\n\n\tif (MACHINE_HAS_ESOP)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_ESOP);\n\t/*\n\t * We need SIE support, ESOP (PROT_READ protection for gmap_shadow),\n\t * 64bit SCAO (SCA passthrough) and IDTE (for gmap_shadow unshadowing).\n\t */\n\tif (!sclp.has_sief2 || !MACHINE_HAS_ESOP || !sclp.has_64bscao ||\n\t !test_facility(3) || !nested)\n\t\treturn;\n\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_SIEF2);\n\tif (sclp.has_64bscao)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_64BSCAO);\n\tif (sclp.has_siif)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_SIIF);\n\tif (sclp.has_gpere)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_GPERE);\n\tif (sclp.has_gsls)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_GSLS);\n\tif (sclp.has_ib)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_IB);\n\tif (sclp.has_cei)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_CEI);\n\tif (sclp.has_ibs)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_IBS);\n\tif (sclp.has_kss)\n\t\tallow_cpu_feat(KVM_S390_VM_CPU_FEAT_KSS);\n\t/*\n\t * KVM_S390_VM_CPU_FEAT_SKEY: Wrong shadow of PTE.I bits will make\n\t * all skey handling functions read/set the skey from the PGSTE\n\t * instead of the real storage key.\n\t *\n\t * KVM_S390_VM_CPU_FEAT_CMMA: Wrong shadow of PTE.I bits will make\n\t * pages being detected as preserved although they are resident.\n\t *\n\t * KVM_S390_VM_CPU_FEAT_PFMFI: Wrong shadow of PTE.I bits will\n\t * have the same effect as for KVM_S390_VM_CPU_FEAT_SKEY.\n\t *\n\t * For KVM_S390_VM_CPU_FEAT_SKEY, KVM_S390_VM_CPU_FEAT_CMMA and\n\t * KVM_S390_VM_CPU_FEAT_PFMFI, all PTE.I and PGSTE bits have to be\n\t * correctly shadowed. We can do that for the PGSTE but not for PTE.I.\n\t *\n\t * KVM_S390_VM_CPU_FEAT_SIGPIF: Wrong SCB addresses in the SCA. We\n\t * cannot easily shadow the SCA because of the ipte lock.\n\t */\n}",
  7534. "project": "linux",
  7535. "hash": 38597385791183829234006308514818466630,
  7536. "size": 102,
  7537. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7538. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7539. "target": 0,
  7540. "dataset": "other",
  7541. "idx": 354821
  7542. },
  7543. {
  7544. "func": "int kvm_arch_init(void *opaque)\n{\n\tint rc = -ENOMEM;\n\n\tkvm_s390_dbf = debug_register(\"kvm-trace\", 32, 1, 7 * sizeof(long));\n\tif (!kvm_s390_dbf)\n\t\treturn -ENOMEM;\n\n\tkvm_s390_dbf_uv = debug_register(\"kvm-uv\", 32, 1, 7 * sizeof(long));\n\tif (!kvm_s390_dbf_uv)\n\t\tgoto out;\n\n\tif (debug_register_view(kvm_s390_dbf, &debug_sprintf_view) ||\n\t debug_register_view(kvm_s390_dbf_uv, &debug_sprintf_view))\n\t\tgoto out;\n\n\tkvm_s390_cpu_feat_init();\n\n\t/* Register floating interrupt controller interface. */\n\trc = kvm_register_device_ops(&kvm_flic_ops, KVM_DEV_TYPE_FLIC);\n\tif (rc) {\n\t\tpr_err(\"A FLIC registration call failed with rc=%d\\n\", rc);\n\t\tgoto out;\n\t}\n\n\trc = kvm_s390_gib_init(GAL_ISC);\n\tif (rc)\n\t\tgoto out;\n\n\treturn 0;\n\nout:\n\tkvm_arch_exit();\n\treturn rc;\n}",
  7545. "project": "linux",
  7546. "hash": 308215839477062622451438864859069962733,
  7547. "size": 35,
  7548. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7549. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7550. "target": 0,
  7551. "dataset": "other",
  7552. "idx": 354755
  7553. },
  7554. {
  7555. "func": "static int __init svm_init(void)\n{\n\treturn kvm_init(&svm_x86_ops, sizeof(struct vcpu_svm),\n\t\t\t__alignof__(struct vcpu_svm), THIS_MODULE);\n}",
  7556. "project": "linux",
  7557. "hash": 266626653823426228696872252366063844001,
  7558. "size": 5,
  7559. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  7560. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7561. "target": 0,
  7562. "dataset": "other",
  7563. "idx": 432401
  7564. },
  7565. {
  7566. "func": "static inline int kvm_irqfd_init(void)\n{\n\treturn 0;\n}",
  7567. "project": "linux",
  7568. "hash": 131730289999752891791530367718980670763,
  7569. "size": 4,
  7570. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  7571. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  7572. "target": 0,
  7573. "dataset": "other",
  7574. "idx": 354627
  7575. }
  7576. ]
  7577. },
  7578. {
  7579. "call_depth": 3,
  7580. "longest_call_chain": [
  7581. "vhost_vdpa_process_iotlb_msg",
  7582. "vhost_vdpa_process_iotlb_update",
  7583. "vhost_vdpa_map"
  7584. ],
  7585. "group_size": 3,
  7586. "functions": [
  7587. {
  7588. "func": "static int vhost_vdpa_process_iotlb_msg(struct vhost_dev *dev,\n\t\t\t\t\tstruct vhost_iotlb_msg *msg)\n{\n\tstruct vhost_vdpa *v = container_of(dev, struct vhost_vdpa, vdev);\n\tstruct vdpa_device *vdpa = v->vdpa;\n\tconst struct vdpa_config_ops *ops = vdpa->config;\n\tint r = 0;\n\n\tr = vhost_dev_check_owner(dev);\n\tif (r)\n\t\treturn r;\n\n\tswitch (msg->type) {\n\tcase VHOST_IOTLB_UPDATE:\n\t\tr = vhost_vdpa_process_iotlb_update(v, msg);\n\t\tbreak;\n\tcase VHOST_IOTLB_INVALIDATE:\n\t\tvhost_vdpa_unmap(v, msg->iova, msg->size);\n\t\tbreak;\n\tcase VHOST_IOTLB_BATCH_BEGIN:\n\t\tv->in_batch = true;\n\t\tbreak;\n\tcase VHOST_IOTLB_BATCH_END:\n\t\tif (v->in_batch && ops->set_map)\n\t\t\tops->set_map(vdpa, dev->iotlb);\n\t\tv->in_batch = false;\n\t\tbreak;\n\tdefault:\n\t\tr = -EINVAL;\n\t\tbreak;\n\t}\n\n\treturn r;\n}",
  7589. "project": "linux",
  7590. "hash": 68411474748167562168444684230306994982,
  7591. "size": 34,
  7592. "commit_id": "f6bbf0010ba004f5e90c7aefdebc0ee4bd3283b9",
  7593. "message": "vhost-vdpa: fix use-after-free of v->config_ctx\n\nWhen the 'v->config_ctx' eventfd_ctx reference is released we didn't\nset it to NULL. So if the same character device (e.g. /dev/vhost-vdpa-0)\nis re-opened, the 'v->config_ctx' is invalid and calling again\nvhost_vdpa_config_put() causes use-after-free issues like the\nfollowing refcount_t underflow:\n\n refcount_t: underflow; use-after-free.\n WARNING: CPU: 2 PID: 872 at lib/refcount.c:28 refcount_warn_saturate+0xae/0xf0\n RIP: 0010:refcount_warn_saturate+0xae/0xf0\n Call Trace:\n eventfd_ctx_put+0x5b/0x70\n vhost_vdpa_release+0xcd/0x150 [vhost_vdpa]\n __fput+0x8e/0x240\n ____fput+0xe/0x10\n task_work_run+0x66/0xa0\n exit_to_user_mode_prepare+0x118/0x120\n syscall_exit_to_user_mode+0x21/0x50\n ? __x64_sys_close+0x12/0x40\n do_syscall_64+0x45/0x50\n entry_SYSCALL_64_after_hwframe+0x44/0xae\n\nFixes: 776f395004d8 (\"vhost_vdpa: Support config interrupt in vdpa\")\nCc: lingshan.zhu@intel.com\nCc: stable@vger.kernel.org\nSigned-off-by: Stefano Garzarella <sgarzare@redhat.com>\nLink: https://lore.kernel.org/r/20210311135257.109460-2-sgarzare@redhat.com\nSigned-off-by: Michael S. Tsirkin <mst@redhat.com>\nReviewed-by: Zhu Lingshan <lingshan.zhu@intel.com>\nAcked-by: Jason Wang <jasowang@redhat.com>",
  7594. "target": 0,
  7595. "dataset": "other",
  7596. "idx": 478242
  7597. },
  7598. {
  7599. "func": "static int vhost_vdpa_map(struct vhost_vdpa *v,\n\t\t\t u64 iova, u64 size, u64 pa, u32 perm)\n{\n\tstruct vhost_dev *dev = &v->vdev;\n\tstruct vdpa_device *vdpa = v->vdpa;\n\tconst struct vdpa_config_ops *ops = vdpa->config;\n\tint r = 0;\n\n\tr = vhost_iotlb_add_range(dev->iotlb, iova, iova + size - 1,\n\t\t\t\t pa, perm);\n\tif (r)\n\t\treturn r;\n\n\tif (ops->dma_map) {\n\t\tr = ops->dma_map(vdpa, iova, size, pa, perm);\n\t} else if (ops->set_map) {\n\t\tif (!v->in_batch)\n\t\t\tr = ops->set_map(vdpa, dev->iotlb);\n\t} else {\n\t\tr = iommu_map(v->domain, iova, pa, size,\n\t\t\t perm_to_iommu_flags(perm));\n\t}\n\n\tif (r)\n\t\tvhost_iotlb_del_range(dev->iotlb, iova, iova + size - 1);\n\telse\n\t\tatomic64_add(size >> PAGE_SHIFT, &dev->mm->pinned_vm);\n\n\treturn r;\n}",
  7600. "project": "linux",
  7601. "hash": 530582098261606381105615368654912094,
  7602. "size": 30,
  7603. "commit_id": "f6bbf0010ba004f5e90c7aefdebc0ee4bd3283b9",
  7604. "message": "vhost-vdpa: fix use-after-free of v->config_ctx\n\nWhen the 'v->config_ctx' eventfd_ctx reference is released we didn't\nset it to NULL. So if the same character device (e.g. /dev/vhost-vdpa-0)\nis re-opened, the 'v->config_ctx' is invalid and calling again\nvhost_vdpa_config_put() causes use-after-free issues like the\nfollowing refcount_t underflow:\n\n refcount_t: underflow; use-after-free.\n WARNING: CPU: 2 PID: 872 at lib/refcount.c:28 refcount_warn_saturate+0xae/0xf0\n RIP: 0010:refcount_warn_saturate+0xae/0xf0\n Call Trace:\n eventfd_ctx_put+0x5b/0x70\n vhost_vdpa_release+0xcd/0x150 [vhost_vdpa]\n __fput+0x8e/0x240\n ____fput+0xe/0x10\n task_work_run+0x66/0xa0\n exit_to_user_mode_prepare+0x118/0x120\n syscall_exit_to_user_mode+0x21/0x50\n ? __x64_sys_close+0x12/0x40\n do_syscall_64+0x45/0x50\n entry_SYSCALL_64_after_hwframe+0x44/0xae\n\nFixes: 776f395004d8 (\"vhost_vdpa: Support config interrupt in vdpa\")\nCc: lingshan.zhu@intel.com\nCc: stable@vger.kernel.org\nSigned-off-by: Stefano Garzarella <sgarzare@redhat.com>\nLink: https://lore.kernel.org/r/20210311135257.109460-2-sgarzare@redhat.com\nSigned-off-by: Michael S. Tsirkin <mst@redhat.com>\nReviewed-by: Zhu Lingshan <lingshan.zhu@intel.com>\nAcked-by: Jason Wang <jasowang@redhat.com>",
  7605. "target": 0,
  7606. "dataset": "other",
  7607. "idx": 478237
  7608. },
  7609. {
  7610. "func": "static int vhost_vdpa_process_iotlb_update(struct vhost_vdpa *v,\n\t\t\t\t\t struct vhost_iotlb_msg *msg)\n{\n\tstruct vhost_dev *dev = &v->vdev;\n\tstruct vhost_iotlb *iotlb = dev->iotlb;\n\tstruct page **page_list;\n\tunsigned long list_size = PAGE_SIZE / sizeof(struct page *);\n\tunsigned int gup_flags = FOLL_LONGTERM;\n\tunsigned long npages, cur_base, map_pfn, last_pfn = 0;\n\tunsigned long lock_limit, sz2pin, nchunks, i;\n\tu64 iova = msg->iova;\n\tlong pinned;\n\tint ret = 0;\n\n\tif (msg->iova < v->range.first ||\n\t msg->iova + msg->size - 1 > v->range.last)\n\t\treturn -EINVAL;\n\n\tif (vhost_iotlb_itree_first(iotlb, msg->iova,\n\t\t\t\t msg->iova + msg->size - 1))\n\t\treturn -EEXIST;\n\n\t/* Limit the use of memory for bookkeeping */\n\tpage_list = (struct page **) __get_free_page(GFP_KERNEL);\n\tif (!page_list)\n\t\treturn -ENOMEM;\n\n\tif (msg->perm & VHOST_ACCESS_WO)\n\t\tgup_flags |= FOLL_WRITE;\n\n\tnpages = PAGE_ALIGN(msg->size + (iova & ~PAGE_MASK)) >> PAGE_SHIFT;\n\tif (!npages) {\n\t\tret = -EINVAL;\n\t\tgoto free;\n\t}\n\n\tmmap_read_lock(dev->mm);\n\n\tlock_limit = rlimit(RLIMIT_MEMLOCK) >> PAGE_SHIFT;\n\tif (npages + atomic64_read(&dev->mm->pinned_vm) > lock_limit) {\n\t\tret = -ENOMEM;\n\t\tgoto unlock;\n\t}\n\n\tcur_base = msg->uaddr & PAGE_MASK;\n\tiova &= PAGE_MASK;\n\tnchunks = 0;\n\n\twhile (npages) {\n\t\tsz2pin = min_t(unsigned long, npages, list_size);\n\t\tpinned = pin_user_pages(cur_base, sz2pin,\n\t\t\t\t\tgup_flags, page_list, NULL);\n\t\tif (sz2pin != pinned) {\n\t\t\tif (pinned < 0) {\n\t\t\t\tret = pinned;\n\t\t\t} else {\n\t\t\t\tunpin_user_pages(page_list, pinned);\n\t\t\t\tret = -ENOMEM;\n\t\t\t}\n\t\t\tgoto out;\n\t\t}\n\t\tnchunks++;\n\n\t\tif (!last_pfn)\n\t\t\tmap_pfn = page_to_pfn(page_list[0]);\n\n\t\tfor (i = 0; i < pinned; i++) {\n\t\t\tunsigned long this_pfn = page_to_pfn(page_list[i]);\n\t\t\tu64 csize;\n\n\t\t\tif (last_pfn && (this_pfn != last_pfn + 1)) {\n\t\t\t\t/* Pin a contiguous chunk of memory */\n\t\t\t\tcsize = (last_pfn - map_pfn + 1) << PAGE_SHIFT;\n\t\t\t\tret = vhost_vdpa_map(v, iova, csize,\n\t\t\t\t\t\t map_pfn << PAGE_SHIFT,\n\t\t\t\t\t\t msg->perm);\n\t\t\t\tif (ret) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Unpin the pages that are left unmapped\n\t\t\t\t\t * from this point on in the current\n\t\t\t\t\t * page_list. The remaining outstanding\n\t\t\t\t\t * ones which may stride across several\n\t\t\t\t\t * chunks will be covered in the common\n\t\t\t\t\t * error path subsequently.\n\t\t\t\t\t */\n\t\t\t\t\tunpin_user_pages(&page_list[i],\n\t\t\t\t\t\t\t pinned - i);\n\t\t\t\t\tgoto out;\n\t\t\t\t}\n\n\t\t\t\tmap_pfn = this_pfn;\n\t\t\t\tiova += csize;\n\t\t\t\tnchunks = 0;\n\t\t\t}\n\n\t\t\tlast_pfn = this_pfn;\n\t\t}\n\n\t\tcur_base += pinned << PAGE_SHIFT;\n\t\tnpages -= pinned;\n\t}\n\n\t/* Pin the rest chunk */\n\tret = vhost_vdpa_map(v, iova, (last_pfn - map_pfn + 1) << PAGE_SHIFT,\n\t\t\t map_pfn << PAGE_SHIFT, msg->perm);\nout:\n\tif (ret) {\n\t\tif (nchunks) {\n\t\t\tunsigned long pfn;\n\n\t\t\t/*\n\t\t\t * Unpin the outstanding pages which are yet to be\n\t\t\t * mapped but haven't due to vdpa_map() or\n\t\t\t * pin_user_pages() failure.\n\t\t\t *\n\t\t\t * Mapped pages are accounted in vdpa_map(), hence\n\t\t\t * the corresponding unpinning will be handled by\n\t\t\t * vdpa_unmap().\n\t\t\t */\n\t\t\tWARN_ON(!last_pfn);\n\t\t\tfor (pfn = map_pfn; pfn <= last_pfn; pfn++)\n\t\t\t\tunpin_user_page(pfn_to_page(pfn));\n\t\t}\n\t\tvhost_vdpa_unmap(v, msg->iova, msg->size);\n\t}\nunlock:\n\tmmap_read_unlock(dev->mm);\nfree:\n\tfree_page((unsigned long)page_list);\n\treturn ret;\n}",
  7611. "project": "linux",
  7612. "hash": 159855076274083097194438563861162008064,
  7613. "size": 131,
  7614. "commit_id": "f6bbf0010ba004f5e90c7aefdebc0ee4bd3283b9",
  7615. "message": "vhost-vdpa: fix use-after-free of v->config_ctx\n\nWhen the 'v->config_ctx' eventfd_ctx reference is released we didn't\nset it to NULL. So if the same character device (e.g. /dev/vhost-vdpa-0)\nis re-opened, the 'v->config_ctx' is invalid and calling again\nvhost_vdpa_config_put() causes use-after-free issues like the\nfollowing refcount_t underflow:\n\n refcount_t: underflow; use-after-free.\n WARNING: CPU: 2 PID: 872 at lib/refcount.c:28 refcount_warn_saturate+0xae/0xf0\n RIP: 0010:refcount_warn_saturate+0xae/0xf0\n Call Trace:\n eventfd_ctx_put+0x5b/0x70\n vhost_vdpa_release+0xcd/0x150 [vhost_vdpa]\n __fput+0x8e/0x240\n ____fput+0xe/0x10\n task_work_run+0x66/0xa0\n exit_to_user_mode_prepare+0x118/0x120\n syscall_exit_to_user_mode+0x21/0x50\n ? __x64_sys_close+0x12/0x40\n do_syscall_64+0x45/0x50\n entry_SYSCALL_64_after_hwframe+0x44/0xae\n\nFixes: 776f395004d8 (\"vhost_vdpa: Support config interrupt in vdpa\")\nCc: lingshan.zhu@intel.com\nCc: stable@vger.kernel.org\nSigned-off-by: Stefano Garzarella <sgarzare@redhat.com>\nLink: https://lore.kernel.org/r/20210311135257.109460-2-sgarzare@redhat.com\nSigned-off-by: Michael S. Tsirkin <mst@redhat.com>\nReviewed-by: Zhu Lingshan <lingshan.zhu@intel.com>\nAcked-by: Jason Wang <jasowang@redhat.com>",
  7616. "target": 0,
  7617. "dataset": "other",
  7618. "idx": 478238
  7619. }
  7620. ]
  7621. },
  7622. {
  7623. "call_depth": 4,
  7624. "longest_call_chain": [
  7625. "acpi_boot_init",
  7626. "acpi_process_madt",
  7627. "acpi_parse_madt_ioapic_entries",
  7628. "acpi_sci_ioapic_setup"
  7629. ],
  7630. "group_size": 5,
  7631. "functions": [
  7632. {
  7633. "func": "static int __init acpi_parse_madt_lapic_entries(void)\n{\n\tint count;\n\n\tif (!cpu_has_apic)\n\t\treturn -ENODEV;\n\n\t/* \n\t * Note that the LAPIC address is obtained from the MADT (32-bit value)\n\t * and (optionally) overriden by a LAPIC_ADDR_OVR entry (64-bit value).\n\t */\n\n\tcount =\n\t acpi_table_parse_madt(ACPI_MADT_LAPIC_ADDR_OVR,\n\t\t\t\t acpi_parse_lapic_addr_ovr, 0);\n\tif (count < 0) {\n\t\tprintk(KERN_ERR PREFIX\n\t\t \"Error parsing LAPIC address override entry\\n\");\n\t\treturn count;\n\t}\n\n\tmp_register_lapic_address(acpi_lapic_addr);\n\n\tcount = acpi_table_parse_madt(ACPI_MADT_LAPIC, acpi_parse_lapic,\n\t\t\t\t MAX_APICS);\n\tif (!count) {\n\t\tprintk(KERN_ERR PREFIX \"No LAPIC entries present\\n\");\n\t\t/* TBD: Cleanup to allow fallback to MPS */\n\t\treturn -ENODEV;\n\t} else if (count < 0) {\n\t\tprintk(KERN_ERR PREFIX \"Error parsing LAPIC entry\\n\");\n\t\t/* TBD: Cleanup to allow fallback to MPS */\n\t\treturn count;\n\t}\n\n\tcount =\n\t acpi_table_parse_madt(ACPI_MADT_LAPIC_NMI, acpi_parse_lapic_nmi, 0);\n\tif (count < 0) {\n\t\tprintk(KERN_ERR PREFIX \"Error parsing LAPIC NMI entry\\n\");\n\t\t/* TBD: Cleanup to allow fallback to MPS */\n\t\treturn count;\n\t}\n\treturn 0;\n}",
  7634. "target": 0,
  7635. "cwe": [],
  7636. "project": "linux-2.6",
  7637. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  7638. "hash": 213721789998004113445496180184575800672,
  7639. "size": 44,
  7640. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  7641. "dataset": "other",
  7642. "idx": 499986
  7643. },
  7644. {
  7645. "func": "static void __init acpi_process_madt(void)\n{\n#ifdef CONFIG_X86_LOCAL_APIC\n\tint count, error;\n\n\tcount = acpi_table_parse(ACPI_APIC, acpi_parse_madt);\n\tif (count >= 1) {\n\n\t\t/*\n\t\t * Parse MADT LAPIC entries\n\t\t */\n\t\terror = acpi_parse_madt_lapic_entries();\n\t\tif (!error) {\n\t\t\tacpi_lapic = 1;\n\n#ifdef CONFIG_X86_GENERICARCH\n\t\t\tgeneric_bigsmp_probe();\n#endif\n\t\t\t/*\n\t\t\t * Parse MADT IO-APIC entries\n\t\t\t */\n\t\t\terror = acpi_parse_madt_ioapic_entries();\n\t\t\tif (!error) {\n\t\t\t\tacpi_irq_model = ACPI_IRQ_MODEL_IOAPIC;\n\t\t\t\tacpi_irq_balance_set(NULL);\n\t\t\t\tacpi_ioapic = 1;\n\n\t\t\t\tsmp_found_config = 1;\n\t\t\t\tclustered_apic_check();\n\t\t\t}\n\t\t}\n\t\tif (error == -EINVAL) {\n\t\t\t/*\n\t\t\t * Dell Precision Workstation 410, 610 come here.\n\t\t\t */\n\t\t\tprintk(KERN_ERR PREFIX\n\t\t\t \"Invalid BIOS MADT, disabling ACPI\\n\");\n\t\t\tdisable_acpi();\n\t\t}\n\t}\n#endif\n\treturn;\n}",
  7646. "target": 0,
  7647. "cwe": [],
  7648. "project": "linux-2.6",
  7649. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  7650. "hash": 304853954482509555927863505312876942754,
  7651. "size": 43,
  7652. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  7653. "dataset": "other",
  7654. "idx": 500015
  7655. },
  7656. {
  7657. "func": "static int __init acpi_parse_madt_ioapic_entries(void)\n{\n\tint count;\n\n\t/*\n\t * ACPI interpreter is required to complete interrupt setup,\n\t * so if it is off, don't enumerate the io-apics with ACPI.\n\t * If MPS is present, it will handle them,\n\t * otherwise the system will stay in PIC mode\n\t */\n\tif (acpi_disabled || acpi_noirq) {\n\t\treturn -ENODEV;\n\t}\n\n\tif (!cpu_has_apic) \n\t\treturn -ENODEV;\n\n\t/*\n\t * if \"noapic\" boot option, don't look for IO-APICs\n\t */\n\tif (skip_ioapic_setup) {\n\t\tprintk(KERN_INFO PREFIX \"Skipping IOAPIC probe \"\n\t\t \"due to 'noapic' option.\\n\");\n\t\treturn -ENODEV;\n\t}\n\n\tcount =\n\t acpi_table_parse_madt(ACPI_MADT_IOAPIC, acpi_parse_ioapic,\n\t\t\t\t MAX_IO_APICS);\n\tif (!count) {\n\t\tprintk(KERN_ERR PREFIX \"No IOAPIC entries present\\n\");\n\t\treturn -ENODEV;\n\t} else if (count < 0) {\n\t\tprintk(KERN_ERR PREFIX \"Error parsing IOAPIC entry\\n\");\n\t\treturn count;\n\t}\n\n\tcount =\n\t acpi_table_parse_madt(ACPI_MADT_INT_SRC_OVR, acpi_parse_int_src_ovr,\n\t\t\t\t NR_IRQ_VECTORS);\n\tif (count < 0) {\n\t\tprintk(KERN_ERR PREFIX\n\t\t \"Error parsing interrupt source overrides entry\\n\");\n\t\t/* TBD: Cleanup to allow fallback to MPS */\n\t\treturn count;\n\t}\n\n\t/*\n\t * If BIOS did not supply an INT_SRC_OVR for the SCI\n\t * pretend we got one so we can set the SCI flags.\n\t */\n\tif (!acpi_sci_override_gsi)\n\t\tacpi_sci_ioapic_setup(acpi_fadt.sci_int, 0, 0);\n\n\t/* Fill in identity legacy mapings where no override */\n\tmp_config_acpi_legacy_irqs();\n\n\tcount =\n\t acpi_table_parse_madt(ACPI_MADT_NMI_SRC, acpi_parse_nmi_src,\n\t\t\t\t NR_IRQ_VECTORS);\n\tif (count < 0) {\n\t\tprintk(KERN_ERR PREFIX \"Error parsing NMI SRC entry\\n\");\n\t\t/* TBD: Cleanup to allow fallback to MPS */\n\t\treturn count;\n\t}\n\n\treturn 0;\n}",
  7658. "target": 0,
  7659. "cwe": [],
  7660. "project": "linux-2.6",
  7661. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  7662. "hash": 206089872263599311184274569938139731793,
  7663. "size": 68,
  7664. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  7665. "dataset": "other",
  7666. "idx": 500001
  7667. },
  7668. {
  7669. "func": "int __init acpi_boot_init(void)\n{\n\t/*\n\t * If acpi_disabled, bail out\n\t * One exception: acpi=ht continues far enough to enumerate LAPICs\n\t */\n\tif (acpi_disabled && !acpi_ht)\n\t\treturn 1;\n\n\tacpi_table_parse(ACPI_BOOT, acpi_parse_sbf);\n\n\t/*\n\t * set sci_int and PM timer address\n\t */\n\tacpi_table_parse(ACPI_FADT, acpi_parse_fadt);\n\n\t/*\n\t * Process the Multiple APIC Description Table (MADT), if present\n\t */\n\tacpi_process_madt();\n\n\tacpi_table_parse(ACPI_HPET, acpi_parse_hpet);\n\n\treturn 0;\n}",
  7670. "target": 0,
  7671. "cwe": [],
  7672. "project": "linux-2.6",
  7673. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  7674. "hash": 340091633310638462260892732834527967470,
  7675. "size": 25,
  7676. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  7677. "dataset": "other",
  7678. "idx": 499993
  7679. },
  7680. {
  7681. "func": "static void acpi_sci_ioapic_setup(u32 gsi, u16 polarity, u16 trigger)\n{\n\tif (trigger == 0)\t/* compatible SCI trigger is level */\n\t\ttrigger = 3;\n\n\tif (polarity == 0)\t/* compatible SCI polarity is low */\n\t\tpolarity = 3;\n\n\t/* Command-line over-ride via acpi_sci= */\n\tif (acpi_sci_flags.trigger)\n\t\ttrigger = acpi_sci_flags.trigger;\n\n\tif (acpi_sci_flags.polarity)\n\t\tpolarity = acpi_sci_flags.polarity;\n\n\t/*\n\t * mp_config_acpi_legacy_irqs() already setup IRQs < 16\n\t * If GSI is < 16, this will update its flags,\n\t * else it will create a new mp_irqs[] entry.\n\t */\n\tmp_override_legacy_irq(gsi, polarity, trigger, gsi);\n\n\t/*\n\t * stash over-ride to indicate we've been here\n\t * and for later update of acpi_fadt\n\t */\n\tacpi_sci_override_gsi = gsi;\n\treturn;\n}",
  7682. "target": 0,
  7683. "cwe": [],
  7684. "project": "linux-2.6",
  7685. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  7686. "hash": 39963657699800888970864861904027485773,
  7687. "size": 29,
  7688. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  7689. "dataset": "other",
  7690. "idx": 500002
  7691. }
  7692. ]
  7693. },
  7694. {
  7695. "call_depth": 3,
  7696. "longest_call_chain": [
  7697. "op_get",
  7698. "get_obj_op",
  7699. "op_head"
  7700. ],
  7701. "group_size": 9,
  7702. "functions": [
  7703. {
  7704. "func": "RGWOp* RGWHandler_REST_Bucket_S3Website::get_obj_op(bool get_data)\n{\n /** If we are in website mode, then it is explicitly impossible to run GET or\n * HEAD on the actual directory. We must convert the request to run on the\n * suffix object instead!\n */\n RGWGetObj_ObjStore_S3Website* op = new RGWGetObj_ObjStore_S3Website;\n op->set_get_data(get_data);\n return op;\n}",
  7705. "project": "ceph",
  7706. "hash": 195660400457123375261698596879597045215,
  7707. "size": 10,
  7708. "commit_id": "ba0790a01ba5252db1ebc299db6e12cd758d0ff9",
  7709. "message": "rgw: reject unauthenticated response-header actions\n\nSigned-off-by: Matt Benjamin <mbenjamin@redhat.com>\nReviewed-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)",
  7710. "target": 0,
  7711. "dataset": "other",
  7712. "idx": 281264
  7713. },
  7714. {
  7715. "func": "RGWOp* RGWHandler_REST_Obj_S3Website::get_obj_op(bool get_data)\n{\n /** If we are in website mode, then it is explicitly impossible to run GET or\n * HEAD on the actual directory. We must convert the request to run on the\n * suffix object instead!\n */\n RGWGetObj_ObjStore_S3Website* op = new RGWGetObj_ObjStore_S3Website;\n op->set_get_data(get_data);\n return op;\n}",
  7716. "project": "ceph",
  7717. "hash": 217033840971029127971392402993146006018,
  7718. "size": 10,
  7719. "commit_id": "ba0790a01ba5252db1ebc299db6e12cd758d0ff9",
  7720. "message": "rgw: reject unauthenticated response-header actions\n\nSigned-off-by: Matt Benjamin <mbenjamin@redhat.com>\nReviewed-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)",
  7721. "target": 0,
  7722. "dataset": "other",
  7723. "idx": 281312
  7724. },
  7725. {
  7726. "func": "RGWOp* RGWHandler_REST_Service_S3Website::get_obj_op(bool get_data)\n{\n /** If we are in website mode, then it is explicitly impossible to run GET or\n * HEAD on the actual directory. We must convert the request to run on the\n * suffix object instead!\n */\n RGWGetObj_ObjStore_S3Website* op = new RGWGetObj_ObjStore_S3Website;\n op->set_get_data(get_data);\n return op;\n}",
  7727. "project": "ceph",
  7728. "hash": 198827055528152227115833717972730456279,
  7729. "size": 10,
  7730. "commit_id": "ba0790a01ba5252db1ebc299db6e12cd758d0ff9",
  7731. "message": "rgw: reject unauthenticated response-header actions\n\nSigned-off-by: Matt Benjamin <mbenjamin@redhat.com>\nReviewed-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)",
  7732. "target": 0,
  7733. "dataset": "other",
  7734. "idx": 281357
  7735. },
  7736. {
  7737. "func": "RGWOp *RGWHandler_REST_Bucket_SWIFT::op_head()\n{\n return get_obj_op(false);\n}",
  7738. "project": "ceph",
  7739. "hash": 88689066606298847544569478217160663156,
  7740. "size": 4,
  7741. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  7742. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  7743. "target": 0,
  7744. "dataset": "other",
  7745. "idx": 448769
  7746. },
  7747. {
  7748. "func": "RGWOp *RGWHandler_REST_Bucket_SWIFT::op_get()\n{\n return get_obj_op(true);\n}",
  7749. "project": "ceph",
  7750. "hash": 32664676222410224026898941198214209341,
  7751. "size": 4,
  7752. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  7753. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  7754. "target": 0,
  7755. "dataset": "other",
  7756. "idx": 448790
  7757. },
  7758. {
  7759. "func": "RGWOp *RGWHandler_REST_Obj_SWIFT::op_get()\n{\n return get_obj_op(true);\n}",
  7760. "project": "ceph",
  7761. "hash": 225871141364726036356028404809714778698,
  7762. "size": 4,
  7763. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  7764. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  7765. "target": 0,
  7766. "dataset": "other",
  7767. "idx": 448845
  7768. },
  7769. {
  7770. "func": "RGWOp *RGWHandler_REST_Obj_SWIFT::op_head()\n{\n return get_obj_op(false);\n}",
  7771. "project": "ceph",
  7772. "hash": 101711086821814895220611321391626329606,
  7773. "size": 4,
  7774. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  7775. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  7776. "target": 0,
  7777. "dataset": "other",
  7778. "idx": 448859
  7779. },
  7780. {
  7781. "func": "RGWOp* RGWHandler_REST_S3Website::op_get()\n{\n return get_obj_op(true);\n}",
  7782. "project": "ceph",
  7783. "hash": 305591977287224409658955069983375222658,
  7784. "size": 4,
  7785. "commit_id": "ba0790a01ba5252db1ebc299db6e12cd758d0ff9",
  7786. "message": "rgw: reject unauthenticated response-header actions\n\nSigned-off-by: Matt Benjamin <mbenjamin@redhat.com>\nReviewed-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)",
  7787. "target": 0,
  7788. "dataset": "other",
  7789. "idx": 281337
  7790. },
  7791. {
  7792. "func": "RGWOp* RGWHandler_REST_S3Website::op_head()\n{\n return get_obj_op(false);\n}",
  7793. "project": "ceph",
  7794. "hash": 309456088556571296183843020617771044754,
  7795. "size": 4,
  7796. "commit_id": "ba0790a01ba5252db1ebc299db6e12cd758d0ff9",
  7797. "message": "rgw: reject unauthenticated response-header actions\n\nSigned-off-by: Matt Benjamin <mbenjamin@redhat.com>\nReviewed-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)",
  7798. "target": 0,
  7799. "dataset": "other",
  7800. "idx": 281255
  7801. }
  7802. ]
  7803. },
  7804. {
  7805. "call_depth": 4,
  7806. "longest_call_chain": [
  7807. "process_answer",
  7808. "process_m_answer",
  7809. "custom_fmt_match",
  7810. "pj_assert"
  7811. ],
  7812. "group_size": 21,
  7813. "functions": [
  7814. {
  7815. "func": "static pj_status_t custom_fmt_match(pj_pool_t *pool,\n\t\t\t\t const pj_str_t *fmt_name,\n\t\t\t\t pjmedia_sdp_media *offer,\n\t\t\t\t unsigned o_fmt_idx,\n\t\t\t\t pjmedia_sdp_media *answer,\n\t\t\t\t unsigned a_fmt_idx,\n\t\t\t\t unsigned option)\n{\n unsigned i;\n\n for (i = 0; i < fmt_match_cb_cnt; ++i) {\n\tif (pj_stricmp(fmt_name, &fmt_match_cb[i].fmt_name) == 0) {\n\t pj_assert(fmt_match_cb[i].cb);\n\t return (*fmt_match_cb[i].cb)(pool, offer, o_fmt_idx,\n\t\t\t\t\t answer, a_fmt_idx,\n\t\t\t\t\t option);\n\t}\n }\n\n /* Not customized format matching found, should be matched */\n return PJ_SUCCESS;\n}",
  7816. "project": "pjproject",
  7817. "hash": 41301759871988627482220993993091844415,
  7818. "size": 22,
  7819. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7820. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7821. "target": 0,
  7822. "dataset": "other",
  7823. "idx": 449670
  7824. },
  7825. {
  7826. "func": "static pj_status_t process_m_answer( pj_pool_t *pool,\n\t\t\t\t pjmedia_sdp_media *offer,\n\t\t\t\t pjmedia_sdp_media *answer,\n\t\t\t\t pj_bool_t allow_asym)\n{\n unsigned i;\n\n /* Check that the media type match our offer. */\n\n if (pj_strcmp(&answer->desc.media, &offer->desc.media)!=0) {\n\t/* The media type in the answer is different than the offer! */\n\treturn PJMEDIA_SDPNEG_EINVANSMEDIA;\n }\n\n\n /* Check that transport in the answer match our offer. */\n\n /* At this point, transport type must be compatible, \n * the transport instance will do more validation later.\n */\n if (pjmedia_sdp_transport_cmp(&answer->desc.transport, \n\t\t\t\t &offer->desc.transport) \n\t!= PJ_SUCCESS)\n {\n\treturn PJMEDIA_SDPNEG_EINVANSTP;\n }\n\n\n /* Check if remote has rejected our offer */\n if (answer->desc.port == 0) {\n\t\n\t/* Remote has rejected our offer. \n\t * Deactivate our media too.\n\t */\n\tpjmedia_sdp_media_deactivate(pool, offer);\n\n\t/* Don't need to proceed */\n\treturn PJ_SUCCESS;\n }\n\n /* Ticket #1148: check if remote answer does not set port to zero when\n * offered with port zero. Let's just tolerate it.\n */\n if (offer->desc.port == 0) {\n\t/* Don't need to proceed */\n\treturn PJ_SUCCESS;\n }\n\n /* Process direction attributes */\n update_media_direction(pool, answer, offer);\n \n /* If asymetric media is allowed, then just check that remote answer has \n * codecs that are within the offer. \n *\n * Otherwise if asymetric media is not allowed, then we will choose only\n * one codec in our initial offer to match the answer.\n */\n if (allow_asym) {\n\tfor (i=0; i<answer->desc.fmt_count; ++i) {\n\t unsigned j;\n\t pj_str_t *rem_fmt = &answer->desc.fmt[i];\n\n\t for (j=0; j<offer->desc.fmt_count; ++j) {\n\t\tif (pj_strcmp(rem_fmt, &answer->desc.fmt[j])==0)\n\t\t break;\n\t }\n\n\t if (j != offer->desc.fmt_count) {\n\t\t/* Found at least one common codec. */\n\t\tbreak;\n\t }\n\t}\n\n\tif (i == answer->desc.fmt_count) {\n\t /* No common codec in the answer! */\n\t return PJMEDIA_SDPNEG_EANSNOMEDIA;\n\t}\n\n\tPJ_TODO(CHECK_SDP_NEGOTIATION_WHEN_ASYMETRIC_MEDIA_IS_ALLOWED);\n\n } else {\n\t/* Offer format priority based on answer format index/priority */\n\tunsigned offer_fmt_prior[PJMEDIA_MAX_SDP_FMT];\n\n\t/* Remove all format in the offer that has no matching answer */\n\tfor (i=0; i<offer->desc.fmt_count;) {\n\t unsigned pt;\n\t pj_uint32_t j;\n\t pj_str_t *fmt = &offer->desc.fmt[i];\n\t \n\n\t /* Find matching answer */\n\t pt = pj_strtoul(fmt);\n\n\t if (pt < 96) {\n\t\tfor (j=0; j<answer->desc.fmt_count; ++j) {\n\t\t if (pj_strcmp(fmt, &answer->desc.fmt[j])==0)\n\t\t\tbreak;\n\t\t}\n\t } else {\n\t\t/* This is dynamic payload type.\n\t\t * For dynamic payload type, we must look the rtpmap and\n\t\t * compare the encoding name.\n\t\t */\n\t\tconst pjmedia_sdp_attr *a;\n\t\tpjmedia_sdp_rtpmap or_;\n\n\t\t/* Get the rtpmap for the payload type in the offer. */\n\t\ta = pjmedia_sdp_media_find_attr2(offer, \"rtpmap\", fmt);\n\t\tif (!a) {\n\t\t pj_assert(!\"Bug! Offer should have been validated\");\n\t\t return PJ_EBUG;\n\t\t}\n\t\tpjmedia_sdp_attr_get_rtpmap(a, &or_);\n\n\t\t/* Find paylaod in answer SDP with matching \n\t\t * encoding name and clock rate.\n\t\t */\n\t\tfor (j=0; j<answer->desc.fmt_count; ++j) {\n\t\t a = pjmedia_sdp_media_find_attr2(answer, \"rtpmap\", \n\t\t\t\t\t\t &answer->desc.fmt[j]);\n\t\t if (a) {\n\t\t\tpjmedia_sdp_rtpmap ar;\n\t\t\tpjmedia_sdp_attr_get_rtpmap(a, &ar);\n\n\t\t\t/* See if encoding name, clock rate, and channel\n\t\t\t * count match \n\t\t\t */\n\t\t\tif (!pj_stricmp(&or_.enc_name, &ar.enc_name) &&\n\t\t\t or_.clock_rate == ar.clock_rate &&\n\t\t\t (pj_stricmp(&or_.param, &ar.param)==0 ||\n\t\t\t (ar.param.slen==1 && *ar.param.ptr=='1')))\n\t\t\t{\n\t\t\t /* Call custom format matching callbacks */\n\t\t\t if (custom_fmt_match(pool, &or_.enc_name,\n\t\t\t\t\t\t offer, i, answer, j, 0) ==\n\t\t\t\tPJ_SUCCESS)\n\t\t\t {\n\t\t\t\t/* Match! */\n\t\t\t\tbreak;\n\t\t\t }\n\t\t\t}\n\t\t }\n\t\t}\n\t }\n\n\t if (j == answer->desc.fmt_count) {\n\t\t/* This format has no matching answer.\n\t\t * Remove it from our offer.\n\t\t */\n\t\tpjmedia_sdp_attr *a;\n\n\t\t/* Remove rtpmap associated with this format */\n\t\ta = pjmedia_sdp_media_find_attr2(offer, \"rtpmap\", fmt);\n\t\tif (a)\n\t\t pjmedia_sdp_media_remove_attr(offer, a);\n\n\t\t/* Remove fmtp associated with this format */\n\t\ta = pjmedia_sdp_media_find_attr2(offer, \"fmtp\", fmt);\n\t\tif (a)\n\t\t pjmedia_sdp_media_remove_attr(offer, a);\n\n\t\t/* Remove this format from offer's array */\n\t\tpj_array_erase(offer->desc.fmt, sizeof(offer->desc.fmt[0]),\n\t\t\t offer->desc.fmt_count, i);\n\t\t--offer->desc.fmt_count;\n\n\t } else {\n\t\toffer_fmt_prior[i] = j;\n\t\t++i;\n\t }\n\t}\n\n\tif (0 == offer->desc.fmt_count) {\n\t /* No common codec in the answer! */\n\t return PJMEDIA_SDPNEG_EANSNOMEDIA;\n\t}\n\n\t/* Post process:\n\t * - Resort offer formats so the order match to the answer.\n\t * - Remove answer formats that unmatches to the offer.\n\t */\n\t\n\t/* Resort offer formats */\n\tfor (i=0; i<offer->desc.fmt_count; ++i) {\n\t unsigned j;\n\t for (j=i+1; j<offer->desc.fmt_count; ++j) {\n\t\tif (offer_fmt_prior[i] > offer_fmt_prior[j]) {\n\t\t unsigned tmp = offer_fmt_prior[i];\n\t\t offer_fmt_prior[i] = offer_fmt_prior[j];\n\t\t offer_fmt_prior[j] = tmp;\n\t\t str_swap(&offer->desc.fmt[i], &offer->desc.fmt[j]);\n\t\t}\n\t }\n\t}\n\n\t/* Remove unmatched answer formats */\n\t{\n\t unsigned del_cnt = 0;\n\t for (i=0; i<answer->desc.fmt_count;) {\n\t\t/* The offer is ordered now, also the offer_fmt_prior */\n\t\tif (i >= offer->desc.fmt_count || \n\t\t offer_fmt_prior[i]-del_cnt != i)\n\t\t{\n\t\t pj_str_t *fmt = &answer->desc.fmt[i];\n\t\t pjmedia_sdp_attr *a;\n\n\t\t /* Remove rtpmap associated with this format */\n\t\t a = pjmedia_sdp_media_find_attr2(answer, \"rtpmap\", fmt);\n\t\t if (a)\n\t\t\tpjmedia_sdp_media_remove_attr(answer, a);\n\n\t\t /* Remove fmtp associated with this format */\n\t\t a = pjmedia_sdp_media_find_attr2(answer, \"fmtp\", fmt);\n\t\t if (a)\n\t\t\tpjmedia_sdp_media_remove_attr(answer, a);\n\n\t\t /* Remove this format from answer's array */\n\t\t pj_array_erase(answer->desc.fmt, \n\t\t\t\t sizeof(answer->desc.fmt[0]),\n\t\t\t\t answer->desc.fmt_count, i);\n\t\t --answer->desc.fmt_count;\n\n\t\t ++del_cnt;\n\t\t} else {\n\t\t ++i;\n\t\t}\n\t }\n\t}\n }\n\n /* Looks okay */\n return PJ_SUCCESS;\n}",
  7827. "project": "pjproject",
  7828. "hash": 306619889036402259679557747540392102694,
  7829. "size": 234,
  7830. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7831. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7832. "target": 0,
  7833. "dataset": "other",
  7834. "idx": 449645
  7835. },
  7836. {
  7837. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_set_prefer_remote_codec_order(\n\t\t\t\t\t\tpjmedia_sdp_neg *neg,\n\t\t\t\t\t\tpj_bool_t prefer_remote)\n{\n PJ_ASSERT_RETURN(neg, PJ_EINVAL);\n neg->prefer_remote_codec_order = prefer_remote;\n return PJ_SUCCESS;\n}",
  7838. "project": "pjproject",
  7839. "hash": 135161748195259289338417694367735299272,
  7840. "size": 8,
  7841. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7842. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7843. "target": 0,
  7844. "dataset": "other",
  7845. "idx": 449648
  7846. },
  7847. {
  7848. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_get_active_local( pjmedia_sdp_neg *neg,\n\t\t\t\t\tconst pjmedia_sdp_session **local)\n{\n PJ_ASSERT_RETURN(neg && local, PJ_EINVAL);\n PJ_ASSERT_RETURN(neg->active_local_sdp, PJMEDIA_SDPNEG_ENOACTIVE);\n\n *local = neg->active_local_sdp;\n return PJ_SUCCESS;\n}",
  7849. "project": "pjproject",
  7850. "hash": 247948104735515018551443226478703169078,
  7851. "size": 9,
  7852. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7853. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7854. "target": 0,
  7855. "dataset": "other",
  7856. "idx": 449649
  7857. },
  7858. {
  7859. "func": "PJ_DEF(pjmedia_sdp_neg_state) pjmedia_sdp_neg_get_state( pjmedia_sdp_neg *neg )\n{\n /* Check arguments are valid. */\n PJ_ASSERT_RETURN(neg != NULL, PJMEDIA_SDP_NEG_STATE_NULL);\n return neg->state;\n}",
  7860. "project": "pjproject",
  7861. "hash": 177841916266260096920835567958572204387,
  7862. "size": 6,
  7863. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7864. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7865. "target": 0,
  7866. "dataset": "other",
  7867. "idx": 449650
  7868. },
  7869. {
  7870. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_get_active_remote( pjmedia_sdp_neg *neg,\n\t\t\t\t const pjmedia_sdp_session **remote)\n{\n PJ_ASSERT_RETURN(neg && remote, PJ_EINVAL);\n PJ_ASSERT_RETURN(neg->active_remote_sdp, PJMEDIA_SDPNEG_ENOACTIVE);\n\n *remote = neg->active_remote_sdp;\n return PJ_SUCCESS;\n}",
  7871. "project": "pjproject",
  7872. "hash": 38478110242827854796437422570723391788,
  7873. "size": 9,
  7874. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7875. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7876. "target": 0,
  7877. "dataset": "other",
  7878. "idx": 449654
  7879. },
  7880. {
  7881. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_create_w_local_offer( pj_pool_t *pool,\n\t\t\t\t const pjmedia_sdp_session *local,\n\t\t\t\t pjmedia_sdp_neg **p_neg)\n{\n pjmedia_sdp_neg *neg;\n pj_status_t status;\n\n /* Check arguments are valid. */\n PJ_ASSERT_RETURN(pool && local && p_neg, PJ_EINVAL);\n\n *p_neg = NULL;\n\n /* Validate local offer. */\n PJ_ASSERT_RETURN((status=pjmedia_sdp_validate(local))==PJ_SUCCESS, status);\n\n /* Create and initialize negotiator. */\n neg = PJ_POOL_ZALLOC_T(pool, pjmedia_sdp_neg);\n PJ_ASSERT_RETURN(neg != NULL, PJ_ENOMEM);\n\n neg->state = PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER;\n neg->prefer_remote_codec_order = PJMEDIA_SDP_NEG_PREFER_REMOTE_CODEC_ORDER;\n neg->answer_with_multiple_codecs = PJMEDIA_SDP_NEG_ANSWER_MULTIPLE_CODECS;\n neg->initial_sdp = pjmedia_sdp_session_clone(pool, local);\n neg->neg_local_sdp = pjmedia_sdp_session_clone(pool, local);\n\n *p_neg = neg;\n return PJ_SUCCESS;\n}",
  7882. "project": "pjproject",
  7883. "hash": 145282566880350545106204485317244844707,
  7884. "size": 28,
  7885. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7886. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7887. "target": 0,
  7888. "dataset": "other",
  7889. "idx": 449656
  7890. },
  7891. {
  7892. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_set_remote_offer( pj_pool_t *pool,\n\t\t\t\t pjmedia_sdp_neg *neg,\n\t\t\t\t const pjmedia_sdp_session *remote)\n{\n /* Check arguments are valid. */\n PJ_ASSERT_RETURN(pool && neg && remote, PJ_EINVAL);\n\n /* Can only do this in STATE_DONE.\n * If we already provide local offer, then rx_remote_answer() should\n * be called instead of this function.\n */\n PJ_ASSERT_RETURN(neg->state == PJMEDIA_SDP_NEG_STATE_DONE, \n\t\t PJMEDIA_SDPNEG_EINSTATE);\n\n /* State now is STATE_REMOTE_OFFER. */\n neg->state = PJMEDIA_SDP_NEG_STATE_REMOTE_OFFER;\n neg->neg_remote_sdp = pjmedia_sdp_session_clone(pool, remote);\n\n return PJ_SUCCESS;\n}",
  7893. "project": "pjproject",
  7894. "hash": 197722992564468219095324708107613173276,
  7895. "size": 20,
  7896. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7897. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7898. "target": 0,
  7899. "dataset": "other",
  7900. "idx": 449659
  7901. },
  7902. {
  7903. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_get_neg_remote( pjmedia_sdp_neg *neg,\n\t\t\t\tconst pjmedia_sdp_session **remote)\n{\n PJ_ASSERT_RETURN(neg && remote, PJ_EINVAL);\n PJ_ASSERT_RETURN(neg->neg_remote_sdp, PJMEDIA_SDPNEG_ENONEG);\n\n *remote = neg->neg_remote_sdp;\n return PJ_SUCCESS;\n}",
  7904. "project": "pjproject",
  7905. "hash": 319226620947786118332536034092481320195,
  7906. "size": 9,
  7907. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7908. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7909. "target": 0,
  7910. "dataset": "other",
  7911. "idx": 449660
  7912. },
  7913. {
  7914. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_get_neg_local( pjmedia_sdp_neg *neg,\n\t\t\t const pjmedia_sdp_session **local)\n{\n PJ_ASSERT_RETURN(neg && local, PJ_EINVAL);\n PJ_ASSERT_RETURN(neg->neg_local_sdp, PJMEDIA_SDPNEG_ENONEG);\n\n *local = neg->neg_local_sdp;\n return PJ_SUCCESS;\n}",
  7915. "project": "pjproject",
  7916. "hash": 209072946929116056803334072498425119956,
  7917. "size": 9,
  7918. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7919. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7920. "target": 0,
  7921. "dataset": "other",
  7922. "idx": 449662
  7923. },
  7924. {
  7925. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_set_remote_answer( pj_pool_t *pool,\n\t\t\t\t pjmedia_sdp_neg *neg,\n\t\t\t\t const pjmedia_sdp_session *remote)\n{\n /* Check arguments are valid. */\n PJ_ASSERT_RETURN(pool && neg && remote, PJ_EINVAL);\n\n /* Can only do this in STATE_LOCAL_OFFER.\n * If we haven't provided local offer, then rx_remote_offer() should\n * be called instead of this function.\n */\n PJ_ASSERT_RETURN(neg->state == PJMEDIA_SDP_NEG_STATE_LOCAL_OFFER, \n\t\t PJMEDIA_SDPNEG_EINSTATE);\n\n /* We're ready to negotiate. */\n neg->state = PJMEDIA_SDP_NEG_STATE_WAIT_NEGO;\n neg->has_remote_answer = PJ_TRUE;\n neg->neg_remote_sdp = pjmedia_sdp_session_clone(pool, remote);\n \n return PJ_SUCCESS;\n}",
  7926. "project": "pjproject",
  7927. "hash": 207244314488309070936957062457519591507,
  7928. "size": 21,
  7929. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7930. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7931. "target": 0,
  7932. "dataset": "other",
  7933. "idx": 449663
  7934. },
  7935. {
  7936. "func": "PJ_DEF(pj_status_t) pjmedia_sdp_neg_set_answer_multiple_codecs(\n pjmedia_sdp_neg *neg,\n pj_bool_t answer_multiple)\n{\n PJ_ASSERT_RETURN(neg, PJ_EINVAL);\n neg->answer_with_multiple_codecs = answer_multiple;\n return PJ_SUCCESS;\n}",
  7937. "project": "pjproject",
  7938. "hash": 248117092337564478747123098065989074218,
  7939. "size": 8,
  7940. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7941. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7942. "target": 0,
  7943. "dataset": "other",
  7944. "idx": 449671
  7945. },
  7946. {
  7947. "func": "PJ_DEF(pj_bool_t) pjmedia_sdp_neg_was_answer_remote(pjmedia_sdp_neg *neg)\n{\n PJ_ASSERT_RETURN(neg, PJ_FALSE);\n\n return neg->answer_was_remote;\n}",
  7948. "project": "pjproject",
  7949. "hash": 43796122874440838758990969022601113736,
  7950. "size": 6,
  7951. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7952. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7953. "target": 0,
  7954. "dataset": "other",
  7955. "idx": 449672
  7956. },
  7957. {
  7958. "func": "static pj_status_t process_answer(pj_pool_t *pool,\n\t\t\t\t pjmedia_sdp_session *local_offer,\n\t\t\t\t pjmedia_sdp_session *answer,\n\t\t\t\t pj_bool_t allow_asym,\n\t\t\t\t pjmedia_sdp_session **p_active)\n{\n unsigned omi = 0; /* Offer media index */\n unsigned ami = 0; /* Answer media index */\n pj_bool_t has_active = PJ_FALSE;\n pjmedia_sdp_session *offer;\n pj_status_t status;\n\n /* Check arguments. */\n PJ_ASSERT_RETURN(pool && local_offer && answer && p_active, PJ_EINVAL);\n\n /* Duplicate local offer SDP. */\n offer = pjmedia_sdp_session_clone(pool, local_offer);\n\n /* Check that media count match between offer and answer */\n // Ticket #527, different media count is allowed for more interoperability,\n // however, the media order must be same between offer and answer.\n // if (offer->media_count != answer->media_count)\n //\t return PJMEDIA_SDPNEG_EMISMEDIA;\n\n /* Now update each media line in the offer with the answer. */\n for (; omi<offer->media_count; ++omi) {\n\tif (ami == answer->media_count) {\n\t /* The answer has less media than the offer */\n\t pjmedia_sdp_media *am;\n\n\t /* Generate matching-but-disabled-media for the answer */\n\t am = sdp_media_clone_deactivate(pool, offer->media[omi],\n\t offer->media[omi], offer);\n\t answer->media[answer->media_count++] = am;\n\t ++ami;\n\n\t /* Deactivate our media offer too */\n\t pjmedia_sdp_media_deactivate(pool, offer->media[omi]);\n\n\t /* No answer media to be negotiated */\n\t continue;\n\t}\n\n\tstatus = process_m_answer(pool, offer->media[omi], answer->media[ami],\n\t\t\t\t allow_asym);\n\n\t/* If media type is mismatched, just disable the media. */\n\tif (status == PJMEDIA_SDPNEG_EINVANSMEDIA) {\n\t pjmedia_sdp_media_deactivate(pool, offer->media[omi]);\n\t continue;\n\t}\n\t/* No common format in the answer media. */\n\telse if (status == PJMEDIA_SDPNEG_EANSNOMEDIA) {\n\t pjmedia_sdp_media_deactivate(pool, offer->media[omi]);\n\t pjmedia_sdp_media_deactivate(pool, answer->media[ami]);\n\t} \n\t/* Return the error code, for other errors. */\n\telse if (status != PJ_SUCCESS) {\n\t return status;\n\t}\n\n\tif (offer->media[omi]->desc.port != 0)\n\t has_active = PJ_TRUE;\n\n\t++ami;\n }\n\n *p_active = offer;\n\n return has_active ? PJ_SUCCESS : PJMEDIA_SDPNEG_ENOMEDIA;\n}",
  7959. "project": "pjproject",
  7960. "hash": 179732466098847472036252057851522054985,
  7961. "size": 71,
  7962. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7963. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7964. "target": 0,
  7965. "dataset": "other",
  7966. "idx": 449669
  7967. },
  7968. {
  7969. "func": "static void str_swap(pj_str_t *str1, pj_str_t *str2)\n{\n pj_str_t tmp = *str1;\n *str1 = *str2;\n *str2 = tmp;\n}",
  7970. "project": "pjproject",
  7971. "hash": 31071335874861223736375872402192073128,
  7972. "size": 6,
  7973. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7974. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7975. "target": 0,
  7976. "dataset": "other",
  7977. "idx": 449665
  7978. },
  7979. {
  7980. "func": "static pj_status_t match_offer(pj_pool_t *pool,\n\t\t\t pj_bool_t prefer_remote_codec_order,\n pj_bool_t answer_with_multiple_codecs,\n\t\t\t const pjmedia_sdp_media *offer,\n\t\t\t const pjmedia_sdp_media *preanswer,\n\t\t\t const pjmedia_sdp_session *preanswer_sdp,\n\t\t\t pjmedia_sdp_media **p_answer)\n{\n unsigned i;\n pj_bool_t master_has_codec = 0,\n\t master_has_other = 0,\n\t found_matching_codec = 0,\n\t found_matching_telephone_event = 0,\n\t found_matching_other = 0;\n unsigned pt_answer_count = 0;\n pj_str_t pt_answer[PJMEDIA_MAX_SDP_FMT];\n pj_str_t pt_offer[PJMEDIA_MAX_SDP_FMT];\n pjmedia_sdp_media *answer;\n const pjmedia_sdp_media *master, *slave;\n unsigned nclockrate = 0, clockrate[PJMEDIA_MAX_SDP_FMT];\n unsigned ntel_clockrate = 0, tel_clockrate[PJMEDIA_MAX_SDP_FMT];\n\n /* If offer has zero port, just clone the offer */\n if (offer->desc.port == 0) {\n\tanswer = sdp_media_clone_deactivate(pool, offer, preanswer,\n\t\t\t\t\t preanswer_sdp);\n\t*p_answer = answer;\n\treturn PJ_SUCCESS;\n }\n\n /* If the preanswer define zero port, this media is being rejected,\n * just clone the preanswer.\n */\n if (preanswer->desc.port == 0) {\n\tanswer = pjmedia_sdp_media_clone(pool, preanswer);\n\t*p_answer = answer;\n\treturn PJ_SUCCESS;\n }\n\n /* Set master/slave negotiator based on prefer_remote_codec_order. */\n if (prefer_remote_codec_order) {\n\tmaster = offer;\n\tslave = preanswer;\n } else {\n\tmaster = preanswer;\n\tslave = offer;\n }\n \n /* With the addition of telephone-event and dodgy MS RTC SDP, \n * the answer generation algorithm looks really shitty...\n */\n for (i=0; i<master->desc.fmt_count; ++i) {\n\tunsigned j;\n\t\n\tif (pj_isdigit(*master->desc.fmt[i].ptr)) {\n\t /* This is normal/standard payload type, where it's identified\n\t * by payload number.\n\t */\n\t unsigned pt;\n\n\t pt = pj_strtoul(&master->desc.fmt[i]);\n\t \n\t if (pt < 96) {\n\t\t/* For static payload type, it's enough to compare just\n\t\t * the payload number.\n\t\t */\n\n\t\tmaster_has_codec = 1;\n\n\t\t/* We just need to select one codec if not allowing multiple.\n\t\t * Continue if we have selected matching codec for previous \n\t\t * payload.\n\t\t */\n\t\tif (!answer_with_multiple_codecs && found_matching_codec)\n\t\t continue;\n\n\t\t/* Find matching codec in local descriptor. */\n\t\tfor (j=0; j<slave->desc.fmt_count; ++j) {\n\t\t unsigned p;\n\t\t p = pj_strtoul(&slave->desc.fmt[j]);\n\t\t if (p == pt && pj_isdigit(*slave->desc.fmt[j].ptr)) {\n\t\t\tunsigned k;\n\n\t\t\tfound_matching_codec = 1;\n\t\t\tpt_offer[pt_answer_count] = slave->desc.fmt[j];\n\t\t\tpt_answer[pt_answer_count++] = slave->desc.fmt[j];\n\n\t\t\t/* Take note of clock rate for tel-event. Note: for\n\t\t\t * static PT, we assume the clock rate is 8000.\n\t\t\t */\n\t\t\tfor (k=0; k<nclockrate; ++k)\n\t\t\t if (clockrate[k] == 8000)\n\t\t\t\tbreak;\n\t\t\tif (k == nclockrate)\n\t\t\t clockrate[nclockrate++] = 8000;\n\t\t\tbreak;\n\t\t }\n\t\t}\n\n\t } else {\n\t\t/* This is dynamic payload type.\n\t\t * For dynamic payload type, we must look the rtpmap and\n\t\t * compare the encoding name.\n\t\t */\n\t\tconst pjmedia_sdp_attr *a;\n\t\tpjmedia_sdp_rtpmap or_;\n\t\tpj_bool_t is_codec = 0;\n\n\t\t/* Get the rtpmap for the payload type in the master. */\n\t\ta = pjmedia_sdp_media_find_attr2(master, \"rtpmap\", \n\t\t\t\t\t\t &master->desc.fmt[i]);\n\t\tif (!a) {\n\t\t pj_assert(!\"Bug! Offer should have been validated\");\n\t\t return PJMEDIA_SDP_EMISSINGRTPMAP;\n\t\t}\n\t\tpjmedia_sdp_attr_get_rtpmap(a, &or_);\n\n\t\tif (pj_stricmp2(&or_.enc_name, \"telephone-event\")) {\n\t\t master_has_codec = 1;\n\t\t if (!answer_with_multiple_codecs && found_matching_codec)\n\t\t\tcontinue;\n\t\t is_codec = 1;\n\t\t}\n\t\t\n\t\t/* Find paylaod in our initial SDP with matching \n\t\t * encoding name and clock rate.\n\t\t */\n\t\tfor (j=0; j<slave->desc.fmt_count; ++j) {\n\t\t a = pjmedia_sdp_media_find_attr2(slave, \"rtpmap\", \n\t\t\t\t\t\t &slave->desc.fmt[j]);\n\t\t if (a) {\n\t\t\tpjmedia_sdp_rtpmap lr;\n\t\t\tpjmedia_sdp_attr_get_rtpmap(a, &lr);\n\n\t\t\t/* See if encoding name, clock rate, and\n\t\t\t * channel count match \n\t\t\t */\n\t\t\tif (!pj_stricmp(&or_.enc_name, &lr.enc_name) &&\n\t\t\t or_.clock_rate == lr.clock_rate &&\n\t\t\t (pj_stricmp(&or_.param, &lr.param)==0 ||\n\t\t\t (lr.param.slen==0 && or_.param.slen==1 && \n\t\t\t\t\t\t *or_.param.ptr=='1') || \n\t\t\t (or_.param.slen==0 && lr.param.slen==1 && \n\t\t\t\t\t\t *lr.param.ptr=='1'))) \n\t\t\t{\n\t\t\t /* Match! */\n\t\t\t if (is_codec) {\n\t\t\t\tpjmedia_sdp_media *o_med, *a_med;\n\t\t\t\tunsigned o_fmt_idx, a_fmt_idx;\n\t\t\t\tunsigned k;\n\n\t\t\t\to_med = (pjmedia_sdp_media*)offer;\n\t\t\t\ta_med = (pjmedia_sdp_media*)preanswer;\n\t\t\t\to_fmt_idx = prefer_remote_codec_order? i:j;\n\t\t\t\ta_fmt_idx = prefer_remote_codec_order? j:i;\n\n\t\t\t\t/* Call custom format matching callbacks */\n\t\t\t\tif (custom_fmt_match(pool, &or_.enc_name,\n\t\t\t\t\t\t o_med, o_fmt_idx,\n\t\t\t\t\t\t a_med, a_fmt_idx,\n\t\t\t\t\t\t ALLOW_MODIFY_ANSWER) !=\n\t\t\t\t PJ_SUCCESS)\n\t\t\t\t{\n\t\t\t\t continue;\n\t\t\t\t}\n\t\t\t\tfound_matching_codec = 1;\n\n\t\t\t\t/* Take note of clock rate for tel-event */\n\t\t\t\tfor (k=0; k<nclockrate; ++k)\n\t\t\t\t if (clockrate[k] == or_.clock_rate)\n\t\t\t\t\tbreak;\n\t\t\t\tif (k == nclockrate)\n\t\t\t\t clockrate[nclockrate++] = or_.clock_rate;\n\t\t\t } else {\n\t\t\t \tunsigned k;\n\n\t\t\t\t/* Keep track of tel-event clock rate,\n\t\t\t\t * to prevent duplicate.\n\t\t\t\t */\n\t\t\t\tfor (k=0; k<ntel_clockrate; ++k)\n\t\t\t\t if (tel_clockrate[k] == or_.clock_rate)\n\t\t\t\t\tbreak;\n\t\t\t\tif (k < ntel_clockrate)\n\t\t\t\t continue;\n\t\t\t\t\n\t\t\t\ttel_clockrate[ntel_clockrate++] = or_.clock_rate;\n\t\t\t\tfound_matching_telephone_event = 1;\n\t\t\t }\n\n\t\t\t pt_offer[pt_answer_count] = \n\t\t\t\t\t\tprefer_remote_codec_order?\n\t\t\t\t\t\toffer->desc.fmt[i]:\n\t\t\t\t\t\toffer->desc.fmt[j];\n\t\t\t pt_answer[pt_answer_count++] = \n\t\t\t\t\t\tprefer_remote_codec_order? \n\t\t\t\t\t\tpreanswer->desc.fmt[j]:\n\t\t\t\t\t\tpreanswer->desc.fmt[i];\n\t\t\t break;\n\t\t\t}\n\t\t }\n\t\t}\n\t }\n\n\t} else {\n\t /* This is a non-standard, brain damaged SDP where the payload\n\t * type is non-numeric. It exists e.g. in Microsoft RTC based\n\t * UA, to indicate instant messaging capability.\n\t * Example:\n\t *\t- m=x-ms-message 5060 sip null\n\t */\n\t master_has_other = 1;\n\t if (found_matching_other)\n\t\tcontinue;\n\n\t for (j=0; j<slave->desc.fmt_count; ++j) {\n\t\tif (!pj_strcmp(&master->desc.fmt[i], &slave->desc.fmt[j])) {\n\t\t /* Match */\n\t\t found_matching_other = 1;\n\t\t pt_offer[pt_answer_count] = prefer_remote_codec_order?\n\t\t\t\t\t\toffer->desc.fmt[i]:\n\t\t\t\t\t\toffer->desc.fmt[j];\n\t\t pt_answer[pt_answer_count++] = prefer_remote_codec_order? \n\t\t\t\t\t\t preanswer->desc.fmt[j]:\n\t\t\t\t\t\t preanswer->desc.fmt[i];\n\t\t break;\n\t\t}\n\t }\n\t}\n }\n\n /* See if all types of master can be matched. */\n if (master_has_codec && !found_matching_codec) {\n\treturn PJMEDIA_SDPNEG_NOANSCODEC;\n }\n\n /* If this comment is removed, negotiation will fail if remote has offered\n telephone-event and local is not configured with telephone-event\n\n if (offer_has_telephone_event && !found_matching_telephone_event) {\n\treturn PJMEDIA_SDPNEG_NOANSTELEVENT;\n }\n */\n\n if (master_has_other && !found_matching_other) {\n\treturn PJMEDIA_SDPNEG_NOANSUNKNOWN;\n }\n\n /* Seems like everything is in order. */\n\n /* Remove unwanted telephone-event formats. */\n if (found_matching_telephone_event) {\n\tpj_str_t first_televent_offer = {0};\n\tpj_str_t first_televent_answer = {0};\n\tunsigned matched_cnt = 0;\n\n\tfor (i=0; i<pt_answer_count; ) {\n\t const pjmedia_sdp_attr *a;\n\t pjmedia_sdp_rtpmap r;\n\t unsigned j;\n\n\t /* Skip static PT, as telephone-event uses dynamic PT */\n\t if (!pj_isdigit(*pt_answer[i].ptr) || pj_strtol(&pt_answer[i])<96)\n\t {\n\t\t++i;\n\t\tcontinue;\n\t }\n\n\t /* Get the rtpmap for format. */\n\t a = pjmedia_sdp_media_find_attr2(preanswer, \"rtpmap\",\n\t\t\t\t\t &pt_answer[i]);\n\t pj_assert(a);\n\t pjmedia_sdp_attr_get_rtpmap(a, &r);\n\n\t /* Only care for telephone-event format */\n\t if (pj_stricmp2(&r.enc_name, \"telephone-event\")) {\n\t\t++i;\n\t\tcontinue;\n\t }\n\n\t if (first_televent_offer.slen == 0) {\n\t\tfirst_televent_offer = pt_offer[i];\n\t\tfirst_televent_answer = pt_answer[i];\n\t }\n\n\t for (j=0; j<nclockrate; ++j) {\n\t\tif (r.clock_rate==clockrate[j])\n\t\t break;\n\t }\n\n\t /* This tel-event's clockrate is unwanted, remove the tel-event */\n\t if (j==nclockrate) {\n\t\tpj_array_erase(pt_answer, sizeof(pt_answer[0]),\n\t\t\t pt_answer_count, i);\n\t\tpj_array_erase(pt_offer, sizeof(pt_offer[0]),\n\t\t\t pt_answer_count, i);\n\t\tpt_answer_count--;\n\t } else {\n\t\t++matched_cnt;\n\t\t++i;\n\t }\n\t}\n\n\t/* Tel-event is wanted, but no matched clock rate (to the selected\n\t * audio codec), just put back any first matched tel-event formats.\n\t */\n\tif (!matched_cnt) {\n\t pt_offer[pt_answer_count] = first_televent_offer;\n\t pt_answer[pt_answer_count++] = first_televent_answer;\n\t}\n }\n\n /* Build the answer by cloning from preanswer, and reorder the payload\n * to suit the offer.\n */\n answer = pjmedia_sdp_media_clone(pool, preanswer);\n for (i=0; i<pt_answer_count; ++i) {\n\tunsigned j;\n\tfor (j=i; j<answer->desc.fmt_count; ++j) {\n\t if (!pj_strcmp(&answer->desc.fmt[j], &pt_answer[i]))\n\t\tbreak;\n\t}\n\tpj_assert(j != answer->desc.fmt_count);\n\tstr_swap(&answer->desc.fmt[i], &answer->desc.fmt[j]);\n }\n \n /* Remove unwanted local formats. */\n for (i=pt_answer_count; i<answer->desc.fmt_count; ++i) {\n\tpjmedia_sdp_attr *a;\n\n\t/* Remove rtpmap for this format */\n\ta = pjmedia_sdp_media_find_attr2(answer, \"rtpmap\", \n\t\t\t\t\t &answer->desc.fmt[i]);\n\tif (a) {\n\t pjmedia_sdp_media_remove_attr(answer, a);\n\t}\n\n\t/* Remove fmtp for this format */\n\ta = pjmedia_sdp_media_find_attr2(answer, \"fmtp\", \n\t\t\t\t\t &answer->desc.fmt[i]);\n\tif (a) {\n\t pjmedia_sdp_media_remove_attr(answer, a);\n\t}\n }\n answer->desc.fmt_count = pt_answer_count;\n\n#if PJMEDIA_SDP_NEG_ANSWER_SYMMETRIC_PT\n apply_answer_symmetric_pt(pool, answer, pt_answer_count,\n\t\t\t pt_offer, pt_answer);\n#endif\n\n /* Update media direction. */\n update_media_direction(pool, offer, answer);\n\n *p_answer = answer;\n return PJ_SUCCESS;\n}",
  7981. "project": "pjproject",
  7982. "hash": 69562952461395558680391602717220036992,
  7983. "size": 356,
  7984. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7985. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7986. "target": 0,
  7987. "dataset": "other",
  7988. "idx": 449668
  7989. },
  7990. {
  7991. "func": "static void remove_all_media_directions(pjmedia_sdp_media *m)\n{\n pjmedia_sdp_media_remove_all_attr(m, \"inactive\");\n pjmedia_sdp_media_remove_all_attr(m, \"sendrecv\");\n pjmedia_sdp_media_remove_all_attr(m, \"sendonly\");\n pjmedia_sdp_media_remove_all_attr(m, \"recvonly\");\n}",
  7992. "project": "pjproject",
  7993. "hash": 159258827173720754826756580001459082748,
  7994. "size": 7,
  7995. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  7996. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  7997. "target": 0,
  7998. "dataset": "other",
  7999. "idx": 449674
  8000. },
  8001. {
  8002. "func": "static void apply_answer_symmetric_pt(pj_pool_t *pool,\n\t\t\t\t pjmedia_sdp_media *answer,\n\t\t\t\t unsigned pt_cnt,\n\t\t\t\t const pj_str_t pt_offer[],\n\t\t\t\t const pj_str_t pt_answer[])\n{\n pjmedia_sdp_attr *a_tmp[PJMEDIA_MAX_SDP_ATTR];\n unsigned i, a_tmp_cnt = 0;\n\n /* Rewrite the payload types in the answer if different to\n * the ones in the offer.\n */\n for (i = 0; i < pt_cnt; ++i) {\n\tpjmedia_sdp_attr *a;\n\n\t/* Skip if the PTs are the same already, e.g: static PT. */\n\tif (pj_strcmp(&pt_answer[i], &pt_offer[i]) == 0)\n\t continue;\n\n\t/* Rewrite payload type in the answer to match to the offer */\n\tpj_strdup(pool, &answer->desc.fmt[i], &pt_offer[i]);\n\n\t/* Also update payload type in rtpmap */\n\ta = pjmedia_sdp_media_find_attr2(answer, \"rtpmap\", &pt_answer[i]);\n\tif (a) {\n\t rewrite_pt(pool, &a->value, &pt_answer[i], &pt_offer[i]);\n\t /* Temporarily remove the attribute in case the new payload\n\t * type is being used by another format in the media.\n\t */\n\t pjmedia_sdp_media_remove_attr(answer, a);\n\t a_tmp[a_tmp_cnt++] = a;\n\t}\n\n\t/* Also update payload type in fmtp */\n\ta = pjmedia_sdp_media_find_attr2(answer, \"fmtp\", &pt_answer[i]);\n\tif (a) {\n\t rewrite_pt(pool, &a->value, &pt_answer[i], &pt_offer[i]);\n\t /* Temporarily remove the attribute in case the new payload\n\t * type is being used by another format in the media.\n\t */\n\t pjmedia_sdp_media_remove_attr(answer, a);\n\t a_tmp[a_tmp_cnt++] = a;\n\t}\n }\n\n /* Return back 'rtpmap' and 'fmtp' attributes */\n for (i = 0; i < a_tmp_cnt; ++i)\n\tpjmedia_sdp_media_add_attr(answer, a_tmp[i]);\n}",
  8003. "project": "pjproject",
  8004. "hash": 94676198818858138948052164899281419766,
  8005. "size": 49,
  8006. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  8007. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  8008. "target": 0,
  8009. "dataset": "other",
  8010. "idx": 449661
  8011. },
  8012. {
  8013. "func": "static void update_media_direction(pj_pool_t *pool,\n\t\t\t\t const pjmedia_sdp_media *remote,\n\t\t\t\t pjmedia_sdp_media *local)\n{\n pjmedia_dir old_dir = PJMEDIA_DIR_ENCODING_DECODING,\n\t new_dir;\n\n /* Get the media direction of local SDP */\n if (pjmedia_sdp_media_find_attr2(local, \"sendonly\", NULL))\n\told_dir = PJMEDIA_DIR_ENCODING;\n else if (pjmedia_sdp_media_find_attr2(local, \"recvonly\", NULL))\n\told_dir = PJMEDIA_DIR_DECODING;\n else if (pjmedia_sdp_media_find_attr2(local, \"inactive\", NULL))\n\told_dir = PJMEDIA_DIR_NONE;\n\n new_dir = old_dir;\n\n /* Adjust local media direction based on remote media direction */\n if (pjmedia_sdp_media_find_attr2(remote, \"inactive\", NULL) != NULL) {\n\t/* If remote has \"a=inactive\", then local is inactive too */\n\n\tnew_dir = PJMEDIA_DIR_NONE;\n\n } else if(pjmedia_sdp_media_find_attr2(remote, \"sendonly\", NULL) != NULL) {\n\t/* If remote has \"a=sendonly\", then set local to \"recvonly\" if\n\t * it is currently \"sendrecv\". Otherwise if local is NOT \"recvonly\",\n\t * then set local direction to \"inactive\".\n\t */\n\tswitch (old_dir) {\n\tcase PJMEDIA_DIR_ENCODING_DECODING:\n\t new_dir = PJMEDIA_DIR_DECODING;\n\t break;\n\tcase PJMEDIA_DIR_DECODING:\n\t /* No change */\n\t break;\n\tdefault:\n\t new_dir = PJMEDIA_DIR_NONE;\n\t break;\n\t}\n\n } else if(pjmedia_sdp_media_find_attr2(remote, \"recvonly\", NULL) != NULL) {\n\t/* If remote has \"a=recvonly\", then set local to \"sendonly\" if\n\t * it is currently \"sendrecv\". Otherwise if local is NOT \"sendonly\",\n\t * then set local direction to \"inactive\"\n\t */\n \n\tswitch (old_dir) {\n\tcase PJMEDIA_DIR_ENCODING_DECODING:\n\t new_dir = PJMEDIA_DIR_ENCODING;\n\t break;\n\tcase PJMEDIA_DIR_ENCODING:\n\t /* No change */\n\t break;\n\tdefault:\n\t new_dir = PJMEDIA_DIR_NONE;\n\t break;\n\t}\n\n } else {\n\t/* Remote indicates \"sendrecv\" capability. No change to local \n\t * direction \n\t */\n }\n\n if (new_dir != old_dir) {\n\tpjmedia_sdp_attr *a = NULL;\n\n\tremove_all_media_directions(local);\n\n\tswitch (new_dir) {\n\tcase PJMEDIA_DIR_NONE:\n\t a = pjmedia_sdp_attr_create(pool, \"inactive\", NULL);\n\t break;\n\tcase PJMEDIA_DIR_ENCODING:\n\t a = pjmedia_sdp_attr_create(pool, \"sendonly\", NULL);\n\t break;\n\tcase PJMEDIA_DIR_DECODING:\n\t a = pjmedia_sdp_attr_create(pool, \"recvonly\", NULL);\n\t break;\n\tdefault:\n\t /* sendrecv */\n\t break;\n\t}\n\t\n\tif (a) {\n\t pjmedia_sdp_media_add_attr(local, a);\n\t}\n }\n}",
  8014. "project": "pjproject",
  8015. "hash": 247833342213862715264954993641996018166,
  8016. "size": 89,
  8017. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  8018. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  8019. "target": 0,
  8020. "dataset": "other",
  8021. "idx": 449666
  8022. },
  8023. {
  8024. "func": "static pj_status_t create_answer( pj_pool_t *pool,\n\t\t\t\t pj_bool_t prefer_remote_codec_order,\n pj_bool_t answer_with_multiple_codecs,\n\t\t\t\t const pjmedia_sdp_session *initial,\n\t\t\t\t const pjmedia_sdp_session *offer,\n\t\t\t\t pjmedia_sdp_session **p_answer)\n{\n pj_status_t status = PJMEDIA_SDPNEG_ENOMEDIA;\n pj_bool_t has_active = PJ_FALSE;\n pjmedia_sdp_session *answer;\n char media_used[PJMEDIA_MAX_SDP_MEDIA];\n unsigned i;\n\n /* Validate remote offer. \n * This should have been validated before.\n */\n PJ_ASSERT_RETURN((status=pjmedia_sdp_validate(offer))==PJ_SUCCESS, status);\n\n /* Create initial answer by duplicating initial SDP,\n * but clear all media lines. The media lines will be filled up later.\n */\n answer = pjmedia_sdp_session_clone(pool, initial);\n PJ_ASSERT_RETURN(answer != NULL, PJ_ENOMEM);\n\n answer->media_count = 0;\n\n pj_bzero(media_used, sizeof(media_used));\n\n /* For each media line, create our answer based on our initial\n * capability.\n */\n for (i=0; i<offer->media_count; ++i) {\n\tconst pjmedia_sdp_media *om;\t/* offer */\n\tconst pjmedia_sdp_media *im;\t/* initial media */\n\tpjmedia_sdp_media *am = NULL;\t/* answer/result */\n\tunsigned j;\n\n\tom = offer->media[i];\n\n\t/* Find media description in our initial capability that matches\n\t * the media type and transport type of offer's media, has\n\t * matching codec, and has not been used to answer other offer.\n\t */\n\tfor (im=NULL, j=0; j<initial->media_count; ++j) {\n\t im = initial->media[j];\n\t if (pj_strcmp(&om->desc.media, &im->desc.media)==0 &&\n\t\tpj_strcmp(&om->desc.transport, &im->desc.transport)==0 &&\n\t\tmedia_used[j] == 0)\n\t {\n pj_status_t status2;\n\n\t\t/* See if it has matching codec. */\n\t\tstatus2 = match_offer(pool, prefer_remote_codec_order,\n answer_with_multiple_codecs,\n\t\t\t\t om, im, initial, &am);\n\t\tif (status2 == PJ_SUCCESS) {\n\t\t /* Mark media as used. */\n\t\t media_used[j] = 1;\n\t\t break;\n } else {\n status = status2;\n }\n\t }\n\t}\n\n\tif (j==initial->media_count) {\n\t /* No matching media.\n\t * Reject the offer by setting the port to zero in the answer.\n\t */\n\t /* For simplicity in the construction of the answer, we'll\n\t * just clone the media from the offer. Anyway receiver will\n\t * ignore anything in the media once it sees that the port\n\t * number is zero.\n\t */\n\t am = sdp_media_clone_deactivate(pool, om, om, answer);\n\t} else {\n\t /* The answer is in am */\n\t pj_assert(am != NULL);\n\t}\n\n\t/* Add the media answer */\n\tanswer->media[answer->media_count++] = am;\n\n\t/* Check if this media is active.*/\n\tif (am->desc.port != 0)\n\t has_active = PJ_TRUE;\n }\n\n *p_answer = answer;\n\n return has_active ? PJ_SUCCESS : status;\n}",
  8025. "project": "pjproject",
  8026. "hash": 236570680447781241801738276633744309107,
  8027. "size": 92,
  8028. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  8029. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  8030. "target": 0,
  8031. "dataset": "other",
  8032. "idx": 449676
  8033. },
  8034. {
  8035. "func": "PJ_DEF(pj_bool_t) pjmedia_sdp_neg_has_local_answer(pjmedia_sdp_neg *neg)\n{\n pj_assert(neg && neg->state==PJMEDIA_SDP_NEG_STATE_WAIT_NEGO);\n return !neg->has_remote_answer;\n}",
  8036. "project": "pjproject",
  8037. "hash": 108008355913245225190456683013015461598,
  8038. "size": 5,
  8039. "commit_id": "97b3d7addbaa720b7ddb0af9bf6f3e443e664365",
  8040. "message": "Merge pull request from GHSA-hvq6-f89p-frvp",
  8041. "target": 0,
  8042. "dataset": "other",
  8043. "idx": 449644
  8044. }
  8045. ]
  8046. },
  8047. {
  8048. "call_depth": 4,
  8049. "longest_call_chain": [
  8050. "ReadJpegFile",
  8051. "ReadJpegSections",
  8052. "process_SOFn",
  8053. "Get16m"
  8054. ],
  8055. "group_size": 10,
  8056. "functions": [
  8057. {
  8058. "func": "static void process_COM (const uchar * Data, int length)\r\n{\r\n int ch;\r\n char Comment[MAX_COMMENT_SIZE+1];\r\n int nch;\r\n int a;\r\n\r\n nch = 0;\r\n\r\n if (length > MAX_COMMENT_SIZE) length = MAX_COMMENT_SIZE; // Truncate if it won't fit in our structure.\r\n\r\n for (a=2;a<length;a++){\r\n ch = Data[a];\r\n\r\n if (ch == '\\r' && a < length-1 && Data[a+1] == '\\n') continue; // Remove cr followed by lf.\r\n\r\n if (ch >= 32 || ch == '\\n' || ch == '\\t'){\r\n Comment[nch++] = (char)ch;\r\n }else{\r\n Comment[nch++] = '?';\r\n }\r\n }\r\n\r\n Comment[nch] = '\\0'; // Null terminate\r\n\r\n if (ShowTags){\r\n printf(\"COM marker comment: %s\\n\",Comment);\r\n }\r\n\r\n strcpy(ImageInfo.Comments,Comment);\r\n}\r",
  8059. "project": "jhead",
  8060. "hash": 292664364004845683272530709796861522405,
  8061. "size": 31,
  8062. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8063. "message": "Same error as previous checking in different function",
  8064. "target": 0,
  8065. "dataset": "other",
  8066. "idx": 261976
  8067. },
  8068. {
  8069. "func": "Section_t * CreateSection(int SectionType, unsigned char * Data, int Size)\r\n{\r\n Section_t * NewSection;\r\n int a;\r\n int NewIndex;\r\n\r\n NewIndex = 0; // Figure out where to put the comment section.\r\n if (SectionType == M_EXIF){\r\n // Exif alwas goes first!\r\n }else{\r\n for (;NewIndex < 3;NewIndex++){ // Maximum fourth position (just for the heck of it)\r\n if (Sections[NewIndex].Type == M_JFIF) continue; // Put it after Jfif\r\n if (Sections[NewIndex].Type == M_EXIF) continue; // Put it after Exif\r\n break;\r\n }\r\n }\r\n\r\n if (SectionsRead < NewIndex){\r\n ErrFatal(\"Too few sections!\");\r\n }\r\n\r\n CheckSectionsAllocated();\r\n for (a=SectionsRead;a>NewIndex;a--){\r\n Sections[a] = Sections[a-1]; \r\n }\r\n SectionsRead += 1;\r\n\r\n NewSection = Sections+NewIndex;\r\n\r\n NewSection->Type = SectionType;\r\n NewSection->Size = Size;\r\n NewSection->Data = Data;\r\n\r\n return NewSection;\r\n}\r",
  8070. "project": "jhead",
  8071. "hash": 142414121532161571740607386321509279285,
  8072. "size": 35,
  8073. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8074. "message": "Same error as previous checking in different function",
  8075. "target": 0,
  8076. "dataset": "other",
  8077. "idx": 261975
  8078. },
  8079. {
  8080. "func": "static int Get16m(const void * Short)\r\n{\r\n return (((uchar *)Short)[0] << 8) | ((uchar *)Short)[1];\r\n}\r",
  8081. "project": "jhead",
  8082. "hash": 224505929614412109203924983268393760920,
  8083. "size": 4,
  8084. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8085. "message": "Same error as previous checking in different function",
  8086. "target": 0,
  8087. "dataset": "other",
  8088. "idx": 261970
  8089. },
  8090. {
  8091. "func": "void DiscardAllButExif(void)\r\n{\r\n Section_t ExifKeeper;\r\n Section_t CommentKeeper;\r\n Section_t IptcKeeper;\r\n Section_t XmpKeeper;\r\n int a;\r\n\r\n memset(&ExifKeeper, 0, sizeof(ExifKeeper));\r\n memset(&CommentKeeper, 0, sizeof(CommentKeeper));\r\n memset(&IptcKeeper, 0, sizeof(IptcKeeper));\r\n memset(&XmpKeeper, 0, sizeof(IptcKeeper));\r\n\r\n for (a=0;a<SectionsRead;a++){\r\n if (Sections[a].Type == M_EXIF && ExifKeeper.Type == 0){\r\n ExifKeeper = Sections[a];\r\n }else if (Sections[a].Type == M_XMP && XmpKeeper.Type == 0){\r\n XmpKeeper = Sections[a];\r\n }else if (Sections[a].Type == M_COM && CommentKeeper.Type == 0){\r\n CommentKeeper = Sections[a];\r\n }else if (Sections[a].Type == M_IPTC && IptcKeeper.Type == 0){\r\n IptcKeeper = Sections[a];\r\n }else{\r\n free(Sections[a].Data);\r\n }\r\n }\r\n SectionsRead = 0;\r\n if (ExifKeeper.Type){\r\n CheckSectionsAllocated();\r\n Sections[SectionsRead++] = ExifKeeper;\r\n }\r\n if (CommentKeeper.Type){\r\n CheckSectionsAllocated();\r\n Sections[SectionsRead++] = CommentKeeper;\r\n }\r\n if (IptcKeeper.Type){\r\n CheckSectionsAllocated();\r\n Sections[SectionsRead++] = IptcKeeper;\r\n }\r\n\r\n if (XmpKeeper.Type){\r\n CheckSectionsAllocated();\r\n Sections[SectionsRead++] = XmpKeeper;\r\n }\r\n} \r",
  8092. "project": "jhead",
  8093. "hash": 212716664587015896897339550406074413700,
  8094. "size": 45,
  8095. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8096. "message": "Same error as previous checking in different function",
  8097. "target": 0,
  8098. "dataset": "other",
  8099. "idx": 261974
  8100. },
  8101. {
  8102. "func": "static void CheckSectionsAllocated(void)\r\n{\r\n if (SectionsRead > SectionsAllocated){\r\n ErrFatal(\"allocation screwup\");\r\n }\r\n if (SectionsRead >= SectionsAllocated){\r\n SectionsAllocated += SectionsAllocated/2;\r\n Sections = (Section_t *)realloc(Sections, sizeof(Section_t)*SectionsAllocated);\r\n if (Sections == NULL){\r\n ErrFatal(\"could not allocate data for entire image\");\r\n }\r\n }\r\n}\r",
  8103. "project": "jhead",
  8104. "hash": 198591798752355418002318661649443148034,
  8105. "size": 13,
  8106. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8107. "message": "Same error as previous checking in different function",
  8108. "target": 0,
  8109. "dataset": "other",
  8110. "idx": 261984
  8111. },
  8112. {
  8113. "func": "static void process_SOFn (const uchar * Data, int marker)\r\n{\r\n int data_precision, num_components;\r\n\r\n data_precision = Data[2];\r\n ImageInfo.Height = Get16m(Data+3);\r\n ImageInfo.Width = Get16m(Data+5);\r\n num_components = Data[7];\r\n\r\n if (num_components == 3){\r\n ImageInfo.IsColor = 1;\r\n }else{\r\n ImageInfo.IsColor = 0;\r\n }\r\n\r\n ImageInfo.Process = marker;\r\n\r\n if (ShowTags){\r\n printf(\"JPEG image is %uw * %uh, %d color components, %d bits per sample\\n\",\r\n ImageInfo.Width, ImageInfo.Height, num_components, data_precision);\r\n }\r\n}\r",
  8114. "project": "jhead",
  8115. "hash": 321479054901529407692575430681343822106,
  8116. "size": 22,
  8117. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8118. "message": "Same error as previous checking in different function",
  8119. "target": 0,
  8120. "dataset": "other",
  8121. "idx": 261981
  8122. },
  8123. {
  8124. "func": "int ReadJpegSections (FILE * infile, ReadMode_t ReadMode)\r\n{\r\n int a;\r\n int HaveCom = FALSE;\r\n\r\n a = fgetc(infile);\r\n\r\n if (a != 0xff || fgetc(infile) != M_SOI){\r\n return FALSE;\r\n }\r\n\r\n ImageInfo.JfifHeader.XDensity = ImageInfo.JfifHeader.YDensity = 300;\r\n ImageInfo.JfifHeader.ResolutionUnits = 1;\r\n\r\n for(;;){\r\n int itemlen;\r\n int prev;\r\n int marker = 0;\r\n int ll,lh, got;\r\n uchar * Data;\r\n\r\n CheckSectionsAllocated();\r\n\r\n prev = 0;\r\n for (a=0;;a++){\r\n marker = fgetc(infile);\r\n if (marker != 0xff && prev == 0xff) break;\r\n if (marker == EOF){\r\n ErrFatal(\"Unexpected end of file\");\r\n }\r\n prev = marker;\r\n }\r\n\r\n if (a > 10){\r\n ErrNonfatal(\"Extraneous %d padding bytes before section %02X\",a-1,marker);\r\n }\r\n\r\n Sections[SectionsRead].Type = marker;\r\n \r\n // Read the length of the section.\r\n lh = fgetc(infile);\r\n ll = fgetc(infile);\r\n if (lh == EOF || ll == EOF){\r\n ErrFatal(\"Unexpected end of file\");\r\n }\r\n\r\n itemlen = (lh << 8) | ll;\r\n\r\n if (itemlen < 2){\r\n ErrFatal(\"invalid marker\");\r\n }\r\n\r\n Sections[SectionsRead].Size = itemlen;\r\n\r\n Data = (uchar *)malloc(itemlen);\r\n if (Data == NULL){\r\n ErrFatal(\"Could not allocate memory\");\r\n }\r\n Sections[SectionsRead].Data = Data;\r\n\r\n // Store first two pre-read bytes.\r\n Data[0] = (uchar)lh;\r\n Data[1] = (uchar)ll;\r\n\r\n got = fread(Data+2, 1, itemlen-2, infile); // Read the whole section.\r\n if (got != itemlen-2){\r\n ErrFatal(\"Premature end of file?\");\r\n }\r\n SectionsRead += 1;\r\n\r\n switch(marker){\r\n\r\n case M_SOS: // stop before hitting compressed data \r\n // If reading entire image is requested, read the rest of the data.\r\n if (ReadMode & READ_IMAGE){\r\n int cp, ep, size;\r\n // Determine how much file is left.\r\n cp = ftell(infile);\r\n fseek(infile, 0, SEEK_END);\r\n ep = ftell(infile);\r\n fseek(infile, cp, SEEK_SET);\r\n\r\n size = ep-cp;\r\n Data = (uchar *)malloc(size);\r\n if (Data == NULL){\r\n ErrFatal(\"could not allocate data for entire image\");\r\n }\r\n\r\n got = fread(Data, 1, size, infile);\r\n if (got != size){\r\n ErrFatal(\"could not read the rest of the image\");\r\n }\r\n\r\n CheckSectionsAllocated();\r\n Sections[SectionsRead].Data = Data;\r\n Sections[SectionsRead].Size = size;\r\n Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;\r\n SectionsRead ++;\r\n HaveAll = 1;\r\n }\r\n return TRUE;\r\n\r\n case M_DQT:\r\n // Use for jpeg quality guessing\r\n process_DQT(Data, itemlen);\r\n break;\r\n\r\n case M_DHT: \r\n // Use for jpeg quality guessing\r\n process_DHT(Data, itemlen);\r\n break;\r\n\r\n\r\n case M_EOI: // in case it's a tables-only JPEG stream\r\n fprintf(stderr,\"No image in jpeg!\\n\");\r\n return FALSE;\r\n\r\n case M_COM: // Comment section\r\n if (HaveCom || ((ReadMode & READ_METADATA) == 0)){\r\n // Discard this section.\r\n free(Sections[--SectionsRead].Data);\r\n }else{\r\n process_COM(Data, itemlen);\r\n HaveCom = TRUE;\r\n }\r\n break;\r\n\r\n case M_JFIF:\r\n // Regular jpegs always have this tag, exif images have the exif\r\n // marker instead, althogh ACDsee will write images with both markers.\r\n // this program will re-create this marker on absence of exif marker.\r\n // hence no need to keep the copy from the file.\r\n if (itemlen < 16){\r\n fprintf(stderr,\"Jfif header too short\\n\");\r\n goto ignore;\r\n }\r\n if (memcmp(Data+2, \"JFIF\\0\",5)){\r\n fprintf(stderr,\"Header missing JFIF marker\\n\");\r\n }\r\n\r\n ImageInfo.JfifHeader.Present = TRUE;\r\n ImageInfo.JfifHeader.ResolutionUnits = Data[9];\r\n ImageInfo.JfifHeader.XDensity = (Data[10]<<8) | Data[11];\r\n ImageInfo.JfifHeader.YDensity = (Data[12]<<8) | Data[13];\r\n if (ShowTags){\r\n printf(\"JFIF SOI marker: Units: %d \",ImageInfo.JfifHeader.ResolutionUnits);\r\n switch(ImageInfo.JfifHeader.ResolutionUnits){\r\n case 0: printf(\"(aspect ratio)\"); break;\r\n case 1: printf(\"(dots per inch)\"); break;\r\n case 2: printf(\"(dots per cm)\"); break;\r\n default: printf(\"(unknown)\"); break;\r\n }\r\n printf(\" X-density=%d Y-density=%d\\n\",ImageInfo.JfifHeader.XDensity, ImageInfo.JfifHeader.YDensity);\r\n\r\n if (Data[14] || Data[15]){\r\n fprintf(stderr,\"Ignoring jfif header thumbnail\\n\");\r\n }\r\n }\r\n\r\n ignore:\r\n\r\n free(Sections[--SectionsRead].Data);\r\n break;\r\n\r\n case M_EXIF:\r\n // There can be different section using the same marker.\r\n if (ReadMode & READ_METADATA){\r\n if (memcmp(Data+2, \"Exif\", 4) == 0){\r\n process_EXIF(Data, itemlen);\r\n break;\r\n }else if (memcmp(Data+2, \"http:\", 5) == 0){\r\n Sections[SectionsRead-1].Type = M_XMP; // Change tag for internal purposes.\r\n if (ShowTags){\r\n printf(\"Image contains XMP section, %d bytes long\\n\", itemlen);\r\n if (ShowTags){\r\n ShowXmp(Sections[SectionsRead-1]);\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n // Oterwise, discard this section.\r\n free(Sections[--SectionsRead].Data);\r\n break;\r\n\r\n case M_IPTC:\r\n if (ReadMode & READ_METADATA){\r\n if (ShowTags){\r\n printf(\"Image contains IPTC section, %d bytes long\\n\", itemlen);\r\n }\r\n // Note: We just store the IPTC section. Its relatively straightforward\r\n // and we don't act on any part of it, so just display it at parse time.\r\n }else{\r\n free(Sections[--SectionsRead].Data);\r\n }\r\n break;\r\n \r\n case M_SOF0: \r\n case M_SOF1: \r\n case M_SOF2: \r\n case M_SOF3: \r\n case M_SOF5: \r\n case M_SOF6: \r\n case M_SOF7: \r\n case M_SOF9: \r\n case M_SOF10:\r\n case M_SOF11:\r\n case M_SOF13:\r\n case M_SOF14:\r\n case M_SOF15:\r\n if (itemlen < 8){\r\n fprintf(stderr,\"Section too short\\n\");\r\n break;\r\n }\r\n process_SOFn(Data, marker);\r\n break;\r\n default:\r\n // Skip any other sections.\r\n if (ShowTags){\r\n printf(\"Jpeg section marker 0x%02x size %d\\n\",marker, itemlen);\r\n }\r\n break;\r\n }\r\n }\r\n return TRUE;\r\n}\r",
  8125. "project": "jhead",
  8126. "hash": 109190490159385379929171220952643934796,
  8127. "size": 226,
  8128. "commit_id": "5186ddcf9e35a7aa0ff0539489a930434a1325f4",
  8129. "message": "Just allocate 20 bytes extra at the end of a section. Otherwise, we end\nup with a whole lot of little checks for structures that the file says\nare there but are unexpectedly cut off in fuzz tests",
  8130. "target": 1,
  8131. "dataset": "other",
  8132. "idx": 206412
  8133. },
  8134. {
  8135. "func": "int ReadJpegSections (FILE * infile, ReadMode_t ReadMode)\r\n{\r\n int a;\r\n int HaveCom = FALSE;\r\n\r\n a = fgetc(infile);\r\n\r\n if (a != 0xff || fgetc(infile) != M_SOI){\r\n return FALSE;\r\n }\r\n\r\n ImageInfo.JfifHeader.XDensity = ImageInfo.JfifHeader.YDensity = 300;\r\n ImageInfo.JfifHeader.ResolutionUnits = 1;\r\n\r\n for(;;){\r\n int itemlen;\r\n int prev;\r\n int marker = 0;\r\n int ll,lh, got;\r\n uchar * Data;\r\n\r\n CheckSectionsAllocated();\r\n\r\n prev = 0;\r\n for (a=0;;a++){\r\n marker = fgetc(infile);\r\n if (marker != 0xff && prev == 0xff) break;\r\n if (marker == EOF){\r\n ErrFatal(\"Unexpected end of file\");\r\n }\r\n prev = marker;\r\n }\r\n\r\n if (a > 10){\r\n ErrNonfatal(\"Extraneous %d padding bytes before section %02X\",a-1,marker);\r\n }\r\n\r\n Sections[SectionsRead].Type = marker;\r\n \r\n // Read the length of the section.\r\n lh = fgetc(infile);\r\n ll = fgetc(infile);\r\n if (lh == EOF || ll == EOF){\r\n ErrFatal(\"Unexpected end of file\");\r\n }\r\n\r\n itemlen = (lh << 8) | ll;\r\n\r\n if (itemlen < 2){\r\n ErrFatal(\"invalid marker\");\r\n }\r\n\r\n Sections[SectionsRead].Size = itemlen;\r\n\r\n // Allocate an extra 20 bytes more than needed, because sometimes when reading structures,\r\n // if the section erroneously ends before short structures that should be there, that can trip\r\n // memory checkers in combination with fuzzers.\r\n Data = (uchar *)malloc(itemlen+20);\r\n if (Data == NULL){\r\n ErrFatal(\"Could not allocate memory\");\r\n }\r\n Sections[SectionsRead].Data = Data;\r\n\r\n // Store first two pre-read bytes.\r\n Data[0] = (uchar)lh;\r\n Data[1] = (uchar)ll;\r\n\r\n got = fread(Data+2, 1, itemlen-2, infile); // Read the whole section.\r\n if (got != itemlen-2){\r\n ErrFatal(\"Premature end of file?\");\r\n }\r\n SectionsRead += 1;\r\n\r\n switch(marker){\r\n\r\n case M_SOS: // stop before hitting compressed data \r\n // If reading entire image is requested, read the rest of the data.\r\n if (ReadMode & READ_IMAGE){\r\n int cp, ep, size;\r\n // Determine how much file is left.\r\n cp = ftell(infile);\r\n fseek(infile, 0, SEEK_END);\r\n ep = ftell(infile);\r\n fseek(infile, cp, SEEK_SET);\r\n\r\n size = ep-cp;\r\n Data = (uchar *)malloc(size);\r\n if (Data == NULL){\r\n ErrFatal(\"could not allocate data for entire image\");\r\n }\r\n\r\n got = fread(Data, 1, size, infile);\r\n if (got != size){\r\n ErrFatal(\"could not read the rest of the image\");\r\n }\r\n\r\n CheckSectionsAllocated();\r\n Sections[SectionsRead].Data = Data;\r\n Sections[SectionsRead].Size = size;\r\n Sections[SectionsRead].Type = PSEUDO_IMAGE_MARKER;\r\n SectionsRead ++;\r\n HaveAll = 1;\r\n }\r\n return TRUE;\r\n\r\n case M_DQT:\r\n // Use for jpeg quality guessing\r\n process_DQT(Data, itemlen);\r\n break;\r\n\r\n case M_DHT: \r\n // Use for jpeg quality guessing\r\n process_DHT(Data, itemlen);\r\n break;\r\n\r\n\r\n case M_EOI: // in case it's a tables-only JPEG stream\r\n fprintf(stderr,\"No image in jpeg!\\n\");\r\n return FALSE;\r\n\r\n case M_COM: // Comment section\r\n if (HaveCom || ((ReadMode & READ_METADATA) == 0)){\r\n // Discard this section.\r\n free(Sections[--SectionsRead].Data);\r\n }else{\r\n process_COM(Data, itemlen);\r\n HaveCom = TRUE;\r\n }\r\n break;\r\n\r\n case M_JFIF:\r\n // Regular jpegs always have this tag, exif images have the exif\r\n // marker instead, althogh ACDsee will write images with both markers.\r\n // this program will re-create this marker on absence of exif marker.\r\n // hence no need to keep the copy from the file.\r\n if (itemlen < 16){\r\n fprintf(stderr,\"Jfif header too short\\n\");\r\n goto ignore;\r\n }\r\n if (memcmp(Data+2, \"JFIF\\0\",5)){\r\n fprintf(stderr,\"Header missing JFIF marker\\n\");\r\n }\r\n\r\n ImageInfo.JfifHeader.Present = TRUE;\r\n ImageInfo.JfifHeader.ResolutionUnits = Data[9];\r\n ImageInfo.JfifHeader.XDensity = (Data[10]<<8) | Data[11];\r\n ImageInfo.JfifHeader.YDensity = (Data[12]<<8) | Data[13];\r\n if (ShowTags){\r\n printf(\"JFIF SOI marker: Units: %d \",ImageInfo.JfifHeader.ResolutionUnits);\r\n switch(ImageInfo.JfifHeader.ResolutionUnits){\r\n case 0: printf(\"(aspect ratio)\"); break;\r\n case 1: printf(\"(dots per inch)\"); break;\r\n case 2: printf(\"(dots per cm)\"); break;\r\n default: printf(\"(unknown)\"); break;\r\n }\r\n printf(\" X-density=%d Y-density=%d\\n\",ImageInfo.JfifHeader.XDensity, ImageInfo.JfifHeader.YDensity);\r\n\r\n if (Data[14] || Data[15]){\r\n fprintf(stderr,\"Ignoring jfif header thumbnail\\n\");\r\n }\r\n }\r\n\r\n ignore:\r\n\r\n free(Sections[--SectionsRead].Data);\r\n break;\r\n\r\n case M_EXIF:\r\n // There can be different section using the same marker.\r\n if (ReadMode & READ_METADATA){\r\n if (memcmp(Data+2, \"Exif\", 4) == 0){\r\n process_EXIF(Data, itemlen);\r\n break;\r\n }else if (memcmp(Data+2, \"http:\", 5) == 0){\r\n Sections[SectionsRead-1].Type = M_XMP; // Change tag for internal purposes.\r\n if (ShowTags){\r\n printf(\"Image contains XMP section, %d bytes long\\n\", itemlen);\r\n if (ShowTags){\r\n ShowXmp(Sections[SectionsRead-1]);\r\n }\r\n }\r\n break;\r\n }\r\n }\r\n // Oterwise, discard this section.\r\n free(Sections[--SectionsRead].Data);\r\n break;\r\n\r\n case M_IPTC:\r\n if (ReadMode & READ_METADATA){\r\n if (ShowTags){\r\n printf(\"Image contains IPTC section, %d bytes long\\n\", itemlen);\r\n }\r\n // Note: We just store the IPTC section. Its relatively straightforward\r\n // and we don't act on any part of it, so just display it at parse time.\r\n }else{\r\n free(Sections[--SectionsRead].Data);\r\n }\r\n break;\r\n \r\n case M_SOF0: \r\n case M_SOF1: \r\n case M_SOF2: \r\n case M_SOF3: \r\n case M_SOF5: \r\n case M_SOF6: \r\n case M_SOF7: \r\n case M_SOF9: \r\n case M_SOF10:\r\n case M_SOF11:\r\n case M_SOF13:\r\n case M_SOF14:\r\n case M_SOF15:\r\n if (itemlen < 8){\r\n fprintf(stderr,\"Section too short\\n\");\r\n break;\r\n }\r\n process_SOFn(Data, marker);\r\n break;\r\n default:\r\n // Skip any other sections.\r\n if (ShowTags){\r\n printf(\"Jpeg section marker 0x%02x size %d\\n\",marker, itemlen);\r\n }\r\n break;\r\n }\r\n }\r\n return TRUE;\r\n}\r",
  8136. "project": "jhead",
  8137. "hash": 42724157494429028607325548164811225506,
  8138. "size": 229,
  8139. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8140. "message": "Same error as previous checking in different function",
  8141. "target": 0,
  8142. "dataset": "other",
  8143. "idx": 261979
  8144. },
  8145. {
  8146. "func": "void DiscardData(void)\r\n{\r\n int a;\r\n\r\n for (a=0;a<SectionsRead;a++){\r\n free(Sections[a].Data);\r\n }\r\n\r\n memset(&ImageInfo, 0, sizeof(ImageInfo));\r\n SectionsRead = 0;\r\n HaveAll = 0;\r\n}\r",
  8147. "project": "jhead",
  8148. "hash": 235139893666732244556011120231657274967,
  8149. "size": 12,
  8150. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8151. "message": "Same error as previous checking in different function",
  8152. "target": 0,
  8153. "dataset": "other",
  8154. "idx": 261971
  8155. },
  8156. {
  8157. "func": "int ReadJpegFile(const char * FileName, ReadMode_t ReadMode)\r\n{\r\n FILE * infile;\r\n int ret;\r\n\r\n infile = fopen(FileName, \"rb\"); // Unix ignores 'b', windows needs it.\r\n\r\n if (infile == NULL) {\r\n fprintf(stderr, \"can't open '%s'\\n\", FileName);\r\n return FALSE;\r\n }\r\n\r\n\r\n // Scan the JPEG headers.\r\n ret = ReadJpegSections(infile, ReadMode);\r\n if (!ret){\r\n if (ReadMode == READ_ANY){\r\n // Process any files mode. Ignore the fact that it's not\r\n // a jpeg file.\r\n ret = TRUE;\r\n }else{\r\n fprintf(stderr,\"Not JPEG: %s\\n\",FileName);\r\n }\r\n }\r\n\r\n fclose(infile);\r\n\r\n if (ret == FALSE){\r\n DiscardData();\r\n }\r\n return ret;\r\n}\r",
  8158. "project": "jhead",
  8159. "hash": 182307760354961996623721805825707445609,
  8160. "size": 32,
  8161. "commit_id": "b8d78e5ec982e86cdd70ebfc1ebbb2273c982eea",
  8162. "message": "Same error as previous checking in different function",
  8163. "target": 0,
  8164. "dataset": "other",
  8165. "idx": 261972
  8166. }
  8167. ]
  8168. },
  8169. {
  8170. "call_depth": 3,
  8171. "longest_call_chain": [
  8172. "WriteWEBPImage",
  8173. "WriteAnimatedWEBPImage",
  8174. "WriteSingleWEBPImage"
  8175. ],
  8176. "group_size": 5,
  8177. "functions": [
  8178. {
  8179. "func": "static MagickBooleanType WriteWEBPImage(const ImageInfo *image_info,\n Image *image)\n{\n const char\n *value;\n\n int\n webp_status;\n\n MagickBooleanType\n status;\n\n WebPAuxStats\n statistics;\n\n WebPConfig\n configure;\n\n#if defined(MAGICKCORE_WEBPMUX_DELEGATE)\n WebPMemoryWriter\n writer_info;\n#endif\n\n WebPPicture\n picture;\n\n PictureMemory\n memory = {0};\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n if ((image->columns > 16383UL) || (image->rows > 16383UL))\n ThrowWriterException(ImageError,\"WidthOrHeightExceedsLimit\");\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);\n if (status == MagickFalse)\n return(status);\n if (WebPConfigInit(&configure) == 0)\n ThrowWriterException(ResourceLimitError,\"UnableToEncodeImageFile\");\n if (WebPPictureInit(&picture) == 0)\n ThrowWriterException(ResourceLimitError,\"UnableToEncodeImageFile\");\n#if !defined(MAGICKCORE_WEBPMUX_DELEGATE)\n picture.writer=WebPEncodeWriter;\n picture.custom_ptr=(void *) image;\n#else\n WebPMemoryWriterInit(&writer_info);\n picture.writer=WebPMemoryWrite;\n picture.custom_ptr=(&writer_info);\n#endif\n picture.stats=(&statistics);\n if (image->quality != UndefinedCompressionQuality)\n configure.quality=(float) image->quality;\n if (image->quality >= 100)\n configure.lossless=1;\n value=GetImageOption(image_info,\"webp:lossless\");\n if (value != (char *) NULL)\n configure.lossless=(int) ParseCommandOption(MagickBooleanOptions,\n MagickFalse,value);\n value=GetImageOption(image_info,\"webp:method\");\n if (value != (char *) NULL)\n configure.method=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:image-hint\");\n if (value != (char *) NULL)\n {\n if (LocaleCompare(value,\"default\") == 0)\n configure.image_hint=WEBP_HINT_DEFAULT;\n if (LocaleCompare(value,\"photo\") == 0)\n configure.image_hint=WEBP_HINT_PHOTO;\n if (LocaleCompare(value,\"picture\") == 0)\n configure.image_hint=WEBP_HINT_PICTURE;\n#if WEBP_ENCODER_ABI_VERSION >= 0x0200\n if (LocaleCompare(value,\"graph\") == 0)\n configure.image_hint=WEBP_HINT_GRAPH;\n#endif\n }\n value=GetImageOption(image_info,\"webp:target-size\");\n if (value != (char *) NULL)\n configure.target_size=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:target-psnr\");\n if (value != (char *) NULL)\n configure.target_PSNR=(float) StringToDouble(value,(char **) NULL);\n value=GetImageOption(image_info,\"webp:segments\");\n if (value != (char *) NULL)\n configure.segments=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:sns-strength\");\n if (value != (char *) NULL)\n configure.sns_strength=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:filter-strength\");\n if (value != (char *) NULL)\n configure.filter_strength=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:filter-sharpness\");\n if (value != (char *) NULL)\n configure.filter_sharpness=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:filter-type\");\n if (value != (char *) NULL)\n configure.filter_type=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:auto-filter\");\n if (value != (char *) NULL)\n configure.autofilter=(int) ParseCommandOption(MagickBooleanOptions,\n MagickFalse,value);\n value=GetImageOption(image_info,\"webp:alpha-compression\");\n if (value != (char *) NULL)\n configure.alpha_compression=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:alpha-filtering\");\n if (value != (char *) NULL)\n configure.alpha_filtering=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:alpha-quality\");\n if (value != (char *) NULL)\n configure.alpha_quality=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:pass\");\n if (value != (char *) NULL)\n configure.pass=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:show-compressed\");\n if (value != (char *) NULL)\n configure.show_compressed=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:preprocessing\");\n if (value != (char *) NULL)\n configure.preprocessing=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:partitions\");\n if (value != (char *) NULL)\n configure.partitions=StringToInteger(value);\n value=GetImageOption(image_info,\"webp:partition-limit\");\n if (value != (char *) NULL)\n configure.partition_limit=StringToInteger(value);\n#if WEBP_ENCODER_ABI_VERSION >= 0x0201\n value=GetImageOption(image_info,\"webp:emulate-jpeg-size\");\n if (value != (char *) NULL)\n configure.emulate_jpeg_size=(int) ParseCommandOption(MagickBooleanOptions,\n MagickFalse,value);\n value=GetImageOption(image_info,\"webp:low-memory\");\n if (value != (char *) NULL)\n configure.low_memory=(int) ParseCommandOption(MagickBooleanOptions,\n MagickFalse,value);\n value=GetImageOption(image_info,\"webp:thread-level\");\n if (value != (char *) NULL)\n configure.thread_level=StringToInteger(value);\n#endif\n#if WEBP_ENCODER_ABI_VERSION >= 0x020e\n value=GetImageOption(image_info,\"webp:use-sharp-yuv\");\n if (value != (char *) NULL)\n configure.use_sharp_yuv=StringToInteger(value);\n#endif\n if (WebPValidateConfig(&configure) == 0)\n ThrowWriterException(ResourceLimitError,\"UnableToEncodeImageFile\");\n\n WriteSingleWEBPImage(image_info,image,&picture,&memory,&image->exception);\n\n#if defined(MAGICKCORE_WEBPMUX_DELEGATE)\n if ((image_info->adjoin != MagickFalse) &&\n (GetPreviousImageInList(image) == (Image *) NULL) &&\n (GetNextImageInList(image) != (Image *) NULL) &&\n (image->iterations != 1))\n WriteAnimatedWEBPImage(image_info,image,&configure,&writer_info,&image->exception);\n#endif\n\n webp_status=WebPEncode(&configure,&picture);\n if (webp_status == 0)\n {\n const char\n *message;\n\n switch (picture.error_code)\n {\n case VP8_ENC_ERROR_OUT_OF_MEMORY:\n {\n message=\"out of memory\";\n break;\n }\n case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY:\n {\n message=\"bitstream out of memory\";\n break;\n }\n case VP8_ENC_ERROR_NULL_PARAMETER:\n {\n message=\"NULL parameter\";\n break;\n }\n case VP8_ENC_ERROR_INVALID_CONFIGURATION:\n {\n message=\"invalid configuration\";\n break;\n }\n case VP8_ENC_ERROR_BAD_DIMENSION:\n {\n message=\"bad dimension\";\n break;\n }\n case VP8_ENC_ERROR_PARTITION0_OVERFLOW:\n {\n message=\"partition 0 overflow (> 512K)\";\n break;\n }\n case VP8_ENC_ERROR_PARTITION_OVERFLOW:\n {\n message=\"partition overflow (> 16M)\";\n break;\n }\n case VP8_ENC_ERROR_BAD_WRITE:\n {\n message=\"bad write\";\n break;\n }\n case VP8_ENC_ERROR_FILE_TOO_BIG:\n {\n message=\"file too big (> 4GB)\";\n break;\n }\n#if WEBP_ENCODER_ABI_VERSION >= 0x0100\n case VP8_ENC_ERROR_USER_ABORT:\n {\n message=\"user abort\";\n break;\n }\n#endif\n default:\n {\n message=\"unknown exception\";\n break;\n }\n }\n (void) ThrowMagickException(&image->exception,GetMagickModule(),CorruptImageError,\n (char *) message,\"`%s'\",image->filename);\n }\n#if defined(MAGICKCORE_WEBPMUX_DELEGATE)\n {\n const StringInfo\n *profile;\n\n WebPData\n chunk,\n image_chunk;\n\n WebPMux\n *mux;\n\n WebPMuxError\n mux_error;\n\n /*\n Set image profiles (if any).\n */\n image_chunk.bytes=writer_info.mem;\n image_chunk.size=writer_info.size;\n mux_error=WEBP_MUX_OK;\n (void) memset(&chunk,0,sizeof(chunk));\n mux=WebPMuxNew();\n profile=GetImageProfile(image,\"ICC\");\n if ((profile != (StringInfo *) NULL) && (mux_error == WEBP_MUX_OK))\n {\n chunk.bytes=GetStringInfoDatum(profile);\n chunk.size=GetStringInfoLength(profile);\n mux_error=WebPMuxSetChunk(mux,\"ICCP\",&chunk,0);\n }\n profile=GetImageProfile(image,\"EXIF\");\n if ((profile != (StringInfo *) NULL) && (mux_error == WEBP_MUX_OK))\n {\n chunk.bytes=GetStringInfoDatum(profile);\n chunk.size=GetStringInfoLength(profile);\n if ((chunk.size >= 6) &&\n (chunk.bytes[0] == 'E') && (chunk.bytes[1] == 'x') &&\n (chunk.bytes[2] == 'i') && (chunk.bytes[3] == 'f') &&\n (chunk.bytes[4] == '\\0') && (chunk.bytes[5] == '\\0'))\n {\n chunk.bytes=GetStringInfoDatum(profile)+6;\n chunk.size-=6;\n }\n mux_error=WebPMuxSetChunk(mux,\"EXIF\",&chunk,0);\n }\n profile=GetImageProfile(image,\"XMP\");\n if ((profile != (StringInfo *) NULL) && (mux_error == WEBP_MUX_OK))\n {\n chunk.bytes=GetStringInfoDatum(profile);\n chunk.size=GetStringInfoLength(profile);\n mux_error=WebPMuxSetChunk(mux,\"XMP\",&chunk,0);\n }\n if (mux_error != WEBP_MUX_OK)\n (void) ThrowMagickException(&image->exception,GetMagickModule(),\n ResourceLimitError,\"UnableToEncodeImageFile\",\"`%s'\",image->filename);\n if (chunk.size != 0)\n {\n WebPData\n picture_profiles;\n\n /*\n Replace original container with image profile (if any).\n */\n picture_profiles.bytes=writer_info.mem;\n picture_profiles.size=writer_info.size;\n WebPMuxSetImage(mux,&image_chunk,1);\n mux_error=WebPMuxAssemble(mux,&picture_profiles);\n WebPMemoryWriterClear(&writer_info);\n writer_info.size=picture_profiles.size;\n writer_info.mem=(unsigned char *) picture_profiles.bytes;\n }\n WebPMuxDelete(mux);\n }\n (void) WriteBlob(image,writer_info.size,writer_info.mem);\n#endif\n picture.argb=(uint32_t *) NULL;\n WebPPictureFree(&picture);\n#if defined(MAGICKCORE_WEBPMUX_DELEGATE)\n WebPMemoryWriterClear(&writer_info);\n#endif\n (void) CloseBlob(image);\n RelinquishVirtualMemory(memory.pixel_info);\n return(webp_status == 0 ? MagickFalse : MagickTrue);\n}",
  8180. "project": "ImageMagick6",
  8181. "hash": 119946347181760794580512753926997806486,
  8182. "size": 314,
  8183. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  8184. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  8185. "target": 0,
  8186. "dataset": "other",
  8187. "idx": 370818
  8188. },
  8189. {
  8190. "func": "static void FreePictureMemoryList (PictureMemory* head) {\n PictureMemory* next;\n while(head != NULL) {\n next = head->next;\n if(head->pixel_info != NULL)\n RelinquishVirtualMemory(head->pixel_info);\n free(head);\n head = next;\n }\n}",
  8191. "project": "ImageMagick6",
  8192. "hash": 292386166158901336250318830950126269652,
  8193. "size": 10,
  8194. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  8195. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  8196. "target": 0,
  8197. "dataset": "other",
  8198. "idx": 370811
  8199. },
  8200. {
  8201. "func": "static MagickBooleanType WriteSingleWEBPImage(const ImageInfo *image_info,\n Image *image,WebPPicture *picture,PictureMemory *picture_memory,\n ExceptionInfo *exception)\n{\n MagickBooleanType\n status = MagickFalse;\n\n uint32_t\n *magick_restrict q;\n\n ssize_t\n y;\n\n#if WEBP_ENCODER_ABI_VERSION >= 0x0100\n picture->progress_hook=WebPEncodeProgress;\n picture->user_data=(void *) image;\n#endif\n picture->width=(int) image->columns;\n picture->height=(int) image->rows;\n picture->argb_stride=(int) image->columns;\n picture->use_argb=1;\n\n /*\n Allocate memory for pixels.\n */\n (void) TransformImageColorspace(image,sRGBColorspace);\n picture_memory->pixel_info=AcquireVirtualMemory(image->columns,image->rows*\n sizeof(*(picture->argb)));\n\n if (picture_memory->pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n picture->argb=(uint32_t *) GetVirtualMemoryBlob(picture_memory->pixel_info);\n /*\n Convert image to WebP raster pixels.\n */\n q=picture->argb;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n const PixelPacket\n *magick_restrict p;\n\n ssize_t\n x;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=(uint32_t) (image->matte != MagickFalse ? (uint32_t)\n ScaleQuantumToChar(GetPixelAlpha(p)) << 24 : 0xff000000) |\n ((uint32_t) ScaleQuantumToChar(GetPixelRed(p)) << 16) |\n ((uint32_t) ScaleQuantumToChar(GetPixelGreen(p)) << 8) |\n ((uint32_t) ScaleQuantumToChar(GetPixelBlue(p)));\n p++;\n }\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n return status;\n}",
  8202. "project": "ImageMagick6",
  8203. "hash": 220261224620017316800574317796322837451,
  8204. "size": 63,
  8205. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  8206. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  8207. "target": 0,
  8208. "dataset": "other",
  8209. "idx": 370817
  8210. },
  8211. {
  8212. "func": "static MagickBooleanType WriteAnimatedWEBPImage(const ImageInfo *image_info,\n Image *image,WebPConfig *configure,WebPMemoryWriter *writer_info,\n ExceptionInfo *exception)\n{\n Image\n *first_image;\n\n PictureMemory\n *current,\n *head;\n\n size_t\n effective_delta = 0,\n frame_timestamp = 0;\n\n WebPAnimEncoder\n *enc;\n\n WebPAnimEncoderOptions\n enc_options;\n\n WebPData\n webp_data;\n\n WebPPicture\n picture;\n\n WebPAnimEncoderOptionsInit(&enc_options);\n if (image_info->verbose)\n enc_options.verbose = 1;\n\n image=CoalesceImages(image, exception);\n first_image=image;\n enc=WebPAnimEncoderNew((int) image->page.width,(int) image->page.height,\n &enc_options);\n\n head=(PictureMemory *) calloc(sizeof(*head),1);\n current=head;\n\n while (image != NULL)\n {\n if (WebPPictureInit(&picture) == 0)\n ThrowWriterException(ResourceLimitError,\"UnableToEncodeImageFile\");\n\n WriteSingleWEBPImage(image_info, image, &picture, current, exception);\n\n effective_delta = image->delay*1000/image->ticks_per_second;\n if (effective_delta < 10)\n effective_delta = 100; /* Consistent with gif2webp */\n frame_timestamp+=effective_delta;\n\n WebPAnimEncoderAdd(enc,&picture,(int) frame_timestamp,configure);\n\n image = GetNextImageInList(image);\n current->next=(PictureMemory *) calloc(sizeof(*head), 1);\n current = current->next;\n }\n webp_data.bytes=writer_info->mem;\n webp_data.size=writer_info->size;\n WebPAnimEncoderAssemble(enc, &webp_data);\n WebPMemoryWriterClear(writer_info);\n writer_info->size=webp_data.size;\n writer_info->mem=(unsigned char *) webp_data.bytes;\n WebPAnimEncoderDelete(enc);\n DestroyImageList(first_image);\n FreePictureMemoryList(head);\n return(MagickTrue);\n}",
  8213. "project": "ImageMagick6",
  8214. "hash": 88540247361010854619934050091886652539,
  8215. "size": 68,
  8216. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  8217. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  8218. "target": 1,
  8219. "dataset": "other",
  8220. "idx": 205720
  8221. },
  8222. {
  8223. "func": "static MagickBooleanType WriteAnimatedWEBPImage(const ImageInfo *image_info,\n Image *image,WebPConfig *configure,WebPMemoryWriter *writer_info,\n ExceptionInfo *exception)\n{\n Image\n *first_image;\n\n PictureMemory\n *current,\n *head;\n\n size_t\n effective_delta = 0,\n frame_timestamp = 0;\n\n WebPAnimEncoder\n *enc;\n\n WebPAnimEncoderOptions\n enc_options;\n\n WebPData\n webp_data;\n\n WebPPicture\n picture;\n\n WebPAnimEncoderOptionsInit(&enc_options);\n if (image_info->verbose)\n enc_options.verbose = 1;\n\n image=CoalesceImages(image, exception);\n first_image=image;\n enc=WebPAnimEncoderNew((int) image->page.width,(int) image->page.height,\n &enc_options);\n\n head=(PictureMemory *) calloc(sizeof(*head),1);\n current=head;\n\n while (image != NULL)\n {\n if (WebPPictureInit(&picture) == 0)\n ThrowWriterException(ResourceLimitError,\"UnableToEncodeImageFile\");\n\n WriteSingleWEBPImage(image_info, image, &picture, current, exception);\n\n effective_delta = image->delay*1000*PerceptibleReciprocal(\n image->ticks_per_second);\n if (effective_delta < 10)\n effective_delta = 100; /* Consistent with gif2webp */\n frame_timestamp+=effective_delta;\n\n WebPAnimEncoderAdd(enc,&picture,(int) frame_timestamp,configure);\n\n image = GetNextImageInList(image);\n current->next=(PictureMemory *) calloc(sizeof(*head), 1);\n current = current->next;\n }\n webp_data.bytes=writer_info->mem;\n webp_data.size=writer_info->size;\n WebPAnimEncoderAssemble(enc, &webp_data);\n WebPMemoryWriterClear(writer_info);\n writer_info->size=webp_data.size;\n writer_info->mem=(unsigned char *) webp_data.bytes;\n WebPAnimEncoderDelete(enc);\n DestroyImageList(first_image);\n FreePictureMemoryList(head);\n return(MagickTrue);\n}",
  8224. "project": "ImageMagick6",
  8225. "hash": 184885542608773702111101964268936553139,
  8226. "size": 69,
  8227. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  8228. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  8229. "target": 0,
  8230. "dataset": "other",
  8231. "idx": 370809
  8232. }
  8233. ]
  8234. },
  8235. {
  8236. "call_depth": 4,
  8237. "longest_call_chain": [
  8238. "esdsin",
  8239. "getsize",
  8240. "u8in",
  8241. "datain"
  8242. ],
  8243. "group_size": 20,
  8244. "functions": [
  8245. {
  8246. "func": "static int mdhdin(int size)\n{\n // version/flags\n u32in();\n // Creation time\n mp4config.ctime = u32in();\n // Modification time\n mp4config.mtime = u32in();\n // Time scale\n mp4config.samplerate = u32in();\n // Duration\n mp4config.samples = u32in();\n // Language\n u16in();\n // pre_defined\n u16in();\n\n return size;\n};",
  8247. "project": "faad2",
  8248. "hash": 199526141618945524307402126500239822292,
  8249. "size": 19,
  8250. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8251. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8252. "target": 0,
  8253. "dataset": "other",
  8254. "idx": 221437
  8255. },
  8256. {
  8257. "func": "static int hdlr2in(int size)\n{\n uint8_t buf[4];\n\n // version/flags\n u32in();\n // Predefined\n u32in();\n // Handler type\n datain(buf, 4);\n if (memcmp(buf, \"mdir\", 4))\n return ERR_FAIL;\n datain(buf, 4);\n if (memcmp(buf, \"appl\", 4))\n return ERR_FAIL;\n // Reserved\n u32in();\n u32in();\n // null terminator\n u8in();\n\n return size;\n};",
  8258. "project": "faad2",
  8259. "hash": 115686852012050553071183260739078458355,
  8260. "size": 23,
  8261. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8262. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8263. "target": 0,
  8264. "dataset": "other",
  8265. "idx": 221442
  8266. },
  8267. {
  8268. "func": "static int stcoin(int size)\n{\n // version/flags\n u32in();\n // Number of entries\n if (u32in() < 1)\n return ERR_FAIL;\n // first chunk offset\n mp4config.mdatofs = u32in();\n // ignore the rest\n\n return size;\n}",
  8269. "project": "faad2",
  8270. "hash": 24307622088068632029917249868008923896,
  8271. "size": 13,
  8272. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8273. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8274. "target": 0,
  8275. "dataset": "other",
  8276. "idx": 221443
  8277. },
  8278. {
  8279. "func": "static int stszin(int size)\n{\n int cnt;\n uint32_t ofs;\n\n // version/flags\n u32in();\n // Sample size\n u32in();\n // Number of entries\n mp4config.frame.ents = u32in();\n // fixme: check atom size\n mp4config.frame.data = malloc(sizeof(*mp4config.frame.data)\n * (mp4config.frame.ents + 1));\n\n if (!mp4config.frame.data)\n return ERR_FAIL;\n\n ofs = 0;\n mp4config.frame.data[0] = ofs;\n for (cnt = 0; cnt < mp4config.frame.ents; cnt++)\n {\n uint32_t fsize = u32in();\n\n ofs += fsize;\n if (mp4config.frame.maxsize < fsize)\n mp4config.frame.maxsize = fsize;\n\n mp4config.frame.data[cnt + 1] = ofs;\n\n if (ofs < mp4config.frame.data[cnt])\n return ERR_FAIL;\n }\n\n return size;\n}",
  8280. "project": "faad2",
  8281. "hash": 162931728092633650703368658690852714538,
  8282. "size": 36,
  8283. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8284. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8285. "target": 1,
  8286. "dataset": "other",
  8287. "idx": 195084
  8288. },
  8289. {
  8290. "func": "static int stszin(int size)\n{\n int cnt;\n uint32_t ofs;\n\n // version/flags\n u32in();\n // Sample size\n u32in();\n // Number of entries\n mp4config.frame.ents = u32in();\n\n if (!(mp4config.frame.ents + 1))\n return ERR_FAIL;\n\n mp4config.frame.data = malloc(sizeof(*mp4config.frame.data)\n * (mp4config.frame.ents + 1));\n\n if (!mp4config.frame.data)\n return ERR_FAIL;\n\n ofs = 0;\n mp4config.frame.data[0] = ofs;\n for (cnt = 0; cnt < mp4config.frame.ents; cnt++)\n {\n uint32_t fsize = u32in();\n\n ofs += fsize;\n if (mp4config.frame.maxsize < fsize)\n mp4config.frame.maxsize = fsize;\n\n mp4config.frame.data[cnt + 1] = ofs;\n\n if (ofs < mp4config.frame.data[cnt])\n return ERR_FAIL;\n }\n\n return size;\n}",
  8291. "project": "faad2",
  8292. "hash": 128822819783274424928244029461541937327,
  8293. "size": 39,
  8294. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8295. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8296. "target": 0,
  8297. "dataset": "other",
  8298. "idx": 221432
  8299. },
  8300. {
  8301. "func": "static int stsdin(int size)\n{\n // version/flags\n u32in();\n // Number of entries(one 'mp4a')\n if (u32in() != 1) //fixme: error handling\n return ERR_FAIL;\n\n return size;\n};",
  8302. "project": "faad2",
  8303. "hash": 197184068360264270082776493704524314753,
  8304. "size": 10,
  8305. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8306. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8307. "target": 0,
  8308. "dataset": "other",
  8309. "idx": 221440
  8310. },
  8311. {
  8312. "func": "static int esdsin(int size)\n{\n // descriptor tree:\n // MP4ES_Descriptor\n // MP4DecoderConfigDescriptor\n // MP4DecSpecificInfoDescriptor\n // MP4SLConfigDescriptor\n enum\n { TAG_ES = 3, TAG_DC = 4, TAG_DSI = 5, TAG_SLC = 6 };\n\n // version/flags\n u32in();\n if (u8in() != TAG_ES)\n return ERR_FAIL;\n getsize();\n // ESID\n u16in();\n // flags(url(bit 6); ocr(5); streamPriority (0-4)):\n u8in();\n\n if (u8in() != TAG_DC)\n return ERR_FAIL;\n getsize();\n if (u8in() != 0x40) /* not MPEG-4 audio */\n return ERR_FAIL;\n // flags\n u8in();\n // buffer size (24 bits)\n mp4config.buffersize = u16in() << 8;\n mp4config.buffersize |= u8in();\n // bitrate\n mp4config.bitratemax = u32in();\n mp4config.bitrateavg = u32in();\n\n if (u8in() != TAG_DSI)\n return ERR_FAIL;\n mp4config.asc.size = getsize();\n if (mp4config.asc.size > sizeof(mp4config.asc.buf))\n return ERR_FAIL;\n // get AudioSpecificConfig\n datain(mp4config.asc.buf, mp4config.asc.size);\n\n if (u8in() != TAG_SLC)\n return ERR_FAIL;\n getsize();\n // \"predefined\" (no idea)\n u8in();\n\n return size;\n}",
  8313. "project": "faad2",
  8314. "hash": 249840270236166144899568226199914208820,
  8315. "size": 50,
  8316. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8317. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8318. "target": 0,
  8319. "dataset": "other",
  8320. "idx": 221441
  8321. },
  8322. {
  8323. "func": "static int mp4ain(int size)\n{\n // Reserved (6 bytes)\n u32in();\n u16in();\n // Data reference index\n u16in();\n // Version\n u16in();\n // Revision level\n u16in();\n // Vendor\n u32in();\n // Number of channels\n mp4config.channels = u16in();\n // Sample size (bits)\n mp4config.bits = u16in();\n // Compression ID\n u16in();\n // Packet size\n u16in();\n // Sample rate (16.16)\n // fractional framerate, probably not for audio\n // rate integer part\n u16in();\n // rate reminder part\n u16in();\n\n return size;\n}",
  8324. "project": "faad2",
  8325. "hash": 177094373413499688540303899101743171346,
  8326. "size": 30,
  8327. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8328. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8329. "target": 0,
  8330. "dataset": "other",
  8331. "idx": 221447
  8332. },
  8333. {
  8334. "func": "static uint32_t getsize(void)\n{\n int cnt;\n uint32_t size = 0;\n for (cnt = 0; cnt < 4; cnt++)\n {\n int tmp = u8in();\n\n size <<= 7;\n size |= (tmp & 0x7f);\n if (!(tmp & 0x80))\n break;\n }\n return size;\n}",
  8335. "project": "faad2",
  8336. "hash": 67050648525714646687008989580781566943,
  8337. "size": 15,
  8338. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8339. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8340. "target": 0,
  8341. "dataset": "other",
  8342. "idx": 221430
  8343. },
  8344. {
  8345. "func": "static int stringin(char *txt, int sizemax)\n{\n int size;\n for (size = 0; size < sizemax; size++)\n {\n if (fread(txt + size, 1, 1, g_fin) != 1)\n return ERR_FAIL;\n if (!txt[size])\n break;\n }\n txt[sizemax-1] = '\\0';\n\n return size;\n}",
  8346. "project": "faad2",
  8347. "hash": 310710672344492615641722231561510106411,
  8348. "size": 14,
  8349. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8350. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8351. "target": 0,
  8352. "dataset": "other",
  8353. "idx": 221444
  8354. },
  8355. {
  8356. "func": "static int u8in(void)\n{\n uint8_t u8;\n datain(&u8, 1);\n return u8;\n}",
  8357. "project": "faad2",
  8358. "hash": 313092909630100574008088062923509792283,
  8359. "size": 6,
  8360. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8361. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8362. "target": 0,
  8363. "dataset": "other",
  8364. "idx": 221439
  8365. },
  8366. {
  8367. "func": "static uint32_t u32in(void)\n{\n uint32_t u32;\n datain(&u32, 4);\n u32 = bswap32(u32);\n return u32;\n}",
  8368. "project": "faad2",
  8369. "hash": 90610583081550478693284108046074781749,
  8370. "size": 7,
  8371. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8372. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8373. "target": 0,
  8374. "dataset": "other",
  8375. "idx": 221454
  8376. },
  8377. {
  8378. "func": "static inline uint32_t bswap32(const uint32_t u32)\n{\n#ifndef WORDS_BIGENDIAN\n#if defined (__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))\n return __builtin_bswap32(u32);\n#elif defined (_MSC_VER)\n return _byteswap_ulong(u32);\n#else\n return (u32 << 24) | ((u32 << 8) & 0xFF0000) | ((u32 >> 8) & 0xFF00) | (u32 >> 24);\n#endif\n#else\n return u32;\n#endif\n}",
  8379. "project": "faad2",
  8380. "hash": 220379345707008644331573635180825066237,
  8381. "size": 14,
  8382. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8383. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8384. "target": 0,
  8385. "dataset": "other",
  8386. "idx": 221431
  8387. },
  8388. {
  8389. "func": "static int ilstin(int size)\n{\n enum {NUMSET = 1, GENRE, EXTAG};\n int read = 0;\n\n static struct {\n char *name;\n char *id;\n int flag;\n } tags[] = {\n {\"Album \", \"\\xa9\" \"alb\"},\n {\"Album Artist\", \"aART\"},\n {\"Artist \", \"\\xa9\" \"ART\"},\n {\"Comment \", \"\\xa9\" \"cmt\"},\n {\"Cover image \", \"covr\"},\n {\"Compilation \", \"cpil\"},\n {\"Copyright \", \"cprt\"},\n {\"Date \", \"\\xa9\" \"day\"},\n {\"Disc# \", \"disk\", NUMSET},\n {\"Genre \", \"gnre\", GENRE},\n {\"Grouping \", \"\\xa9\" \"grp\"},\n {\"Lyrics \", \"\\xa9\" \"lyr\"},\n {\"Title \", \"\\xa9\" \"nam\"},\n {\"Rating \", \"rtng\"},\n {\"BPM \", \"tmpo\"},\n {\"Encoder \", \"\\xa9\" \"too\"},\n {\"Track \", \"trkn\", NUMSET},\n {\"Composer \", \"\\xa9\" \"wrt\"},\n {0, \"----\", EXTAG},\n {0},\n };\n\n static const char *genres[] = {\n \"Blues\", \"Classic Rock\", \"Country\", \"Dance\",\n \"Disco\", \"Funk\", \"Grunge\", \"Hip-Hop\",\n \"Jazz\", \"Metal\", \"New Age\", \"Oldies\",\n \"Other\", \"Pop\", \"R&B\", \"Rap\",\n \"Reggae\", \"Rock\", \"Techno\", \"Industrial\",\n \"Alternative\", \"Ska\", \"Death Metal\", \"Pranks\",\n \"Soundtrack\", \"Euro-Techno\", \"Ambient\", \"Trip-Hop\",\n \"Vocal\", \"Jazz+Funk\", \"Fusion\", \"Trance\",\n \"Classical\", \"Instrumental\", \"Acid\", \"House\",\n \"Game\", \"Sound Clip\", \"Gospel\", \"Noise\",\n \"Alternative Rock\", \"Bass\", \"Soul\", \"Punk\",\n \"Space\", \"Meditative\", \"Instrumental Pop\", \"Instrumental Rock\",\n \"Ethnic\", \"Gothic\", \"Darkwave\", \"Techno-Industrial\",\n \"Electronic\", \"Pop-Folk\", \"Eurodance\", \"Dream\",\n \"Southern Rock\", \"Comedy\", \"Cult\", \"Gangsta\",\n \"Top 40\", \"Christian Rap\", \"Pop/Funk\", \"Jungle\",\n \"Native US\", \"Cabaret\", \"New Wave\", \"Psychadelic\",\n \"Rave\", \"Showtunes\", \"Trailer\", \"Lo-Fi\",\n \"Tribal\", \"Acid Punk\", \"Acid Jazz\", \"Polka\",\n \"Retro\", \"Musical\", \"Rock & Roll\", \"Hard Rock\",\n \"Folk\", \"Folk-Rock\", \"National Folk\", \"Swing\",\n \"Fast Fusion\", \"Bebob\", \"Latin\", \"Revival\",\n \"Celtic\", \"Bluegrass\", \"Avantgarde\", \"Gothic Rock\",\n \"Progressive Rock\", \"Psychedelic Rock\", \"Symphonic Rock\", \"Slow Rock\",\n \"Big Band\", \"Chorus\", \"Easy Listening\", \"Acoustic\",\n \"Humour\", \"Speech\", \"Chanson\", \"Opera\",\n \"Chamber Music\", \"Sonata\", \"Symphony\", \"Booty Bass\",\n \"Primus\", \"Porn Groove\", \"Satire\", \"Slow Jam\",\n \"Club\", \"Tango\", \"Samba\", \"Folklore\",\n \"Ballad\", \"Power Ballad\", \"Rhythmic Soul\", \"Freestyle\",\n \"Duet\", \"Punk Rock\", \"Drum Solo\", \"Acapella\",\n \"Euro-House\", \"Dance Hall\", \"Goa\", \"Drum & Bass\",\n \"Club - House\", \"Hardcore\", \"Terror\", \"Indie\",\n \"BritPop\", \"Negerpunk\", \"Polsk Punk\", \"Beat\",\n \"Christian Gangsta Rap\", \"Heavy Metal\", \"Black Metal\", \"Crossover\",\n \"Contemporary Christian\", \"Christian Rock\", \"Merengue\", \"Salsa\",\n \"Thrash Metal\", \"Anime\", \"JPop\", \"Synthpop\",\n \"Unknown\",\n };\n\n fprintf(stderr, \"----------tag list-------------\\n\");\n while(read < size)\n {\n int asize, dsize;\n uint8_t id[5];\n int cnt;\n uint32_t type;\n\n id[4] = 0;\n\n asize = u32in();\n read += asize;\n asize -= 4;\n if (datain(id, 4) < 4)\n return ERR_FAIL;\n asize -= 4;\n\n for (cnt = 0; tags[cnt].id; cnt++)\n {\n if (!memcmp(id, tags[cnt].id, 4))\n break;\n }\n\n if (tags[cnt].name)\n fprintf(stderr, \"%s : \", tags[cnt].name);\n else\n {\n if (tags[cnt].flag != EXTAG)\n fprintf(stderr, \"'%s' : \", id);\n }\n\n dsize = u32in();\n asize -= 4;\n if (datain(id, 4) < 4)\n return ERR_FAIL;\n asize -= 4;\n\n if (tags[cnt].flag != EXTAG)\n {\n if (memcmp(id, \"data\", 4))\n return ERR_FAIL;\n }\n else\n {\n int spc;\n\n if (memcmp(id, \"mean\", 4))\n goto skip;\n dsize -= 8;\n while (dsize > 0)\n {\n u8in();\n asize--;\n dsize--;\n }\n if (asize >= 8)\n {\n dsize = u32in() - 8;\n asize -= 4;\n if (datain(id, 4) < 4)\n return ERR_FAIL;\n asize -= 4;\n if (memcmp(id, \"name\", 4))\n goto skip;\n u32in();\n asize -= 4;\n dsize -= 4;\n }\n spc = 13 - dsize;\n if (spc < 0) spc = 0;\n while (dsize > 0)\n {\n fprintf(stderr, \"%c\",u8in());\n asize--;\n dsize--;\n }\n while (spc--)\n fprintf(stderr, \" \");\n fprintf(stderr, \": \");\n if (asize >= 8)\n {\n dsize = u32in() - 8;\n asize -= 4;\n if (datain(id, 4) < 4)\n return ERR_FAIL;\n asize -= 4;\n if (memcmp(id, \"data\", 4))\n goto skip;\n u32in();\n asize -= 4;\n dsize -= 4;\n }\n while (dsize > 0)\n {\n fprintf(stderr, \"%c\",u8in());\n asize--;\n dsize--;\n }\n fprintf(stderr, \"\\n\");\n\n goto skip;\n }\n type = u32in();\n asize -= 4;\n u32in();\n asize -= 4;\n\n switch(type)\n {\n case 1:\n while (asize > 0)\n {\n fprintf(stderr, \"%c\",u8in());\n asize--;\n }\n break;\n case 0:\n switch(tags[cnt].flag)\n {\n case NUMSET:\n u16in();\n asize -= 2;\n\n fprintf(stderr, \"%d\", u16in());\n asize -= 2;\n fprintf(stderr, \"/%d\", u16in());\n asize -= 2;\n break;\n case GENRE:\n {\n uint8_t gnum = u16in();\n asize -= 2;\n if (!gnum)\n goto skip;\n gnum--;\n if (gnum >= 147)\n gnum = 147;\n fprintf(stderr, \"%s\", genres[gnum]);\n }\n break;\n default:\n while(asize > 0)\n {\n fprintf(stderr, \"%d/\", u16in());\n asize-=2;\n }\n }\n break;\n case 0x15:\n //fprintf(stderr, \"(8bit data)\");\n while(asize > 0)\n {\n fprintf(stderr, \"%d\", u8in());\n asize--;\n if (asize)\n fprintf(stderr, \"/\");\n }\n break;\n case 0xd:\n fprintf(stderr, \"(image data)\");\n break;\n default:\n fprintf(stderr, \"(unknown data type)\");\n break;\n }\n fprintf(stderr, \"\\n\");\n\n skip:\n // skip to the end of atom\n while (asize > 0)\n {\n u8in();\n asize--;\n }\n }\n fprintf(stderr, \"-------------------------------\\n\");\n\n return size;\n};",
  8390. "project": "faad2",
  8391. "hash": 270817636775156388719722064958229858604,
  8392. "size": 252,
  8393. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8394. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8395. "target": 0,
  8396. "dataset": "other",
  8397. "idx": 221450
  8398. },
  8399. {
  8400. "func": "static int hdlr1in(int size)\n{\n uint8_t buf[5];\n\n buf[4] = 0;\n // version/flags\n u32in();\n // pre_defined\n u32in();\n // Component subtype\n datain(buf, 4);\n if (mp4config.verbose.header)\n fprintf(stderr, \"*track media type: '%s': \", buf);\n if (memcmp(\"soun\", buf, 4))\n {\n if (mp4config.verbose.header)\n fprintf(stderr, \"unsupported, skipping\\n\");\n return ERR_UNSUPPORTED;\n }\n else\n {\n if (mp4config.verbose.header)\n fprintf(stderr, \"OK\\n\");\n }\n // reserved\n u32in();\n u32in();\n u32in();\n // name\n // null terminate\n u8in();\n\n return size;\n};",
  8401. "project": "faad2",
  8402. "hash": 154591307517079041335713649658869234735,
  8403. "size": 34,
  8404. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8405. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8406. "target": 0,
  8407. "dataset": "other",
  8408. "idx": 221445
  8409. },
  8410. {
  8411. "func": "static int metain(int size)\n{\n // version/flags\n u32in();\n\n return ERR_OK;\n};",
  8412. "project": "faad2",
  8413. "hash": 75324055347829734329165615870439980536,
  8414. "size": 7,
  8415. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8416. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8417. "target": 0,
  8418. "dataset": "other",
  8419. "idx": 221455
  8420. },
  8421. {
  8422. "func": "static int ftypin(int size)\n{\n enum {BUFSIZE = 40};\n char buf[BUFSIZE];\n uint32_t u32;\n\n buf[4] = 0;\n datain(buf, 4);\n u32 = u32in();\n\n if (mp4config.verbose.header)\n fprintf(stderr, \"Brand:\\t\\t\\t%s(version %d)\\n\", buf, u32);\n\n stringin(buf, BUFSIZE);\n\n if (mp4config.verbose.header)\n fprintf(stderr, \"Compatible brands:\\t%s\\n\", buf);\n\n return size;\n}",
  8423. "project": "faad2",
  8424. "hash": 50311746152815412413561320829290338062,
  8425. "size": 20,
  8426. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8427. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8428. "target": 0,
  8429. "dataset": "other",
  8430. "idx": 221458
  8431. },
  8432. {
  8433. "func": "static int datain(void *data, int size)\n{\n if (fread(data, 1, size, g_fin) != size)\n return ERR_FAIL;\n return size;\n}",
  8434. "project": "faad2",
  8435. "hash": 338414385361084113991386902383601496212,
  8436. "size": 6,
  8437. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8438. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8439. "target": 0,
  8440. "dataset": "other",
  8441. "idx": 221429
  8442. },
  8443. {
  8444. "func": "static uint16_t u16in(void)\n{\n uint16_t u16;\n datain(&u16, 2);\n u16 = bswap16(u16);\n return u16;\n}",
  8445. "project": "faad2",
  8446. "hash": 300009682279474729032196346079080354587,
  8447. "size": 7,
  8448. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8449. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8450. "target": 0,
  8451. "dataset": "other",
  8452. "idx": 221452
  8453. },
  8454. {
  8455. "func": "static inline uint16_t bswap16(const uint16_t u16)\n{\n#ifndef WORDS_BIGENDIAN\n#if defined (__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 8)))\n return __builtin_bswap16(u16);\n#elif defined (_MSC_VER)\n return _byteswap_ushort(u16);\n#else\n return (u16 << 8) | (u16 >> 8);\n#endif\n#else\n return u16;\n#endif\n}",
  8456. "project": "faad2",
  8457. "hash": 93752458717884206147046017786973658718,
  8458. "size": 14,
  8459. "commit_id": "1b71a6ba963d131375f5e489b3b25e36f19f3f24",
  8460. "message": "fix heap-buffer-overflow in mp4read.c\n\nThis originated from an integer overflow: If mp4config.frame.ents\nwould be read-in with a value of (uint32t)(-1), it would overflow to 0\nin the size calculation for the allocation in the next line. The\nmalloc() function would then successfully return a pointer to a memory\nregion of size 0, which will cause a segfault when written to.\n\nFixes #57.",
  8461. "target": 0,
  8462. "dataset": "other",
  8463. "idx": 221456
  8464. }
  8465. ]
  8466. },
  8467. {
  8468. "call_depth": 3,
  8469. "longest_call_chain": [
  8470. "nfs4_xdr_enc_create_session",
  8471. "encode_create_session",
  8472. "xdr_encode_array"
  8473. ],
  8474. "group_size": 3,
  8475. "functions": [
  8476. {
  8477. "func": "xdr_encode_string(__be32 *p, const char *string)\n{\n\treturn xdr_encode_array(p, string, strlen(string));\n}",
  8478. "project": "linux",
  8479. "hash": 283093132022500626066677416199834873177,
  8480. "size": 4,
  8481. "commit_id": "6d1c0f3d28f98ea2736128ed3e46821496dc3a8c",
  8482. "message": "sunrpc: Avoid a KASAN slab-out-of-bounds bug in xdr_set_page_base()\n\nThis seems to happen fairly easily during READ_PLUS testing on NFS v4.2.\nI found that we could end up accessing xdr->buf->pages[pgnr] with a pgnr\ngreater than the number of pages in the array. So let's just return\nearly if we're setting base to a point at the end of the page data and\nlet xdr_set_tail_base() handle setting up the buffer pointers instead.\n\nSigned-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>\nFixes: 8d86e373b0ef (\"SUNRPC: Clean up helpers xdr_set_iov() and xdr_set_page_base()\")\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  8483. "target": 0,
  8484. "dataset": "other",
  8485. "idx": 481083
  8486. },
  8487. {
  8488. "func": "static void nfs4_xdr_enc_create_session(struct rpc_rqst *req,\n\t\t\t\t\tstruct xdr_stream *xdr,\n\t\t\t\t\tconst void *data)\n{\n\tconst struct nfs41_create_session_args *args = data;\n\tstruct compound_hdr hdr = {\n\t\t.minorversion = args->client->cl_mvops->minor_version,\n\t};\n\n\tencode_compound_hdr(xdr, req, &hdr);\n\tencode_create_session(xdr, args, &hdr);\n\tencode_nops(&hdr);\n}",
  8489. "project": "linux",
  8490. "hash": 54861487140608560829208413179510324463,
  8491. "size": 13,
  8492. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  8493. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  8494. "target": 0,
  8495. "dataset": "other",
  8496. "idx": 430972
  8497. },
  8498. {
  8499. "func": "static void encode_create_session(struct xdr_stream *xdr,\n\t\t\t\t const struct nfs41_create_session_args *args,\n\t\t\t\t struct compound_hdr *hdr)\n{\n\t__be32 *p;\n\tstruct nfs_client *clp = args->client;\n\tstruct rpc_clnt *clnt = clp->cl_rpcclient;\n\tstruct nfs_net *nn = net_generic(clp->cl_net, nfs_net_id);\n\tu32 max_resp_sz_cached;\n\n\t/*\n\t * Assumes OPEN is the biggest non-idempotent compound.\n\t * 2 is the verifier.\n\t */\n\tmax_resp_sz_cached = (NFS4_dec_open_sz + RPC_REPHDRSIZE + 2)\n\t\t\t\t* XDR_UNIT + RPC_MAX_AUTH_SIZE;\n\n\tencode_op_hdr(xdr, OP_CREATE_SESSION, decode_create_session_maxsz, hdr);\n\tp = reserve_space(xdr, 16 + 2*28 + 20 + clnt->cl_nodelen + 12);\n\tp = xdr_encode_hyper(p, args->clientid);\n\t*p++ = cpu_to_be32(args->seqid);\t\t\t/*Sequence id */\n\t*p++ = cpu_to_be32(args->flags);\t\t\t/*flags */\n\n\t/* Fore Channel */\n\t*p++ = cpu_to_be32(0);\t\t\t\t/* header padding size */\n\t*p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz);\t/* max req size */\n\t*p++ = cpu_to_be32(args->fc_attrs.max_resp_sz);\t/* max resp size */\n\t*p++ = cpu_to_be32(max_resp_sz_cached);\t\t/* Max resp sz cached */\n\t*p++ = cpu_to_be32(args->fc_attrs.max_ops);\t/* max operations */\n\t*p++ = cpu_to_be32(args->fc_attrs.max_reqs);\t/* max requests */\n\t*p++ = cpu_to_be32(0);\t\t\t\t/* rdmachannel_attrs */\n\n\t/* Back Channel */\n\t*p++ = cpu_to_be32(0);\t\t\t\t/* header padding size */\n\t*p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz);\t/* max req size */\n\t*p++ = cpu_to_be32(args->bc_attrs.max_resp_sz);\t/* max resp size */\n\t*p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached);\t/* Max resp sz cached */\n\t*p++ = cpu_to_be32(args->bc_attrs.max_ops);\t/* max operations */\n\t*p++ = cpu_to_be32(args->bc_attrs.max_reqs);\t/* max requests */\n\t*p++ = cpu_to_be32(0);\t\t\t\t/* rdmachannel_attrs */\n\n\t*p++ = cpu_to_be32(args->cb_program);\t\t/* cb_program */\n\t*p++ = cpu_to_be32(1);\n\t*p++ = cpu_to_be32(RPC_AUTH_UNIX);\t\t\t/* auth_sys */\n\n\t/* authsys_parms rfc1831 */\n\t*p++ = cpu_to_be32(ktime_to_ns(nn->boot_time));\t/* stamp */\n\tp = xdr_encode_array(p, clnt->cl_nodename, clnt->cl_nodelen);\n\t*p++ = cpu_to_be32(0);\t\t\t\t/* UID */\n\t*p++ = cpu_to_be32(0);\t\t\t\t/* GID */\n\t*p = cpu_to_be32(0);\t\t\t\t/* No more gids */\n}",
  8500. "project": "linux",
  8501. "hash": 271164664246807814614671893720271838784,
  8502. "size": 52,
  8503. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  8504. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  8505. "target": 0,
  8506. "dataset": "other",
  8507. "idx": 431326
  8508. }
  8509. ]
  8510. },
  8511. {
  8512. "call_depth": 4,
  8513. "longest_call_chain": [
  8514. "ldapsrv_accept_priv",
  8515. "ldapsrv_accept",
  8516. "ldapsrv_call_read_next",
  8517. "ldapsrv_terminate_connection"
  8518. ],
  8519. "group_size": 20,
  8520. "functions": [
  8521. {
  8522. "func": "void ldapsrv_notification_retry_setup(struct ldapsrv_service *service, bool force)\n{\n\tstruct ldapsrv_connection *conn = NULL;\n\tstruct timeval retry;\n\tsize_t num_pending = 0;\n\tsize_t num_active = 0;\n\n\tif (force) {\n\t\tTALLOC_FREE(service->notification.retry);\n\t\tservice->notification.generation += 1;\n\t}\n\n\tif (service->notification.retry != NULL) {\n\t\treturn;\n\t}\n\n\tfor (conn = service->connections; conn != NULL; conn = conn->next) {\n\t\tif (conn->pending_calls == NULL) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tnum_pending += 1;\n\n\t\tif (conn->pending_calls->notification.generation !=\n\t\t service->notification.generation)\n\t\t{\n\t\t\tnum_active += 1;\n\t\t}\n\t}\n\n\tif (num_pending == 0) {\n\t\treturn;\n\t}\n\n\tif (num_active != 0) {\n\t\tretry = timeval_current_ofs(0, 100);\n\t} else {\n\t\tretry = timeval_current_ofs(5, 0);\n\t}\n\n\tservice->notification.retry = tevent_wakeup_send(service,\n\t\t\t\t\t\t\t service->task->event_ctx,\n\t\t\t\t\t\t\t retry);\n\tif (service->notification.retry == NULL) {\n\t\t/* retry later */\n\t\treturn;\n\t}\n\n\ttevent_req_set_callback(service->notification.retry,\n\t\t\t\tldapsrv_notification_retry_done,\n\t\t\t\tservice);\n}",
  8523. "project": "samba",
  8524. "hash": 164211767725914976735745017379817965043,
  8525. "size": 52,
  8526. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8527. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8528. "target": 0,
  8529. "dataset": "other",
  8530. "idx": 274244
  8531. },
  8532. {
  8533. "func": "static void ldapsrv_call_postprocess_done(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_call *call =\n\t\ttevent_req_callback_data(subreq,\n\t\tstruct ldapsrv_call);\n\tstruct ldapsrv_connection *conn = call->conn;\n\tNTSTATUS status;\n\n\tstatus = call->postprocess_recv(subreq);\n\tTALLOC_FREE(subreq);\n\tif (!NT_STATUS_IS_OK(status)) {\n\t\tconst char *reason;\n\n\t\treason = talloc_asprintf(call, \"ldapsrv_call_postprocess_done: \"\n\t\t\t\t\t \"call->postprocess_recv() - %s\",\n\t\t\t\t\t nt_errstr(status));\n\t\tif (reason == NULL) {\n\t\t\treason = nt_errstr(status);\n\t\t}\n\n\t\tldapsrv_terminate_connection(conn, reason);\n\t\treturn;\n\t}\n\n\tTALLOC_FREE(call);\n\n\tldapsrv_call_read_next(conn);\n}",
  8534. "project": "samba",
  8535. "hash": 50898281518744840722080015617681281545,
  8536. "size": 28,
  8537. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8538. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8539. "target": 0,
  8540. "dataset": "other",
  8541. "idx": 274258
  8542. },
  8543. {
  8544. "func": "static NTSTATUS ldapsrv_process_call_recv(struct tevent_req *req)\n{\n\tNTSTATUS status;\n\n\tif (tevent_req_is_nterror(req, &status)) {\n\t\ttevent_req_received(req);\n\t\treturn status;\n\t}\n\n\ttevent_req_received(req);\n\treturn NT_STATUS_OK;\n}",
  8545. "project": "samba",
  8546. "hash": 131695309655897279135109411774164603380,
  8547. "size": 12,
  8548. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8549. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8550. "target": 0,
  8551. "dataset": "other",
  8552. "idx": 274256
  8553. },
  8554. {
  8555. "func": "static void ldapsrv_accept_nonpriv(struct stream_connection *c)\n{\n\tstruct ldapsrv_service *ldapsrv_service = talloc_get_type_abort(\n\t\tc->private_data, struct ldapsrv_service);\n\tstruct auth_session_info *session_info;\n\tNTSTATUS status;\n\n\tstatus = auth_anonymous_session_info(\n\t\tc, ldapsrv_service->task->lp_ctx, &session_info);\n\tif (!NT_STATUS_IS_OK(status)) {\n\t\tstream_terminate_connection(c, \"failed to setup anonymous \"\n\t\t\t\t\t \"session info\");\n\t\treturn;\n\t}\n\tldapsrv_accept(c, session_info, false);\n}",
  8556. "project": "samba",
  8557. "hash": 200890418750490307386632058241356591988,
  8558. "size": 16,
  8559. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8560. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8561. "target": 0,
  8562. "dataset": "other",
  8563. "idx": 274268
  8564. },
  8565. {
  8566. "func": "static bool ldapsrv_call_read_next(struct ldapsrv_connection *conn)\n{\n\tstruct tevent_req *subreq;\n\n\tif (conn->pending_calls != NULL) {\n\t\tconn->limits.endtime = timeval_zero();\n\n\t\tldapsrv_notification_retry_setup(conn->service, false);\n\t} else if (timeval_is_zero(&conn->limits.endtime)) {\n\t\tconn->limits.endtime =\n\t\t\ttimeval_current_ofs(conn->limits.initial_timeout, 0);\n\t} else {\n\t\tconn->limits.endtime =\n\t\t\ttimeval_current_ofs(conn->limits.conn_idle_time, 0);\n\t}\n\n\tif (conn->sockets.read_req != NULL) {\n\t\treturn true;\n\t}\n\n\t/*\n\t * The minimum size of a LDAP pdu is 7 bytes\n\t *\n\t * dumpasn1 -hh ldap-unbind-min.dat\n\t *\n\t * <30 05 02 01 09 42 00>\n\t * 0 5: SEQUENCE {\n\t * <02 01 09>\n\t * 2 1: INTEGER 9\n\t * <42 00>\n\t * 5 0: [APPLICATION 2]\n\t * : Error: Object has zero length.\n\t * : }\n\t *\n\t * dumpasn1 -hh ldap-unbind-windows.dat\n\t *\n\t * <30 84 00 00 00 05 02 01 09 42 00>\n\t * 0 5: SEQUENCE {\n\t * <02 01 09>\n\t * 6 1: INTEGER 9\n\t * <42 00>\n\t * 9 0: [APPLICATION 2]\n\t * : Error: Object has zero length.\n\t * : }\n\t *\n\t * This means using an initial read size\n\t * of 7 is ok.\n\t */\n\tsubreq = tstream_read_pdu_blob_send(conn,\n\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t conn->sockets.active,\n\t\t\t\t\t 7, /* initial_read_size */\n\t\t\t\t\t ldapsrv_packet_check,\n\t\t\t\t\t conn);\n\tif (subreq == NULL) {\n\t\tldapsrv_terminate_connection(conn, \"ldapsrv_call_read_next: \"\n\t\t\t\t\"no memory for tstream_read_pdu_blob_send\");\n\t\treturn false;\n\t}\n\tif (!timeval_is_zero(&conn->limits.endtime)) {\n\t\tbool ok;\n\t\tok = tevent_req_set_endtime(subreq,\n\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t conn->limits.endtime);\n\t\tif (!ok) {\n\t\t\tldapsrv_terminate_connection(\n\t\t\t\tconn,\n\t\t\t\t\"ldapsrv_call_read_next: \"\n\t\t\t\t\"no memory for tevent_req_set_endtime\");\n\t\t\treturn false;\n\t\t}\n\t}\n\ttevent_req_set_callback(subreq, ldapsrv_call_read_done, conn);\n\tconn->sockets.read_req = subreq;\n\treturn true;\n}",
  8567. "project": "samba",
  8568. "hash": 148804764610121926366840016195510941867,
  8569. "size": 76,
  8570. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8571. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8572. "target": 0,
  8573. "dataset": "other",
  8574. "idx": 274267
  8575. },
  8576. {
  8577. "func": "static void ldapsrv_call_wait_done(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_call *call =\n\t\ttevent_req_callback_data(subreq,\n\t\tstruct ldapsrv_call);\n\tstruct ldapsrv_connection *conn = call->conn;\n\tNTSTATUS status;\n\n\tconn->active_call = NULL;\n\n\tstatus = call->wait_recv(subreq);\n\tTALLOC_FREE(subreq);\n\tif (!NT_STATUS_IS_OK(status)) {\n\t\tconst char *reason;\n\n\t\treason = talloc_asprintf(call, \"ldapsrv_call_wait_done: \"\n\t\t\t\t\t \"call->wait_recv() - %s\",\n\t\t\t\t\t nt_errstr(status));\n\t\tif (reason == NULL) {\n\t\t\treason = nt_errstr(status);\n\t\t}\n\n\t\tldapsrv_terminate_connection(conn, reason);\n\t\treturn;\n\t}\n\n\tldapsrv_call_writev_start(call);\n}",
  8578. "project": "samba",
  8579. "hash": 245179838042033896261629711516324441256,
  8580. "size": 28,
  8581. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8582. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8583. "target": 0,
  8584. "dataset": "other",
  8585. "idx": 274257
  8586. },
  8587. {
  8588. "func": "static void ldapsrv_terminate_connection(struct ldapsrv_connection *conn,\n\t\t\t\t\t const char *reason)\n{\n\tstruct tevent_req *subreq;\n\n\tif (conn->limits.reason) {\n\t\treturn;\n\t}\n\n\tDLIST_REMOVE(conn->service->connections, conn);\n\n\tconn->limits.endtime = timeval_current_ofs(0, 500);\n\n\ttevent_queue_stop(conn->sockets.send_queue);\n\tTALLOC_FREE(conn->sockets.read_req);\n\tTALLOC_FREE(conn->deferred_expire_disconnect);\n\tif (conn->active_call) {\n\t\ttevent_req_cancel(conn->active_call);\n\t\tconn->active_call = NULL;\n\t}\n\n\tconn->limits.reason = talloc_strdup(conn, reason);\n\tif (conn->limits.reason == NULL) {\n\t\tTALLOC_FREE(conn->sockets.tls);\n\t\tTALLOC_FREE(conn->sockets.sasl);\n\t\tTALLOC_FREE(conn->sockets.raw);\n\t\tstream_terminate_connection(conn->connection, reason);\n\t\treturn;\n\t}\n\n\tsubreq = tstream_disconnect_send(conn,\n\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t conn->sockets.active);\n\tif (subreq == NULL) {\n\t\tTALLOC_FREE(conn->sockets.tls);\n\t\tTALLOC_FREE(conn->sockets.sasl);\n\t\tTALLOC_FREE(conn->sockets.raw);\n\t\tstream_terminate_connection(conn->connection, reason);\n\t\treturn;\n\t}\n\ttevent_req_set_endtime(subreq,\n\t\t\t conn->connection->event.ctx,\n\t\t\t conn->limits.endtime);\n\ttevent_req_set_callback(subreq, ldapsrv_terminate_connection_done, conn);\n}",
  8589. "project": "samba",
  8590. "hash": 89896492431690803255383534521597584901,
  8591. "size": 45,
  8592. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8593. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8594. "target": 0,
  8595. "dataset": "other",
  8596. "idx": 274255
  8597. },
  8598. {
  8599. "func": "static void ldapsrv_disconnect_ticket_expired(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_connection *conn = tevent_req_callback_data(\n\t\tsubreq, struct ldapsrv_connection);\n\tbool ok;\n\n\tok = tevent_wakeup_recv(subreq);\n\tTALLOC_FREE(subreq);\n\tif (!ok) {\n\t\tDBG_WARNING(\"tevent_wakeup_recv failed\\n\");\n\t}\n\tconn->deferred_expire_disconnect = NULL;\n\tldapsrv_terminate_connection(conn, \"network session expired\");\n}",
  8600. "project": "samba",
  8601. "hash": 149216946338093456042738285057139220459,
  8602. "size": 14,
  8603. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8604. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8605. "target": 0,
  8606. "dataset": "other",
  8607. "idx": 274260
  8608. },
  8609. {
  8610. "func": "static void ldapsrv_accept(struct stream_connection *c,\n\t\t\t struct auth_session_info *session_info,\n\t\t\t bool is_privileged)\n{\n\tstruct ldapsrv_service *ldapsrv_service = \n\t\ttalloc_get_type(c->private_data, struct ldapsrv_service);\n\tstruct ldapsrv_connection *conn;\n\tstruct cli_credentials *server_credentials;\n\tstruct socket_address *socket_address;\n\tNTSTATUS status;\n\tint port;\n\tint ret;\n\tstruct tevent_req *subreq;\n\tstruct timeval endtime;\n\tchar *errstring = NULL;\n\n\tconn = talloc_zero(c, struct ldapsrv_connection);\n\tif (!conn) {\n\t\tstream_terminate_connection(c, \"ldapsrv_accept: out of memory\");\n\t\treturn;\n\t}\n\tconn->is_privileged = is_privileged;\n\n\tconn->sockets.send_queue = tevent_queue_create(conn, \"ldapsev send queue\");\n\tif (conn->sockets.send_queue == NULL) {\n\t\tstream_terminate_connection(c,\n\t\t\t\t\t \"ldapsrv_accept: tevent_queue_create failed\");\n\t\treturn;\n\t}\n\n\tTALLOC_FREE(c->event.fde);\n\n\tret = tstream_bsd_existing_socket(conn,\n\t\t\t\t\t socket_get_fd(c->socket),\n\t\t\t\t\t &conn->sockets.raw);\n\tif (ret == -1) {\n\t\tstream_terminate_connection(c,\n\t\t\t\t\t \"ldapsrv_accept: out of memory\");\n\t\treturn;\n\t}\n\tsocket_set_flags(c->socket, SOCKET_FLAG_NOCLOSE);\n\n\tconn->connection = c;\n\tconn->service = ldapsrv_service;\n\tconn->lp_ctx = ldapsrv_service->task->lp_ctx;\n\n\tc->private_data = conn;\n\n\tsocket_address = socket_get_my_addr(c->socket, conn);\n\tif (!socket_address) {\n\t\tldapsrv_terminate_connection(conn, \"ldapsrv_accept: failed to obtain local socket address!\");\n\t\treturn;\n\t}\n\tport = socket_address->port;\n\ttalloc_free(socket_address);\n\tif (port == 3268 || port == 3269) /* Global catalog */ {\n\t\tconn->global_catalog = true;\n\t}\n\n\tserver_credentials = cli_credentials_init(conn);\n\tif (!server_credentials) {\n\t\tstream_terminate_connection(c, \"Failed to init server credentials\\n\");\n\t\treturn;\n\t}\n\n\tcli_credentials_set_conf(server_credentials, conn->lp_ctx);\n\tstatus = cli_credentials_set_machine_account(server_credentials, conn->lp_ctx);\n\tif (!NT_STATUS_IS_OK(status)) {\n\t\tstream_terminate_connection(c, talloc_asprintf(conn, \"Failed to obtain server credentials, perhaps a standalone server?: %s\\n\", nt_errstr(status)));\n\t\treturn;\n\t}\n\tconn->server_credentials = server_credentials;\n\n\tconn->session_info = session_info;\n\n\tconn->sockets.active = conn->sockets.raw;\n\n\tif (conn->is_privileged) {\n\t\tconn->require_strong_auth = LDAP_SERVER_REQUIRE_STRONG_AUTH_NO;\n\t} else {\n\t\tconn->require_strong_auth = lpcfg_ldap_server_require_strong_auth(conn->lp_ctx);\n\t}\n\n\tret = ldapsrv_backend_Init(conn, &errstring);\n\tif (ret != LDB_SUCCESS) {\n\t\tchar *reason = talloc_asprintf(conn,\n\t\t\t\t\t \"LDB backend for LDAP Init \"\n\t\t\t\t\t \"failed: %s: %s\",\n\t\t\t\t\t errstring, ldb_strerror(ret));\n\t\tldapsrv_terminate_connection(conn, reason);\n\t\treturn;\n\t}\n\n\t/* load limits from the conf partition */\n\tldapsrv_load_limits(conn); /* should we fail on error ? */\n\n\t/* register the server */\t\n\tirpc_add_name(c->msg_ctx, \"ldap_server\");\n\n\tDLIST_ADD_END(ldapsrv_service->connections, conn);\n\n\tif (port != 636 && port != 3269) {\n\t\tldapsrv_call_read_next(conn);\n\t\treturn;\n\t}\n\n\tendtime = timeval_current_ofs(conn->limits.conn_idle_time, 0);\n\n\tsubreq = tstream_tls_accept_send(conn,\n\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t conn->sockets.raw,\n\t\t\t\t\t conn->service->tls_params);\n\tif (subreq == NULL) {\n\t\tldapsrv_terminate_connection(conn, \"ldapsrv_accept: \"\n\t\t\t\t\"no memory for tstream_tls_accept_send\");\n\t\treturn;\n\t}\n\ttevent_req_set_endtime(subreq,\n\t\t\t conn->connection->event.ctx,\n\t\t\t endtime);\n\ttevent_req_set_callback(subreq, ldapsrv_accept_tls_done, conn);\n}",
  8611. "project": "samba",
  8612. "hash": 237481986044682052606798819803454206300,
  8613. "size": 122,
  8614. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8615. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8616. "target": 0,
  8617. "dataset": "other",
  8618. "idx": 274248
  8619. },
  8620. {
  8621. "func": "static void ldapsrv_call_writev_done(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_call *call =\n\t\ttevent_req_callback_data(subreq,\n\t\tstruct ldapsrv_call);\n\tstruct ldapsrv_connection *conn = call->conn;\n\tint sys_errno;\n\tint rc;\n\n\trc = tstream_writev_queue_recv(subreq, &sys_errno);\n\tTALLOC_FREE(subreq);\n\n\t/* This releases the ASN.1 encoded packets from memory */\n\tTALLOC_FREE(call->out_iov);\n\tif (rc == -1) {\n\t\tconst char *reason;\n\n\t\treason = talloc_asprintf(call, \"ldapsrv_call_writev_done: \"\n\t\t\t\t\t \"tstream_writev_queue_recv() - %d:%s\",\n\t\t\t\t\t sys_errno, strerror(sys_errno));\n\t\tif (reason == NULL) {\n\t\t\treason = \"ldapsrv_call_writev_done: \"\n\t\t\t\t \"tstream_writev_queue_recv() failed\";\n\t\t}\n\n\t\tldapsrv_terminate_connection(conn, reason);\n\t\treturn;\n\t}\n\n\tif (call->postprocess_send) {\n\t\tsubreq = call->postprocess_send(call,\n\t\t\t\t\t\tconn->connection->event.ctx,\n\t\t\t\t\t\tcall->postprocess_private);\n\t\tif (subreq == NULL) {\n\t\t\tldapsrv_terminate_connection(conn, \"ldapsrv_call_writev_done: \"\n\t\t\t\t\t\"call->postprocess_send - no memory\");\n\t\t\treturn;\n\t\t}\n\t\ttevent_req_set_callback(subreq,\n\t\t\t\t\tldapsrv_call_postprocess_done,\n\t\t\t\t\tcall);\n\t\treturn;\n\t}\n\n\t/* Perhaps still some more to send */\n\tif (call->replies != NULL) {\n\t\tldapsrv_call_writev_start(call);\n\t\treturn;\n\t}\n\n\tif (!call->notification.busy) {\n\t\tTALLOC_FREE(call);\n\t}\n\n\tldapsrv_call_read_next(conn);\n}",
  8622. "project": "samba",
  8623. "hash": 23721395339361040522884503184921195612,
  8624. "size": 56,
  8625. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8626. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8627. "target": 0,
  8628. "dataset": "other",
  8629. "idx": 274272
  8630. },
  8631. {
  8632. "func": "static void ldapsrv_accept_tls_done(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_connection *conn =\n\t\ttevent_req_callback_data(subreq,\n\t\tstruct ldapsrv_connection);\n\tint ret;\n\tint sys_errno;\n\n\tret = tstream_tls_accept_recv(subreq, &sys_errno,\n\t\t\t\t conn, &conn->sockets.tls);\n\tTALLOC_FREE(subreq);\n\tif (ret == -1) {\n\t\tconst char *reason;\n\n\t\treason = talloc_asprintf(conn, \"ldapsrv_accept_tls_loop: \"\n\t\t\t\t\t \"tstream_tls_accept_recv() - %d:%s\",\n\t\t\t\t\t sys_errno, strerror(sys_errno));\n\t\tif (!reason) {\n\t\t\treason = \"ldapsrv_accept_tls_loop: \"\n\t\t\t\t \"tstream_tls_accept_recv() - failed\";\n\t\t}\n\n\t\tldapsrv_terminate_connection(conn, reason);\n\t\treturn;\n\t}\n\n\tconn->sockets.active = conn->sockets.tls;\n\tconn->referral_scheme = LDAP_REFERRAL_SCHEME_LDAPS;\n\tldapsrv_call_read_next(conn);\n}",
  8633. "project": "samba",
  8634. "hash": 156007926465375734284255274710207877505,
  8635. "size": 30,
  8636. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8637. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8638. "target": 0,
  8639. "dataset": "other",
  8640. "idx": 274266
  8641. },
  8642. {
  8643. "func": "static void ldapsrv_notification_retry_done(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_service *service =\n\t\ttevent_req_callback_data(subreq,\n\t\tstruct ldapsrv_service);\n\tstruct ldapsrv_connection *conn = NULL;\n\tstruct ldapsrv_connection *conn_next = NULL;\n\tbool ok;\n\n\tservice->notification.retry = NULL;\n\n\tok = tevent_wakeup_recv(subreq);\n\tTALLOC_FREE(subreq);\n\tif (!ok) {\n\t\t/* ignore */\n\t}\n\n\tfor (conn = service->connections; conn != NULL; conn = conn_next) {\n\t\tstruct ldapsrv_call *call = conn->pending_calls;\n\n\t\tconn_next = conn->next;\n\n\t\tif (conn->pending_calls == NULL) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (conn->active_call != NULL) {\n\t\t\tcontinue;\n\t\t}\n\n\t\tDLIST_DEMOTE(conn->pending_calls, call);\n\t\tcall->notification.generation =\n\t\t\t\tservice->notification.generation;\n\n\t\t/* queue the call in the global queue */\n\t\tsubreq = ldapsrv_process_call_send(call,\n\t\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t\t conn->service->call_queue,\n\t\t\t\t\t\t call);\n\t\tif (subreq == NULL) {\n\t\t\tldapsrv_terminate_connection(conn,\n\t\t\t\t\t\"ldapsrv_process_call_send failed\");\n\t\t\tcontinue;\n\t\t}\n\t\ttevent_req_set_callback(subreq, ldapsrv_call_process_done, call);\n\t\tconn->active_call = subreq;\n\t}\n\n\tldapsrv_notification_retry_setup(service, false);\n}",
  8644. "project": "samba",
  8645. "hash": 209125356924479592647807381179697027992,
  8646. "size": 50,
  8647. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8648. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8649. "target": 0,
  8650. "dataset": "other",
  8651. "idx": 274249
  8652. },
  8653. {
  8654. "func": "static int ldapsrv_load_limits(struct ldapsrv_connection *conn)\n{\n\tTALLOC_CTX *tmp_ctx;\n\tconst char *attrs[] = { \"configurationNamingContext\", NULL };\n\tconst char *attrs2[] = { \"lDAPAdminLimits\", NULL };\n\tstruct ldb_message_element *el;\n\tstruct ldb_result *res = NULL;\n\tstruct ldb_dn *basedn;\n\tstruct ldb_dn *conf_dn;\n\tstruct ldb_dn *policy_dn;\n\tunsigned int i;\n\tint ret;\n\n\t/* set defaults limits in case of failure */\n\tconn->limits.initial_timeout = 120;\n\tconn->limits.conn_idle_time = 900;\n\tconn->limits.max_page_size = 1000;\n\tconn->limits.max_notifications = 5;\n\tconn->limits.search_timeout = 120;\n\tconn->limits.expire_time = (struct timeval) {\n\t\t.tv_sec = get_time_t_max(),\n\t};\n\n\n\ttmp_ctx = talloc_new(conn);\n\tif (tmp_ctx == NULL) {\n\t\treturn -1;\n\t}\n\n\tbasedn = ldb_dn_new(tmp_ctx, conn->ldb, NULL);\n\tif (basedn == NULL) {\n\t\tgoto failed;\n\t}\n\n\tret = ldb_search(conn->ldb, tmp_ctx, &res, basedn, LDB_SCOPE_BASE, attrs, NULL);\n\tif (ret != LDB_SUCCESS) {\n\t\tgoto failed;\n\t}\n\n\tif (res->count != 1) {\n\t\tgoto failed;\n\t}\n\n\tconf_dn = ldb_msg_find_attr_as_dn(conn->ldb, tmp_ctx, res->msgs[0], \"configurationNamingContext\");\n\tif (conf_dn == NULL) {\n\t\tgoto failed;\n\t}\n\n\tpolicy_dn = ldb_dn_copy(tmp_ctx, conf_dn);\n\tldb_dn_add_child_fmt(policy_dn, \"CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services\");\n\tif (policy_dn == NULL) {\n\t\tgoto failed;\n\t}\n\n\tret = ldb_search(conn->ldb, tmp_ctx, &res, policy_dn, LDB_SCOPE_BASE, attrs2, NULL);\n\tif (ret != LDB_SUCCESS) {\n\t\tgoto failed;\n\t}\n\n\tif (res->count != 1) {\n\t\tgoto failed;\n\t}\n\n\tel = ldb_msg_find_element(res->msgs[0], \"lDAPAdminLimits\");\n\tif (el == NULL) {\n\t\tgoto failed;\n\t}\n\n\tfor (i = 0; i < el->num_values; i++) {\n\t\tchar policy_name[256];\n\t\tint policy_value, s;\n\n\t\ts = sscanf((const char *)el->values[i].data, \"%255[^=]=%d\", policy_name, &policy_value);\n\t\tif (s != 2 || policy_value == 0)\n\t\t\tcontinue;\n\t\tif (strcasecmp(\"InitRecvTimeout\", policy_name) == 0) {\n\t\t\tconn->limits.initial_timeout = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxConnIdleTime\", policy_name) == 0) {\n\t\t\tconn->limits.conn_idle_time = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxPageSize\", policy_name) == 0) {\n\t\t\tconn->limits.max_page_size = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxNotificationPerConn\", policy_name) == 0) {\n\t\t\tconn->limits.max_notifications = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxQueryDuration\", policy_name) == 0) {\n\t\t\tconn->limits.search_timeout = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\treturn 0;\n\nfailed:\n\tDBG_ERR(\"Failed to load ldap server query policies\\n\");\n\ttalloc_free(tmp_ctx);\n\treturn -1;\n}",
  8655. "project": "samba",
  8656. "hash": 179110453965118510639557808253855764974,
  8657. "size": 104,
  8658. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8659. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8660. "target": 1,
  8661. "dataset": "other",
  8662. "idx": 198425
  8663. },
  8664. {
  8665. "func": "static int ldapsrv_load_limits(struct ldapsrv_connection *conn)\n{\n\tTALLOC_CTX *tmp_ctx;\n\tconst char *attrs[] = { \"configurationNamingContext\", NULL };\n\tconst char *attrs2[] = { \"lDAPAdminLimits\", NULL };\n\tstruct ldb_message_element *el;\n\tstruct ldb_result *res = NULL;\n\tstruct ldb_dn *basedn;\n\tstruct ldb_dn *conf_dn;\n\tstruct ldb_dn *policy_dn;\n\tunsigned int i;\n\tint ret;\n\n\t/* set defaults limits in case of failure */\n\tconn->limits.initial_timeout = 120;\n\tconn->limits.conn_idle_time = 900;\n\tconn->limits.max_page_size = 1000;\n\tconn->limits.max_notifications = 5;\n\tconn->limits.search_timeout = 120;\n\tconn->limits.expire_time = (struct timeval) {\n\t\t.tv_sec = get_time_t_max(),\n\t};\n\n\n\ttmp_ctx = talloc_new(conn);\n\tif (tmp_ctx == NULL) {\n\t\treturn -1;\n\t}\n\n\tbasedn = ldb_dn_new(tmp_ctx, conn->ldb, NULL);\n\tif (basedn == NULL) {\n\t\tgoto failed;\n\t}\n\n\tret = ldb_search(conn->ldb, tmp_ctx, &res, basedn, LDB_SCOPE_BASE, attrs, NULL);\n\tif (ret != LDB_SUCCESS) {\n\t\tgoto failed;\n\t}\n\n\tif (res->count != 1) {\n\t\tgoto failed;\n\t}\n\n\tconf_dn = ldb_msg_find_attr_as_dn(conn->ldb, tmp_ctx, res->msgs[0], \"configurationNamingContext\");\n\tif (conf_dn == NULL) {\n\t\tgoto failed;\n\t}\n\n\tpolicy_dn = ldb_dn_copy(tmp_ctx, conf_dn);\n\tldb_dn_add_child_fmt(policy_dn, \"CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services\");\n\tif (policy_dn == NULL) {\n\t\tgoto failed;\n\t}\n\n\tret = ldb_search(conn->ldb, tmp_ctx, &res, policy_dn, LDB_SCOPE_BASE, attrs2, NULL);\n\tif (ret != LDB_SUCCESS) {\n\t\tgoto failed;\n\t}\n\n\tif (res->count != 1) {\n\t\tgoto failed;\n\t}\n\n\tel = ldb_msg_find_element(res->msgs[0], \"lDAPAdminLimits\");\n\tif (el == NULL) {\n\t\tgoto failed;\n\t}\n\n\tfor (i = 0; i < el->num_values; i++) {\n\t\tchar policy_name[256];\n\t\tint policy_value, s;\n\n\t\ts = sscanf((const char *)el->values[i].data, \"%255[^=]=%d\", policy_name, &policy_value);\n\t\tif (s != 2 || policy_value == 0)\n\t\t\tcontinue;\n\t\tif (strcasecmp(\"InitRecvTimeout\", policy_name) == 0) {\n\t\t\tconn->limits.initial_timeout = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxConnIdleTime\", policy_name) == 0) {\n\t\t\tconn->limits.conn_idle_time = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxPageSize\", policy_name) == 0) {\n\t\t\tconn->limits.max_page_size = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxNotificationPerConn\", policy_name) == 0) {\n\t\t\tconn->limits.max_notifications = policy_value;\n\t\t\tcontinue;\n\t\t}\n\t\tif (strcasecmp(\"MaxQueryDuration\", policy_name) == 0) {\n\t\t\tif (policy_value > 0) {\n\t\t\t\tconn->limits.search_timeout = policy_value;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t}\n\n\treturn 0;\n\nfailed:\n\tDBG_ERR(\"Failed to load ldap server query policies\\n\");\n\ttalloc_free(tmp_ctx);\n\treturn -1;\n}",
  8666. "project": "samba",
  8667. "hash": 20233092815787754852088965792044905240,
  8668. "size": 106,
  8669. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8670. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8671. "target": 0,
  8672. "dataset": "other",
  8673. "idx": 274270
  8674. },
  8675. {
  8676. "func": "static NTSTATUS ldapsrv_packet_check(\n\tvoid *private_data,\n\tDATA_BLOB blob,\n\tsize_t *packet_size)\n{\n\tNTSTATUS ret;\n\tstruct ldapsrv_connection *conn = private_data;\n\tint result = LDB_SUCCESS;\n\n\tret = ldap_full_packet(private_data, blob, packet_size);\n\tif (!NT_STATUS_IS_OK(ret)) {\n\t\treturn ret;\n\t}\n\tresult = ldapsrv_check_packet_size(conn, *packet_size);\n\tif (result != LDAP_SUCCESS) {\n\t\treturn NT_STATUS_LDAP(result);\n\t}\n\treturn NT_STATUS_OK;\n}",
  8677. "project": "samba",
  8678. "hash": 26391111498996562762649733474230387709,
  8679. "size": 19,
  8680. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8681. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8682. "target": 0,
  8683. "dataset": "other",
  8684. "idx": 274263
  8685. },
  8686. {
  8687. "func": "static void ldapsrv_call_writev_start(struct ldapsrv_call *call)\n{\n\tstruct ldapsrv_connection *conn = call->conn;\n\tstruct ldapsrv_reply *reply = NULL;\n\tstruct tevent_req *subreq = NULL;\n\tsize_t length = 0;\n\tsize_t i;\n\n\tcall->iov_count = 0;\n\n\t/* build all the replies into an IOV (no copy) */\n\tfor (reply = call->replies;\n\t reply != NULL;\n\t reply = reply->next) {\n\n\t\t/* Cap output at 25MB per writev() */\n\t\tif (length > length + reply->blob.length\n\t\t || length + reply->blob.length > LDAP_SERVER_MAX_CHUNK_SIZE) {\n\t\t\tbreak;\n\t\t}\n\n\t\t/*\n\t\t * Overflow is harmless here, just used below to\n\t\t * decide if to read or write, but checked above anyway\n\t\t */\n\t\tlength += reply->blob.length;\n\n\t\t/*\n\t\t * At worst an overflow would mean we send less\n\t\t * replies\n\t\t */\n\t\tcall->iov_count++;\n\t}\n\n\tif (length == 0) {\n\t\tif (!call->notification.busy) {\n\t\t\tTALLOC_FREE(call);\n\t\t}\n\n\t\tldapsrv_call_read_next(conn);\n\t\treturn;\n\t}\n\n\t/* Cap call->iov_count at IOV_MAX */\n\tcall->iov_count = MIN(call->iov_count, IOV_MAX);\n\n\tcall->out_iov = talloc_array(call,\n\t\t\t\t struct iovec,\n\t\t\t\t call->iov_count);\n\tif (!call->out_iov) {\n\t\t/* This is not ideal */\n\t\tldapsrv_terminate_connection(conn,\n\t\t\t\t\t \"failed to allocate \"\n\t\t\t\t\t \"iovec array\");\n\t\treturn;\n\t}\n\n\t/* We may have had to cap the number of replies at IOV_MAX */\n\tfor (i = 0;\n\t i < call->iov_count && call->replies != NULL;\n\t i++) {\n\t\treply = call->replies;\n\t\tcall->out_iov[i].iov_base = reply->blob.data;\n\t\tcall->out_iov[i].iov_len = reply->blob.length;\n\n\t\t/* Keep only the ASN.1 encoded data */\n\t\ttalloc_steal(call->out_iov, reply->blob.data);\n\n\t\tDLIST_REMOVE(call->replies, reply);\n\t\tTALLOC_FREE(reply);\n\t}\n\n\tif (i > call->iov_count) {\n\t\t/* This is not ideal, but also (essentially) impossible */\n\t\tldapsrv_terminate_connection(conn,\n\t\t\t\t\t \"call list ended\"\n\t\t\t\t\t \"before iov_count\");\n\t\treturn;\n\t}\n\n\tsubreq = tstream_writev_queue_send(call,\n\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t conn->sockets.active,\n\t\t\t\t\t conn->sockets.send_queue,\n\t\t\t\t\t call->out_iov, call->iov_count);\n\tif (subreq == NULL) {\n\t\tldapsrv_terminate_connection(conn, \"stream_writev_queue_send failed\");\n\t\treturn;\n\t}\n\ttevent_req_set_callback(subreq, ldapsrv_call_writev_done, call);\n}",
  8688. "project": "samba",
  8689. "hash": 63660284643483350930249543818774251501,
  8690. "size": 91,
  8691. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8692. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8693. "target": 0,
  8694. "dataset": "other",
  8695. "idx": 274265
  8696. },
  8697. {
  8698. "func": "static void ldapsrv_accept_priv(struct stream_connection *c)\n{\n\tstruct ldapsrv_service *ldapsrv_service = talloc_get_type_abort(\n\t\tc->private_data, struct ldapsrv_service);\n\tstruct auth_session_info *session_info;\n\n\tsession_info = system_session(ldapsrv_service->task->lp_ctx);\n\tif (!session_info) {\n\t\tstream_terminate_connection(c, \"failed to setup system \"\n\t\t\t\t\t \"session info\");\n\t\treturn;\n\t}\n\tldapsrv_accept(c, session_info, true);\n}",
  8699. "project": "samba",
  8700. "hash": 248588516067925582677625240081482568956,
  8701. "size": 14,
  8702. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8703. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8704. "target": 0,
  8705. "dataset": "other",
  8706. "idx": 274269
  8707. },
  8708. {
  8709. "func": "static void ldapsrv_call_read_done(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_connection *conn =\n\t\ttevent_req_callback_data(subreq,\n\t\tstruct ldapsrv_connection);\n\tNTSTATUS status;\n\tstruct ldapsrv_call *call;\n\tstruct asn1_data *asn1;\n\tDATA_BLOB blob;\n\tint ret = LDAP_SUCCESS;\n\tstruct ldap_request_limits limits = {0};\n\n\tconn->sockets.read_req = NULL;\n\n\tcall = talloc_zero(conn, struct ldapsrv_call);\n\tif (!call) {\n\t\tldapsrv_terminate_connection(conn, \"no memory\");\n\t\treturn;\n\t}\n\ttalloc_set_destructor(call, ldapsrv_call_destructor);\n\n\tcall->conn = conn;\n\n\tstatus = tstream_read_pdu_blob_recv(subreq,\n\t\t\t\t\t call,\n\t\t\t\t\t &blob);\n\tTALLOC_FREE(subreq);\n\tif (!NT_STATUS_IS_OK(status)) {\n\t\tconst char *reason;\n\n\t\treason = talloc_asprintf(call, \"ldapsrv_call_loop: \"\n\t\t\t\t\t \"tstream_read_pdu_blob_recv() - %s\",\n\t\t\t\t\t nt_errstr(status));\n\t\tif (!reason) {\n\t\t\treason = nt_errstr(status);\n\t\t}\n\n\t\tldapsrv_terminate_connection(conn, reason);\n\t\treturn;\n\t}\n\n\tret = ldapsrv_check_packet_size(conn, blob.length);\n\tif (ret != LDAP_SUCCESS) {\n\t\tldapsrv_terminate_connection(\n\t\t\tconn,\n\t\t\t\"Request packet too large\");\n\t\treturn;\n\t}\n\n\tasn1 = asn1_init(call, ASN1_MAX_TREE_DEPTH);\n\tif (asn1 == NULL) {\n\t\tldapsrv_terminate_connection(conn, \"no memory\");\n\t\treturn;\n\t}\n\n\tcall->request = talloc(call, struct ldap_message);\n\tif (call->request == NULL) {\n\t\tldapsrv_terminate_connection(conn, \"no memory\");\n\t\treturn;\n\t}\n\n\tasn1_load_nocopy(asn1, blob.data, blob.length);\n\n\tlimits.max_search_size =\n\t\tlpcfg_ldap_max_search_request_size(conn->lp_ctx);\n\tstatus = ldap_decode(\n\t\tasn1,\n\t\t&limits,\n\t\tsamba_ldap_control_handlers(),\n\t\tcall->request);\n\tif (!NT_STATUS_IS_OK(status)) {\n\t\tldapsrv_terminate_connection(conn, nt_errstr(status));\n\t\treturn;\n\t}\n\n\tdata_blob_free(&blob);\n\tTALLOC_FREE(asn1);\n\n\n\t/* queue the call in the global queue */\n\tsubreq = ldapsrv_process_call_send(call,\n\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t conn->service->call_queue,\n\t\t\t\t\t call);\n\tif (subreq == NULL) {\n\t\tldapsrv_terminate_connection(conn, \"ldapsrv_process_call_send failed\");\n\t\treturn;\n\t}\n\ttevent_req_set_callback(subreq, ldapsrv_call_process_done, call);\n\tconn->active_call = subreq;\n}",
  8710. "project": "samba",
  8711. "hash": 83780409077588544429973836003259519563,
  8712. "size": 91,
  8713. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8714. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8715. "target": 0,
  8716. "dataset": "other",
  8717. "idx": 274251
  8718. },
  8719. {
  8720. "func": "static void ldapsrv_call_process_done(struct tevent_req *subreq)\n{\n\tstruct ldapsrv_call *call =\n\t\ttevent_req_callback_data(subreq,\n\t\tstruct ldapsrv_call);\n\tstruct ldapsrv_connection *conn = call->conn;\n\tNTSTATUS status;\n\n\tconn->active_call = NULL;\n\n\tstatus = ldapsrv_process_call_recv(subreq);\n\tTALLOC_FREE(subreq);\n\tif (!NT_STATUS_IS_OK(status)) {\n\t\tldapsrv_terminate_connection(conn, nt_errstr(status));\n\t\treturn;\n\t}\n\n\tif (call->wait_send != NULL) {\n\t\tsubreq = call->wait_send(call,\n\t\t\t\t\t conn->connection->event.ctx,\n\t\t\t\t\t call->wait_private);\n\t\tif (subreq == NULL) {\n\t\t\tldapsrv_terminate_connection(conn,\n\t\t\t\t\t\"ldapsrv_call_process_done: \"\n\t\t\t\t\t\"call->wait_send - no memory\");\n\t\t\treturn;\n\t\t}\n\t\ttevent_req_set_callback(subreq,\n\t\t\t\t\tldapsrv_call_wait_done,\n\t\t\t\t\tcall);\n\t\tconn->active_call = subreq;\n\t\treturn;\n\t}\n\n\tldapsrv_call_writev_start(call);\n}",
  8721. "project": "samba",
  8722. "hash": 91770496350954271773300687472820359720,
  8723. "size": 36,
  8724. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8725. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8726. "target": 0,
  8727. "dataset": "other",
  8728. "idx": 274271
  8729. },
  8730. {
  8731. "func": "static int ldapsrv_check_packet_size(\n\tstruct ldapsrv_connection *conn,\n\tsize_t size)\n{\n\tbool is_anonymous = false;\n\tsize_t max_size = 0;\n\n\tmax_size = lpcfg_ldap_max_anonymous_request_size(conn->lp_ctx);\n\tif (size <= max_size) {\n\t\treturn LDAP_SUCCESS;\n\t}\n\n\t/*\n\t * Request is larger than the maximum unauthenticated request size.\n\t * As this code is called frequently we avoid calling\n\t * security_token_is_anonymous if possible\n\t */\n\tif (conn->session_info != NULL &&\n\t\tconn->session_info->security_token != NULL) {\n\t\tis_anonymous = security_token_is_anonymous(\n\t\t\tconn->session_info->security_token);\n\t}\n\n\tif (is_anonymous) {\n\t\tDBG_WARNING(\n\t\t\t\"LDAP request size (%zu) exceeds (%zu)\\n\",\n\t\t\tsize,\n\t\t\tmax_size);\n\t\treturn LDAP_UNWILLING_TO_PERFORM;\n\t}\n\n\tmax_size = lpcfg_ldap_max_authenticated_request_size(conn->lp_ctx);\n\tif (size > max_size) {\n\t\tDBG_WARNING(\n\t\t\t\"LDAP request size (%zu) exceeds (%zu)\\n\",\n\t\t\tsize,\n\t\t\tmax_size);\n\t\treturn LDAP_UNWILLING_TO_PERFORM;\n\t}\n\treturn LDAP_SUCCESS;\n\n}",
  8732. "project": "samba",
  8733. "hash": 125310637314983518118518477367507280780,
  8734. "size": 42,
  8735. "commit_id": "f9b2267c6eb8138fc94df7a138ad5d87526f1d79",
  8736. "message": "CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14694\n\nSigned-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>\nReviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>\n(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)",
  8737. "target": 0,
  8738. "dataset": "other",
  8739. "idx": 274252
  8740. }
  8741. ]
  8742. },
  8743. {
  8744. "call_depth": 4,
  8745. "longest_call_chain": [
  8746. "do_print",
  8747. "do_show",
  8748. "show_line",
  8749. "acl_perm_str"
  8750. ],
  8751. "group_size": 8,
  8752. "functions": [
  8753. {
  8754. "func": "int do_show(FILE *stream, const char *path_p, const struct stat *st,\n acl_t acl, acl_t dacl)\n{\n\tstruct name_list *acl_names = get_list(st, acl),\n\t *first_acl_name = acl_names;\n\tstruct name_list *dacl_names = get_list(st, dacl),\n\t *first_dacl_name = dacl_names;\n\t\n\tint acl_names_width = max_name_length(acl_names);\n\tint dacl_names_width = max_name_length(dacl_names);\n\tacl_entry_t acl_ent;\n\tacl_entry_t dacl_ent;\n\tchar acl_mask[ACL_PERMS+1], dacl_mask[ACL_PERMS+1];\n\tint ret;\n\n\tnames_width = 8;\n\tif (acl_names_width > names_width)\n\t\tnames_width = acl_names_width;\n\tif (dacl_names_width > names_width)\n\t\tnames_width = dacl_names_width;\n\n\tacl_mask[0] = '\\0';\n\tif (acl) {\n\t\tacl_mask_perm_str(acl, acl_mask);\n\t\tret = acl_get_entry(acl, ACL_FIRST_ENTRY, &acl_ent);\n\t\tif (ret == 0)\n\t\t\tacl = NULL;\n\t\tif (ret < 0)\n\t\t\treturn ret;\n\t}\n\tdacl_mask[0] = '\\0';\n\tif (dacl) {\n\t\tacl_mask_perm_str(dacl, dacl_mask);\n\t\tret = acl_get_entry(dacl, ACL_FIRST_ENTRY, &dacl_ent);\n\t\tif (ret == 0)\n\t\t\tdacl = NULL;\n\t\tif (ret < 0)\n\t\t\treturn ret;\n\t}\n\tfprintf(stream, \"# file: %s\\n\", xquote(path_p, \"\\n\\r\"));\n\twhile (acl_names != NULL || dacl_names != NULL) {\n\t\tacl_tag_t acl_tag, dacl_tag;\n\n\t\tif (acl)\n\t\t\tacl_get_tag_type(acl_ent, &acl_tag);\n\t\tif (dacl)\n\t\t\tacl_get_tag_type(dacl_ent, &dacl_tag);\n\n\t\tif (acl && (!dacl || acl_tag < dacl_tag)) {\n\t\t\tshow_line(stream, &acl_names, acl, &acl_ent, acl_mask,\n\t\t\t NULL, NULL, NULL, NULL);\n\t\t\tcontinue;\n\t\t} else if (dacl && (!acl || dacl_tag < acl_tag)) {\n\t\t\tshow_line(stream, NULL, NULL, NULL, NULL,\n\t\t\t &dacl_names, dacl, &dacl_ent, dacl_mask);\n\t\t\tcontinue;\n\t\t} else {\n\t\t\tif (acl_tag == ACL_USER || acl_tag == ACL_GROUP) {\n\t\t\t\tid_t *acl_id_p = NULL, *dacl_id_p = NULL;\n\t\t\t\tif (acl_ent)\n\t\t\t\t\tacl_id_p = acl_get_qualifier(acl_ent);\n\t\t\t\tif (dacl_ent)\n\t\t\t\t\tdacl_id_p = acl_get_qualifier(dacl_ent);\n\t\t\t\t\n\t\t\t\tif (acl && (!dacl || *acl_id_p < *dacl_id_p)) {\n\t\t\t\t\tshow_line(stream, &acl_names, acl,\n\t\t\t\t\t &acl_ent, acl_mask,\n\t\t\t\t\t\t NULL, NULL, NULL, NULL);\n\t\t\t\t\tcontinue;\n\t\t\t\t} else if (dacl &&\n\t\t\t\t\t(!acl || *dacl_id_p < *acl_id_p)) {\n\t\t\t\t\tshow_line(stream, NULL, NULL, NULL,\n\t\t\t\t\t NULL, &dacl_names, dacl,\n\t\t\t\t\t\t &dacl_ent, dacl_mask);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tshow_line(stream, &acl_names, acl, &acl_ent, acl_mask,\n\t\t\t\t &dacl_names, dacl, &dacl_ent, dacl_mask);\n\t\t}\n\t}\n\n\tfree_list(first_acl_name);\n\tfree_list(first_dacl_name);\n\n\treturn 0;\n}",
  8755. "target": 0,
  8756. "cwe": [],
  8757. "project": "acl",
  8758. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8759. "hash": 148979610646046169696771366369271425537,
  8760. "size": 87,
  8761. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8762. "dataset": "other",
  8763. "idx": 491966
  8764. },
  8765. {
  8766. "func": "void acl_mask_perm_str(acl_t acl, char *str)\n{\n\tacl_entry_t entry;\n\n\tstr[0] = '\\0';\n\tif (acl_get_entry(acl, ACL_FIRST_ENTRY, &entry) != 1)\n\t\treturn;\n\tfor(;;) {\n\t\tacl_tag_t tag;\n\n\t\tacl_get_tag_type(entry, &tag);\n\t\tif (tag == ACL_MASK) {\n\t\t\tacl_perm_str(entry, str);\n\t\t\treturn;\n\t\t}\n\t\tif (acl_get_entry(acl, ACL_NEXT_ENTRY, &entry) != 1)\n\t\t\treturn;\n\t}\n}",
  8767. "target": 0,
  8768. "cwe": [],
  8769. "project": "acl",
  8770. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8771. "hash": 102244957849193618816091429761976899252,
  8772. "size": 19,
  8773. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8774. "dataset": "other",
  8775. "idx": 491977
  8776. },
  8777. {
  8778. "func": "int do_print(const char *path_p, const struct stat *st, int walk_flags, void *unused)\n{\n\tconst char *default_prefix = NULL;\n\tacl_t acl = NULL, default_acl = NULL;\n\tint error = 0;\n\n\tif (walk_flags & WALK_TREE_FAILED) {\n\t\tfprintf(stderr, \"%s: %s: %s\\n\", progname, xquote(path_p, \"\\n\\r\"),\n\t\t\tstrerror(errno));\n\t\treturn 1;\n\t}\n\n\t/*\n\t * Symlinks can never have ACLs, so when doing a physical walk, we\n\t * skip symlinks altogether, and when doing a half-logical walk, we\n\t * skip all non-toplevel symlinks. \n\t */\n\tif ((walk_flags & WALK_TREE_SYMLINK) &&\n\t ((walk_flags & WALK_TREE_PHYSICAL) ||\n\t !(walk_flags & (WALK_TREE_TOPLEVEL | WALK_TREE_LOGICAL))))\n\t\treturn 0;\n\n\tif (opt_print_acl) {\n\t\tacl = acl_get_file(path_p, ACL_TYPE_ACCESS);\n\t\tif (acl == NULL && (errno == ENOSYS || errno == ENOTSUP))\n\t\t\tacl = acl_get_file_mode(path_p);\n\t\tif (acl == NULL)\n\t\t\tgoto fail;\n\t}\n\n\tif (opt_print_default_acl && S_ISDIR(st->st_mode)) {\n\t\tdefault_acl = acl_get_file(path_p, ACL_TYPE_DEFAULT);\n\t\tif (default_acl == NULL) {\n\t\t\tif (errno != ENOSYS && errno != ENOTSUP)\n\t\t\t\tgoto fail;\n\t\t} else if (acl_entries(default_acl) == 0) {\n\t\t\tacl_free(default_acl);\n\t\t\tdefault_acl = NULL;\n\t\t}\n\t}\n\n\tif (opt_skip_base &&\n\t (!acl || acl_equiv_mode(acl, NULL) == 0) && !default_acl)\n\t\treturn 0;\n\n\tif (opt_print_acl && opt_print_default_acl)\n\t\tdefault_prefix = \"default:\";\n\n\tif (opt_strip_leading_slash) {\n\t\tif (*path_p == '/') {\n\t\t\tif (!absolute_warning) {\n\t\t\t\tfprintf(stderr, _(\"%s: Removing leading \"\n\t\t\t\t\t\"'/' from absolute path names\\n\"),\n\t\t\t\t progname);\n\t\t\t\tabsolute_warning = 1;\n\t\t\t}\n\t\t\twhile (*path_p == '/')\n\t\t\t\tpath_p++;\n\t\t} else if (*path_p == '.' && *(path_p+1) == '/')\n\t\t\twhile (*++path_p == '/')\n\t\t\t\t/* nothing */ ;\n\t\tif (*path_p == '\\0')\n\t\t\tpath_p = \".\";\n\t}\n\n\tif (opt_tabular) {\n\t\tif (do_show(stdout, path_p, st, acl, default_acl) != 0)\n\t\t\tgoto fail;\n\t} else {\n\t\tif (opt_comments) {\n\t\t\tprintf(\"# file: %s\\n\", xquote(path_p, \"\\n\\r\"));\n\t\t\tprintf(\"# owner: %s\\n\",\n\t\t\t xquote(user_name(st->st_uid, opt_numeric), \" \\t\\n\\r\"));\n\t\t\tprintf(\"# group: %s\\n\",\n\t\t\t xquote(group_name(st->st_gid, opt_numeric), \" \\t\\n\\r\"));\n\t\t}\n\t\tif (acl != NULL) {\n\t\t\tchar *acl_text = acl_to_any_text(acl, NULL, '\\n',\n\t\t\t\t\t\t\t print_options);\n\t\t\tif (!acl_text)\n\t\t\t\tgoto fail;\n\t\t\tif (puts(acl_text) < 0) {\n\t\t\t\tacl_free(acl_text);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tacl_free(acl_text);\n\t\t}\n\t\tif (default_acl != NULL) {\n\t\t\tchar *acl_text = acl_to_any_text(default_acl, \n\t\t\t\t\t\t\t default_prefix, '\\n',\n\t\t\t\t\t\t\t print_options);\n\t\t\tif (!acl_text)\n\t\t\t\tgoto fail;\n\t\t\tif (puts(acl_text) < 0) {\n\t\t\t\tacl_free(acl_text);\n\t\t\t\tgoto fail;\n\t\t\t}\n\t\t\tacl_free(acl_text);\n\t\t}\n\t}\n\tif (acl || default_acl || opt_comments)\n\t\tprintf(\"\\n\");\n\ncleanup:\n\tif (acl)\n\t\tacl_free(acl);\n\tif (default_acl)\n\t\tacl_free(default_acl);\n\treturn error;\n\nfail:\n\tfprintf(stderr, \"%s: %s: %s\\n\", progname, xquote(path_p, \"\\n\\r\"),\n\t\tstrerror(errno));\n\terror = -1;\n\tgoto cleanup;\n}",
  8779. "target": 0,
  8780. "cwe": [],
  8781. "project": "acl",
  8782. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8783. "hash": 304094450354480469241650128653476885305,
  8784. "size": 116,
  8785. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8786. "dataset": "other",
  8787. "idx": 491971
  8788. },
  8789. {
  8790. "func": "void free_list(struct name_list *names)\n{\n\tstruct name_list *next;\n\n\twhile (names) {\n\t\tnext = names->next;\n\t\tfree(names);\n\t\tnames = next;\n\t}\n}",
  8791. "target": 0,
  8792. "cwe": [],
  8793. "project": "acl",
  8794. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8795. "hash": 246378709380030782815618129545973149210,
  8796. "size": 10,
  8797. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8798. "dataset": "other",
  8799. "idx": 491972
  8800. },
  8801. {
  8802. "func": "int show_line(FILE *stream, struct name_list **acl_names, acl_t acl,\n acl_entry_t *acl_ent, const char *acl_mask,\n struct name_list **dacl_names, acl_t dacl,\n\t acl_entry_t *dacl_ent, const char *dacl_mask)\n{\n\tacl_tag_t tag_type;\n\tconst char *tag, *name;\n\tchar acl_perm[ACL_PERMS+1], dacl_perm[ACL_PERMS+1];\n\n\tif (acl) {\n\t\tacl_get_tag_type(*acl_ent, &tag_type);\n\t\tname = (*acl_names)->name;\n\t} else {\n\t\tacl_get_tag_type(*dacl_ent, &tag_type);\n\t\tname = (*dacl_names)->name;\n\t}\n\n\tswitch(tag_type) {\n\t\tcase ACL_USER_OBJ:\n\t\t\ttag = \"USER\";\n\t\t\tbreak;\n\t\tcase ACL_USER:\n\t\t\ttag = \"user\";\n\t\t\tbreak;\n\t\tcase ACL_GROUP_OBJ:\n\t\t\ttag = \"GROUP\";\n\t\t\tbreak;\n\t\tcase ACL_GROUP:\n\t\t\ttag = \"group\";\n\t\t\tbreak;\n\t\tcase ACL_MASK:\n\t\t\ttag = \"mask\";\n\t\t\tbreak;\n\t\tcase ACL_OTHER:\n\t\t\ttag = \"other\";\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn -1;\n\t}\n\n\tmemset(acl_perm, ' ', ACL_PERMS);\n\tacl_perm[ACL_PERMS] = '\\0';\n\tif (acl_ent) {\n\t\tacl_perm_str(*acl_ent, acl_perm);\n\t\tif (tag_type != ACL_USER_OBJ && tag_type != ACL_OTHER &&\n\t\t tag_type != ACL_MASK)\n\t\t\tapply_mask(acl_perm, acl_mask);\n\t}\n\tmemset(dacl_perm, ' ', ACL_PERMS);\n\tdacl_perm[ACL_PERMS] = '\\0';\n\tif (dacl_ent) {\n\t\tacl_perm_str(*dacl_ent, dacl_perm);\n\t\tif (tag_type != ACL_USER_OBJ && tag_type != ACL_OTHER &&\n\t\t tag_type != ACL_MASK)\n\t\t\tapply_mask(dacl_perm, dacl_mask);\n\t}\n\n\tfprintf(stream, \"%-5s %*s %*s %*s\\n\",\n\t tag, -names_width, name,\n\t -(int)ACL_PERMS, acl_perm,\n\t\t-(int)ACL_PERMS, dacl_perm);\n\n\tif (acl_names) {\n\t\tacl_get_entry(acl, ACL_NEXT_ENTRY, acl_ent);\n\t\t(*acl_names) = (*acl_names)->next;\n\t}\n\tif (dacl_names) {\n\t\tacl_get_entry(dacl, ACL_NEXT_ENTRY, dacl_ent);\n\t\t(*dacl_names) = (*dacl_names)->next;\n\t}\n\treturn 0;\n}",
  8803. "target": 0,
  8804. "cwe": [],
  8805. "project": "acl",
  8806. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8807. "hash": 161065813611095891222693530206636661992,
  8808. "size": 72,
  8809. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8810. "dataset": "other",
  8811. "idx": 491974
  8812. },
  8813. {
  8814. "func": "void acl_perm_str(acl_entry_t entry, char *str)\n{\n\tacl_permset_t permset;\n\tint n;\n\n\tacl_get_permset(entry, &permset);\n\tfor (n = 0; n < (int) ACL_PERMS; n++) {\n\t\tstr[n] = (acl_get_perm(permset, acl_perm_defs[n].tag) ?\n\t\t acl_perm_defs[n].c : '-');\n\t}\n\tstr[n] = '\\0';\n}",
  8815. "target": 0,
  8816. "cwe": [],
  8817. "project": "acl",
  8818. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8819. "hash": 240727839017765817104842232036773145645,
  8820. "size": 12,
  8821. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8822. "dataset": "other",
  8823. "idx": 491975
  8824. },
  8825. {
  8826. "func": "int max_name_length(struct name_list *names)\n{\n\tint max_len = 0;\n\twhile (names != NULL) {\n\t\tstruct name_list *next = names->next;\n\t\tint len = strlen(names->name);\n\n\t\tif (len > max_len)\n\t\t\tmax_len = len;\n\t\tnames = next;\n\t}\n\treturn max_len;\n}",
  8827. "target": 0,
  8828. "cwe": [],
  8829. "project": "acl",
  8830. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8831. "hash": 236533432565682712712378128349416165826,
  8832. "size": 13,
  8833. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8834. "dataset": "other",
  8835. "idx": 491978
  8836. },
  8837. {
  8838. "func": "void apply_mask(char *perm, const char *mask)\n{\n\twhile (*perm) {\n\t\tif (*mask == '-' && *perm >= 'a' && *perm <= 'z')\n\t\t\t*perm = *perm - 'a' + 'A';\n\t\tperm++;\n\t\tif (*mask)\n\t\t\tmask++;\n\t}\n}",
  8839. "target": 0,
  8840. "cwe": [],
  8841. "project": "acl",
  8842. "commit_id": "63451a06b7484d220750ed8574d3ee84e156daf5",
  8843. "hash": 235784037899618074132466825107297440506,
  8844. "size": 10,
  8845. "message": "Make sure that getfacl -R only calls stat(2) on symlinks when it needs to\n\nThis fixes http://oss.sgi.com/bugzilla/show_bug.cgi?id=790\n\"getfacl follows symlinks, even without -L\".",
  8846. "dataset": "other",
  8847. "idx": 491968
  8848. }
  8849. ]
  8850. },
  8851. {
  8852. "call_depth": 3,
  8853. "longest_call_chain": [
  8854. "tooLargePattern",
  8855. "ASSERT_THROWS_CODE",
  8856. "regex"
  8857. ],
  8858. "group_size": 34,
  8859. "functions": [
  8860. {
  8861. "func": "void RegexMatchExpression::_init() {\n uassert(\n ErrorCodes::BadValue, \"Regular expression is too long\", _regex.size() <= kMaxPatternSize);\n\n uassert(ErrorCodes::BadValue,\n \"Regular expression cannot contain an embedded null byte\",\n _regex.find('\\0') == std::string::npos);\n\n uassert(ErrorCodes::BadValue,\n \"Regular expression options string cannot contain an embedded null byte\",\n _flags.find('\\0') == std::string::npos);\n}",
  8862. "project": "mongo",
  8863. "hash": 196906255193958728876698958313286561082,
  8864. "size": 12,
  8865. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8866. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8867. "target": 1,
  8868. "dataset": "other",
  8869. "idx": 209844
  8870. },
  8871. {
  8872. "func": "void RegexMatchExpression::_init() {\n uassert(\n ErrorCodes::BadValue, \"Regular expression is too long\", _regex.size() <= kMaxPatternSize);\n\n uassert(ErrorCodes::BadValue,\n \"Regular expression cannot contain an embedded null byte\",\n _regex.find('\\0') == std::string::npos);\n\n uassert(ErrorCodes::BadValue,\n \"Regular expression options string cannot contain an embedded null byte\",\n _flags.find('\\0') == std::string::npos);\n\n // isValidUTF8() checks for UTF-8 which does not map to a series of codepoints but does not\n // check the validity of the code points themselves. These situations do not cause problems\n // downstream so we do not do additional work to enforce that the code points are valid.\n uassert(\n 5108300, \"Regular expression is invalid UTF-8\", isValidUTF8(_regex) && isValidUTF8(_flags));\n}",
  8873. "project": "mongo",
  8874. "hash": 296417704049406944583817007241379160223,
  8875. "size": 18,
  8876. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8877. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8878. "target": 0,
  8879. "dataset": "other",
  8880. "idx": 422547
  8881. },
  8882. {
  8883. "func": " RegexMatcherImpl(const RequirementRule& rule)\n : BaseMatcherImpl(rule), regex_str_(rule.match().safe_regex().regex()),\n path_matcher_(Matchers::PathMatcher::createSafeRegex(rule.match().safe_regex())) {\n ASSERT(rule.match().path_specifier_case() ==\n envoy::config::route::v3::RouteMatch::PathSpecifierCase::kSafeRegex);\n }",
  8884. "project": "envoy",
  8885. "hash": 177926330647558908520111297623450225194,
  8886. "size": 6,
  8887. "commit_id": "9371333230b1a6e1be2eccf4868771e11af6253a",
  8888. "message": "CVE-2021-43824\n\njwt_atuhn: fixed the crash when a CONNECT request is sent to JWT filter\nconfigured with regex match.\n\nSigned-off-by: Yan Avlasov <yavlasov@google.com>",
  8889. "target": 0,
  8890. "dataset": "other",
  8891. "idx": 246608
  8892. },
  8893. {
  8894. "func": " ConnectMatcherImpl(const RequirementRule& rule) : BaseMatcherImpl(rule) {}",
  8895. "project": "envoy",
  8896. "hash": 69909293970036435930584561002786980459,
  8897. "size": 1,
  8898. "commit_id": "9371333230b1a6e1be2eccf4868771e11af6253a",
  8899. "message": "CVE-2021-43824\n\njwt_atuhn: fixed the crash when a CONNECT request is sent to JWT filter\nconfigured with regex match.\n\nSigned-off-by: Yan Avlasov <yavlasov@google.com>",
  8900. "target": 0,
  8901. "dataset": "other",
  8902. "idx": 246600
  8903. },
  8904. {
  8905. "func": "RegexMatchExpression::RegexMatchExpression(StringData path, StringData regex, StringData options)\n : LeafMatchExpression(REGEX, path),\n _regex(regex.toString()),\n _flags(options.toString()),\n _re(new pcrecpp::RE(_regex.c_str(), flags2options(_flags.c_str()))) {\n _init();\n}",
  8906. "project": "mongo",
  8907. "hash": 335861526958212346706983090925732908437,
  8908. "size": 7,
  8909. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8910. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8911. "target": 0,
  8912. "dataset": "other",
  8913. "idx": 422536
  8914. },
  8915. {
  8916. "func": "RegexMatchExpression::RegexMatchExpression(StringData path, const BSONElement& e)\n : LeafMatchExpression(REGEX, path),\n _regex(e.regex()),\n _flags(e.regexFlags()),\n _re(new pcrecpp::RE(_regex.c_str(), flags2options(_flags.c_str()))) {\n uassert(ErrorCodes::BadValue, \"regex not a regex\", e.type() == RegEx);\n _init();\n}",
  8917. "project": "mongo",
  8918. "hash": 70858585662722592172046567506141856880,
  8919. "size": 8,
  8920. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8921. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8922. "target": 0,
  8923. "dataset": "other",
  8924. "idx": 422685
  8925. },
  8926. {
  8927. "func": " PathMatcherImpl(const RequirementRule& rule)\n : BaseMatcherImpl(rule), path_(rule.match().path()),\n path_matcher_(Matchers::PathMatcher::createExact(path_, !case_sensitive_)) {}",
  8928. "project": "envoy",
  8929. "hash": 236527079260690776661196479027875964453,
  8930. "size": 3,
  8931. "commit_id": "9371333230b1a6e1be2eccf4868771e11af6253a",
  8932. "message": "CVE-2021-43824\n\njwt_atuhn: fixed the crash when a CONNECT request is sent to JWT filter\nconfigured with regex match.\n\nSigned-off-by: Yan Avlasov <yavlasov@google.com>",
  8933. "target": 0,
  8934. "dataset": "other",
  8935. "idx": 246601
  8936. },
  8937. {
  8938. "func": " PrefixMatcherImpl(const RequirementRule& rule)\n : BaseMatcherImpl(rule), prefix_(rule.match().prefix()),\n path_matcher_(Matchers::PathMatcher::createPrefix(prefix_, !case_sensitive_)) {}",
  8939. "project": "envoy",
  8940. "hash": 81940720665359151703373047087591024809,
  8941. "size": 3,
  8942. "commit_id": "9371333230b1a6e1be2eccf4868771e11af6253a",
  8943. "message": "CVE-2021-43824\n\njwt_atuhn: fixed the crash when a CONNECT request is sent to JWT filter\nconfigured with regex match.\n\nSigned-off-by: Yan Avlasov <yavlasov@google.com>",
  8944. "target": 0,
  8945. "dataset": "other",
  8946. "idx": 246617
  8947. },
  8948. {
  8949. "func": "TEST(RegexMatchExpression, MatchesElementDotAllOn) {\n BSONObj match = BSON(\"x\"\n << \"a b\");\n BSONObj matchDotAll = BSON(\"x\"\n << \"a\\nb\");\n BSONObj notMatch = BSON(\"x\"\n << \"ab\");\n RegexMatchExpression regex(\"\", \"a.b\", \"s\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(regex.matchesSingleElement(matchDotAll.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  8950. "project": "mongo",
  8951. "hash": 63412851143097204133445098103344934924,
  8952. "size": 12,
  8953. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8954. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8955. "target": 0,
  8956. "dataset": "other",
  8957. "idx": 422534
  8958. },
  8959. {
  8960. "func": "TEST(RegexMatchExpression, MatchesNull) {\n RegexMatchExpression regex(\"a\", \"b\", \"\");\n ASSERT(!regex.matchesBSON(BSONObj(), NULL));\n ASSERT(!regex.matchesBSON(BSON(\"a\" << BSONNULL), NULL));\n}",
  8961. "project": "mongo",
  8962. "hash": 193009804061745465816871677323230638849,
  8963. "size": 5,
  8964. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8965. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8966. "target": 0,
  8967. "dataset": "other",
  8968. "idx": 422543
  8969. },
  8970. {
  8971. "func": "TEST(RegexMatchExpression, MatchesElementDotAllOff) {\n BSONObj match = BSON(\"x\"\n << \"a b\");\n BSONObj notMatch = BSON(\"x\"\n << \"a\\nb\");\n RegexMatchExpression regex(\"\", \"a.b\", \"\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  8972. "project": "mongo",
  8973. "hash": 254989944548547860653052183568318768603,
  8974. "size": 9,
  8975. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8976. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8977. "target": 0,
  8978. "dataset": "other",
  8979. "idx": 422567
  8980. },
  8981. {
  8982. "func": "TEST(RegexMatchExpression, MatchesElementWrongType) {\n BSONObj notMatchInt = BSON(\"x\" << 1);\n BSONObj notMatchBool = BSON(\"x\" << true);\n RegexMatchExpression regex(\"\", \"1\", \"\");\n ASSERT(!regex.matchesSingleElement(notMatchInt.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatchBool.firstElement()));\n}",
  8983. "project": "mongo",
  8984. "hash": 296477677199849513746558412559452083102,
  8985. "size": 7,
  8986. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8987. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8988. "target": 0,
  8989. "dataset": "other",
  8990. "idx": 422579
  8991. },
  8992. {
  8993. "func": "TEST(RegexMatchExpression, MatchesElementSymbolType) {\n BSONObj match = BSONObjBuilder().appendSymbol(\"x\", \"yz\").obj();\n BSONObj notMatch = BSONObjBuilder().appendSymbol(\"x\", \"gg\").obj();\n RegexMatchExpression regex(\"\", \"yz\", \"\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  8994. "project": "mongo",
  8995. "hash": 301556173795461187162616872778185518220,
  8996. "size": 7,
  8997. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  8998. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  8999. "target": 0,
  9000. "dataset": "other",
  9001. "idx": 422581
  9002. },
  9003. {
  9004. "func": "TEST(RegexMatchExpression, ElemMatchKey) {\n RegexMatchExpression regex(\"a\", \"b\", \"\");\n MatchDetails details;\n details.requestElemMatchKey();\n ASSERT(!regex.matchesBSON(BSON(\"a\"\n << \"c\"),\n &details));\n ASSERT(!details.hasElemMatchKey());\n ASSERT(regex.matchesBSON(BSON(\"a\"\n << \"b\"),\n &details));\n ASSERT(!details.hasElemMatchKey());\n ASSERT(regex.matchesBSON(BSON(\"a\" << BSON_ARRAY(\"c\"\n << \"b\")),\n &details));\n ASSERT(details.hasElemMatchKey());\n ASSERT_EQUALS(\"1\", details.elemMatchKey());\n}",
  9005. "project": "mongo",
  9006. "hash": 145973166090898470211725047307295936287,
  9007. "size": 18,
  9008. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9009. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9010. "target": 0,
  9011. "dataset": "other",
  9012. "idx": 422582
  9013. },
  9014. {
  9015. "func": "TEST(RegexMatchExpression, MalformedRegexAcceptedButMatchesNothing) {\n RegexMatchExpression regex(\"a\", \"[(*ACCEPT)\", \"\");\n ASSERT_FALSE(regex.matchesBSON(BSON(\"a\"\n << \"\")));\n ASSERT_FALSE(regex.matchesBSON(BSON(\"a\"\n << \"[\")));\n}",
  9016. "project": "mongo",
  9017. "hash": 53344960387358334717005761952875921258,
  9018. "size": 7,
  9019. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9020. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9021. "target": 0,
  9022. "dataset": "other",
  9023. "idx": 422592
  9024. },
  9025. {
  9026. "func": "TEST(RegexMatchExpression, MatchesElementMultilineOn) {\n BSONObj match = BSON(\"x\"\n << \"az\");\n BSONObj matchMultiline = BSON(\"x\"\n << \"\\naz\");\n BSONObj notMatch = BSON(\"x\"\n << \"\\n\\n\");\n RegexMatchExpression regex(\"\", \"^a\", \"m\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(regex.matchesSingleElement(matchMultiline.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9027. "project": "mongo",
  9028. "hash": 253041449393034191418301643541322807902,
  9029. "size": 12,
  9030. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9031. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9032. "target": 0,
  9033. "dataset": "other",
  9034. "idx": 422601
  9035. },
  9036. {
  9037. "func": "TEST(RegexMatchExpression, RegexAcceptsUCPOption) {\n RegexMatchExpression regex(\"a\", \"(*UCP)(\\\\w|\\u304C)\", \"\");\n ASSERT(regex.matchesBSON(BSON(\"a\"\n << \"k\")));\n ASSERT(regex.matchesBSON(BSON(\"a\"\n << \"\\u304B\")));\n ASSERT(regex.matchesBSON(BSON(\"a\"\n << \"\\u304C\")));\n}",
  9038. "project": "mongo",
  9039. "hash": 9313621577667968064463263427990204031,
  9040. "size": 9,
  9041. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9042. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9043. "target": 0,
  9044. "dataset": "other",
  9045. "idx": 422618
  9046. },
  9047. {
  9048. "func": "TEST(RegexMatchExpression, MatchesElementExtendedOff) {\n BSONObj match = BSON(\"x\"\n << \"a b\");\n BSONObj notMatch = BSON(\"x\"\n << \"ab\");\n RegexMatchExpression regex(\"\", \"a b\", \"\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9049. "project": "mongo",
  9050. "hash": 189742530746481934825047330178964446135,
  9051. "size": 9,
  9052. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9053. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9054. "target": 0,
  9055. "dataset": "other",
  9056. "idx": 422626
  9057. },
  9058. {
  9059. "func": "TEST(RegexMatchExpression, MatchesScalar) {\n RegexMatchExpression regex(\"a\", \"b\", \"\");\n ASSERT(regex.matchesBSON(BSON(\"a\"\n << \"b\"),\n NULL));\n ASSERT(!regex.matchesBSON(BSON(\"a\"\n << \"c\"),\n NULL));\n}",
  9060. "project": "mongo",
  9061. "hash": 238555791786910426223972844546631149159,
  9062. "size": 9,
  9063. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9064. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9065. "target": 0,
  9066. "dataset": "other",
  9067. "idx": 422627
  9068. },
  9069. {
  9070. "func": "TEST(RegexMatchExpression, MatchesElementMultipleFlags) {\n BSONObj matchMultilineDotAll = BSON(\"x\"\n << \"\\na\\nb\");\n RegexMatchExpression regex(\"\", \"^a.b\", \"ms\");\n ASSERT(regex.matchesSingleElement(matchMultilineDotAll.firstElement()));\n}",
  9071. "project": "mongo",
  9072. "hash": 274046080689778210121094181073121824682,
  9073. "size": 6,
  9074. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9075. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9076. "target": 0,
  9077. "dataset": "other",
  9078. "idx": 422630
  9079. },
  9080. {
  9081. "func": "TEST(RegexMatchExpression, MatchesElementMultilineOff) {\n BSONObj match = BSON(\"x\"\n << \"az\");\n BSONObj notMatch = BSON(\"x\"\n << \"\\naz\");\n RegexMatchExpression regex(\"\", \"^a\", \"\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9082. "project": "mongo",
  9083. "hash": 30805843691375222757285220202287272140,
  9084. "size": 9,
  9085. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9086. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9087. "target": 0,
  9088. "dataset": "other",
  9089. "idx": 422646
  9090. },
  9091. {
  9092. "func": "TEST(RegexMatchExpression, MatchesElementCaseSensitive) {\n BSONObj match = BSON(\"x\"\n << \"abc\");\n BSONObj notMatch = BSON(\"x\"\n << \"ABC\");\n RegexMatchExpression regex(\"\", \"abc\", \"\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9093. "project": "mongo",
  9094. "hash": 109807149515533842565870345205746509936,
  9095. "size": 9,
  9096. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9097. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9098. "target": 0,
  9099. "dataset": "other",
  9100. "idx": 422647
  9101. },
  9102. {
  9103. "func": "TEST(RegexMatchExpression, MatchesArrayValue) {\n RegexMatchExpression regex(\"a\", \"b\", \"\");\n ASSERT(regex.matchesBSON(BSON(\"a\" << BSON_ARRAY(\"c\"\n << \"b\")),\n NULL));\n ASSERT(!regex.matchesBSON(BSON(\"a\" << BSON_ARRAY(\"d\"\n << \"c\")),\n NULL));\n}",
  9104. "project": "mongo",
  9105. "hash": 220263853473013391651097862422017913166,
  9106. "size": 9,
  9107. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9108. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9109. "target": 0,
  9110. "dataset": "other",
  9111. "idx": 422648
  9112. },
  9113. {
  9114. "func": "TEST(RegexMatchExpression, MatchesElementSimplePrefix) {\n BSONObj match = BSON(\"x\"\n << \"abc\");\n BSONObj notMatch = BSON(\"x\"\n << \"adz\");\n RegexMatchExpression regex(\"\", \"^ab\", \"\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9115. "project": "mongo",
  9116. "hash": 104537045789006579046504453602952695715,
  9117. "size": 9,
  9118. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9119. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9120. "target": 0,
  9121. "dataset": "other",
  9122. "idx": 422657
  9123. },
  9124. {
  9125. "func": "TEST(RegexMatchExpression, MatchesElementUtf8) {\n BSONObj multiByteCharacter = BSON(\"x\"\n << \"\\xc2\\xa5\");\n RegexMatchExpression regex(\"\", \"^.$\", \"\");\n ASSERT(regex.matchesSingleElement(multiByteCharacter.firstElement()));\n}",
  9126. "project": "mongo",
  9127. "hash": 228045459094896457478921951931574105884,
  9128. "size": 6,
  9129. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9130. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9131. "target": 0,
  9132. "dataset": "other",
  9133. "idx": 422662
  9134. },
  9135. {
  9136. "func": "TEST(RegexMatchExpression, MatchesElementExact) {\n BSONObj match = BSON(\"a\"\n << \"b\");\n BSONObj notMatch = BSON(\"a\"\n << \"c\");\n RegexMatchExpression regex(\"\", \"b\", \"\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9137. "project": "mongo",
  9138. "hash": 246675795675956434778627281700852083841,
  9139. "size": 9,
  9140. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9141. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9142. "target": 0,
  9143. "dataset": "other",
  9144. "idx": 422670
  9145. },
  9146. {
  9147. "func": "TEST(RegexMatchExpression, MatchesElementRegexType) {\n BSONObj match = BSONObjBuilder().appendRegex(\"x\", \"yz\", \"i\").obj();\n BSONObj notMatchPattern = BSONObjBuilder().appendRegex(\"x\", \"r\", \"i\").obj();\n BSONObj notMatchFlags = BSONObjBuilder().appendRegex(\"x\", \"yz\", \"s\").obj();\n RegexMatchExpression regex(\"\", \"yz\", \"i\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatchPattern.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatchFlags.firstElement()));\n}",
  9148. "project": "mongo",
  9149. "hash": 41068840303974328139967044120733554012,
  9150. "size": 9,
  9151. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9152. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9153. "target": 0,
  9154. "dataset": "other",
  9155. "idx": 422671
  9156. },
  9157. {
  9158. "func": "TEST(RegexMatchExpression, MatchesElementExtendedOn) {\n BSONObj match = BSON(\"x\"\n << \"ab\");\n BSONObj notMatch = BSON(\"x\"\n << \"a b\");\n RegexMatchExpression regex(\"\", \"a b\", \"x\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9159. "project": "mongo",
  9160. "hash": 30100801040499127389091838096252595386,
  9161. "size": 9,
  9162. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9163. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9164. "target": 0,
  9165. "dataset": "other",
  9166. "idx": 422678
  9167. },
  9168. {
  9169. "func": "TEST(RegexMatchExpression, MatchesElementCaseInsensitive) {\n BSONObj match = BSON(\"x\"\n << \"abc\");\n BSONObj matchUppercase = BSON(\"x\"\n << \"ABC\");\n BSONObj notMatch = BSON(\"x\"\n << \"abz\");\n RegexMatchExpression regex(\"\", \"abc\", \"i\");\n ASSERT(regex.matchesSingleElement(match.firstElement()));\n ASSERT(regex.matchesSingleElement(matchUppercase.firstElement()));\n ASSERT(!regex.matchesSingleElement(notMatch.firstElement()));\n}",
  9170. "project": "mongo",
  9171. "hash": 270724244339065023498330291061524903221,
  9172. "size": 12,
  9173. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9174. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9175. "target": 0,
  9176. "dataset": "other",
  9177. "idx": 422679
  9178. },
  9179. {
  9180. "func": "TEST(RegexMatchExpression, TooLargePattern) {\n string tooLargePattern(50 * 1000, 'z');\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"a\", tooLargePattern, \"\"),\n AssertionException,\n ErrorCodes::BadValue);\n}",
  9181. "project": "mongo",
  9182. "hash": 144259179245132325864815488828294198010,
  9183. "size": 6,
  9184. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9185. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9186. "target": 0,
  9187. "dataset": "other",
  9188. "idx": 422610
  9189. },
  9190. {
  9191. "func": " BaseMatcherImpl(const RequirementRule& rule)\n : case_sensitive_(PROTOBUF_GET_WRAPPED_OR_DEFAULT(rule.match(), case_sensitive, true)),\n config_headers_(Http::HeaderUtility::buildHeaderDataVector(rule.match().headers())) {\n for (const auto& query_parameter : rule.match().query_parameters()) {\n config_query_parameters_.push_back(\n std::make_unique<Router::ConfigUtility::QueryParameterMatcher>(query_parameter));\n }\n }",
  9192. "project": "envoy",
  9193. "hash": 166923194649114364939241113749561431729,
  9194. "size": 8,
  9195. "commit_id": "9371333230b1a6e1be2eccf4868771e11af6253a",
  9196. "message": "CVE-2021-43824\n\njwt_atuhn: fixed the crash when a CONNECT request is sent to JWT filter\nconfigured with regex match.\n\nSigned-off-by: Yan Avlasov <yavlasov@google.com>",
  9197. "target": 0,
  9198. "dataset": "other",
  9199. "idx": 246628
  9200. },
  9201. {
  9202. "func": "TEST(ModMatchExpression, ZeroDivisor) {\n ASSERT_THROWS_CODE(ModMatchExpression mod(\"\", 0, 1), AssertionException, ErrorCodes::BadValue);\n}",
  9203. "project": "mongo",
  9204. "hash": 210026470774459985495121513352399864150,
  9205. "size": 3,
  9206. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9207. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9208. "target": 0,
  9209. "dataset": "other",
  9210. "idx": 422550
  9211. },
  9212. {
  9213. "func": "TEST(RegexMatchExpression, RegexCannotContainEmbeddedNullByte) {\n {\n const auto embeddedNull = \"a\\0b\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", embeddedNull, \"\"),\n AssertionException,\n ErrorCodes::BadValue);\n }\n\n {\n const auto singleNullByte = \"\\0\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", singleNullByte, \"\"),\n AssertionException,\n ErrorCodes::BadValue);\n }\n\n {\n const auto leadingNullByte = \"\\0bbbb\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", leadingNullByte, \"\"),\n AssertionException,\n ErrorCodes::BadValue);\n }\n\n {\n const auto trailingNullByte = \"bbbb\\0\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", trailingNullByte, \"\"),\n AssertionException,\n ErrorCodes::BadValue);\n }\n}",
  9214. "project": "mongo",
  9215. "hash": 214167679385357894421527743201648837080,
  9216. "size": 29,
  9217. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9218. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9219. "target": 0,
  9220. "dataset": "other",
  9221. "idx": 422624
  9222. },
  9223. {
  9224. "func": "TEST(RegexMatchExpression, RegexOptionsStringCannotContainEmbeddedNullByte) {\n {\n const auto embeddedNull = \"a\\0b\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", \"pattern\", embeddedNull),\n AssertionException,\n ErrorCodes::BadValue);\n }\n\n {\n const auto singleNullByte = \"\\0\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", \"pattern\", singleNullByte),\n AssertionException,\n ErrorCodes::BadValue);\n }\n\n {\n const auto leadingNullByte = \"\\0bbbb\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", \"pattern\", leadingNullByte),\n AssertionException,\n ErrorCodes::BadValue);\n }\n\n {\n const auto trailingNullByte = \"bbbb\\0\"_sd;\n ASSERT_THROWS_CODE(RegexMatchExpression regex(\"path\", \"pattern\", trailingNullByte),\n AssertionException,\n ErrorCodes::BadValue);\n }\n}",
  9225. "project": "mongo",
  9226. "hash": 284944757388508690836471167619011489748,
  9227. "size": 29,
  9228. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  9229. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  9230. "target": 0,
  9231. "dataset": "other",
  9232. "idx": 422651
  9233. }
  9234. ]
  9235. },
  9236. {
  9237. "call_depth": 3,
  9238. "longest_call_chain": [
  9239. "FromkLinuxCpuSet",
  9240. "kLinuxCpuSetCheckBit",
  9241. "kLinuxCpuWordNum"
  9242. ],
  9243. "group_size": 4,
  9244. "functions": [
  9245. {
  9246. "func": "inline uint64_t kLinuxCpuWordNum(int cpu) {\n return cpu / (8 * sizeof(klinux_cpu_set_word));\n}",
  9247. "project": "asylo",
  9248. "hash": 308057746686457165258786405237147697555,
  9249. "size": 3,
  9250. "commit_id": "bda9772e7872b0d2b9bee32930cf7a4983837b39",
  9251. "message": "Check input length in FromLinuxSockAddr\n\nPiperOrigin-RevId: 333785506\nChange-Id: I1d68fb8954665eebc1018d80ff995cbe9e7ed6a9",
  9252. "target": 0,
  9253. "dataset": "other",
  9254. "idx": 263430
  9255. },
  9256. {
  9257. "func": "int kLinuxCpuSetCheckBit(int cpu, klinux_cpu_set_t *set) {\n return (set->words[kLinuxCpuWordNum(cpu)] &\n (static_cast<klinux_cpu_set_word>(1) << kLinuxCpuBitNum(cpu))) != 0;\n}",
  9258. "project": "asylo",
  9259. "hash": 9664284605372000371369559691608006991,
  9260. "size": 4,
  9261. "commit_id": "bda9772e7872b0d2b9bee32930cf7a4983837b39",
  9262. "message": "Check input length in FromLinuxSockAddr\n\nPiperOrigin-RevId: 333785506\nChange-Id: I1d68fb8954665eebc1018d80ff995cbe9e7ed6a9",
  9263. "target": 0,
  9264. "dataset": "other",
  9265. "idx": 263440
  9266. },
  9267. {
  9268. "func": "inline klinux_cpu_set_word kLinuxCpuBitNum(int cpu) {\n return cpu % (8 * sizeof(klinux_cpu_set_word));\n}",
  9269. "project": "asylo",
  9270. "hash": 206687947824855021326968881950347607340,
  9271. "size": 3,
  9272. "commit_id": "bda9772e7872b0d2b9bee32930cf7a4983837b39",
  9273. "message": "Check input length in FromLinuxSockAddr\n\nPiperOrigin-RevId: 333785506\nChange-Id: I1d68fb8954665eebc1018d80ff995cbe9e7ed6a9",
  9274. "target": 0,
  9275. "dataset": "other",
  9276. "idx": 263432
  9277. },
  9278. {
  9279. "func": "bool FromkLinuxCpuSet(klinux_cpu_set_t *input, cpu_set_t *output) {\n if (!input || !output) {\n return false;\n }\n\n CPU_ZERO(output);\n\n for (int cpu = 0; cpu < KLINUX_CPU_SET_MAX_CPUS; cpu++) {\n if (kLinuxCpuSetCheckBit(cpu, input)) {\n CPU_SET(cpu, output);\n }\n }\n return true;\n}",
  9280. "project": "asylo",
  9281. "hash": 83580394826757849395774231587230699499,
  9282. "size": 14,
  9283. "commit_id": "bda9772e7872b0d2b9bee32930cf7a4983837b39",
  9284. "message": "Check input length in FromLinuxSockAddr\n\nPiperOrigin-RevId: 333785506\nChange-Id: I1d68fb8954665eebc1018d80ff995cbe9e7ed6a9",
  9285. "target": 0,
  9286. "dataset": "other",
  9287. "idx": 263439
  9288. }
  9289. ]
  9290. },
  9291. {
  9292. "call_depth": 3,
  9293. "longest_call_chain": [
  9294. "flatview_read",
  9295. "flatview_read_continue",
  9296. "memory_access_size"
  9297. ],
  9298. "group_size": 8,
  9299. "functions": [
  9300. {
  9301. "func": "static MemTxResult flatview_write(FlatView *fv, hwaddr addr, MemTxAttrs attrs,\n const void *buf, hwaddr len)\n{\n hwaddr l;\n hwaddr addr1;\n MemoryRegion *mr;\n\n l = len;\n mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);\n if (!flatview_access_allowed(mr, attrs, addr, len)) {\n return MEMTX_ACCESS_ERROR;\n }\n return flatview_write_continue(fv, addr, attrs, buf, len,\n addr1, l, mr);\n}",
  9302. "target": 0,
  9303. "cwe": [
  9304. "CWE-908"
  9305. ],
  9306. "project": "qemu",
  9307. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9308. "hash": 111322297083016839008485737585231516371,
  9309. "size": 15,
  9310. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9311. "dataset": "other",
  9312. "idx": 514787
  9313. },
  9314. {
  9315. "func": "int memory_access_size(MemoryRegion *mr, unsigned l, hwaddr addr)\n{\n unsigned access_size_max = mr->ops->valid.max_access_size;\n\n /* Regions are assumed to support 1-4 byte accesses unless\n otherwise specified. */\n if (access_size_max == 0) {\n access_size_max = 4;\n }\n\n /* Bound the maximum access by the alignment of the address. */\n if (!mr->ops->impl.unaligned) {\n unsigned align_size_max = addr & -addr;\n if (align_size_max != 0 && align_size_max < access_size_max) {\n access_size_max = align_size_max;\n }\n }\n\n /* Don't attempt accesses larger than the maximum. */\n if (l > access_size_max) {\n l = access_size_max;\n }\n l = pow2floor(l);\n\n return l;\n}",
  9316. "target": 0,
  9317. "cwe": [
  9318. "CWE-908"
  9319. ],
  9320. "project": "qemu",
  9321. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9322. "hash": 128892610593230758689950558718855065981,
  9323. "size": 26,
  9324. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9325. "dataset": "other",
  9326. "idx": 514764
  9327. },
  9328. {
  9329. "func": "static MemTxResult flatview_write_continue(FlatView *fv, hwaddr addr,\n MemTxAttrs attrs,\n const void *ptr,\n hwaddr len, hwaddr addr1,\n hwaddr l, MemoryRegion *mr)\n{\n uint8_t *ram_ptr;\n uint64_t val;\n MemTxResult result = MEMTX_OK;\n bool release_lock = false;\n const uint8_t *buf = ptr;\n\n for (;;) {\n if (!flatview_access_allowed(mr, attrs, addr1, l)) {\n result |= MEMTX_ACCESS_ERROR;\n /* Keep going. */\n } else if (!memory_access_is_direct(mr, true)) {\n release_lock |= prepare_mmio_access(mr);\n l = memory_access_size(mr, l, addr1);\n /* XXX: could force current_cpu to NULL to avoid\n potential bugs */\n val = ldn_he_p(buf, l);\n result |= memory_region_dispatch_write(mr, addr1, val,\n size_memop(l), attrs);\n } else {\n /* RAM case */\n ram_ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);\n memcpy(ram_ptr, buf, l);\n invalidate_and_set_dirty(mr, addr1, l);\n }\n\n if (release_lock) {\n qemu_mutex_unlock_iothread();\n release_lock = false;\n }\n\n len -= l;\n buf += l;\n addr += l;\n\n if (!len) {\n break;\n }\n\n l = len;\n mr = flatview_translate(fv, addr, &addr1, &l, true, attrs);\n }\n\n return result;\n}",
  9330. "target": 0,
  9331. "cwe": [
  9332. "CWE-908"
  9333. ],
  9334. "project": "qemu",
  9335. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9336. "hash": 235798208000865140915448621750172246340,
  9337. "size": 50,
  9338. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9339. "dataset": "other",
  9340. "idx": 514750
  9341. },
  9342. {
  9343. "func": "static inline MemTxResult address_space_write_rom_internal(AddressSpace *as,\n hwaddr addr,\n MemTxAttrs attrs,\n const void *ptr,\n hwaddr len,\n enum write_rom_type type)\n{\n hwaddr l;\n uint8_t *ram_ptr;\n hwaddr addr1;\n MemoryRegion *mr;\n const uint8_t *buf = ptr;\n\n RCU_READ_LOCK_GUARD();\n while (len > 0) {\n l = len;\n mr = address_space_translate(as, addr, &addr1, &l, true, attrs);\n\n if (!(memory_region_is_ram(mr) ||\n memory_region_is_romd(mr))) {\n l = memory_access_size(mr, l, addr1);\n } else {\n /* ROM/RAM case */\n ram_ptr = qemu_map_ram_ptr(mr->ram_block, addr1);\n switch (type) {\n case WRITE_DATA:\n memcpy(ram_ptr, buf, l);\n invalidate_and_set_dirty(mr, addr1, l);\n break;\n case FLUSH_CACHE:\n flush_idcache_range((uintptr_t)ram_ptr, (uintptr_t)ram_ptr, l);\n break;\n }\n }\n len -= l;\n buf += l;\n addr += l;\n }\n return MEMTX_OK;\n}",
  9344. "target": 0,
  9345. "cwe": [
  9346. "CWE-908"
  9347. ],
  9348. "project": "qemu",
  9349. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9350. "hash": 113409499952132379188333851003709465197,
  9351. "size": 40,
  9352. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9353. "dataset": "other",
  9354. "idx": 514782
  9355. },
  9356. {
  9357. "func": "static MemTxResult flatview_read(FlatView *fv, hwaddr addr,\n MemTxAttrs attrs, void *buf, hwaddr len)\n{\n hwaddr l;\n hwaddr addr1;\n MemoryRegion *mr;\n\n l = len;\n mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);\n if (!flatview_access_allowed(mr, attrs, addr, len)) {\n return MEMTX_ACCESS_ERROR;\n }\n return flatview_read_continue(fv, addr, attrs, buf, len,\n addr1, l, mr);\n}",
  9358. "target": 0,
  9359. "cwe": [
  9360. "CWE-908"
  9361. ],
  9362. "project": "qemu",
  9363. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9364. "hash": 159611724233729046758076535418035210163,
  9365. "size": 15,
  9366. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9367. "dataset": "other",
  9368. "idx": 514779
  9369. },
  9370. {
  9371. "func": "static bool flatview_access_allowed(MemoryRegion *mr, MemTxAttrs attrs,\n hwaddr addr, hwaddr len)\n{\n if (likely(!attrs.memory)) {\n return true;\n }\n if (memory_region_is_ram(mr)) {\n return true;\n }\n qemu_log_mask(LOG_GUEST_ERROR,\n \"Invalid access to non-RAM device at \"\n \"addr 0x%\" HWADDR_PRIX \", size %\" HWADDR_PRIu \", \"\n \"region '%s'\\n\", addr, len, memory_region_name(mr));\n return false;\n}",
  9372. "target": 0,
  9373. "cwe": [
  9374. "CWE-908"
  9375. ],
  9376. "project": "qemu",
  9377. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9378. "hash": 78259487319584410108391883915596765157,
  9379. "size": 15,
  9380. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9381. "dataset": "other",
  9382. "idx": 514770
  9383. },
  9384. {
  9385. "func": "bool prepare_mmio_access(MemoryRegion *mr)\n{\n bool release_lock = false;\n\n if (!qemu_mutex_iothread_locked()) {\n qemu_mutex_lock_iothread();\n release_lock = true;\n }\n if (mr->flush_coalesced_mmio) {\n qemu_flush_coalesced_mmio_buffer();\n }\n\n return release_lock;\n}",
  9386. "target": 0,
  9387. "cwe": [
  9388. "CWE-908"
  9389. ],
  9390. "project": "qemu",
  9391. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9392. "hash": 263096267271380692382362820570665888790,
  9393. "size": 14,
  9394. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9395. "dataset": "other",
  9396. "idx": 514766
  9397. },
  9398. {
  9399. "func": "MemTxResult flatview_read_continue(FlatView *fv, hwaddr addr,\n MemTxAttrs attrs, void *ptr,\n hwaddr len, hwaddr addr1, hwaddr l,\n MemoryRegion *mr)\n{\n uint8_t *ram_ptr;\n uint64_t val;\n MemTxResult result = MEMTX_OK;\n bool release_lock = false;\n uint8_t *buf = ptr;\n\n fuzz_dma_read_cb(addr, len, mr);\n for (;;) {\n if (!flatview_access_allowed(mr, attrs, addr1, l)) {\n result |= MEMTX_ACCESS_ERROR;\n /* Keep going. */\n } else if (!memory_access_is_direct(mr, false)) {\n /* I/O case */\n release_lock |= prepare_mmio_access(mr);\n l = memory_access_size(mr, l, addr1);\n result |= memory_region_dispatch_read(mr, addr1, &val,\n size_memop(l), attrs);\n stn_he_p(buf, l, val);\n } else {\n /* RAM case */\n ram_ptr = qemu_ram_ptr_length(mr->ram_block, addr1, &l, false);\n memcpy(buf, ram_ptr, l);\n }\n\n if (release_lock) {\n qemu_mutex_unlock_iothread();\n release_lock = false;\n }\n\n len -= l;\n buf += l;\n addr += l;\n\n if (!len) {\n break;\n }\n\n l = len;\n mr = flatview_translate(fv, addr, &addr1, &l, false, attrs);\n }\n\n return result;\n}",
  9400. "target": 0,
  9401. "cwe": [
  9402. "CWE-908"
  9403. ],
  9404. "project": "qemu",
  9405. "commit_id": "418ade7849ce7641c0f7333718caf5091a02fd4c",
  9406. "hash": 126242774040219518758898534185243601349,
  9407. "size": 48,
  9408. "message": "softmmu: Always initialize xlat in address_space_translate_for_iotlb\n\nThe bug is an uninitialized memory read, along the translate_fail\npath, which results in garbage being read from iotlb_to_section,\nwhich can lead to a crash in io_readx/io_writex.\n\nThe bug may be fixed by writing any value with zero\nin ~TARGET_PAGE_MASK, so that the call to iotlb_to_section using\nthe xlat'ed address returns io_mem_unassigned, as desired by the\ntranslate_fail path.\n\nIt is most useful to record the original physical page address,\nwhich will eventually be logged by memory_region_access_valid\nwhen the access is rejected by unassigned_mem_accepts.\n\nResolves: https://gitlab.com/qemu-project/qemu/-/issues/1065\nSigned-off-by: Richard Henderson <richard.henderson@linaro.org>\nReviewed-by: Peter Maydell <peter.maydell@linaro.org>\nMessage-Id: <20220621153829.366423-1-richard.henderson@linaro.org>",
  9409. "dataset": "other",
  9410. "idx": 514784
  9411. }
  9412. ]
  9413. },
  9414. {
  9415. "call_depth": 4,
  9416. "longest_call_chain": [
  9417. "ntlmssp_append_target_info",
  9418. "i_zero",
  9419. "ntlmssp_append_string",
  9420. "append_string"
  9421. ],
  9422. "group_size": 12,
  9423. "functions": [
  9424. {
  9425. "func": "bool ntlmssp_check_response(const struct ntlmssp_response *response,\n\t\t\t size_t data_size, const char **error)\n{\n\tif (data_size < sizeof(struct ntlmssp_response)) {\n\t\t*error = \"response too short\";\n\t\treturn FALSE;\n\t}\n\n\tif (read_le64(&response->magic) != NTLMSSP_MAGIC) {\n\t\t*error = \"signature mismatch\";\n\t\treturn FALSE;\n\t}\n\n\tif (read_le32(&response->type) != NTLMSSP_MSG_TYPE3) {\n\t\t*error = \"message type mismatch\";\n\t\treturn FALSE;\n\t}\n\n\tif (!ntlmssp_check_buffer(&response->lm_response, data_size, error) ||\n\t !ntlmssp_check_buffer(&response->ntlm_response, data_size, error) ||\n\t !ntlmssp_check_buffer(&response->domain, data_size, error) ||\n\t !ntlmssp_check_buffer(&response->user, data_size, error) ||\n\t !ntlmssp_check_buffer(&response->workstation, data_size, error))\n\t\treturn FALSE;\n\n\treturn TRUE;\n}",
  9426. "target": 0,
  9427. "cwe": [
  9428. "CWE-125"
  9429. ],
  9430. "project": "core",
  9431. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9432. "hash": 308575781816202870018561307819992021820,
  9433. "size": 27,
  9434. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9435. "dataset": "other",
  9436. "idx": 506425
  9437. },
  9438. {
  9439. "func": "static unsigned int read_le32(const unsigned char *p)\n{\n return ((unsigned int) p[0])\n | ((unsigned int) p[1] << 8)\n | ((unsigned int) p[2] << 16)\n | ((unsigned int) p[3] << 24);\n}",
  9440. "project": "fluent-bit",
  9441. "hash": 130456446374820103303280755667404613105,
  9442. "size": 7,
  9443. "commit_id": "cadff53c093210404aed01c4cf586adb8caa07af",
  9444. "message": "gzip: fix compression size calculation (oss-fuzz 27261)\n\nSigned-off-by: davkor <david@adalogics.com>",
  9445. "target": 0,
  9446. "dataset": "other",
  9447. "idx": 417947
  9448. },
  9449. {
  9450. "func": "static void ntlmssp_append_target_info(buffer_t *buf, size_t buffer_offset, ...)\n{\n\tstruct ntlmssp_v2_target_info info;\n\tstruct ntlmssp_buffer buffer;\n\tva_list args;\n\tunsigned int length, total_length = 0;\n\tint type;\n\n\twrite_le32(&buffer.offset, buf->used);\n\n\tva_start(args, buffer_offset);\n\n\tdo {\n\t\tconst char *data;\n\t\ttype = va_arg(args, int);\n\n\t\ti_zero(&info);\n\t\twrite_le16(&info.type, type);\n\n\t\tswitch (type) {\n\t\t\tcase NTPLMSSP_V2_TARGET_END:\n\t\t\t\tbuffer_append(buf, &info, sizeof(info));\n\t\t\t\tlength = sizeof(info);\n\t\t\t\tbreak;\n\t\t\tcase NTPLMSSP_V2_TARGET_SERVER:\n\t\t\tcase NTPLMSSP_V2_TARGET_DOMAIN:\n\t\t\tcase NTPLMSSP_V2_TARGET_FQDN:\n\t\t\tcase NTPLMSSP_V2_TARGET_DNS:\n\t\t\t\tdata = va_arg(args, const char *);\n\t\t\t\twrite_le16(&info.length,\n\t\t\t\t\t strlen(data) * sizeof(ucs2le_t));\n\t\t\t\tbuffer_append(buf, &info, sizeof(info));\n\t\t\t\tlength = append_string(buf, data, FALSE, TRUE) +\n\t\t\t\t\t sizeof(info);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\ti_panic(\"Invalid NTLM target info block type \"\n\t\t\t\t\t\"%u\", type);\n\t\t}\n\n\t\ttotal_length += length;\n\t\n\t} while (type != NTPLMSSP_V2_TARGET_END);\n\n\tva_end(args);\n\n\twrite_le16(&buffer.length, total_length);\n\twrite_le16(&buffer.space, total_length);\n\tbuffer_write(buf, buffer_offset, &buffer, sizeof(buffer));\n}",
  9451. "target": 0,
  9452. "cwe": [
  9453. "CWE-125"
  9454. ],
  9455. "project": "core",
  9456. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9457. "hash": 304744503973824614610420588575244245089,
  9458. "size": 50,
  9459. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9460. "dataset": "other",
  9461. "idx": 506419
  9462. },
  9463. {
  9464. "func": "static inline uint32_t ntlmssp_flags(uint32_t client_flags)\n{\n\tuint32_t flags = NTLMSSP_NEGOTIATE_NTLM |\n\t\t\t NTLMSSP_NEGOTIATE_TARGET_INFO;\n\n\tif ((client_flags & NTLMSSP_NEGOTIATE_UNICODE) != 0)\n\t\tflags |= NTLMSSP_NEGOTIATE_UNICODE;\n\telse\n\t\tflags |= NTLMSSP_NEGOTIATE_OEM;\n\n\tif ((client_flags & NTLMSSP_NEGOTIATE_NTLM2) != 0)\n\t\tflags |= NTLMSSP_NEGOTIATE_NTLM2;\n\n\tif ((client_flags & NTLMSSP_REQUEST_TARGET) != 0)\n\t\tflags |= NTLMSSP_REQUEST_TARGET | NTLMSSP_TARGET_TYPE_SERVER;\n\n\treturn flags;\n}",
  9465. "target": 0,
  9466. "cwe": [
  9467. "CWE-125"
  9468. ],
  9469. "project": "core",
  9470. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9471. "hash": 143518257012832472132156956647676353494,
  9472. "size": 18,
  9473. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9474. "dataset": "other",
  9475. "idx": 506422
  9476. },
  9477. {
  9478. "func": "int flb_gzip_uncompress(void *in_data, size_t in_len,\n void **out_data, size_t *out_len)\n{\n int status;\n uint8_t *p;\n void *out_buf;\n size_t out_size = 0;\n void *zip_data;\n size_t zip_len;\n unsigned char flg;\n unsigned int xlen, hcrc;\n unsigned int dlen, crc;\n mz_ulong crc_out;\n mz_stream stream;\n const unsigned char *start;\n\n /* Minimal length: header + crc32 */\n if (in_len < 18) {\n flb_error(\"[gzip] unexpected content length\");\n return -1;\n }\n\n /* Magic bytes */\n p = in_data;\n if (p[0] != 0x1F || p[1] != 0x8B) {\n flb_error(\"[gzip] invalid magic bytes\");\n return -1;\n }\n\n if (p[2] != 8) {\n flb_error(\"[gzip] invalid method\");\n return -1;\n }\n\n /* Flag byte */\n flg = p[3];\n\n /* Reserved bits */\n if (flg & 0xE0) {\n flb_error(\"[gzip] invalid flag\");\n return -1;\n }\n\n /* Skip base header of 10 bytes */\n start = p + FLB_GZIP_HEADER_OFFSET;\n\n /* Skip extra data if present */\n if (flg & FEXTRA) {\n xlen = read_le16(start);\n if (xlen > in_len - 12) {\n flb_error(\"[gzip] invalid gzip data\");\n return -1;\n }\n start += xlen + 2;\n }\n\n /* Skip file name if present */\n if (flg & FNAME) {\n do {\n if (start - p >= in_len) {\n flb_error(\"[gzip] invalid gzip data (FNAME)\");\n return -1;\n }\n } while (*start++);\n }\n\n /* Skip file comment if present */\n if (flg & FCOMMENT) {\n do {\n if (start - p >= in_len) {\n flb_error(\"[gzip] invalid gzip data (FCOMMENT)\");\n return -1;\n }\n } while (*start++);\n }\n\n /* Check header crc if present */\n if (flg & FHCRC) {\n if (start - p > in_len - 2) {\n flb_error(\"[gzip] invalid gzip data (FHRC)\");\n return -1;\n }\n\n hcrc = read_le16(start);\n crc = mz_crc32(MZ_CRC32_INIT, p, start - p) & 0x0000FFFF;\n if (hcrc != crc) {\n flb_error(\"[gzip] invalid gzip header CRC\");\n return -1;\n }\n start += 2;\n }\n\n /* Get decompressed length */\n dlen = read_le32(&p[in_len - 4]);\n\n /* Get CRC32 checksum of original data */\n crc = read_le32(&p[in_len - 8]);\n\n /* Decompress data */\n if ((p + in_len) - p < 8) {\n flb_error(\"[gzip] invalid gzip CRC32 checksum\");\n return -1;\n }\n\n /* Allocate outgoing buffer */\n out_buf = flb_malloc(dlen);\n if (!out_buf) {\n flb_errno();\n return -1;\n }\n out_size = dlen;\n\n /* Map zip content */\n zip_data = (uint8_t *) start;\n zip_len = (p + in_len) - start - 8;\n\n memset(&stream, 0, sizeof(stream));\n stream.next_in = zip_data;\n stream.avail_in = zip_len;\n stream.next_out = out_buf;\n stream.avail_out = out_size;\n\n status = mz_inflateInit2(&stream, -Z_DEFAULT_WINDOW_BITS);\n if (status != MZ_OK) {\n flb_free(out_buf);\n return -1;\n }\n\n status = mz_inflate(&stream, MZ_FINISH);\n if (status != MZ_STREAM_END) {\n mz_inflateEnd(&stream);\n flb_free(out_buf);\n return -1;\n }\n\n if (stream.total_out != dlen) {\n mz_inflateEnd(&stream);\n flb_free(out_buf);\n flb_error(\"[gzip] invalid gzip data size\");\n return -1;\n }\n\n /* terminate the stream, it's not longer required */\n mz_inflateEnd(&stream);\n\n /* Validate message CRC vs inflated data CRC */\n crc_out = mz_crc32(MZ_CRC32_INIT, out_buf, dlen);\n if (crc_out != crc) {\n flb_free(out_buf);\n flb_error(\"[gzip] invalid GZip checksum (CRC32)\");\n return -1;\n }\n\n /* set the uncompressed data */\n *out_len = dlen;\n *out_data = out_buf;\n\n return 0;\n}",
  9479. "project": "fluent-bit",
  9480. "hash": 86999460491909484734595669886450493823,
  9481. "size": 159,
  9482. "commit_id": "cadff53c093210404aed01c4cf586adb8caa07af",
  9483. "message": "gzip: fix compression size calculation (oss-fuzz 27261)\n\nSigned-off-by: davkor <david@adalogics.com>",
  9484. "target": 0,
  9485. "dataset": "other",
  9486. "idx": 417951
  9487. },
  9488. {
  9489. "func": "static unsigned int append_string(buffer_t *buf, const char *str, \n\t\t\t\t bool ucase, bool unicode)\n{\n\tunsigned int length = 0;\n\n\tfor ( ; *str != '\\0'; str++) {\n\t\tbuffer_append_c(buf, ucase ? i_toupper(*str) : *str);\n\t\tif (unicode) {\n\t\t\tbuffer_append_c(buf, 0);\n\t\t\tlength++; \n\t\t}\n\t\tlength++;\n\t}\n\n\treturn length;\n}",
  9490. "target": 0,
  9491. "cwe": [
  9492. "CWE-125"
  9493. ],
  9494. "project": "core",
  9495. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9496. "hash": 270835728281084741559078096449952534504,
  9497. "size": 16,
  9498. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9499. "dataset": "other",
  9500. "idx": 506418
  9501. },
  9502. {
  9503. "func": "static bool ntlmssp_check_buffer(const struct ntlmssp_buffer *buffer,\n\t\t\t\t size_t data_size, const char **error)\n{\n\tuint32_t offset = read_le32(&buffer->offset);\n\tuint16_t length = read_le16(&buffer->length);\n\tuint16_t space = read_le16(&buffer->space);\n\n\t/* Empty buffer is ok */\n\tif (length == 0 && space == 0)\n\t\treturn TRUE;\n\n\tif (offset >= data_size) {\n\t\t*error = \"buffer offset out of bounds\";\n\t\treturn FALSE;\n\t}\n\n\tif (offset + space > data_size) {\n\t\t*error = \"buffer end out of bounds\";\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  9504. "target": 1,
  9505. "cwe": [
  9506. "CWE-125"
  9507. ],
  9508. "project": "core",
  9509. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9510. "hash": 44503422073269898902321827906643231697,
  9511. "size": 23,
  9512. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9513. "dataset": "other",
  9514. "idx": 216799
  9515. },
  9516. {
  9517. "func": "static bool ntlmssp_check_buffer(const struct ntlmssp_buffer *buffer,\n\t\t\t\t size_t data_size, const char **error)\n{\n\tuint32_t offset = read_le32(&buffer->offset);\n\tuint16_t length = read_le16(&buffer->length);\n\tuint16_t space = read_le16(&buffer->space);\n\n\t/* Empty buffer is ok */\n\tif (length == 0 && space == 0)\n\t\treturn TRUE;\n\n\tif (length > data_size) {\n\t\t*error = \"buffer length out of bounds\";\n\t\treturn FALSE;\n\t}\n\n\tif (offset >= data_size) {\n\t\t*error = \"buffer offset out of bounds\";\n\t\treturn FALSE;\n\t}\n\n\tif (offset + space > data_size) {\n\t\t*error = \"buffer end out of bounds\";\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  9518. "target": 0,
  9519. "cwe": [
  9520. "CWE-125"
  9521. ],
  9522. "project": "core",
  9523. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9524. "hash": 207567383368999279475384375671028455850,
  9525. "size": 28,
  9526. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9527. "dataset": "other",
  9528. "idx": 506421
  9529. },
  9530. {
  9531. "func": "static void ntlmssp_append_string(buffer_t *buf, size_t buffer_offset,\n\t\t\t\t const char *str, bool unicode)\n{\n\tstruct ntlmssp_buffer buffer;\n\tunsigned int length;\n\n\twrite_le32(&buffer.offset, buf->used);\n\n\tlength = append_string(buf, str, FALSE, unicode);\n\n\twrite_le16(&buffer.length, length);\n\twrite_le16(&buffer.space, length);\n\tbuffer_write(buf, buffer_offset, &buffer, sizeof(buffer));\n}",
  9532. "target": 0,
  9533. "cwe": [
  9534. "CWE-125"
  9535. ],
  9536. "project": "core",
  9537. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9538. "hash": 302108502454610039907347848030792437312,
  9539. "size": 14,
  9540. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9541. "dataset": "other",
  9542. "idx": 506420
  9543. },
  9544. {
  9545. "func": "ntlmssp_create_challenge(pool_t pool, const struct ntlmssp_request *request,\n\t\t\t size_t *size)\n{\n\tbuffer_t *buf;\n\tuint32_t flags = ntlmssp_flags(read_le32(&request->flags));\n\tbool unicode = (flags & NTLMSSP_NEGOTIATE_UNICODE) != 0;\n\tstruct ntlmssp_challenge c;\n\n\tbuf = buffer_create_dynamic(pool, sizeof(struct ntlmssp_challenge));\n\n\ti_zero(&c);\n\twrite_le64(&c.magic, NTLMSSP_MAGIC);\n\twrite_le32(&c.type, NTLMSSP_MSG_TYPE2);\n\twrite_le32(&c.flags, flags);\n\trandom_fill(c.challenge, sizeof(c.challenge));\n\n\tbuffer_write(buf, 0, &c, sizeof(c));\n\n\tif ((flags & NTLMSSP_TARGET_TYPE_SERVER) != 0)\n\t\tntlmssp_append_string(buf,\n\t\t\toffsetof(struct ntlmssp_challenge, target_name),\n\t\t\tmy_hostname, unicode);\n\n\tntlmssp_append_target_info(buf, offsetof(struct ntlmssp_challenge,\n\t\t\t\t\t\t target_info),\n\t\t\t\t NTPLMSSP_V2_TARGET_FQDN, my_hostname,\n\t\t\t\t NTPLMSSP_V2_TARGET_END);\n\n\t*size = buf->used;\n\treturn buffer_free_without_data(&buf);\n}",
  9546. "target": 0,
  9547. "cwe": [
  9548. "CWE-125"
  9549. ],
  9550. "project": "core",
  9551. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9552. "hash": 320103123546302170650251415237215051807,
  9553. "size": 31,
  9554. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9555. "dataset": "other",
  9556. "idx": 506423
  9557. },
  9558. {
  9559. "func": "static unsigned int read_le16(const unsigned char *p)\n{\n return ((unsigned int) p[0]) | ((unsigned int) p[1] << 8);\n}",
  9560. "project": "fluent-bit",
  9561. "hash": 324762848922911257424959728155920709102,
  9562. "size": 4,
  9563. "commit_id": "cadff53c093210404aed01c4cf586adb8caa07af",
  9564. "message": "gzip: fix compression size calculation (oss-fuzz 27261)\n\nSigned-off-by: davkor <david@adalogics.com>",
  9565. "target": 0,
  9566. "dataset": "other",
  9567. "idx": 417950
  9568. },
  9569. {
  9570. "func": "bool ntlmssp_check_request(const struct ntlmssp_request *request,\n\t\t\t size_t data_size, const char **error)\n{\n\tuint32_t flags;\n\n\tif (data_size < sizeof(struct ntlmssp_request)) {\n\t\t*error = \"request too short\";\n\t\treturn FALSE;\n\t}\n\n\tif (read_le64(&request->magic) != NTLMSSP_MAGIC) {\n\t\t*error = \"signature mismatch\";\n\t\treturn FALSE;\n\t}\n\n\tif (read_le32(&request->type) != NTLMSSP_MSG_TYPE1) {\n\t\t*error = \"message type mismatch\";\n\t\treturn FALSE;\n\t}\n\n\tflags = read_le32(&request->flags);\n\n\tif ((flags & NTLMSSP_NEGOTIATE_NTLM) == 0) {\n\t\t*error = \"client doesn't advertise NTLM support\";\n\t\treturn FALSE;\n\t}\n\n\treturn TRUE;\n}",
  9571. "target": 0,
  9572. "cwe": [
  9573. "CWE-125"
  9574. ],
  9575. "project": "core",
  9576. "commit_id": "fb246611e62ad8c5a95b0ca180a63f17aa34b0d8",
  9577. "hash": 259203876739144659665264532647969570099,
  9578. "size": 29,
  9579. "message": "lib-ntlm: Check buffer length on responses\n\nAdd missing check for buffer length.\n\nIf this is not checked, it is possible to send message which\ncauses read past buffer bug.\n\nBroken in c7480644202e5451fbed448508ea29a25cffc99c",
  9580. "dataset": "other",
  9581. "idx": 506424
  9582. }
  9583. ]
  9584. },
  9585. {
  9586. "call_depth": 4,
  9587. "longest_call_chain": [
  9588. "fix_and_set_name_from_value",
  9589. "fix_from_value",
  9590. "fix_charset_and_length_from_str_value",
  9591. "char_length"
  9592. ],
  9593. "group_size": 8,
  9594. "functions": [
  9595. {
  9596. "func": " void fix_charset_and_length_from_str_value(Derivation dv)\n {\n fix_charset_and_length_from_str_value(dv, Metadata(&str_value));\n }",
  9597. "target": 0,
  9598. "cwe": [
  9599. "CWE-617"
  9600. ],
  9601. "project": "server",
  9602. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9603. "hash": 154327255266273886720011309447068665016,
  9604. "size": 4,
  9605. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9606. "dataset": "other",
  9607. "idx": 509365
  9608. },
  9609. {
  9610. "func": " void fix_charset_and_length_from_str_value(Derivation dv, Metadata metadata)\n {\n /*\n We have to have a different max_length than 'length' here to\n ensure that we get the right length if we do use the item\n to create a new table. In this case max_length must be the maximum\n number of chars for a string of this type because we in Create_field::\n divide the max_length with mbmaxlen).\n */\n collation.set(str_value.charset(), dv, metadata.repertoire());\n fix_char_length(metadata.char_length());\n decimals= NOT_FIXED_DEC;\n }",
  9611. "target": 0,
  9612. "cwe": [
  9613. "CWE-617"
  9614. ],
  9615. "project": "server",
  9616. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9617. "hash": 86150775855358446446247509084940415998,
  9618. "size": 13,
  9619. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9620. "dataset": "other",
  9621. "idx": 509395
  9622. },
  9623. {
  9624. "func": " DTCollation(CHARSET_INFO *collation_arg,\n Derivation derivation_arg,\n uint repertoire_arg)\n :collation(collation_arg),\n derivation(derivation_arg),\n repertoire(repertoire_arg)\n { }",
  9625. "target": 0,
  9626. "cwe": [
  9627. "CWE-617"
  9628. ],
  9629. "project": "server",
  9630. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9631. "hash": 28332889171668248265375703857713795156,
  9632. "size": 7,
  9633. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9634. "dataset": "other",
  9635. "idx": 508937
  9636. },
  9637. {
  9638. "func": " uint repertoire() const { return MY_STRING_METADATA::repertoire; }",
  9639. "target": 0,
  9640. "cwe": [
  9641. "CWE-617"
  9642. ],
  9643. "project": "server",
  9644. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9645. "hash": 120270694217732731454200073771895596300,
  9646. "size": 1,
  9647. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9648. "dataset": "other",
  9649. "idx": 509414
  9650. },
  9651. {
  9652. "func": " size_t char_length() const { return MY_STRING_METADATA::char_length; }",
  9653. "target": 0,
  9654. "cwe": [
  9655. "CWE-617"
  9656. ],
  9657. "project": "server",
  9658. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9659. "hash": 56924974304726318879916470792753787357,
  9660. "size": 1,
  9661. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9662. "dataset": "other",
  9663. "idx": 508931
  9664. },
  9665. {
  9666. "func": " void fix_and_set_name_from_value(THD *thd, Derivation dv,\n const Metadata metadata)\n {\n fix_from_value(dv, metadata);\n set_name(thd, str_value.ptr(), str_value.length(), str_value.charset());\n }",
  9667. "target": 0,
  9668. "cwe": [
  9669. "CWE-617"
  9670. ],
  9671. "project": "server",
  9672. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9673. "hash": 145223923482690028166112356840311921502,
  9674. "size": 6,
  9675. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9676. "dataset": "other",
  9677. "idx": 509321
  9678. },
  9679. {
  9680. "func": " void fix_char_length(size_t max_char_length_arg)\n {\n max_length= char_to_byte_length_safe(max_char_length_arg,\n collation.collation->mbmaxlen);\n }",
  9681. "target": 0,
  9682. "cwe": [
  9683. "CWE-617"
  9684. ],
  9685. "project": "server",
  9686. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9687. "hash": 128055378885442712357673431363026385823,
  9688. "size": 5,
  9689. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9690. "dataset": "other",
  9691. "idx": 509276
  9692. },
  9693. {
  9694. "func": " void fix_from_value(Derivation dv, const Metadata metadata)\n {\n fix_charset_and_length_from_str_value(dv, metadata);\n // it is constant => can be used without fix_fields (and frequently used)\n fixed= 1;\n }",
  9695. "target": 0,
  9696. "cwe": [
  9697. "CWE-617"
  9698. ],
  9699. "project": "server",
  9700. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  9701. "hash": 165902672546454000048602381389207469936,
  9702. "size": 6,
  9703. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  9704. "dataset": "other",
  9705. "idx": 509014
  9706. }
  9707. ]
  9708. },
  9709. {
  9710. "call_depth": 3,
  9711. "longest_call_chain": [
  9712. "vmf_insert_pfn_pud_prot",
  9713. "insert_pfn_pud",
  9714. "maybe_pud_mkwrite"
  9715. ],
  9716. "group_size": 3,
  9717. "functions": [
  9718. {
  9719. "func": "vm_fault_t vmf_insert_pfn_pud_prot(struct vm_fault *vmf, pfn_t pfn,\n\t\t\t\t pgprot_t pgprot, bool write)\n{\n\tunsigned long addr = vmf->address & PUD_MASK;\n\tstruct vm_area_struct *vma = vmf->vma;\n\n\t/*\n\t * If we had pud_special, we could avoid all these restrictions,\n\t * but we need to be consistent with PTEs and architectures that\n\t * can't support a 'special' bit.\n\t */\n\tBUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) &&\n\t\t\t!pfn_t_devmap(pfn));\n\tBUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) ==\n\t\t\t\t\t\t(VM_PFNMAP|VM_MIXEDMAP));\n\tBUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags));\n\n\tif (addr < vma->vm_start || addr >= vma->vm_end)\n\t\treturn VM_FAULT_SIGBUS;\n\n\ttrack_pfn_insert(vma, &pgprot, pfn);\n\n\tinsert_pfn_pud(vma, addr, vmf->pud, pfn, pgprot, write);\n\treturn VM_FAULT_NOPAGE;\n}",
  9720. "project": "linux",
  9721. "hash": 209157331707782529198757520996980655520,
  9722. "size": 25,
  9723. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  9724. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  9725. "target": 0,
  9726. "dataset": "other",
  9727. "idx": 364155
  9728. },
  9729. {
  9730. "func": "static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr,\n\t\tpud_t *pud, pfn_t pfn, pgprot_t prot, bool write)\n{\n\tstruct mm_struct *mm = vma->vm_mm;\n\tpud_t entry;\n\tspinlock_t *ptl;\n\n\tptl = pud_lock(mm, pud);\n\tif (!pud_none(*pud)) {\n\t\tif (write) {\n\t\t\tif (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) {\n\t\t\t\tWARN_ON_ONCE(!is_huge_zero_pud(*pud));\n\t\t\t\tgoto out_unlock;\n\t\t\t}\n\t\t\tentry = pud_mkyoung(*pud);\n\t\t\tentry = maybe_pud_mkwrite(pud_mkdirty(entry), vma);\n\t\t\tif (pudp_set_access_flags(vma, addr, pud, entry, 1))\n\t\t\t\tupdate_mmu_cache_pud(vma, addr, pud);\n\t\t}\n\t\tgoto out_unlock;\n\t}\n\n\tentry = pud_mkhuge(pfn_t_pud(pfn, prot));\n\tif (pfn_t_devmap(pfn))\n\t\tentry = pud_mkdevmap(entry);\n\tif (write) {\n\t\tentry = pud_mkyoung(pud_mkdirty(entry));\n\t\tentry = maybe_pud_mkwrite(entry, vma);\n\t}\n\tset_pud_at(mm, addr, pud, entry);\n\tupdate_mmu_cache_pud(vma, addr, pud);\n\nout_unlock:\n\tspin_unlock(ptl);\n}",
  9731. "project": "linux",
  9732. "hash": 173034307180225157472608885308363813534,
  9733. "size": 35,
  9734. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  9735. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  9736. "target": 0,
  9737. "dataset": "other",
  9738. "idx": 364196
  9739. },
  9740. {
  9741. "func": "static pud_t maybe_pud_mkwrite(pud_t pud, struct vm_area_struct *vma)\n{\n\tif (likely(vma->vm_flags & VM_WRITE))\n\t\tpud = pud_mkwrite(pud);\n\treturn pud;\n}",
  9742. "project": "linux",
  9743. "hash": 5567300536024320700807929861113141006,
  9744. "size": 6,
  9745. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  9746. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  9747. "target": 0,
  9748. "dataset": "other",
  9749. "idx": 364204
  9750. }
  9751. ]
  9752. },
  9753. {
  9754. "call_depth": 3,
  9755. "longest_call_chain": [
  9756. "soap_xmlParseFile",
  9757. "cleanup_xml_node",
  9758. "is_blank"
  9759. ],
  9760. "group_size": 4,
  9761. "functions": [
  9762. {
  9763. "func": "static void cleanup_xml_node(xmlNodePtr node)\n{\n\txmlNodePtr trav;\n\txmlNodePtr del = NULL;\n\n\ttrav = node->children;\n\twhile (trav != NULL) {\n\t\tif (del != NULL) {\n\t\t\txmlUnlinkNode(del);\n\t\t\txmlFreeNode(del);\n\t\t\tdel = NULL;\n\t\t}\n\t\tif (trav->type == XML_TEXT_NODE) {\n\t\t\tif (is_blank(trav->content)) {\n\t\t\t\tdel = trav;\n\t\t\t}\n\t\t} else if ((trav->type != XML_ELEMENT_NODE) &&\n\t\t (trav->type != XML_CDATA_SECTION_NODE)) {\n\t\t\tdel = trav;\n\t\t} else if (trav->children != NULL) {\n\t\t\tcleanup_xml_node(trav);\n\t\t}\n\t\ttrav = trav->next;\n\t}\n\tif (del != NULL) {\n\t\txmlUnlinkNode(del);\n\t\txmlFreeNode(del);\n\t}\n}",
  9764. "project": "php-src",
  9765. "hash": 336831823560269625055179690903166043585,
  9766. "size": 29,
  9767. "commit_id": "fcd4b5335a6df4e0676ee32e2267ca71d70fe623",
  9768. "message": "Fix TSRM (after afc1debb)",
  9769. "target": 0,
  9770. "dataset": "other",
  9771. "idx": 285584
  9772. },
  9773. {
  9774. "func": "static int is_blank(const xmlChar* str)\n{\n\twhile (*str != '\\0') {\n\t\tif (*str != ' ' && *str != 0x9 && *str != 0xa && *str != 0xd) {\n\t\t\treturn 0;\n\t\t}\n\t\tstr++;\n\t}\n\treturn 1;\n}",
  9775. "project": "php-src",
  9776. "hash": 255186597252804202024117709233117773393,
  9777. "size": 10,
  9778. "commit_id": "fcd4b5335a6df4e0676ee32e2267ca71d70fe623",
  9779. "message": "Fix TSRM (after afc1debb)",
  9780. "target": 0,
  9781. "dataset": "other",
  9782. "idx": 285590
  9783. },
  9784. {
  9785. "func": "xmlDocPtr soap_xmlParseFile(const char *filename TSRMLS_DC)\n{\n\txmlParserCtxtPtr ctxt = NULL;\n\txmlDocPtr ret;\n\tzend_bool old_allow_url_fopen;\n\n/*\n\txmlInitParser();\n*/\n\n\told_allow_url_fopen = PG(allow_url_fopen);\n\tPG(allow_url_fopen) = 1;\n\tctxt = xmlCreateFileParserCtxt(filename);\n\tPG(allow_url_fopen) = old_allow_url_fopen;\n\tif (ctxt) {\n\t\tzend_bool old;\n\n\t\tctxt->keepBlanks = 0;\n\t\tctxt->sax->ignorableWhitespace = soap_ignorableWhitespace;\n\t\tctxt->sax->comment = soap_Comment;\n\t\tctxt->sax->warning = NULL;\n\t\tctxt->sax->error = NULL;\n\t\t/*ctxt->sax->fatalError = NULL;*/\n\t\told = php_libxml_disable_entity_loader(1);\n\t\txmlParseDocument(ctxt);\n\t\tphp_libxml_disable_entity_loader(old);\n\t\tif (ctxt->wellFormed) {\n\t\t\tret = ctxt->myDoc;\n\t\t\tif (ret->URL == NULL && ctxt->directory != NULL) {\n\t\t\t\tret->URL = xmlCharStrdup(ctxt->directory);\n\t\t\t}\n\t\t} else {\n\t\t\tret = NULL;\n\t\t\txmlFreeDoc(ctxt->myDoc);\n\t\t\tctxt->myDoc = NULL;\n\t\t}\n\t\txmlFreeParserCtxt(ctxt);\n\t} else {\n\t\tret = NULL;\n\t}\n\n/*\n\txmlCleanupParser();\n*/\n\n\tif (ret) {\n\t\tcleanup_xml_node((xmlNodePtr)ret);\n\t}\n\treturn ret;\n}",
  9786. "project": "php-src",
  9787. "hash": 149172573949708914156035129804477784284,
  9788. "size": 50,
  9789. "commit_id": "fcd4b5335a6df4e0676ee32e2267ca71d70fe623",
  9790. "message": "Fix TSRM (after afc1debb)",
  9791. "target": 1,
  9792. "dataset": "other",
  9793. "idx": 198943
  9794. },
  9795. {
  9796. "func": "xmlDocPtr soap_xmlParseFile(const char *filename TSRMLS_DC)\n{\n\txmlParserCtxtPtr ctxt = NULL;\n\txmlDocPtr ret;\n\tzend_bool old_allow_url_fopen;\n\n/*\n\txmlInitParser();\n*/\n\n\told_allow_url_fopen = PG(allow_url_fopen);\n\tPG(allow_url_fopen) = 1;\n\tctxt = xmlCreateFileParserCtxt(filename);\n\tPG(allow_url_fopen) = old_allow_url_fopen;\n\tif (ctxt) {\n\t\tzend_bool old;\n\n\t\tctxt->keepBlanks = 0;\n\t\tctxt->sax->ignorableWhitespace = soap_ignorableWhitespace;\n\t\tctxt->sax->comment = soap_Comment;\n\t\tctxt->sax->warning = NULL;\n\t\tctxt->sax->error = NULL;\n\t\t/*ctxt->sax->fatalError = NULL;*/\n\t\told = php_libxml_disable_entity_loader(1 TSRMLS_CC);\n\t\txmlParseDocument(ctxt);\n\t\tphp_libxml_disable_entity_loader(old TSRMLS_CC);\n\t\tif (ctxt->wellFormed) {\n\t\t\tret = ctxt->myDoc;\n\t\t\tif (ret->URL == NULL && ctxt->directory != NULL) {\n\t\t\t\tret->URL = xmlCharStrdup(ctxt->directory);\n\t\t\t}\n\t\t} else {\n\t\t\tret = NULL;\n\t\t\txmlFreeDoc(ctxt->myDoc);\n\t\t\tctxt->myDoc = NULL;\n\t\t}\n\t\txmlFreeParserCtxt(ctxt);\n\t} else {\n\t\tret = NULL;\n\t}\n\n/*\n\txmlCleanupParser();\n*/\n\n\tif (ret) {\n\t\tcleanup_xml_node((xmlNodePtr)ret);\n\t}\n\treturn ret;\n}",
  9797. "project": "php-src",
  9798. "hash": 81104495453836081457129860350581051957,
  9799. "size": 50,
  9800. "commit_id": "fcd4b5335a6df4e0676ee32e2267ca71d70fe623",
  9801. "message": "Fix TSRM (after afc1debb)",
  9802. "target": 0,
  9803. "dataset": "other",
  9804. "idx": 285598
  9805. }
  9806. ]
  9807. },
  9808. {
  9809. "call_depth": 3,
  9810. "longest_call_chain": [
  9811. "ssh_bind_accept",
  9812. "ssh_bind_accept_fd",
  9813. "ssh_bind_import_keys"
  9814. ],
  9815. "group_size": 8,
  9816. "functions": [
  9817. {
  9818. "func": "static int ssh_bind_import_keys(ssh_bind sshbind) {\n int rc;\n\n if (sshbind->ecdsakey == NULL &&\n sshbind->dsakey == NULL &&\n sshbind->rsakey == NULL) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"ECDSA, DSA, or RSA host key file must be set\");\n return SSH_ERROR;\n }\n\n#ifdef HAVE_ECC\n if (sshbind->ecdsa == NULL && sshbind->ecdsakey != NULL) {\n rc = ssh_pki_import_privkey_file(sshbind->ecdsakey,\n NULL,\n NULL,\n NULL,\n &sshbind->ecdsa);\n if (rc == SSH_ERROR || rc == SSH_EOF) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"Failed to import private ECDSA host key\");\n return SSH_ERROR;\n }\n\n if (ssh_key_type(sshbind->ecdsa) != SSH_KEYTYPE_ECDSA) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"The ECDSA host key has the wrong type\");\n ssh_key_free(sshbind->ecdsa);\n sshbind->ecdsa = NULL;\n return SSH_ERROR;\n }\n }\n#endif\n\n if (sshbind->dsa == NULL && sshbind->dsakey != NULL) {\n rc = ssh_pki_import_privkey_file(sshbind->dsakey,\n NULL,\n NULL,\n NULL,\n &sshbind->dsa);\n if (rc == SSH_ERROR || rc == SSH_EOF) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"Failed to import private DSA host key\");\n return SSH_ERROR;\n }\n\n if (ssh_key_type(sshbind->dsa) != SSH_KEYTYPE_DSS) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"The DSA host key has the wrong type: %d\",\n ssh_key_type(sshbind->dsa));\n ssh_key_free(sshbind->dsa);\n sshbind->dsa = NULL;\n return SSH_ERROR;\n }\n }\n\n if (sshbind->rsa == NULL && sshbind->rsakey != NULL) {\n rc = ssh_pki_import_privkey_file(sshbind->rsakey,\n NULL,\n NULL,\n NULL,\n &sshbind->rsa);\n if (rc == SSH_ERROR || rc == SSH_EOF) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"Failed to import private RSA host key\");\n return SSH_ERROR;\n }\n\n if (ssh_key_type(sshbind->rsa) != SSH_KEYTYPE_RSA &&\n ssh_key_type(sshbind->rsa) != SSH_KEYTYPE_RSA1) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"The RSA host key has the wrong type\");\n ssh_key_free(sshbind->rsa);\n sshbind->rsa = NULL;\n return SSH_ERROR;\n }\n }\n\n return SSH_OK;\n}",
  9819. "target": 0,
  9820. "cwe": [
  9821. "CWE-310"
  9822. ],
  9823. "project": "libssh",
  9824. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9825. "hash": 135131792960307994107176415297779068866,
  9826. "size": 80,
  9827. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9828. "dataset": "other",
  9829. "idx": 497582
  9830. },
  9831. {
  9832. "func": "static socket_t bind_socket(ssh_bind sshbind, const char *hostname,\n int port) {\n char port_c[6];\n struct addrinfo *ai;\n struct addrinfo hints;\n int opt = 1;\n socket_t s;\n int rc;\n\n ZERO_STRUCT(hints);\n\n hints.ai_flags = AI_PASSIVE;\n hints.ai_socktype = SOCK_STREAM;\n\n snprintf(port_c, 6, \"%d\", port);\n rc = getaddrinfo(hostname, port_c, &hints, &ai);\n if (rc != 0) {\n ssh_set_error(sshbind,\n SSH_FATAL,\n \"Resolving %s: %s\", hostname, gai_strerror(rc));\n return -1;\n }\n\n s = socket (ai->ai_family,\n ai->ai_socktype,\n ai->ai_protocol);\n if (s == SSH_INVALID_SOCKET) {\n ssh_set_error(sshbind, SSH_FATAL, \"%s\", strerror(errno));\n freeaddrinfo (ai);\n return -1;\n }\n\n if (setsockopt(s, SOL_SOCKET, SO_REUSEADDR,\n (char *)&opt, sizeof(opt)) < 0) {\n ssh_set_error(sshbind,\n SSH_FATAL,\n \"Setting socket options failed: %s\",\n strerror(errno));\n freeaddrinfo (ai);\n close(s);\n return -1;\n }\n\n if (bind(s, ai->ai_addr, ai->ai_addrlen) != 0) {\n ssh_set_error(sshbind,\n SSH_FATAL,\n \"Binding to %s:%d: %s\",\n hostname,\n port,\n strerror(errno));\n freeaddrinfo (ai);\n close(s);\n return -1;\n }\n\n freeaddrinfo (ai);\n return s;\n}",
  9833. "target": 0,
  9834. "cwe": [
  9835. "CWE-310"
  9836. ],
  9837. "project": "libssh",
  9838. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9839. "hash": 173339869333689413947099578402182230467,
  9840. "size": 58,
  9841. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9842. "dataset": "other",
  9843. "idx": 497571
  9844. },
  9845. {
  9846. "func": "int ssh_bind_listen(ssh_bind sshbind) {\n const char *host;\n socket_t fd;\n int rc;\n\n if (ssh_init() < 0) {\n ssh_set_error(sshbind, SSH_FATAL, \"ssh_init() failed\");\n return -1;\n }\n\n rc = ssh_bind_import_keys(sshbind);\n if (rc != SSH_OK) {\n return SSH_ERROR;\n }\n\n if (sshbind->bindfd == SSH_INVALID_SOCKET) {\n host = sshbind->bindaddr;\n if (host == NULL) {\n host = \"0.0.0.0\";\n }\n\n fd = bind_socket(sshbind, host, sshbind->bindport);\n if (fd == SSH_INVALID_SOCKET) {\n ssh_key_free(sshbind->dsa);\n sshbind->dsa = NULL;\n ssh_key_free(sshbind->rsa);\n sshbind->rsa = NULL;\n return -1;\n }\n sshbind->bindfd = fd;\n\n if (listen(fd, 10) < 0) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"Listening to socket %d: %s\",\n fd, strerror(errno));\n close(fd);\n ssh_key_free(sshbind->dsa);\n sshbind->dsa = NULL;\n ssh_key_free(sshbind->rsa);\n sshbind->rsa = NULL;\n return -1;\n }\n } else {\n SSH_LOG(SSH_LOG_INFO, \"Using app-provided bind socket\");\n }\n return 0;\n}",
  9847. "target": 0,
  9848. "cwe": [
  9849. "CWE-310"
  9850. ],
  9851. "project": "libssh",
  9852. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9853. "hash": 64414208037938162023631478119560321020,
  9854. "size": 47,
  9855. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9856. "dataset": "other",
  9857. "idx": 497585
  9858. },
  9859. {
  9860. "func": "int ssh_bind_accept(ssh_bind sshbind, ssh_session session) {\n socket_t fd = SSH_INVALID_SOCKET;\n int rc;\n if (sshbind->bindfd == SSH_INVALID_SOCKET) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"Can't accept new clients on a not bound socket.\");\n return SSH_ERROR;\n }\n\n if (session == NULL){\n ssh_set_error(sshbind, SSH_FATAL,\"session is null\");\n return SSH_ERROR;\n }\n\n fd = accept(sshbind->bindfd, NULL, NULL);\n if (fd == SSH_INVALID_SOCKET) {\n ssh_set_error(sshbind, SSH_FATAL,\n \"Accepting a new connection: %s\",\n strerror(errno));\n return SSH_ERROR;\n }\n rc = ssh_bind_accept_fd(sshbind, session, fd);\n\n if(rc == SSH_ERROR){\n#ifdef _WIN32\n closesocket(fd);\n#else\n close(fd);\n#endif\n ssh_socket_free(session->socket);\n }\n return rc;\n}",
  9861. "target": 0,
  9862. "cwe": [
  9863. "CWE-310"
  9864. ],
  9865. "project": "libssh",
  9866. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9867. "hash": 291515228790407961465346476453129936868,
  9868. "size": 33,
  9869. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9870. "dataset": "other",
  9871. "idx": 497611
  9872. },
  9873. {
  9874. "func": "void ssh_reseed(void){\n struct timeval tv;\n gettimeofday(&tv, NULL);\n RAND_add(&tv, sizeof(tv), 0.0);\n}",
  9875. "target": 0,
  9876. "cwe": [
  9877. "CWE-310"
  9878. ],
  9879. "project": "libssh",
  9880. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9881. "hash": 305542695176359193849183352525571486978,
  9882. "size": 5,
  9883. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9884. "dataset": "other",
  9885. "idx": 497607
  9886. },
  9887. {
  9888. "func": "void ssh_reseed(void){\n\t}",
  9889. "target": 0,
  9890. "cwe": [
  9891. "CWE-310"
  9892. ],
  9893. "project": "libssh",
  9894. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9895. "hash": 291255402854087085271531697813318542559,
  9896. "size": 2,
  9897. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9898. "dataset": "other",
  9899. "idx": 497608
  9900. },
  9901. {
  9902. "func": "int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd){\n int i, rc;\n\n if (session == NULL){\n ssh_set_error(sshbind, SSH_FATAL,\"session is null\");\n return SSH_ERROR;\n }\n\n session->server = 1;\n session->version = 2;\n\n /* copy options */\n for (i = 0; i < 10; ++i) {\n if (sshbind->wanted_methods[i]) {\n session->opts.wanted_methods[i] = strdup(sshbind->wanted_methods[i]);\n if (session->opts.wanted_methods[i] == NULL) {\n return SSH_ERROR;\n }\n }\n }\n\n if (sshbind->bindaddr == NULL)\n session->opts.bindaddr = NULL;\n else {\n SAFE_FREE(session->opts.bindaddr);\n session->opts.bindaddr = strdup(sshbind->bindaddr);\n if (session->opts.bindaddr == NULL) {\n return SSH_ERROR;\n }\n }\n\n session->common.log_verbosity = sshbind->common.log_verbosity;\n if(sshbind->banner != NULL)\n \tsession->opts.custombanner = strdup(sshbind->banner);\n ssh_socket_free(session->socket);\n session->socket = ssh_socket_new(session);\n if (session->socket == NULL) {\n /* perhaps it may be better to copy the error from session to sshbind */\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n ssh_socket_set_fd(session->socket, fd);\n ssh_socket_get_poll_handle_out(session->socket);\n\n /* We must try to import any keys that could be imported in case\n * we are not using ssh_bind_listen (which is the other place\n * where keys can be imported) on this ssh_bind and are instead\n * only using ssh_bind_accept_fd to manage sockets ourselves.\n */\n rc = ssh_bind_import_keys(sshbind);\n if (rc != SSH_OK) {\n return SSH_ERROR;\n }\n\n#ifdef HAVE_ECC\n if (sshbind->ecdsa) {\n session->srv.ecdsa_key = ssh_key_dup(sshbind->ecdsa);\n if (session->srv.ecdsa_key == NULL) {\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n }\n#endif\n if (sshbind->dsa) {\n session->srv.dsa_key = ssh_key_dup(sshbind->dsa);\n if (session->srv.dsa_key == NULL) {\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n }\n if (sshbind->rsa) {\n session->srv.rsa_key = ssh_key_dup(sshbind->rsa);\n if (session->srv.rsa_key == NULL) {\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n }\n return SSH_OK;\n}",
  9903. "target": 1,
  9904. "cwe": [
  9905. "CWE-310"
  9906. ],
  9907. "project": "libssh",
  9908. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9909. "hash": 155342663606614956692829213292082664878,
  9910. "size": 79,
  9911. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9912. "dataset": "other",
  9913. "idx": 215904
  9914. },
  9915. {
  9916. "func": "int ssh_bind_accept_fd(ssh_bind sshbind, ssh_session session, socket_t fd){\n int i, rc;\n\n if (session == NULL){\n ssh_set_error(sshbind, SSH_FATAL,\"session is null\");\n return SSH_ERROR;\n }\n\n session->server = 1;\n session->version = 2;\n\n /* copy options */\n for (i = 0; i < 10; ++i) {\n if (sshbind->wanted_methods[i]) {\n session->opts.wanted_methods[i] = strdup(sshbind->wanted_methods[i]);\n if (session->opts.wanted_methods[i] == NULL) {\n return SSH_ERROR;\n }\n }\n }\n\n if (sshbind->bindaddr == NULL)\n session->opts.bindaddr = NULL;\n else {\n SAFE_FREE(session->opts.bindaddr);\n session->opts.bindaddr = strdup(sshbind->bindaddr);\n if (session->opts.bindaddr == NULL) {\n return SSH_ERROR;\n }\n }\n\n session->common.log_verbosity = sshbind->common.log_verbosity;\n if(sshbind->banner != NULL)\n \tsession->opts.custombanner = strdup(sshbind->banner);\n ssh_socket_free(session->socket);\n session->socket = ssh_socket_new(session);\n if (session->socket == NULL) {\n /* perhaps it may be better to copy the error from session to sshbind */\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n ssh_socket_set_fd(session->socket, fd);\n ssh_socket_get_poll_handle_out(session->socket);\n\n /* We must try to import any keys that could be imported in case\n * we are not using ssh_bind_listen (which is the other place\n * where keys can be imported) on this ssh_bind and are instead\n * only using ssh_bind_accept_fd to manage sockets ourselves.\n */\n rc = ssh_bind_import_keys(sshbind);\n if (rc != SSH_OK) {\n return SSH_ERROR;\n }\n\n#ifdef HAVE_ECC\n if (sshbind->ecdsa) {\n session->srv.ecdsa_key = ssh_key_dup(sshbind->ecdsa);\n if (session->srv.ecdsa_key == NULL) {\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n }\n#endif\n if (sshbind->dsa) {\n session->srv.dsa_key = ssh_key_dup(sshbind->dsa);\n if (session->srv.dsa_key == NULL) {\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n }\n if (sshbind->rsa) {\n session->srv.rsa_key = ssh_key_dup(sshbind->rsa);\n if (session->srv.rsa_key == NULL) {\n ssh_set_error_oom(sshbind);\n return SSH_ERROR;\n }\n }\n /* force PRNG to change state in case we fork after ssh_bind_accept */\n ssh_reseed();\n return SSH_OK;\n}",
  9917. "target": 0,
  9918. "cwe": [
  9919. "CWE-310"
  9920. ],
  9921. "project": "libssh",
  9922. "commit_id": "e99246246b4061f7e71463f8806b9dcad65affa0",
  9923. "hash": 50685877395540749769671536212771341726,
  9924. "size": 81,
  9925. "message": "security: fix for vulnerability CVE-2014-0017\n\nWhen accepting a new connection, a forking server based on libssh forks\nand the child process handles the request. The RAND_bytes() function of\nopenssl doesn't reset its state after the fork, but simply adds the\ncurrent process id (getpid) to the PRNG state, which is not guaranteed\nto be unique.\nThis can cause several children to end up with same PRNG state which is\na security issue.",
  9926. "dataset": "other",
  9927. "idx": 497609
  9928. }
  9929. ]
  9930. },
  9931. {
  9932. "call_depth": 4,
  9933. "longest_call_chain": [
  9934. "ares_getaddrinfo",
  9935. "next_lookup",
  9936. "next_dns_lookup",
  9937. "as_is_first"
  9938. ],
  9939. "group_size": 11,
  9940. "functions": [
  9941. {
  9942. "func": "static int as_is_first(const struct host_query* hquery)\n{\n char* p;\n int ndots = 0;\n for (p = hquery->name; *p; p++)\n {\n if (*p == '.')\n {\n ndots++;\n }\n }\n return ndots >= hquery->channel->ndots;\n}",
  9943. "project": "c-ares",
  9944. "hash": 237346194066420551353335228895255001524,
  9945. "size": 13,
  9946. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  9947. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  9948. "target": 0,
  9949. "dataset": "other",
  9950. "idx": 478390
  9951. },
  9952. {
  9953. "func": "struct ares_addrinfo_node *ares__malloc_addrinfo_node()\n{\n struct ares_addrinfo_node *node =\n ares_malloc(sizeof(struct ares_addrinfo_node));\n if (!node)\n return NULL;\n\n *node = empty_addrinfo_node;\n return node;\n}",
  9954. "project": "c-ares",
  9955. "hash": 331518379725729988919523964971797931276,
  9956. "size": 10,
  9957. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  9958. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  9959. "target": 0,
  9960. "dataset": "other",
  9961. "idx": 478401
  9962. },
  9963. {
  9964. "func": "static void next_lookup(struct host_query *hquery, int status)\n{\n switch (*hquery->remaining_lookups)\n {\n case 'b':\n /* DNS lookup */\n if (next_dns_lookup(hquery))\n break;\n hquery->remaining_lookups++;\n next_lookup(hquery, status);\n break;\n\n case 'f':\n /* Host file lookup */\n if (file_lookup(hquery) == ARES_SUCCESS)\n {\n end_hquery(hquery, ARES_SUCCESS);\n break;\n }\n hquery->remaining_lookups++;\n next_lookup(hquery, status);\n break;\n default:\n /* No lookup left */\n end_hquery(hquery, status);\n break;\n }\n}",
  9965. "project": "c-ares",
  9966. "hash": 249579464914117560189654227896029669445,
  9967. "size": 28,
  9968. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  9969. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  9970. "target": 0,
  9971. "dataset": "other",
  9972. "idx": 478393
  9973. },
  9974. {
  9975. "func": "static unsigned short lookup_service(const char *service, int flags)\n{\n const char *proto;\n struct servent *sep;\n#ifdef HAVE_GETSERVBYNAME_R\n struct servent se;\n char tmpbuf[4096];\n#endif\n\n if (service)\n {\n if (flags & ARES_NI_UDP)\n proto = \"udp\";\n else if (flags & ARES_NI_SCTP)\n proto = \"sctp\";\n else if (flags & ARES_NI_DCCP)\n proto = \"dccp\";\n else\n proto = \"tcp\";\n#ifdef HAVE_GETSERVBYNAME_R\n memset(&se, 0, sizeof(se));\n sep = &se;\n memset(tmpbuf, 0, sizeof(tmpbuf));\n#if GETSERVBYNAME_R_ARGS == 6\n if (getservbyname_r(service, proto, &se, (void *)tmpbuf, sizeof(tmpbuf),\n &sep) != 0)\n sep = NULL; /* LCOV_EXCL_LINE: buffer large so this never fails */\n#elif GETSERVBYNAME_R_ARGS == 5\n sep =\n getservbyname_r(service, proto, &se, (void *)tmpbuf, sizeof(tmpbuf));\n#elif GETSERVBYNAME_R_ARGS == 4\n if (getservbyname_r(service, proto, &se, (void *)tmpbuf) != 0)\n sep = NULL;\n#else\n /* Lets just hope the OS uses TLS! */\n sep = getservbyname(service, proto);\n#endif\n#else\n /* Lets just hope the OS uses TLS! */\n#if (defined(NETWARE) && !defined(__NOVELL_LIBC__))\n sep = getservbyname(service, (char *)proto);\n#else\n sep = getservbyname(service, proto);\n#endif\n#endif\n return (sep ? ntohs((unsigned short)sep->s_port) : 0);\n }\n return 0;\n}",
  9976. "project": "c-ares",
  9977. "hash": 200609651790992095530661424133344557133,
  9978. "size": 49,
  9979. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  9980. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  9981. "target": 0,
  9982. "dataset": "other",
  9983. "idx": 478400
  9984. },
  9985. {
  9986. "func": "static void host_callback(void *arg, int status, int timeouts,\n unsigned char *abuf, int alen)\n{\n struct host_query *hquery = (struct host_query*)arg;\n int addinfostatus = ARES_SUCCESS;\n hquery->timeouts += timeouts;\n hquery->remaining--;\n\n if (status == ARES_SUCCESS)\n {\n addinfostatus = ares__parse_into_addrinfo(abuf, alen, hquery->ai);\n }\n else if (status == ARES_EDESTRUCTION)\n {\n end_hquery(hquery, status);\n }\n\n if (!hquery->remaining)\n {\n if (addinfostatus != ARES_SUCCESS)\n {\n /* error in parsing result e.g. no memory */\n end_hquery(hquery, addinfostatus);\n }\n else if (hquery->ai->nodes)\n {\n /* at least one query ended with ARES_SUCCESS */\n end_hquery(hquery, ARES_SUCCESS);\n }\n else if (status == ARES_ENOTFOUND)\n {\n next_lookup(hquery, status);\n }\n else\n {\n end_hquery(hquery, status);\n }\n }\n\n /* at this point we keep on waiting for the next query to finish */\n}",
  9987. "project": "c-ares",
  9988. "hash": 338428520293637615587127648198461687166,
  9989. "size": 41,
  9990. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  9991. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  9992. "target": 1,
  9993. "dataset": "other",
  9994. "idx": 214405
  9995. },
  9996. {
  9997. "func": "static void host_callback(void *arg, int status, int timeouts,\n unsigned char *abuf, int alen)\n{\n struct host_query *hquery = (struct host_query*)arg;\n int addinfostatus = ARES_SUCCESS;\n hquery->timeouts += timeouts;\n hquery->remaining--;\n\n if (status == ARES_SUCCESS)\n {\n addinfostatus = ares__parse_into_addrinfo(abuf, alen, hquery->ai);\n }\n else if (status == ARES_EDESTRUCTION)\n {\n end_hquery(hquery, status);\n return;\n }\n\n if (!hquery->remaining)\n {\n if (addinfostatus != ARES_SUCCESS)\n {\n /* error in parsing result e.g. no memory */\n end_hquery(hquery, addinfostatus);\n }\n else if (hquery->ai->nodes)\n {\n /* at least one query ended with ARES_SUCCESS */\n end_hquery(hquery, ARES_SUCCESS);\n }\n else if (status == ARES_ENOTFOUND)\n {\n next_lookup(hquery, status);\n }\n else\n {\n end_hquery(hquery, status);\n }\n }\n\n /* at this point we keep on waiting for the next query to finish */\n}",
  9998. "project": "c-ares",
  9999. "hash": 65112642692504141750909294658666282062,
  10000. "size": 42,
  10001. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  10002. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  10003. "target": 0,
  10004. "dataset": "other",
  10005. "idx": 478396
  10006. },
  10007. {
  10008. "func": "static int fake_addrinfo(const char *name,\n unsigned short port,\n const struct ares_addrinfo_hints *hints,\n struct ares_addrinfo *ai,\n ares_addrinfo_callback callback,\n void *arg)\n{\n struct ares_addrinfo_cname *cname;\n struct ares_addrinfo_node *node;\n ares_sockaddr addr;\n size_t addrlen;\n int result = 0;\n int family = hints->ai_family;\n if (family == AF_INET || family == AF_INET6 || family == AF_UNSPEC)\n {\n /* It only looks like an IP address if it's all numbers and dots. */\n int numdots = 0, valid = 1;\n const char *p;\n for (p = name; *p; p++)\n {\n if (!ISDIGIT(*p) && *p != '.')\n {\n valid = 0;\n break;\n }\n else if (*p == '.')\n {\n numdots++;\n }\n }\n\n memset(&addr, 0, sizeof(addr));\n\n /* if we don't have 3 dots, it is illegal\n * (although inet_pton doesn't think so).\n */\n if (numdots != 3 || !valid)\n result = 0;\n else\n result =\n (ares_inet_pton(AF_INET, name, &addr.sa4.sin_addr) < 1 ? 0 : 1);\n\n if (result)\n {\n family = addr.sa.sa_family = AF_INET;\n addr.sa4.sin_port = htons(port);\n addrlen = sizeof(addr.sa4);\n }\n }\n\n if (family == AF_INET6 || family == AF_UNSPEC)\n {\n result =\n (ares_inet_pton(AF_INET6, name, &addr.sa6.sin6_addr) < 1 ? 0 : 1);\n addr.sa6.sin6_family = AF_INET6;\n addr.sa6.sin6_port = htons(port);\n addrlen = sizeof(addr.sa6);\n }\n\n if (!result)\n return 0;\n\n node = ares__malloc_addrinfo_node();\n if (!node)\n {\n ares_freeaddrinfo(ai);\n callback(arg, ARES_ENOMEM, 0, NULL);\n return 1;\n }\n\n ai->nodes = node;\n\n node->ai_addr = ares_malloc(addrlen);\n if (!node->ai_addr)\n {\n ares_freeaddrinfo(ai);\n callback(arg, ARES_ENOMEM, 0, NULL);\n return 1;\n }\n\n node->ai_addrlen = (unsigned int)addrlen;\n node->ai_family = addr.sa.sa_family;\n if (addr.sa.sa_family == AF_INET)\n memcpy(node->ai_addr, &addr.sa4, sizeof(addr.sa4));\n else\n memcpy(node->ai_addr, &addr.sa6, sizeof(addr.sa6));\n\n if (hints->ai_flags & ARES_AI_CANONNAME)\n {\n cname = ares__append_addrinfo_cname(&ai->cnames);\n if (!cname)\n {\n ares_freeaddrinfo(ai);\n callback(arg, ARES_ENOMEM, 0, NULL);\n return 1;\n }\n\n /* Duplicate the name, to avoid a constness violation. */\n cname->name = ares_strdup(name);\n if (!cname->name)\n {\n ares_freeaddrinfo(ai);\n callback(arg, ARES_ENOMEM, 0, NULL);\n return 1;\n }\n }\n\n callback(arg, ARES_SUCCESS, 0, ai);\n return 1;\n}",
  10009. "project": "c-ares",
  10010. "hash": 66006611725293027056403245970014345416,
  10011. "size": 110,
  10012. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  10013. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  10014. "target": 0,
  10015. "dataset": "other",
  10016. "idx": 478397
  10017. },
  10018. {
  10019. "func": "static int file_lookup(struct host_query *hquery)\n{\n FILE *fp;\n int error;\n int status;\n const char *path_hosts = NULL;\n\n if (hquery->hints.ai_flags & ARES_AI_ENVHOSTS)\n {\n path_hosts = getenv(\"CARES_HOSTS\");\n }\n\n if (!path_hosts)\n {\n#ifdef WIN32\n char PATH_HOSTS[MAX_PATH];\n win_platform platform;\n\n PATH_HOSTS[0] = '\\0';\n\n platform = ares__getplatform();\n\n if (platform == WIN_NT)\n {\n char tmp[MAX_PATH];\n HKEY hkeyHosts;\n\n if (RegOpenKeyExA(HKEY_LOCAL_MACHINE, WIN_NS_NT_KEY, 0, KEY_READ,\n &hkeyHosts) == ERROR_SUCCESS)\n {\n DWORD dwLength = MAX_PATH;\n RegQueryValueExA(hkeyHosts, DATABASEPATH, NULL, NULL, (LPBYTE)tmp,\n &dwLength);\n ExpandEnvironmentStringsA(tmp, PATH_HOSTS, MAX_PATH);\n RegCloseKey(hkeyHosts);\n }\n }\n else if (platform == WIN_9X)\n GetWindowsDirectoryA(PATH_HOSTS, MAX_PATH);\n else\n return ARES_ENOTFOUND;\n\n strcat(PATH_HOSTS, WIN_PATH_HOSTS);\n path_hosts = PATH_HOSTS;\n\n#elif defined(WATT32)\n const char *PATH_HOSTS = _w32_GetHostsFile();\n\n if (!PATH_HOSTS)\n return ARES_ENOTFOUND;\n#endif\n path_hosts = PATH_HOSTS;\n }\n\n fp = fopen(path_hosts, \"r\");\n if (!fp)\n {\n error = ERRNO;\n switch (error)\n {\n case ENOENT:\n case ESRCH:\n return ARES_ENOTFOUND;\n default:\n DEBUGF(fprintf(stderr, \"fopen() failed with error: %d %s\\n\", error,\n strerror(error)));\n DEBUGF(fprintf(stderr, \"Error opening file: %s\\n\", path_hosts));\n return ARES_EFILE;\n }\n }\n status = ares__readaddrinfo(fp, hquery->name, hquery->port, &hquery->hints, hquery->ai);\n fclose(fp);\n return status;\n}",
  10020. "project": "c-ares",
  10021. "hash": 91599572035713631136624203713505139306,
  10022. "size": 74,
  10023. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  10024. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  10025. "target": 0,
  10026. "dataset": "other",
  10027. "idx": 478389
  10028. },
  10029. {
  10030. "func": "static void end_hquery(struct host_query *hquery, int status)\n{\n struct ares_addrinfo_node sentinel;\n struct ares_addrinfo_node *next;\n if (status == ARES_SUCCESS)\n {\n if (!(hquery->hints.ai_flags & ARES_AI_NOSORT))\n {\n sentinel.ai_next = hquery->ai->nodes;\n ares__sortaddrinfo(hquery->channel, &sentinel);\n hquery->ai->nodes = sentinel.ai_next;\n }\n next = hquery->ai->nodes;\n /* Set port into each address (resolved separately). */\n while (next)\n {\n if (next->ai_family == AF_INET)\n {\n (CARES_INADDR_CAST(struct sockaddr_in *, next->ai_addr))->sin_port = htons(hquery->port);\n }\n else\n {\n (CARES_INADDR_CAST(struct sockaddr_in6 *, next->ai_addr))->sin6_port = htons(hquery->port);\n }\n next = next->ai_next;\n }\n }\n else\n {\n /* Clean up what we have collected by so far. */\n ares_freeaddrinfo(hquery->ai);\n hquery->ai = NULL;\n }\n\n hquery->callback(hquery->arg, status, hquery->timeouts, hquery->ai);\n ares_free(hquery->name);\n ares_free(hquery);\n}",
  10031. "project": "c-ares",
  10032. "hash": 71186623123778906237306314660113629765,
  10033. "size": 38,
  10034. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  10035. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  10036. "target": 0,
  10037. "dataset": "other",
  10038. "idx": 478388
  10039. },
  10040. {
  10041. "func": "static int next_dns_lookup(struct host_query *hquery)\n{\n char *s = NULL;\n int is_s_allocated = 0;\n int status;\n\n /* if next_domain == -1 and as_is_first is true, try hquery->name */\n if (hquery->next_domain == -1)\n {\n if (as_is_first(hquery))\n {\n s = hquery->name;\n }\n hquery->next_domain = 0;\n }\n\n /* if as_is_first is false, try hquery->name at last */\n if (!s && hquery->next_domain == hquery->channel->ndomains) {\n if (!as_is_first(hquery))\n {\n s = hquery->name;\n }\n hquery->next_domain++;\n }\n\n if (!s && hquery->next_domain < hquery->channel->ndomains)\n {\n status = ares__cat_domain(\n hquery->name,\n hquery->channel->domains[hquery->next_domain++],\n &s);\n if (status == ARES_SUCCESS)\n {\n is_s_allocated = 1;\n }\n }\n\n if (s)\n {\n switch (hquery->hints.ai_family)\n {\n case AF_INET:\n hquery->remaining += 1;\n ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery);\n break;\n case AF_INET6:\n hquery->remaining += 1;\n ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery);\n break;\n case AF_UNSPEC:\n hquery->remaining += 2;\n ares_query(hquery->channel, s, C_IN, T_A, host_callback, hquery);\n ares_query(hquery->channel, s, C_IN, T_AAAA, host_callback, hquery);\n break;\n default: break;\n }\n if (is_s_allocated)\n {\n ares_free(s);\n }\n return 1;\n }\n else\n {\n assert(!hquery->ai->nodes);\n return 0;\n }\n}",
  10042. "project": "c-ares",
  10043. "hash": 178615620088609344767490760442616582817,
  10044. "size": 68,
  10045. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  10046. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  10047. "target": 0,
  10048. "dataset": "other",
  10049. "idx": 478399
  10050. },
  10051. {
  10052. "func": "void ares_getaddrinfo(ares_channel channel,\n const char* name, const char* service,\n const struct ares_addrinfo_hints* hints,\n ares_addrinfo_callback callback, void* arg)\n{\n struct host_query *hquery;\n unsigned short port = 0;\n int family;\n struct ares_addrinfo *ai;\n\n if (!hints)\n {\n hints = &default_hints;\n }\n\n family = hints->ai_family;\n\n /* Right now we only know how to look up Internet addresses\n and unspec means try both basically. */\n if (family != AF_INET &&\n family != AF_INET6 &&\n family != AF_UNSPEC)\n {\n callback(arg, ARES_ENOTIMP, 0, NULL);\n return;\n }\n\n if (ares__is_onion_domain(name))\n {\n callback(arg, ARES_ENOTFOUND, 0, NULL);\n return;\n }\n\n if (service)\n {\n if (hints->ai_flags & ARES_AI_NUMERICSERV)\n {\n port = (unsigned short)strtoul(service, NULL, 0);\n if (!port)\n {\n callback(arg, ARES_ESERVICE, 0, NULL);\n return;\n }\n }\n else\n {\n port = lookup_service(service, 0);\n if (!port)\n {\n port = (unsigned short)strtoul(service, NULL, 0);\n if (!port)\n {\n callback(arg, ARES_ESERVICE, 0, NULL);\n return;\n }\n }\n }\n }\n\n ai = ares__malloc_addrinfo();\n if (!ai)\n {\n callback(arg, ARES_ENOMEM, 0, NULL);\n return;\n }\n\n if (fake_addrinfo(name, port, hints, ai, callback, arg))\n {\n return;\n }\n\n /* Allocate and fill in the host query structure. */\n hquery = ares_malloc(sizeof(struct host_query));\n if (!hquery)\n {\n ares_freeaddrinfo(ai);\n callback(arg, ARES_ENOMEM, 0, NULL);\n return;\n }\n\n hquery->name = ares_strdup(name);\n if (!hquery->name)\n {\n ares_free(hquery);\n ares_freeaddrinfo(ai);\n callback(arg, ARES_ENOMEM, 0, NULL);\n return;\n }\n\n hquery->port = port;\n hquery->channel = channel;\n hquery->hints = *hints;\n hquery->sent_family = -1; /* nothing is sent yet */\n hquery->callback = callback;\n hquery->arg = arg;\n hquery->remaining_lookups = channel->lookups;\n hquery->timeouts = 0;\n hquery->ai = ai;\n hquery->next_domain = -1;\n hquery->remaining = 0;\n\n /* Start performing lookups according to channel->lookups. */\n next_lookup(hquery, ARES_ECONNREFUSED /* initial error code */);\n}",
  10053. "project": "c-ares",
  10054. "hash": 313928135751897402325324090812725212075,
  10055. "size": 104,
  10056. "commit_id": "1cc7e83c3bdfaafbc5919c95025592d8de3a170e",
  10057. "message": "Prevent possible double-free in ares_getaddrinfo() if ares_destroy() is called\n\nIn the event that ares_destroy() is called prior to ares_getaddrinfo() completing,\nit would result in an invalid read and double-free due to calling end_hquery() twice.\n\nReported By: Jann Horn @ Google Project Zero",
  10058. "target": 0,
  10059. "dataset": "other",
  10060. "idx": 478394
  10061. }
  10062. ]
  10063. },
  10064. {
  10065. "call_depth": 5,
  10066. "longest_call_chain": [
  10067. "lp_write",
  10068. "lp_wait_ready",
  10069. "lp_check_status",
  10070. "lp_error",
  10071. "lp_claim_parport_or_block"
  10072. ],
  10073. "group_size": 17,
  10074. "functions": [
  10075. {
  10076. "func": "static long lp_ioctl(struct file *file, unsigned int cmd,\n\t\t\tunsigned long arg)\n{\n\tunsigned int minor;\n\tstruct timeval par_timeout;\n\tint ret;\n\n\tminor = iminor(file_inode(file));\n\tmutex_lock(&lp_mutex);\n\tswitch (cmd) {\n\tcase LPSETTIMEOUT:\n\t\tif (copy_from_user(&par_timeout, (void __user *)arg,\n\t\t\t\t\tsizeof (struct timeval))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tret = lp_set_timeout(minor, &par_timeout);\n\t\tbreak;\n\tdefault:\n\t\tret = lp_do_ioctl(minor, cmd, arg, (void __user *)arg);\n\t\tbreak;\n\t}\n\tmutex_unlock(&lp_mutex);\n\n\treturn ret;\n}",
  10077. "project": "linux",
  10078. "hash": 310317011291507096778848627939386883859,
  10079. "size": 26,
  10080. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10081. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10082. "target": 0,
  10083. "dataset": "other",
  10084. "idx": 450876
  10085. },
  10086. {
  10087. "func": "static int lp_do_ioctl(unsigned int minor, unsigned int cmd,\n\tunsigned long arg, void __user *argp)\n{\n\tint status;\n\tint retval = 0;\n\n#ifdef LP_DEBUG\n\tprintk(KERN_DEBUG \"lp%d ioctl, cmd: 0x%x, arg: 0x%lx\\n\", minor, cmd, arg);\n#endif\n\tif (minor >= LP_NO)\n\t\treturn -ENODEV;\n\tif ((LP_F(minor) & LP_EXIST) == 0)\n\t\treturn -ENODEV;\n\tswitch ( cmd ) {\n\t\tcase LPTIME:\n\t\t\tif (arg > UINT_MAX / HZ)\n\t\t\t\treturn -EINVAL;\n\t\t\tLP_TIME(minor) = arg * HZ/100;\n\t\t\tbreak;\n\t\tcase LPCHAR:\n\t\t\tLP_CHAR(minor) = arg;\n\t\t\tbreak;\n\t\tcase LPABORT:\n\t\t\tif (arg)\n\t\t\t\tLP_F(minor) |= LP_ABORT;\n\t\t\telse\n\t\t\t\tLP_F(minor) &= ~LP_ABORT;\n\t\t\tbreak;\n\t\tcase LPABORTOPEN:\n\t\t\tif (arg)\n\t\t\t\tLP_F(minor) |= LP_ABORTOPEN;\n\t\t\telse\n\t\t\t\tLP_F(minor) &= ~LP_ABORTOPEN;\n\t\t\tbreak;\n\t\tcase LPCAREFUL:\n\t\t\tif (arg)\n\t\t\t\tLP_F(minor) |= LP_CAREFUL;\n\t\t\telse\n\t\t\t\tLP_F(minor) &= ~LP_CAREFUL;\n\t\t\tbreak;\n\t\tcase LPWAIT:\n\t\t\tLP_WAIT(minor) = arg;\n\t\t\tbreak;\n\t\tcase LPSETIRQ: \n\t\t\treturn -EINVAL;\n\t\t\tbreak;\n\t\tcase LPGETIRQ:\n\t\t\tif (copy_to_user(argp, &LP_IRQ(minor),\n\t\t\t\t\tsizeof(int)))\n\t\t\t\treturn -EFAULT;\n\t\t\tbreak;\n\t\tcase LPGETSTATUS:\n\t\t\tif (mutex_lock_interruptible(&lp_table[minor].port_mutex))\n\t\t\t\treturn -EINTR;\n\t\t\tlp_claim_parport_or_block (&lp_table[minor]);\n\t\t\tstatus = r_str(minor);\n\t\t\tlp_release_parport (&lp_table[minor]);\n\t\t\tmutex_unlock(&lp_table[minor].port_mutex);\n\n\t\t\tif (copy_to_user(argp, &status, sizeof(int)))\n\t\t\t\treturn -EFAULT;\n\t\t\tbreak;\n\t\tcase LPRESET:\n\t\t\tlp_reset(minor);\n\t\t\tbreak;\n#ifdef LP_STATS\n\t\tcase LPGETSTATS:\n\t\t\tif (copy_to_user(argp, &LP_STAT(minor),\n\t\t\t\t\tsizeof(struct lp_stats)))\n\t\t\t\treturn -EFAULT;\n\t\t\tif (capable(CAP_SYS_ADMIN))\n\t\t\t\tmemset(&LP_STAT(minor), 0,\n\t\t\t\t\t\tsizeof(struct lp_stats));\n\t\t\tbreak;\n#endif\n \t\tcase LPGETFLAGS:\n \t\t\tstatus = LP_F(minor);\n\t\t\tif (copy_to_user(argp, &status, sizeof(int)))\n\t\t\t\treturn -EFAULT;\n\t\t\tbreak;\n\n\t\tdefault:\n\t\t\tretval = -EINVAL;\n\t}\n\treturn retval;\n}",
  10088. "project": "linux",
  10089. "hash": 130937153518089685760846986940114699309,
  10090. "size": 86,
  10091. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10092. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10093. "target": 0,
  10094. "dataset": "other",
  10095. "idx": 450889
  10096. },
  10097. {
  10098. "func": "static void lp_release_parport(struct lp_struct *this_lp)\n{\n\tif (test_and_clear_bit(LP_PARPORT_CLAIMED, &this_lp->bits)) {\n\t\tparport_release (this_lp->dev);\n\t}\n}",
  10099. "project": "linux",
  10100. "hash": 325627075379842917137031662491786157013,
  10101. "size": 6,
  10102. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10103. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10104. "target": 0,
  10105. "dataset": "other",
  10106. "idx": 450872
  10107. },
  10108. {
  10109. "func": "static ssize_t lp_read(struct file * file, char __user * buf,\n\t\t size_t count, loff_t *ppos)\n{\n\tDEFINE_WAIT(wait);\n\tunsigned int minor=iminor(file_inode(file));\n\tstruct parport *port = lp_table[minor].dev->port;\n\tssize_t retval = 0;\n\tchar *kbuf = lp_table[minor].lp_buffer;\n\tint nonblock = ((file->f_flags & O_NONBLOCK) ||\n\t\t\t(LP_F(minor) & LP_ABORT));\n\n\tif (count > LP_BUFFER_SIZE)\n\t\tcount = LP_BUFFER_SIZE;\n\n\tif (mutex_lock_interruptible(&lp_table[minor].port_mutex))\n\t\treturn -EINTR;\n\n\tlp_claim_parport_or_block (&lp_table[minor]);\n\n\tparport_set_timeout (lp_table[minor].dev,\n\t\t\t (nonblock ? PARPORT_INACTIVITY_O_NONBLOCK\n\t\t\t : lp_table[minor].timeout));\n\n\tparport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);\n\tif (parport_negotiate (lp_table[minor].dev->port,\n\t\t\t IEEE1284_MODE_NIBBLE)) {\n\t\tretval = -EIO;\n\t\tgoto out;\n\t}\n\n\twhile (retval == 0) {\n\t\tretval = parport_read (port, kbuf, count);\n\n\t\tif (retval > 0)\n\t\t\tbreak;\n\n\t\tif (nonblock) {\n\t\t\tretval = -EAGAIN;\n\t\t\tbreak;\n\t\t}\n\n\t\t/* Wait for data. */\n\n\t\tif (lp_table[minor].dev->port->irq == PARPORT_IRQ_NONE) {\n\t\t\tparport_negotiate (lp_table[minor].dev->port,\n\t\t\t\t\t IEEE1284_MODE_COMPAT);\n\t\t\tlp_error (minor);\n\t\t\tif (parport_negotiate (lp_table[minor].dev->port,\n\t\t\t\t\t IEEE1284_MODE_NIBBLE)) {\n\t\t\t\tretval = -EIO;\n\t\t\t\tgoto out;\n\t\t\t}\n\t\t} else {\n\t\t\tprepare_to_wait(&lp_table[minor].waitq, &wait, TASK_INTERRUPTIBLE);\n\t\t\tschedule_timeout(LP_TIMEOUT_POLLED);\n\t\t\tfinish_wait(&lp_table[minor].waitq, &wait);\n\t\t}\n\n\t\tif (signal_pending (current)) {\n\t\t\tretval = -ERESTARTSYS;\n\t\t\tbreak;\n\t\t}\n\n\t\tcond_resched ();\n\t}\n\tparport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);\n out:\n\tlp_release_parport (&lp_table[minor]);\n\n\tif (retval > 0 && copy_to_user (buf, kbuf, retval))\n\t\tretval = -EFAULT;\n\n\tmutex_unlock(&lp_table[minor].port_mutex);\n\n\treturn retval;\n}",
  10110. "project": "linux",
  10111. "hash": 154375708472708164100537430448370772239,
  10112. "size": 76,
  10113. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10114. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10115. "target": 0,
  10116. "dataset": "other",
  10117. "idx": 450894
  10118. },
  10119. {
  10120. "func": "static int lp_register(int nr, struct parport *port)\n{\n\tlp_table[nr].dev = parport_register_device(port, \"lp\", \n\t\t\t\t\t\t lp_preempt, NULL, NULL, 0,\n\t\t\t\t\t\t (void *) &lp_table[nr]);\n\tif (lp_table[nr].dev == NULL)\n\t\treturn 1;\n\tlp_table[nr].flags |= LP_EXIST;\n\n\tif (reset)\n\t\tlp_reset(nr);\n\n\tdevice_create(lp_class, port->dev, MKDEV(LP_MAJOR, nr), NULL,\n\t\t \"lp%d\", nr);\n\n\tprintk(KERN_INFO \"lp%d: using %s (%s).\\n\", nr, port->name, \n\t (port->irq == PARPORT_IRQ_NONE)?\"polling\":\"interrupt-driven\");\n\n#ifdef CONFIG_LP_CONSOLE\n\tif (!nr) {\n\t\tif (port->modes & PARPORT_MODE_SAFEININT) {\n\t\t\tregister_console(&lpcons);\n\t\t\tconsole_registered = port;\n\t\t\tprintk (KERN_INFO \"lp%d: console ready\\n\", CONSOLE_LP);\n\t\t} else\n\t\t\tprintk (KERN_ERR \"lp%d: cannot run console on %s\\n\",\n\t\t\t\tCONSOLE_LP, port->name);\n\t}\n#endif\n\n\treturn 0;\n}",
  10121. "project": "linux",
  10122. "hash": 231515468297809346842200784678081972349,
  10123. "size": 32,
  10124. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10125. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10126. "target": 0,
  10127. "dataset": "other",
  10128. "idx": 450877
  10129. },
  10130. {
  10131. "func": "static int lp_wait_ready(int minor, int nonblock)\n{\n\tint error = 0;\n\n\t/* If we're not in compatibility mode, we're ready now! */\n\tif (lp_table[minor].current_mode != IEEE1284_MODE_COMPAT) {\n\t return (0);\n\t}\n\n\tdo {\n\t\terror = lp_check_status (minor);\n\t\tif (error && (nonblock || (LP_F(minor) & LP_ABORT)))\n\t\t\tbreak;\n\t\tif (signal_pending (current)) {\n\t\t\terror = -EINTR;\n\t\t\tbreak;\n\t\t}\n\t} while (error);\n\treturn error;\n}",
  10132. "project": "linux",
  10133. "hash": 165698499137128099582147548390371243788,
  10134. "size": 20,
  10135. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10136. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10137. "target": 0,
  10138. "dataset": "other",
  10139. "idx": 450886
  10140. },
  10141. {
  10142. "func": "static ssize_t lp_write(struct file * file, const char __user * buf,\n\t\t size_t count, loff_t *ppos)\n{\n\tunsigned int minor = iminor(file_inode(file));\n\tstruct parport *port = lp_table[minor].dev->port;\n\tchar *kbuf = lp_table[minor].lp_buffer;\n\tssize_t retv = 0;\n\tssize_t written;\n\tsize_t copy_size = count;\n\tint nonblock = ((file->f_flags & O_NONBLOCK) ||\n\t\t\t(LP_F(minor) & LP_ABORT));\n\n#ifdef LP_STATS\n\tif (time_after(jiffies, lp_table[minor].lastcall + LP_TIME(minor)))\n\t\tlp_table[minor].runchars = 0;\n\n\tlp_table[minor].lastcall = jiffies;\n#endif\n\n\t/* Need to copy the data from user-space. */\n\tif (copy_size > LP_BUFFER_SIZE)\n\t\tcopy_size = LP_BUFFER_SIZE;\n\n\tif (mutex_lock_interruptible(&lp_table[minor].port_mutex))\n\t\treturn -EINTR;\n\n\tif (copy_from_user (kbuf, buf, copy_size)) {\n\t\tretv = -EFAULT;\n\t\tgoto out_unlock;\n\t}\n\n \t/* Claim Parport or sleep until it becomes available\n \t */\n\tlp_claim_parport_or_block (&lp_table[minor]);\n\t/* Go to the proper mode. */\n\tlp_table[minor].current_mode = lp_negotiate (port, \n\t\t\t\t\t\t lp_table[minor].best_mode);\n\n\tparport_set_timeout (lp_table[minor].dev,\n\t\t\t (nonblock ? PARPORT_INACTIVITY_O_NONBLOCK\n\t\t\t : lp_table[minor].timeout));\n\n\tif ((retv = lp_wait_ready (minor, nonblock)) == 0)\n\tdo {\n\t\t/* Write the data. */\n\t\twritten = parport_write (port, kbuf, copy_size);\n\t\tif (written > 0) {\n\t\t\tcopy_size -= written;\n\t\t\tcount -= written;\n\t\t\tbuf += written;\n\t\t\tretv += written;\n\t\t}\n\n\t\tif (signal_pending (current)) {\n\t\t\tif (retv == 0)\n\t\t\t\tretv = -EINTR;\n\n\t\t\tbreak;\n\t\t}\n\n\t\tif (copy_size > 0) {\n\t\t\t/* incomplete write -> check error ! */\n\t\t\tint error;\n\n\t\t\tparport_negotiate (lp_table[minor].dev->port, \n\t\t\t\t\t IEEE1284_MODE_COMPAT);\n\t\t\tlp_table[minor].current_mode = IEEE1284_MODE_COMPAT;\n\n\t\t\terror = lp_wait_ready (minor, nonblock);\n\n\t\t\tif (error) {\n\t\t\t\tif (retv == 0)\n\t\t\t\t\tretv = error;\n\t\t\t\tbreak;\n\t\t\t} else if (nonblock) {\n\t\t\t\tif (retv == 0)\n\t\t\t\t\tretv = -EAGAIN;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tparport_yield_blocking (lp_table[minor].dev);\n\t\t\tlp_table[minor].current_mode \n\t\t\t = lp_negotiate (port, \n\t\t\t\t\t lp_table[minor].best_mode);\n\n\t\t} else if (need_resched())\n\t\t\tschedule ();\n\n\t\tif (count) {\n\t\t\tcopy_size = count;\n\t\t\tif (copy_size > LP_BUFFER_SIZE)\n\t\t\t\tcopy_size = LP_BUFFER_SIZE;\n\n\t\t\tif (copy_from_user(kbuf, buf, copy_size)) {\n\t\t\t\tif (retv == 0)\n\t\t\t\t\tretv = -EFAULT;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\t\n\t} while (count > 0);\n\n\tif (test_and_clear_bit(LP_PREEMPT_REQUEST, \n\t\t\t &lp_table[minor].bits)) {\n\t\tprintk(KERN_INFO \"lp%d releasing parport\\n\", minor);\n\t\tparport_negotiate (lp_table[minor].dev->port, \n\t\t\t\t IEEE1284_MODE_COMPAT);\n\t\tlp_table[minor].current_mode = IEEE1284_MODE_COMPAT;\n\t\tlp_release_parport (&lp_table[minor]);\n\t}\nout_unlock:\n\tmutex_unlock(&lp_table[minor].port_mutex);\n\n \treturn retv;\n}",
  10143. "project": "linux",
  10144. "hash": 117232957958936779529326922595402686609,
  10145. "size": 114,
  10146. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10147. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10148. "target": 0,
  10149. "dataset": "other",
  10150. "idx": 450884
  10151. },
  10152. {
  10153. "func": "static int lp_check_status(int minor)\n{\n\tint error = 0;\n\tunsigned int last = lp_table[minor].last_error;\n\tunsigned char status = r_str(minor);\n\tif ((status & LP_PERRORP) && !(LP_F(minor) & LP_CAREFUL))\n\t\t/* No error. */\n\t\tlast = 0;\n\telse if ((status & LP_POUTPA)) {\n\t\tif (last != LP_POUTPA) {\n\t\t\tlast = LP_POUTPA;\n\t\t\tprintk(KERN_INFO \"lp%d out of paper\\n\", minor);\n\t\t}\n\t\terror = -ENOSPC;\n\t} else if (!(status & LP_PSELECD)) {\n\t\tif (last != LP_PSELECD) {\n\t\t\tlast = LP_PSELECD;\n\t\t\tprintk(KERN_INFO \"lp%d off-line\\n\", minor);\n\t\t}\n\t\terror = -EIO;\n\t} else if (!(status & LP_PERRORP)) {\n\t\tif (last != LP_PERRORP) {\n\t\t\tlast = LP_PERRORP;\n\t\t\tprintk(KERN_INFO \"lp%d on fire\\n\", minor);\n\t\t}\n\t\terror = -EIO;\n\t} else {\n\t\tlast = 0; /* Come here if LP_CAREFUL is set and no\n errors are reported. */\n\t}\n\n\tlp_table[minor].last_error = last;\n\n\tif (last != 0)\n\t\tlp_error(minor);\n\n\treturn error;\n}",
  10154. "project": "linux",
  10155. "hash": 53826108333373058949670796360280619913,
  10156. "size": 38,
  10157. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10158. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10159. "target": 0,
  10160. "dataset": "other",
  10161. "idx": 450874
  10162. },
  10163. {
  10164. "func": "static void lp_attach (struct parport *port)\n{\n\tunsigned int i;\n\n\tswitch (parport_nr[0]) {\n\tcase LP_PARPORT_UNSPEC:\n\tcase LP_PARPORT_AUTO:\n\t\tif (parport_nr[0] == LP_PARPORT_AUTO &&\n\t\t port->probe_info[0].class != PARPORT_CLASS_PRINTER)\n\t\t\treturn;\n\t\tif (lp_count == LP_NO) {\n\t\t\tprintk(KERN_INFO \"lp: ignoring parallel port (max. %d)\\n\",LP_NO);\n\t\t\treturn;\n\t\t}\n\t\tif (!lp_register(lp_count, port))\n\t\t\tlp_count++;\n\t\tbreak;\n\n\tdefault:\n\t\tfor (i = 0; i < LP_NO; i++) {\n\t\t\tif (port->number == parport_nr[i]) {\n\t\t\t\tif (!lp_register(i, port))\n\t\t\t\t\tlp_count++;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tbreak;\n\t}\n}",
  10165. "project": "linux",
  10166. "hash": 116872138336984322809423542780047067618,
  10167. "size": 29,
  10168. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10169. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10170. "target": 0,
  10171. "dataset": "other",
  10172. "idx": 450881
  10173. },
  10174. {
  10175. "func": "static int lp_reset(int minor)\n{\n\tint retval;\n\tlp_claim_parport_or_block (&lp_table[minor]);\n\tw_ctr(minor, LP_PSELECP);\n\tudelay (LP_DELAY);\n\tw_ctr(minor, LP_PSELECP | LP_PINITP);\n\tretval = r_str(minor);\n\tlp_release_parport (&lp_table[minor]);\n\treturn retval;\n}",
  10176. "project": "linux",
  10177. "hash": 72641415785998346157674704417312057333,
  10178. "size": 11,
  10179. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10180. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10181. "target": 0,
  10182. "dataset": "other",
  10183. "idx": 450873
  10184. },
  10185. {
  10186. "func": "static int lp_release(struct inode * inode, struct file * file)\n{\n\tunsigned int minor = iminor(inode);\n\n\tlp_claim_parport_or_block (&lp_table[minor]);\n\tparport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);\n\tlp_table[minor].current_mode = IEEE1284_MODE_COMPAT;\n\tlp_release_parport (&lp_table[minor]);\n\tkfree(lp_table[minor].lp_buffer);\n\tlp_table[minor].lp_buffer = NULL;\n\tLP_F(minor) &= ~LP_BUSY;\n\treturn 0;\n}",
  10187. "project": "linux",
  10188. "hash": 100176523045059279116912805733551169117,
  10189. "size": 13,
  10190. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10191. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10192. "target": 0,
  10193. "dataset": "other",
  10194. "idx": 450885
  10195. },
  10196. {
  10197. "func": "static void lp_claim_parport_or_block(struct lp_struct *this_lp)\n{\n\tif (!test_and_set_bit(LP_PARPORT_CLAIMED, &this_lp->bits)) {\n\t\tparport_claim_or_block (this_lp->dev);\n\t}\n}",
  10198. "project": "linux",
  10199. "hash": 154440745684791428730342145864371334759,
  10200. "size": 6,
  10201. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10202. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10203. "target": 0,
  10204. "dataset": "other",
  10205. "idx": 450883
  10206. },
  10207. {
  10208. "func": "static void lp_error (int minor)\n{\n\tDEFINE_WAIT(wait);\n\tint polling;\n\n\tif (LP_F(minor) & LP_ABORT)\n\t\treturn;\n\n\tpolling = lp_table[minor].dev->port->irq == PARPORT_IRQ_NONE;\n\tif (polling) lp_release_parport (&lp_table[minor]);\n\tprepare_to_wait(&lp_table[minor].waitq, &wait, TASK_INTERRUPTIBLE);\n\tschedule_timeout(LP_TIMEOUT_POLLED);\n\tfinish_wait(&lp_table[minor].waitq, &wait);\n\tif (polling) lp_claim_parport_or_block (&lp_table[minor]);\n\telse parport_yield_blocking (lp_table[minor].dev);\n}",
  10209. "project": "linux",
  10210. "hash": 194182076708265289569840949840870470183,
  10211. "size": 16,
  10212. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10213. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10214. "target": 0,
  10215. "dataset": "other",
  10216. "idx": 450893
  10217. },
  10218. {
  10219. "func": "static long lp_compat_ioctl(struct file *file, unsigned int cmd,\n\t\t\tunsigned long arg)\n{\n\tunsigned int minor;\n\tstruct timeval par_timeout;\n\tint ret;\n\n\tminor = iminor(file_inode(file));\n\tmutex_lock(&lp_mutex);\n\tswitch (cmd) {\n\tcase LPSETTIMEOUT:\n\t\tif (compat_get_timeval(&par_timeout, compat_ptr(arg))) {\n\t\t\tret = -EFAULT;\n\t\t\tbreak;\n\t\t}\n\t\tret = lp_set_timeout(minor, &par_timeout);\n\t\tbreak;\n#ifdef LP_STATS\n\tcase LPGETSTATS:\n\t\t/* FIXME: add an implementation if you set LP_STATS */\n\t\tret = -EINVAL;\n\t\tbreak;\n#endif\n\tdefault:\n\t\tret = lp_do_ioctl(minor, cmd, arg, compat_ptr(arg));\n\t\tbreak;\n\t}\n\tmutex_unlock(&lp_mutex);\n\n\treturn ret;\n}",
  10220. "project": "linux",
  10221. "hash": 124506607362284007062064640513193579418,
  10222. "size": 31,
  10223. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10224. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10225. "target": 0,
  10226. "dataset": "other",
  10227. "idx": 450891
  10228. },
  10229. {
  10230. "func": "static int lp_negotiate(struct parport * port, int mode)\n{\n\tif (parport_negotiate (port, mode) != 0) {\n\t\tmode = IEEE1284_MODE_COMPAT;\n\t\tparport_negotiate (port, mode);\n\t}\n\n\treturn (mode);\n}",
  10231. "project": "linux",
  10232. "hash": 183732070711002803500514793696458183145,
  10233. "size": 9,
  10234. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10235. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10236. "target": 0,
  10237. "dataset": "other",
  10238. "idx": 450882
  10239. },
  10240. {
  10241. "func": "static int lp_set_timeout(unsigned int minor, struct timeval *par_timeout)\n{\n\tlong to_jiffies;\n\n\t/* Convert to jiffies, place in lp_table */\n\tif ((par_timeout->tv_sec < 0) ||\n\t (par_timeout->tv_usec < 0)) {\n\t\treturn -EINVAL;\n\t}\n\tto_jiffies = DIV_ROUND_UP(par_timeout->tv_usec, 1000000/HZ);\n\tto_jiffies += par_timeout->tv_sec * (long) HZ;\n\tif (to_jiffies <= 0) {\n\t\treturn -EINVAL;\n\t}\n\tlp_table[minor].timeout = to_jiffies;\n\treturn 0;\n}",
  10242. "project": "linux",
  10243. "hash": 125201676574025652251181138392245504296,
  10244. "size": 17,
  10245. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10246. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10247. "target": 0,
  10248. "dataset": "other",
  10249. "idx": 450890
  10250. },
  10251. {
  10252. "func": "static int lp_open(struct inode * inode, struct file * file)\n{\n\tunsigned int minor = iminor(inode);\n\tint ret = 0;\n\n\tmutex_lock(&lp_mutex);\n\tif (minor >= LP_NO) {\n\t\tret = -ENXIO;\n\t\tgoto out;\n\t}\n\tif ((LP_F(minor) & LP_EXIST) == 0) {\n\t\tret = -ENXIO;\n\t\tgoto out;\n\t}\n\tif (test_and_set_bit(LP_BUSY_BIT_POS, &LP_F(minor))) {\n\t\tret = -EBUSY;\n\t\tgoto out;\n\t}\n\t/* If ABORTOPEN is set and the printer is offline or out of paper,\n\t we may still want to open it to perform ioctl()s. Therefore we\n\t have commandeered O_NONBLOCK, even though it is being used in\n\t a non-standard manner. This is strictly a Linux hack, and\n\t should most likely only ever be used by the tunelp application. */\n\tif ((LP_F(minor) & LP_ABORTOPEN) && !(file->f_flags & O_NONBLOCK)) {\n\t\tint status;\n\t\tlp_claim_parport_or_block (&lp_table[minor]);\n\t\tstatus = r_str(minor);\n\t\tlp_release_parport (&lp_table[minor]);\n\t\tif (status & LP_POUTPA) {\n\t\t\tprintk(KERN_INFO \"lp%d out of paper\\n\", minor);\n\t\t\tLP_F(minor) &= ~LP_BUSY;\n\t\t\tret = -ENOSPC;\n\t\t\tgoto out;\n\t\t} else if (!(status & LP_PSELECD)) {\n\t\t\tprintk(KERN_INFO \"lp%d off-line\\n\", minor);\n\t\t\tLP_F(minor) &= ~LP_BUSY;\n\t\t\tret = -EIO;\n\t\t\tgoto out;\n\t\t} else if (!(status & LP_PERRORP)) {\n\t\t\tprintk(KERN_ERR \"lp%d printer error\\n\", minor);\n\t\t\tLP_F(minor) &= ~LP_BUSY;\n\t\t\tret = -EIO;\n\t\t\tgoto out;\n\t\t}\n\t}\n\tlp_table[minor].lp_buffer = kmalloc(LP_BUFFER_SIZE, GFP_KERNEL);\n\tif (!lp_table[minor].lp_buffer) {\n\t\tLP_F(minor) &= ~LP_BUSY;\n\t\tret = -ENOMEM;\n\t\tgoto out;\n\t}\n\t/* Determine if the peripheral supports ECP mode */\n\tlp_claim_parport_or_block (&lp_table[minor]);\n\tif ( (lp_table[minor].dev->port->modes & PARPORT_MODE_ECP) &&\n !parport_negotiate (lp_table[minor].dev->port, \n IEEE1284_MODE_ECP)) {\n\t\tprintk (KERN_INFO \"lp%d: ECP mode\\n\", minor);\n\t\tlp_table[minor].best_mode = IEEE1284_MODE_ECP;\n\t} else {\n\t\tlp_table[minor].best_mode = IEEE1284_MODE_COMPAT;\n\t}\n\t/* Leave peripheral in compatibility mode */\n\tparport_negotiate (lp_table[minor].dev->port, IEEE1284_MODE_COMPAT);\n\tlp_release_parport (&lp_table[minor]);\n\tlp_table[minor].current_mode = IEEE1284_MODE_COMPAT;\nout:\n\tmutex_unlock(&lp_mutex);\n\treturn ret;\n}",
  10253. "project": "linux",
  10254. "hash": 160925209290101545324385690617341075442,
  10255. "size": 69,
  10256. "commit_id": "3e21f4af170bebf47c187c1ff8bf155583c9f3b1",
  10257. "message": "char: lp: fix possible integer overflow in lp_setup()\n\nThe lp_setup() code doesn't apply any bounds checking when passing\n\"lp=none\", and only in this case, resulting in an overflow of the\nparport_nr[] array. All versions in Git history are affected.\n\nReported-By: Roee Hay <roee.hay@hcl.com>\nCc: Ben Hutchings <ben@decadent.org.uk>\nCc: stable@vger.kernel.org\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nSigned-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>",
  10258. "target": 0,
  10259. "dataset": "other",
  10260. "idx": 450875
  10261. }
  10262. ]
  10263. },
  10264. {
  10265. "call_depth": 3,
  10266. "longest_call_chain": [
  10267. "split_huge_page_to_list",
  10268. "__split_huge_page",
  10269. "remap_page"
  10270. ],
  10271. "group_size": 7,
  10272. "functions": [
  10273. {
  10274. "func": "int split_huge_page_to_list(struct page *page, struct list_head *list)\n{\n\tstruct page *head = compound_head(page);\n\tstruct pglist_data *pgdata = NODE_DATA(page_to_nid(head));\n\tstruct deferred_split *ds_queue = get_deferred_split_queue(head);\n\tstruct anon_vma *anon_vma = NULL;\n\tstruct address_space *mapping = NULL;\n\tint count, mapcount, extra_pins, ret;\n\tbool mlocked;\n\tunsigned long flags;\n\tpgoff_t end;\n\n\tVM_BUG_ON_PAGE(is_huge_zero_page(head), head);\n\tVM_BUG_ON_PAGE(!PageLocked(head), head);\n\tVM_BUG_ON_PAGE(!PageCompound(head), head);\n\n\tif (PageWriteback(head))\n\t\treturn -EBUSY;\n\n\tif (PageAnon(head)) {\n\t\t/*\n\t\t * The caller does not necessarily hold an mmap_sem that would\n\t\t * prevent the anon_vma disappearing so we first we take a\n\t\t * reference to it and then lock the anon_vma for write. This\n\t\t * is similar to page_lock_anon_vma_read except the write lock\n\t\t * is taken to serialise against parallel split or collapse\n\t\t * operations.\n\t\t */\n\t\tanon_vma = page_get_anon_vma(head);\n\t\tif (!anon_vma) {\n\t\t\tret = -EBUSY;\n\t\t\tgoto out;\n\t\t}\n\t\tend = -1;\n\t\tmapping = NULL;\n\t\tanon_vma_lock_write(anon_vma);\n\t} else {\n\t\tmapping = head->mapping;\n\n\t\t/* Truncated ? */\n\t\tif (!mapping) {\n\t\t\tret = -EBUSY;\n\t\t\tgoto out;\n\t\t}\n\n\t\tanon_vma = NULL;\n\t\ti_mmap_lock_read(mapping);\n\n\t\t/*\n\t\t *__split_huge_page() may need to trim off pages beyond EOF:\n\t\t * but on 32-bit, i_size_read() takes an irq-unsafe seqlock,\n\t\t * which cannot be nested inside the page tree lock. So note\n\t\t * end now: i_size itself may be changed at any moment, but\n\t\t * head page lock is good enough to serialize the trimming.\n\t\t */\n\t\tend = DIV_ROUND_UP(i_size_read(mapping->host), PAGE_SIZE);\n\t}\n\n\t/*\n\t * Racy check if we can split the page, before unmap_page() will\n\t * split PMDs\n\t */\n\tif (!can_split_huge_page(head, &extra_pins)) {\n\t\tret = -EBUSY;\n\t\tgoto out_unlock;\n\t}\n\n\tmlocked = PageMlocked(head);\n\tunmap_page(head);\n\tVM_BUG_ON_PAGE(compound_mapcount(head), head);\n\n\t/* Make sure the page is not on per-CPU pagevec as it takes pin */\n\tif (mlocked)\n\t\tlru_add_drain();\n\n\t/* prevent PageLRU to go away from under us, and freeze lru stats */\n\tspin_lock_irqsave(&pgdata->lru_lock, flags);\n\n\tif (mapping) {\n\t\tXA_STATE(xas, &mapping->i_pages, page_index(head));\n\n\t\t/*\n\t\t * Check if the head page is present in page cache.\n\t\t * We assume all tail are present too, if head is there.\n\t\t */\n\t\txa_lock(&mapping->i_pages);\n\t\tif (xas_load(&xas) != head)\n\t\t\tgoto fail;\n\t}\n\n\t/* Prevent deferred_split_scan() touching ->_refcount */\n\tspin_lock(&ds_queue->split_queue_lock);\n\tcount = page_count(head);\n\tmapcount = total_mapcount(head);\n\tif (!mapcount && page_ref_freeze(head, 1 + extra_pins)) {\n\t\tif (!list_empty(page_deferred_list(head))) {\n\t\t\tds_queue->split_queue_len--;\n\t\t\tlist_del(page_deferred_list(head));\n\t\t}\n\t\tspin_unlock(&ds_queue->split_queue_lock);\n\t\tif (mapping) {\n\t\t\tif (PageSwapBacked(head))\n\t\t\t\t__dec_node_page_state(head, NR_SHMEM_THPS);\n\t\t\telse\n\t\t\t\t__dec_node_page_state(head, NR_FILE_THPS);\n\t\t}\n\n\t\t__split_huge_page(page, list, end, flags);\n\t\tif (PageSwapCache(head)) {\n\t\t\tswp_entry_t entry = { .val = page_private(head) };\n\n\t\t\tret = split_swap_cluster(entry);\n\t\t} else\n\t\t\tret = 0;\n\t} else {\n\t\tif (IS_ENABLED(CONFIG_DEBUG_VM) && mapcount) {\n\t\t\tpr_alert(\"total_mapcount: %u, page_count(): %u\\n\",\n\t\t\t\t\tmapcount, count);\n\t\t\tif (PageTail(page))\n\t\t\t\tdump_page(head, NULL);\n\t\t\tdump_page(page, \"total_mapcount(head) > 0\");\n\t\t\tBUG();\n\t\t}\n\t\tspin_unlock(&ds_queue->split_queue_lock);\nfail:\t\tif (mapping)\n\t\t\txa_unlock(&mapping->i_pages);\n\t\tspin_unlock_irqrestore(&pgdata->lru_lock, flags);\n\t\tremap_page(head);\n\t\tret = -EBUSY;\n\t}\n\nout_unlock:\n\tif (anon_vma) {\n\t\tanon_vma_unlock_write(anon_vma);\n\t\tput_anon_vma(anon_vma);\n\t}\n\tif (mapping)\n\t\ti_mmap_unlock_read(mapping);\nout:\n\tcount_vm_event(!ret ? THP_SPLIT_PAGE : THP_SPLIT_PAGE_FAILED);\n\treturn ret;\n}",
  10275. "project": "linux",
  10276. "hash": 177093454439225671884976065861384671915,
  10277. "size": 142,
  10278. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  10279. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  10280. "target": 0,
  10281. "dataset": "other",
  10282. "idx": 364182
  10283. },
  10284. {
  10285. "func": "static void remap_page(struct page *page)\n{\n\tint i;\n\tif (PageTransHuge(page)) {\n\t\tremove_migration_ptes(page, page, true);\n\t} else {\n\t\tfor (i = 0; i < HPAGE_PMD_NR; i++)\n\t\t\tremove_migration_ptes(page + i, page + i, true);\n\t}\n}",
  10286. "project": "linux",
  10287. "hash": 328353852454119527778865378294198789825,
  10288. "size": 10,
  10289. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  10290. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  10291. "target": 0,
  10292. "dataset": "other",
  10293. "idx": 364149
  10294. },
  10295. {
  10296. "func": "static void unmap_page(struct page *page)\n{\n\tenum ttu_flags ttu_flags = TTU_IGNORE_MLOCK | TTU_IGNORE_ACCESS |\n\t\tTTU_RMAP_LOCKED | TTU_SPLIT_HUGE_PMD;\n\tbool unmap_success;\n\n\tVM_BUG_ON_PAGE(!PageHead(page), page);\n\n\tif (PageAnon(page))\n\t\tttu_flags |= TTU_SPLIT_FREEZE;\n\n\tunmap_success = try_to_unmap(page, ttu_flags);\n\tVM_BUG_ON_PAGE(!unmap_success, page);\n}",
  10297. "project": "linux",
  10298. "hash": 236597899933957575461287399877960079794,
  10299. "size": 14,
  10300. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  10301. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  10302. "target": 0,
  10303. "dataset": "other",
  10304. "idx": 364203
  10305. },
  10306. {
  10307. "func": "bool can_split_huge_page(struct page *page, int *pextra_pins)\n{\n\tint extra_pins;\n\n\t/* Additional pins from page cache */\n\tif (PageAnon(page))\n\t\textra_pins = PageSwapCache(page) ? HPAGE_PMD_NR : 0;\n\telse\n\t\textra_pins = HPAGE_PMD_NR;\n\tif (pextra_pins)\n\t\t*pextra_pins = extra_pins;\n\treturn total_mapcount(page) == page_count(page) - extra_pins - 1;\n}",
  10308. "project": "linux",
  10309. "hash": 141971627184867522201353591812467874831,
  10310. "size": 13,
  10311. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  10312. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  10313. "target": 0,
  10314. "dataset": "other",
  10315. "idx": 364147
  10316. },
  10317. {
  10318. "func": "int total_mapcount(struct page *page)\n{\n\tint i, compound, ret;\n\n\tVM_BUG_ON_PAGE(PageTail(page), page);\n\n\tif (likely(!PageCompound(page)))\n\t\treturn atomic_read(&page->_mapcount) + 1;\n\n\tcompound = compound_mapcount(page);\n\tif (PageHuge(page))\n\t\treturn compound;\n\tret = compound;\n\tfor (i = 0; i < HPAGE_PMD_NR; i++)\n\t\tret += atomic_read(&page[i]._mapcount) + 1;\n\t/* File pages has compound_mapcount included in _mapcount */\n\tif (!PageAnon(page))\n\t\treturn ret - compound * HPAGE_PMD_NR;\n\tif (PageDoubleMap(page))\n\t\tret -= HPAGE_PMD_NR;\n\treturn ret;\n}",
  10319. "project": "linux",
  10320. "hash": 308104722577897397154904188186847906736,
  10321. "size": 22,
  10322. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  10323. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  10324. "target": 0,
  10325. "dataset": "other",
  10326. "idx": 364159
  10327. },
  10328. {
  10329. "func": "static void __split_huge_page(struct page *page, struct list_head *list,\n\t\tpgoff_t end, unsigned long flags)\n{\n\tstruct page *head = compound_head(page);\n\tpg_data_t *pgdat = page_pgdat(head);\n\tstruct lruvec *lruvec;\n\tstruct address_space *swap_cache = NULL;\n\tunsigned long offset = 0;\n\tint i;\n\n\tlruvec = mem_cgroup_page_lruvec(head, pgdat);\n\n\t/* complete memcg works before add pages to LRU */\n\tmem_cgroup_split_huge_fixup(head);\n\n\tif (PageAnon(head) && PageSwapCache(head)) {\n\t\tswp_entry_t entry = { .val = page_private(head) };\n\n\t\toffset = swp_offset(entry);\n\t\tswap_cache = swap_address_space(entry);\n\t\txa_lock(&swap_cache->i_pages);\n\t}\n\n\tfor (i = HPAGE_PMD_NR - 1; i >= 1; i--) {\n\t\t__split_huge_page_tail(head, i, lruvec, list);\n\t\t/* Some pages can be beyond i_size: drop them from page cache */\n\t\tif (head[i].index >= end) {\n\t\t\tClearPageDirty(head + i);\n\t\t\t__delete_from_page_cache(head + i, NULL);\n\t\t\tif (IS_ENABLED(CONFIG_SHMEM) && PageSwapBacked(head))\n\t\t\t\tshmem_uncharge(head->mapping->host, 1);\n\t\t\tput_page(head + i);\n\t\t} else if (!PageAnon(page)) {\n\t\t\t__xa_store(&head->mapping->i_pages, head[i].index,\n\t\t\t\t\thead + i, 0);\n\t\t} else if (swap_cache) {\n\t\t\t__xa_store(&swap_cache->i_pages, offset + i,\n\t\t\t\t\thead + i, 0);\n\t\t}\n\t}\n\n\tClearPageCompound(head);\n\n\tsplit_page_owner(head, HPAGE_PMD_ORDER);\n\n\t/* See comment in __split_huge_page_tail() */\n\tif (PageAnon(head)) {\n\t\t/* Additional pin to swap cache */\n\t\tif (PageSwapCache(head)) {\n\t\t\tpage_ref_add(head, 2);\n\t\t\txa_unlock(&swap_cache->i_pages);\n\t\t} else {\n\t\t\tpage_ref_inc(head);\n\t\t}\n\t} else {\n\t\t/* Additional pin to page cache */\n\t\tpage_ref_add(head, 2);\n\t\txa_unlock(&head->mapping->i_pages);\n\t}\n\n\tspin_unlock_irqrestore(&pgdat->lru_lock, flags);\n\n\tremap_page(head);\n\n\tfor (i = 0; i < HPAGE_PMD_NR; i++) {\n\t\tstruct page *subpage = head + i;\n\t\tif (subpage == page)\n\t\t\tcontinue;\n\t\tunlock_page(subpage);\n\n\t\t/*\n\t\t * Subpages may be freed if there wasn't any mapping\n\t\t * like if add_to_swap() is running on a lru page that\n\t\t * had its mapping zapped. And freeing these pages\n\t\t * requires taking the lru_lock so we do the put_page\n\t\t * of the tail pages after the split is complete.\n\t\t */\n\t\tput_page(subpage);\n\t}\n}",
  10330. "project": "linux",
  10331. "hash": 54462104535713535047534862094541104810,
  10332. "size": 80,
  10333. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  10334. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  10335. "target": 0,
  10336. "dataset": "other",
  10337. "idx": 364143
  10338. },
  10339. {
  10340. "func": "static void __split_huge_page_tail(struct page *head, int tail,\n\t\tstruct lruvec *lruvec, struct list_head *list)\n{\n\tstruct page *page_tail = head + tail;\n\n\tVM_BUG_ON_PAGE(atomic_read(&page_tail->_mapcount) != -1, page_tail);\n\n\t/*\n\t * Clone page flags before unfreezing refcount.\n\t *\n\t * After successful get_page_unless_zero() might follow flags change,\n\t * for exmaple lock_page() which set PG_waiters.\n\t */\n\tpage_tail->flags &= ~PAGE_FLAGS_CHECK_AT_PREP;\n\tpage_tail->flags |= (head->flags &\n\t\t\t((1L << PG_referenced) |\n\t\t\t (1L << PG_swapbacked) |\n\t\t\t (1L << PG_swapcache) |\n\t\t\t (1L << PG_mlocked) |\n\t\t\t (1L << PG_uptodate) |\n\t\t\t (1L << PG_active) |\n\t\t\t (1L << PG_workingset) |\n\t\t\t (1L << PG_locked) |\n\t\t\t (1L << PG_unevictable) |\n\t\t\t (1L << PG_dirty)));\n\n\t/* ->mapping in first tail page is compound_mapcount */\n\tVM_BUG_ON_PAGE(tail > 2 && page_tail->mapping != TAIL_MAPPING,\n\t\t\tpage_tail);\n\tpage_tail->mapping = head->mapping;\n\tpage_tail->index = head->index + tail;\n\n\t/* Page flags must be visible before we make the page non-compound. */\n\tsmp_wmb();\n\n\t/*\n\t * Clear PageTail before unfreezing page refcount.\n\t *\n\t * After successful get_page_unless_zero() might follow put_page()\n\t * which needs correct compound_head().\n\t */\n\tclear_compound_head(page_tail);\n\n\t/* Finally unfreeze refcount. Additional reference from page cache. */\n\tpage_ref_unfreeze(page_tail, 1 + (!PageAnon(head) ||\n\t\t\t\t\t PageSwapCache(head)));\n\n\tif (page_is_young(head))\n\t\tset_page_young(page_tail);\n\tif (page_is_idle(head))\n\t\tset_page_idle(page_tail);\n\n\tpage_cpupid_xchg_last(page_tail, page_cpupid_last(head));\n\n\t/*\n\t * always add to the tail because some iterators expect new\n\t * pages to show after the currently processed elements - e.g.\n\t * migrate_pages\n\t */\n\tlru_add_page_tail(head, page_tail, lruvec, list);\n}",
  10341. "project": "linux",
  10342. "hash": 2690326593263460544583986949135098895,
  10343. "size": 61,
  10344. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  10345. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  10346. "target": 0,
  10347. "dataset": "other",
  10348. "idx": 364141
  10349. }
  10350. ]
  10351. },
  10352. {
  10353. "call_depth": 3,
  10354. "longest_call_chain": [
  10355. "crypto_cert_subject_alt_name",
  10356. "crypto_cert_get_dns_names",
  10357. "map_subject_alt_name"
  10358. ],
  10359. "group_size": 9,
  10360. "functions": [
  10361. {
  10362. "func": "static void string_list_free(string_list* list)\n{\n\t/* Note: we don't free the contents of the strings array: this */\n\t/* is handled by the caller, either by returning this */\n\t/* content, or freeing it itself. */\n\tfree(list->strings);\n}",
  10363. "project": "FreeRDP",
  10364. "hash": 20158190027491407816706054231332992893,
  10365. "size": 7,
  10366. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10367. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10368. "target": 0,
  10369. "dataset": "other",
  10370. "idx": 473463
  10371. },
  10372. {
  10373. "func": "char** crypto_cert_subject_alt_name(X509* xcert, int* count, int** lengths)\n{\n\treturn crypto_cert_get_dns_names(xcert, count, lengths);\n}",
  10374. "project": "FreeRDP",
  10375. "hash": 235926981249995151916963096847087020554,
  10376. "size": 4,
  10377. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10378. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10379. "target": 0,
  10380. "dataset": "other",
  10381. "idx": 473435
  10382. },
  10383. {
  10384. "func": "char* crypto_cert_get_email(X509* x509)\n{\n\tchar* result = 0;\n\tstring_list list;\n\tstring_list_initialize(&list);\n\tlist.maximum = 1;\n\tmap_subject_alt_name(x509, GEN_EMAIL, extract_string, &list);\n\n\tif (list.count == 0)\n\t{\n\t\tstring_list_free(&list);\n\t\treturn 0;\n\t}\n\n\tresult = _strdup(list.strings[0]);\n\tOPENSSL_free(list.strings[0]);\n\tstring_list_free(&list);\n\treturn result;\n}",
  10385. "project": "FreeRDP",
  10386. "hash": 247633492722307693841384954817032745149,
  10387. "size": 19,
  10388. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10389. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10390. "target": 0,
  10391. "dataset": "other",
  10392. "idx": 473444
  10393. },
  10394. {
  10395. "func": "char** crypto_cert_get_dns_names(X509* x509, int* count, int** lengths)\n{\n\tint i;\n\tchar** result = 0;\n\tstring_list list;\n\tstring_list_initialize(&list);\n\tmap_subject_alt_name(x509, GEN_DNS, extract_string, &list);\n\t(*count) = list.count;\n\n\tif (list.count == 0)\n\t{\n\t\tstring_list_free(&list);\n\t\treturn NULL;\n\t}\n\n\t/* lengths are not useful, since we converted the\n\t strings to utf-8, there cannot be nul-bytes in them. */\n\tresult = calloc(list.count, sizeof(*result));\n\t(*lengths) = calloc(list.count, sizeof(**lengths));\n\n\tif (!result || !(*lengths))\n\t{\n\t\tstring_list_free(&list);\n\t\tfree(result);\n\t\tfree(*lengths);\n\t\t(*lengths) = 0;\n\t\t(*count) = 0;\n\t\treturn NULL;\n\t}\n\n\tfor (i = 0; i < list.count; i++)\n\t{\n\t\tresult[i] = list.strings[i];\n\t\t(*lengths)[i] = strlen(result[i]);\n\t}\n\n\tstring_list_free(&list);\n\treturn result;\n}",
  10396. "project": "FreeRDP",
  10397. "hash": 127357553955080384520440557034728922314,
  10398. "size": 39,
  10399. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10400. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10401. "target": 0,
  10402. "dataset": "other",
  10403. "idx": 473459
  10404. },
  10405. {
  10406. "func": "static void object_list_free(object_list* list)\n{\n\tfree(list->strings);\n}",
  10407. "project": "FreeRDP",
  10408. "hash": 28704612906556058015576774120980914238,
  10409. "size": 4,
  10410. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10411. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10412. "target": 0,
  10413. "dataset": "other",
  10414. "idx": 473446
  10415. },
  10416. {
  10417. "func": "static void object_list_initialize(object_list* list)\n{\n\tlist->type_id = 0;\n\tlist->strings = 0;\n\tlist->allocated = 0;\n\tlist->count = 0;\n\tlist->maximum = INT_MAX;\n}",
  10418. "project": "FreeRDP",
  10419. "hash": 59543420300543247513210246478172196410,
  10420. "size": 8,
  10421. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10422. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10423. "target": 0,
  10424. "dataset": "other",
  10425. "idx": 473448
  10426. },
  10427. {
  10428. "func": "char* crypto_cert_get_upn(X509* x509)\n{\n\tchar* result = 0;\n\tobject_list list;\n\tobject_list_initialize(&list);\n\tlist.type_id = OBJ_nid2obj(NID_ms_upn);\n\tlist.maximum = 1;\n\tmap_subject_alt_name(x509, GEN_OTHERNAME, extract_othername_object_as_string, &list);\n\n\tif (list.count == 0)\n\t{\n\t\tobject_list_free(&list);\n\t\treturn 0;\n\t}\n\n\tresult = list.strings[0];\n\tobject_list_free(&list);\n\treturn result;\n}",
  10429. "project": "FreeRDP",
  10430. "hash": 131707778683960650442173647907339765906,
  10431. "size": 19,
  10432. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10433. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10434. "target": 0,
  10435. "dataset": "other",
  10436. "idx": 473429
  10437. },
  10438. {
  10439. "func": "static void map_subject_alt_name(X509* x509, int general_name_type, general_name_mapper_pr mapper,\n void* data)\n{\n\tint i;\n\tint num;\n\tSTACK_OF(GENERAL_NAME) * gens;\n\tgens = X509_get_ext_d2i(x509, NID_subject_alt_name, NULL, NULL);\n\n\tif (!gens)\n\t{\n\t\treturn;\n\t}\n\n\tnum = sk_GENERAL_NAME_num(gens);\n\n\tfor (i = 0; (i < num); i++)\n\t{\n\t\tGENERAL_NAME* name = sk_GENERAL_NAME_value(gens, i);\n\n\t\tif (name)\n\t\t{\n\t\t\tif ((general_name_type == GEN_ALL) || (general_name_type == name->type))\n\t\t\t{\n\t\t\t\tif (!mapper(name, data, i, num))\n\t\t\t\t{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tsk_GENERAL_NAME_pop_free(gens, GENERAL_NAME_free);\n}",
  10440. "project": "FreeRDP",
  10441. "hash": 271668920065952351661408059748404248540,
  10442. "size": 33,
  10443. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10444. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10445. "target": 0,
  10446. "dataset": "other",
  10447. "idx": 473436
  10448. },
  10449. {
  10450. "func": "static void string_list_initialize(string_list* list)\n{\n\tlist->strings = 0;\n\tlist->allocated = 0;\n\tlist->count = 0;\n\tlist->maximum = INT_MAX;\n}",
  10451. "project": "FreeRDP",
  10452. "hash": 14901682138334002996032361485040202584,
  10453. "size": 7,
  10454. "commit_id": "8305349a943c68b1bc8c158f431dc607655aadea",
  10455. "message": "Fixed GHSL-2020-102 heap overflow\n\n(cherry picked from commit 197b16cc15a12813c2e4fa2d6ae9cd9c4a57e581)",
  10456. "target": 0,
  10457. "dataset": "other",
  10458. "idx": 473445
  10459. }
  10460. ]
  10461. },
  10462. {
  10463. "call_depth": 3,
  10464. "longest_call_chain": [
  10465. "php_mysqlnd_auth_write",
  10466. "int4store",
  10467. "ma_simple_command"
  10468. ],
  10469. "group_size": 20,
  10470. "functions": [
  10471. {
  10472. "func": "static void free_old_query(MYSQL *mysql)\n{\n if (mysql->fields)\n ma_free_root(&mysql->field_alloc,MYF(0));\n ma_init_alloc_root(&mysql->field_alloc,8192,0);\t/* Assume rowlength < 8192 */\n mysql->fields=0;\n mysql->field_count=0;\t\t\t\t/* For API */\n mysql->info= 0;\n return;\n}",
  10473. "project": "mariadb-connector-c",
  10474. "hash": 195053718545900700720798038659972477263,
  10475. "size": 10,
  10476. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10477. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10478. "target": 0,
  10479. "dataset": "other",
  10480. "idx": 429685
  10481. },
  10482. {
  10483. "func": "mysql_list_processes(MYSQL *mysql)\n{\n MYSQL_DATA *fields;\n uint field_count;\n uchar *pos;\n\n LINT_INIT(fields);\n if (ma_simple_command(mysql, COM_PROCESS_INFO,0,0,0,0))\n return(NULL);\n free_old_query(mysql);\n pos=(uchar*) mysql->net.read_pos;\n field_count=(uint) net_field_length(&pos);\n if (!(fields = mysql->methods->db_read_rows(mysql,(MYSQL_FIELD*) 0,7)))\n return(NULL);\n if (!(mysql->fields= unpack_fields(mysql, fields, &mysql->field_alloc,\n field_count, 0)))\n return(NULL);\n mysql->status=MYSQL_STATUS_GET_RESULT;\n mysql->field_count=field_count;\n return(mysql_store_result(mysql));\n}",
  10484. "project": "mariadb-connector-c",
  10485. "hash": 98516357705314590439017840525578099956,
  10486. "size": 21,
  10487. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10488. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10489. "target": 0,
  10490. "dataset": "other",
  10491. "idx": 429689
  10492. },
  10493. {
  10494. "func": "mysql_list_fields(MYSQL *mysql, const char *table, const char *wild)\n{\n MYSQL_RES *result;\n MYSQL_DATA *query;\n char buff[255];\n int length= 0;\n\n LINT_INIT(query);\n\n length= snprintf(buff, 128, \"%s%c%s\", table, '\\0', wild ? wild : \"\");\n\n if (ma_simple_command(mysql, COM_FIELD_LIST,buff,length,1,0) ||\n !(query = mysql->methods->db_read_rows(mysql,(MYSQL_FIELD*) 0,\n ma_result_set_rows(mysql))))\n return(NULL);\n\n free_old_query(mysql);\n if (!(result = (MYSQL_RES *) calloc(1, sizeof(MYSQL_RES))))\n {\n free_rows(query);\n return(NULL);\n }\n result->field_alloc=mysql->field_alloc;\n mysql->fields=0;\n result->eof=1;\n result->field_count = (uint) query->rows;\n result->fields= unpack_fields(mysql, query, &result->field_alloc,\n\t\t\t\tresult->field_count, 1);\n if (result->fields)\n return(result);\n\n free(result);\n return(NULL);\n}",
  10495. "project": "mariadb-connector-c",
  10496. "hash": 78321946657412755555703489205711967441,
  10497. "size": 34,
  10498. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10499. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10500. "target": 0,
  10501. "dataset": "other",
  10502. "idx": 429706
  10503. },
  10504. {
  10505. "func": "void mysql_close_slow_part(MYSQL *mysql)\n{\n if (mysql->net.pvio)\n {\n free_old_query(mysql);\n mysql->status=MYSQL_STATUS_READY; /* Force command */\n mysql->options.reconnect=0;\n if (mysql->net.pvio && mysql->net.buff)\n ma_simple_command(mysql, COM_QUIT,NullS,0,1,0);\n end_server(mysql);\n }\n}",
  10506. "project": "mariadb-connector-c",
  10507. "hash": 328234525684634752151361164166232750681,
  10508. "size": 12,
  10509. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10510. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10511. "target": 0,
  10512. "dataset": "other",
  10513. "idx": 429662
  10514. },
  10515. {
  10516. "func": "int mthd_my_read_query_result(MYSQL *mysql)\n{\n uchar *pos;\n ulong field_count;\n MYSQL_DATA *fields;\n ulong length;\n my_bool can_local_infile= (mysql->options.extension) && (mysql->extension->auto_local_infile != WAIT_FOR_QUERY);\n\n if (mysql->options.extension && mysql->extension->auto_local_infile == ACCEPT_FILE_REQUEST)\n mysql->extension->auto_local_infile= WAIT_FOR_QUERY;\n\n if ((length = ma_net_safe_read(mysql)) == packet_error)\n {\n return(1);\n }\n free_old_query(mysql);\t\t\t/* Free old result */\nget_info:\n pos=(uchar*) mysql->net.read_pos;\n if ((field_count= net_field_length(&pos)) == 0)\n return ma_read_ok_packet(mysql, pos, length);\n if (field_count == NULL_LENGTH)\t\t/* LOAD DATA LOCAL INFILE */\n {\n int error=mysql_handle_local_infile(mysql, (char *)pos, can_local_infile);\n\n if ((length=ma_net_safe_read(mysql)) == packet_error || error)\n return(-1);\n goto get_info;\t\t\t\t/* Get info packet */\n }\n if (!(mysql->server_status & SERVER_STATUS_AUTOCOMMIT))\n mysql->server_status|= SERVER_STATUS_IN_TRANS;\n\n mysql->extra_info= net_field_length_ll(&pos); /* Maybe number of rec */\n if (!(fields=mysql->methods->db_read_rows(mysql,(MYSQL_FIELD*) 0,\n ma_result_set_rows(mysql))))\n return(-1);\n if (!(mysql->fields=unpack_fields(mysql, fields, &mysql->field_alloc,\n\t\t\t\t (uint) field_count, 1)))\n return(-1);\n mysql->status=MYSQL_STATUS_GET_RESULT;\n mysql->field_count=field_count;\n return(0);\n}",
  10517. "project": "mariadb-connector-c",
  10518. "hash": 42436805830013062947087346614678831156,
  10519. "size": 42,
  10520. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10521. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10522. "target": 0,
  10523. "dataset": "other",
  10524. "idx": 429680
  10525. },
  10526. {
  10527. "func": "size_t \nphp_mysqlnd_net_store_length_size(uint64_t length)\n{\n\tif (length < (uint64_t) L64(251)) {\n\t\treturn 1;\n\t}\n\tif (length < (uint64_t) L64(65536)) {\n\t\treturn 3;\n\t}\n\tif (length < (uint64_t) L64(16777216)) {\n\t\treturn 4;\n\t}\n\treturn 9;",
  10528. "project": "php-src",
  10529. "hash": 102147847470215060372303924479382086507,
  10530. "size": 13,
  10531. "commit_id": "28f80baf3c53e267c9ce46a2a0fadbb981585132",
  10532. "message": "Fix bug #72293 - Heap overflow in mysqlnd related to BIT fields",
  10533. "target": 0,
  10534. "dataset": "other",
  10535. "idx": 416655
  10536. },
  10537. {
  10538. "func": "int STDCALL mysql_reset_connection(MYSQL *mysql)\n{\n int rc;\n\n /* check if connection handler is active */\n if (IS_CONNHDLR_ACTIVE(mysql))\n {\n if (mysql->extension->conn_hdlr->plugin && mysql->extension->conn_hdlr->plugin->reset)\n return(mysql->extension->conn_hdlr->plugin->reset(mysql));\n }\n\n /* skip result sets */\n if (mysql->status == MYSQL_STATUS_USE_RESULT ||\n mysql->status == MYSQL_STATUS_GET_RESULT ||\n mysql->status & SERVER_MORE_RESULTS_EXIST)\n {\n mthd_my_skip_result(mysql);\n mysql->status= MYSQL_STATUS_READY;\n }\n\n rc= ma_simple_command(mysql, COM_RESET_CONNECTION, 0, 0, 0, 0);\n if (rc && mysql->options.reconnect)\n {\n /* There is no big sense in resetting but we need reconnect */\n rc= ma_simple_command(mysql, COM_RESET_CONNECTION,0,0,0,0);\n }\n if (rc)\n return 1;\n\n /* reset the connection in all active statements */\n ma_invalidate_stmts(mysql, \"mysql_reset_connection()\");\n free_old_query(mysql);\n mysql->status= MYSQL_STATUS_READY;\n mysql->affected_rows= ~(my_ulonglong)0;\n mysql->insert_id= 0;\n return 0;\n}",
  10539. "project": "mariadb-connector-c",
  10540. "hash": 275860702094216651498698710865916158386,
  10541. "size": 37,
  10542. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10543. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10544. "target": 0,
  10545. "dataset": "other",
  10546. "idx": 429749
  10547. },
  10548. {
  10549. "func": "int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length)\n{\n size_t item_len;\n mysql->affected_rows= net_field_length_ll(&pos);\n mysql->insert_id=\t net_field_length_ll(&pos);\n mysql->server_status=uint2korr(pos);\n pos+=2;\n mysql->warning_count=uint2korr(pos);\n pos+=2;\n if (pos < mysql->net.read_pos+length)\n {\n if ((item_len= net_field_length(&pos)))\n mysql->info=(char*) pos;\n\n /* check if server supports session tracking */\n if (mysql->server_capabilities & CLIENT_SESSION_TRACKING)\n {\n ma_clear_session_state(mysql);\n pos+= item_len;\n\n if (mysql->server_status & SERVER_SESSION_STATE_CHANGED)\n {\n int i;\n if (pos < mysql->net.read_pos + length)\n {\n LIST *session_item;\n MYSQL_LEX_STRING *str= NULL;\n enum enum_session_state_type si_type;\n uchar *old_pos= pos;\n size_t item_len= net_field_length(&pos); /* length for all items */\n\n /* length was already set, so make sure that info will be zero terminated */\n if (mysql->info)\n *old_pos= 0;\n\n while (item_len > 0)\n {\n size_t plen;\n char *data;\n old_pos= pos;\n si_type= (enum enum_session_state_type)net_field_length(&pos);\n switch(si_type) {\n case SESSION_TRACK_SCHEMA:\n case SESSION_TRACK_STATE_CHANGE:\n case SESSION_TRACK_TRANSACTION_CHARACTERISTICS:\n case SESSION_TRACK_SYSTEM_VARIABLES:\n if (si_type != SESSION_TRACK_STATE_CHANGE)\n net_field_length(&pos); /* ignore total length, item length will follow next */\n plen= net_field_length(&pos);\n if (!(session_item= ma_multi_malloc(0,\n &session_item, sizeof(LIST),\n &str, sizeof(MYSQL_LEX_STRING),\n &data, plen,\n NULL)))\n {\n ma_clear_session_state(mysql);\n SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);\n return -1;\n }\n str->length= plen;\n str->str= data;\n memcpy(str->str, (char *)pos, plen);\n pos+= plen;\n session_item->data= str;\n mysql->extension->session_state[si_type].list= list_add(mysql->extension->session_state[si_type].list, session_item);\n\n /* in case schema has changed, we have to update mysql->db */\n if (si_type == SESSION_TRACK_SCHEMA)\n {\n free(mysql->db);\n mysql->db= malloc(plen + 1);\n memcpy(mysql->db, str->str, plen);\n mysql->db[plen]= 0;\n }\n else if (si_type == SESSION_TRACK_SYSTEM_VARIABLES)\n {\n my_bool set_charset= 0;\n /* make sure that we update charset in case it has changed */\n if (!strncmp(str->str, \"character_set_client\", str->length))\n set_charset= 1;\n plen= net_field_length(&pos);\n if (!(session_item= ma_multi_malloc(0,\n &session_item, sizeof(LIST),\n &str, sizeof(MYSQL_LEX_STRING),\n &data, plen,\n NULL)))\n {\n ma_clear_session_state(mysql);\n SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);\n return -1;\n }\n str->length= plen;\n str->str= data;\n memcpy(str->str, (char *)pos, plen);\n pos+= plen;\n session_item->data= str;\n mysql->extension->session_state[si_type].list= list_add(mysql->extension->session_state[si_type].list, session_item);\n if (set_charset &&\n strncmp(mysql->charset->csname, str->str, str->length) != 0)\n {\n char cs_name[64];\n MARIADB_CHARSET_INFO *cs_info;\n memcpy(cs_name, str->str, str->length);\n cs_name[str->length]= 0;\n if ((cs_info = (MARIADB_CHARSET_INFO *)mysql_find_charset_name(cs_name)))\n mysql->charset= cs_info;\n }\n }\n break;\n default:\n /* not supported yet */\n plen= net_field_length(&pos);\n pos+= plen;\n break;\n }\n item_len-= (pos - old_pos);\n }\n }\n for (i= SESSION_TRACK_BEGIN; i <= SESSION_TRACK_END; i++)\n {\n mysql->extension->session_state[i].list= list_reverse(mysql->extension->session_state[i].list);\n mysql->extension->session_state[i].current= mysql->extension->session_state[i].list;\n }\n }\n }\n }\n /* CONC-351: clear session state information */\n else if (mysql->server_capabilities & CLIENT_SESSION_TRACKING)\n ma_clear_session_state(mysql);\n return(0);\n}",
  10550. "project": "mariadb-connector-c",
  10551. "hash": 76318025094495661937304907006689356074,
  10552. "size": 131,
  10553. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10554. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10555. "target": 1,
  10556. "dataset": "other",
  10557. "idx": 210193
  10558. },
  10559. {
  10560. "func": "int ma_read_ok_packet(MYSQL *mysql, uchar *pos, ulong length)\n{\n uchar *end= mysql->net.read_pos+length;\n size_t item_len;\n mysql->affected_rows= net_field_length_ll(&pos);\n mysql->insert_id=\t net_field_length_ll(&pos);\n mysql->server_status=uint2korr(pos);\n pos+=2;\n mysql->warning_count=uint2korr(pos);\n pos+=2;\n if (pos > end)\n goto corrupted;\n if (pos < end)\n {\n if ((item_len= net_field_length(&pos)))\n mysql->info=(char*) pos;\n if (pos + item_len > end)\n goto corrupted;\n\n /* check if server supports session tracking */\n if (mysql->server_capabilities & CLIENT_SESSION_TRACKING)\n {\n ma_clear_session_state(mysql);\n pos+= item_len;\n\n if (mysql->server_status & SERVER_SESSION_STATE_CHANGED)\n {\n int i;\n if (pos < end)\n {\n LIST *session_item;\n MYSQL_LEX_STRING *str= NULL;\n enum enum_session_state_type si_type;\n uchar *old_pos= pos;\n\n item_len= net_field_length(&pos); /* length for all items */\n if (pos + item_len > end)\n goto corrupted;\n end= pos + item_len;\n\n /* length was already set, so make sure that info will be zero terminated */\n if (mysql->info)\n *old_pos= 0;\n\n while (pos < end)\n {\n size_t plen;\n char *data;\n si_type= (enum enum_session_state_type)net_field_length(&pos);\n switch(si_type) {\n case SESSION_TRACK_SCHEMA:\n case SESSION_TRACK_STATE_CHANGE:\n case SESSION_TRACK_TRANSACTION_CHARACTERISTICS:\n case SESSION_TRACK_SYSTEM_VARIABLES:\n if (si_type != SESSION_TRACK_STATE_CHANGE)\n net_field_length(&pos); /* ignore total length, item length will follow next */\n plen= net_field_length(&pos);\n if (pos + plen > end)\n goto corrupted;\n if (!(session_item= ma_multi_malloc(0,\n &session_item, sizeof(LIST),\n &str, sizeof(MYSQL_LEX_STRING),\n &data, plen,\n NULL)))\n goto oom;\n str->length= plen;\n str->str= data;\n memcpy(str->str, (char *)pos, plen);\n pos+= plen;\n session_item->data= str;\n mysql->extension->session_state[si_type].list= list_add(mysql->extension->session_state[si_type].list, session_item);\n\n /* in case schema has changed, we have to update mysql->db */\n if (si_type == SESSION_TRACK_SCHEMA)\n {\n free(mysql->db);\n mysql->db= malloc(plen + 1);\n memcpy(mysql->db, str->str, plen);\n mysql->db[plen]= 0;\n }\n else if (si_type == SESSION_TRACK_SYSTEM_VARIABLES)\n {\n my_bool set_charset= 0;\n /* make sure that we update charset in case it has changed */\n if (!strncmp(str->str, \"character_set_client\", str->length))\n set_charset= 1;\n plen= net_field_length(&pos);\n if (pos + plen > end)\n goto corrupted;\n if (!(session_item= ma_multi_malloc(0,\n &session_item, sizeof(LIST),\n &str, sizeof(MYSQL_LEX_STRING),\n &data, plen,\n NULL)))\n goto oom;\n str->length= plen;\n str->str= data;\n memcpy(str->str, (char *)pos, plen);\n pos+= plen;\n session_item->data= str;\n mysql->extension->session_state[si_type].list= list_add(mysql->extension->session_state[si_type].list, session_item);\n if (set_charset && str->length < CHARSET_NAME_LEN &&\n strncmp(mysql->charset->csname, str->str, str->length) != 0)\n {\n char cs_name[CHARSET_NAME_LEN];\n const MARIADB_CHARSET_INFO *cs_info;\n memcpy(cs_name, str->str, str->length);\n cs_name[str->length]= 0;\n if ((cs_info = mysql_find_charset_name(cs_name)))\n mysql->charset= cs_info;\n }\n }\n break;\n default:\n /* not supported yet */\n plen= net_field_length(&pos);\n if (pos + plen > end)\n goto corrupted;\n pos+= plen;\n break;\n }\n }\n }\n for (i= SESSION_TRACK_BEGIN; i <= SESSION_TRACK_END; i++)\n {\n mysql->extension->session_state[i].list= list_reverse(mysql->extension->session_state[i].list);\n mysql->extension->session_state[i].current= mysql->extension->session_state[i].list;\n }\n }\n }\n }\n /* CONC-351: clear session state information */\n else if (mysql->server_capabilities & CLIENT_SESSION_TRACKING)\n ma_clear_session_state(mysql);\n return(0);\n\noom:\n ma_clear_session_state(mysql);\n SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);\n return -1;\n\ncorrupted:\n ma_clear_session_state(mysql);\n SET_CLIENT_ERROR(mysql, CR_MALFORMED_PACKET, SQLSTATE_UNKNOWN, 0);\n return -1;\n}",
  10561. "project": "mariadb-connector-c",
  10562. "hash": 291866632911754157865017334546963738553,
  10563. "size": 146,
  10564. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10565. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10566. "target": 0,
  10567. "dataset": "other",
  10568. "idx": 429686
  10569. },
  10570. {
  10571. "func": "void free_rows(MYSQL_DATA *cur)\n{\n if (cur)\n {\n ma_free_root(&cur->alloc,MYF(0));\n free(cur);\n }\n}",
  10572. "project": "mariadb-connector-c",
  10573. "hash": 198962061977167570955232814236589623806,
  10574. "size": 8,
  10575. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10576. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10577. "target": 0,
  10578. "dataset": "other",
  10579. "idx": 429684
  10580. },
  10581. {
  10582. "func": "void mthd_my_skip_result(MYSQL *mysql)\n{\n ulong pkt_len;\n\n do {\n pkt_len= ma_net_safe_read(mysql);\n if (pkt_len == packet_error)\n break;\n } while (pkt_len > 8 || mysql->net.read_pos[0] != 254);\n return;\n}",
  10583. "project": "mariadb-connector-c",
  10584. "hash": 203101374464425645101501422159724336895,
  10585. "size": 11,
  10586. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10587. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10588. "target": 0,
  10589. "dataset": "other",
  10590. "idx": 429733
  10591. },
  10592. {
  10593. "func": "mysql_send_query(MYSQL* mysql, const char* query, unsigned long length)\n{\n return ma_simple_command(mysql, COM_QUERY, query, length, 1,0);\n}",
  10594. "project": "mariadb-connector-c",
  10595. "hash": 67441807333904927140051531001455467892,
  10596. "size": 4,
  10597. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10598. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10599. "target": 0,
  10600. "dataset": "other",
  10601. "idx": 429649
  10602. },
  10603. {
  10604. "func": "mysql_kill(MYSQL *mysql,ulong pid)\n{\n char buff[12];\n int4store(buff,pid);\n /* if we kill our own thread, reading the response packet will fail */\n return(ma_simple_command(mysql, COM_PROCESS_KILL,buff,4,0,0));\n}",
  10605. "project": "mariadb-connector-c",
  10606. "hash": 174321311947773430030587123772710182159,
  10607. "size": 7,
  10608. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10609. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10610. "target": 0,
  10611. "dataset": "other",
  10612. "idx": 429664
  10613. },
  10614. {
  10615. "func": "my_bool\tSTDCALL mysql_change_user(MYSQL *mysql, const char *user,\n\t\t\t\t const char *passwd, const char *db)\n{\n const MARIADB_CHARSET_INFO *s_cs= mysql->charset;\n char *s_user= mysql->user,\n *s_passwd= mysql->passwd,\n *s_db= mysql->db;\n int rc;\n\n if (mysql->options.charset_name)\n mysql->charset= mysql_find_charset_name(mysql->options.charset_name);\n else\n mysql->charset=mysql_find_charset_name(MARIADB_DEFAULT_CHARSET);\n\n mysql->user= strdup(user ? user : \"\");\n mysql->passwd= strdup(passwd ? passwd : \"\");\n\n /* db will be set in run_plugin_auth */\n mysql->db= 0;\n rc= run_plugin_auth(mysql, 0, 0, 0, db);\n\n /* COM_CHANGE_USER always releases prepared statements, so we need to invalidate them */\n ma_invalidate_stmts(mysql, \"mysql_change_user()\");\n\n if (rc==0)\n {\n free(s_user);\n free(s_passwd);\n free(s_db);\n\n if (!mysql->db && db && !(mysql->db= strdup(db)))\n {\n SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0);\n rc= 1;\n }\n } else\n {\n free(mysql->user);\n free(mysql->passwd);\n free(mysql->db);\n\n mysql->user= s_user;\n mysql->passwd= s_passwd;\n mysql->db= s_db;\n mysql->charset= s_cs;\n }\n return(rc);\n}",
  10616. "project": "mariadb-connector-c",
  10617. "hash": 188984189105226255617793815371802728528,
  10618. "size": 48,
  10619. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10620. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10621. "target": 0,
  10622. "dataset": "other",
  10623. "idx": 429735
  10624. },
  10625. {
  10626. "func": "static\nsize_t php_mysqlnd_auth_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)\n{\n\tzend_uchar buffer[AUTH_WRITE_BUFFER_LEN];\n\tzend_uchar *p = buffer + MYSQLND_HEADER_SIZE; /* start after the header */\n\tint len;\n\tMYSQLND_PACKET_AUTH * packet= (MYSQLND_PACKET_AUTH *) _packet;\n\n\tDBG_ENTER(\"php_mysqlnd_auth_write\");\n\n\tif (!packet->is_change_user_packet) {\n\t\tint4store(p, packet->client_flags);\n\t\tp+= 4;\n\n\t\tint4store(p, packet->max_packet_size);\n\t\tp+= 4;\n\n\t\tint1store(p, packet->charset_no);\n\t\tp++;\n\n\t\tmemset(p, 0, 23); /* filler */\n\t\tp+= 23;\n\t}\n\n\tif (packet->send_auth_data || packet->is_change_user_packet) {\n\t\tlen = MIN(strlen(packet->user), MYSQLND_MAX_ALLOWED_USER_LEN);\n\t\tmemcpy(p, packet->user, len);\n\t\tp+= len;\n\t\t*p++ = '\\0';\n\n\t\t/* defensive coding */\n\t\tif (packet->auth_data == NULL) {\n\t\t\tpacket->auth_data_len = 0;\n\t\t}\n\t\tif (packet->auth_data_len > 0xFF) {\n\t\t\tconst char * const msg = \"Authentication data too long. \"\n\t\t\t\t\"Won't fit into the buffer and will be truncated. Authentication will thus fail\";\n\t\t\tSET_CLIENT_ERROR(*conn->error_info, CR_UNKNOWN_ERROR, UNKNOWN_SQLSTATE, msg);\n\t\t\tphp_error_docref(NULL TSRMLS_CC, E_WARNING, \"%s\", msg);\n\t\t\tDBG_RETURN(0);\n\t\t}\t\t\n\t\t\n\t\tint1store(p, packet->auth_data_len);\n\t\t++p;\n/*!!!!! is the buffer big enough ??? */\n\t\tif ((sizeof(buffer) - (p - buffer)) < packet->auth_data_len) {\n\t\t\tDBG_ERR(\"the stack buffer was not enough!!\");\n\t\t\tDBG_RETURN(0);\n\t\t}\n\t\tif (packet->auth_data_len) {\n\t\t\tmemcpy(p, packet->auth_data, packet->auth_data_len);\n\t\t\tp+= packet->auth_data_len;\n\t\t}\n\n\t\tif (packet->db) {\n\t\t\t/* CLIENT_CONNECT_WITH_DB should have been set */\n\t\t\tsize_t real_db_len = MIN(MYSQLND_MAX_ALLOWED_DB_LEN, packet->db_len);\n\t\t\tmemcpy(p, packet->db, real_db_len);\n\t\t\tp+= real_db_len;\n\t\t\t*p++= '\\0';\n\t\t} else if (packet->is_change_user_packet) {\n\t\t\t*p++= '\\0';\t\t\n\t\t}\n\t\t/* no \\0 for no DB */\n\n\t\tif (packet->is_change_user_packet) {\n\t\t\tif (packet->charset_no) {\n\t\t\t\tint2store(p, packet->charset_no);\n\t\t\t\tp+= 2;\n\t\t\t}\n\t\t}\n\t\t\n\t\tif (packet->auth_plugin_name) {\n\t\t\tsize_t len = MIN(strlen(packet->auth_plugin_name), sizeof(buffer) - (p - buffer) - 1);\n\t\t\tmemcpy(p, packet->auth_plugin_name, len);\n\t\t\tp+= len;\n\t\t\t*p++= '\\0';\n\t\t}\n\n\t\tif (packet->connect_attr && zend_hash_num_elements(packet->connect_attr)) {\n\t\t\tHashPosition pos_value;\n\t\t\tconst char ** entry_value;\n\t\t\tsize_t ca_payload_len = 0;\n\t\t\tzend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value);\n\t\t\twhile (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {\n\t\t\t\tchar *s_key;\n\t\t\t\tunsigned int s_len;\n\t\t\t\tunsigned long num_key;\n\t\t\t\tsize_t value_len = strlen(*entry_value);\n\t\t\t\t\n\t\t\t\tif (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {\n\t\t\t\t\tca_payload_len += php_mysqlnd_net_store_length_size(s_len);\n\t\t\t\t\tca_payload_len += s_len;\n\t\t\t\t\tca_payload_len += php_mysqlnd_net_store_length_size(value_len);\n\t\t\t\t\tca_payload_len += value_len;\n\t\t\t\t}\n\t\t\t\tzend_hash_move_forward_ex(conn->options->connect_attr, &pos_value);\n\t\t\t}\n\n\t\t\tif ((sizeof(buffer) - (p - buffer)) >= (ca_payload_len + php_mysqlnd_net_store_length_size(ca_payload_len))) {\n\t\t\t\tp = php_mysqlnd_net_store_length(p, ca_payload_len);\n\n\t\t\t\tzend_hash_internal_pointer_reset_ex(packet->connect_attr, &pos_value);\n\t\t\t\twhile (SUCCESS == zend_hash_get_current_data_ex(packet->connect_attr, (void **)&entry_value, &pos_value)) {\n\t\t\t\t\tchar *s_key;\n\t\t\t\t\tunsigned int s_len;\n\t\t\t\t\tunsigned long num_key;\n\t\t\t\t\tsize_t value_len = strlen(*entry_value);\n\t\t\t\t\tif (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(packet->connect_attr, &s_key, &s_len, &num_key, 0, &pos_value)) {\n\t\t\t\t\t\t/* copy key */\n\t\t\t\t\t\tp = php_mysqlnd_net_store_length(p, s_len);\n\t\t\t\t\t\tmemcpy(p, s_key, s_len);\n\t\t\t\t\t\tp+= s_len;\n\t\t\t\t\t\t/* copy value */\n\t\t\t\t\t\tp = php_mysqlnd_net_store_length(p, value_len);\n\t\t\t\t\t\tmemcpy(p, *entry_value, value_len);\n\t\t\t\t\t\tp+= value_len;\n\t\t\t\t\t}\n\t\t\t\t\tzend_hash_move_forward_ex(conn->options->connect_attr, &pos_value);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\t/* cannot put the data - skip */\n\t\t\t}\n\t\t}\n\t}\n\tif (packet->is_change_user_packet) {\n\t\tif (PASS != conn->m->simple_command(conn, COM_CHANGE_USER, buffer + MYSQLND_HEADER_SIZE, p - buffer - MYSQLND_HEADER_SIZE,\n\t\t\t\t\t\t\t\t\t\t PROT_LAST /* the caller will handle the OK packet */,\n\t\t\t\t\t\t\t\t\t\t packet->silent, TRUE TSRMLS_CC)) {\n\t\t\tDBG_RETURN(0);\n\t\t}\n\t\tDBG_RETURN(p - buffer - MYSQLND_HEADER_SIZE);\n\t} else {\n\t\tsize_t sent = conn->net->data->m.send_ex(conn->net, buffer, p - buffer - MYSQLND_HEADER_SIZE, conn->stats, conn->error_info TSRMLS_CC);\n\t\tif (!sent) {\n\t\t\tCONN_SET_STATE(conn, CONN_QUIT_SENT);\n\t\t}\n\t\tDBG_RETURN(sent);\n\t}",
  10627. "project": "php-src",
  10628. "hash": 114075198024963005465621442961939471180,
  10629. "size": 139,
  10630. "commit_id": "28f80baf3c53e267c9ce46a2a0fadbb981585132",
  10631. "message": "Fix bug #72293 - Heap overflow in mysqlnd related to BIT fields",
  10632. "target": 0,
  10633. "dataset": "other",
  10634. "idx": 416678
  10635. },
  10636. {
  10637. "func": "void ma_invalidate_stmts(MYSQL *mysql, const char *function_name)\n{\n if (mysql->stmts)\n {\n LIST *li_stmt= mysql->stmts;\n\n for (; li_stmt; li_stmt= li_stmt->next)\n {\n MYSQL_STMT *stmt= (MYSQL_STMT *)li_stmt->data;\n stmt->mysql= NULL;\n SET_CLIENT_STMT_ERROR(stmt, CR_STMT_CLOSED, SQLSTATE_UNKNOWN, function_name);\n }\n mysql->stmts= NULL;\n }\n}",
  10638. "project": "mariadb-connector-c",
  10639. "hash": 53182753541168920515190393586156322279,
  10640. "size": 15,
  10641. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10642. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10643. "target": 0,
  10644. "dataset": "other",
  10645. "idx": 429693
  10646. },
  10647. {
  10648. "func": "static void ma_clear_session_state(MYSQL *mysql)\n{\n uint i;\n\n if (!mysql || !mysql->extension)\n return;\n\n for (i= SESSION_TRACK_BEGIN; i <= SESSION_TRACK_END; i++)\n {\n list_free(mysql->extension->session_state[i].list, 0);\n }\n memset(mysql->extension->session_state, 0, sizeof(struct st_mariadb_session_state) * SESSION_TRACK_TYPES);\n}",
  10649. "project": "mariadb-connector-c",
  10650. "hash": 203907896303212000940535036812864321229,
  10651. "size": 13,
  10652. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10653. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10654. "target": 0,
  10655. "dataset": "other",
  10656. "idx": 429677
  10657. },
  10658. {
  10659. "func": "zend_uchar *\nphp_mysqlnd_net_store_length(zend_uchar *packet, uint64_t length)\n{\n\tif (length < (uint64_t) L64(251)) {\n\t\t*packet = (zend_uchar) length;\n\t\treturn packet + 1;\n\t}\n\n\tif (length < (uint64_t) L64(65536)) {\n\t\t*packet++ = 252;\n\t\tint2store(packet,(unsigned int) length);\n\t\treturn packet + 2;\n\t}\n\n\tif (length < (uint64_t) L64(16777216)) {\n\t\t*packet++ = 253;\n\t\tint3store(packet,(ulong) length);\n\t\treturn packet + 3;\n\t}\n\t*packet++ = 254;\n\tint8store(packet, length);\n\treturn packet + 8;",
  10660. "project": "php-src",
  10661. "hash": 111815171582436517996243548500835477597,
  10662. "size": 22,
  10663. "commit_id": "28f80baf3c53e267c9ce46a2a0fadbb981585132",
  10664. "message": "Fix bug #72293 - Heap overflow in mysqlnd related to BIT fields",
  10665. "target": 0,
  10666. "dataset": "other",
  10667. "idx": 416681
  10668. },
  10669. {
  10670. "func": "static void mysql_close_memory(MYSQL *mysql)\n{\n ma_clear_session_state(mysql);\n free(mysql->host_info);\n free(mysql->host);\n free(mysql->user);\n free(mysql->passwd);\n free(mysql->db);\n free(mysql->unix_socket);\n free(mysql->server_version);\n mysql->host_info= mysql->host= mysql->unix_socket=\n mysql->server_version=mysql->user=mysql->passwd=mysql->db=0;\n}",
  10671. "project": "mariadb-connector-c",
  10672. "hash": 299823909470805805524548764029670920429,
  10673. "size": 13,
  10674. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10675. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10676. "target": 0,
  10677. "dataset": "other",
  10678. "idx": 429671
  10679. },
  10680. {
  10681. "func": "int STDCALL mysql_set_server_option(MYSQL *mysql,\n enum enum_mysql_set_option option)\n{\n char buffer[2];\n int2store(buffer, (uint)option);\n return(ma_simple_command(mysql, COM_SET_OPTION, buffer, sizeof(buffer), 0, 0));\n}",
  10682. "project": "mariadb-connector-c",
  10683. "hash": 278711197721630844368740385950522368233,
  10684. "size": 7,
  10685. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  10686. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  10687. "target": 0,
  10688. "dataset": "other",
  10689. "idx": 429643
  10690. }
  10691. ]
  10692. },
  10693. {
  10694. "call_depth": 3,
  10695. "longest_call_chain": [
  10696. "ff_layout_read_prepare_v4",
  10697. "ff_layout_read_prepare_common",
  10698. "ff_layout_read_record_layoutstats_start"
  10699. ],
  10700. "group_size": 4,
  10701. "functions": [
  10702. {
  10703. "func": "static void ff_layout_read_prepare_v4(struct rpc_task *task, void *data)\n{\n\tstruct nfs_pgio_header *hdr = data;\n\n\tif (nfs4_setup_sequence(hdr->ds_clp,\n\t\t\t\t&hdr->args.seq_args,\n\t\t\t\t&hdr->res.seq_res,\n\t\t\t\ttask))\n\t\treturn;\n\n\tff_layout_read_prepare_common(task, hdr);\n}",
  10704. "project": "linux",
  10705. "hash": 226440226190759581103757914950951705523,
  10706. "size": 12,
  10707. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  10708. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  10709. "target": 0,
  10710. "dataset": "other",
  10711. "idx": 234422
  10712. },
  10713. {
  10714. "func": "static int ff_layout_read_prepare_common(struct rpc_task *task,\n\t\t\t\t\t struct nfs_pgio_header *hdr)\n{\n\tif (unlikely(test_bit(NFS_CONTEXT_BAD, &hdr->args.context->flags))) {\n\t\trpc_exit(task, -EIO);\n\t\treturn -EIO;\n\t}\n\n\tff_layout_read_record_layoutstats_start(task, hdr);\n\treturn 0;\n}",
  10715. "project": "linux",
  10716. "hash": 157729610648494303101839328390099699136,
  10717. "size": 11,
  10718. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  10719. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  10720. "target": 0,
  10721. "dataset": "other",
  10722. "idx": 234452
  10723. },
  10724. {
  10725. "func": "static void ff_layout_read_record_layoutstats_start(struct rpc_task *task,\n\t\tstruct nfs_pgio_header *hdr)\n{\n\tif (test_and_set_bit(NFS_IOHDR_STAT, &hdr->flags))\n\t\treturn;\n\tnfs4_ff_layout_stat_io_start_read(hdr->inode,\n\t\t\tFF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx),\n\t\t\thdr->args.count,\n\t\t\ttask->tk_start);\n}",
  10726. "project": "linux",
  10727. "hash": 32293857655617288977544246707045501905,
  10728. "size": 10,
  10729. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  10730. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  10731. "target": 0,
  10732. "dataset": "other",
  10733. "idx": 234481
  10734. },
  10735. {
  10736. "func": "static void ff_layout_read_prepare_v3(struct rpc_task *task, void *data)\n{\n\tstruct nfs_pgio_header *hdr = data;\n\n\tif (ff_layout_read_prepare_common(task, hdr))\n\t\treturn;\n\n\trpc_call_start(task);\n}",
  10737. "project": "linux",
  10738. "hash": 311339260865109808727959923669793718017,
  10739. "size": 9,
  10740. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  10741. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  10742. "target": 0,
  10743. "dataset": "other",
  10744. "idx": 234414
  10745. }
  10746. ]
  10747. },
  10748. {
  10749. "call_depth": 3,
  10750. "longest_call_chain": [
  10751. "texImage2D",
  10752. "imageSizeInBytes",
  10753. "componentsPerPixel"
  10754. ],
  10755. "group_size": 4,
  10756. "functions": [
  10757. {
  10758. "project": "Chrome",
  10759. "commit_id": "327585cb0eab0859518643a2d00917081f7e7645",
  10760. "target": 0,
  10761. "func": "size_t imageSizeInBytes(unsigned width, unsigned height, unsigned format, unsigned type)\n{\n return width * height * bytesPerComponent(type) * componentsPerPixel(format, type);\n}\n",
  10762. "cwe": "",
  10763. "big_vul_idx": 99009,
  10764. "idx": 89066,
  10765. "hash": 100191103927277428462910561057830902731
  10766. },
  10767. {
  10768. "project": "Chrome",
  10769. "commit_id": "327585cb0eab0859518643a2d00917081f7e7645",
  10770. "target": 0,
  10771. "func": "void WebGraphicsContext3DDefaultImpl::texImage2D(unsigned target, unsigned level, unsigned internalFormat, unsigned width, unsigned height, unsigned border, unsigned format, unsigned type, const void* pixels)\n{\n OwnArrayPtr<uint8> zero;\n if (!pixels) {\n size_t size = imageSizeInBytes(width, height, format, type);\n zero.set(new uint8[size]);\n memset(zero.get(), 0, size);\n pixels = zero.get();\n }\n glTexImage2D(target, level, internalFormat, width, height, border, format, type, pixels);\n}\n",
  10772. "cwe": "",
  10773. "big_vul_idx": 99028,
  10774. "idx": 89082,
  10775. "hash": 288715348610881210509303505688349014827
  10776. },
  10777. {
  10778. "project": "Chrome",
  10779. "commit_id": "327585cb0eab0859518643a2d00917081f7e7645",
  10780. "target": 0,
  10781. "func": "unsigned bytesPerComponent(unsigned type)\n{\n switch (type) {\n case GL_BYTE:\n case GL_UNSIGNED_BYTE:\n return 1;\n case GL_SHORT:\n case GL_UNSIGNED_SHORT:\n case GL_UNSIGNED_SHORT_5_6_5:\n case GL_UNSIGNED_SHORT_4_4_4_4:\n case GL_UNSIGNED_SHORT_5_5_5_1:\n return 2;\n case GL_FLOAT:\n return 4;\n default:\n return 4;\n }\n}\n",
  10782. "cwe": "",
  10783. "big_vul_idx": 98971,
  10784. "idx": 89030,
  10785. "hash": 181225461820534879990745914179801188323
  10786. },
  10787. {
  10788. "project": "Chrome",
  10789. "commit_id": "327585cb0eab0859518643a2d00917081f7e7645",
  10790. "target": 0,
  10791. "func": "unsigned componentsPerPixel(unsigned format, unsigned type)\n{\n switch (type) {\n case GL_UNSIGNED_SHORT_5_6_5:\n case GL_UNSIGNED_SHORT_4_4_4_4:\n case GL_UNSIGNED_SHORT_5_5_5_1:\n return 1;\n default:\n break;\n }\n switch (format) {\n case GL_LUMINANCE:\n return 1;\n case GL_LUMINANCE_ALPHA:\n return 2;\n case GL_RGB:\n return 3;\n case GL_RGBA:\n case GL_BGRA_EXT:\n return 4;\n default:\n return 4;\n }\n}\n",
  10792. "cwe": "",
  10793. "big_vul_idx": 98973,
  10794. "idx": 89032,
  10795. "hash": 323523728756380712835029241906702190867
  10796. }
  10797. ]
  10798. },
  10799. {
  10800. "call_depth": 4,
  10801. "longest_call_chain": [
  10802. "SetExtensionContentSettingFromList",
  10803. "SetExtensionContentSetting",
  10804. "GetValueMap",
  10805. "FindEntry"
  10806. ],
  10807. "group_size": 13,
  10808. "functions": [
  10809. {
  10810. "project": "Chrome",
  10811. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10812. "target": 0,
  10813. "func": "void ContentSettingsStore::SetExtensionContentSetting(\n const std::string& ext_id,\n const ContentSettingsPattern& primary_pattern,\n const ContentSettingsPattern& secondary_pattern,\n ContentSettingsType type,\n const content_settings::ResourceIdentifier& identifier,\n ContentSetting setting,\n ExtensionPrefsScope scope) {\n {\n base::AutoLock lock(lock_);\n OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);\n if (setting == CONTENT_SETTING_DEFAULT) {\n map->DeleteValue(primary_pattern, secondary_pattern, type, identifier);\n } else {\n map->SetValue(primary_pattern, secondary_pattern, type, identifier,\n base::Value::CreateIntegerValue(setting));\n }\n }\n\n NotifyOfContentSettingChanged(ext_id,\n scope != kExtensionPrefsScopeRegular);\n}\n",
  10814. "cwe": "",
  10815. "big_vul_idx": 113813,
  10816. "idx": 102022,
  10817. "hash": 84849344927467544405296447728019616117
  10818. },
  10819. {
  10820. "project": "Chrome",
  10821. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10822. "target": 0,
  10823. "func": "ContentSettingsStore::FindEntry(const std::string& ext_id) {\n ExtensionEntryMap::iterator i;\n for (i = entries_.begin(); i != entries_.end(); ++i) {\n if (i->second->id == ext_id)\n return i;\n }\n return entries_.end();\n}\n",
  10824. "cwe": "",
  10825. "big_vul_idx": 113803,
  10826. "idx": 102013,
  10827. "hash": 144871821058680461837679452113349635692
  10828. },
  10829. {
  10830. "project": "Chrome",
  10831. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10832. "target": 0,
  10833. "func": "void ContentSettingsStore::RegisterExtension(\n const std::string& ext_id,\n const base::Time& install_time,\n bool is_enabled) {\n base::AutoLock lock(lock_);\n ExtensionEntryMap::iterator i = FindEntry(ext_id);\n if (i != entries_.end()) {\n delete i->second;\n entries_.erase(i);\n }\n\n ExtensionEntry* entry = new ExtensionEntry;\n entry->id = ext_id;\n entry->enabled = is_enabled;\n entries_.insert(std::make_pair(install_time, entry));\n}\n",
  10834. "cwe": "",
  10835. "big_vul_idx": 113811,
  10836. "idx": 102020,
  10837. "hash": 71329738332924000295255173779941553477
  10838. },
  10839. {
  10840. "project": "Chrome",
  10841. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10842. "target": 0,
  10843. "func": "void ContentSettingsStore::UnregisterExtension(\n const std::string& ext_id) {\n bool notify = false;\n bool notify_incognito = false;\n {\n base::AutoLock lock(lock_);\n ExtensionEntryMap::iterator i = FindEntry(ext_id);\n if (i == entries_.end())\n return;\n notify = !i->second->settings.empty();\n notify_incognito = !i->second->incognito_persistent_settings.empty() ||\n !i->second->incognito_session_only_settings.empty();\n\n delete i->second;\n entries_.erase(i);\n }\n if (notify)\n NotifyOfContentSettingChanged(ext_id, false);\n if (notify_incognito)\n NotifyOfContentSettingChanged(ext_id, true);\n}\n",
  10844. "cwe": "",
  10845. "big_vul_idx": 113816,
  10846. "idx": 102025,
  10847. "hash": 253336267348198700968344145950842188022
  10848. },
  10849. {
  10850. "project": "Chrome",
  10851. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10852. "target": 1,
  10853. "func": "void ContentSettingsStore::ClearContentSettingsForExtension(\n const std::string& ext_id,\n ExtensionPrefsScope scope) {\n bool notify = false;\n {\n base::AutoLock lock(lock_);\n OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);\n char ext_id_buffer[33];\n base::strlcpy(ext_id_buffer, ext_id.c_str(), sizeof(ext_id_buffer));\n base::debug::Alias(ext_id_buffer);\n CHECK(false);\n }\n notify = !map->empty();\n map->clear();\n }\n if (notify) {\n NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular);\n }\n}\n",
  10854. "cwe": "",
  10855. "big_vul_idx": 184504,
  10856. "idx": 5458,
  10857. "hash": 265797374762752738816496693872000415093
  10858. },
  10859. {
  10860. "project": "Chrome",
  10861. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10862. "target": 0,
  10863. "func": "void ContentSettingsStore::ClearContentSettingsForExtension(\n const std::string& ext_id,\n ExtensionPrefsScope scope) {\n bool notify = false;\n {\n base::AutoLock lock(lock_);\n OriginIdentifierValueMap* map = GetValueMap(ext_id, scope);\n // Fail gracefully in Release builds.\n NOTREACHED();\n return;\n }\n notify = !map->empty();\n map->clear();\n }\n if (notify) {\n NotifyOfContentSettingChanged(ext_id, scope != kExtensionPrefsScopeRegular);\n }\n}\n",
  10864. "cwe": "",
  10865. "big_vul_idx": 184504,
  10866. "idx": 162573,
  10867. "hash": 12967184921243506354797539177835054040
  10868. },
  10869. {
  10870. "project": "Chrome",
  10871. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10872. "target": 0,
  10873. "func": "void ContentSettingsStore::NotifyOfContentSettingChanged(\n const std::string& extension_id,\n bool incognito) {\n FOR_EACH_OBSERVER(\n ContentSettingsStore::Observer,\n observers_,\n OnContentSettingChanged(extension_id, incognito));\n}\n",
  10874. "cwe": "",
  10875. "big_vul_idx": 113809,
  10876. "idx": 102018,
  10877. "hash": 154976950546548493239244573307163992760
  10878. },
  10879. {
  10880. "project": "Chrome",
  10881. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10882. "target": 0,
  10883. "func": "OriginIdentifierValueMap* ContentSettingsStore::GetValueMap(\n const std::string& ext_id,\n ExtensionPrefsScope scope) {\n ExtensionEntryMap::const_iterator i = FindEntry(ext_id);\n if (i != entries_.end()) {\n switch (scope) {\n case kExtensionPrefsScopeRegular:\n return &(i->second->settings);\n case kExtensionPrefsScopeRegularOnly:\n NOTREACHED();\n return NULL;\n case kExtensionPrefsScopeIncognitoPersistent:\n return &(i->second->incognito_persistent_settings);\n case kExtensionPrefsScopeIncognitoSessionOnly:\n return &(i->second->incognito_session_only_settings);\n }\n }\n return NULL;\n}\n",
  10884. "cwe": "",
  10885. "big_vul_idx": 113807,
  10886. "idx": 102016,
  10887. "hash": 38362777105571324642739053017074788386
  10888. },
  10889. {
  10890. "project": "Chrome",
  10891. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10892. "target": 0,
  10893. "func": "const OriginIdentifierValueMap* ContentSettingsStore::GetValueMap(\n const std::string& ext_id,\n ExtensionPrefsScope scope) const {\n ExtensionEntryMap::const_iterator i = FindEntry(ext_id);\n if (i == entries_.end())\n return NULL;\n\n switch (scope) {\n case kExtensionPrefsScopeRegular:\n return &(i->second->settings);\n case kExtensionPrefsScopeRegularOnly:\n NOTREACHED();\n return NULL;\n case kExtensionPrefsScopeIncognitoPersistent:\n return &(i->second->incognito_persistent_settings);\n case kExtensionPrefsScopeIncognitoSessionOnly:\n return &(i->second->incognito_session_only_settings);\n }\n\n NOTREACHED();\n return NULL;\n}\n",
  10894. "cwe": "",
  10895. "big_vul_idx": 113808,
  10896. "idx": 102017,
  10897. "hash": 142418416636862609877378004129025837881
  10898. },
  10899. {
  10900. "project": "Chrome",
  10901. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10902. "target": 0,
  10903. "func": "base::ListValue* ContentSettingsStore::GetSettingsForExtension(\n const std::string& extension_id,\n ExtensionPrefsScope scope) const {\n base::AutoLock lock(lock_);\n const OriginIdentifierValueMap* map = GetValueMap(extension_id, scope);\n if (!map)\n return NULL;\n base::ListValue* settings = new base::ListValue();\n OriginIdentifierValueMap::EntryMap::const_iterator it;\n for (it = map->begin(); it != map->end(); ++it) {\n scoped_ptr<RuleIterator> rule_iterator(\n map->GetRuleIterator(it->first.content_type,\n it->first.resource_identifier,\n NULL)); // We already hold the lock.\n while (rule_iterator->HasNext()) {\n const Rule& rule = rule_iterator->Next();\n base::DictionaryValue* setting_dict = new base::DictionaryValue();\n setting_dict->SetString(keys::kPrimaryPatternKey,\n rule.primary_pattern.ToString());\n setting_dict->SetString(keys::kSecondaryPatternKey,\n rule.secondary_pattern.ToString());\n setting_dict->SetString(\n keys::kContentSettingsTypeKey,\n helpers::ContentSettingsTypeToString(it->first.content_type));\n setting_dict->SetString(keys::kResourceIdentifierKey,\n it->first.resource_identifier);\n ContentSetting content_setting = ValueToContentSetting(rule.value.get());\n DCHECK_NE(CONTENT_SETTING_DEFAULT, content_setting);\n setting_dict->SetString(\n keys::kContentSettingKey,\n helpers::ContentSettingToString(content_setting));\n settings->Append(setting_dict);\n }\n }\n return settings;\n}\n",
  10904. "cwe": "",
  10905. "big_vul_idx": 113806,
  10906. "idx": 102015,
  10907. "hash": 139241730344285891252776837781574289833
  10908. },
  10909. {
  10910. "project": "Chrome",
  10911. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10912. "target": 0,
  10913. "func": "void ContentSettingsStore::SetExtensionContentSettingFromList(\n const std::string& extension_id,\n const base::ListValue* list,\n ExtensionPrefsScope scope) {\n for (base::ListValue::const_iterator it = list->begin();\n it != list->end(); ++it) {\n if ((*it)->GetType() != Value::TYPE_DICTIONARY) {\n NOTREACHED();\n continue;\n }\n base::DictionaryValue* dict = static_cast<base::DictionaryValue*>(*it);\n std::string primary_pattern_str;\n dict->GetString(keys::kPrimaryPatternKey, &primary_pattern_str);\n ContentSettingsPattern primary_pattern =\n ContentSettingsPattern::FromString(primary_pattern_str);\n DCHECK(primary_pattern.IsValid());\n\n std::string secondary_pattern_str;\n dict->GetString(keys::kSecondaryPatternKey, &secondary_pattern_str);\n ContentSettingsPattern secondary_pattern =\n ContentSettingsPattern::FromString(secondary_pattern_str);\n DCHECK(secondary_pattern.IsValid());\n\n std::string content_settings_type_str;\n dict->GetString(keys::kContentSettingsTypeKey, &content_settings_type_str);\n ContentSettingsType content_settings_type =\n helpers::StringToContentSettingsType(content_settings_type_str);\n DCHECK_NE(CONTENT_SETTINGS_TYPE_DEFAULT, content_settings_type);\n\n std::string resource_identifier;\n dict->GetString(keys::kResourceIdentifierKey, &resource_identifier);\n\n std::string content_setting_string;\n dict->GetString(keys::kContentSettingKey, &content_setting_string);\n ContentSetting setting = CONTENT_SETTING_DEFAULT;\n bool result =\n helpers::StringToContentSetting(content_setting_string, &setting);\n DCHECK(result);\n\n SetExtensionContentSetting(extension_id,\n primary_pattern,\n secondary_pattern,\n content_settings_type,\n resource_identifier,\n setting,\n scope);\n }\n}\n",
  10914. "cwe": "",
  10915. "big_vul_idx": 113814,
  10916. "idx": 102023,
  10917. "hash": 70179980667900133818009144382780628834
  10918. },
  10919. {
  10920. "project": "Chrome",
  10921. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10922. "target": 0,
  10923. "func": "void ContentSettingsStore::SetExtensionState(\n const std::string& ext_id, bool is_enabled) {\n bool notify = false;\n bool notify_incognito = false;\n {\n base::AutoLock lock(lock_);\n ExtensionEntryMap::const_iterator i = FindEntry(ext_id);\n if (i == entries_.end())\n return;\n notify = !i->second->settings.empty();\n notify_incognito = !i->second->incognito_persistent_settings.empty() ||\n !i->second->incognito_session_only_settings.empty();\n\n i->second->enabled = is_enabled;\n }\n if (notify)\n NotifyOfContentSettingChanged(ext_id, false);\n if (notify_incognito)\n NotifyOfContentSettingChanged(ext_id, true);\n}\n",
  10924. "cwe": "",
  10925. "big_vul_idx": 113815,
  10926. "idx": 102024,
  10927. "hash": 20125382622179189208306526857457148182
  10928. },
  10929. {
  10930. "project": "Chrome",
  10931. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10932. "target": 0,
  10933. "func": "RuleIterator* ContentSettingsStore::GetRuleIterator(\n ContentSettingsType type,\n const content_settings::ResourceIdentifier& identifier,\n bool incognito) const {\n ScopedVector<RuleIterator> iterators;\n ExtensionEntryMap::const_reverse_iterator entry;\n\n scoped_ptr<base::AutoLock> auto_lock(new base::AutoLock(lock_));\n\n for (entry = entries_.rbegin(); entry != entries_.rend(); ++entry) {\n if (!entry->second->enabled)\n continue;\n\n if (incognito) {\n iterators.push_back(\n entry->second->incognito_session_only_settings.GetRuleIterator(\n type,\n identifier,\n NULL));\n iterators.push_back(\n entry->second->incognito_persistent_settings.GetRuleIterator(\n type,\n identifier,\n NULL));\n } else {\n iterators.push_back(\n entry->second->settings.GetRuleIterator(type, identifier, NULL));\n }\n }\n return new ConcatenationIterator(&iterators, auto_lock.release());\n}\n",
  10934. "cwe": "",
  10935. "big_vul_idx": 113805,
  10936. "idx": 102014,
  10937. "hash": 89570315413421650235602117772268834038
  10938. }
  10939. ]
  10940. },
  10941. {
  10942. "call_depth": 3,
  10943. "longest_call_chain": [
  10944. "~ContentSettingsStore",
  10945. "ContentSettingsStore",
  10946. "OnCorrectThread"
  10947. ],
  10948. "group_size": 5,
  10949. "functions": [
  10950. {
  10951. "project": "Chrome",
  10952. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10953. "target": 0,
  10954. "func": "bool ContentSettingsStore::OnCorrectThread() {\n return !BrowserThread::IsWellKnownThread(BrowserThread::UI) ||\n BrowserThread::CurrentlyOn(BrowserThread::UI);\n}\n",
  10955. "cwe": "",
  10956. "big_vul_idx": 113810,
  10957. "idx": 102019,
  10958. "hash": 85964980237324972811762407694656373748
  10959. },
  10960. {
  10961. "project": "Chrome",
  10962. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10963. "target": 0,
  10964. "func": "void ContentSettingsStore::AddObserver(Observer* observer) {\n DCHECK(OnCorrectThread());\n observers_.AddObserver(observer);\n}\n",
  10965. "cwe": "",
  10966. "big_vul_idx": 113801,
  10967. "idx": 102011,
  10968. "hash": 274375230843812264978090509763247298972
  10969. },
  10970. {
  10971. "project": "Chrome",
  10972. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10973. "target": 0,
  10974. "func": "ContentSettingsStore::~ContentSettingsStore() {\n STLDeleteValues(&entries_);\n}\n",
  10975. "cwe": "",
  10976. "big_vul_idx": 113817,
  10977. "idx": 102026,
  10978. "hash": 193315584364047723290740036884479523650
  10979. },
  10980. {
  10981. "project": "Chrome",
  10982. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10983. "target": 0,
  10984. "func": "void ContentSettingsStore::RemoveObserver(Observer* observer) {\n DCHECK(OnCorrectThread());\n observers_.RemoveObserver(observer);\n}\n",
  10985. "cwe": "",
  10986. "big_vul_idx": 113812,
  10987. "idx": 102021,
  10988. "hash": 288872367979228713729187696799686614287
  10989. },
  10990. {
  10991. "project": "Chrome",
  10992. "commit_id": "1a113d35a19c0ed6500fb5c0acdc35730617fb3f",
  10993. "target": 0,
  10994. "func": "ContentSettingsStore::ContentSettingsStore() {\n DCHECK(OnCorrectThread());\n}\n",
  10995. "cwe": "",
  10996. "big_vul_idx": 113802,
  10997. "idx": 102012,
  10998. "hash": 99620593167027437578310083732980640293
  10999. }
  11000. ]
  11001. },
  11002. {
  11003. "call_depth": 3,
  11004. "longest_call_chain": [
  11005. "rsi_mac80211_cancel_roc",
  11006. "rsi_resume_conn_channel",
  11007. "rsi_switch_channel"
  11008. ],
  11009. "group_size": 4,
  11010. "functions": [
  11011. {
  11012. "func": "static void rsi_switch_channel(struct rsi_hw *adapter,\n\t\t\t struct ieee80211_vif *vif)\n{\n\tstruct rsi_common *common = adapter->priv;\n\tstruct ieee80211_channel *channel;\n\n\tif (common->iface_down)\n\t\treturn;\n\tif (!vif)\n\t\treturn;\n\n\tchannel = vif->bss_conf.chandef.chan;\n\n\tif (!channel)\n\t\treturn;\n\n\trsi_band_check(common, channel);\n\trsi_set_channel(common, channel);\n\trsi_dbg(INFO_ZONE, \"Switched to channel - %d\\n\", channel->hw_value);\n}",
  11013. "project": "linux",
  11014. "hash": 49657447112588327295626339182823740407,
  11015. "size": 20,
  11016. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  11017. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  11018. "target": 0,
  11019. "dataset": "other",
  11020. "idx": 461639
  11021. },
  11022. {
  11023. "func": "static int rsi_mac80211_cancel_roc(struct ieee80211_hw *hw)\n{\n\tstruct rsi_hw *adapter = hw->priv;\n\tstruct rsi_common *common = adapter->priv;\n\n\trsi_dbg(INFO_ZONE, \"Cancel remain on channel\\n\");\n\n\tmutex_lock(&common->mutex);\n\tif (!timer_pending(&common->roc_timer)) {\n\t\tmutex_unlock(&common->mutex);\n\t\treturn 0;\n\t}\n\n\tdel_timer(&common->roc_timer);\n\n\trsi_resume_conn_channel(common);\n\tmutex_unlock(&common->mutex);\n\n\treturn 0;\n}",
  11024. "project": "linux",
  11025. "hash": 258436340765509179612182905105279715926,
  11026. "size": 20,
  11027. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  11028. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  11029. "target": 0,
  11030. "dataset": "other",
  11031. "idx": 461632
  11032. },
  11033. {
  11034. "func": "void rsi_roc_timeout(struct timer_list *t)\n{\n\tstruct rsi_common *common = from_timer(common, t, roc_timer);\n\n\trsi_dbg(INFO_ZONE, \"Remain on channel expired\\n\");\n\n\tmutex_lock(&common->mutex);\n\tieee80211_remain_on_channel_expired(common->priv->hw);\n\n\tif (timer_pending(&common->roc_timer))\n\t\tdel_timer(&common->roc_timer);\n\n\trsi_resume_conn_channel(common);\n\tmutex_unlock(&common->mutex);\n}",
  11035. "project": "linux",
  11036. "hash": 151059921459410287184034486238416954191,
  11037. "size": 15,
  11038. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  11039. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  11040. "target": 0,
  11041. "dataset": "other",
  11042. "idx": 461664
  11043. },
  11044. {
  11045. "func": "static void rsi_resume_conn_channel(struct rsi_common *common)\n{\n\tstruct rsi_hw *adapter = common->priv;\n\tstruct ieee80211_vif *vif;\n\tint cnt;\n\n\tfor (cnt = 0; cnt < RSI_MAX_VIFS; cnt++) {\n\t\tvif = adapter->vifs[cnt];\n\t\tif (!vif)\n\t\t\tcontinue;\n\n\t\tif ((vif->type == NL80211_IFTYPE_AP) ||\n\t\t (vif->type == NL80211_IFTYPE_P2P_GO)) {\n\t\t\trsi_switch_channel(adapter, vif);\n\t\t\tbreak;\n\t\t}\n\t\tif (((vif->type == NL80211_IFTYPE_STATION) ||\n\t\t (vif->type == NL80211_IFTYPE_P2P_CLIENT)) &&\n\t\t vif->bss_conf.assoc) {\n\t\t\trsi_switch_channel(adapter, vif);\n\t\t\tbreak;\n\t\t}\n\t}\n}",
  11046. "project": "linux",
  11047. "hash": 145343264581648018838314304350418653766,
  11048. "size": 24,
  11049. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  11050. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  11051. "target": 0,
  11052. "dataset": "other",
  11053. "idx": 461657
  11054. }
  11055. ]
  11056. },
  11057. {
  11058. "call_depth": 4,
  11059. "longest_call_chain": [
  11060. "msf2_emac_reset",
  11061. "msf2_emac_do_reset",
  11062. "msf2_phy_reset",
  11063. "msf2_phy_update_link"
  11064. ],
  11065. "group_size": 17,
  11066. "functions": [
  11067. {
  11068. "func": "static void write_to_phy(MSF2EmacState *s)\n{\n uint8_t reg_addr = s->regs[R_MII_ADDR] & R_MII_ADDR_REGADDR_MASK;\n uint8_t phy_addr = (s->regs[R_MII_ADDR] >> R_MII_ADDR_PHYADDR_SHIFT) &\n R_MII_ADDR_REGADDR_MASK;\n uint16_t data = s->regs[R_MII_CTL] & 0xFFFF;\n\n if (phy_addr != PHYADDR) {\n return;\n }\n\n switch (reg_addr) {\n case MII_BMCR:\n if (data & MII_BMCR_RESET) {\n /* Phy reset */\n msf2_phy_reset(s);\n data &= ~MII_BMCR_RESET;\n }\n if (data & MII_BMCR_AUTOEN) {\n /* Complete autonegotiation immediately */\n data &= ~MII_BMCR_AUTOEN;\n s->phy_regs[MII_BMSR] |= MII_BMSR_AN_COMP;\n }\n break;\n }\n\n s->phy_regs[reg_addr] = data;\n}",
  11069. "project": "qemu",
  11070. "hash": 2435123177511818004101984301770380239,
  11071. "size": 28,
  11072. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11073. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11074. "target": 0,
  11075. "dataset": "other",
  11076. "idx": 408520
  11077. },
  11078. {
  11079. "func": "static void emac_write(void *opaque, hwaddr addr, uint64_t val64,\n unsigned int size)\n{\n MSF2EmacState *s = opaque;\n uint32_t value = val64;\n uint32_t enreqbits;\n uint8_t pktcnt;\n\n addr >>= 2;\n switch (addr) {\n case R_DMA_TX_CTL:\n s->regs[addr] = value;\n if (value & R_DMA_TX_CTL_EN_MASK) {\n msf2_dma_tx(s);\n }\n break;\n case R_DMA_RX_CTL:\n s->regs[addr] = value;\n if (value & R_DMA_RX_CTL_EN_MASK) {\n s->rx_desc = s->regs[R_DMA_RX_DESC];\n qemu_flush_queued_packets(qemu_get_queue(s->nic));\n }\n break;\n case R_CFG1:\n s->regs[addr] = value;\n if (value & R_CFG1_RESET_MASK) {\n msf2_emac_do_reset(s);\n }\n break;\n case R_FIFO_CFG0:\n /*\n * For our implementation, turning on modules is instantaneous,\n * so the states requested via the *ENREQ bits appear in the\n * *ENRPLY bits immediately. Also the reset bits to reset PE-MCXMAC\n * module are not emulated here since it deals with start of frames,\n * inter-packet gap and control frames.\n */\n enreqbits = extract32(value, 8, 5);\n s->regs[addr] = deposit32(value, 16, 5, enreqbits);\n break;\n case R_DMA_TX_DESC:\n if (value & 0x3) {\n qemu_log_mask(LOG_GUEST_ERROR, \"Tx Descriptor address should be\"\n \" 32 bit aligned\\n\");\n }\n /* Ignore [1:0] bits */\n s->regs[addr] = value & ~3;\n break;\n case R_DMA_RX_DESC:\n if (value & 0x3) {\n qemu_log_mask(LOG_GUEST_ERROR, \"Rx Descriptor address should be\"\n \" 32 bit aligned\\n\");\n }\n /* Ignore [1:0] bits */\n s->regs[addr] = value & ~3;\n break;\n case R_DMA_TX_STATUS:\n if (value & R_DMA_TX_STATUS_UNDERRUN_MASK) {\n s->regs[addr] &= ~R_DMA_TX_STATUS_UNDERRUN_MASK;\n }\n if (value & R_DMA_TX_STATUS_PKT_SENT_MASK) {\n pktcnt = FIELD_EX32(s->regs[addr], DMA_TX_STATUS, PKTCNT);\n pktcnt--;\n s->regs[addr] = FIELD_DP32(s->regs[addr], DMA_TX_STATUS,\n PKTCNT, pktcnt);\n if (pktcnt == 0) {\n s->regs[addr] &= ~R_DMA_TX_STATUS_PKT_SENT_MASK;\n }\n }\n break;\n case R_DMA_RX_STATUS:\n if (value & R_DMA_RX_STATUS_OVERFLOW_MASK) {\n s->regs[addr] &= ~R_DMA_RX_STATUS_OVERFLOW_MASK;\n }\n if (value & R_DMA_RX_STATUS_PKT_RCVD_MASK) {\n pktcnt = FIELD_EX32(s->regs[addr], DMA_RX_STATUS, PKTCNT);\n pktcnt--;\n s->regs[addr] = FIELD_DP32(s->regs[addr], DMA_RX_STATUS,\n PKTCNT, pktcnt);\n if (pktcnt == 0) {\n s->regs[addr] &= ~R_DMA_RX_STATUS_PKT_RCVD_MASK;\n }\n }\n break;\n case R_DMA_IRQ:\n break;\n case R_MII_CMD:\n if (value & R_MII_CMD_READ_MASK) {\n s->regs[R_MII_STS] = read_from_phy(s);\n }\n break;\n case R_MII_CTL:\n s->regs[addr] = value;\n write_to_phy(s);\n break;\n case R_STA1:\n s->regs[addr] = value;\n /*\n * R_STA1 [31:24] : octet 1 of mac address\n * R_STA1 [23:16] : octet 2 of mac address\n * R_STA1 [15:8] : octet 3 of mac address\n * R_STA1 [7:0] : octet 4 of mac address\n */\n stl_be_p(s->mac_addr, value);\n break;\n case R_STA2:\n s->regs[addr] = value;\n /*\n * R_STA2 [31:24] : octet 5 of mac address\n * R_STA2 [23:16] : octet 6 of mac address\n */\n stw_be_p(s->mac_addr + 4, value >> 16);\n break;\n default:\n if (addr >= ARRAY_SIZE(s->regs)) {\n qemu_log_mask(LOG_GUEST_ERROR,\n \"%s: Bad offset 0x%\" HWADDR_PRIx \"\\n\", __func__,\n addr * 4);\n return;\n }\n s->regs[addr] = value;\n break;\n }\n emac_update_irq(s);\n}",
  11080. "project": "qemu",
  11081. "hash": 142627919697664424382763103238155423526,
  11082. "size": 125,
  11083. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11084. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11085. "target": 0,
  11086. "dataset": "other",
  11087. "idx": 408531
  11088. },
  11089. {
  11090. "func": "static void emac_load_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc)\n{\n address_space_read(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, d, sizeof *d);\n /* Convert from LE into host endianness. */\n d->pktaddr = le32_to_cpu(d->pktaddr);\n d->pktsize = le32_to_cpu(d->pktsize);\n d->next = le32_to_cpu(d->next);\n}",
  11091. "project": "qemu",
  11092. "hash": 204187275545666389689651758191500588253,
  11093. "size": 8,
  11094. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11095. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11096. "target": 0,
  11097. "dataset": "other",
  11098. "idx": 408535
  11099. },
  11100. {
  11101. "func": "static uint16_t read_from_phy(MSF2EmacState *s)\n{\n uint8_t reg_addr = s->regs[R_MII_ADDR] & R_MII_ADDR_REGADDR_MASK;\n uint8_t phy_addr = (s->regs[R_MII_ADDR] >> R_MII_ADDR_PHYADDR_SHIFT) &\n R_MII_ADDR_REGADDR_MASK;\n\n if (phy_addr == PHYADDR) {\n return s->phy_regs[reg_addr];\n } else {\n return 0xFFFF;\n }\n}",
  11102. "project": "qemu",
  11103. "hash": 296640283957708942790458729395725489243,
  11104. "size": 12,
  11105. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11106. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11107. "target": 0,
  11108. "dataset": "other",
  11109. "idx": 408537
  11110. },
  11111. {
  11112. "func": "static ssize_t emac_rx(NetClientState *nc, const uint8_t *buf, size_t size)\n{\n MSF2EmacState *s = qemu_get_nic_opaque(nc);\n EmacDesc d;\n uint8_t pktcnt;\n uint32_t status;\n\n if (size > (s->regs[R_MAX_FRAME_LENGTH] & 0xFFFF)) {\n return size;\n }\n if (!addr_filter_ok(s, buf)) {\n return size;\n }\n\n emac_load_desc(s, &d, s->rx_desc);\n\n if (d.pktsize & EMPTY_MASK) {\n address_space_write(&s->dma_as, d.pktaddr, MEMTXATTRS_UNSPECIFIED,\n buf, size & PKT_SIZE);\n d.pktsize = size & PKT_SIZE;\n emac_store_desc(s, &d, s->rx_desc);\n /* update received packets count */\n status = s->regs[R_DMA_RX_STATUS];\n pktcnt = FIELD_EX32(status, DMA_RX_STATUS, PKTCNT);\n pktcnt++;\n s->regs[R_DMA_RX_STATUS] = FIELD_DP32(status, DMA_RX_STATUS,\n PKTCNT, pktcnt);\n s->regs[R_DMA_RX_STATUS] |= R_DMA_RX_STATUS_PKT_RCVD_MASK;\n s->rx_desc = d.next;\n } else {\n s->regs[R_DMA_RX_CTL] &= ~R_DMA_RX_CTL_EN_MASK;\n s->regs[R_DMA_RX_STATUS] |= R_DMA_RX_STATUS_OVERFLOW_MASK;\n }\n emac_update_irq(s);\n return size;\n}",
  11113. "project": "qemu",
  11114. "hash": 145795289411570125648461718405523924905,
  11115. "size": 36,
  11116. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11117. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11118. "target": 0,
  11119. "dataset": "other",
  11120. "idx": 408538
  11121. },
  11122. {
  11123. "func": "static void msf2_phy_reset(MSF2EmacState *s)\n{\n memset(&s->phy_regs[0], 0, sizeof(s->phy_regs));\n s->phy_regs[MII_BMCR] = 0x1140;\n s->phy_regs[MII_BMSR] = 0x7968;\n s->phy_regs[MII_PHYID1] = 0x0022;\n s->phy_regs[MII_PHYID2] = 0x1550;\n s->phy_regs[MII_ANAR] = 0x01E1;\n s->phy_regs[MII_ANLPAR] = 0xCDE1;\n\n msf2_phy_update_link(s);\n}",
  11124. "project": "qemu",
  11125. "hash": 261913340885200105699747283455116435972,
  11126. "size": 12,
  11127. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11128. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11129. "target": 0,
  11130. "dataset": "other",
  11131. "idx": 408528
  11132. },
  11133. {
  11134. "func": "static void msf2_emac_reset(DeviceState *dev)\n{\n MSF2EmacState *s = MSS_EMAC(dev);\n\n msf2_emac_do_reset(s);\n}",
  11135. "project": "qemu",
  11136. "hash": 143395039747611100025821846418462296891,
  11137. "size": 6,
  11138. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11139. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11140. "target": 0,
  11141. "dataset": "other",
  11142. "idx": 408530
  11143. },
  11144. {
  11145. "func": "static void emac_set_link(NetClientState *nc)\n{\n MSF2EmacState *s = qemu_get_nic_opaque(nc);\n\n msf2_phy_update_link(s);\n}",
  11146. "project": "qemu",
  11147. "hash": 134704307068120005767148988481491840933,
  11148. "size": 6,
  11149. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11150. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11151. "target": 0,
  11152. "dataset": "other",
  11153. "idx": 408523
  11154. },
  11155. {
  11156. "func": "static uint64_t emac_read(void *opaque, hwaddr addr, unsigned int size)\n{\n MSF2EmacState *s = opaque;\n uint32_t r = 0;\n\n addr >>= 2;\n\n switch (addr) {\n case R_DMA_IRQ:\n r = emac_get_isr(s);\n break;\n default:\n if (addr >= ARRAY_SIZE(s->regs)) {\n qemu_log_mask(LOG_GUEST_ERROR,\n \"%s: Bad offset 0x%\" HWADDR_PRIx \"\\n\", __func__,\n addr * 4);\n return r;\n }\n r = s->regs[addr];\n break;\n }\n return r;\n}",
  11157. "project": "qemu",
  11158. "hash": 135504479882235916529443679824092130533,
  11159. "size": 23,
  11160. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11161. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11162. "target": 0,
  11163. "dataset": "other",
  11164. "idx": 408540
  11165. },
  11166. {
  11167. "func": "static bool addr_filter_ok(MSF2EmacState *s, const uint8_t *buf)\n{\n /* The broadcast MAC address: FF:FF:FF:FF:FF:FF */\n const uint8_t broadcast_addr[] = { 0xFF, 0xFF, 0xFF, 0xFF,\n 0xFF, 0xFF };\n bool bcast_en = true;\n bool mcast_en = true;\n\n if (s->regs[R_FIFO_CFG5] & R_FIFO_CFG5_BCAST_MASK) {\n bcast_en = true; /* Broadcast dont care for drop circuitry */\n } else if (s->regs[R_FIFO_CFG4] & R_FIFO_CFG4_BCAST_MASK) {\n bcast_en = false;\n }\n\n if (s->regs[R_FIFO_CFG5] & R_FIFO_CFG5_MCAST_MASK) {\n mcast_en = true; /* Multicast dont care for drop circuitry */\n } else if (s->regs[R_FIFO_CFG4] & R_FIFO_CFG4_MCAST_MASK) {\n mcast_en = false;\n }\n\n if (!memcmp(buf, broadcast_addr, sizeof(broadcast_addr))) {\n return bcast_en;\n }\n\n if (buf[0] & 1) {\n return mcast_en;\n }\n\n return !memcmp(buf, s->mac_addr, sizeof(s->mac_addr));\n}",
  11168. "project": "qemu",
  11169. "hash": 271913976529453484580742580817691950705,
  11170. "size": 30,
  11171. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11172. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11173. "target": 0,
  11174. "dataset": "other",
  11175. "idx": 408532
  11176. },
  11177. {
  11178. "func": "static void msf2_dma_tx(MSF2EmacState *s)\n{\n NetClientState *nc = qemu_get_queue(s->nic);\n hwaddr desc = s->regs[R_DMA_TX_DESC];\n uint8_t buf[MAX_PKT_SIZE];\n EmacDesc d;\n int size;\n uint8_t pktcnt;\n uint32_t status;\n\n if (!(s->regs[R_CFG1] & R_CFG1_TX_EN_MASK)) {\n return;\n }\n\n while (1) {\n emac_load_desc(s, &d, desc);\n if (d.pktsize & EMPTY_MASK) {\n break;\n }\n size = d.pktsize & PKT_SIZE;\n address_space_read(&s->dma_as, d.pktaddr, MEMTXATTRS_UNSPECIFIED,\n buf, size);\n /*\n * This is very basic way to send packets. Ideally there should be\n * a FIFO and packets should be sent out from FIFO only when\n * R_CFG1 bit 0 is set.\n */\n if (s->regs[R_CFG1] & R_CFG1_LB_EN_MASK) {\n nc->info->receive(nc, buf, size);\n } else {\n qemu_send_packet(nc, buf, size);\n }\n d.pktsize |= EMPTY_MASK;\n emac_store_desc(s, &d, desc);\n /* update sent packets count */\n status = s->regs[R_DMA_TX_STATUS];\n pktcnt = FIELD_EX32(status, DMA_TX_STATUS, PKTCNT);\n pktcnt++;\n s->regs[R_DMA_TX_STATUS] = FIELD_DP32(status, DMA_TX_STATUS,\n PKTCNT, pktcnt);\n s->regs[R_DMA_TX_STATUS] |= R_DMA_TX_STATUS_PKT_SENT_MASK;\n desc = d.next;\n }\n s->regs[R_DMA_TX_STATUS] |= R_DMA_TX_STATUS_UNDERRUN_MASK;\n s->regs[R_DMA_TX_CTL] &= ~R_DMA_TX_CTL_EN_MASK;\n}",
  11179. "project": "qemu",
  11180. "hash": 266996506783650672252406401947191343006,
  11181. "size": 46,
  11182. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11183. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11184. "target": 1,
  11185. "dataset": "other",
  11186. "idx": 208328
  11187. },
  11188. {
  11189. "func": "static void msf2_dma_tx(MSF2EmacState *s)\n{\n NetClientState *nc = qemu_get_queue(s->nic);\n hwaddr desc = s->regs[R_DMA_TX_DESC];\n uint8_t buf[MAX_PKT_SIZE];\n EmacDesc d;\n int size;\n uint8_t pktcnt;\n uint32_t status;\n\n if (!(s->regs[R_CFG1] & R_CFG1_TX_EN_MASK)) {\n return;\n }\n\n while (1) {\n emac_load_desc(s, &d, desc);\n if (d.pktsize & EMPTY_MASK) {\n break;\n }\n size = d.pktsize & PKT_SIZE;\n address_space_read(&s->dma_as, d.pktaddr, MEMTXATTRS_UNSPECIFIED,\n buf, size);\n /*\n * This is very basic way to send packets. Ideally there should be\n * a FIFO and packets should be sent out from FIFO only when\n * R_CFG1 bit 0 is set.\n */\n if (s->regs[R_CFG1] & R_CFG1_LB_EN_MASK) {\n qemu_receive_packet(nc, buf, size);\n } else {\n qemu_send_packet(nc, buf, size);\n }\n d.pktsize |= EMPTY_MASK;\n emac_store_desc(s, &d, desc);\n /* update sent packets count */\n status = s->regs[R_DMA_TX_STATUS];\n pktcnt = FIELD_EX32(status, DMA_TX_STATUS, PKTCNT);\n pktcnt++;\n s->regs[R_DMA_TX_STATUS] = FIELD_DP32(status, DMA_TX_STATUS,\n PKTCNT, pktcnt);\n s->regs[R_DMA_TX_STATUS] |= R_DMA_TX_STATUS_PKT_SENT_MASK;\n desc = d.next;\n }\n s->regs[R_DMA_TX_STATUS] |= R_DMA_TX_STATUS_UNDERRUN_MASK;\n s->regs[R_DMA_TX_CTL] &= ~R_DMA_TX_CTL_EN_MASK;\n}",
  11190. "project": "qemu",
  11191. "hash": 673024745665237607007576976494892674,
  11192. "size": 46,
  11193. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11194. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11195. "target": 0,
  11196. "dataset": "other",
  11197. "idx": 408536
  11198. },
  11199. {
  11200. "func": "static uint32_t emac_get_isr(MSF2EmacState *s)\n{\n uint32_t ier = s->regs[R_DMA_IRQ_MASK];\n uint32_t tx = s->regs[R_DMA_TX_STATUS] & 0xF;\n uint32_t rx = s->regs[R_DMA_RX_STATUS] & 0xF;\n uint32_t isr = (rx << 4) | tx;\n\n s->regs[R_DMA_IRQ] = ier & isr;\n return s->regs[R_DMA_IRQ];\n}",
  11201. "project": "qemu",
  11202. "hash": 76556053197794724458386467208649723546,
  11203. "size": 10,
  11204. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11205. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11206. "target": 0,
  11207. "dataset": "other",
  11208. "idx": 408533
  11209. },
  11210. {
  11211. "func": "static void emac_store_desc(MSF2EmacState *s, EmacDesc *d, hwaddr desc)\n{\n /* Convert from host endianness into LE. */\n d->pktaddr = cpu_to_le32(d->pktaddr);\n d->pktsize = cpu_to_le32(d->pktsize);\n d->next = cpu_to_le32(d->next);\n\n address_space_write(&s->dma_as, desc, MEMTXATTRS_UNSPECIFIED, d, sizeof *d);\n}",
  11212. "project": "qemu",
  11213. "hash": 111735247435558295267087719220167079599,
  11214. "size": 9,
  11215. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11216. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11217. "target": 0,
  11218. "dataset": "other",
  11219. "idx": 408525
  11220. },
  11221. {
  11222. "func": "static void msf2_emac_do_reset(MSF2EmacState *s)\n{\n memset(&s->regs[0], 0, sizeof(s->regs));\n s->regs[R_CFG1] = 0x80000000;\n s->regs[R_CFG2] = 0x00007000;\n s->regs[R_IFG] = 0x40605060;\n s->regs[R_HALF_DUPLEX] = 0x00A1F037;\n s->regs[R_MAX_FRAME_LENGTH] = 0x00000600;\n s->regs[R_FIFO_CFG5] = 0X3FFFF;\n\n msf2_phy_reset(s);\n}",
  11223. "project": "qemu",
  11224. "hash": 301867812472469643451396628674770133451,
  11225. "size": 12,
  11226. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11227. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11228. "target": 0,
  11229. "dataset": "other",
  11230. "idx": 408522
  11231. },
  11232. {
  11233. "func": "static void emac_update_irq(MSF2EmacState *s)\n{\n bool intr = emac_get_isr(s);\n\n qemu_set_irq(s->irq, intr);\n}",
  11234. "project": "qemu",
  11235. "hash": 333172412219392156233285272403604782462,
  11236. "size": 6,
  11237. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11238. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11239. "target": 0,
  11240. "dataset": "other",
  11241. "idx": 408539
  11242. },
  11243. {
  11244. "func": "static void msf2_phy_update_link(MSF2EmacState *s)\n{\n /* Autonegotiation status mirrors link status. */\n if (qemu_get_queue(s->nic)->link_down) {\n s->phy_regs[MII_BMSR] &= ~(MII_BMSR_AN_COMP |\n MII_BMSR_LINK_ST);\n } else {\n s->phy_regs[MII_BMSR] |= (MII_BMSR_AN_COMP |\n MII_BMSR_LINK_ST);\n }\n}",
  11245. "project": "qemu",
  11246. "hash": 21239304882160056911292914400277760247,
  11247. "size": 11,
  11248. "commit_id": "26194a58f4eb83c5bdf4061a1628508084450ba1",
  11249. "message": "msf2-mac: switch to use qemu_receive_packet() for loopback\n\nThis patch switches to use qemu_receive_packet() which can detect\nreentrancy and return early.\n\nThis is intended to address CVE-2021-3416.\n\nCc: Prasad J Pandit <ppandit@redhat.com>\nCc: qemu-stable@nongnu.org\nReviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>\nSigned-off-by: Jason Wang <jasowang@redhat.com>",
  11250. "target": 0,
  11251. "dataset": "other",
  11252. "idx": 408529
  11253. }
  11254. ]
  11255. },
  11256. {
  11257. "call_depth": 4,
  11258. "longest_call_chain": [
  11259. "ff_layout_read_release",
  11260. "ff_layout_resend_pnfs_read",
  11261. "ff_layout_choose_any_ds_for_read",
  11262. "ff_layout_choose_best_ds_for_read"
  11263. ],
  11264. "group_size": 9,
  11265. "functions": [
  11266. {
  11267. "func": "static void ff_layout_resend_pnfs_read(struct nfs_pgio_header *hdr)\n{\n\tu32 idx = hdr->pgio_mirror_idx + 1;\n\tu32 new_idx = 0;\n\n\tif (ff_layout_choose_any_ds_for_read(hdr->lseg, idx, &new_idx))\n\t\tff_layout_send_layouterror(hdr->lseg);\n\telse\n\t\tpnfs_error_mark_layout_for_return(hdr->inode, hdr->lseg);\n\tpnfs_read_resend_pnfs(hdr, new_idx);\n}",
  11268. "project": "linux",
  11269. "hash": 221400344490443336390998011943132739130,
  11270. "size": 11,
  11271. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11272. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11273. "target": 0,
  11274. "dataset": "other",
  11275. "idx": 234386
  11276. },
  11277. {
  11278. "func": "static void ff_layout_read_record_layoutstats_done(struct rpc_task *task,\n\t\tstruct nfs_pgio_header *hdr)\n{\n\tif (!test_and_clear_bit(NFS_IOHDR_STAT, &hdr->flags))\n\t\treturn;\n\tnfs4_ff_layout_stat_io_end_read(task,\n\t\t\tFF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx),\n\t\t\thdr->args.count,\n\t\t\thdr->res.count);\n\tset_bit(NFS_LSEG_LAYOUTRETURN, &hdr->lseg->pls_flags);\n}",
  11279. "project": "linux",
  11280. "hash": 180815083649218398311438273574541494211,
  11281. "size": 11,
  11282. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11283. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11284. "target": 0,
  11285. "dataset": "other",
  11286. "idx": 234432
  11287. },
  11288. {
  11289. "func": "ff_layout_get_ds_for_read(struct nfs_pageio_descriptor *pgio,\n\t\t\t u32 *best_idx)\n{\n\tstruct pnfs_layout_segment *lseg = pgio->pg_lseg;\n\tstruct nfs4_pnfs_ds *ds;\n\n\tds = ff_layout_choose_best_ds_for_read(lseg, pgio->pg_mirror_idx,\n\t\t\t\t\t best_idx);\n\tif (ds || !pgio->pg_mirror_idx)\n\t\treturn ds;\n\treturn ff_layout_choose_best_ds_for_read(lseg, 0, best_idx);\n}",
  11290. "project": "linux",
  11291. "hash": 254909909558430372208815151322590055598,
  11292. "size": 12,
  11293. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11294. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11295. "target": 0,
  11296. "dataset": "other",
  11297. "idx": 234392
  11298. },
  11299. {
  11300. "func": "static void ff_layout_read_count_stats(struct rpc_task *task, void *data)\n{\n\tstruct nfs_pgio_header *hdr = data;\n\n\tff_layout_read_record_layoutstats_done(task, hdr);\n\trpc_count_iostats_metrics(task,\n\t &NFS_CLIENT(hdr->inode)->cl_metrics[NFSPROC4_CLNT_READ]);\n}",
  11301. "project": "linux",
  11302. "hash": 111504923297298743059264768804593840040,
  11303. "size": 8,
  11304. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11305. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11306. "target": 0,
  11307. "dataset": "other",
  11308. "idx": 234487
  11309. },
  11310. {
  11311. "func": "static void ff_layout_reset_read(struct nfs_pgio_header *hdr)\n{\n\tstruct rpc_task *task = &hdr->task;\n\n\tpnfs_layoutcommit_inode(hdr->inode, false);\n\tpnfs_error_mark_layout_for_return(hdr->inode, hdr->lseg);\n\n\tif (!test_and_set_bit(NFS_IOHDR_REDO, &hdr->flags)) {\n\t\tdprintk(\"%s Reset task %5u for i/o through MDS \"\n\t\t\t\"(req %s/%llu, %u bytes @ offset %llu)\\n\", __func__,\n\t\t\thdr->task.tk_pid,\n\t\t\thdr->inode->i_sb->s_id,\n\t\t\t(unsigned long long)NFS_FILEID(hdr->inode),\n\t\t\thdr->args.count,\n\t\t\t(unsigned long long)hdr->args.offset);\n\n\t\ttrace_pnfs_mds_fallback_read_done(hdr->inode,\n\t\t\t\thdr->args.offset, hdr->args.count,\n\t\t\t\tIOMODE_READ, NFS_I(hdr->inode)->layout,\n\t\t\t\thdr->lseg);\n\t\ttask->tk_status = pnfs_read_done_resend_to_mds(hdr);\n\t}\n}",
  11312. "project": "linux",
  11313. "hash": 165625786622733838658217576364489228194,
  11314. "size": 23,
  11315. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11316. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11317. "target": 0,
  11318. "dataset": "other",
  11319. "idx": 234489
  11320. },
  11321. {
  11322. "func": "ff_layout_choose_valid_ds_for_read(struct pnfs_layout_segment *lseg,\n\t\t\t\t u32 start_idx, u32 *best_idx)\n{\n\treturn ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, true);\n}",
  11323. "project": "linux",
  11324. "hash": 183358589091286308071765017109110013908,
  11325. "size": 5,
  11326. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11327. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11328. "target": 0,
  11329. "dataset": "other",
  11330. "idx": 234413
  11331. },
  11332. {
  11333. "func": "ff_layout_choose_any_ds_for_read(struct pnfs_layout_segment *lseg,\n\t\t\t\t u32 start_idx, u32 *best_idx)\n{\n\treturn ff_layout_choose_ds_for_read(lseg, start_idx, best_idx, false);\n}",
  11334. "project": "linux",
  11335. "hash": 265008521026144273299156386349075170732,
  11336. "size": 5,
  11337. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11338. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11339. "target": 0,
  11340. "dataset": "other",
  11341. "idx": 234463
  11342. },
  11343. {
  11344. "func": "static void ff_layout_read_release(void *data)\n{\n\tstruct nfs_pgio_header *hdr = data;\n\n\tff_layout_read_record_layoutstats_done(&hdr->task, hdr);\n\tif (test_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags))\n\t\tff_layout_resend_pnfs_read(hdr);\n\telse if (test_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags))\n\t\tff_layout_reset_read(hdr);\n\tpnfs_generic_rw_release(data);\n}",
  11345. "project": "linux",
  11346. "hash": 8856986107342943583502713801015682015,
  11347. "size": 11,
  11348. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11349. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11350. "target": 0,
  11351. "dataset": "other",
  11352. "idx": 234435
  11353. },
  11354. {
  11355. "func": "ff_layout_choose_best_ds_for_read(struct pnfs_layout_segment *lseg,\n\t\t\t\t u32 start_idx, u32 *best_idx)\n{\n\tstruct nfs4_pnfs_ds *ds;\n\n\tds = ff_layout_choose_valid_ds_for_read(lseg, start_idx, best_idx);\n\tif (ds)\n\t\treturn ds;\n\treturn ff_layout_choose_any_ds_for_read(lseg, start_idx, best_idx);\n}",
  11356. "project": "linux",
  11357. "hash": 147451117378478970686978877506404847386,
  11358. "size": 10,
  11359. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  11360. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  11361. "target": 0,
  11362. "dataset": "other",
  11363. "idx": 234387
  11364. }
  11365. ]
  11366. },
  11367. {
  11368. "call_depth": 3,
  11369. "longest_call_chain": [
  11370. "mariadb_reconnect",
  11371. "mysql_set_character_set",
  11372. "mysql_real_query"
  11373. ],
  11374. "group_size": 7,
  11375. "functions": [
  11376. {
  11377. "func": "my_bool STDCALL mysql_autocommit(MYSQL *mysql, my_bool mode)\n{\n return((my_bool) mysql_real_query(mysql, (mode) ? \"SET autocommit=1\" :\n \"SET autocommit=0\", 16));\n}",
  11378. "project": "mariadb-connector-c",
  11379. "hash": 40011449824224765253356387018160813692,
  11380. "size": 5,
  11381. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  11382. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  11383. "target": 0,
  11384. "dataset": "other",
  11385. "idx": 429744
  11386. },
  11387. {
  11388. "func": "my_bool STDCALL mysql_commit(MYSQL *mysql)\n{\n return((my_bool)mysql_real_query(mysql, \"COMMIT\", (unsigned long)strlen(\"COMMIT\")));\n}",
  11389. "project": "mariadb-connector-c",
  11390. "hash": 277806673306036671992080538600299334387,
  11391. "size": 4,
  11392. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  11393. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  11394. "target": 0,
  11395. "dataset": "other",
  11396. "idx": 429632
  11397. },
  11398. {
  11399. "func": "mysql_query(MYSQL *mysql, const char *query)\n{\n return mysql_real_query(mysql,query, (unsigned long) strlen(query));\n}",
  11400. "project": "mariadb-connector-c",
  11401. "hash": 208668653661987079458603989521521130525,
  11402. "size": 4,
  11403. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  11404. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  11405. "target": 0,
  11406. "dataset": "other",
  11407. "idx": 429682
  11408. },
  11409. {
  11410. "func": "int STDCALL mysql_set_character_set(MYSQL *mysql, const char *csname)\n{\n const MARIADB_CHARSET_INFO *cs;\n\n if (!csname)\n goto error;\n\n if ((cs= mysql_find_charset_name(csname)))\n {\n char buff[64];\n\n snprintf(buff, 63, \"SET NAMES %s\", cs->csname);\n if (!mysql_real_query(mysql, buff, (unsigned long)strlen(buff)))\n {\n mysql->charset= cs;\n return(0);\n }\n return(mysql->net.last_errno);\n }\n\nerror:\n my_set_error(mysql, CR_CANT_READ_CHARSET, SQLSTATE_UNKNOWN,\n 0, csname, \"compiled_in\");\n return(mysql->net.last_errno);\n}",
  11411. "project": "mariadb-connector-c",
  11412. "hash": 308536125327576078874356108592490986962,
  11413. "size": 25,
  11414. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  11415. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  11416. "target": 0,
  11417. "dataset": "other",
  11418. "idx": 429715
  11419. },
  11420. {
  11421. "func": "my_bool STDCALL mysql_rollback(MYSQL *mysql)\n{\n return((my_bool)mysql_real_query(mysql, \"ROLLBACK\", (unsigned long)strlen(\"ROLLBACK\")));\n}",
  11422. "project": "mariadb-connector-c",
  11423. "hash": 198193360316179830187275108416911562349,
  11424. "size": 4,
  11425. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  11426. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  11427. "target": 0,
  11428. "dataset": "other",
  11429. "idx": 429718
  11430. },
  11431. {
  11432. "func": "void my_set_error(MYSQL *mysql,\n unsigned int error_nr,\n const char *sqlstate,\n const char *format,\n ...)\n{\n va_list ap;\n\n const char *errmsg;\n\n if (!format)\n {\n if (error_nr >= CR_MIN_ERROR && error_nr <= CR_MYSQL_LAST_ERROR)\n errmsg= ER(error_nr);\n else if (error_nr >= CER_MIN_ERROR && error_nr <= CR_MARIADB_LAST_ERROR)\n errmsg= CER(error_nr);\n else\n errmsg= ER(CR_UNKNOWN_ERROR);\n }\n\n mysql->net.last_errno= error_nr;\n ma_strmake(mysql->net.sqlstate, sqlstate, SQLSTATE_LENGTH);\n va_start(ap, format);\n vsnprintf(mysql->net.last_error, MYSQL_ERRMSG_SIZE - 1,\n format ? format : errmsg, ap);\n va_end(ap);\n return;\n}",
  11433. "project": "mariadb-connector-c",
  11434. "hash": 255550454870437716355738647373684959112,
  11435. "size": 28,
  11436. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  11437. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  11438. "target": 0,
  11439. "dataset": "other",
  11440. "idx": 429625
  11441. },
  11442. {
  11443. "func": "my_bool STDCALL mariadb_reconnect(MYSQL *mysql)\n{\n MYSQL tmp_mysql;\n struct my_hook_data hook_data;\n struct mysql_async_context *ctxt= NULL;\n LIST *li_stmt= mysql->stmts;\n\n /* check if connection handler is active */\n if (IS_CONNHDLR_ACTIVE(mysql))\n {\n if (mysql->extension->conn_hdlr->plugin && mysql->extension->conn_hdlr->plugin->reconnect)\n return(mysql->extension->conn_hdlr->plugin->reconnect(mysql));\n }\n\n if (!mysql->options.reconnect ||\n (mysql->server_status & SERVER_STATUS_IN_TRANS) || !mysql->host_info)\n {\n /* Allow reconnect next time */\n mysql->server_status&= ~SERVER_STATUS_IN_TRANS;\n my_set_error(mysql, CR_SERVER_GONE_ERROR, SQLSTATE_UNKNOWN, 0);\n return(1);\n }\n\n mysql_init(&tmp_mysql);\n tmp_mysql.free_me= 0;\n tmp_mysql.options=mysql->options;\n if (mysql->extension->conn_hdlr)\n {\n tmp_mysql.extension->conn_hdlr= mysql->extension->conn_hdlr;\n mysql->extension->conn_hdlr= 0;\n }\n\n /* don't reread options from configuration files */\n tmp_mysql.options.my_cnf_group= tmp_mysql.options.my_cnf_file= NULL;\n if (IS_MYSQL_ASYNC_ACTIVE(mysql))\n {\n ctxt= mysql->options.extension->async_context;\n hook_data.orig_mysql= mysql;\n hook_data.new_mysql= &tmp_mysql;\n hook_data.orig_pvio= mysql->net.pvio;\n my_context_install_suspend_resume_hook(ctxt, my_suspend_hook, &hook_data);\n }\n\n if (!mysql_real_connect(&tmp_mysql,mysql->host,mysql->user,mysql->passwd,\n\t\t\t mysql->db, mysql->port, mysql->unix_socket,\n\t\t\t mysql->client_flag | CLIENT_REMEMBER_OPTIONS) ||\n mysql_set_character_set(&tmp_mysql, mysql->charset->csname))\n {\n if (ctxt)\n my_context_install_suspend_resume_hook(ctxt, NULL, NULL);\n /* don't free options (CONC-118) */\n memset(&tmp_mysql.options, 0, sizeof(struct st_mysql_options));\n my_set_error(mysql, tmp_mysql.net.last_errno,\n tmp_mysql.net.sqlstate,\n tmp_mysql.net.last_error);\n mysql_close(&tmp_mysql);\n return(1);\n }\n\n for (;li_stmt;li_stmt= li_stmt->next)\n {\n MYSQL_STMT *stmt= (MYSQL_STMT *)li_stmt->data;\n\n if (stmt->state != MYSQL_STMT_INITTED)\n {\n stmt->state= MYSQL_STMT_INITTED;\n SET_CLIENT_STMT_ERROR(stmt, CR_SERVER_LOST, SQLSTATE_UNKNOWN, 0);\n }\n }\n\n tmp_mysql.free_me= mysql->free_me;\n tmp_mysql.stmts= mysql->stmts;\n mysql->stmts= NULL;\n\n if (ctxt)\n my_context_install_suspend_resume_hook(ctxt, NULL, NULL);\n /* Don't free options, we moved them to tmp_mysql */\n memset(&mysql->options, 0, sizeof(mysql->options));\n mysql->free_me=0;\n mysql_close(mysql);\n *mysql=tmp_mysql;\n mysql->net.pvio->mysql= mysql;\n ma_net_clear(&mysql->net);\n mysql->affected_rows= ~(unsigned long long) 0;\n mysql->info= 0;\n return(0);\n}",
  11444. "project": "mariadb-connector-c",
  11445. "hash": 43534428296790047385030562430603162760,
  11446. "size": 87,
  11447. "commit_id": "2759b87d72926b7c9b5426437a7c8dd15ff57945",
  11448. "message": "sanity checks for client-supplied OK packet content\n\nreported by Matthias Kaiser, Apple Information Security",
  11449. "target": 0,
  11450. "dataset": "other",
  11451. "idx": 429675
  11452. }
  11453. ]
  11454. },
  11455. {
  11456. "call_depth": 3,
  11457. "longest_call_chain": [
  11458. "kvm_resume",
  11459. "hardware_enable_nolock",
  11460. "kvm_arch_hardware_enable"
  11461. ],
  11462. "group_size": 4,
  11463. "functions": [
  11464. {
  11465. "func": "static void hardware_enable_nolock(void *junk)\n{\n\tint cpu = raw_smp_processor_id();\n\tint r;\n\n\tif (cpumask_test_cpu(cpu, cpus_hardware_enabled))\n\t\treturn;\n\n\tcpumask_set_cpu(cpu, cpus_hardware_enabled);\n\n\tr = kvm_arch_hardware_enable();\n\n\tif (r) {\n\t\tcpumask_clear_cpu(cpu, cpus_hardware_enabled);\n\t\tatomic_inc(&hardware_enable_failed);\n\t\tpr_info(\"kvm: enabling virtualization on CPU%d failed\\n\", cpu);\n\t}\n}",
  11466. "project": "linux",
  11467. "hash": 263560706724937534113049149347748343735,
  11468. "size": 18,
  11469. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  11470. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11471. "target": 0,
  11472. "dataset": "other",
  11473. "idx": 354793
  11474. },
  11475. {
  11476. "func": "int kvm_arch_hardware_enable(void)\n{\n\t/* every s390 is virtualization enabled ;-) */\n\treturn 0;\n}",
  11477. "project": "linux",
  11478. "hash": 143943492953819740075059104517356620906,
  11479. "size": 5,
  11480. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  11481. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11482. "target": 0,
  11483. "dataset": "other",
  11484. "idx": 354514
  11485. },
  11486. {
  11487. "func": "static void kvm_resume(void)\n{\n\tif (kvm_usage_count) {\n#ifdef CONFIG_LOCKDEP\n\t\tWARN_ON(lockdep_is_held(&kvm_count_lock));\n#endif\n\t\thardware_enable_nolock(NULL);\n\t}\n}",
  11488. "project": "linux",
  11489. "hash": 90841378524437743140245635783206034476,
  11490. "size": 9,
  11491. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  11492. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11493. "target": 0,
  11494. "dataset": "other",
  11495. "idx": 354698
  11496. },
  11497. {
  11498. "func": "static int kvm_starting_cpu(unsigned int cpu)\n{\n\traw_spin_lock(&kvm_count_lock);\n\tif (kvm_usage_count)\n\t\thardware_enable_nolock(NULL);\n\traw_spin_unlock(&kvm_count_lock);\n\treturn 0;\n}",
  11499. "project": "linux",
  11500. "hash": 159417518360892180577795405365108644057,
  11501. "size": 8,
  11502. "commit_id": "0774a964ef561b7170d8d1b1bfe6f88002b6d219",
  11503. "message": "KVM: Fix out of range accesses to memslots\n\nReset the LRU slot if it becomes invalid when deleting a memslot to fix\nan out-of-bounds/use-after-free access when searching through memslots.\n\nExplicitly check for there being no used slots in search_memslots(), and\nin the caller of s390's approximation variant.\n\nFixes: 36947254e5f9 (\"KVM: Dynamically size memslot array based on number of used slots\")\nReported-by: Qian Cai <cai@lca.pw>\nCc: Peter Xu <peterx@redhat.com>\nSigned-off-by: Sean Christopherson <sean.j.christopherson@intel.com>\nMessage-Id: <20200320205546.2396-2-sean.j.christopherson@intel.com>\nAcked-by: Christian Borntraeger <borntraeger@de.ibm.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11504. "target": 0,
  11505. "dataset": "other",
  11506. "idx": 354730
  11507. }
  11508. ]
  11509. },
  11510. {
  11511. "call_depth": 3,
  11512. "longest_call_chain": [
  11513. "test_r_str_bits64",
  11514. "r_str_bits64",
  11515. "trimbits"
  11516. ],
  11517. "group_size": 3,
  11518. "functions": [
  11519. {
  11520. "func": "static void trimbits(char *b) {\n\tconst int len = strlen (b);\n\tchar *one = strchr (b, '1');\n\tint pos = one ? (int)(size_t)(one - b) : len - 1;\n\tpos = (pos / 8) * 8;\n\tmemmove (b, b + pos, len - pos + 1);\n}",
  11521. "project": "radare2",
  11522. "hash": 250137149611511151531453188080985035917,
  11523. "size": 7,
  11524. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  11525. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  11526. "target": 0,
  11527. "dataset": "other",
  11528. "idx": 268960
  11529. },
  11530. {
  11531. "func": "R_API int r_str_bits64(char* strout, ut64 in) {\n\tint i, bit, count = 0;\n\tcount = 0;\n\tfor (i = (sizeof (in) * 8) - 1; i >= 0; i--) {\n\t\tbit = in >> i;\n\t\tif (bit & 1) {\n\t\t\tstrout[count] = '1';\n\t\t} else {\n\t\t\tstrout[count] = '0';\n\t\t}\n\t\tcount++;\n\t}\n\tstrout[count] = '\\0';\n\t/* trim by 8 bits */\n\ttrimbits (strout);\n\treturn count;\n}",
  11532. "project": "radare2",
  11533. "hash": 169601071216008749437034713873681196176,
  11534. "size": 17,
  11535. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  11536. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  11537. "target": 0,
  11538. "dataset": "other",
  11539. "idx": 268873
  11540. },
  11541. {
  11542. "func": "bool test_r_str_bits64(void) {\n\tchar buf[65];\n\t(void)r_str_bits64 (buf, 0);\n\tmu_assert_streq (buf, \"00000000\", \"binary of 0\");\n\t(void)r_str_bits64 (buf, 1);\n\tmu_assert_streq (buf, \"00000001\", \"binary of 1\");\n\t(void)r_str_bits64 (buf, 2);\n\tmu_assert_streq (buf, \"00000010\", \"binary of 2\");\n\tmu_end;\n}",
  11543. "project": "radare2",
  11544. "hash": 173974212266307538713308629725546730614,
  11545. "size": 10,
  11546. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  11547. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  11548. "target": 0,
  11549. "dataset": "other",
  11550. "idx": 269076
  11551. }
  11552. ]
  11553. },
  11554. {
  11555. "call_depth": 5,
  11556. "longest_call_chain": [
  11557. "svm_mem_enc_op",
  11558. "sev_guest_init",
  11559. "sev_asid_new",
  11560. "__sev_recycle_asids",
  11561. "sev_flush_asids"
  11562. ],
  11563. "group_size": 42,
  11564. "functions": [
  11565. {
  11566. "func": "static void sev_asid_free(int asid)\n{\n\tstruct svm_cpu_data *sd;\n\tint cpu, pos;\n\n\tmutex_lock(&sev_bitmap_lock);\n\n\tpos = asid - 1;\n\t__set_bit(pos, sev_reclaim_asid_bitmap);\n\n\tfor_each_possible_cpu(cpu) {\n\t\tsd = per_cpu(svm_data, cpu);\n\t\tsd->sev_vmcbs[pos] = NULL;\n\t}\n\n\tmutex_unlock(&sev_bitmap_lock);\n}",
  11567. "project": "linux",
  11568. "hash": 110051649451753639156279861145214543458,
  11569. "size": 17,
  11570. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11571. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11572. "target": 0,
  11573. "dataset": "other",
  11574. "idx": 432559
  11575. },
  11576. {
  11577. "func": "static int sev_bind_asid(struct kvm *kvm, unsigned int handle, int *error)\n{\n\tstruct sev_data_activate *data;\n\tint asid = sev_get_asid(kvm);\n\tint ret;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\treturn -ENOMEM;\n\n\t/* activate ASID on the given handle */\n\tdata->handle = handle;\n\tdata->asid = asid;\n\tret = sev_guest_activate(data, error);\n\tkfree(data);\n\n\treturn ret;\n}",
  11578. "project": "linux",
  11579. "hash": 11078279248666113617818639032846245096,
  11580. "size": 18,
  11581. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11582. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11583. "target": 0,
  11584. "dataset": "other",
  11585. "idx": 432393
  11586. },
  11587. {
  11588. "func": "static void __unregister_enc_region_locked(struct kvm *kvm,\n\t\t\t\t\t struct enc_region *region)\n{\n\t/*\n\t * The guest may change the memory encryption attribute from C=0 -> C=1\n\t * or vice versa for this memory range. Lets make sure caches are\n\t * flushed to ensure that guest data gets written into memory with\n\t * correct C-bit.\n\t */\n\tsev_clflush_pages(region->pages, region->npages);\n\n\tsev_unpin_memory(kvm, region->pages, region->npages);\n\tlist_del(&region->list);\n\tkfree(region);\n}",
  11589. "project": "linux",
  11590. "hash": 332068645346374939608708697430025474041,
  11591. "size": 15,
  11592. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11593. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11594. "target": 0,
  11595. "dataset": "other",
  11596. "idx": 432439
  11597. },
  11598. {
  11599. "func": "static void sev_unbind_asid(struct kvm *kvm, unsigned int handle)\n{\n\tstruct sev_data_decommission *decommission;\n\tstruct sev_data_deactivate *data;\n\n\tif (!handle)\n\t\treturn;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL);\n\tif (!data)\n\t\treturn;\n\n\t/* deactivate handle */\n\tdata->handle = handle;\n\n\t/* Guard DEACTIVATE against WBINVD/DF_FLUSH used in ASID recycling */\n\tdown_read(&sev_deactivate_lock);\n\tsev_guest_deactivate(data, NULL);\n\tup_read(&sev_deactivate_lock);\n\n\tkfree(data);\n\n\tdecommission = kzalloc(sizeof(*decommission), GFP_KERNEL);\n\tif (!decommission)\n\t\treturn;\n\n\t/* decommission handle */\n\tdecommission->handle = handle;\n\tsev_guest_decommission(decommission, NULL);\n\n\tkfree(decommission);\n}",
  11600. "project": "linux",
  11601. "hash": 124230634520433907125113308845834191374,
  11602. "size": 32,
  11603. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11604. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11605. "target": 0,
  11606. "dataset": "other",
  11607. "idx": 432576
  11608. },
  11609. {
  11610. "func": "static int sev_launch_measure(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tvoid __user *measure = (void __user *)(uintptr_t)argp->data;\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct sev_data_launch_measure *data;\n\tstruct kvm_sev_launch_measure params;\n\tvoid __user *p = NULL;\n\tvoid *blob = NULL;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&params, measure, sizeof(params)))\n\t\treturn -EFAULT;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\treturn -ENOMEM;\n\n\t/* User wants to query the blob length */\n\tif (!params.len)\n\t\tgoto cmd;\n\n\tp = (void __user *)(uintptr_t)params.uaddr;\n\tif (p) {\n\t\tif (params.len > SEV_FW_BLOB_MAX_SIZE) {\n\t\t\tret = -EINVAL;\n\t\t\tgoto e_free;\n\t\t}\n\n\t\tret = -ENOMEM;\n\t\tblob = kmalloc(params.len, GFP_KERNEL);\n\t\tif (!blob)\n\t\t\tgoto e_free;\n\n\t\tdata->address = __psp_pa(blob);\n\t\tdata->len = params.len;\n\t}\n\ncmd:\n\tdata->handle = sev->handle;\n\tret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_MEASURE, data, &argp->error);\n\n\t/*\n\t * If we query the session length, FW responded with expected data.\n\t */\n\tif (!params.len)\n\t\tgoto done;\n\n\tif (ret)\n\t\tgoto e_free_blob;\n\n\tif (blob) {\n\t\tif (copy_to_user(p, blob, params.len))\n\t\t\tret = -EFAULT;\n\t}\n\ndone:\n\tparams.len = data->len;\n\tif (copy_to_user(measure, &params, sizeof(params)))\n\t\tret = -EFAULT;\ne_free_blob:\n\tkfree(blob);\ne_free:\n\tkfree(data);\n\treturn ret;\n}",
  11611. "project": "linux",
  11612. "hash": 79508873500671794631728108819545045296,
  11613. "size": 68,
  11614. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11615. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11616. "target": 0,
  11617. "dataset": "other",
  11618. "idx": 432541
  11619. },
  11620. {
  11621. "func": "static int svm_register_enc_region(struct kvm *kvm,\n\t\t\t\t struct kvm_enc_region *range)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct enc_region *region;\n\tint ret = 0;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (range->addr > ULONG_MAX || range->size > ULONG_MAX)\n\t\treturn -EINVAL;\n\n\tregion = kzalloc(sizeof(*region), GFP_KERNEL_ACCOUNT);\n\tif (!region)\n\t\treturn -ENOMEM;\n\n\tregion->pages = sev_pin_memory(kvm, range->addr, range->size, &region->npages, 1);\n\tif (!region->pages) {\n\t\tret = -ENOMEM;\n\t\tgoto e_free;\n\t}\n\n\t/*\n\t * The guest may change the memory encryption attribute from C=0 -> C=1\n\t * or vice versa for this memory range. Lets make sure caches are\n\t * flushed to ensure that guest data gets written into memory with\n\t * correct C-bit.\n\t */\n\tsev_clflush_pages(region->pages, region->npages);\n\n\tregion->uaddr = range->addr;\n\tregion->size = range->size;\n\n\tmutex_lock(&kvm->lock);\n\tlist_add_tail(&region->list, &sev->regions_list);\n\tmutex_unlock(&kvm->lock);\n\n\treturn ret;\n\ne_free:\n\tkfree(region);\n\treturn ret;\n}",
  11622. "project": "linux",
  11623. "hash": 340188249972174187229020738901262857840,
  11624. "size": 44,
  11625. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11626. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11627. "target": 0,
  11628. "dataset": "other",
  11629. "idx": 432396
  11630. },
  11631. {
  11632. "func": "int svm_register_enc_region(struct kvm *kvm,\n\t\t\t struct kvm_enc_region *range)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct enc_region *region;\n\tint ret = 0;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (range->addr > ULONG_MAX || range->size > ULONG_MAX)\n\t\treturn -EINVAL;\n\n\tregion = kzalloc(sizeof(*region), GFP_KERNEL_ACCOUNT);\n\tif (!region)\n\t\treturn -ENOMEM;\n\n\tregion->pages = sev_pin_memory(kvm, range->addr, range->size, &region->npages, 1);\n\tif (IS_ERR(region->pages)) {\n\t\tret = PTR_ERR(region->pages);\n\t\tgoto e_free;\n\t}\n\n\t/*\n\t * The guest may change the memory encryption attribute from C=0 -> C=1\n\t * or vice versa for this memory range. Lets make sure caches are\n\t * flushed to ensure that guest data gets written into memory with\n\t * correct C-bit.\n\t */\n\tsev_clflush_pages(region->pages, region->npages);\n\n\tregion->uaddr = range->addr;\n\tregion->size = range->size;\n\n\tmutex_lock(&kvm->lock);\n\tlist_add_tail(&region->list, &sev->regions_list);\n\tmutex_unlock(&kvm->lock);\n\n\treturn ret;\n\ne_free:\n\tkfree(region);\n\treturn ret;\n}",
  11633. "project": "linux",
  11634. "hash": 261026284960045719300334748438486467719,
  11635. "size": 44,
  11636. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11637. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11638. "target": 0,
  11639. "dataset": "other",
  11640. "idx": 463018
  11641. },
  11642. {
  11643. "func": "static int svm_mem_enc_op(struct kvm *kvm, void __user *argp)\n{\n\tstruct kvm_sev_cmd sev_cmd;\n\tint r;\n\n\tif (!svm_sev_enabled())\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&sev_cmd, argp, sizeof(struct kvm_sev_cmd)))\n\t\treturn -EFAULT;\n\n\tmutex_lock(&kvm->lock);\n\n\tswitch (sev_cmd.id) {\n\tcase KVM_SEV_INIT:\n\t\tr = sev_guest_init(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_START:\n\t\tr = sev_launch_start(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_UPDATE_DATA:\n\t\tr = sev_launch_update_data(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_MEASURE:\n\t\tr = sev_launch_measure(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_FINISH:\n\t\tr = sev_launch_finish(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_GUEST_STATUS:\n\t\tr = sev_guest_status(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_DBG_DECRYPT:\n\t\tr = sev_dbg_crypt(kvm, &sev_cmd, true);\n\t\tbreak;\n\tcase KVM_SEV_DBG_ENCRYPT:\n\t\tr = sev_dbg_crypt(kvm, &sev_cmd, false);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_SECRET:\n\t\tr = sev_launch_secret(kvm, &sev_cmd);\n\t\tbreak;\n\tdefault:\n\t\tr = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif (copy_to_user(argp, &sev_cmd, sizeof(struct kvm_sev_cmd)))\n\t\tr = -EFAULT;\n\nout:\n\tmutex_unlock(&kvm->lock);\n\treturn r;\n}",
  11644. "project": "linux",
  11645. "hash": 40960850045783148870263081172067868276,
  11646. "size": 53,
  11647. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11648. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11649. "target": 0,
  11650. "dataset": "other",
  11651. "idx": 432521
  11652. },
  11653. {
  11654. "func": "int svm_mem_enc_op(struct kvm *kvm, void __user *argp)\n{\n\tstruct kvm_sev_cmd sev_cmd;\n\tint r;\n\n\tif (!svm_sev_enabled())\n\t\treturn -ENOTTY;\n\n\tif (!argp)\n\t\treturn 0;\n\n\tif (copy_from_user(&sev_cmd, argp, sizeof(struct kvm_sev_cmd)))\n\t\treturn -EFAULT;\n\n\tmutex_lock(&kvm->lock);\n\n\tswitch (sev_cmd.id) {\n\tcase KVM_SEV_INIT:\n\t\tr = sev_guest_init(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_START:\n\t\tr = sev_launch_start(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_UPDATE_DATA:\n\t\tr = sev_launch_update_data(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_MEASURE:\n\t\tr = sev_launch_measure(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_FINISH:\n\t\tr = sev_launch_finish(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_GUEST_STATUS:\n\t\tr = sev_guest_status(kvm, &sev_cmd);\n\t\tbreak;\n\tcase KVM_SEV_DBG_DECRYPT:\n\t\tr = sev_dbg_crypt(kvm, &sev_cmd, true);\n\t\tbreak;\n\tcase KVM_SEV_DBG_ENCRYPT:\n\t\tr = sev_dbg_crypt(kvm, &sev_cmd, false);\n\t\tbreak;\n\tcase KVM_SEV_LAUNCH_SECRET:\n\t\tr = sev_launch_secret(kvm, &sev_cmd);\n\t\tbreak;\n\tdefault:\n\t\tr = -EINVAL;\n\t\tgoto out;\n\t}\n\n\tif (copy_to_user(argp, &sev_cmd, sizeof(struct kvm_sev_cmd)))\n\t\tr = -EFAULT;\n\nout:\n\tmutex_unlock(&kvm->lock);\n\treturn r;\n}",
  11655. "project": "linux",
  11656. "hash": 252759964062877013724591152636074133940,
  11657. "size": 56,
  11658. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11659. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11660. "target": 0,
  11661. "dataset": "other",
  11662. "idx": 463014
  11663. },
  11664. {
  11665. "func": "void sev_hardware_teardown(void)\n{\n\tif (!svm_sev_enabled())\n\t\treturn;\n\n\tbitmap_free(sev_asid_bitmap);\n\tbitmap_free(sev_reclaim_asid_bitmap);\n\n\tsev_flush_asids();\n}",
  11666. "project": "linux",
  11667. "hash": 3595474365089806791872833678690839230,
  11668. "size": 10,
  11669. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11670. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11671. "target": 0,
  11672. "dataset": "other",
  11673. "idx": 463024
  11674. },
  11675. {
  11676. "func": "static int __sev_dbg_decrypt(struct kvm *kvm, unsigned long src_paddr,\n\t\t\t unsigned long dst_paddr, int sz, int *err)\n{\n\tint offset;\n\n\t/*\n\t * Its safe to read more than we are asked, caller should ensure that\n\t * destination has enough space.\n\t */\n\tsrc_paddr = round_down(src_paddr, 16);\n\toffset = src_paddr & 15;\n\tsz = round_up(sz + offset, 16);\n\n\treturn __sev_issue_dbg_cmd(kvm, src_paddr, dst_paddr, sz, err, false);\n}",
  11677. "project": "linux",
  11678. "hash": 42537997646210310897681143075413218426,
  11679. "size": 15,
  11680. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11681. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11682. "target": 0,
  11683. "dataset": "other",
  11684. "idx": 432503
  11685. },
  11686. {
  11687. "func": "void sev_vm_destroy(struct kvm *kvm)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct list_head *head = &sev->regions_list;\n\tstruct list_head *pos, *q;\n\n\tif (!sev_guest(kvm))\n\t\treturn;\n\n\tmutex_lock(&kvm->lock);\n\n\t/*\n\t * Ensure that all guest tagged cache entries are flushed before\n\t * releasing the pages back to the system for use. CLFLUSH will\n\t * not do this, so issue a WBINVD.\n\t */\n\twbinvd_on_all_cpus();\n\n\t/*\n\t * if userspace was terminated before unregistering the memory regions\n\t * then lets unpin all the registered memory.\n\t */\n\tif (!list_empty(head)) {\n\t\tlist_for_each_safe(pos, q, head) {\n\t\t\t__unregister_enc_region_locked(kvm,\n\t\t\t\tlist_entry(pos, struct enc_region, list));\n\t\t}\n\t}\n\n\tmutex_unlock(&kvm->lock);\n\n\tsev_unbind_asid(kvm, sev->handle);\n\tsev_asid_free(sev->asid);\n}",
  11688. "project": "linux",
  11689. "hash": 59854663405289045336965850461540245489,
  11690. "size": 34,
  11691. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11692. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11693. "target": 1,
  11694. "dataset": "other",
  11695. "idx": 212916
  11696. },
  11697. {
  11698. "func": "static void sev_vm_destroy(struct kvm *kvm)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct list_head *head = &sev->regions_list;\n\tstruct list_head *pos, *q;\n\n\tif (!sev_guest(kvm))\n\t\treturn;\n\n\tmutex_lock(&kvm->lock);\n\n\t/*\n\t * if userspace was terminated before unregistering the memory regions\n\t * then lets unpin all the registered memory.\n\t */\n\tif (!list_empty(head)) {\n\t\tlist_for_each_safe(pos, q, head) {\n\t\t\t__unregister_enc_region_locked(kvm,\n\t\t\t\tlist_entry(pos, struct enc_region, list));\n\t\t}\n\t}\n\n\tmutex_unlock(&kvm->lock);\n\n\tsev_unbind_asid(kvm, sev->handle);\n\tsev_asid_free(sev->asid);\n}",
  11699. "project": "linux",
  11700. "hash": 148708266910677575433322269002046744158,
  11701. "size": 27,
  11702. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11703. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11704. "target": 0,
  11705. "dataset": "other",
  11706. "idx": 432605
  11707. },
  11708. {
  11709. "func": "void sev_vm_destroy(struct kvm *kvm)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct list_head *head = &sev->regions_list;\n\tstruct list_head *pos, *q;\n\n\tif (!sev_guest(kvm))\n\t\treturn;\n\n\tmutex_lock(&kvm->lock);\n\n\t/*\n\t * Ensure that all guest tagged cache entries are flushed before\n\t * releasing the pages back to the system for use. CLFLUSH will\n\t * not do this, so issue a WBINVD.\n\t */\n\twbinvd_on_all_cpus();\n\n\t/*\n\t * if userspace was terminated before unregistering the memory regions\n\t * then lets unpin all the registered memory.\n\t */\n\tif (!list_empty(head)) {\n\t\tlist_for_each_safe(pos, q, head) {\n\t\t\t__unregister_enc_region_locked(kvm,\n\t\t\t\tlist_entry(pos, struct enc_region, list));\n\t\t\tcond_resched();\n\t\t}\n\t}\n\n\tmutex_unlock(&kvm->lock);\n\n\tsev_unbind_asid(kvm, sev->handle);\n\tsev_asid_free(sev->asid);\n}",
  11710. "project": "linux",
  11711. "hash": 32944969904859958026118495600871042845,
  11712. "size": 35,
  11713. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11714. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11715. "target": 0,
  11716. "dataset": "other",
  11717. "idx": 463016
  11718. },
  11719. {
  11720. "func": "static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tunsigned long vaddr, vaddr_end, next_vaddr, npages, pages, size, i;\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct kvm_sev_launch_update_data params;\n\tstruct sev_data_launch_update_data *data;\n\tstruct page **inpages;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&params, (void __user *)(uintptr_t)argp->data, sizeof(params)))\n\t\treturn -EFAULT;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\treturn -ENOMEM;\n\n\tvaddr = params.uaddr;\n\tsize = params.len;\n\tvaddr_end = vaddr + size;\n\n\t/* Lock the user memory. */\n\tinpages = sev_pin_memory(kvm, vaddr, size, &npages, 1);\n\tif (!inpages) {\n\t\tret = -ENOMEM;\n\t\tgoto e_free;\n\t}\n\n\t/*\n\t * The LAUNCH_UPDATE command will perform in-place encryption of the\n\t * memory content (i.e it will write the same memory region with C=1).\n\t * It's possible that the cache may contain the data with C=0, i.e.,\n\t * unencrypted so invalidate it first.\n\t */\n\tsev_clflush_pages(inpages, npages);\n\n\tfor (i = 0; vaddr < vaddr_end; vaddr = next_vaddr, i += pages) {\n\t\tint offset, len;\n\n\t\t/*\n\t\t * If the user buffer is not page-aligned, calculate the offset\n\t\t * within the page.\n\t\t */\n\t\toffset = vaddr & (PAGE_SIZE - 1);\n\n\t\t/* Calculate the number of pages that can be encrypted in one go. */\n\t\tpages = get_num_contig_pages(i, inpages, npages);\n\n\t\tlen = min_t(size_t, ((pages * PAGE_SIZE) - offset), size);\n\n\t\tdata->handle = sev->handle;\n\t\tdata->len = len;\n\t\tdata->address = __sme_page_pa(inpages[i]) + offset;\n\t\tret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_UPDATE_DATA, data, &argp->error);\n\t\tif (ret)\n\t\t\tgoto e_unpin;\n\n\t\tsize -= len;\n\t\tnext_vaddr = vaddr + len;\n\t}\n\ne_unpin:\n\t/* content of memory is updated, mark pages dirty */\n\tfor (i = 0; i < npages; i++) {\n\t\tset_page_dirty_lock(inpages[i]);\n\t\tmark_page_accessed(inpages[i]);\n\t}\n\t/* unlock the user pages */\n\tsev_unpin_memory(kvm, inpages, npages);\ne_free:\n\tkfree(data);\n\treturn ret;\n}",
  11721. "project": "linux",
  11722. "hash": 259237632331430277631833096548130017898,
  11723. "size": 75,
  11724. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11725. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11726. "target": 0,
  11727. "dataset": "other",
  11728. "idx": 432467
  11729. },
  11730. {
  11731. "func": "static int sev_launch_update_data(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tunsigned long vaddr, vaddr_end, next_vaddr, npages, pages, size, i;\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct kvm_sev_launch_update_data params;\n\tstruct sev_data_launch_update_data *data;\n\tstruct page **inpages;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&params, (void __user *)(uintptr_t)argp->data, sizeof(params)))\n\t\treturn -EFAULT;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\treturn -ENOMEM;\n\n\tvaddr = params.uaddr;\n\tsize = params.len;\n\tvaddr_end = vaddr + size;\n\n\t/* Lock the user memory. */\n\tinpages = sev_pin_memory(kvm, vaddr, size, &npages, 1);\n\tif (IS_ERR(inpages)) {\n\t\tret = PTR_ERR(inpages);\n\t\tgoto e_free;\n\t}\n\n\t/*\n\t * The LAUNCH_UPDATE command will perform in-place encryption of the\n\t * memory content (i.e it will write the same memory region with C=1).\n\t * It's possible that the cache may contain the data with C=0, i.e.,\n\t * unencrypted so invalidate it first.\n\t */\n\tsev_clflush_pages(inpages, npages);\n\n\tfor (i = 0; vaddr < vaddr_end; vaddr = next_vaddr, i += pages) {\n\t\tint offset, len;\n\n\t\t/*\n\t\t * If the user buffer is not page-aligned, calculate the offset\n\t\t * within the page.\n\t\t */\n\t\toffset = vaddr & (PAGE_SIZE - 1);\n\n\t\t/* Calculate the number of pages that can be encrypted in one go. */\n\t\tpages = get_num_contig_pages(i, inpages, npages);\n\n\t\tlen = min_t(size_t, ((pages * PAGE_SIZE) - offset), size);\n\n\t\tdata->handle = sev->handle;\n\t\tdata->len = len;\n\t\tdata->address = __sme_page_pa(inpages[i]) + offset;\n\t\tret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_UPDATE_DATA, data, &argp->error);\n\t\tif (ret)\n\t\t\tgoto e_unpin;\n\n\t\tsize -= len;\n\t\tnext_vaddr = vaddr + len;\n\t}\n\ne_unpin:\n\t/* content of memory is updated, mark pages dirty */\n\tfor (i = 0; i < npages; i++) {\n\t\tset_page_dirty_lock(inpages[i]);\n\t\tmark_page_accessed(inpages[i]);\n\t}\n\t/* unlock the user pages */\n\tsev_unpin_memory(kvm, inpages, npages);\ne_free:\n\tkfree(data);\n\treturn ret;\n}",
  11732. "project": "linux",
  11733. "hash": 169613976698129785300011515650129741913,
  11734. "size": 75,
  11735. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11736. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11737. "target": 0,
  11738. "dataset": "other",
  11739. "idx": 463021
  11740. },
  11741. {
  11742. "func": "static bool __sev_recycle_asids(void)\n{\n\tint pos;\n\n\t/* Check if there are any ASIDs to reclaim before performing a flush */\n\tpos = find_next_bit(sev_reclaim_asid_bitmap,\n\t\t\t max_sev_asid, min_sev_asid - 1);\n\tif (pos >= max_sev_asid)\n\t\treturn false;\n\n\tif (sev_flush_asids())\n\t\treturn false;\n\n\tbitmap_xor(sev_asid_bitmap, sev_asid_bitmap, sev_reclaim_asid_bitmap,\n\t\t max_sev_asid);\n\tbitmap_zero(sev_reclaim_asid_bitmap, max_sev_asid);\n\n\treturn true;\n}",
  11743. "project": "linux",
  11744. "hash": 54780876933145881155257222834486811611,
  11745. "size": 19,
  11746. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11747. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11748. "target": 0,
  11749. "dataset": "other",
  11750. "idx": 432446
  11751. },
  11752. {
  11753. "func": "static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec)\n{\n\tunsigned long vaddr, vaddr_end, next_vaddr;\n\tunsigned long dst_vaddr;\n\tstruct page **src_p, **dst_p;\n\tstruct kvm_sev_dbg debug;\n\tunsigned long n;\n\tunsigned int size;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug)))\n\t\treturn -EFAULT;\n\n\tif (!debug.len || debug.src_uaddr + debug.len < debug.src_uaddr)\n\t\treturn -EINVAL;\n\tif (!debug.dst_uaddr)\n\t\treturn -EINVAL;\n\n\tvaddr = debug.src_uaddr;\n\tsize = debug.len;\n\tvaddr_end = vaddr + size;\n\tdst_vaddr = debug.dst_uaddr;\n\n\tfor (; vaddr < vaddr_end; vaddr = next_vaddr) {\n\t\tint len, s_off, d_off;\n\n\t\t/* lock userspace source and destination page */\n\t\tsrc_p = sev_pin_memory(kvm, vaddr & PAGE_MASK, PAGE_SIZE, &n, 0);\n\t\tif (!src_p)\n\t\t\treturn -EFAULT;\n\n\t\tdst_p = sev_pin_memory(kvm, dst_vaddr & PAGE_MASK, PAGE_SIZE, &n, 1);\n\t\tif (!dst_p) {\n\t\t\tsev_unpin_memory(kvm, src_p, n);\n\t\t\treturn -EFAULT;\n\t\t}\n\n\t\t/*\n\t\t * The DBG_{DE,EN}CRYPT commands will perform {dec,en}cryption of the\n\t\t * memory content (i.e it will write the same memory region with C=1).\n\t\t * It's possible that the cache may contain the data with C=0, i.e.,\n\t\t * unencrypted so invalidate it first.\n\t\t */\n\t\tsev_clflush_pages(src_p, 1);\n\t\tsev_clflush_pages(dst_p, 1);\n\n\t\t/*\n\t\t * Since user buffer may not be page aligned, calculate the\n\t\t * offset within the page.\n\t\t */\n\t\ts_off = vaddr & ~PAGE_MASK;\n\t\td_off = dst_vaddr & ~PAGE_MASK;\n\t\tlen = min_t(size_t, (PAGE_SIZE - s_off), size);\n\n\t\tif (dec)\n\t\t\tret = __sev_dbg_decrypt_user(kvm,\n\t\t\t\t\t\t __sme_page_pa(src_p[0]) + s_off,\n\t\t\t\t\t\t dst_vaddr,\n\t\t\t\t\t\t __sme_page_pa(dst_p[0]) + d_off,\n\t\t\t\t\t\t len, &argp->error);\n\t\telse\n\t\t\tret = __sev_dbg_encrypt_user(kvm,\n\t\t\t\t\t\t __sme_page_pa(src_p[0]) + s_off,\n\t\t\t\t\t\t vaddr,\n\t\t\t\t\t\t __sme_page_pa(dst_p[0]) + d_off,\n\t\t\t\t\t\t dst_vaddr,\n\t\t\t\t\t\t len, &argp->error);\n\n\t\tsev_unpin_memory(kvm, src_p, n);\n\t\tsev_unpin_memory(kvm, dst_p, n);\n\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tnext_vaddr = vaddr + len;\n\t\tdst_vaddr = dst_vaddr + len;\n\t\tsize -= len;\n\t}\nerr:\n\treturn ret;\n}",
  11754. "project": "linux",
  11755. "hash": 265362558599156376011885157508787748900,
  11756. "size": 84,
  11757. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11758. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11759. "target": 0,
  11760. "dataset": "other",
  11761. "idx": 432427
  11762. },
  11763. {
  11764. "func": "static int sev_dbg_crypt(struct kvm *kvm, struct kvm_sev_cmd *argp, bool dec)\n{\n\tunsigned long vaddr, vaddr_end, next_vaddr;\n\tunsigned long dst_vaddr;\n\tstruct page **src_p, **dst_p;\n\tstruct kvm_sev_dbg debug;\n\tunsigned long n;\n\tunsigned int size;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&debug, (void __user *)(uintptr_t)argp->data, sizeof(debug)))\n\t\treturn -EFAULT;\n\n\tif (!debug.len || debug.src_uaddr + debug.len < debug.src_uaddr)\n\t\treturn -EINVAL;\n\tif (!debug.dst_uaddr)\n\t\treturn -EINVAL;\n\n\tvaddr = debug.src_uaddr;\n\tsize = debug.len;\n\tvaddr_end = vaddr + size;\n\tdst_vaddr = debug.dst_uaddr;\n\n\tfor (; vaddr < vaddr_end; vaddr = next_vaddr) {\n\t\tint len, s_off, d_off;\n\n\t\t/* lock userspace source and destination page */\n\t\tsrc_p = sev_pin_memory(kvm, vaddr & PAGE_MASK, PAGE_SIZE, &n, 0);\n\t\tif (IS_ERR(src_p))\n\t\t\treturn PTR_ERR(src_p);\n\n\t\tdst_p = sev_pin_memory(kvm, dst_vaddr & PAGE_MASK, PAGE_SIZE, &n, 1);\n\t\tif (IS_ERR(dst_p)) {\n\t\t\tsev_unpin_memory(kvm, src_p, n);\n\t\t\treturn PTR_ERR(dst_p);\n\t\t}\n\n\t\t/*\n\t\t * The DBG_{DE,EN}CRYPT commands will perform {dec,en}cryption of the\n\t\t * memory content (i.e it will write the same memory region with C=1).\n\t\t * It's possible that the cache may contain the data with C=0, i.e.,\n\t\t * unencrypted so invalidate it first.\n\t\t */\n\t\tsev_clflush_pages(src_p, 1);\n\t\tsev_clflush_pages(dst_p, 1);\n\n\t\t/*\n\t\t * Since user buffer may not be page aligned, calculate the\n\t\t * offset within the page.\n\t\t */\n\t\ts_off = vaddr & ~PAGE_MASK;\n\t\td_off = dst_vaddr & ~PAGE_MASK;\n\t\tlen = min_t(size_t, (PAGE_SIZE - s_off), size);\n\n\t\tif (dec)\n\t\t\tret = __sev_dbg_decrypt_user(kvm,\n\t\t\t\t\t\t __sme_page_pa(src_p[0]) + s_off,\n\t\t\t\t\t\t dst_vaddr,\n\t\t\t\t\t\t __sme_page_pa(dst_p[0]) + d_off,\n\t\t\t\t\t\t len, &argp->error);\n\t\telse\n\t\t\tret = __sev_dbg_encrypt_user(kvm,\n\t\t\t\t\t\t __sme_page_pa(src_p[0]) + s_off,\n\t\t\t\t\t\t vaddr,\n\t\t\t\t\t\t __sme_page_pa(dst_p[0]) + d_off,\n\t\t\t\t\t\t dst_vaddr,\n\t\t\t\t\t\t len, &argp->error);\n\n\t\tsev_unpin_memory(kvm, src_p, n);\n\t\tsev_unpin_memory(kvm, dst_p, n);\n\n\t\tif (ret)\n\t\t\tgoto err;\n\n\t\tnext_vaddr = vaddr + len;\n\t\tdst_vaddr = dst_vaddr + len;\n\t\tsize -= len;\n\t}\nerr:\n\treturn ret;\n}",
  11765. "project": "linux",
  11766. "hash": 139266061284104979989439763930667103174,
  11767. "size": 84,
  11768. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11769. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11770. "target": 0,
  11771. "dataset": "other",
  11772. "idx": 463017
  11773. },
  11774. {
  11775. "func": "static int sev_launch_secret(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct sev_data_launch_secret *data;\n\tstruct kvm_sev_launch_secret params;\n\tstruct page **pages;\n\tvoid *blob, *hdr;\n\tunsigned long n;\n\tint ret, offset;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&params, (void __user *)(uintptr_t)argp->data, sizeof(params)))\n\t\treturn -EFAULT;\n\n\tpages = sev_pin_memory(kvm, params.guest_uaddr, params.guest_len, &n, 1);\n\tif (!pages)\n\t\treturn -ENOMEM;\n\n\t/*\n\t * The secret must be copied into contiguous memory region, lets verify\n\t * that userspace memory pages are contiguous before we issue command.\n\t */\n\tif (get_num_contig_pages(0, pages, n) != n) {\n\t\tret = -EINVAL;\n\t\tgoto e_unpin_memory;\n\t}\n\n\tret = -ENOMEM;\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\tgoto e_unpin_memory;\n\n\toffset = params.guest_uaddr & (PAGE_SIZE - 1);\n\tdata->guest_address = __sme_page_pa(pages[0]) + offset;\n\tdata->guest_len = params.guest_len;\n\n\tblob = psp_copy_user_blob(params.trans_uaddr, params.trans_len);\n\tif (IS_ERR(blob)) {\n\t\tret = PTR_ERR(blob);\n\t\tgoto e_free;\n\t}\n\n\tdata->trans_address = __psp_pa(blob);\n\tdata->trans_len = params.trans_len;\n\n\thdr = psp_copy_user_blob(params.hdr_uaddr, params.hdr_len);\n\tif (IS_ERR(hdr)) {\n\t\tret = PTR_ERR(hdr);\n\t\tgoto e_free_blob;\n\t}\n\tdata->hdr_address = __psp_pa(hdr);\n\tdata->hdr_len = params.hdr_len;\n\n\tdata->handle = sev->handle;\n\tret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_UPDATE_SECRET, data, &argp->error);\n\n\tkfree(hdr);\n\ne_free_blob:\n\tkfree(blob);\ne_free:\n\tkfree(data);\ne_unpin_memory:\n\tsev_unpin_memory(kvm, pages, n);\n\treturn ret;\n}",
  11776. "project": "linux",
  11777. "hash": 90014859234449724402896520757334760640,
  11778. "size": 68,
  11779. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11780. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11781. "target": 0,
  11782. "dataset": "other",
  11783. "idx": 432582
  11784. },
  11785. {
  11786. "func": "static int sev_launch_secret(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct sev_data_launch_secret *data;\n\tstruct kvm_sev_launch_secret params;\n\tstruct page **pages;\n\tvoid *blob, *hdr;\n\tunsigned long n;\n\tint ret, offset;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&params, (void __user *)(uintptr_t)argp->data, sizeof(params)))\n\t\treturn -EFAULT;\n\n\tpages = sev_pin_memory(kvm, params.guest_uaddr, params.guest_len, &n, 1);\n\tif (IS_ERR(pages))\n\t\treturn PTR_ERR(pages);\n\n\t/*\n\t * The secret must be copied into contiguous memory region, lets verify\n\t * that userspace memory pages are contiguous before we issue command.\n\t */\n\tif (get_num_contig_pages(0, pages, n) != n) {\n\t\tret = -EINVAL;\n\t\tgoto e_unpin_memory;\n\t}\n\n\tret = -ENOMEM;\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\tgoto e_unpin_memory;\n\n\toffset = params.guest_uaddr & (PAGE_SIZE - 1);\n\tdata->guest_address = __sme_page_pa(pages[0]) + offset;\n\tdata->guest_len = params.guest_len;\n\n\tblob = psp_copy_user_blob(params.trans_uaddr, params.trans_len);\n\tif (IS_ERR(blob)) {\n\t\tret = PTR_ERR(blob);\n\t\tgoto e_free;\n\t}\n\n\tdata->trans_address = __psp_pa(blob);\n\tdata->trans_len = params.trans_len;\n\n\thdr = psp_copy_user_blob(params.hdr_uaddr, params.hdr_len);\n\tif (IS_ERR(hdr)) {\n\t\tret = PTR_ERR(hdr);\n\t\tgoto e_free_blob;\n\t}\n\tdata->hdr_address = __psp_pa(hdr);\n\tdata->hdr_len = params.hdr_len;\n\n\tdata->handle = sev->handle;\n\tret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_UPDATE_SECRET, data, &argp->error);\n\n\tkfree(hdr);\n\ne_free_blob:\n\tkfree(blob);\ne_free:\n\tkfree(data);\ne_unpin_memory:\n\tsev_unpin_memory(kvm, pages, n);\n\treturn ret;\n}",
  11787. "project": "linux",
  11788. "hash": 53229546700636566703018700337684671345,
  11789. "size": 68,
  11790. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11791. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11792. "target": 0,
  11793. "dataset": "other",
  11794. "idx": 463023
  11795. },
  11796. {
  11797. "func": "static int svm_unregister_enc_region(struct kvm *kvm,\n\t\t\t\t struct kvm_enc_region *range)\n{\n\tstruct enc_region *region;\n\tint ret;\n\n\tmutex_lock(&kvm->lock);\n\n\tif (!sev_guest(kvm)) {\n\t\tret = -ENOTTY;\n\t\tgoto failed;\n\t}\n\n\tregion = find_enc_region(kvm, range);\n\tif (!region) {\n\t\tret = -EINVAL;\n\t\tgoto failed;\n\t}\n\n\t__unregister_enc_region_locked(kvm, region);\n\n\tmutex_unlock(&kvm->lock);\n\treturn 0;\n\nfailed:\n\tmutex_unlock(&kvm->lock);\n\treturn ret;\n}",
  11798. "project": "linux",
  11799. "hash": 52395066315231246157752429709320383363,
  11800. "size": 28,
  11801. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11802. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11803. "target": 0,
  11804. "dataset": "other",
  11805. "idx": 432404
  11806. },
  11807. {
  11808. "func": "int svm_unregister_enc_region(struct kvm *kvm,\n\t\t\t struct kvm_enc_region *range)\n{\n\tstruct enc_region *region;\n\tint ret;\n\n\tmutex_lock(&kvm->lock);\n\n\tif (!sev_guest(kvm)) {\n\t\tret = -ENOTTY;\n\t\tgoto failed;\n\t}\n\n\tregion = find_enc_region(kvm, range);\n\tif (!region) {\n\t\tret = -EINVAL;\n\t\tgoto failed;\n\t}\n\n\t/*\n\t * Ensure that all guest tagged cache entries are flushed before\n\t * releasing the pages back to the system for use. CLFLUSH will\n\t * not do this, so issue a WBINVD.\n\t */\n\twbinvd_on_all_cpus();\n\n\t__unregister_enc_region_locked(kvm, region);\n\n\tmutex_unlock(&kvm->lock);\n\treturn 0;\n\nfailed:\n\tmutex_unlock(&kvm->lock);\n\treturn ret;\n}",
  11809. "project": "linux",
  11810. "hash": 141055903523358356197112389313038723048,
  11811. "size": 35,
  11812. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11813. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11814. "target": 0,
  11815. "dataset": "other",
  11816. "idx": 463022
  11817. },
  11818. {
  11819. "func": "static int __sev_issue_dbg_cmd(struct kvm *kvm, unsigned long src,\n\t\t\t unsigned long dst, int size,\n\t\t\t int *error, bool enc)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct sev_data_dbg *data;\n\tint ret;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\treturn -ENOMEM;\n\n\tdata->handle = sev->handle;\n\tdata->dst_addr = dst;\n\tdata->src_addr = src;\n\tdata->len = size;\n\n\tret = sev_issue_cmd(kvm,\n\t\t\t enc ? SEV_CMD_DBG_ENCRYPT : SEV_CMD_DBG_DECRYPT,\n\t\t\t data, error);\n\tkfree(data);\n\treturn ret;\n}",
  11820. "project": "linux",
  11821. "hash": 81323525278608007212218978031525821029,
  11822. "size": 23,
  11823. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11824. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11825. "target": 0,
  11826. "dataset": "other",
  11827. "idx": 432450
  11828. },
  11829. {
  11830. "func": "static __init int sev_hardware_setup(void)\n{\n\tstruct sev_user_data_status *status;\n\tint rc;\n\n\t/* Maximum number of encrypted guests supported simultaneously */\n\tmax_sev_asid = cpuid_ecx(0x8000001F);\n\n\tif (!max_sev_asid)\n\t\treturn 1;\n\n\t/* Minimum ASID value that should be used for SEV guest */\n\tmin_sev_asid = cpuid_edx(0x8000001F);\n\n\t/* Initialize SEV ASID bitmaps */\n\tsev_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);\n\tif (!sev_asid_bitmap)\n\t\treturn 1;\n\n\tsev_reclaim_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);\n\tif (!sev_reclaim_asid_bitmap)\n\t\treturn 1;\n\n\tstatus = kmalloc(sizeof(*status), GFP_KERNEL);\n\tif (!status)\n\t\treturn 1;\n\n\t/*\n\t * Check SEV platform status.\n\t *\n\t * PLATFORM_STATUS can be called in any state, if we failed to query\n\t * the PLATFORM status then either PSP firmware does not support SEV\n\t * feature or SEV firmware is dead.\n\t */\n\trc = sev_platform_status(status, NULL);\n\tif (rc)\n\t\tgoto err;\n\n\tpr_info(\"SEV supported\\n\");\n\nerr:\n\tkfree(status);\n\treturn rc;\n}",
  11831. "project": "linux",
  11832. "hash": 40755539377558452587805772487792055067,
  11833. "size": 44,
  11834. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11835. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11836. "target": 0,
  11837. "dataset": "other",
  11838. "idx": 432414
  11839. },
  11840. {
  11841. "func": "int __init sev_hardware_setup(void)\n{\n\tstruct sev_user_data_status *status;\n\tint rc;\n\n\t/* Maximum number of encrypted guests supported simultaneously */\n\tmax_sev_asid = cpuid_ecx(0x8000001F);\n\n\tif (!svm_sev_enabled())\n\t\treturn 1;\n\n\t/* Minimum ASID value that should be used for SEV guest */\n\tmin_sev_asid = cpuid_edx(0x8000001F);\n\n\t/* Initialize SEV ASID bitmaps */\n\tsev_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);\n\tif (!sev_asid_bitmap)\n\t\treturn 1;\n\n\tsev_reclaim_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);\n\tif (!sev_reclaim_asid_bitmap)\n\t\treturn 1;\n\n\tstatus = kmalloc(sizeof(*status), GFP_KERNEL);\n\tif (!status)\n\t\treturn 1;\n\n\t/*\n\t * Check SEV platform status.\n\t *\n\t * PLATFORM_STATUS can be called in any state, if we failed to query\n\t * the PLATFORM status then either PSP firmware does not support SEV\n\t * feature or SEV firmware is dead.\n\t */\n\trc = sev_platform_status(status, NULL);\n\tif (rc)\n\t\tgoto err;\n\n\tpr_info(\"SEV supported\\n\");\n\nerr:\n\tkfree(status);\n\treturn rc;\n}",
  11842. "project": "linux",
  11843. "hash": 337415527868549211510790630798520805883,
  11844. "size": 44,
  11845. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11846. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11847. "target": 0,
  11848. "dataset": "other",
  11849. "idx": 463019
  11850. },
  11851. {
  11852. "func": "static int sev_launch_finish(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct sev_data_launch_finish *data;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\treturn -ENOMEM;\n\n\tdata->handle = sev->handle;\n\tret = sev_issue_cmd(kvm, SEV_CMD_LAUNCH_FINISH, data, &argp->error);\n\n\tkfree(data);\n\treturn ret;\n}",
  11853. "project": "linux",
  11854. "hash": 230517921809587966444217040755934782011,
  11855. "size": 19,
  11856. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11857. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11858. "target": 0,
  11859. "dataset": "other",
  11860. "idx": 432447
  11861. },
  11862. {
  11863. "func": "static int __sev_dbg_decrypt_user(struct kvm *kvm, unsigned long paddr,\n\t\t\t\t unsigned long __user dst_uaddr,\n\t\t\t\t unsigned long dst_paddr,\n\t\t\t\t int size, int *err)\n{\n\tstruct page *tpage = NULL;\n\tint ret, offset;\n\n\t/* if inputs are not 16-byte then use intermediate buffer */\n\tif (!IS_ALIGNED(dst_paddr, 16) ||\n\t !IS_ALIGNED(paddr, 16) ||\n\t !IS_ALIGNED(size, 16)) {\n\t\ttpage = (void *)alloc_page(GFP_KERNEL);\n\t\tif (!tpage)\n\t\t\treturn -ENOMEM;\n\n\t\tdst_paddr = __sme_page_pa(tpage);\n\t}\n\n\tret = __sev_dbg_decrypt(kvm, paddr, dst_paddr, size, err);\n\tif (ret)\n\t\tgoto e_free;\n\n\tif (tpage) {\n\t\toffset = paddr & 15;\n\t\tif (copy_to_user((void __user *)(uintptr_t)dst_uaddr,\n\t\t\t\t page_address(tpage) + offset, size))\n\t\t\tret = -EFAULT;\n\t}\n\ne_free:\n\tif (tpage)\n\t\t__free_page(tpage);\n\n\treturn ret;\n}",
  11864. "project": "linux",
  11865. "hash": 198671757318387645801257997354094409129,
  11866. "size": 36,
  11867. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11868. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11869. "target": 0,
  11870. "dataset": "other",
  11871. "idx": 432408
  11872. },
  11873. {
  11874. "func": "static inline bool sev_guest(struct kvm *kvm)\n{\n#ifdef CONFIG_KVM_AMD_SEV\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\n\treturn sev->active;\n#else\n\treturn false;\n#endif\n}",
  11875. "project": "linux",
  11876. "hash": 197480876992807830707128069285170218193,
  11877. "size": 10,
  11878. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11879. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11880. "target": 0,
  11881. "dataset": "other",
  11882. "idx": 432510
  11883. },
  11884. {
  11885. "func": "static int sev_flush_asids(void)\n{\n\tint ret, error;\n\n\t/*\n\t * DEACTIVATE will clear the WBINVD indicator causing DF_FLUSH to fail,\n\t * so it must be guarded.\n\t */\n\tdown_write(&sev_deactivate_lock);\n\n\twbinvd_on_all_cpus();\n\tret = sev_guest_df_flush(&error);\n\n\tup_write(&sev_deactivate_lock);\n\n\tif (ret)\n\t\tpr_err(\"SEV: DF_FLUSH failed, ret=%d, error=%#x\\n\", ret, error);\n\n\treturn ret;\n}",
  11886. "project": "linux",
  11887. "hash": 12128932245247985228935987453947279645,
  11888. "size": 20,
  11889. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11890. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11891. "target": 0,
  11892. "dataset": "other",
  11893. "idx": 432455
  11894. },
  11895. {
  11896. "func": "static int sev_flush_asids(void)\n{\n\tint ret, error = 0;\n\n\t/*\n\t * DEACTIVATE will clear the WBINVD indicator causing DF_FLUSH to fail,\n\t * so it must be guarded.\n\t */\n\tdown_write(&sev_deactivate_lock);\n\n\twbinvd_on_all_cpus();\n\tret = sev_guest_df_flush(&error);\n\n\tup_write(&sev_deactivate_lock);\n\n\tif (ret)\n\t\tpr_err(\"SEV: DF_FLUSH failed, ret=%d, error=%#x\\n\", ret, error);\n\n\treturn ret;\n}",
  11897. "project": "linux",
  11898. "hash": 276288275136177449722163869277031804522,
  11899. "size": 20,
  11900. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11901. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11902. "target": 0,
  11903. "dataset": "other",
  11904. "idx": 463025
  11905. },
  11906. {
  11907. "func": "static void sev_clflush_pages(struct page *pages[], unsigned long npages)\n{\n\tuint8_t *page_virtual;\n\tunsigned long i;\n\n\tif (npages == 0 || pages == NULL)\n\t\treturn;\n\n\tfor (i = 0; i < npages; i++) {\n\t\tpage_virtual = kmap_atomic(pages[i]);\n\t\tclflush_cache_range(page_virtual, PAGE_SIZE);\n\t\tkunmap_atomic(page_virtual);\n\t}\n}",
  11908. "project": "linux",
  11909. "hash": 81580088784001093736702684537359694761,
  11910. "size": 14,
  11911. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11912. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11913. "target": 0,
  11914. "dataset": "other",
  11915. "idx": 432469
  11916. },
  11917. {
  11918. "func": "static inline bool svm_sev_enabled(void)\n{\n\treturn IS_ENABLED(CONFIG_KVM_AMD_SEV) ? max_sev_asid : 0;\n}",
  11919. "project": "linux",
  11920. "hash": 272729550424054117932640225614431812172,
  11921. "size": 4,
  11922. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11923. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11924. "target": 0,
  11925. "dataset": "other",
  11926. "idx": 432478
  11927. },
  11928. {
  11929. "func": "static inline int sev_get_asid(struct kvm *kvm)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\n\treturn sev->asid;\n}",
  11930. "project": "linux",
  11931. "hash": 66850244743292985282483600543464714294,
  11932. "size": 6,
  11933. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11934. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11935. "target": 0,
  11936. "dataset": "other",
  11937. "idx": 432499
  11938. },
  11939. {
  11940. "func": "static void pre_sev_run(struct vcpu_svm *svm, int cpu)\n{\n\tstruct svm_cpu_data *sd = per_cpu(svm_data, cpu);\n\tint asid = sev_get_asid(svm->vcpu.kvm);\n\n\t/* Assign the asid allocated with this SEV guest */\n\tsvm->vmcb->control.asid = asid;\n\n\t/*\n\t * Flush guest TLB:\n\t *\n\t * 1) when different VMCB for the same ASID is to be run on the same host CPU.\n\t * 2) or this VMCB was executed on different host CPU in previous VMRUNs.\n\t */\n\tif (sd->sev_vmcbs[asid] == svm->vmcb &&\n\t svm->last_cpu == cpu)\n\t\treturn;\n\n\tsvm->last_cpu = cpu;\n\tsd->sev_vmcbs[asid] = svm->vmcb;\n\tsvm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ASID;\n\tmark_dirty(svm->vmcb, VMCB_ASID);\n}",
  11941. "project": "linux",
  11942. "hash": 243602562275000501286938621089103105835,
  11943. "size": 23,
  11944. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11945. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11946. "target": 0,
  11947. "dataset": "other",
  11948. "idx": 432495
  11949. },
  11950. {
  11951. "func": "void pre_sev_run(struct vcpu_svm *svm, int cpu)\n{\n\tstruct svm_cpu_data *sd = per_cpu(svm_data, cpu);\n\tint asid = sev_get_asid(svm->vcpu.kvm);\n\n\t/* Assign the asid allocated with this SEV guest */\n\tsvm->vmcb->control.asid = asid;\n\n\t/*\n\t * Flush guest TLB:\n\t *\n\t * 1) when different VMCB for the same ASID is to be run on the same host CPU.\n\t * 2) or this VMCB was executed on different host CPU in previous VMRUNs.\n\t */\n\tif (sd->sev_vmcbs[asid] == svm->vmcb &&\n\t svm->vcpu.arch.last_vmentry_cpu == cpu)\n\t\treturn;\n\n\tsd->sev_vmcbs[asid] = svm->vmcb;\n\tsvm->vmcb->control.tlb_ctl = TLB_CONTROL_FLUSH_ASID;\n\tvmcb_mark_dirty(svm->vmcb, VMCB_ASID);\n}",
  11952. "project": "linux",
  11953. "hash": 82306258198673685680273555741000766863,
  11954. "size": 22,
  11955. "commit_id": "7be74942f184fdfba34ddd19a0d995deb34d4a03",
  11956. "message": "KVM: SVM: Periodically schedule when unregistering regions on destroy\n\nThere may be many encrypted regions that need to be unregistered when a\nSEV VM is destroyed. This can lead to soft lockups. For example, on a\nhost running 4.15:\n\nwatchdog: BUG: soft lockup - CPU#206 stuck for 11s! [t_virtual_machi:194348]\nCPU: 206 PID: 194348 Comm: t_virtual_machi\nRIP: 0010:free_unref_page_list+0x105/0x170\n...\nCall Trace:\n [<0>] release_pages+0x159/0x3d0\n [<0>] sev_unpin_memory+0x2c/0x50 [kvm_amd]\n [<0>] __unregister_enc_region_locked+0x2f/0x70 [kvm_amd]\n [<0>] svm_vm_destroy+0xa9/0x200 [kvm_amd]\n [<0>] kvm_arch_destroy_vm+0x47/0x200\n [<0>] kvm_put_kvm+0x1a8/0x2f0\n [<0>] kvm_vm_release+0x25/0x30\n [<0>] do_exit+0x335/0xc10\n [<0>] do_group_exit+0x3f/0xa0\n [<0>] get_signal+0x1bc/0x670\n [<0>] do_signal+0x31/0x130\n\nAlthough the CLFLUSH is no longer issued on every encrypted region to be\nunregistered, there are no other changes that can prevent soft lockups for\nvery large SEV VMs in the latest kernel.\n\nPeriodically schedule if necessary. This still holds kvm->lock across the\nresched, but since this only happens when the VM is destroyed this is\nassumed to be acceptable.\n\nSigned-off-by: David Rientjes <rientjes@google.com>\nMessage-Id: <alpine.DEB.2.23.453.2008251255240.2987727@chino.kir.corp.google.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11957. "target": 0,
  11958. "dataset": "other",
  11959. "idx": 463015
  11960. },
  11961. {
  11962. "func": "static int sev_guest_status(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct kvm_sev_guest_status params;\n\tstruct sev_data_guest_status *data;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tdata = kzalloc(sizeof(*data), GFP_KERNEL_ACCOUNT);\n\tif (!data)\n\t\treturn -ENOMEM;\n\n\tdata->handle = sev->handle;\n\tret = sev_issue_cmd(kvm, SEV_CMD_GUEST_STATUS, data, &argp->error);\n\tif (ret)\n\t\tgoto e_free;\n\n\tparams.policy = data->policy;\n\tparams.state = data->state;\n\tparams.handle = data->handle;\n\n\tif (copy_to_user((void __user *)(uintptr_t)argp->data, &params, sizeof(params)))\n\t\tret = -EFAULT;\ne_free:\n\tkfree(data);\n\treturn ret;\n}",
  11963. "project": "linux",
  11964. "hash": 85899878238619361124036181960701334048,
  11965. "size": 29,
  11966. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11967. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11968. "target": 0,
  11969. "dataset": "other",
  11970. "idx": 432537
  11971. },
  11972. {
  11973. "func": "static void sev_unpin_memory(struct kvm *kvm, struct page **pages,\n\t\t\t unsigned long npages)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\n\trelease_pages(pages, npages);\n\tkvfree(pages);\n\tsev->pages_locked -= npages;\n}",
  11974. "project": "linux",
  11975. "hash": 171157111146673193766248062715929701601,
  11976. "size": 9,
  11977. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11978. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11979. "target": 0,
  11980. "dataset": "other",
  11981. "idx": 432496
  11982. },
  11983. {
  11984. "func": "static int sev_launch_start(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tstruct sev_data_launch_start *start;\n\tstruct kvm_sev_launch_start params;\n\tvoid *dh_blob, *session_blob;\n\tint *error = &argp->error;\n\tint ret;\n\n\tif (!sev_guest(kvm))\n\t\treturn -ENOTTY;\n\n\tif (copy_from_user(&params, (void __user *)(uintptr_t)argp->data, sizeof(params)))\n\t\treturn -EFAULT;\n\n\tstart = kzalloc(sizeof(*start), GFP_KERNEL_ACCOUNT);\n\tif (!start)\n\t\treturn -ENOMEM;\n\n\tdh_blob = NULL;\n\tif (params.dh_uaddr) {\n\t\tdh_blob = psp_copy_user_blob(params.dh_uaddr, params.dh_len);\n\t\tif (IS_ERR(dh_blob)) {\n\t\t\tret = PTR_ERR(dh_blob);\n\t\t\tgoto e_free;\n\t\t}\n\n\t\tstart->dh_cert_address = __sme_set(__pa(dh_blob));\n\t\tstart->dh_cert_len = params.dh_len;\n\t}\n\n\tsession_blob = NULL;\n\tif (params.session_uaddr) {\n\t\tsession_blob = psp_copy_user_blob(params.session_uaddr, params.session_len);\n\t\tif (IS_ERR(session_blob)) {\n\t\t\tret = PTR_ERR(session_blob);\n\t\t\tgoto e_free_dh;\n\t\t}\n\n\t\tstart->session_address = __sme_set(__pa(session_blob));\n\t\tstart->session_len = params.session_len;\n\t}\n\n\tstart->handle = params.handle;\n\tstart->policy = params.policy;\n\n\t/* create memory encryption context */\n\tret = __sev_issue_cmd(argp->sev_fd, SEV_CMD_LAUNCH_START, start, error);\n\tif (ret)\n\t\tgoto e_free_session;\n\n\t/* Bind ASID to this guest */\n\tret = sev_bind_asid(kvm, start->handle, error);\n\tif (ret)\n\t\tgoto e_free_session;\n\n\t/* return handle to userspace */\n\tparams.handle = start->handle;\n\tif (copy_to_user((void __user *)(uintptr_t)argp->data, &params, sizeof(params))) {\n\t\tsev_unbind_asid(kvm, start->handle);\n\t\tret = -EFAULT;\n\t\tgoto e_free_session;\n\t}\n\n\tsev->handle = start->handle;\n\tsev->fd = argp->sev_fd;\n\ne_free_session:\n\tkfree(session_blob);\ne_free_dh:\n\tkfree(dh_blob);\ne_free:\n\tkfree(start);\n\treturn ret;\n}",
  11985. "project": "linux",
  11986. "hash": 327382084721145336609172412034880321775,
  11987. "size": 75,
  11988. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  11989. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  11990. "target": 0,
  11991. "dataset": "other",
  11992. "idx": 432485
  11993. },
  11994. {
  11995. "func": "static int sev_asid_new(void)\n{\n\tbool retry = true;\n\tint pos;\n\n\tmutex_lock(&sev_bitmap_lock);\n\n\t/*\n\t * SEV-enabled guest must use asid from min_sev_asid to max_sev_asid.\n\t */\nagain:\n\tpos = find_next_zero_bit(sev_asid_bitmap, max_sev_asid, min_sev_asid - 1);\n\tif (pos >= max_sev_asid) {\n\t\tif (retry && __sev_recycle_asids()) {\n\t\t\tretry = false;\n\t\t\tgoto again;\n\t\t}\n\t\tmutex_unlock(&sev_bitmap_lock);\n\t\treturn -EBUSY;\n\t}\n\n\t__set_bit(pos, sev_asid_bitmap);\n\n\tmutex_unlock(&sev_bitmap_lock);\n\n\treturn pos + 1;\n}",
  11996. "project": "linux",
  11997. "hash": 68010888444918245818194939433088823384,
  11998. "size": 27,
  11999. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  12000. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  12001. "target": 0,
  12002. "dataset": "other",
  12003. "idx": 432532
  12004. },
  12005. {
  12006. "func": "static int __sev_dbg_encrypt_user(struct kvm *kvm, unsigned long paddr,\n\t\t\t\t unsigned long __user vaddr,\n\t\t\t\t unsigned long dst_paddr,\n\t\t\t\t unsigned long __user dst_vaddr,\n\t\t\t\t int size, int *error)\n{\n\tstruct page *src_tpage = NULL;\n\tstruct page *dst_tpage = NULL;\n\tint ret, len = size;\n\n\t/* If source buffer is not aligned then use an intermediate buffer */\n\tif (!IS_ALIGNED(vaddr, 16)) {\n\t\tsrc_tpage = alloc_page(GFP_KERNEL);\n\t\tif (!src_tpage)\n\t\t\treturn -ENOMEM;\n\n\t\tif (copy_from_user(page_address(src_tpage),\n\t\t\t\t(void __user *)(uintptr_t)vaddr, size)) {\n\t\t\t__free_page(src_tpage);\n\t\t\treturn -EFAULT;\n\t\t}\n\n\t\tpaddr = __sme_page_pa(src_tpage);\n\t}\n\n\t/*\n\t * If destination buffer or length is not aligned then do read-modify-write:\n\t * - decrypt destination in an intermediate buffer\n\t * - copy the source buffer in an intermediate buffer\n\t * - use the intermediate buffer as source buffer\n\t */\n\tif (!IS_ALIGNED(dst_vaddr, 16) || !IS_ALIGNED(size, 16)) {\n\t\tint dst_offset;\n\n\t\tdst_tpage = alloc_page(GFP_KERNEL);\n\t\tif (!dst_tpage) {\n\t\t\tret = -ENOMEM;\n\t\t\tgoto e_free;\n\t\t}\n\n\t\tret = __sev_dbg_decrypt(kvm, dst_paddr,\n\t\t\t\t\t__sme_page_pa(dst_tpage), size, error);\n\t\tif (ret)\n\t\t\tgoto e_free;\n\n\t\t/*\n\t\t * If source is kernel buffer then use memcpy() otherwise\n\t\t * copy_from_user().\n\t\t */\n\t\tdst_offset = dst_paddr & 15;\n\n\t\tif (src_tpage)\n\t\t\tmemcpy(page_address(dst_tpage) + dst_offset,\n\t\t\t page_address(src_tpage), size);\n\t\telse {\n\t\t\tif (copy_from_user(page_address(dst_tpage) + dst_offset,\n\t\t\t\t\t (void __user *)(uintptr_t)vaddr, size)) {\n\t\t\t\tret = -EFAULT;\n\t\t\t\tgoto e_free;\n\t\t\t}\n\t\t}\n\n\t\tpaddr = __sme_page_pa(dst_tpage);\n\t\tdst_paddr = round_down(dst_paddr, 16);\n\t\tlen = round_up(size, 16);\n\t}\n\n\tret = __sev_issue_dbg_cmd(kvm, paddr, dst_paddr, len, error, true);\n\ne_free:\n\tif (src_tpage)\n\t\t__free_page(src_tpage);\n\tif (dst_tpage)\n\t\t__free_page(dst_tpage);\n\treturn ret;\n}",
  12007. "project": "linux",
  12008. "hash": 44807109384765060363671957329569291103,
  12009. "size": 76,
  12010. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  12011. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  12012. "target": 0,
  12013. "dataset": "other",
  12014. "idx": 432438
  12015. },
  12016. {
  12017. "func": "static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp)\n{\n\tstruct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info;\n\tint asid, ret;\n\n\tret = -EBUSY;\n\tif (unlikely(sev->active))\n\t\treturn ret;\n\n\tasid = sev_asid_new();\n\tif (asid < 0)\n\t\treturn ret;\n\n\tret = sev_platform_init(&argp->error);\n\tif (ret)\n\t\tgoto e_free;\n\n\tsev->active = true;\n\tsev->asid = asid;\n\tINIT_LIST_HEAD(&sev->regions_list);\n\n\treturn 0;\n\ne_free:\n\tsev_asid_free(asid);\n\treturn ret;\n}",
  12018. "project": "linux",
  12019. "hash": 112816211679516444387194592874037827972,
  12020. "size": 27,
  12021. "commit_id": "d80b64ff297e40c2b6f7d7abc1b3eba70d22a068",
  12022. "message": "KVM: SVM: Fix potential memory leak in svm_cpu_init()\n\nWhen kmalloc memory for sd->sev_vmcbs failed, we forget to free the page\nheld by sd->save_area. Also get rid of the var r as '-ENOMEM' is actually\nthe only possible outcome here.\n\nReviewed-by: Liran Alon <liran.alon@oracle.com>\nReviewed-by: Vitaly Kuznetsov <vkuznets@redhat.com>\nSigned-off-by: Miaohe Lin <linmiaohe@huawei.com>\nSigned-off-by: Paolo Bonzini <pbonzini@redhat.com>",
  12023. "target": 0,
  12024. "dataset": "other",
  12025. "idx": 432601
  12026. }
  12027. ]
  12028. },
  12029. {
  12030. "call_depth": 3,
  12031. "longest_call_chain": [
  12032. "remove_pending_change_notify_requests_by_mid",
  12033. "smbd_notify_cancel_by_map",
  12034. "change_notify_remove_request"
  12035. ],
  12036. "group_size": 6,
  12037. "functions": [
  12038. {
  12039. "func": "void smbd_notify_cancel_by_smbreq(const struct smb_request *smbreq)\n{\n\tstruct smbd_server_connection *sconn = smbreq->sconn;\n\tstruct notify_mid_map *map;\n\n\tfor (map = sconn->smb1.notify_mid_maps; map; map = map->next) {\n\t\tif (map->req->req == smbreq) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (map == NULL) {\n\t\treturn;\n\t}\n\n\tsmbd_notify_cancel_by_map(map);\n}",
  12040. "project": "samba",
  12041. "hash": 197873660544430567237872443142405706058,
  12042. "size": 17,
  12043. "commit_id": "c300a85848350635e7ddd8129b31c4d439dc0f8a",
  12044. "message": "s3: smbd: Ensure change notifies can't get set unless the directory handle is open for SEC_DIR_LIST.\n\nRemove knownfail entry.\n\nCVE-2020-14318\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14434\n\nSigned-off-by: Jeremy Allison <jra@samba.org>",
  12045. "target": 0,
  12046. "dataset": "other",
  12047. "idx": 279693
  12048. },
  12049. {
  12050. "func": "void remove_pending_change_notify_requests_by_fid(files_struct *fsp,\n\t\t\t\t\t\t NTSTATUS status)\n{\n\tif (fsp->notify == NULL) {\n\t\treturn;\n\t}\n\n\twhile (fsp->notify->requests != NULL) {\n\t\tchange_notify_reply(fsp->notify->requests->req,\n\t\t\t\t status, 0, NULL,\n\t\t\t\t fsp->notify->requests->reply_fn);\n\t\tchange_notify_remove_request(fsp->conn->sconn,\n\t\t\t\t\t fsp->notify->requests);\n\t}\n}",
  12051. "project": "samba",
  12052. "hash": 116435028013848744244740147800906819338,
  12053. "size": 15,
  12054. "commit_id": "c300a85848350635e7ddd8129b31c4d439dc0f8a",
  12055. "message": "s3: smbd: Ensure change notifies can't get set unless the directory handle is open for SEC_DIR_LIST.\n\nRemove knownfail entry.\n\nCVE-2020-14318\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14434\n\nSigned-off-by: Jeremy Allison <jra@samba.org>",
  12056. "target": 0,
  12057. "dataset": "other",
  12058. "idx": 279685
  12059. },
  12060. {
  12061. "func": "static void notify_fsp(files_struct *fsp, struct timespec when,\n\t\t uint32_t action, const char *name)\n{\n\tstruct notify_change_event *change, *changes;\n\tchar *tmp;\n\n\tif (fsp->notify == NULL) {\n\t\t/*\n\t\t * Nobody is waiting, don't queue\n\t\t */\n\t\treturn;\n\t}\n\n\t/*\n\t * Someone has triggered a notify previously, queue the change for\n\t * later.\n\t */\n\n\tif ((fsp->notify->num_changes > 1000) || (name == NULL)) {\n\t\t/*\n\t\t * The real number depends on the client buf, just provide a\n\t\t * guard against a DoS here. If name == NULL the CN backend is\n\t\t * alerting us to a problem. Possibly dropped events. Clear\n\t\t * queued changes and send the catch-all response to the client\n\t\t * if a request is pending.\n\t\t */\n\t\tTALLOC_FREE(fsp->notify->changes);\n\t\tfsp->notify->num_changes = -1;\n\t\tif (fsp->notify->requests != NULL) {\n\t\t\tchange_notify_reply(fsp->notify->requests->req,\n\t\t\t\t\t NT_STATUS_OK,\n\t\t\t\t\t fsp->notify->requests->max_param,\n\t\t\t\t\t fsp->notify,\n\t\t\t\t\t fsp->notify->requests->reply_fn);\n\t\t\tchange_notify_remove_request(fsp->conn->sconn,\n\t\t\t\t\t\t fsp->notify->requests);\n\t\t}\n\t\treturn;\n\t}\n\n\t/* If we've exceeded the server side queue or received a NULL name\n\t * from the underlying CN implementation, don't queue up any more\n\t * requests until we can send a catch-all response to the client */\n\tif (fsp->notify->num_changes == -1) {\n\t\treturn;\n\t}\n\n\tif (!(changes = talloc_realloc(\n\t\t fsp->notify, fsp->notify->changes,\n\t\t struct notify_change_event,\n\t\t fsp->notify->num_changes+1))) {\n\t\tDEBUG(0, (\"talloc_realloc failed\\n\"));\n\t\treturn;\n\t}\n\n\tfsp->notify->changes = changes;\n\n\tchange = &(fsp->notify->changes[fsp->notify->num_changes]);\n\n\tif (!(tmp = talloc_strdup(changes, name))) {\n\t\tDEBUG(0, (\"talloc_strdup failed\\n\"));\n\t\treturn;\n\t}\n\n\tstring_replace(tmp, '/', '\\\\');\n\tchange->name = tmp;\t\n\n\tchange->when = when;\n\tchange->action = action;\n\tfsp->notify->num_changes += 1;\n\n\tif (fsp->notify->requests == NULL) {\n\t\t/*\n\t\t * Nobody is waiting, so don't send anything. The ot\n\t\t */\n\t\treturn;\n\t}\n\n\tif (action == NOTIFY_ACTION_OLD_NAME) {\n\t\t/*\n\t\t * We have to send the two rename events in one reply. So hold\n\t\t * the first part back.\n\t\t */\n\t\treturn;\n\t}\n\n\t/*\n\t * Someone is waiting for the change, trigger the reply immediately.\n\t *\n\t * TODO: do we have to walk the lists of requests pending?\n\t */\n\n\tchange_notify_reply(fsp->notify->requests->req,\n\t\t\t NT_STATUS_OK,\n\t\t\t fsp->notify->requests->max_param,\n\t\t\t fsp->notify,\n\t\t\t fsp->notify->requests->reply_fn);\n\n\tchange_notify_remove_request(fsp->conn->sconn, fsp->notify->requests);\n}",
  12062. "project": "samba",
  12063. "hash": 55414215855137377012312980613844174714,
  12064. "size": 100,
  12065. "commit_id": "c300a85848350635e7ddd8129b31c4d439dc0f8a",
  12066. "message": "s3: smbd: Ensure change notifies can't get set unless the directory handle is open for SEC_DIR_LIST.\n\nRemove knownfail entry.\n\nCVE-2020-14318\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14434\n\nSigned-off-by: Jeremy Allison <jra@samba.org>",
  12067. "target": 0,
  12068. "dataset": "other",
  12069. "idx": 279696
  12070. },
  12071. {
  12072. "func": "static void change_notify_remove_request(struct smbd_server_connection *sconn,\n\t\t\t\t\t struct notify_change_request *remove_req)\n{\n\tfiles_struct *fsp;\n\tstruct notify_change_request *req;\n\n\t/*\n\t * Paranoia checks, the fsp referenced must must have the request in\n\t * its list of pending requests\n\t */\n\n\tfsp = remove_req->fsp;\n\tSMB_ASSERT(fsp->notify != NULL);\n\n\tfor (req = fsp->notify->requests; req; req = req->next) {\n\t\tif (req == remove_req) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (req == NULL) {\n\t\tsmb_panic(\"notify_req not found in fsp's requests\");\n\t}\n\n\tDLIST_REMOVE(fsp->notify->requests, req);\n\tDLIST_REMOVE(sconn->smb1.notify_mid_maps, req->mid_map);\n\tTALLOC_FREE(req);\n}",
  12073. "project": "samba",
  12074. "hash": 113917000493755922406827458330864321437,
  12075. "size": 28,
  12076. "commit_id": "c300a85848350635e7ddd8129b31c4d439dc0f8a",
  12077. "message": "s3: smbd: Ensure change notifies can't get set unless the directory handle is open for SEC_DIR_LIST.\n\nRemove knownfail entry.\n\nCVE-2020-14318\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14434\n\nSigned-off-by: Jeremy Allison <jra@samba.org>",
  12078. "target": 0,
  12079. "dataset": "other",
  12080. "idx": 279704
  12081. },
  12082. {
  12083. "func": "bool remove_pending_change_notify_requests_by_mid(\n\tstruct smbd_server_connection *sconn, uint64_t mid)\n{\n\tstruct notify_mid_map *map;\n\n\tfor (map = sconn->smb1.notify_mid_maps; map; map = map->next) {\n\t\tif (map->mid == mid) {\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (map == NULL) {\n\t\treturn false;\n\t}\n\n\tsmbd_notify_cancel_by_map(map);\n\treturn true;\n}",
  12084. "project": "samba",
  12085. "hash": 228094122422571733736054467096417549326,
  12086. "size": 18,
  12087. "commit_id": "c300a85848350635e7ddd8129b31c4d439dc0f8a",
  12088. "message": "s3: smbd: Ensure change notifies can't get set unless the directory handle is open for SEC_DIR_LIST.\n\nRemove knownfail entry.\n\nCVE-2020-14318\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14434\n\nSigned-off-by: Jeremy Allison <jra@samba.org>",
  12089. "target": 0,
  12090. "dataset": "other",
  12091. "idx": 279687
  12092. },
  12093. {
  12094. "func": "static void smbd_notify_cancel_by_map(struct notify_mid_map *map)\n{\n\tstruct smb_request *smbreq = map->req->req;\n\tstruct smbd_server_connection *sconn = smbreq->sconn;\n\tstruct smbd_smb2_request *smb2req = smbreq->smb2req;\n\tNTSTATUS notify_status = NT_STATUS_CANCELLED;\n\n\tif (smb2req != NULL) {\n\t\tNTSTATUS sstatus;\n\n\t\tif (smb2req->session == NULL) {\n\t\t\tsstatus = NT_STATUS_USER_SESSION_DELETED;\n\t\t} else {\n\t\t\tsstatus = smb2req->session->status;\n\t\t}\n\n\t\tif (NT_STATUS_EQUAL(sstatus, NT_STATUS_NETWORK_SESSION_EXPIRED)) {\n\t\t\tsstatus = NT_STATUS_OK;\n\t\t}\n\n\t\tif (!NT_STATUS_IS_OK(sstatus)) {\n\t\t\tnotify_status = STATUS_NOTIFY_CLEANUP;\n\t\t} else if (smb2req->tcon == NULL) {\n\t\t\tnotify_status = STATUS_NOTIFY_CLEANUP;\n\t\t} else if (!NT_STATUS_IS_OK(smb2req->tcon->status)) {\n\t\t\tnotify_status = STATUS_NOTIFY_CLEANUP;\n\t\t}\n\t}\n\n\tchange_notify_reply(smbreq, notify_status,\n\t\t\t 0, NULL, map->req->reply_fn);\n\tchange_notify_remove_request(sconn, map->req);\n}",
  12095. "project": "samba",
  12096. "hash": 158985065159182065461930161912048986754,
  12097. "size": 33,
  12098. "commit_id": "c300a85848350635e7ddd8129b31c4d439dc0f8a",
  12099. "message": "s3: smbd: Ensure change notifies can't get set unless the directory handle is open for SEC_DIR_LIST.\n\nRemove knownfail entry.\n\nCVE-2020-14318\n\nBUG: https://bugzilla.samba.org/show_bug.cgi?id=14434\n\nSigned-off-by: Jeremy Allison <jra@samba.org>",
  12100. "target": 0,
  12101. "dataset": "other",
  12102. "idx": 279701
  12103. }
  12104. ]
  12105. },
  12106. {
  12107. "call_depth": 3,
  12108. "longest_call_chain": [
  12109. "TlsSetValue",
  12110. "mono_loader_lock",
  12111. "mono_loader_unlock"
  12112. ],
  12113. "group_size": 14,
  12114. "functions": [
  12115. {
  12116. "func": "tcp_src_prompt(packet_info *pinfo, gchar *result)\n{\n guint32 port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_tcp_srcport, pinfo->curr_layer_num));\n\n g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, \"source (%u%s)\", port, UTF8_RIGHTWARDS_ARROW);\n}",
  12117. "project": "wireshark",
  12118. "hash": 243029606365869679011893096644425255357,
  12119. "size": 6,
  12120. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  12121. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  12122. "target": 0,
  12123. "dataset": "other",
  12124. "idx": 385197
  12125. },
  12126. {
  12127. "func": "tcp_dst_prompt(packet_info *pinfo, gchar *result)\n{\n guint32 port = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_tcp_dstport, pinfo->curr_layer_num));\n\n g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, \"destination (%s%u)\", UTF8_RIGHTWARDS_ARROW, port);\n}",
  12128. "project": "wireshark",
  12129. "hash": 229594618645422847498588340128012053786,
  12130. "size": 6,
  12131. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  12132. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  12133. "target": 0,
  12134. "dataset": "other",
  12135. "idx": 385232
  12136. },
  12137. {
  12138. "func": "tcp_both_prompt(packet_info *pinfo, gchar *result)\n{\n guint32 srcport = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_tcp_srcport, pinfo->curr_layer_num)),\n destport = GPOINTER_TO_UINT(p_get_proto_data(pinfo->pool, pinfo, hf_tcp_dstport, pinfo->curr_layer_num));\n g_snprintf(result, MAX_DECODE_AS_PROMPT_LEN, \"both (%u%s%u)\", srcport, UTF8_LEFT_RIGHT_ARROW, destport);\n}",
  12139. "project": "wireshark",
  12140. "hash": 223609035746124680614692817043359611066,
  12141. "size": 6,
  12142. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  12143. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  12144. "target": 0,
  12145. "dataset": "other",
  12146. "idx": 385255
  12147. },
  12148. {
  12149. "func": "mono_loader_unlock (void)\n{\n\tmono_locks_release (&loader_mutex, LoaderLock);\n\tif (G_UNLIKELY (loader_lock_track_ownership)) {\n\t\tTlsSetValue (loader_lock_nest_id, GUINT_TO_POINTER (GPOINTER_TO_UINT (TlsGetValue (loader_lock_nest_id)) - 1));\n\t}\n}",
  12150. "project": "mono",
  12151. "hash": 233233954986845845596365919409106211673,
  12152. "size": 7,
  12153. "commit_id": "8e890a3bf80a4620e417814dc14886b1bbd17625",
  12154. "message": "Search for dllimported shared libs in the base directory, not cwd.\n\n* loader.c: we don't search the current directory anymore for shared\nlibraries referenced in DllImport attributes, as it has a slight\nsecurity risk. We search in the same directory where the referencing\nimage was loaded from, instead. Fixes bug# 641915.",
  12155. "target": 0,
  12156. "dataset": "other",
  12157. "idx": 334478
  12158. },
  12159. {
  12160. "func": "mono_loader_lock (void)\n{\n\tmono_locks_acquire (&loader_mutex, LoaderLock);\n\tif (G_UNLIKELY (loader_lock_track_ownership)) {\n\t\tTlsSetValue (loader_lock_nest_id, GUINT_TO_POINTER (GPOINTER_TO_UINT (TlsGetValue (loader_lock_nest_id)) + 1));\n\t}\n}",
  12161. "project": "mono",
  12162. "hash": 149133099918348962033482518260271943311,
  12163. "size": 7,
  12164. "commit_id": "8e890a3bf80a4620e417814dc14886b1bbd17625",
  12165. "message": "Search for dllimported shared libs in the base directory, not cwd.\n\n* loader.c: we don't search the current directory anymore for shared\nlibraries referenced in DllImport attributes, as it has a slight\nsecurity risk. We search in the same directory where the referencing\nimage was loaded from, instead. Fixes bug# 641915.",
  12166. "target": 0,
  12167. "dataset": "other",
  12168. "idx": 334507
  12169. },
  12170. {
  12171. "func": "tcp_src_value(packet_info *pinfo)\n{\n return p_get_proto_data(pinfo->pool, pinfo, hf_tcp_srcport, pinfo->curr_layer_num);\n}",
  12172. "project": "wireshark",
  12173. "hash": 269721267962870118367440272260943368013,
  12174. "size": 4,
  12175. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  12176. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  12177. "target": 0,
  12178. "dataset": "other",
  12179. "idx": 385200
  12180. },
  12181. {
  12182. "func": "tcp_dst_value(packet_info *pinfo)\n{\n return p_get_proto_data(pinfo->pool, pinfo, hf_tcp_dstport, pinfo->curr_layer_num);\n}",
  12183. "project": "wireshark",
  12184. "hash": 129362666005724023401991086809138002933,
  12185. "size": 4,
  12186. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  12187. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  12188. "target": 0,
  12189. "dataset": "other",
  12190. "idx": 385214
  12191. },
  12192. {
  12193. "func": "mono_loader_lock_is_owned_by_self (void)\n{\n\tg_assert (loader_lock_track_ownership);\n\n\treturn GPOINTER_TO_UINT (TlsGetValue (loader_lock_nest_id)) > 0;\n}",
  12194. "project": "mono",
  12195. "hash": 240673674177835474670681667619621290297,
  12196. "size": 6,
  12197. "commit_id": "8e890a3bf80a4620e417814dc14886b1bbd17625",
  12198. "message": "Search for dllimported shared libs in the base directory, not cwd.\n\n* loader.c: we don't search the current directory anymore for shared\nlibraries referenced in DllImport attributes, as it has a slight\nsecurity risk. We search in the same directory where the referencing\nimage was loaded from, instead. Fixes bug# 641915.",
  12199. "target": 0,
  12200. "dataset": "other",
  12201. "idx": 334473
  12202. },
  12203. {
  12204. "func": "relate_slaves (gpointer key,\n gpointer value,\n gpointer data)\n{\n ClutterDeviceManagerXI2 *manager_xi2 = data;\n ClutterInputDevice *master, *slave;\n\n slave = g_hash_table_lookup (manager_xi2->devices_by_id, key);\n master = g_hash_table_lookup (manager_xi2->devices_by_id, value);\n\n _clutter_input_device_set_associated_device (slave, master);\n _clutter_input_device_add_slave (master, slave);\n}",
  12205. "target": 0,
  12206. "cwe": [
  12207. "CWE-264"
  12208. ],
  12209. "project": "clutter",
  12210. "commit_id": "e310c68d7b38d521e341f4e8a36f54303079d74e",
  12211. "hash": 11732202029626356531742516125834610434,
  12212. "size": 13,
  12213. "message": "x11: trap errors when calling XIQueryDevice\n\nDevices can disappear at any time, causing XIQueryDevice\nto throw an error. At the same time, plug a memory leak.\n\nhttps://bugzilla.gnome.org/show_bug.cgi?id=701974",
  12214. "dataset": "other",
  12215. "idx": 497479
  12216. },
  12217. {
  12218. "func": "relate_masters (gpointer key,\n gpointer value,\n gpointer data)\n{\n ClutterDeviceManagerXI2 *manager_xi2 = data;\n ClutterInputDevice *device, *relative;\n\n device = g_hash_table_lookup (manager_xi2->devices_by_id, key);\n relative = g_hash_table_lookup (manager_xi2->devices_by_id, value);\n\n _clutter_input_device_set_associated_device (device, relative);\n _clutter_input_device_set_associated_device (relative, device);\n}",
  12219. "target": 0,
  12220. "cwe": [
  12221. "CWE-264"
  12222. ],
  12223. "project": "clutter",
  12224. "commit_id": "e310c68d7b38d521e341f4e8a36f54303079d74e",
  12225. "hash": 275646750222884968905318332727855387912,
  12226. "size": 13,
  12227. "message": "x11: trap errors when calling XIQueryDevice\n\nDevices can disappear at any time, causing XIQueryDevice\nto throw an error. At the same time, plug a memory leak.\n\nhttps://bugzilla.gnome.org/show_bug.cgi?id=701974",
  12228. "dataset": "other",
  12229. "idx": 497484
  12230. },
  12231. {
  12232. "func": "mono_loader_lock_if_inited (void)\n{\n\tif (loader_lock_inited)\n\t\tmono_loader_lock ();\n}",
  12233. "project": "mono",
  12234. "hash": 169559412662811690103534238135039914320,
  12235. "size": 5,
  12236. "commit_id": "8e890a3bf80a4620e417814dc14886b1bbd17625",
  12237. "message": "Search for dllimported shared libs in the base directory, not cwd.\n\n* loader.c: we don't search the current directory anymore for shared\nlibraries referenced in DllImport attributes, as it has a slight\nsecurity risk. We search in the same directory where the referencing\nimage was loaded from, instead. Fixes bug# 641915.",
  12238. "target": 0,
  12239. "dataset": "other",
  12240. "idx": 334479
  12241. },
  12242. {
  12243. "func": "find_cached_memberref_sig (MonoImage *image, guint32 sig_idx)\n{\n\tgpointer res;\n\n\tmono_loader_lock ();\n\tres = g_hash_table_lookup (image->memberref_signatures, GUINT_TO_POINTER (sig_idx));\n\tmono_loader_unlock ();\n\n\treturn res;\n}",
  12244. "project": "mono",
  12245. "hash": 204761287727301514708150813086363835120,
  12246. "size": 10,
  12247. "commit_id": "8e890a3bf80a4620e417814dc14886b1bbd17625",
  12248. "message": "Search for dllimported shared libs in the base directory, not cwd.\n\n* loader.c: we don't search the current directory anymore for shared\nlibraries referenced in DllImport attributes, as it has a slight\nsecurity risk. We search in the same directory where the referencing\nimage was loaded from, instead. Fixes bug# 641915.",
  12249. "target": 0,
  12250. "dataset": "other",
  12251. "idx": 334503
  12252. },
  12253. {
  12254. "func": "mono_loader_unlock_if_inited (void)\n{\n\tif (loader_lock_inited)\n\t\tmono_loader_unlock ();\n}",
  12255. "project": "mono",
  12256. "hash": 167586732968159065909171015031580186969,
  12257. "size": 5,
  12258. "commit_id": "8e890a3bf80a4620e417814dc14886b1bbd17625",
  12259. "message": "Search for dllimported shared libs in the base directory, not cwd.\n\n* loader.c: we don't search the current directory anymore for shared\nlibraries referenced in DllImport attributes, as it has a slight\nsecurity risk. We search in the same directory where the referencing\nimage was loaded from, instead. Fixes bug# 641915.",
  12260. "target": 0,
  12261. "dataset": "other",
  12262. "idx": 334515
  12263. },
  12264. {
  12265. "func": "clutter_device_manager_xi2_get_device (ClutterDeviceManager *manager,\n gint id)\n{\n ClutterDeviceManagerXI2 *manager_xi2 = CLUTTER_DEVICE_MANAGER_XI2 (manager);\n\n return g_hash_table_lookup (manager_xi2->devices_by_id,\n GINT_TO_POINTER (id));\n}",
  12266. "target": 0,
  12267. "cwe": [
  12268. "CWE-264"
  12269. ],
  12270. "project": "clutter",
  12271. "commit_id": "e310c68d7b38d521e341f4e8a36f54303079d74e",
  12272. "hash": 49896070100448030956265376701597052987,
  12273. "size": 8,
  12274. "message": "x11: trap errors when calling XIQueryDevice\n\nDevices can disappear at any time, causing XIQueryDevice\nto throw an error. At the same time, plug a memory leak.\n\nhttps://bugzilla.gnome.org/show_bug.cgi?id=701974",
  12275. "dataset": "other",
  12276. "idx": 497488
  12277. }
  12278. ]
  12279. },
  12280. {
  12281. "call_depth": 3,
  12282. "longest_call_chain": [
  12283. "end_profiler_frame",
  12284. "endFrame",
  12285. "endFrameEx"
  12286. ],
  12287. "group_size": 5,
  12288. "functions": [
  12289. {
  12290. "func": " void endFrame(const TypedValue* /*retval*/, const char* symbol,\n bool /*endMain*/ = false) override {\n doTrace(symbol, true);\n }",
  12291. "project": "hhvm",
  12292. "hash": 216998652212451743931488043650664066631,
  12293. "size": 4,
  12294. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  12295. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  12296. "target": 0,
  12297. "dataset": "other",
  12298. "idx": 219430
  12299. },
  12300. {
  12301. "func": "void Profiler::endFrame(const TypedValue *retval,\n const char *symbol,\n bool endMain) {\n if (m_stack) {\n // special case for main() frame that's only ended by endAllFrames()\n if (!endMain && m_stack->m_parent == nullptr) {\n return;\n }\n endFrameEx(retval, symbol);\n m_func_hash_counters[m_stack->m_hash_code]--;\n releaseFrame();\n }\n}",
  12302. "project": "hhvm",
  12303. "hash": 26587959672488513904056432004123374690,
  12304. "size": 13,
  12305. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  12306. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  12307. "target": 0,
  12308. "dataset": "other",
  12309. "idx": 219461
  12310. },
  12311. {
  12312. "func": " endFrameEx(const TypedValue* /*retvalue*/, const char* /*symbol*/) override {\n sample_check();\n }",
  12313. "project": "hhvm",
  12314. "hash": 273478467820533882100467124057011381506,
  12315. "size": 3,
  12316. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  12317. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  12318. "target": 0,
  12319. "dataset": "other",
  12320. "idx": 219310
  12321. },
  12322. {
  12323. "func": "void Profiler::endFrameEx(const TypedValue* /*retval*/,\n const char* /*_symbol*/) {}",
  12324. "project": "hhvm",
  12325. "hash": 35590551211878468064778370986041065781,
  12326. "size": 2,
  12327. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  12328. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  12329. "target": 0,
  12330. "dataset": "other",
  12331. "idx": 219813
  12332. },
  12333. {
  12334. "func": "void end_profiler_frame(Profiler *p,\n const TypedValue *retval,\n const char *symbol) {\n p->endFrame(retval, symbol);\n}",
  12335. "project": "hhvm",
  12336. "hash": 236448474649344352598051191628845271714,
  12337. "size": 5,
  12338. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  12339. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  12340. "target": 0,
  12341. "dataset": "other",
  12342. "idx": 219590
  12343. }
  12344. ]
  12345. },
  12346. {
  12347. "call_depth": 3,
  12348. "longest_call_chain": [
  12349. "input_add_uevent_modalias_var",
  12350. "input_print_modalias",
  12351. "input_print_modalias_bits"
  12352. ],
  12353. "group_size": 4,
  12354. "functions": [
  12355. {
  12356. "func": "static int input_print_modalias_bits(char *buf, int size,\n\t\t\t\t char name, unsigned long *bm,\n\t\t\t\t unsigned int min_bit, unsigned int max_bit)\n{\n\tint len = 0, i;\n\n\tlen += snprintf(buf, max(size, 0), \"%c\", name);\n\tfor (i = min_bit; i < max_bit; i++)\n\t\tif (bm[BIT_WORD(i)] & BIT_MASK(i))\n\t\t\tlen += snprintf(buf + len, max(size - len, 0), \"%X,\", i);\n\treturn len;\n}",
  12357. "project": "linux",
  12358. "hash": 158850091406226619329147198274351263310,
  12359. "size": 12,
  12360. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  12361. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  12362. "target": 0,
  12363. "dataset": "other",
  12364. "idx": 353392
  12365. },
  12366. {
  12367. "func": "static int input_print_modalias(char *buf, int size, struct input_dev *id,\n\t\t\t\tint add_cr)\n{\n\tint len;\n\n\tlen = snprintf(buf, max(size, 0),\n\t\t \"input:b%04Xv%04Xp%04Xe%04X-\",\n\t\t id->id.bustype, id->id.vendor,\n\t\t id->id.product, id->id.version);\n\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'e', id->evbit, 0, EV_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'k', id->keybit, KEY_MIN_INTERESTING, KEY_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'r', id->relbit, 0, REL_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'a', id->absbit, 0, ABS_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'm', id->mscbit, 0, MSC_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'l', id->ledbit, 0, LED_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t's', id->sndbit, 0, SND_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'f', id->ffbit, 0, FF_MAX);\n\tlen += input_print_modalias_bits(buf + len, size - len,\n\t\t\t\t'w', id->swbit, 0, SW_MAX);\n\n\tif (add_cr)\n\t\tlen += snprintf(buf + len, max(size - len, 0), \"\\n\");\n\n\treturn len;\n}",
  12368. "project": "linux",
  12369. "hash": 60420096432809030050053268975505946861,
  12370. "size": 34,
  12371. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  12372. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  12373. "target": 0,
  12374. "dataset": "other",
  12375. "idx": 353343
  12376. },
  12377. {
  12378. "func": "static int input_add_uevent_modalias_var(struct kobj_uevent_env *env,\n\t\t\t\t\t struct input_dev *dev)\n{\n\tint len;\n\n\tif (add_uevent_var(env, \"MODALIAS=\"))\n\t\treturn -ENOMEM;\n\n\tlen = input_print_modalias(&env->buf[env->buflen - 1],\n\t\t\t\t sizeof(env->buf) - env->buflen,\n\t\t\t\t dev, 0);\n\tif (len >= (sizeof(env->buf) - env->buflen))\n\t\treturn -ENOMEM;\n\n\tenv->buflen += len;\n\treturn 0;\n}",
  12379. "project": "linux",
  12380. "hash": 258821360740180395617262343756556213176,
  12381. "size": 17,
  12382. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  12383. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  12384. "target": 0,
  12385. "dataset": "other",
  12386. "idx": 353380
  12387. },
  12388. {
  12389. "func": "static ssize_t input_dev_show_modalias(struct device *dev,\n\t\t\t\t struct device_attribute *attr,\n\t\t\t\t char *buf)\n{\n\tstruct input_dev *id = to_input_dev(dev);\n\tssize_t len;\n\n\tlen = input_print_modalias(buf, PAGE_SIZE, id, 1);\n\n\treturn min_t(int, len, PAGE_SIZE);\n}",
  12390. "project": "linux",
  12391. "hash": 264464487934238493096880515774601896895,
  12392. "size": 11,
  12393. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  12394. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  12395. "target": 0,
  12396. "dataset": "other",
  12397. "idx": 353326
  12398. }
  12399. ]
  12400. },
  12401. {
  12402. "call_depth": 3,
  12403. "longest_call_chain": [
  12404. "jsi_csBitGetSet",
  12405. "jsi_csSBitGetSet",
  12406. "jsi_csSBitSetGet"
  12407. ],
  12408. "group_size": 4,
  12409. "functions": [
  12410. {
  12411. "project": "jsish",
  12412. "commit_id": "858da537bde4de9d8c92466d5a866505310bc328",
  12413. "target": 0,
  12414. "func": "static bool jsi_csBitSetGet(int isSet, uchar *tbuf, int bits, Jsi_UWide *valPtr) {\n union bitfield *bms = (union bitfield *)tbuf;\n Jsi_UWide val = *valPtr;\n union bitfield {\n Jsi_UWide b1:1; Jsi_UWide b2:2; Jsi_UWide b3:3; Jsi_UWide b4:4; Jsi_UWide b5:5; Jsi_UWide b6:6;\n Jsi_UWide b7:7; Jsi_UWide b8:8; Jsi_UWide b9:9; Jsi_UWide b10:10; Jsi_UWide b11:11; Jsi_UWide b12:12;\n Jsi_UWide b13:13; Jsi_UWide b14:14; Jsi_UWide b15:15; Jsi_UWide b16:16; Jsi_UWide b17:17; \n Jsi_UWide b18:18; Jsi_UWide b19:19; Jsi_UWide b20:20; Jsi_UWide b21:21; Jsi_UWide b22:22;\n Jsi_UWide b23:23; Jsi_UWide b24:24; Jsi_UWide b25:25; Jsi_UWide b26:26; Jsi_UWide b27:27;\n Jsi_UWide b28:28; Jsi_UWide b29:29; Jsi_UWide b30:30; Jsi_UWide b31:31; Jsi_UWide b32:32;\n Jsi_UWide b33:33; Jsi_UWide b34:34; Jsi_UWide b35:35; Jsi_UWide b36:36; Jsi_UWide b37:37;\n Jsi_UWide b38:38; Jsi_UWide b39:39; Jsi_UWide b40:40; Jsi_UWide b41:41; Jsi_UWide b42:42;\n Jsi_UWide b43:43; Jsi_UWide b44:44; Jsi_UWide b45:45; Jsi_UWide b46:46; Jsi_UWide b47:47;\n Jsi_UWide b48:48; Jsi_UWide b49:49; Jsi_UWide b50:50; Jsi_UWide b51:51; Jsi_UWide b52:52;\n Jsi_UWide b53:53; Jsi_UWide b54:54; Jsi_UWide b55:55; Jsi_UWide b56:56; Jsi_UWide b57:57;\n Jsi_UWide b58:58; Jsi_UWide b59:59; Jsi_UWide b60:60; Jsi_UWide b61:61; Jsi_UWide b62:62;\n Jsi_UWide b63:63; Jsi_UWide b64:64;\n };\n if (isSet) {\n switch (bits) {\n #define CBSN(n) \\\n case n: bms->b##n = val; return (bms->b##n == val)\n CBSN(1); CBSN(2); CBSN(3); CBSN(4); CBSN(5); CBSN(6); CBSN(7); CBSN(8);\n CBSN(9); CBSN(10); CBSN(11); CBSN(12); CBSN(13); CBSN(14); CBSN(15); CBSN(16);\n CBSN(17); CBSN(18); CBSN(19); CBSN(20); CBSN(21); CBSN(22); CBSN(23); CBSN(24);\n CBSN(25); CBSN(26); CBSN(27); CBSN(28); CBSN(29); CBSN(30); CBSN(31); CBSN(32);\n CBSN(33); CBSN(34); CBSN(35); CBSN(36); CBSN(37); CBSN(38); CBSN(39); CBSN(40);\n CBSN(41); CBSN(42); CBSN(43); CBSN(44); CBSN(45); CBSN(46); CBSN(47); CBSN(48);\n CBSN(49); CBSN(50); CBSN(51); CBSN(52); CBSN(53); CBSN(54); CBSN(55); CBSN(56);\n CBSN(57); CBSN(58); CBSN(59); CBSN(60); CBSN(61); CBSN(62); CBSN(63); CBSN(64);\n }\n assert(0);\n }\n switch (bits) {\n#define CBGN(n) \\\n case n: val = bms->b##n; break\n CBGN(1); CBGN(2); CBGN(3); CBGN(4); CBGN(5); CBGN(6); CBGN(7); CBGN(8);\n CBGN(9); CBGN(10); CBGN(11); CBGN(12); CBGN(13); CBGN(14); CBGN(15); CBGN(16);\n CBGN(17); CBGN(18); CBGN(19); CBGN(20); CBGN(21); CBGN(22); CBGN(23); CBGN(24);\n CBGN(25); CBGN(26); CBGN(27); CBGN(28); CBGN(29); CBGN(30); CBGN(31); CBGN(32);\n CBGN(33); CBGN(34); CBGN(35); CBGN(36); CBGN(37); CBGN(38); CBGN(39); CBGN(40);\n CBGN(41); CBGN(42); CBGN(43); CBGN(44); CBGN(45); CBGN(46); CBGN(47); CBGN(48);\n CBGN(49); CBGN(50); CBGN(51); CBGN(52); CBGN(53); CBGN(54); CBGN(55); CBGN(56);\n CBGN(57); CBGN(58); CBGN(59); CBGN(60); CBGN(61); CBGN(62); CBGN(63); CBGN(64);\n default: assert(0);\n }\n *valPtr = val;\n return 1;\n}",
  12415. "idx": 520862,
  12416. "cwe": "CWE-190",
  12417. "hash": 315040628554983887920356217431033151804,
  12418. "dataset": "other"
  12419. },
  12420. {
  12421. "project": "jsish",
  12422. "commit_id": "858da537bde4de9d8c92466d5a866505310bc328",
  12423. "target": 0,
  12424. "func": "static Jsi_RC jsi_csSBitGetSet(Jsi_Interp *interp, void *vrec, Jsi_Wide* vPtr, Jsi_OptionSpec *spec, int idx, bool isSet) {\n Jsi_Wide *valPtr = (typeof(valPtr))vPtr;\n int bits = spec->bits;\n int boffs = spec->boffset;\n if (bits<1 || bits>=64) return JSI_ERROR;\n int ofs = (boffs/8);\n int bo = (boffs%8); // 0 if byte-aligned\n int Bsz = ((bits+bo+7)/8);\n uchar *rec = (uchar*)vrec;\n#ifdef __SIZEOF_INT128__\n typedef __int128 stvalType;\n#else\n typedef Jsi_Wide stvalType;\n#endif\n stvalType tbuf[2] = {};\n uchar sbuf[20], *bptr = (uchar*)tbuf;\n memcpy(tbuf, rec+ofs, Bsz);\n Jsi_Wide mval = *valPtr;\n Jsi_Wide amask = ((1LL<<(bits-1))-1LL);\n stvalType tval = 0, kval = 0, lmask;\n if (bo) { // If not byte aligned, get tval and shift\n bptr = sbuf;\n kval = tval = *(typeof(tval)*)tbuf;\n tval >>= bo;\n if (!isSet) {\n mval = (Jsi_Wide)tval;\n *(Jsi_Wide*)bptr = mval;\n }\n }\n \n if (!isSet) { // Get value.\n if (!jsi_csSBitSetGet(0, bptr, bits, &mval))\n return JSI_ERROR;\n *valPtr = mval;\n return JSI_OK;\n }\n \n if (!jsi_csSBitSetGet(1, bptr, bits, &mval))\n return JSI_ERROR;\n if (bo) {\n tval = (typeof(tval))mval;\n lmask=(amask<<bo);\n kval &= ~lmask;\n tval <<= bo;\n tval = (kval | tval);\n *(typeof(tval)*)tbuf = tval;\n }\n memcpy(rec+ofs, tbuf, Bsz);\n\n return JSI_OK; \n}",
  12425. "idx": 520912,
  12426. "cwe": "CWE-190",
  12427. "hash": 85793746791659603420840514709219530889,
  12428. "dataset": "other"
  12429. },
  12430. {
  12431. "project": "jsish",
  12432. "commit_id": "858da537bde4de9d8c92466d5a866505310bc328",
  12433. "target": 0,
  12434. "func": "static Jsi_RC jsi_csBitGetSet(Jsi_Interp *interp, void *vrec, Jsi_Wide* vPtr, Jsi_OptionSpec *spec, int idx, bool isSet) {\n bool us = (spec->tname && spec->tname[0] == 'u');\n if (!us) \n return jsi_csSBitGetSet(interp, vrec, vPtr, spec, idx, isSet);\n\n if (*vPtr<0)\n return JSI_ERROR;\n\n Jsi_UWide *valPtr = (typeof(valPtr))vPtr;\n int bits = spec->bits;\n int boffs = spec->boffset;\n if (bits<1 || bits>=64) return JSI_ERROR;\n int ofs = (boffs/8);\n int bo = (boffs%8); // 0 if byte-aligned\n int Bsz = ((bits+bo+7)/8);\n uchar *rec = (uchar*)vrec;\n#ifdef __SIZEOF_INT128__\n typedef unsigned __int128 utvalType;\n#else\n typedef Jsi_UWide utvalType;\n#endif\n utvalType tbuf[2] = {};\n uchar sbuf[20], *bptr = (uchar*)tbuf;\n memcpy(tbuf, rec+ofs, Bsz);\n Jsi_UWide mval;\n Jsi_UWide amask = ((1LL<<(bits-1))-1LL);\n utvalType tval = 0, kval = 0, lmask;\n if (bo) { // If not byte aligned, get tval and shift\n bptr = sbuf;\n kval = tval = *(typeof(tval)*)tbuf;\n tval >>= bo;\n if (!isSet) {\n mval = (Jsi_UWide)tval;\n *(Jsi_UWide*)bptr = mval;\n }\n } else\n mval = *valPtr;\n \n if (!isSet) { // Get value.\n if (!jsi_csBitSetGet(0, bptr, bits, &mval))\n return JSI_ERROR;\n *valPtr = mval;\n return JSI_OK;\n }\n \n if (!jsi_csBitSetGet(1, bptr, bits, &mval))\n return JSI_ERROR;\n if (bo) {\n tval = (typeof(tval))mval;\n lmask=(amask<<bo);\n kval &= ~lmask;\n tval <<= bo;\n tval = (kval | tval);\n *(typeof(tval)*)tbuf = tval;\n }\n memcpy(rec+ofs, tbuf, Bsz);\n\n return JSI_OK; \n}",
  12435. "idx": 520856,
  12436. "cwe": "CWE-190",
  12437. "hash": 233792583997789375492824257043596509458,
  12438. "dataset": "other"
  12439. },
  12440. {
  12441. "project": "jsish",
  12442. "commit_id": "858da537bde4de9d8c92466d5a866505310bc328",
  12443. "target": 0,
  12444. "func": "static bool jsi_csSBitSetGet(int isSet, uchar *tbuf, int bits, Jsi_Wide *valPtr) {\n union bitfield *bms = (union bitfield *)tbuf;\n Jsi_Wide val = *valPtr;\n union bitfield {\n Jsi_Wide b1:1; Jsi_Wide b2:2; Jsi_Wide b3:3; Jsi_Wide b4:4; Jsi_Wide b5:5; Jsi_Wide b6:6;\n Jsi_Wide b7:7; Jsi_Wide b8:8; Jsi_Wide b9:9; Jsi_Wide b10:10; Jsi_Wide b11:11; Jsi_Wide b12:12;\n Jsi_Wide b13:13; Jsi_Wide b14:14; Jsi_Wide b15:15; Jsi_Wide b16:16; Jsi_Wide b17:17; \n Jsi_Wide b18:18; Jsi_Wide b19:19; Jsi_Wide b20:20; Jsi_Wide b21:21; Jsi_Wide b22:22;\n Jsi_Wide b23:23; Jsi_Wide b24:24; Jsi_Wide b25:25; Jsi_Wide b26:26; Jsi_Wide b27:27;\n Jsi_Wide b28:28; Jsi_Wide b29:29; Jsi_Wide b30:30; Jsi_Wide b31:31; Jsi_Wide b32:32;\n Jsi_Wide b33:33; Jsi_Wide b34:34; Jsi_Wide b35:35; Jsi_Wide b36:36; Jsi_Wide b37:37;\n Jsi_Wide b38:38; Jsi_Wide b39:39; Jsi_Wide b40:40; Jsi_Wide b41:41; Jsi_Wide b42:42;\n Jsi_Wide b43:43; Jsi_Wide b44:44; Jsi_Wide b45:45; Jsi_Wide b46:46; Jsi_Wide b47:47;\n Jsi_Wide b48:48; Jsi_Wide b49:49; Jsi_Wide b50:50; Jsi_Wide b51:51; Jsi_Wide b52:52;\n Jsi_Wide b53:53; Jsi_Wide b54:54; Jsi_Wide b55:55; Jsi_Wide b56:56; Jsi_Wide b57:57;\n Jsi_Wide b58:58; Jsi_Wide b59:59; Jsi_Wide b60:60; Jsi_Wide b61:61; Jsi_Wide b62:62;\n Jsi_Wide b63:63; Jsi_Wide b64:64;\n };\n if (isSet) {\n switch (bits) {\n CBSN(1); CBSN(2); CBSN(3); CBSN(4); CBSN(5); CBSN(6); CBSN(7); CBSN(8);\n CBSN(9); CBSN(10); CBSN(11); CBSN(12); CBSN(13); CBSN(14); CBSN(15); CBSN(16);\n CBSN(17); CBSN(18); CBSN(19); CBSN(20); CBSN(21); CBSN(22); CBSN(23); CBSN(24);\n CBSN(25); CBSN(26); CBSN(27); CBSN(28); CBSN(29); CBSN(30); CBSN(31); CBSN(32);\n CBSN(33); CBSN(34); CBSN(35); CBSN(36); CBSN(37); CBSN(38); CBSN(39); CBSN(40);\n CBSN(41); CBSN(42); CBSN(43); CBSN(44); CBSN(45); CBSN(46); CBSN(47); CBSN(48);\n CBSN(49); CBSN(50); CBSN(51); CBSN(52); CBSN(53); CBSN(54); CBSN(55); CBSN(56);\n CBSN(57); CBSN(58); CBSN(59); CBSN(60); CBSN(61); CBSN(62); CBSN(63); CBSN(64);\n }\n assert(0);\n }\n switch (bits) {\n CBGN(1); CBGN(2); CBGN(3); CBGN(4); CBGN(5); CBGN(6); CBGN(7); CBGN(8);\n CBGN(9); CBGN(10); CBGN(11); CBGN(12); CBGN(13); CBGN(14); CBGN(15); CBGN(16);\n CBGN(17); CBGN(18); CBGN(19); CBGN(20); CBGN(21); CBGN(22); CBGN(23); CBGN(24);\n CBGN(25); CBGN(26); CBGN(27); CBGN(28); CBGN(29); CBGN(30); CBGN(31); CBGN(32);\n CBGN(33); CBGN(34); CBGN(35); CBGN(36); CBGN(37); CBGN(38); CBGN(39); CBGN(40);\n CBGN(41); CBGN(42); CBGN(43); CBGN(44); CBGN(45); CBGN(46); CBGN(47); CBGN(48);\n CBGN(49); CBGN(50); CBGN(51); CBGN(52); CBGN(53); CBGN(54); CBGN(55); CBGN(56);\n CBGN(57); CBGN(58); CBGN(59); CBGN(60); CBGN(61); CBGN(62); CBGN(63); CBGN(64);\n default: assert(0);\n }\n *valPtr = val;\n return 1;\n}",
  12445. "idx": 520915,
  12446. "cwe": "CWE-190",
  12447. "hash": 144975561671138693424233026446886621647,
  12448. "dataset": "other"
  12449. }
  12450. ]
  12451. },
  12452. {
  12453. "call_depth": 4,
  12454. "longest_call_chain": [
  12455. "LY_TREE_DFS_BEGIN",
  12456. "LY_TREE_FOR",
  12457. "LY_TREE_FOR_SAFE",
  12458. "LY_CHECK_ERR_RETURN"
  12459. ],
  12460. "group_size": 25,
  12461. "functions": [
  12462. {
  12463. "func": "lyxml_correct_elem_ns(struct ly_ctx *ctx, struct lyxml_elem *elem, struct lyxml_elem *orig, int copy_ns,\n int correct_attrs)\n{\n const struct lyxml_ns *tmp_ns;\n struct lyxml_elem *elem_root, *ns_root, *tmp, *iter;\n struct lyxml_attr *attr;\n\n /* find the root of elem */\n for (elem_root = elem; elem_root->parent; elem_root = elem_root->parent);\n\n LY_TREE_DFS_BEGIN(elem, tmp, iter) {\n if (iter->ns) {\n /* find the root of elem NS */\n for (ns_root = iter->ns->parent; ns_root; ns_root = ns_root->parent);\n\n /* elem NS is defined outside elem subtree */\n if (ns_root != elem_root) {\n if (copy_ns) {\n tmp_ns = iter->ns;\n /* we may have already copied the NS over? */\n iter->ns = lyxml_get_ns(iter, tmp_ns->prefix);\n\n /* we haven't copied it over, copy it now */\n if (!iter->ns) {\n iter->ns = (struct lyxml_ns *)lyxml_dup_attr(ctx, iter, (struct lyxml_attr *)tmp_ns);\n }\n } else {\n iter->ns = NULL;\n }\n }\n }\n if (iter->content && iter->content[0] && copy_ns) {\n lyxml_correct_content_ns(ctx, iter, orig);\n }\n if (correct_attrs) {\n LY_TREE_FOR(iter->attr, attr) {\n lyxml_correct_attr_ns(ctx, attr, elem_root, copy_ns);\n }\n }\n LY_TREE_DFS_END(elem, tmp, iter);\n }\n}",
  12464. "project": "libyang",
  12465. "hash": 283162333390592841335093381050743686724,
  12466. "size": 42,
  12467. "commit_id": "298b30ea4ebee137226acf9bb38678bd82704582",
  12468. "message": "common FEATURE add a hard limit for recursion\n\nFixes #1453",
  12469. "target": 0,
  12470. "dataset": "other",
  12471. "idx": 366031
  12472. },
  12473. {
  12474. "func": "fill_yin_feature(struct lys_module *module, struct lyxml_elem *yin, struct lys_feature *f, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n const char *value;\n struct lyxml_elem *child, *next;\n int c_ftrs = 0, c_ext = 0, ret;\n void *reallocated;\n\n GETVAL(ctx, value, yin, \"name\");\n if (lyp_check_identifier(ctx, value, LY_IDENT_FEATURE, module, NULL)) {\n goto error;\n }\n f->name = lydict_insert(ctx, value, strlen(value));\n f->module = module;\n\n if (read_yin_common(module, NULL, f, LYEXT_PAR_FEATURE, yin, 0, unres)) {\n goto error;\n }\n\n LY_TREE_FOR(yin->child, child) {\n if (strcmp(child->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, f->ext_size, \"extensions\", \"feature\", error);\n c_ext++;\n } else if (!strcmp(child->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, f->iffeature_size, \"if-feature\", \"feature\", error);\n c_ftrs++;\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n goto error;\n }\n }\n\n if (c_ftrs) {\n f->iffeature = calloc(c_ftrs, sizeof *f->iffeature);\n LY_CHECK_ERR_GOTO(!f->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(f->ext, (c_ext + f->ext_size) * sizeof *f->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n f->ext = reallocated;\n\n /* init memory */\n memset(&f->ext[f->ext_size], 0, c_ext * sizeof *f->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (strcmp(child->ns->value, LY_NSYIN)) {\n /* extension */\n ret = lyp_yin_fill_ext(f, LYEXT_PAR_FEATURE, 0, 0, module, child, &f->ext, &f->ext_size, unres);\n if (ret) {\n goto error;\n }\n } else { /* if-feature */\n ret = fill_yin_iffeature((struct lys_node *)f, 1, child, &f->iffeature[f->iffeature_size], unres);\n f->iffeature_size++;\n if (ret) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&f->ext, f->ext_size, c_ext + f->ext_size);\n\n /* check for circular dependencies */\n if (f->iffeature_size) {\n if (unres_schema_add_node(module, unres, f, UNRES_FEATURE, NULL) == -1) {\n goto error;\n }\n }\n\n return EXIT_SUCCESS;\n\nerror:\n return EXIT_FAILURE;\n}",
  12475. "project": "libyang",
  12476. "hash": 23072446618288366163898240985312641642,
  12477. "size": 77,
  12478. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12479. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12480. "target": 0,
  12481. "dataset": "other",
  12482. "idx": 336769
  12483. },
  12484. {
  12485. "func": "fill_yin_identity(struct lys_module *module, struct lyxml_elem *yin, struct lys_ident *ident, struct unres_schema *unres)\n{\n struct lyxml_elem *node, *next;\n struct ly_ctx *ctx = module->ctx;\n const char *value;\n int rc;\n int c_ftrs = 0, c_base = 0, c_ext = 0;\n void *reallocated;\n\n GETVAL(ctx, value, yin, \"name\");\n ident->name = value;\n\n if (read_yin_common(module, NULL, ident, LYEXT_PAR_IDENT, yin, OPT_IDENT | OPT_MODULE, unres)) {\n goto error;\n }\n\n if (dup_identities_check(ident->name, module)) {\n goto error;\n }\n\n LY_TREE_FOR(yin->child, node) {\n if (strcmp(node->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, ident->ext_size, \"extensions\", \"identity\", error);\n c_ext++;\n } else if (!strcmp(node->name, \"base\")) {\n if (c_base && (module->version < 2)) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, \"base\", \"identity\");\n goto error;\n }\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_base, ident->base_size, \"bases\", \"identity\", error);\n if (lyp_yin_parse_subnode_ext(module, ident, LYEXT_PAR_IDENT, node, LYEXT_SUBSTMT_BASE, c_base, unres)) {\n goto error;\n }\n c_base++;\n\n } else if ((module->version >= 2) && !strcmp(node->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, ident->iffeature_size, \"if-features\", \"identity\", error);\n c_ftrs++;\n\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, node->name, \"identity\");\n goto error;\n }\n }\n\n if (c_base) {\n ident->base_size = 0;\n ident->base = calloc(c_base, sizeof *ident->base);\n LY_CHECK_ERR_GOTO(!ident->base, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n ident->iffeature = calloc(c_ftrs, sizeof *ident->iffeature);\n LY_CHECK_ERR_GOTO(!ident->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(ident->ext, (c_ext + ident->ext_size) * sizeof *ident->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n ident->ext = reallocated;\n\n /* init memory */\n memset(&ident->ext[ident->ext_size], 0, c_ext * sizeof *ident->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, node) {\n if (strcmp(node->ns->value, LY_NSYIN)) {\n /* extension */\n rc = lyp_yin_fill_ext(ident, LYEXT_PAR_IDENT, 0, 0, module, node, &ident->ext, &ident->ext_size, unres);\n if (rc) {\n goto error;\n }\n } else if (!strcmp(node->name, \"base\")) {\n GETVAL(ctx, value, node, \"name\");\n value = transform_schema2json(module, value);\n if (!value) {\n goto error;\n }\n\n if (unres_schema_add_str(module, unres, ident, UNRES_IDENT, value) == -1) {\n lydict_remove(ctx, value);\n goto error;\n }\n lydict_remove(ctx, value);\n } else if (!strcmp(node->name, \"if-feature\")) {\n rc = fill_yin_iffeature((struct lys_node *)ident, 0, node, &ident->iffeature[ident->iffeature_size], unres);\n ident->iffeature_size++;\n if (rc) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&ident->ext, ident->ext_size, c_ext + ident->ext_size);\n\n return EXIT_SUCCESS;\n\nerror:\n return EXIT_FAILURE;\n}",
  12486. "project": "libyang",
  12487. "hash": 303210407653721522682644813687627927126,
  12488. "size": 100,
  12489. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12490. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12491. "target": 0,
  12492. "dataset": "other",
  12493. "idx": 336785
  12494. },
  12495. {
  12496. "func": "read_yin_container(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next, root;\n struct lys_node *node = NULL;\n struct lys_node *retval;\n struct lys_node_container *cont;\n const char *value;\n void *reallocated;\n int r;\n int c_tpdf = 0, c_must = 0, c_ftrs = 0, c_ext = 0;\n\n /* init */\n memset(&root, 0, sizeof root);\n\n cont = calloc(1, sizeof *cont);\n LY_CHECK_ERR_RETURN(!cont, LOGMEM(ctx), NULL);\n\n cont->nodetype = LYS_CONTAINER;\n cont->prev = (struct lys_node *)cont;\n retval = (struct lys_node *)cont;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :\n (options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT),\n unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* process container's specific children */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"container\", error);\n c_ext++;\n } else if (!strcmp(sub->name, \"presence\")) {\n if (cont->presence) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, sub, \"value\");\n cont->presence = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_PRESENCE, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"when\")) {\n if (cont->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n cont->when = read_yin_when(module, sub, unres);\n if (!cont->when) {\n lyxml_free(ctx, sub);\n goto error;\n }\n lyxml_free(ctx, sub);\n\n /* data statements */\n } else if (!strcmp(sub->name, \"container\") ||\n !strcmp(sub->name, \"leaf-list\") ||\n !strcmp(sub->name, \"leaf\") ||\n !strcmp(sub->name, \"list\") ||\n !strcmp(sub->name, \"choice\") ||\n !strcmp(sub->name, \"uses\") ||\n !strcmp(sub->name, \"grouping\") ||\n !strcmp(sub->name, \"anyxml\") ||\n !strcmp(sub->name, \"anydata\") ||\n !strcmp(sub->name, \"action\") ||\n !strcmp(sub->name, \"notification\")) {\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* array counters */\n } else if (!strcmp(sub->name, \"typedef\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, cont->tpdf_size, \"typedefs\", \"container\", error);\n c_tpdf++;\n } else if (!strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, cont->must_size, \"musts\", \"container\", error);\n c_must++;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"container\", error);\n c_ftrs++;\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* middle part - process nodes with cardinality of 0..n except the data nodes */\n if (c_tpdf) {\n cont->tpdf = calloc(c_tpdf, sizeof *cont->tpdf);\n LY_CHECK_ERR_GOTO(!cont->tpdf, LOGMEM(ctx), error);\n }\n if (c_must) {\n cont->must = calloc(c_must, sizeof *cont->must);\n LY_CHECK_ERR_GOTO(!cont->must, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n cont->iffeature = calloc(c_ftrs, sizeof *cont->iffeature);\n LY_CHECK_ERR_GOTO(!cont->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"typedef\")) {\n r = fill_yin_typedef(module, retval, sub, &cont->tpdf[cont->tpdf_size], unres);\n cont->tpdf_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &cont->must[cont->must_size], unres);\n cont->must_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &cont->iffeature[cont->iffeature_size], unres);\n cont->iffeature_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"container\")) {\n node = read_yin_container(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n node = read_yin_leaflist(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf\")) {\n node = read_yin_leaf(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"list\")) {\n node = read_yin_list(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"choice\")) {\n node = read_yin_choice(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"uses\")) {\n node = read_yin_uses(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"grouping\")) {\n node = read_yin_grouping(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"anyxml\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);\n } else if (!strcmp(sub->name, \"anydata\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);\n } else if (!strcmp(sub->name, \"action\")) {\n node = read_yin_rpc_action(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"notification\")) {\n node = read_yin_notif(module, retval, sub, options, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && (cont->when || cont->must)) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n for (r = 0; r < retval->ext_size; ++r) {\n /* set flag, which represent LYEXT_OPT_VALID */\n if (retval->ext[r]->flags & LYEXT_OPT_VALID) {\n retval->flags |= LYS_VALID_EXT;\n if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {\n retval->flags |= LYS_VALID_EXT_SUBTREE;\n break;\n }\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n return NULL;\n}",
  12497. "project": "libyang",
  12498. "hash": 55868768057507781729927570308714603647,
  12499. "size": 217,
  12500. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12501. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12502. "target": 1,
  12503. "dataset": "other",
  12504. "idx": 202684
  12505. },
  12506. {
  12507. "func": "read_yin_case(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next, root;\n struct lys_node_case *cs;\n struct lys_node *retval, *node = NULL;\n int c_ftrs = 0, c_ext = 0, ret;\n void *reallocated;\n\n /* init */\n memset(&root, 0, sizeof root);\n\n cs = calloc(1, sizeof *cs);\n LY_CHECK_ERR_RETURN(!cs, LOGMEM(ctx), NULL);\n cs->nodetype = LYS_CASE;\n cs->prev = (struct lys_node *)cs;\n retval = (struct lys_node *)cs;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | (!(options & LYS_PARSE_OPT_CFG_MASK) ? OPT_CFG_INHERIT : 0), unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* process choice's specific children */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"case\", error);\n c_ext++;\n } else if (!strcmp(sub->name, \"container\") ||\n !strcmp(sub->name, \"leaf-list\") ||\n !strcmp(sub->name, \"leaf\") ||\n !strcmp(sub->name, \"list\") ||\n !strcmp(sub->name, \"uses\") ||\n !strcmp(sub->name, \"choice\") ||\n !strcmp(sub->name, \"anyxml\") ||\n !strcmp(sub->name, \"anydata\")) {\n\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"case\", error);\n c_ftrs++;\n } else if (!strcmp(sub->name, \"when\")) {\n if (cs->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n cs->when = read_yin_when(module, sub, unres);\n if (!cs->when) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n if (c_ftrs) {\n cs->iffeature = calloc(c_ftrs, sizeof *cs->iffeature);\n LY_CHECK_ERR_GOTO(!cs->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n ret = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (ret) {\n goto error;\n }\n } else {\n /* if-feature */\n ret = fill_yin_iffeature(retval, 0, sub, &cs->iffeature[cs->iffeature_size], unres);\n cs->iffeature_size++;\n if (ret) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"container\")) {\n node = read_yin_container(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n node = read_yin_leaflist(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf\")) {\n node = read_yin_leaf(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"list\")) {\n node = read_yin_list(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"choice\")) {\n node = read_yin_choice(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"uses\")) {\n node = read_yin_uses(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"anyxml\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);\n } else if (!strcmp(sub->name, \"anydata\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && cs->when) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n return retval;\n\nerror:\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n lys_node_free(ctx, retval, NULL, 0);\n\n return NULL;\n}",
  12508. "project": "libyang",
  12509. "hash": 263724935681497802127371327965989280613,
  12510. "size": 151,
  12511. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12512. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12513. "target": 0,
  12514. "dataset": "other",
  12515. "idx": 336755
  12516. },
  12517. {
  12518. "func": "fill_yin_revision(struct lys_module *module, struct lyxml_elem *yin, struct lys_revision *rev,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *next, *child;\n const char *value;\n\n GETVAL(ctx, value, yin, \"date\");\n if (lyp_check_date(ctx, value)) {\n goto error;\n }\n memcpy(rev->date, value, LY_REV_SIZE - 1);\n\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (!child->ns) {\n /* garbage */\n continue;\n } else if (strcmp(child->ns->value, LY_NSYIN)) {\n /* possible extension instance */\n if (lyp_yin_parse_subnode_ext(module, rev, LYEXT_PAR_REVISION,\n child, LYEXT_SUBSTMT_SELF, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(child->name, \"description\")) {\n if (rev->dsc) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(module, rev, LYEXT_PAR_REVISION,\n child, LYEXT_SUBSTMT_DESCRIPTION, 0, unres)) {\n goto error;\n }\n rev->dsc = read_yin_subnode(ctx, child, \"text\");\n if (!rev->dsc) {\n goto error;\n }\n } else if (!strcmp(child->name, \"reference\")) {\n if (rev->ref) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(module, rev, LYEXT_PAR_REVISION,\n child, LYEXT_SUBSTMT_REFERENCE, 0, unres)) {\n goto error;\n }\n rev->ref = read_yin_subnode(ctx, child, \"text\");\n if (!rev->ref) {\n goto error;\n }\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n goto error;\n }\n }\n\n return EXIT_SUCCESS;\n\nerror:\n return EXIT_FAILURE;\n}",
  12519. "project": "libyang",
  12520. "hash": 29093414042920482668152808587976036431,
  12521. "size": 60,
  12522. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12523. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12524. "target": 0,
  12525. "dataset": "other",
  12526. "idx": 336757
  12527. },
  12528. {
  12529. "func": "read_yin_rpc_action(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin,\n int options, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next, root;\n struct lys_node *node = NULL;\n struct lys_node *retval;\n struct lys_node_rpc_action *rpc;\n int r;\n int c_tpdf = 0, c_ftrs = 0, c_input = 0, c_output = 0, c_ext = 0;\n void *reallocated;\n\n if (!strcmp(yin->name, \"action\") && (module->version < 2)) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, parent, \"action\");\n return NULL;\n }\n\n /* init */\n memset(&root, 0, sizeof root);\n\n rpc = calloc(1, sizeof *rpc);\n LY_CHECK_ERR_RETURN(!rpc, LOGMEM(ctx), NULL);\n\n rpc->nodetype = (!strcmp(yin->name, \"rpc\") ? LYS_RPC : LYS_ACTION);\n rpc->prev = (struct lys_node *)rpc;\n retval = (struct lys_node *)rpc;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin, OPT_IDENT | OPT_MODULE, unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* process rpc's specific children */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\",\n rpc->nodetype == LYS_RPC ? \"rpc\" : \"action\", error);\n c_ext++;\n continue;\n } else if (!strcmp(sub->name, \"input\")) {\n if (c_input) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n c_input++;\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n } else if (!strcmp(sub->name, \"output\")) {\n if (c_output) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n c_output++;\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* data statements */\n } else if (!strcmp(sub->name, \"grouping\")) {\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* array counters */\n } else if (!strcmp(sub->name, \"typedef\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, rpc->tpdf_size, \"typedefs\",\n rpc->nodetype == LYS_RPC ? \"rpc\" : \"action\", error);\n c_tpdf++;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\",\n rpc->nodetype == LYS_RPC ? \"rpc\" : \"action\", error);\n c_ftrs++;\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* middle part - process nodes with cardinality of 0..n except the data nodes */\n if (c_tpdf) {\n rpc->tpdf = calloc(c_tpdf, sizeof *rpc->tpdf);\n LY_CHECK_ERR_GOTO(!rpc->tpdf, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n rpc->iffeature = calloc(c_ftrs, sizeof *rpc->iffeature);\n LY_CHECK_ERR_GOTO(!rpc->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"typedef\")) {\n r = fill_yin_typedef(module, retval, sub, &rpc->tpdf[rpc->tpdf_size], unres);\n rpc->tpdf_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &rpc->iffeature[rpc->iffeature_size], unres);\n rpc->iffeature_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"grouping\")) {\n node = read_yin_grouping(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"input\") || !strcmp(sub->name, \"output\")) {\n node = read_yin_input_output(module, retval, sub, options, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n return NULL;\n}",
  12530. "project": "libyang",
  12531. "hash": 59707091107614957838004211761638343213,
  12532. "size": 149,
  12533. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12534. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12535. "target": 0,
  12536. "dataset": "other",
  12537. "idx": 336765
  12538. },
  12539. {
  12540. "func": "read_sub_module(struct lys_module *module, struct lys_submodule *submodule, struct lyxml_elem *yin,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *next, *child, root, grps, augs, revs, exts;\n struct lys_node *node = NULL;\n struct lys_module *trg;\n const char *value;\n int i, r, ret = -1;\n int version_flag = 0;\n /* (sub)module substatements are ordered in groups, increment this value when moving to another group\n * 0 - header-stmts, 1 - linkage-stmts, 2 - meta-stmts, 3 - revision-stmts, 4 - body-stmts */\n int substmt_group;\n /* just remember last substatement for logging */\n const char *substmt_prev;\n /* counters */\n int c_imp = 0, c_rev = 0, c_tpdf = 0, c_ident = 0, c_inc = 0, c_aug = 0, c_ftrs = 0, c_dev = 0;\n int c_ext = 0, c_extinst = 0;\n void *reallocated;\n\n /* to simplify code, store the module/submodule being processed as trg */\n trg = submodule ? (struct lys_module *)submodule : module;\n\n /* init */\n memset(&root, 0, sizeof root);\n memset(&grps, 0, sizeof grps);\n memset(&augs, 0, sizeof augs);\n memset(&exts, 0, sizeof exts);\n memset(&revs, 0, sizeof revs);\n\n /*\n * in the first run, we process elements with cardinality of 1 or 0..1 and\n * count elements with cardinality 0..n. Data elements (choices, containers,\n * leafs, lists, leaf-lists) are moved aside to be processed last, since we\n * need have all top-level and groupings already prepared at that time. In\n * the middle loop, we process other elements with carinality of 0..n since\n * we need to allocate arrays to store them.\n */\n substmt_group = 0;\n substmt_prev = NULL;\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (!child->ns) {\n /* garbage */\n lyxml_free(ctx, child);\n continue;\n } else if (strcmp(child->ns->value, LY_NSYIN)) {\n /* possible extension instance */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_extinst, trg->ext_size, \"extension instances\",\n submodule ? \"submodule\" : \"module\", error);\n lyxml_unlink_elem(ctx, child, 2);\n lyxml_add_child(ctx, &exts, child);\n c_extinst++;\n } else if (!submodule && !strcmp(child->name, \"namespace\")) {\n if (substmt_group > 0) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n\n if (trg->ns) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, child, \"uri\");\n trg->ns = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_NAMESPACE, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, child);\n\n substmt_prev = \"namespace\";\n } else if (!submodule && !strcmp(child->name, \"prefix\")) {\n if (substmt_group > 0) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n\n if (trg->prefix) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, child, \"value\");\n if (lyp_check_identifier(ctx, value, LY_IDENT_PREFIX, trg, NULL)) {\n goto error;\n }\n trg->prefix = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_PREFIX, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, child);\n\n substmt_prev = \"prefix\";\n } else if (submodule && !strcmp(child->name, \"belongs-to\")) {\n if (substmt_group > 0) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n\n if (trg->prefix) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, child, \"module\");\n if (!ly_strequal(value, submodule->belongsto->name, 1)) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, child->name);\n goto error;\n }\n\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_BELONGSTO, 0, unres)) {\n goto error;\n }\n\n /* get the prefix substatement, start with checks */\n if (!child->child) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, \"prefix\", child->name);\n goto error;\n } else if (strcmp(child->child->name, \"prefix\")) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->child->name);\n goto error;\n } else if (child->child->next) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->child->next->name);\n goto error;\n }\n /* and now finally get the value */\n GETVAL(ctx, value, child->child, \"value\");\n /* check here differs from a generic prefix check, since this prefix\n * don't have to be unique\n */\n if (lyp_check_identifier(ctx, value, LY_IDENT_NAME, NULL, NULL)) {\n goto error;\n }\n submodule->prefix = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child->child, LYEXT_SUBSTMT_PREFIX, 0, unres)) {\n goto error;\n }\n\n /* we are done with belongs-to */\n lyxml_free(ctx, child);\n\n substmt_prev = \"belongs-to\";\n\n /* counters (statements with n..1 cardinality) */\n } else if (!strcmp(child->name, \"import\")) {\n if (substmt_group > 1) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n substmt_group = 1;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_imp, trg->imp_size, \"imports\",\n submodule ? \"submodule\" : \"module\", error);\n c_imp++;\n\n substmt_prev = \"import\";\n } else if (!strcmp(child->name, \"revision\")) {\n if (substmt_group > 3) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n substmt_group = 3;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_rev, trg->rev_size, \"revisions\",\n submodule ? \"submodule\" : \"module\", error);\n c_rev++;\n\n lyxml_unlink_elem(ctx, child, 2);\n lyxml_add_child(ctx, &revs, child);\n\n substmt_prev = \"revision\";\n } else if (!strcmp(child->name, \"typedef\")) {\n substmt_group = 4;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, trg->tpdf_size, \"typedefs\",\n submodule ? \"submodule\" : \"module\", error);\n c_tpdf++;\n\n substmt_prev = \"typedef\";\n } else if (!strcmp(child->name, \"identity\")) {\n substmt_group = 4;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ident, trg->ident_size, \"identities\",\n submodule ? \"submodule\" : \"module\", error);\n c_ident++;\n\n substmt_prev = \"identity\";\n } else if (!strcmp(child->name, \"include\")) {\n if (substmt_group > 1) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n substmt_group = 1;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_inc, trg->inc_size, \"includes\",\n submodule ? \"submodule\" : \"module\", error);\n c_inc++;\n\n substmt_prev = \"include\";\n } else if (!strcmp(child->name, \"augment\")) {\n substmt_group = 4;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_aug, trg->augment_size, \"augments\",\n submodule ? \"submodule\" : \"module\", error);\n c_aug++;\n /* keep augments separated, processed last */\n lyxml_unlink_elem(ctx, child, 2);\n lyxml_add_child(ctx, &augs, child);\n\n substmt_prev = \"augment\";\n } else if (!strcmp(child->name, \"feature\")) {\n substmt_group = 4;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, trg->features_size, \"features\",\n submodule ? \"submodule\" : \"module\", error);\n c_ftrs++;\n\n substmt_prev = \"feature\";\n\n /* data statements */\n } else if (!strcmp(child->name, \"container\") ||\n !strcmp(child->name, \"leaf-list\") ||\n !strcmp(child->name, \"leaf\") ||\n !strcmp(child->name, \"list\") ||\n !strcmp(child->name, \"choice\") ||\n !strcmp(child->name, \"uses\") ||\n !strcmp(child->name, \"anyxml\") ||\n !strcmp(child->name, \"anydata\") ||\n !strcmp(child->name, \"rpc\") ||\n !strcmp(child->name, \"notification\")) {\n substmt_group = 4;\n\n lyxml_unlink_elem(ctx, child, 2);\n lyxml_add_child(ctx, &root, child);\n\n substmt_prev = \"data definition\";\n } else if (!strcmp(child->name, \"grouping\")) {\n substmt_group = 4;\n\n /* keep groupings separated and process them before other data statements */\n lyxml_unlink_elem(ctx, child, 2);\n lyxml_add_child(ctx, &grps, child);\n\n substmt_prev = \"grouping\";\n /* optional statements */\n } else if (!strcmp(child->name, \"description\")) {\n if (substmt_group > 2) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n substmt_group = 2;\n\n if (trg->dsc) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_DESCRIPTION, 0, unres)) {\n goto error;\n }\n trg->dsc = read_yin_subnode(ctx, child, \"text\");\n lyxml_free(ctx, child);\n if (!trg->dsc) {\n goto error;\n }\n\n substmt_prev = \"description\";\n } else if (!strcmp(child->name, \"reference\")) {\n if (substmt_group > 2) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n substmt_group = 2;\n\n if (trg->ref) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_REFERENCE, 0, unres)) {\n goto error;\n }\n trg->ref = read_yin_subnode(ctx, child, \"text\");\n lyxml_free(ctx, child);\n if (!trg->ref) {\n goto error;\n }\n\n substmt_prev = \"reference\";\n } else if (!strcmp(child->name, \"organization\")) {\n if (substmt_group > 2) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n substmt_group = 2;\n\n if (trg->org) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_ORGANIZATION, 0, unres)) {\n goto error;\n }\n trg->org = read_yin_subnode(ctx, child, \"text\");\n lyxml_free(ctx, child);\n if (!trg->org) {\n goto error;\n }\n\n substmt_prev = \"organization\";\n } else if (!strcmp(child->name, \"contact\")) {\n if (substmt_group > 2) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n substmt_group = 2;\n\n if (trg->contact) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_CONTACT, 0, unres)) {\n goto error;\n }\n trg->contact = read_yin_subnode(ctx, child, \"text\");\n lyxml_free(ctx, child);\n if (!trg->contact) {\n goto error;\n }\n\n substmt_prev = \"contact\";\n } else if (!strcmp(child->name, \"yang-version\")) {\n if (substmt_group > 0) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_NONE, NULL, \"Statement \\\"%s\\\" cannot appear after \\\"%s\\\" statement.\",\n child->name, substmt_prev);\n goto error;\n }\n\n if (version_flag) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, child, \"value\");\n if (strcmp(value, \"1\") && strcmp(value, \"1.1\")) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_NONE, NULL, value, \"yang-version\");\n goto error;\n }\n version_flag = 1;\n if (!strcmp(value, \"1\")) {\n if (submodule) {\n if (module->version > 1) {\n LOGVAL(ctx, LYE_INVER, LY_VLOG_NONE, NULL);\n goto error;\n }\n submodule->version = 1;\n } else {\n module->version = 1;\n }\n } else {\n if (submodule) {\n if (module->version < 2) {\n LOGVAL(ctx, LYE_INVER, LY_VLOG_NONE, NULL);\n goto error;\n }\n submodule->version = 2;\n } else {\n module->version = 2;\n }\n }\n\n if (lyp_yin_parse_subnode_ext(trg, trg, LYEXT_PAR_MODULE, child, LYEXT_SUBSTMT_VERSION, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, child);\n\n substmt_prev = \"yang-version\";\n } else if (!strcmp(child->name, \"extension\")) {\n substmt_group = 4;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, trg->extensions_size, \"extensions\",\n submodule ? \"submodule\" : \"module\", error);\n c_ext++;\n\n substmt_prev = \"extension\";\n } else if (!strcmp(child->name, \"deviation\")) {\n substmt_group = 4;\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_dev, trg->deviation_size, \"deviations\",\n submodule ? \"submodule\" : \"module\", error);\n c_dev++;\n\n substmt_prev = \"deviation\";\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n goto error;\n }\n }\n\n /* check for mandatory statements */\n if (submodule) {\n if (!submodule->prefix) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, \"belongs-to\", \"submodule\");\n goto error;\n }\n if (!version_flag) {\n /* check version compatibility with the main module */\n if (module->version > 1) {\n LOGVAL(ctx, LYE_INVER, LY_VLOG_NONE, NULL);\n goto error;\n }\n }\n } else {\n if (!trg->ns) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, \"namespace\", \"module\");\n goto error;\n }\n if (!trg->prefix) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, \"prefix\", \"module\");\n goto error;\n }\n }\n\n /* allocate arrays for elements with cardinality of 0..n */\n if (c_imp) {\n trg->imp = calloc(c_imp, sizeof *trg->imp);\n LY_CHECK_ERR_GOTO(!trg->imp, LOGMEM(ctx), error);\n }\n if (c_rev) {\n trg->rev = calloc(c_rev, sizeof *trg->rev);\n LY_CHECK_ERR_GOTO(!trg->rev, LOGMEM(ctx), error);\n }\n if (c_tpdf) {\n trg->tpdf = calloc(c_tpdf, sizeof *trg->tpdf);\n LY_CHECK_ERR_GOTO(!trg->tpdf, LOGMEM(ctx), error);\n }\n if (c_ident) {\n trg->ident = calloc(c_ident, sizeof *trg->ident);\n LY_CHECK_ERR_GOTO(!trg->ident, LOGMEM(ctx), error);\n }\n if (c_inc) {\n trg->inc = calloc(c_inc, sizeof *trg->inc);\n LY_CHECK_ERR_GOTO(!trg->inc, LOGMEM(ctx), error);\n }\n if (c_aug) {\n trg->augment = calloc(c_aug, sizeof *trg->augment);\n LY_CHECK_ERR_GOTO(!trg->augment, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n trg->features = calloc(c_ftrs, sizeof *trg->features);\n LY_CHECK_ERR_GOTO(!trg->features, LOGMEM(ctx), error);\n }\n if (c_dev) {\n trg->deviation = calloc(c_dev, sizeof *trg->deviation);\n LY_CHECK_ERR_GOTO(!trg->deviation, LOGMEM(ctx), error);\n }\n if (c_ext) {\n trg->extensions = calloc(c_ext, sizeof *trg->extensions);\n LY_CHECK_ERR_GOTO(!trg->extensions, LOGMEM(ctx), error);\n }\n\n /* middle part 1 - process revision and then check whether this (sub)module was not already parsed, add it there */\n LY_TREE_FOR_SAFE(revs.child, next, child) {\n r = fill_yin_revision(trg, child, &trg->rev[trg->rev_size], unres);\n trg->rev_size++;\n if (r) {\n goto error;\n }\n\n /* check uniqueness of the revision date - not required by RFC */\n for (i = 0; i < (trg->rev_size - 1); i++) {\n if (!strcmp(trg->rev[i].date, trg->rev[trg->rev_size - 1].date)) {\n LOGWRN(ctx, \"Module's revisions are not unique (%s).\", trg->rev[trg->rev_size - 1].date);\n break;\n }\n }\n\n lyxml_free(ctx, child);\n }\n\n /* check the module with respect to the context now */\n if (!submodule) {\n switch (lyp_ctx_check_module(module)) {\n case -1:\n goto error;\n case 0:\n break;\n case 1:\n /* it's already there */\n ret = 1;\n goto error;\n }\n }\n\n /* check first definition of extensions */\n if (c_ext) {\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (!strcmp(child->name, \"extension\")) {\n r = fill_yin_extension(trg, child, &trg->extensions[trg->extensions_size], unres);\n trg->extensions_size++;\n if (r) {\n goto error;\n }\n\n }\n }\n }\n\n /* middle part 2 - process nodes with cardinality of 0..n except the data nodes and augments */\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (!strcmp(child->name, \"import\")) {\n r = fill_yin_import(trg, child, &trg->imp[trg->imp_size], unres);\n trg->imp_size++;\n if (r) {\n goto error;\n }\n\n } else if (!strcmp(child->name, \"include\")) {\n r = fill_yin_include(module, submodule, child, &trg->inc[trg->inc_size], unres);\n trg->inc_size++;\n if (r) {\n goto error;\n }\n\n } else if (!strcmp(child->name, \"typedef\")) {\n r = fill_yin_typedef(trg, NULL, child, &trg->tpdf[trg->tpdf_size], unres);\n trg->tpdf_size++;\n if (r) {\n goto error;\n }\n\n } else if (!strcmp(child->name, \"identity\")) {\n r = fill_yin_identity(trg, child, &trg->ident[trg->ident_size], unres);\n trg->ident_size++;\n if (r) {\n goto error;\n }\n\n } else if (!strcmp(child->name, \"feature\")) {\n r = fill_yin_feature(trg, child, &trg->features[trg->features_size], unres);\n trg->features_size++;\n if (r) {\n goto error;\n }\n\n } else if (!strcmp(child->name, \"deviation\")) {\n /* must be implemented in this case */\n trg->implemented = 1;\n\n r = fill_yin_deviation(trg, child, &trg->deviation[trg->deviation_size], unres);\n trg->deviation_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n /* process extension instances */\n if (c_extinst) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(trg->ext, (c_extinst + trg->ext_size) * sizeof *trg->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n trg->ext = reallocated;\n\n /* init memory */\n memset(&trg->ext[trg->ext_size], 0, c_extinst * sizeof *trg->ext);\n\n LY_TREE_FOR_SAFE(exts.child, next, child) {\n r = lyp_yin_fill_ext(trg, LYEXT_PAR_MODULE, 0, 0, trg, child, &trg->ext, &trg->ext_size, unres);\n if (r) {\n goto error;\n }\n }\n\n lyp_reduce_ext_list(&trg->ext, trg->ext_size, c_ext + trg->ext_size);\n }\n\n /* process data nodes. Start with groupings to allow uses\n * refer to them. Submodule's data nodes are stored in the\n * main module data tree.\n */\n LY_TREE_FOR_SAFE(grps.child, next, child) {\n node = read_yin_grouping(trg, NULL, child, 0, unres);\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, child);\n }\n\n /* parse data nodes, ... */\n LY_TREE_FOR_SAFE(root.child, next, child) {\n\n if (!strcmp(child->name, \"container\")) {\n node = read_yin_container(trg, NULL, child, 0, unres);\n } else if (!strcmp(child->name, \"leaf-list\")) {\n node = read_yin_leaflist(trg, NULL, child, 0, unres);\n } else if (!strcmp(child->name, \"leaf\")) {\n node = read_yin_leaf(trg, NULL, child, 0, unres);\n } else if (!strcmp(child->name, \"list\")) {\n node = read_yin_list(trg, NULL, child, 0, unres);\n } else if (!strcmp(child->name, \"choice\")) {\n node = read_yin_choice(trg, NULL, child, 0, unres);\n } else if (!strcmp(child->name, \"uses\")) {\n node = read_yin_uses(trg, NULL, child, 0, unres);\n } else if (!strcmp(child->name, \"anyxml\")) {\n node = read_yin_anydata(trg, NULL, child, LYS_ANYXML, 0, unres);\n } else if (!strcmp(child->name, \"anydata\")) {\n node = read_yin_anydata(trg, NULL, child, LYS_ANYDATA, 0, unres);\n } else if (!strcmp(child->name, \"rpc\")) {\n node = read_yin_rpc_action(trg, NULL, child, 0, unres);\n } else if (!strcmp(child->name, \"notification\")) {\n node = read_yin_notif(trg, NULL, child, 0, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, child);\n }\n\n /* ... and finally augments (last, so we can augment our data, for instance) */\n LY_TREE_FOR_SAFE(augs.child, next, child) {\n r = fill_yin_augment(trg, NULL, child, &trg->augment[trg->augment_size], 0, unres);\n trg->augment_size++;\n\n if (r) {\n goto error;\n }\n lyxml_free(ctx, child);\n }\n\n return 0;\n\nerror:\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n while (grps.child) {\n lyxml_free(ctx, grps.child);\n }\n while (augs.child) {\n lyxml_free(ctx, augs.child);\n }\n while (revs.child) {\n lyxml_free(ctx, revs.child);\n }\n while (exts.child) {\n lyxml_free(ctx, exts.child);\n }\n\n return ret;\n}",
  12541. "project": "libyang",
  12542. "hash": 23864015992641617212461037399150147821,
  12543. "size": 662,
  12544. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12545. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12546. "target": 0,
  12547. "dataset": "other",
  12548. "idx": 336766
  12549. },
  12550. {
  12551. "func": "fill_yin_typedef(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, struct lys_tpdf *tpdf,\n struct unres_schema *unres)\n{\n const char *value;\n struct lyxml_elem *node, *next;\n struct ly_ctx *ctx = module->ctx;\n int rc, has_type = 0, c_ext = 0, i;\n void *reallocated;\n\n GETVAL(ctx, value, yin, \"name\");\n if (lyp_check_identifier(ctx, value, LY_IDENT_TYPE, module, parent)) {\n goto error;\n }\n tpdf->name = lydict_insert(ctx, value, strlen(value));\n\n /* generic part - status, description, reference */\n if (read_yin_common(module, NULL, tpdf, LYEXT_PAR_TPDF, yin, OPT_MODULE, unres)) {\n goto error;\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, node) {\n if (strcmp(node->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, tpdf->ext_size, \"extensions\", \"typedef\", error);\n c_ext++;\n continue;\n } else if (!strcmp(node->name, \"type\")) {\n if (has_type) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, node->name, yin->name);\n goto error;\n }\n /* HACK for unres */\n tpdf->type.der = (struct lys_tpdf *)node;\n tpdf->type.parent = tpdf;\n if (unres_schema_add_node(module, unres, &tpdf->type, UNRES_TYPE_DER_TPDF, parent) == -1) {\n goto error;\n }\n has_type = 1;\n\n /* skip lyxml_free() at the end of the loop, node was freed or at least unlinked in unres processing */\n continue;\n } else if (!strcmp(node->name, \"default\")) {\n if (tpdf->dflt) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, node->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, node, \"value\");\n tpdf->dflt = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, tpdf, LYEXT_PAR_TPDF, node, LYEXT_SUBSTMT_DEFAULT, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(node->name, \"units\")) {\n if (tpdf->units) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, node->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, node, \"name\");\n tpdf->units = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, tpdf, LYEXT_PAR_TPDF, node, LYEXT_SUBSTMT_UNITS, 0, unres)) {\n goto error;\n }\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, value);\n goto error;\n }\n\n lyxml_free(ctx, node);\n }\n\n /* check mandatory value */\n if (!has_type) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, \"type\", yin->name);\n goto error;\n }\n\n /* check default value (if not defined, there still could be some restrictions\n * that need to be checked against a default value from a derived type) */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) &&\n unres_schema_add_node(module, unres, &tpdf->type, UNRES_TYPEDEF_DFLT, (struct lys_node *)(&tpdf->dflt)) == -1) {\n goto error;\n }\n\n /* finish extensions parsing */\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(tpdf->ext, (c_ext + tpdf->ext_size) * sizeof *tpdf->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n tpdf->ext = reallocated;\n\n /* init memory */\n memset(&tpdf->ext[tpdf->ext_size], 0, c_ext * sizeof *tpdf->ext);\n\n LY_TREE_FOR_SAFE(yin->child, next, node) {\n rc = lyp_yin_fill_ext(tpdf, LYEXT_PAR_TYPE, 0, 0, module, node, &tpdf->ext, &tpdf->ext_size, unres);\n if (rc) {\n goto error;\n }\n }\n\n lyp_reduce_ext_list(&tpdf->ext, tpdf->ext_size, c_ext + tpdf->ext_size);\n }\n\n for (i = 0; i < tpdf->ext_size; ++i) {\n /* set flag, which represent LYEXT_OPT_VALID */\n if (tpdf->ext[i]->flags & LYEXT_OPT_VALID) {\n tpdf->flags |= LYS_VALID_EXT;\n break;\n }\n }\n\n return EXIT_SUCCESS;\n\nerror:\n return EXIT_FAILURE;\n}",
  12552. "project": "libyang",
  12553. "hash": 29979432700281147848223132432589735934,
  12554. "size": 117,
  12555. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12556. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12557. "target": 0,
  12558. "dataset": "other",
  12559. "idx": 336770
  12560. },
  12561. {
  12562. "func": "fill_yin_import(struct lys_module *module, struct lyxml_elem *yin, struct lys_import *imp, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *child, *next, exts;\n const char *value;\n int r, c_ext = 0;\n void *reallocated;\n\n /* init */\n memset(&exts, 0, sizeof exts);\n\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (!child->ns) {\n /* garbage */\n continue;\n } else if (strcmp(child->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, imp->ext_size, \"extensions\", \"import\", error);\n c_ext++;\n lyxml_unlink_elem(ctx, child, 2);\n lyxml_add_child(ctx, &exts, child);\n } else if (!strcmp(child->name, \"prefix\")) {\n GETVAL(ctx, value, child, \"value\");\n if (lyp_check_identifier(ctx, value, LY_IDENT_PREFIX, module, NULL)) {\n goto error;\n }\n imp->prefix = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, imp, LYEXT_PAR_IMPORT, child, LYEXT_SUBSTMT_PREFIX, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(child->name, \"revision-date\")) {\n if (imp->rev[0]) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, child, \"date\");\n if (lyp_check_date(ctx, value)) {\n goto error;\n }\n memcpy(imp->rev, value, LY_REV_SIZE - 1);\n\n if (lyp_yin_parse_subnode_ext(module, imp, LYEXT_PAR_IMPORT, child, LYEXT_SUBSTMT_REVISIONDATE, 0, unres)) {\n goto error;\n }\n } else if ((module->version >= 2) && !strcmp(child->name, \"description\")) {\n if (imp->dsc) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(module, imp, LYEXT_PAR_IMPORT, child, LYEXT_SUBSTMT_DESCRIPTION, 0, unres)) {\n goto error;\n }\n imp->dsc = read_yin_subnode(ctx, child, \"text\");\n if (!imp->dsc) {\n goto error;\n }\n } else if ((module->version >= 2) && !strcmp(child->name, \"reference\")) {\n if (imp->ref) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(module, imp, LYEXT_PAR_IMPORT, child, LYEXT_SUBSTMT_REFERENCE, 0, unres)) {\n goto error;\n }\n imp->ref = read_yin_subnode(ctx, child, \"text\");\n if (!imp->ref) {\n goto error;\n }\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n goto error;\n }\n }\n\n /* check mandatory information */\n if (!imp->prefix) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_NONE, NULL, \"prefix\", yin->name);\n goto error;\n }\n\n /* process extensions */\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(imp->ext, (c_ext + imp->ext_size) * sizeof *imp->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n imp->ext = reallocated;\n\n /* init memory */\n memset(&imp->ext[imp->ext_size], 0, c_ext * sizeof *imp->ext);\n\n LY_TREE_FOR_SAFE(exts.child, next, child) {\n /* extension */\n r = lyp_yin_fill_ext(imp, LYEXT_PAR_IMPORT, 0, 0, module, child, &imp->ext, &imp->ext_size, unres);\n if (r) {\n goto error;\n }\n }\n\n lyp_reduce_ext_list(&imp->ext, imp->ext_size, c_ext + imp->ext_size);\n }\n\n GETVAL(ctx, value, yin, \"module\");\n return lyp_check_import(module, value, imp);\n\nerror:\n while (exts.child) {\n lyxml_free(ctx, exts.child);\n }\n return EXIT_FAILURE;\n}",
  12563. "project": "libyang",
  12564. "hash": 264509654321598332653299108821426852308,
  12565. "size": 111,
  12566. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12567. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12568. "target": 0,
  12569. "dataset": "other",
  12570. "idx": 336771
  12571. },
  12572. {
  12573. "func": "read_yin_uses(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin,\n int options, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next;\n struct lys_node *retval;\n struct lys_node_uses *uses;\n const char *value;\n int c_ref = 0, c_aug = 0, c_ftrs = 0, c_ext = 0;\n int r;\n void *reallocated;\n\n uses = calloc(1, sizeof *uses);\n LY_CHECK_ERR_RETURN(!uses, LOGMEM(ctx), NULL);\n\n uses->nodetype = LYS_USES;\n uses->prev = (struct lys_node *)uses;\n retval = (struct lys_node *)uses;\n\n GETVAL(ctx, value, yin, \"name\");\n uses->name = lydict_insert(ctx, value, 0);\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin, OPT_MODULE, unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* get other properties of uses */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"uses\", error);\n c_ext++;\n continue;\n } else if (!strcmp(sub->name, \"refine\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ref, uses->refine_size, \"refines\", \"uses\", error);\n c_ref++;\n } else if (!strcmp(sub->name, \"augment\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_aug, uses->augment_size, \"augments\", \"uses\", error);\n c_aug++;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"uses\", error);\n c_ftrs++;\n } else if (!strcmp(sub->name, \"when\")) {\n if (uses->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n uses->when = read_yin_when(module, sub, unres);\n if (!uses->when) {\n lyxml_free(ctx, sub);\n goto error;\n }\n lyxml_free(ctx, sub);\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* process properties with cardinality 0..n */\n if (c_ref) {\n uses->refine = calloc(c_ref, sizeof *uses->refine);\n LY_CHECK_ERR_GOTO(!uses->refine, LOGMEM(ctx), error);\n }\n if (c_aug) {\n uses->augment = calloc(c_aug, sizeof *uses->augment);\n LY_CHECK_ERR_GOTO(!uses->augment, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n uses->iffeature = calloc(c_ftrs, sizeof *uses->iffeature);\n LY_CHECK_ERR_GOTO(!uses->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"refine\")) {\n r = fill_yin_refine(retval, sub, &uses->refine[uses->refine_size], unres);\n uses->refine_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"augment\")) {\n r = fill_yin_augment(module, retval, sub, &uses->augment[uses->augment_size], options, unres);\n uses->augment_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &uses->iffeature[uses->iffeature_size], unres);\n uses->iffeature_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n if (unres_schema_add_node(module, unres, uses, UNRES_USES, NULL) == -1) {\n goto error;\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && uses->when) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n return NULL;\n}",
  12574. "project": "libyang",
  12575. "hash": 285004860863246809372138985468028712083,
  12576. "size": 143,
  12577. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12578. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12579. "target": 0,
  12580. "dataset": "other",
  12581. "idx": 336772
  12582. },
  12583. {
  12584. "func": "read_yin_leaflist(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lys_node *retval;\n struct lys_node_leaflist *llist;\n struct lyxml_elem *sub, *next;\n const char *value;\n char *endptr;\n unsigned long val;\n int r, has_type = 0;\n int c_must = 0, c_ftrs = 0, c_dflt = 0, c_ext = 0;\n int f_ordr = 0, f_min = 0, f_max = 0;\n void *reallocated;\n\n llist = calloc(1, sizeof *llist);\n LY_CHECK_ERR_RETURN(!llist, LOGMEM(ctx), NULL);\n\n llist->nodetype = LYS_LEAFLIST;\n llist->prev = (struct lys_node *)llist;\n retval = (struct lys_node *)llist;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :\n (options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT),\n unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"leaf-list\", error);\n c_ext++;\n continue;\n } else if (!strcmp(sub->name, \"type\")) {\n if (has_type) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n /* HACK for unres */\n llist->type.der = (struct lys_tpdf *)sub;\n llist->type.parent = (struct lys_tpdf *)llist;\n /* postpone type resolution when if-feature parsing is done since we need\n * if-feature for check_leafref_features() */\n has_type = 1;\n } else if (!strcmp(sub->name, \"units\")) {\n if (llist->units) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, sub, \"name\");\n llist->units = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_UNITS, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"ordered-by\")) {\n if (f_ordr) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n /* just checking the flags in llist is not sufficient, we would\n * allow multiple ordered-by statements with the \"system\" value\n */\n f_ordr = 1;\n\n if (llist->flags & LYS_CONFIG_R) {\n /* RFC 6020, 7.7.5 - ignore ordering when the list represents\n * state data\n */\n lyxml_free(ctx, sub);\n continue;\n }\n\n GETVAL(ctx, value, sub, \"value\");\n if (!strcmp(value, \"user\")) {\n llist->flags |= LYS_USERORDERED;\n } else if (strcmp(value, \"system\")) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n } /* else system is the default value, so we can ignore it */\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_ORDEREDBY, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, llist->must_size, \"musts\", \"leaf-list\", error);\n c_must++;\n continue;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"leaf-list\", error);\n c_ftrs++;\n continue;\n } else if ((module->version >= 2) && !strcmp(sub->name, \"default\")) {\n /* read the default's extension instances */\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_DEFAULT, c_dflt, unres)) {\n goto error;\n }\n\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_dflt, llist->dflt_size, \"defaults\", \"leaf-list\", error);\n c_dflt++;\n continue;\n\n } else if (!strcmp(sub->name, \"min-elements\")) {\n if (f_min) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n f_min = 1;\n\n GETVAL(ctx, value, sub, \"value\");\n while (isspace(value[0])) {\n value++;\n }\n\n /* convert it to uint32_t */\n errno = 0;\n endptr = NULL;\n val = strtoul(value, &endptr, 10);\n if (*endptr || value[0] == '-' || errno || val > UINT32_MAX) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n }\n llist->min = (uint32_t) val;\n if (llist->max && (llist->min > llist->max)) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, \"\\\"min-elements\\\" is bigger than \\\"max-elements\\\".\");\n goto error;\n }\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MIN, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"max-elements\")) {\n if (f_max) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n f_max = 1;\n\n GETVAL(ctx, value, sub, \"value\");\n while (isspace(value[0])) {\n value++;\n }\n\n if (!strcmp(value, \"unbounded\")) {\n llist->max = 0;\n } else {\n /* convert it to uint32_t */\n errno = 0;\n endptr = NULL;\n val = strtoul(value, &endptr, 10);\n if (*endptr || value[0] == '-' || errno || val == 0 || val > UINT32_MAX) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n }\n llist->max = (uint32_t) val;\n if (llist->min > llist->max) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, \"\\\"max-elements\\\" is smaller than \\\"min-elements\\\".\");\n goto error;\n }\n }\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MAX, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"when\")) {\n if (llist->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n llist->when = read_yin_when(module, sub, unres);\n if (!llist->when) {\n goto error;\n }\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n\n /* do not free sub, it could have been unlinked and stored in unres */\n }\n\n /* check constraints */\n if (!has_type) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, retval, \"type\", yin->name);\n goto error;\n }\n\n /* middle part - process nodes with cardinality of 0..n */\n if (c_must) {\n llist->must = calloc(c_must, sizeof *llist->must);\n LY_CHECK_ERR_GOTO(!llist->must, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n llist->iffeature = calloc(c_ftrs, sizeof *llist->iffeature);\n LY_CHECK_ERR_GOTO(!llist->iffeature, LOGMEM(ctx), error);\n }\n if (c_dflt) {\n llist->dflt = calloc(c_dflt, sizeof *llist->dflt);\n LY_CHECK_ERR_GOTO(!llist->dflt, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &llist->must[llist->must_size], unres);\n llist->must_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &llist->iffeature[llist->iffeature_size], unres);\n llist->iffeature_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"default\")) {\n GETVAL(ctx, value, sub, \"value\");\n\n /* check for duplicity in case of configuration data,\n * in case of status data duplicities are allowed */\n if (llist->flags & LYS_CONFIG_W) {\n for (r = 0; r < llist->dflt_size; r++) {\n if (ly_strequal(llist->dflt[r], value, 1)) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, \"default\");\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, \"Duplicated default value \\\"%s\\\".\", value);\n goto error;\n }\n }\n }\n llist->dflt[llist->dflt_size++] = lydict_insert(ctx, value, strlen(value));\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* finalize type parsing */\n if (unres_schema_add_node(module, unres, &llist->type, UNRES_TYPE_DER, retval) == -1) {\n llist->type.der = NULL;\n goto error;\n }\n\n if (llist->dflt_size && llist->min) {\n LOGVAL(ctx, LYE_INCHILDSTMT, LY_VLOG_LYS, retval, \"min-elements\", \"leaf-list\");\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL,\n \"The \\\"min-elements\\\" statement with non-zero value is forbidden on leaf-lists with the \\\"default\\\" statement.\");\n goto error;\n }\n\n /* check default value (if not defined, there still could be some restrictions\n * that need to be checked against a default value from a derived type) */\n for (r = 0; r < llist->dflt_size; r++) {\n if (!(ctx->models.flags & LY_CTX_TRUSTED) &&\n (unres_schema_add_node(module, unres, &llist->type, UNRES_TYPE_DFLT,\n (struct lys_node *)(&llist->dflt[r])) == -1)) {\n goto error;\n }\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && (llist->when || llist->must)) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n for (r = 0; r < retval->ext_size; ++r) {\n /* set flag, which represent LYEXT_OPT_VALID */\n if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {\n retval->flags |= LYS_VALID_EXT;\n break;\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n return NULL;\n}",
  12585. "project": "libyang",
  12586. "hash": 47871158716956981093659887429750913688,
  12587. "size": 311,
  12588. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12589. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12590. "target": 0,
  12591. "dataset": "other",
  12592. "idx": 336774
  12593. },
  12594. {
  12595. "func": "read_yin_list(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lys_node *retval, *node;\n struct lys_node_list *list;\n struct lyxml_elem *sub, *next, root, uniq;\n int r;\n int c_tpdf = 0, c_must = 0, c_uniq = 0, c_ftrs = 0, c_ext = 0;\n int f_ordr = 0, f_max = 0, f_min = 0;\n const char *value;\n char *auxs;\n unsigned long val;\n void *reallocated;\n\n /* init */\n memset(&root, 0, sizeof root);\n memset(&uniq, 0, sizeof uniq);\n\n list = calloc(1, sizeof *list);\n LY_CHECK_ERR_RETURN(!list, LOGMEM(ctx), NULL);\n\n list->nodetype = LYS_LIST;\n list->prev = (struct lys_node *)list;\n retval = (struct lys_node *)list;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :\n (options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT),\n unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* process list's specific children */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"list\", error);\n c_ext++;\n continue;\n\n /* data statements */\n } else if (!strcmp(sub->name, \"container\") ||\n !strcmp(sub->name, \"leaf-list\") ||\n !strcmp(sub->name, \"leaf\") ||\n !strcmp(sub->name, \"list\") ||\n !strcmp(sub->name, \"choice\") ||\n !strcmp(sub->name, \"uses\") ||\n !strcmp(sub->name, \"grouping\") ||\n !strcmp(sub->name, \"anyxml\") ||\n !strcmp(sub->name, \"anydata\") ||\n !strcmp(sub->name, \"action\") ||\n !strcmp(sub->name, \"notification\")) {\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* array counters */\n } else if (!strcmp(sub->name, \"key\")) {\n /* check cardinality 0..1 */\n if (list->keys_size) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, list->name);\n goto error;\n }\n\n /* count the number of keys */\n GETVAL(ctx, value, sub, \"value\");\n list->keys_str = lydict_insert(ctx, value, 0);\n while ((value = strpbrk(value, \" \\t\\n\"))) {\n list->keys_size++;\n while (isspace(*value)) {\n value++;\n }\n }\n list->keys_size++;\n list->keys = calloc(list->keys_size, sizeof *list->keys);\n LY_CHECK_ERR_GOTO(!list->keys, LOGMEM(ctx), error);\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_KEY, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"unique\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_uniq, list->unique_size, \"uniques\", \"list\", error);\n c_uniq++;\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &uniq, sub);\n } else if (!strcmp(sub->name, \"typedef\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, list->tpdf_size, \"typedefs\", \"list\", error);\n c_tpdf++;\n } else if (!strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, list->must_size, \"musts\", \"list\", error);\n c_must++;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"list\", error);\n c_ftrs++;\n\n /* optional stetments */\n } else if (!strcmp(sub->name, \"ordered-by\")) {\n if (f_ordr) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n /* just checking the flags in llist is not sufficient, we would\n * allow multiple ordered-by statements with the \"system\" value\n */\n f_ordr = 1;\n\n if (list->flags & LYS_CONFIG_R) {\n /* RFC 6020, 7.7.5 - ignore ordering when the list represents\n * state data\n */\n lyxml_free(ctx, sub);\n continue;\n }\n\n GETVAL(ctx, value, sub, \"value\");\n if (!strcmp(value, \"user\")) {\n list->flags |= LYS_USERORDERED;\n } else if (strcmp(value, \"system\")) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n } /* else system is the default value, so we can ignore it */\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_ORDEREDBY, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"min-elements\")) {\n if (f_min) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n f_min = 1;\n\n GETVAL(ctx, value, sub, \"value\");\n while (isspace(value[0])) {\n value++;\n }\n\n /* convert it to uint32_t */\n errno = 0;\n auxs = NULL;\n val = strtoul(value, &auxs, 10);\n if (*auxs || value[0] == '-' || errno || val > UINT32_MAX) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n }\n list->min = (uint32_t) val;\n if (list->max && (list->min > list->max)) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, \"\\\"min-elements\\\" is bigger than \\\"max-elements\\\".\");\n lyxml_free(ctx, sub);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MIN, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"max-elements\")) {\n if (f_max) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n f_max = 1;\n\n GETVAL(ctx, value, sub, \"value\");\n while (isspace(value[0])) {\n value++;\n }\n\n if (!strcmp(value, \"unbounded\")) {\n list->max = 0;;\n } else {\n /* convert it to uint32_t */\n errno = 0;\n auxs = NULL;\n val = strtoul(value, &auxs, 10);\n if (*auxs || value[0] == '-' || errno || val == 0 || val > UINT32_MAX) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n }\n list->max = (uint32_t) val;\n if (list->min > list->max) {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, \"\\\"max-elements\\\" is smaller than \\\"min-elements\\\".\");\n goto error;\n }\n }\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MAX, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"when\")) {\n if (list->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n list->when = read_yin_when(module, sub, unres);\n if (!list->when) {\n lyxml_free(ctx, sub);\n goto error;\n }\n lyxml_free(ctx, sub);\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* check - if list is configuration, key statement is mandatory\n * (but only if we are not in a grouping or augment, then the check is deferred) */\n for (node = retval; node && !(node->nodetype & (LYS_GROUPING | LYS_AUGMENT | LYS_EXT)); node = node->parent);\n if (!node && (list->flags & LYS_CONFIG_W) && !list->keys_str) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, retval, \"key\", \"list\");\n goto error;\n }\n\n /* middle part - process nodes with cardinality of 0..n except the data nodes */\n if (c_tpdf) {\n list->tpdf = calloc(c_tpdf, sizeof *list->tpdf);\n LY_CHECK_ERR_GOTO(!list->tpdf, LOGMEM(ctx), error);\n }\n if (c_must) {\n list->must = calloc(c_must, sizeof *list->must);\n LY_CHECK_ERR_GOTO(!list->must, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n list->iffeature = calloc(c_ftrs, sizeof *list->iffeature);\n LY_CHECK_ERR_GOTO(!list->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"typedef\")) {\n r = fill_yin_typedef(module, retval, sub, &list->tpdf[list->tpdf_size], unres);\n list->tpdf_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &list->iffeature[list->iffeature_size], unres);\n list->iffeature_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &list->must[list->must_size], unres);\n list->must_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"container\")) {\n node = read_yin_container(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n node = read_yin_leaflist(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf\")) {\n node = read_yin_leaf(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"list\")) {\n node = read_yin_list(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"choice\")) {\n node = read_yin_choice(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"uses\")) {\n node = read_yin_uses(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"grouping\")) {\n node = read_yin_grouping(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"anyxml\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);\n } else if (!strcmp(sub->name, \"anydata\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);\n } else if (!strcmp(sub->name, \"action\")) {\n node = read_yin_rpc_action(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"notification\")) {\n node = read_yin_notif(module, retval, sub, options, unres);\n } else {\n LOGINT(ctx);\n goto error;\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n if (list->keys_str) {\n if (unres_schema_add_node(module, unres, list, UNRES_LIST_KEYS, NULL) == -1) {\n goto error;\n }\n } /* else config false list without a key, key_str presence in case of config true is checked earlier */\n\n /* process unique statements */\n if (c_uniq) {\n list->unique = calloc(c_uniq, sizeof *list->unique);\n LY_CHECK_ERR_GOTO(!list->unique, LOGMEM(ctx), error);\n\n LY_TREE_FOR_SAFE(uniq.child, next, sub) {\n r = fill_yin_unique(module, retval, sub, &list->unique[list->unique_size], unres);\n list->unique_size++;\n if (r) {\n goto error;\n }\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub,\n LYEXT_SUBSTMT_UNIQUE, list->unique_size - 1, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n }\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && (list->when || list->must)) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n for (r = 0; r < retval->ext_size; ++r) {\n /* set flag, which represent LYEXT_OPT_VALID */\n if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {\n retval->flags |= LYS_VALID_EXT;\n if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {\n retval->flags |= LYS_VALID_EXT_SUBTREE;\n break;\n }\n }\n }\n\n return retval;\n\nerror:\n\n lys_node_free(ctx, retval, NULL, 0);\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n while (uniq.child) {\n lyxml_free(ctx, uniq.child);\n }\n\n return NULL;\n}",
  12596. "project": "libyang",
  12597. "hash": 115335602041432819983754005856712723739,
  12598. "size": 377,
  12599. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12600. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12601. "target": 0,
  12602. "dataset": "other",
  12603. "idx": 336776
  12604. },
  12605. {
  12606. "func": "fill_yin_extension(struct lys_module *module, struct lyxml_elem *yin, struct lys_ext *ext, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n const char *value;\n struct lyxml_elem *child, *node, *next, *next2;\n int c_ext = 0, rc;\n void *reallocated;\n\n GETVAL(ctx, value, yin, \"name\");\n\n if (lyp_check_identifier(ctx, value, LY_IDENT_EXTENSION, module, NULL)) {\n goto error;\n }\n ext->name = lydict_insert(ctx, value, strlen(value));\n\n if (read_yin_common(module, NULL, ext, LYEXT_PAR_EXT, yin, OPT_MODULE, unres)) {\n goto error;\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, node) {\n if (strcmp(node->ns->value, LY_NSYIN)) {\n /* possible extension instance */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, ext->ext_size, \"extensions\", \"extension\", error);\n c_ext++;\n } else if (!strcmp(node->name, \"argument\")) {\n /* argument */\n GETVAL(ctx, value, node, \"name\");\n ext->argument = lydict_insert(ctx, value, strlen(value));\n if (lyp_yin_parse_subnode_ext(module, ext, LYEXT_PAR_EXT, node, LYEXT_SUBSTMT_ARGUMENT, 0, unres)) {\n goto error;\n }\n\n /* yin-element */\n LY_TREE_FOR_SAFE(node->child, next2, child) {\n if (child->ns == node->ns && !strcmp(child->name, \"yin-element\")) {\n GETVAL(ctx, value, child, \"value\");\n if (ly_strequal(value, \"true\", 0)) {\n ext->flags |= LYS_YINELEM;\n }\n\n if (lyp_yin_parse_subnode_ext(module, ext, LYEXT_PAR_EXT, child, LYEXT_SUBSTMT_YINELEM, 0, unres)) {\n goto error;\n }\n } else if (child->ns) {\n /* unexpected YANG statement */\n LOGVAL(ctx, LYE_INCHILDSTMT, LY_VLOG_NONE, NULL, child->name, child->name);\n goto error;\n } /* else garbage, but save resource needed for unlinking */\n }\n\n lyxml_free(ctx, node);\n } else {\n /* unexpected YANG statement */\n LOGVAL(ctx, LYE_INCHILDSTMT, LY_VLOG_NONE, NULL, node->name, node->name);\n goto error;\n }\n }\n\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(ext->ext, (c_ext + ext->ext_size) * sizeof *ext->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n ext->ext = reallocated;\n\n /* init memory */\n memset(&ext->ext[ext->ext_size], 0, c_ext * sizeof *ext->ext);\n\n /* process the extension instances of the extension itself */\n LY_TREE_FOR_SAFE(yin->child, next, node) {\n rc = lyp_yin_fill_ext(ext, LYEXT_PAR_EXT, 0, 0, module, node, &ext->ext, &ext->ext_size, unres);\n if (rc) {\n goto error;\n }\n }\n\n lyp_reduce_ext_list(&ext->ext, ext->ext_size, c_ext + ext->ext_size);\n }\n\n /* search for plugin */\n ext->plugin = ext_get_plugin(ext->name, ext->module->name, ext->module->rev ? ext->module->rev[0].date : NULL);\n\n return EXIT_SUCCESS;\n\nerror:\n return EXIT_FAILURE;\n}",
  12607. "project": "libyang",
  12608. "hash": 286134204984875195300411165637507195251,
  12609. "size": 86,
  12610. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12611. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12612. "target": 0,
  12613. "dataset": "other",
  12614. "idx": 336777
  12615. },
  12616. {
  12617. "func": "read_yin_input_output(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin,\n int options, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next, root;\n struct lys_node *node = NULL;\n struct lys_node *retval = NULL;\n struct lys_node_inout *inout;\n int r;\n int c_tpdf = 0, c_must = 0, c_ext = 0;\n\n /* init */\n memset(&root, 0, sizeof root);\n\n inout = calloc(1, sizeof *inout);\n LY_CHECK_ERR_RETURN(!inout, LOGMEM(ctx), NULL);\n inout->prev = (struct lys_node *)inout;\n\n if (!strcmp(yin->name, \"input\")) {\n inout->nodetype = LYS_INPUT;\n inout->name = lydict_insert(ctx, \"input\", 0);\n } else if (!strcmp(yin->name, \"output\")) {\n inout->nodetype = LYS_OUTPUT;\n inout->name = lydict_insert(ctx, \"output\", 0);\n } else {\n LOGINT(ctx);\n free(inout);\n goto error;\n }\n\n retval = (struct lys_node *)inout;\n retval->module = module;\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* data statements */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (!sub->ns) {\n /* garbage */\n lyxml_free(ctx, sub);\n } else if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\",\n inout->nodetype == LYS_INPUT ? \"input\" : \"output\", error);\n c_ext++;\n } else if (!strcmp(sub->name, \"container\") ||\n !strcmp(sub->name, \"leaf-list\") ||\n !strcmp(sub->name, \"leaf\") ||\n !strcmp(sub->name, \"list\") ||\n !strcmp(sub->name, \"choice\") ||\n !strcmp(sub->name, \"uses\") ||\n !strcmp(sub->name, \"grouping\") ||\n !strcmp(sub->name, \"anyxml\") ||\n !strcmp(sub->name, \"anydata\")) {\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* array counters */\n } else if (!strcmp(sub->name, \"typedef\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, inout->tpdf_size, \"typedefs\",\n inout->nodetype == LYS_INPUT ? \"input\" : \"output\", error);\n c_tpdf++;\n\n } else if ((module->version >= 2) && !strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, inout->must_size, \"musts\",\n inout->nodetype == LYS_INPUT ? \"input\" : \"output\", error);\n c_must++;\n\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n if (!root.child) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, retval, \"schema-node\", strnodetype(retval->nodetype));\n goto error;\n }\n\n /* middle part - process nodes with cardinality of 0..n except the data nodes */\n if (c_tpdf) {\n inout->tpdf = calloc(c_tpdf, sizeof *inout->tpdf);\n LY_CHECK_ERR_GOTO(!inout->tpdf, LOGMEM(ctx), error);\n }\n if (c_must) {\n inout->must = calloc(c_must, sizeof *inout->must);\n LY_CHECK_ERR_GOTO(!inout->must, LOGMEM(ctx), error);\n }\n if (c_ext) {\n inout->ext = calloc(c_ext, sizeof *inout->ext);\n LY_CHECK_ERR_GOTO(!inout->ext, LOGMEM(ctx), error);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &inout->must[inout->must_size], unres);\n inout->must_size++;\n if (r) {\n goto error;\n }\n } else { /* typedef */\n r = fill_yin_typedef(module, retval, sub, &inout->tpdf[inout->tpdf_size], unres);\n inout->tpdf_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n options |= LYS_PARSE_OPT_CFG_IGNORE;\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"container\")) {\n node = read_yin_container(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n node = read_yin_leaflist(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf\")) {\n node = read_yin_leaf(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"list\")) {\n node = read_yin_list(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"choice\")) {\n node = read_yin_choice(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"uses\")) {\n node = read_yin_uses(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"grouping\")) {\n node = read_yin_grouping(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"anyxml\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);\n } else if (!strcmp(sub->name, \"anydata\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && inout->must) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n return NULL;\n}",
  12618. "project": "libyang",
  12619. "hash": 307597432580069249223182367673754240947,
  12620. "size": 173,
  12621. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12622. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12623. "target": 0,
  12624. "dataset": "other",
  12625. "idx": 336779
  12626. },
  12627. {
  12628. "func": "read_yin_choice(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct lyxml_elem *sub, *next, *dflt = NULL;\n struct ly_ctx *const ctx = module->ctx;\n struct lys_node *retval, *node = NULL;\n struct lys_node_choice *choice;\n const char *value;\n int f_mand = 0, c_ftrs = 0, c_ext = 0, ret;\n void *reallocated;\n\n choice = calloc(1, sizeof *choice);\n LY_CHECK_ERR_RETURN(!choice, LOGMEM(ctx), NULL);\n\n choice->nodetype = LYS_CHOICE;\n choice->prev = (struct lys_node *)choice;\n retval = (struct lys_node *)choice;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :\n (options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT),\n unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* process choice's specific children */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"choice\", error);\n c_ext++;\n /* keep it for later processing, skip lyxml_free() */\n continue;\n } else if (!strcmp(sub->name, \"container\")) {\n if (!(node = read_yin_container(module, retval, sub, options, unres))) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n if (!(node = read_yin_leaflist(module, retval, sub, options, unres))) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"leaf\")) {\n if (!(node = read_yin_leaf(module, retval, sub, options, unres))) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"list\")) {\n if (!(node = read_yin_list(module, retval, sub, options, unres))) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"case\")) {\n if (!(node = read_yin_case(module, retval, sub, options, unres))) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"anyxml\")) {\n if (!(node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres))) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"anydata\")) {\n if (!(node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres))) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"default\")) {\n if (dflt) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_DEFAULT, 0, unres)) {\n goto error;\n }\n\n dflt = sub;\n lyxml_unlink_elem(ctx, dflt, 0);\n continue;\n /* skip lyxml_free() at the end of the loop, the sub node is processed later as dflt */\n\n } else if (!strcmp(sub->name, \"mandatory\")) {\n if (f_mand) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n /* just checking the flags in leaf is not sufficient, we would allow\n * multiple mandatory statements with the \"false\" value\n */\n f_mand = 1;\n\n GETVAL(ctx, value, sub, \"value\");\n if (!strcmp(value, \"true\")) {\n choice->flags |= LYS_MAND_TRUE;\n } else if (!strcmp(value, \"false\")) {\n choice->flags |= LYS_MAND_FALSE;\n } else {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n } /* else false is the default value, so we can ignore it */\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MANDATORY, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"when\")) {\n if (choice->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n choice->when = read_yin_when(module, sub, unres);\n if (!choice->when) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"choice\", error);\n c_ftrs++;\n\n /* skip lyxml_free() at the end of the loop, the sub node is processed later */\n continue;\n } else if (module->version >= 2 && !strcmp(sub->name, \"choice\")) {\n if (!(node = read_yin_choice(module, retval, sub, options, unres))) {\n goto error;\n }\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n\n node = NULL;\n lyxml_free(ctx, sub);\n }\n\n if (c_ftrs) {\n choice->iffeature = calloc(c_ftrs, sizeof *choice->iffeature);\n LY_CHECK_ERR_GOTO(!choice->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n ret = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (ret) {\n goto error;\n }\n } else {\n ret = fill_yin_iffeature(retval, 0, sub, &choice->iffeature[choice->iffeature_size], unres);\n choice->iffeature_size++;\n if (ret) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* check - default is prohibited in combination with mandatory */\n if (dflt && (choice->flags & LYS_MAND_TRUE)) {\n LOGVAL(ctx, LYE_INCHILDSTMT, LY_VLOG_LYS, retval, \"default\", \"choice\");\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL, \"The \\\"default\\\" statement is forbidden on choices with \\\"mandatory\\\".\");\n goto error;\n }\n\n /* link default with the case */\n if (dflt) {\n GETVAL(ctx, value, dflt, \"value\");\n if (unres_schema_add_str(module, unres, choice, UNRES_CHOICE_DFLT, value) == -1) {\n goto error;\n }\n lyxml_free(ctx, dflt);\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && choice->when) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n return retval;\n\nerror:\n lyxml_free(ctx, dflt);\n lys_node_free(ctx, retval, NULL, 0);\n return NULL;\n}",
  12629. "project": "libyang",
  12630. "hash": 315797547351147599913771454392714186138,
  12631. "size": 203,
  12632. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12633. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12634. "target": 0,
  12635. "dataset": "other",
  12636. "idx": 336780
  12637. },
  12638. {
  12639. "func": "read_yin_anydata(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, LYS_NODE type,\n int options, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lys_node *retval;\n struct lys_node_anydata *anyxml;\n struct lyxml_elem *sub, *next;\n const char *value;\n int r;\n int f_mand = 0;\n int c_must = 0, c_ftrs = 0, c_ext = 0;\n void *reallocated;\n\n anyxml = calloc(1, sizeof *anyxml);\n LY_CHECK_ERR_RETURN(!anyxml, LOGMEM(ctx), NULL);\n\n anyxml->nodetype = type;\n anyxml->prev = (struct lys_node *)anyxml;\n retval = (struct lys_node *)anyxml;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :\n (options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT), unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"anydata\", error);\n c_ext++;\n } else if (!strcmp(sub->name, \"mandatory\")) {\n if (f_mand) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n /* just checking the flags in leaf is not sufficient, we would allow\n * multiple mandatory statements with the \"false\" value\n */\n f_mand = 1;\n\n GETVAL(ctx, value, sub, \"value\");\n if (!strcmp(value, \"true\")) {\n anyxml->flags |= LYS_MAND_TRUE;\n } else if (!strcmp(value, \"false\")) {\n anyxml->flags |= LYS_MAND_FALSE;\n } else {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n }\n /* else false is the default value, so we can ignore it */\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MANDATORY, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"when\")) {\n if (anyxml->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n anyxml->when = read_yin_when(module, sub, unres);\n if (!anyxml->when) {\n lyxml_free(ctx, sub);\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, anyxml->must_size, \"musts\", \"anydata\", error);\n c_must++;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"anydata\", error);\n c_ftrs++;\n\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* middle part - process nodes with cardinality of 0..n */\n if (c_must) {\n anyxml->must = calloc(c_must, sizeof *anyxml->must);\n LY_CHECK_ERR_GOTO(!anyxml->must, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n anyxml->iffeature = calloc(c_ftrs, sizeof *anyxml->iffeature);\n LY_CHECK_ERR_GOTO(!anyxml->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &anyxml->must[anyxml->must_size], unres);\n anyxml->must_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &anyxml->iffeature[anyxml->iffeature_size], unres);\n anyxml->iffeature_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && (anyxml->when || anyxml->must)) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n for (r = 0; r < retval->ext_size; ++r) {\n /* set flag, which represent LYEXT_OPT_VALID */\n if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {\n retval->flags |= LYS_VALID_EXT;\n break;\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n return NULL;\n}",
  12640. "project": "libyang",
  12641. "hash": 190407262843483632675530669528518292129,
  12642. "size": 158,
  12643. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12644. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12645. "target": 0,
  12646. "dataset": "other",
  12647. "idx": 336782
  12648. },
  12649. {
  12650. "func": "read_yin_container(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next, root;\n struct lys_node *node = NULL;\n struct lys_node *retval;\n struct lys_node_container *cont;\n const char *value;\n void *reallocated;\n int r;\n int c_tpdf = 0, c_must = 0, c_ftrs = 0, c_ext = 0;\n\n /* init */\n memset(&root, 0, sizeof root);\n\n cont = calloc(1, sizeof *cont);\n LY_CHECK_ERR_RETURN(!cont, LOGMEM(ctx), NULL);\n\n cont->nodetype = LYS_CONTAINER;\n cont->prev = (struct lys_node *)cont;\n retval = (struct lys_node *)cont;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :\n (options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT),\n unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* process container's specific children */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"container\", error);\n c_ext++;\n } else if (!strcmp(sub->name, \"presence\")) {\n if (cont->presence) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, sub, \"value\");\n cont->presence = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_PRESENCE, 0, unres)) {\n goto error;\n }\n lyxml_free(ctx, sub);\n } else if (!strcmp(sub->name, \"when\")) {\n if (cont->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n cont->when = read_yin_when(module, sub, unres);\n if (!cont->when) {\n lyxml_free(ctx, sub);\n goto error;\n }\n lyxml_free(ctx, sub);\n\n /* data statements */\n } else if (!strcmp(sub->name, \"container\") ||\n !strcmp(sub->name, \"leaf-list\") ||\n !strcmp(sub->name, \"leaf\") ||\n !strcmp(sub->name, \"list\") ||\n !strcmp(sub->name, \"choice\") ||\n !strcmp(sub->name, \"uses\") ||\n !strcmp(sub->name, \"grouping\") ||\n !strcmp(sub->name, \"anyxml\") ||\n !strcmp(sub->name, \"anydata\") ||\n !strcmp(sub->name, \"action\") ||\n !strcmp(sub->name, \"notification\")) {\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* array counters */\n } else if (!strcmp(sub->name, \"typedef\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, cont->tpdf_size, \"typedefs\", \"container\", error);\n c_tpdf++;\n } else if (!strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, cont->must_size, \"musts\", \"container\", error);\n c_must++;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"container\", error);\n c_ftrs++;\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* middle part - process nodes with cardinality of 0..n except the data nodes */\n if (c_tpdf) {\n cont->tpdf = calloc(c_tpdf, sizeof *cont->tpdf);\n LY_CHECK_ERR_GOTO(!cont->tpdf, LOGMEM(ctx), error);\n }\n if (c_must) {\n cont->must = calloc(c_must, sizeof *cont->must);\n LY_CHECK_ERR_GOTO(!cont->must, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n cont->iffeature = calloc(c_ftrs, sizeof *cont->iffeature);\n LY_CHECK_ERR_GOTO(!cont->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"typedef\")) {\n r = fill_yin_typedef(module, retval, sub, &cont->tpdf[cont->tpdf_size], unres);\n cont->tpdf_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &cont->must[cont->must_size], unres);\n cont->must_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &cont->iffeature[cont->iffeature_size], unres);\n cont->iffeature_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"container\")) {\n node = read_yin_container(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n node = read_yin_leaflist(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf\")) {\n node = read_yin_leaf(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"list\")) {\n node = read_yin_list(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"choice\")) {\n node = read_yin_choice(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"uses\")) {\n node = read_yin_uses(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"grouping\")) {\n node = read_yin_grouping(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"anyxml\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);\n } else if (!strcmp(sub->name, \"anydata\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);\n } else if (!strcmp(sub->name, \"action\")) {\n node = read_yin_rpc_action(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"notification\")) {\n node = read_yin_notif(module, retval, sub, options, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && (cont->when || cont->must)) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n for (r = 0; r < retval->ext_size; ++r) {\n /* extension instance may not yet be resolved */\n if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {\n /* set flag, which represent LYEXT_OPT_VALID */\n retval->flags |= LYS_VALID_EXT;\n if (retval->ext[r]->flags & LYEXT_OPT_VALID_SUBTREE) {\n retval->flags |= LYS_VALID_EXT_SUBTREE;\n break;\n }\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n return NULL;\n}",
  12651. "project": "libyang",
  12652. "hash": 336173865557448454715868745869729551732,
  12653. "size": 218,
  12654. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12655. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12656. "target": 0,
  12657. "dataset": "other",
  12658. "idx": 336786
  12659. },
  12660. {
  12661. "func": "read_yin_leaf(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lys_node *retval;\n struct lys_node_leaf *leaf;\n struct lyxml_elem *sub, *next;\n const char *value;\n int r, has_type = 0;\n int c_must = 0, c_ftrs = 0, f_mand = 0, c_ext = 0;\n void *reallocated;\n\n leaf = calloc(1, sizeof *leaf);\n LY_CHECK_ERR_RETURN(!leaf, LOGMEM(ctx), NULL);\n\n leaf->nodetype = LYS_LEAF;\n leaf->prev = (struct lys_node *)leaf;\n retval = (struct lys_node *)leaf;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin,\n OPT_IDENT | OPT_MODULE | ((options & LYS_PARSE_OPT_CFG_IGNORE) ? OPT_CFG_IGNORE :\n (options & LYS_PARSE_OPT_CFG_NOINHERIT) ? OPT_CFG_PARSE : OPT_CFG_PARSE | OPT_CFG_INHERIT),\n unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"leaf\", error);\n c_ext++;\n continue;\n } else if (!strcmp(sub->name, \"type\")) {\n if (has_type) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n /* HACK for unres */\n leaf->type.der = (struct lys_tpdf *)sub;\n leaf->type.parent = (struct lys_tpdf *)leaf;\n /* postpone type resolution when if-feature parsing is done since we need\n * if-feature for check_leafref_features() */\n has_type = 1;\n } else if (!strcmp(sub->name, \"default\")) {\n if (leaf->dflt) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, sub, \"value\");\n leaf->dflt = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_DEFAULT, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"units\")) {\n if (leaf->units) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n GETVAL(ctx, value, sub, \"name\");\n leaf->units = lydict_insert(ctx, value, strlen(value));\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_UNITS, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"mandatory\")) {\n if (f_mand) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n /* just checking the flags in leaf is not sufficient, we would allow\n * multiple mandatory statements with the \"false\" value\n */\n f_mand = 1;\n\n GETVAL(ctx, value, sub, \"value\");\n if (!strcmp(value, \"true\")) {\n leaf->flags |= LYS_MAND_TRUE;\n } else if (!strcmp(value, \"false\")) {\n leaf->flags |= LYS_MAND_FALSE;\n } else {\n LOGVAL(ctx, LYE_INARG, LY_VLOG_LYS, retval, value, sub->name);\n goto error;\n } /* else false is the default value, so we can ignore it */\n\n if (lyp_yin_parse_subnode_ext(module, retval, LYEXT_PAR_NODE, sub, LYEXT_SUBSTMT_MANDATORY, 0, unres)) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"when\")) {\n if (leaf->when) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_LYS, retval, sub->name, yin->name);\n goto error;\n }\n\n leaf->when = read_yin_when(module, sub, unres);\n if (!leaf->when) {\n goto error;\n }\n\n } else if (!strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, leaf->must_size, \"musts\", \"leaf\", error);\n c_must++;\n continue;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"musts\", \"leaf\", error);\n c_ftrs++;\n continue;\n\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n\n /* do not free sub, it could have been unlinked and stored in unres */\n }\n\n /* check mandatory parameters */\n if (!has_type) {\n LOGVAL(ctx, LYE_MISSCHILDSTMT, LY_VLOG_LYS, retval, \"type\", yin->name);\n goto error;\n }\n if (leaf->dflt && (leaf->flags & LYS_MAND_TRUE)) {\n LOGVAL(ctx, LYE_INCHILDSTMT, LY_VLOG_LYS, retval, \"mandatory\", \"leaf\");\n LOGVAL(ctx, LYE_SPEC, LY_VLOG_PREV, NULL,\n \"The \\\"mandatory\\\" statement is forbidden on leaf with the \\\"default\\\" statement.\");\n goto error;\n }\n\n /* middle part - process nodes with cardinality of 0..n */\n if (c_must) {\n leaf->must = calloc(c_must, sizeof *leaf->must);\n LY_CHECK_ERR_GOTO(!leaf->must, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n leaf->iffeature = calloc(c_ftrs, sizeof *leaf->iffeature);\n LY_CHECK_ERR_GOTO(!leaf->iffeature, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &leaf->must[leaf->must_size], unres);\n leaf->must_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &leaf->iffeature[leaf->iffeature_size], unres);\n leaf->iffeature_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* finalize type parsing */\n if (unres_schema_add_node(module, unres, &leaf->type, UNRES_TYPE_DER, retval) == -1) {\n leaf->type.der = NULL;\n goto error;\n }\n\n /* check default value (if not defined, there still could be some restrictions\n * that need to be checked against a default value from a derived type) */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) &&\n (unres_schema_add_node(module, unres, &leaf->type, UNRES_TYPE_DFLT,\n (struct lys_node *)(&leaf->dflt)) == -1)) {\n goto error;\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && (leaf->when || leaf->must)) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n for (r = 0; r < retval->ext_size; ++r) {\n /* set flag, which represent LYEXT_OPT_VALID */\n if (retval->ext[r] && (retval->ext[r]->flags & LYEXT_OPT_VALID)) {\n retval->flags |= LYS_VALID_EXT;\n break;\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n return NULL;\n}",
  12662. "project": "libyang",
  12663. "hash": 112837442562867612790477931862043988586,
  12664. "size": 219,
  12665. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12666. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12667. "target": 0,
  12668. "dataset": "other",
  12669. "idx": 336787
  12670. },
  12671. {
  12672. "func": "read_yin_grouping(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin, int options,\n struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next, root;\n struct lys_node *node = NULL;\n struct lys_node *retval;\n struct lys_node_grp *grp;\n int r;\n int c_tpdf = 0, c_ext = 0;\n void *reallocated;\n\n /* init */\n memset(&root, 0, sizeof root);\n\n grp = calloc(1, sizeof *grp);\n LY_CHECK_ERR_RETURN(!grp, LOGMEM(ctx), NULL);\n\n grp->nodetype = LYS_GROUPING;\n grp->prev = (struct lys_node *)grp;\n retval = (struct lys_node *)grp;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin, OPT_IDENT | OPT_MODULE , unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"grouping\", error);\n c_ext++;\n\n /* data statements */\n } else if (!strcmp(sub->name, \"container\") ||\n !strcmp(sub->name, \"leaf-list\") ||\n !strcmp(sub->name, \"leaf\") ||\n !strcmp(sub->name, \"list\") ||\n !strcmp(sub->name, \"choice\") ||\n !strcmp(sub->name, \"uses\") ||\n !strcmp(sub->name, \"grouping\") ||\n !strcmp(sub->name, \"anyxml\") ||\n !strcmp(sub->name, \"anydata\") ||\n !strcmp(sub->name, \"action\") ||\n !strcmp(sub->name, \"notification\")) {\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* array counters */\n } else if (!strcmp(sub->name, \"typedef\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, grp->tpdf_size, \"typedefs\", \"grouping\", error);\n c_tpdf++;\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* middle part - process nodes with cardinality of 0..n except the data nodes */\n if (c_tpdf) {\n grp->tpdf = calloc(c_tpdf, sizeof *grp->tpdf);\n LY_CHECK_ERR_GOTO(!grp->tpdf, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else {\n /* typedef */\n r = fill_yin_typedef(module, retval, sub, &grp->tpdf[grp->tpdf_size], unres);\n grp->tpdf_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n if (!root.child) {\n LOGWRN(ctx, \"Grouping \\\"%s\\\" without children.\", retval->name);\n }\n options |= LYS_PARSE_OPT_INGRP;\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"container\")) {\n node = read_yin_container(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n node = read_yin_leaflist(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf\")) {\n node = read_yin_leaf(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"list\")) {\n node = read_yin_list(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"choice\")) {\n node = read_yin_choice(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"uses\")) {\n node = read_yin_uses(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"grouping\")) {\n node = read_yin_grouping(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"anyxml\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);\n } else if (!strcmp(sub->name, \"anydata\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);\n } else if (!strcmp(sub->name, \"action\")) {\n node = read_yin_rpc_action(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"notification\")) {\n node = read_yin_notif(module, retval, sub, options, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n return NULL;\n}",
  12673. "project": "libyang",
  12674. "hash": 15413466291165177767871103584060305603,
  12675. "size": 142,
  12676. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12677. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12678. "target": 0,
  12679. "dataset": "other",
  12680. "idx": 336790
  12681. },
  12682. {
  12683. "func": "read_restr_substmt(struct lys_module *module, struct lys_restr *restr, struct lyxml_elem *yin,\n struct unres_schema *unres)\n{\n struct lyxml_elem *child, *next;\n const char *value;\n struct ly_ctx *ctx = module->ctx;\n\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (!child->ns) {\n /* garbage */\n continue;\n } else if (strcmp(child->ns->value, LY_NSYIN)) {\n /* extension */\n if (lyp_yin_parse_subnode_ext(module, restr, LYEXT_PAR_RESTR, child, LYEXT_SUBSTMT_SELF, 0, unres)) {\n return EXIT_FAILURE;\n }\n } else if (!strcmp(child->name, \"description\")) {\n if (restr->dsc) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n return EXIT_FAILURE;\n }\n if (lyp_yin_parse_subnode_ext(module, restr, LYEXT_PAR_RESTR, child, LYEXT_SUBSTMT_DESCRIPTION, 0, unres)) {\n return EXIT_FAILURE;\n }\n restr->dsc = read_yin_subnode(ctx, child, \"text\");\n if (!restr->dsc) {\n return EXIT_FAILURE;\n }\n } else if (!strcmp(child->name, \"reference\")) {\n if (restr->ref) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n return EXIT_FAILURE;\n }\n if (lyp_yin_parse_subnode_ext(module, restr, LYEXT_PAR_RESTR, child, LYEXT_SUBSTMT_REFERENCE, 0, unres)) {\n return EXIT_FAILURE;\n }\n restr->ref = read_yin_subnode(ctx, child, \"text\");\n if (!restr->ref) {\n return EXIT_FAILURE;\n }\n } else if (!strcmp(child->name, \"error-app-tag\")) {\n if (restr->eapptag) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n return EXIT_FAILURE;\n }\n if (lyp_yin_parse_subnode_ext(module, restr, LYEXT_PAR_RESTR, child, LYEXT_SUBSTMT_ERRTAG, 0, unres)) {\n return EXIT_FAILURE;\n }\n GETVAL(ctx, value, child, \"value\");\n restr->eapptag = lydict_insert(ctx, value, 0);\n } else if (!strcmp(child->name, \"error-message\")) {\n if (restr->emsg) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n return EXIT_FAILURE;\n }\n if (lyp_yin_parse_subnode_ext(module, restr, LYEXT_PAR_RESTR, child, LYEXT_SUBSTMT_ERRMSG, 0, unres)) {\n return EXIT_FAILURE;\n }\n restr->emsg = read_yin_subnode(ctx, child, \"value\");\n if (!restr->emsg) {\n return EXIT_FAILURE;\n }\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n return EXIT_FAILURE;\n }\n }\n\n return EXIT_SUCCESS;\n\nerror:\n return EXIT_FAILURE;\n}",
  12684. "project": "libyang",
  12685. "hash": 93354852469643142055828412969936608221,
  12686. "size": 73,
  12687. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12688. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12689. "target": 0,
  12690. "dataset": "other",
  12691. "idx": 336793
  12692. },
  12693. {
  12694. "func": "fill_yin_include(struct lys_module *module, struct lys_submodule *submodule, struct lyxml_elem *yin,\n struct lys_include *inc, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *child, *next, exts;\n const char *value;\n int r, c_ext = 0;\n void *reallocated;\n\n /* init */\n memset(&exts, 0, sizeof exts);\n\n LY_TREE_FOR_SAFE(yin->child, next, child) {\n if (!child->ns) {\n /* garbage */\n continue;\n } else if (strcmp(child->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, inc->ext_size, \"extensions\", \"include\", error);\n c_ext++;\n lyxml_unlink_elem(ctx, child, 2);\n lyxml_add_child(ctx, &exts, child);\n } else if (!strcmp(child->name, \"revision-date\")) {\n if (inc->rev[0]) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, \"revision-date\", yin->name);\n goto error;\n }\n GETVAL(ctx, value, child, \"date\");\n if (lyp_check_date(ctx, value)) {\n goto error;\n }\n memcpy(inc->rev, value, LY_REV_SIZE - 1);\n\n if (lyp_yin_parse_subnode_ext(module, inc, LYEXT_PAR_INCLUDE, child, LYEXT_SUBSTMT_REVISIONDATE, 0, unres)) {\n goto error;\n }\n } else if ((module->version >= 2) && !strcmp(child->name, \"description\")) {\n if (inc->dsc) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(module, inc, LYEXT_PAR_INCLUDE, child, LYEXT_SUBSTMT_DESCRIPTION, 0, unres)) {\n goto error;\n }\n inc->dsc = read_yin_subnode(ctx, child, \"text\");\n if (!inc->dsc) {\n goto error;\n }\n } else if ((module->version >= 2) && !strcmp(child->name, \"reference\")) {\n if (inc->ref) {\n LOGVAL(ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, child->name, yin->name);\n goto error;\n }\n if (lyp_yin_parse_subnode_ext(module, inc, LYEXT_PAR_INCLUDE, child, LYEXT_SUBSTMT_REFERENCE, 0, unres)) {\n goto error;\n }\n inc->ref = read_yin_subnode(ctx, child, \"text\");\n if (!inc->ref) {\n goto error;\n }\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, child->name);\n goto error;\n }\n }\n\n /* process extensions */\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(inc->ext, (c_ext + inc->ext_size) * sizeof *inc->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n inc->ext = reallocated;\n\n /* init memory */\n memset(&inc->ext[inc->ext_size], 0, c_ext * sizeof *inc->ext);\n\n LY_TREE_FOR_SAFE(exts.child, next, child) {\n /* extension */\n r = lyp_yin_fill_ext(inc, LYEXT_PAR_INCLUDE, 0, 0, module, child, &inc->ext, &inc->ext_size, unres);\n if (r) {\n goto error;\n }\n }\n\n lyp_reduce_ext_list(&inc->ext, inc->ext_size, c_ext + inc->ext_size);\n }\n\n GETVAL(ctx, value, yin, \"module\");\n return lyp_check_include(submodule ? (struct lys_module *)submodule : module, value, inc, unres);\n\nerror:\n return -1;\n}",
  12695. "project": "libyang",
  12696. "hash": 275328397526231724343075461502239926647,
  12697. "size": 93,
  12698. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12699. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12700. "target": 0,
  12701. "dataset": "other",
  12702. "idx": 336795
  12703. },
  12704. {
  12705. "func": "read_yin_notif(struct lys_module *module, struct lys_node *parent, struct lyxml_elem *yin,\n int options, struct unres_schema *unres)\n{\n struct ly_ctx *ctx = module->ctx;\n struct lyxml_elem *sub, *next, root;\n struct lys_node *node = NULL;\n struct lys_node *retval;\n struct lys_node_notif *notif;\n int r;\n int c_tpdf = 0, c_ftrs = 0, c_must = 0, c_ext = 0;\n void *reallocated;\n\n if (parent && (module->version < 2)) {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, parent, \"notification\");\n return NULL;\n }\n\n memset(&root, 0, sizeof root);\n\n notif = calloc(1, sizeof *notif);\n LY_CHECK_ERR_RETURN(!notif, LOGMEM(ctx), NULL);\n\n notif->nodetype = LYS_NOTIF;\n notif->prev = (struct lys_node *)notif;\n retval = (struct lys_node *)notif;\n\n if (read_yin_common(module, parent, retval, LYEXT_PAR_NODE, yin, OPT_IDENT | OPT_MODULE, unres)) {\n goto error;\n }\n\n LOGDBG(LY_LDGYIN, \"parsing %s statement \\\"%s\\\"\", yin->name, retval->name);\n\n /* insert the node into the schema tree */\n if (lys_node_addchild(parent, lys_main_module(module), retval, options)) {\n goto error;\n }\n\n /* process rpc's specific children */\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ext, retval->ext_size, \"extensions\", \"notification\", error);\n c_ext++;\n continue;\n\n /* data statements */\n } else if (!strcmp(sub->name, \"container\") ||\n !strcmp(sub->name, \"leaf-list\") ||\n !strcmp(sub->name, \"leaf\") ||\n !strcmp(sub->name, \"list\") ||\n !strcmp(sub->name, \"choice\") ||\n !strcmp(sub->name, \"uses\") ||\n !strcmp(sub->name, \"grouping\") ||\n !strcmp(sub->name, \"anyxml\") ||\n !strcmp(sub->name, \"anydata\")) {\n lyxml_unlink_elem(ctx, sub, 2);\n lyxml_add_child(ctx, &root, sub);\n\n /* array counters */\n } else if (!strcmp(sub->name, \"typedef\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_tpdf, notif->tpdf_size, \"typedefs\", \"notification\", error);\n c_tpdf++;\n } else if (!strcmp(sub->name, \"if-feature\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_ftrs, retval->iffeature_size, \"if-features\", \"notification\", error);\n c_ftrs++;\n } else if ((module->version >= 2) && !strcmp(sub->name, \"must\")) {\n YIN_CHECK_ARRAY_OVERFLOW_GOTO(ctx, c_must, notif->must_size, \"musts\", \"notification\", error);\n c_must++;\n } else {\n LOGVAL(ctx, LYE_INSTMT, LY_VLOG_LYS, retval, sub->name);\n goto error;\n }\n }\n\n /* middle part - process nodes with cardinality of 0..n except the data nodes */\n if (c_tpdf) {\n notif->tpdf = calloc(c_tpdf, sizeof *notif->tpdf);\n LY_CHECK_ERR_GOTO(!notif->tpdf, LOGMEM(ctx), error);\n }\n if (c_ftrs) {\n notif->iffeature = calloc(c_ftrs, sizeof *notif->iffeature);\n LY_CHECK_ERR_GOTO(!notif->iffeature, LOGMEM(ctx), error);\n }\n if (c_must) {\n notif->must = calloc(c_must, sizeof *notif->must);\n LY_CHECK_ERR_GOTO(!notif->must, LOGMEM(ctx), error);\n }\n if (c_ext) {\n /* some extensions may be already present from the substatements */\n reallocated = realloc(retval->ext, (c_ext + retval->ext_size) * sizeof *retval->ext);\n LY_CHECK_ERR_GOTO(!reallocated, LOGMEM(ctx), error);\n retval->ext = reallocated;\n\n /* init memory */\n memset(&retval->ext[retval->ext_size], 0, c_ext * sizeof *retval->ext);\n }\n\n LY_TREE_FOR_SAFE(yin->child, next, sub) {\n if (strcmp(sub->ns->value, LY_NSYIN)) {\n /* extension */\n r = lyp_yin_fill_ext(retval, LYEXT_PAR_NODE, 0, 0, module, sub, &retval->ext, &retval->ext_size, unres);\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"typedef\")) {\n r = fill_yin_typedef(module, retval, sub, &notif->tpdf[notif->tpdf_size], unres);\n notif->tpdf_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"if-feature\")) {\n r = fill_yin_iffeature(retval, 0, sub, &notif->iffeature[notif->iffeature_size], unres);\n notif->iffeature_size++;\n if (r) {\n goto error;\n }\n } else if (!strcmp(sub->name, \"must\")) {\n r = fill_yin_must(module, sub, &notif->must[notif->must_size], unres);\n notif->must_size++;\n if (r) {\n goto error;\n }\n }\n }\n\n lyp_reduce_ext_list(&retval->ext, retval->ext_size, c_ext + retval->ext_size);\n\n /* last part - process data nodes */\n options |= LYS_PARSE_OPT_CFG_IGNORE;\n LY_TREE_FOR_SAFE(root.child, next, sub) {\n if (!strcmp(sub->name, \"container\")) {\n node = read_yin_container(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf-list\")) {\n node = read_yin_leaflist(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"leaf\")) {\n node = read_yin_leaf(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"list\")) {\n node = read_yin_list(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"choice\")) {\n node = read_yin_choice(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"uses\")) {\n node = read_yin_uses(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"grouping\")) {\n node = read_yin_grouping(module, retval, sub, options, unres);\n } else if (!strcmp(sub->name, \"anyxml\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYXML, options, unres);\n } else if (!strcmp(sub->name, \"anydata\")) {\n node = read_yin_anydata(module, retval, sub, LYS_ANYDATA, options, unres);\n }\n if (!node) {\n goto error;\n }\n\n lyxml_free(ctx, sub);\n }\n\n /* check XPath dependencies */\n if (!(ctx->models.flags & LY_CTX_TRUSTED) && notif->must) {\n if (options & LYS_PARSE_OPT_INGRP) {\n if (lyxp_node_check_syntax(retval)) {\n goto error;\n }\n } else {\n if (unres_schema_add_node(module, unres, retval, UNRES_XPATH, NULL) == -1) {\n goto error;\n }\n }\n }\n\n return retval;\n\nerror:\n lys_node_free(ctx, retval, NULL, 0);\n while (root.child) {\n lyxml_free(ctx, root.child);\n }\n return NULL;\n}",
  12706. "project": "libyang",
  12707. "hash": 194930711234157440117714933618475949815,
  12708. "size": 178,
  12709. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12710. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12711. "target": 0,
  12712. "dataset": "other",
  12713. "idx": 336796
  12714. },
  12715. {
  12716. "func": "lyp_yin_fill_ext(void *parent, LYEXT_PAR parent_type, LYEXT_SUBSTMT substmt, uint8_t substmt_index,\n struct lys_module *module, struct lyxml_elem *yin, struct lys_ext_instance ***ext,\n uint8_t *ext_size, struct unres_schema *unres)\n{\n struct unres_ext *info;\n int rc;\n\n info = malloc(sizeof *info);\n LY_CHECK_ERR_RETURN(!info, LOGMEM(module->ctx), EXIT_FAILURE);\n lyxml_unlink(module->ctx, yin);\n info->data.yin = yin;\n info->datatype = LYS_IN_YIN;\n info->parent = parent;\n info->mod = module;\n info->parent_type = parent_type;\n info->substmt = substmt;\n info->substmt_index = substmt_index;\n info->ext_index = *ext_size;\n\n rc = unres_schema_add_node(module, unres, ext, UNRES_EXT, (struct lys_node *)info);\n if (!rc && !(*ext)[*ext_size]) {\n /* extension instance is skipped */\n } else {\n ++(*ext_size);\n }\n\n return rc == -1 ? EXIT_FAILURE : EXIT_SUCCESS;\n}",
  12717. "project": "libyang",
  12718. "hash": 288373933368995538789084507090978474894,
  12719. "size": 28,
  12720. "commit_id": "a3917d95d516e3de267d3cfa5d4d3715a90e8777",
  12721. "message": "yin parser BUGFIX invalid memory access\n\n... in case there were some unresolved\nextensions.\nFixes #1454\nFixes #1455",
  12722. "target": 0,
  12723. "dataset": "other",
  12724. "idx": 336759
  12725. },
  12726. {
  12727. "func": "ly_add_loaded_plugin(char *name)\n{\n loaded_plugins = ly_realloc(loaded_plugins, (loaded_plugins_count + 2) * sizeof *loaded_plugins);\n LY_CHECK_ERR_RETURN(!loaded_plugins, free(name); LOGMEM(NULL), );\n ++loaded_plugins_count;\n\n loaded_plugins[loaded_plugins_count - 1] = name;\n loaded_plugins[loaded_plugins_count] = NULL;\n}",
  12728. "project": "libyang",
  12729. "hash": 124770143019807796430683696017842707483,
  12730. "size": 9,
  12731. "commit_id": "59a0bff1a5a2f0a0eac07e4bf94d4aea9dd3708d",
  12732. "message": "plugins BUGFIX handle empty revision correctly\n\nFixes #1451",
  12733. "target": 0,
  12734. "dataset": "other",
  12735. "idx": 413420
  12736. }
  12737. ]
  12738. },
  12739. {
  12740. "call_depth": 4,
  12741. "longest_call_chain": [
  12742. "test_r_str_ansi_len",
  12743. "r_str_ansi_len",
  12744. "r_str_ansi_nlen",
  12745. "__str_ansi_length"
  12746. ],
  12747. "group_size": 12,
  12748. "functions": [
  12749. {
  12750. "func": "R_API int r_str_bounds(const char *_str, int *h) {\n\tconst char *str, *ptr;\n\tint W = 0, H = 0;\n\tint cw = 0;\n\n\tif (_str) {\n\t\tptr = str = _str;\n\t\twhile (*str) {\n\t\t\tif (*str == '\\n') {\n\t\t\t\tH++;\n\t\t\t\tcw = r_str_ansi_nlen (ptr, (size_t)(str - ptr));\n\t\t\t\tif (cw > W) {\n\t\t\t\t\tW = cw;\n\t\t\t\t}\n\t\t\t\tcw = 0;\n\t\t\t\tptr = str + 1;\n\t\t\t}\n\t\t\tstr++;\n\t\t\tcw++;\n\t\t}\n\t\tif (*str == '\\n') {// skip last newline\n\t\t\tH--;\n\t\t}\n\t\tif (h) {\n\t\t\t*h = H;\n\t\t}\n\t}\n\treturn W;\n}",
  12751. "project": "radare2",
  12752. "hash": 172961371563676163614597385006965488211,
  12753. "size": 29,
  12754. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12755. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12756. "target": 0,
  12757. "dataset": "other",
  12758. "idx": 269020
  12759. },
  12760. {
  12761. "func": "R_API size_t r_str_utf8_codepoint(const char* s, size_t left) {\n\tif ((*s & 0x80) != 0x80) {\n\t\treturn 0;\n\t} else if ((*s & 0xe0) == 0xc0 && left >= 1) {\n\t\treturn ((*s & 0x1f) << 6) + (*(s + 1) & 0x3f);\n\t} else if ((*s & 0xf0) == 0xe0 && left >= 2) {\n\t\treturn ((*s & 0xf) << 12) + ((*(s + 1) & 0x3f) << 6) + (*(s + 2) & 0x3f);\n\t} else if ((*s & 0xf8) == 0xf0 && left >= 3) {\n\t\treturn ((*s & 0x7) << 18) + ((*(s + 1) & 0x3f) << 12) + ((*(s + 2) & 0x3f) << 6) + (*(s + 3) & 0x3f);\n\t}\n\treturn 0;\n}",
  12762. "project": "radare2",
  12763. "hash": 82642143776190898523180011603148462796,
  12764. "size": 12,
  12765. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12766. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12767. "target": 0,
  12768. "dataset": "other",
  12769. "idx": 269075
  12770. },
  12771. {
  12772. "func": "bool test_r_str_ansi_len(void) {\n\tint len;\n\n\tlen = r_str_ansi_len (\"radare2\");\n\tmu_assert_eq (len, 7, \"len(ascii only)\");\n\n\tlen = r_str_ansi_len (\"r\\x1b[38;2;208;80;0madare2\");\n\tmu_assert_eq (len, 7, \"len(ascii + ansi ending with m)\");\n\n\tlen = r_str_ansi_len (\"r\\x1b[0Jadare2\");\n\tmu_assert_eq (len, 7, \"len(ascii + ansi ending with J)\");\n\n\tlen = r_str_ansi_len (\"r\\x1b[42;42Hadare2\");\n\tmu_assert_eq (len, 7, \"len(ascii + ansi ending with H)\");\n\n\tlen = r_str_ansi_len (\"r\\xc3\\xa4\"\"dare2\");\n\tmu_assert_eq (len, 8, \"len(ascii + 2 byte utf-8 counted as 2 chars)\");\n\n\tlen = r_str_ansi_len (\"radar\\xe2\\x82\\xac\"\"2\");\n\tmu_assert_eq (len, 9, \"len(ascii + 3 byte utf-8 counted as 3 chars)\");\n\n\tlen = r_str_ansi_len (\"radar\\xf0\\x9d\\x84\\x9e\"\"2\");\n\tmu_assert_eq (len, 10, \"len(ascii + 4 byte utf-8 counted as 4 chars)\");\n\n\tmu_end;\n}",
  12773. "project": "radare2",
  12774. "hash": 245129988670048831657085626011348857996,
  12775. "size": 26,
  12776. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12777. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12778. "target": 0,
  12779. "dataset": "other",
  12780. "idx": 268963
  12781. },
  12782. {
  12783. "func": "R_API size_t r_str_len_utf8_ansi(const char *str) {\n\tint i = 0, len = 0, fullwidths = 0;\n\twhile (str[i]) {\n\t\tchar ch = str[i];\n\t\tsize_t chlen = __str_ansi_length (str + i);\n\t\tif (chlen > 1) {\n\t\t\ti += chlen - 1;\n\t\t} else if ((ch & 0xc0) != 0x80) { // utf8\n\t\t\tlen++;\n\t\t\tif (r_str_char_fullwidth (str + i, 4)) {\n\t\t\t\tfullwidths++;\n\t\t\t}\n\t\t}\n\t\ti++;\n\t}\n\treturn len + fullwidths;\n}",
  12784. "project": "radare2",
  12785. "hash": 246882952988880531618945286284081071080,
  12786. "size": 17,
  12787. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12788. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12789. "target": 0,
  12790. "dataset": "other",
  12791. "idx": 268864
  12792. },
  12793. {
  12794. "func": "R_API size_t r_str_len_utf8(const char *s) {\n\tsize_t i = 0, j = 0, fullwidths = 0;\n\twhile (s[i]) {\n\t\tif ((s[i] & 0xc0) != 0x80) {\n\t\t\tj++;\n\t\t\tif (r_str_char_fullwidth (s + i, 4)) {\n\t\t\t\tfullwidths++;\n\t\t\t}\n\t\t}\n\t\ti++;\n\t}\n\treturn j + fullwidths;\n}",
  12795. "project": "radare2",
  12796. "hash": 316503508038150507658967101271731313672,
  12797. "size": 13,
  12798. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12799. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12800. "target": 0,
  12801. "dataset": "other",
  12802. "idx": 268842
  12803. },
  12804. {
  12805. "func": "bool test_r_str_len_utf8_ansi(void) {\n\tint len;\n\n\tlen = r_str_len_utf8_ansi (\"radare2\");\n\tmu_assert_eq (len, 7, \"len(ascii only)\");\n\n\tlen = r_str_len_utf8_ansi (\"r\\x1b[38;2;208;80;0madare2\");\n\tmu_assert_eq (len, 7, \"len(ascii + ansi ending with m)\");\n\n\tlen = r_str_len_utf8_ansi (\"r\\x1b[0Jadare2\");\n\tmu_assert_eq (len, 7, \"len(ascii + ansi ending with J)\");\n\n\tlen = r_str_len_utf8_ansi (\"r\\x1b[42;42Hadare2\");\n\tmu_assert_eq (len, 7, \"len(ascii + ansi ending with H)\");\n\n\tlen = r_str_len_utf8_ansi (\"r\\xc3\\xa4\"\"dare2\");\n\tmu_assert_eq (len, 7, \"len(ascii + 2 byte utf-8 counted as 1 char)\");\n\n\tlen = r_str_len_utf8_ansi (\"radar\\xe2\\x82\\xac\"\"2\");\n\tmu_assert_eq (len, 7, \"len(ascii + 3 byte utf-8 counted as 1 char)\");\n\n\tlen = r_str_len_utf8_ansi (\"radar\\xf0\\x9d\\x84\\x9e\"\"2\");\n\tmu_assert_eq (len, 7, \"len(ascii + 4 byte utf-8 counted as 1 char)\");\n\n\tmu_end;\n}",
  12806. "project": "radare2",
  12807. "hash": 300615110034844303206843893313033797781,
  12808. "size": 26,
  12809. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12810. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12811. "target": 0,
  12812. "dataset": "other",
  12813. "idx": 268885
  12814. },
  12815. {
  12816. "func": "static size_t __str_ansi_length(char const *str) {\n\tsize_t i = 1;\n\tif (str[0] == 0x1b) {\n\t\tif (str[1] == '[') {\n\t\t\ti++;\n\t\t\twhile (str[i] && str[i] != 'J' && str[i] != 'm' && str[i] != 'H' && str[i] != 'K') {\n\t\t\t\ti++;\n\t\t\t}\n\t\t} else if (str[1] == '#') {\n\t\t\twhile (str[i] && str[i] != 'q') {\n\t\t\t\ti++;\n\t\t\t}\n\t\t}\n\t\tif (str[i]) {\n\t\t\ti++;\n\t\t}\n\t}\n\treturn i;\n}",
  12817. "project": "radare2",
  12818. "hash": 200895843150089395620465295524191413400,
  12819. "size": 19,
  12820. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12821. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12822. "target": 0,
  12823. "dataset": "other",
  12824. "idx": 268870
  12825. },
  12826. {
  12827. "func": "R_API bool r_str_char_fullwidth (const char* s, size_t left) {\n\tsize_t codepoint = r_str_utf8_codepoint (s, left);\n\treturn (codepoint >= 0x1100 &&\n\t\t (codepoint <= 0x115f || /* Hangul Jamo init. consonants */\n\t\t\t codepoint == 0x2329 || codepoint == 0x232a ||\n\t\t (R_BETWEEN (0x2e80, codepoint, 0xa4cf)\n\t\t\t&& codepoint != 0x303f) || /* CJK ... Yi */\n\t\t R_BETWEEN (0xac00, codepoint, 0xd7a3) || /* Hangul Syllables */\n\t\t R_BETWEEN (0xf900, codepoint, 0xfaff) || /* CJK Compatibility Ideographs */\n\t\t R_BETWEEN (0xfe10, codepoint, 0xfe19) || /* Vertical forms */\n\t\t R_BETWEEN (0xfe30, codepoint, 0xfe6f) || /* CJK Compatibility Forms */\n\t\t R_BETWEEN (0xff00, codepoint, 0xff60) || /* Fullwidth Forms */\n\t\t R_BETWEEN (0xffe0, codepoint, 0xffe6) ||\n\t\t R_BETWEEN (0x20000, codepoint, 0x2fffd) ||\n\t\t R_BETWEEN (0x30000, codepoint, 0x3fffd)));\n\n}",
  12828. "project": "radare2",
  12829. "hash": 151893148021945223497863263296321387586,
  12830. "size": 17,
  12831. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12832. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12833. "target": 0,
  12834. "dataset": "other",
  12835. "idx": 269038
  12836. },
  12837. {
  12838. "func": "R_API size_t r_str_ansi_len(const char *str) {\n\treturn r_str_ansi_nlen (str, 0);\n}",
  12839. "project": "radare2",
  12840. "hash": 58897733689454207834188866702317919166,
  12841. "size": 3,
  12842. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12843. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12844. "target": 0,
  12845. "dataset": "other",
  12846. "idx": 268835
  12847. },
  12848. {
  12849. "func": "R_API size_t r_str_ansi_nlen(const char *str, size_t slen) {\n\tsize_t i = 0, len = 0;\n\tif (slen > 0) {\n\t\twhile (str[i] && i < slen) {\n\t\t\tsize_t chlen = __str_ansi_length (str + i);\n\t\t\tif (chlen == 1) {\n\t\t\t\tlen ++;\n\t\t\t}\n\t\t\ti += chlen;\n\t\t}\n\t\treturn len > 0 ? len: 1;\n\t}\n\twhile (str[i]) {\n\t\tsize_t chlen = __str_ansi_length (str + i);\n\t\tif (chlen == 1) {\n\t\t\tlen ++;\n\t\t}\n\t\ti += chlen;\n\t}\n\treturn len > 0 ? len: 1;\n}",
  12850. "project": "radare2",
  12851. "hash": 87218290180537692850025468704473713796,
  12852. "size": 21,
  12853. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12854. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12855. "target": 0,
  12856. "dataset": "other",
  12857. "idx": 268881
  12858. },
  12859. {
  12860. "func": "R_API int r_str_ansi_filter(char *str, char **out, int **cposs, int len) {\n\tint i, j, *cps;\n\n\tif (len == 0) {\n\t\treturn 0;\n\t}\n\tif (len < 0) {\n\t\tlen = strlen (str);\n\t}\n\tchar *tmp = malloc (len + 1);\n\tif (!tmp) {\n\t\treturn -1;\n\t}\n\tmemcpy (tmp, str, len + 1);\n\tcps = calloc (len + 1, sizeof (int));\n\tif (!cps) {\n\t\tfree (tmp);\n\t\treturn -1;\n\t}\n\n\tfor (i = j = 0; i < len; i++) {\n\t\tif (tmp[i] == 0x1b) {\n\t\t\tsize_t chlen = __str_ansi_length (str + i);\n\t\t\tif (chlen > 1) {\n\t\t\t\ti += chlen;\n\t\t\t\ti--;\n\t\t\t}\n\t\t} else {\n\t\t\tstr[j] = tmp[i];\n\t\t\tcps[j] = i;\n\t\t\tj++;\n\t\t}\n\t}\n\tstr[j] = tmp[i];\n\n\tif (out) {\n\t\t*out = tmp;\n\t} else {\n\t\tfree (tmp);\n\t}\n\n\tif (cposs) {\n\t\t*cposs = cps;\n\t} else {\n\t\tfree (cps);\n\t}\n\n\treturn j;\n}",
  12861. "project": "radare2",
  12862. "hash": 84547543664250501063876670059002389663,
  12863. "size": 49,
  12864. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12865. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12866. "target": 0,
  12867. "dataset": "other",
  12868. "idx": 269037
  12869. },
  12870. {
  12871. "func": "R_API char* r_str_replace_thunked(char *str, char *clean, int *thunk, int clen,\n\t\t\t\t const char *key, const char *val, int g) {\n\tint i, klen, vlen, slen, delta = 0, bias;\n\tchar *newstr, *scnd, *p = clean, *str_p;\n\n\tif (!str || !key || !val || !clean || !thunk) {\n\t\treturn NULL;\n\t}\n\tklen = strlen (key);\n\tvlen = strlen (val);\n\tif (klen == vlen && !strcmp (key, val)) {\n\t\treturn str;\n\t}\n\tslen = strlen (str) + 1;\n\n\tfor (i = 0; i < clen; ) {\n\t\tp = (char *)r_mem_mem (\n\t\t\t(const ut8*)clean + i, clen - i,\n\t\t\t(const ut8*)key, klen);\n\t\tif (!p) {\n\t\t\tbreak;\n\t\t}\n\t\ti = (int)(size_t)(p - clean);\n\t\t/* as the original string changes size during replacement\n\t\t * we need delta to keep track of it*/\n\t\tstr_p = str + thunk[i] + delta;\n\n\t\tint newo = thunk[i + klen] - thunk[i];\n\t\tr_str_ansi_filter (str_p, NULL, NULL, newo);\n\t\tscnd = strdup (str_p + newo);\n\t\tbias = vlen - newo;\n\n\t\tslen += bias;\n\t\t// HACK: this 32 avoids overwrites wtf\n\t\tnewstr = realloc (str, slen + klen);\n\t\tif (!newstr) {\n\t\t\teprintf (\"realloc fail\\n\");\n\t\t\tR_FREE (str);\n\t\t\tfree (scnd);\n\t\t\tbreak;\n\t\t}\n\t\tstr = newstr;\n\t\tstr_p = str + thunk[i] + delta;\n\t\tmemcpy (str_p, val, vlen);\n\t\tmemcpy (str_p + vlen, scnd, strlen (scnd) + 1);\n\t\ti += klen;\n\t\tdelta += bias;\n\t\tfree (scnd);\n\t\tif (!g) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn str;\n}",
  12872. "project": "radare2",
  12873. "hash": 45113790991075915971260591637914211342,
  12874. "size": 54,
  12875. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  12876. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  12877. "target": 0,
  12878. "dataset": "other",
  12879. "idx": 268912
  12880. }
  12881. ]
  12882. },
  12883. {
  12884. "call_depth": 4,
  12885. "longest_call_chain": [
  12886. "do_tune",
  12887. "gch_build",
  12888. "gch_capo",
  12889. "gch_tr1"
  12890. ],
  12891. "group_size": 7,
  12892. "functions": [
  12893. {
  12894. "func": "static void get_over(struct SYMBOL *s)\n{\n\tstruct VOICE_S *p_voice, *p_voice2, *p_voice3;\n\tint range, voice, voice2, voice3;\nstatic char tx_wrong_dur[] = \"Wrong duration in voice overlay\";\nstatic char txt_no_note[] = \"No note in voice overlay\";\n\n\t/* treat the end of overlay */\n\tp_voice = curvoice;\n\tif (p_voice->ignore)\n\t\treturn;\n\tif (s->abc_type == ABC_T_BAR\n\t || s->u.v_over.type == V_OVER_E) {\n\t\tif (!p_voice->last_sym) {\n\t\t\terror(1, s, txt_no_note);\n\t\t\treturn;\n\t\t}\n\t\tp_voice->last_sym->sflags |= S_BEAM_END;\n\t\tover_bar = 0;\n\t\tif (over_time < 0) {\n\t\t\terror(1, s, \"Erroneous end of voice overlap\");\n\t\t\treturn;\n\t\t}\n\t\tif (p_voice->time != over_mxtime)\n\t\t\terror(1, s, tx_wrong_dur);\n\t\tcurvoice = &voice_tb[over_voice];\n\t\tover_mxtime = 0;\n\t\tover_voice = -1;\n\t\tover_time = -1;\n\t\treturn;\n\t}\n\n\t/* treat the full overlay start */\n\tif (s->u.v_over.type == V_OVER_S) {\n\t\tover_voice = p_voice - voice_tb;\n\t\tover_time = p_voice->time;\n\t\treturn;\n\t}\n\n\t/* (here is treated a new overlay - '&') */\n\t/* create the extra voice if not done yet */\n\tif (!p_voice->last_sym) {\n\t\terror(1, s, txt_no_note);\n\t\treturn;\n\t}\n\tp_voice->last_sym->sflags |= S_BEAM_END;\n\tvoice2 = s->u.v_over.voice;\n\tp_voice2 = &voice_tb[voice2];\n\tif (parsys->voice[voice2].range < 0) {\n\t\tint clone;\n\n\t\tif (cfmt.abc2pscompat) {\n\t\t\terror(1, s, \"Cannot have %%%%abc2pscompat\");\n\t\t\tcfmt.abc2pscompat = 0;\n\t\t}\n\t\tclone = p_voice->clone >= 0;\n\t\tp_voice2->id[0] = '&';\n\t\tp_voice2->id[1] = '\\0';\n\t\tp_voice2->second = 1;\n\t\tparsys->voice[voice2].second = 1;\n\t\tp_voice2->scale = p_voice->scale;\n\t\tp_voice2->octave = p_voice->octave;\n\t\tp_voice2->transpose = p_voice->transpose;\n\t\tmemcpy(&p_voice2->key, &p_voice->key,\n\t\t\t\t\tsizeof p_voice2->key);\n\t\tmemcpy(&p_voice2->ckey, &p_voice->ckey,\n\t\t\t\t\tsizeof p_voice2->ckey);\n\t\tmemcpy(&p_voice2->okey, &p_voice->okey,\n\t\t\t\t\tsizeof p_voice2->okey);\n\t\tp_voice2->posit = p_voice->posit;\n\t\tp_voice2->staff = p_voice->staff;\n\t\tp_voice2->cstaff = p_voice->cstaff;\n\t\tp_voice2->color = p_voice->color;\n\t\tp_voice2->map_name = p_voice->map_name;\n\t\trange = parsys->voice[p_voice - voice_tb].range;\n\t\tfor (voice = 0; voice < MAXVOICE; voice++) {\n\t\t\tif (parsys->voice[voice].range > range)\n\t\t\t\tparsys->voice[voice].range += clone + 1;\n\t\t}\n\t\tparsys->voice[voice2].range = range + 1;\n\t\tvoice_link(p_voice2);\n\t\tif (clone) {\n\t\t\tfor (voice3 = MAXVOICE; --voice3 >= 0; ) {\n\t\t\t\tif (parsys->voice[voice3].range < 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (voice3 > 0) {\n\t\t\t\tp_voice3 = &voice_tb[voice3];\n\t\t\t\tstrcpy(p_voice3->id, p_voice2->id);\n\t\t\t\tp_voice3->second = 1;\n\t\t\t\tparsys->voice[voice3].second = 1;\n\t\t\t\tp_voice3->scale = voice_tb[p_voice->clone].scale;\n\t\t\t\tparsys->voice[voice3].range = range + 2;\n\t\t\t\tvoice_link(p_voice3);\n\t\t\t\tp_voice2->clone = voice3;\n\t\t\t} else {\n\t\t\t\terror(1, s,\n\t\t\t\t \"Too many voices for overlay cloning\");\n\t\t\t}\n\t\t}\n\t}\n\tvoice = p_voice - voice_tb;\n//\tp_voice2->cstaff = p_voice2->staff = parsys->voice[voice2].staff\n//\t\t\t= parsys->voice[voice].staff;\n//\tif ((voice3 = p_voice2->clone) >= 0) {\n//\t\tp_voice3 = &voice_tb[voice3];\n//\t\tp_voice3->cstaff = p_voice3->staff\n//\t\t\t\t= parsys->voice[voice3].staff\n//\t\t\t\t= parsys->voice[p_voice->clone].staff;\n//\t}\n\n\tif (over_time < 0) {\t\t\t/* first '&' in a measure */\n\t\tint time;\n\n\t\tover_bar = 1;\n\t\tover_mxtime = p_voice->time;\n\t\tover_voice = voice;\n\t\ttime = p_voice2->time;\n\t\tfor (s = p_voice->last_sym; /*s*/; s = s->prev) {\n\t\t\tif (s->type == BAR\n\t\t\t || s->time <= time)\t/* (if start of tune) */\n\t\t\t\tbreak;\n\t\t}\n\t\tover_time = s->time;\n\t} else {\n\t\tif (over_mxtime == 0)\n\t\t\tover_mxtime = p_voice->time;\n\t\telse if (p_voice->time != over_mxtime)\n\t\t\terror(1, s, tx_wrong_dur);\n\t}\n\tp_voice2->time = over_time;\n\tcurvoice = p_voice2;\n}",
  12895. "project": "abcm2ps",
  12896. "hash": 89478143332361880739890507095670885956,
  12897. "size": 133,
  12898. "commit_id": "2f56e1179cab6affeb8afa9d6c324008fe40d8e3",
  12899. "message": "fix: array overflow when wrong duration in voice overlay\n\nIssue #83,",
  12900. "target": 1,
  12901. "dataset": "other",
  12902. "idx": 215165
  12903. },
  12904. {
  12905. "func": "static void get_over(struct SYMBOL *s)\n{\n\tstruct VOICE_S *p_voice, *p_voice2, *p_voice3;\n\tint range, voice, voice2, voice3;\nstatic char tx_wrong_dur[] = \"Wrong duration in voice overlay\";\nstatic char txt_no_note[] = \"No note in voice overlay\";\n\n\t/* treat the end of overlay */\n\tp_voice = curvoice;\n\tif (p_voice->ignore)\n\t\treturn;\n\tif (s->abc_type == ABC_T_BAR\n\t || s->u.v_over.type == V_OVER_E) {\n\t\tif (!p_voice->last_sym) {\n\t\t\terror(1, s, txt_no_note);\n\t\t\treturn;\n\t\t}\n\t\tp_voice->last_sym->sflags |= S_BEAM_END;\n\t\tover_bar = 0;\n\t\tif (over_time < 0) {\n\t\t\terror(1, s, \"Erroneous end of voice overlap\");\n\t\t\treturn;\n\t\t}\n\t\tcurvoice = &voice_tb[over_voice];\n\t\tif (p_voice->time != over_mxtime) {\n\t\t\terror(1, s, tx_wrong_dur);\n\t\t\tif (p_voice->time > over_mxtime)\n\t\t\t\tcurvoice->time = p_voice->time;\n\t\t\telse\n\t\t\t\tp_voice->time = curvoice->time;\n\t\t}\n\t\tover_mxtime = 0;\n\t\tover_voice = -1;\n\t\tover_time = -1;\n\t\treturn;\n\t}\n\n\t/* treat the full overlay start */\n\tif (s->u.v_over.type == V_OVER_S) {\n\t\tover_voice = p_voice - voice_tb;\n\t\tover_time = p_voice->time;\n\t\treturn;\n\t}\n\n\t/* (here is treated a new overlay - '&') */\n\t/* create the extra voice if not done yet */\n\tif (!p_voice->last_sym) {\n\t\terror(1, s, txt_no_note);\n\t\treturn;\n\t}\n\tp_voice->last_sym->sflags |= S_BEAM_END;\n\tvoice2 = s->u.v_over.voice;\n\tp_voice2 = &voice_tb[voice2];\n\tif (parsys->voice[voice2].range < 0) {\n\t\tint clone;\n\n\t\tif (cfmt.abc2pscompat) {\n\t\t\terror(1, s, \"Cannot have %%%%abc2pscompat\");\n\t\t\tcfmt.abc2pscompat = 0;\n\t\t}\n\t\tclone = p_voice->clone >= 0;\n\t\tp_voice2->id[0] = '&';\n\t\tp_voice2->id[1] = '\\0';\n\t\tp_voice2->second = 1;\n\t\tparsys->voice[voice2].second = 1;\n\t\tp_voice2->scale = p_voice->scale;\n\t\tp_voice2->octave = p_voice->octave;\n\t\tp_voice2->transpose = p_voice->transpose;\n\t\tmemcpy(&p_voice2->key, &p_voice->key,\n\t\t\t\t\tsizeof p_voice2->key);\n\t\tmemcpy(&p_voice2->ckey, &p_voice->ckey,\n\t\t\t\t\tsizeof p_voice2->ckey);\n\t\tmemcpy(&p_voice2->okey, &p_voice->okey,\n\t\t\t\t\tsizeof p_voice2->okey);\n\t\tp_voice2->posit = p_voice->posit;\n\t\tp_voice2->staff = p_voice->staff;\n\t\tp_voice2->cstaff = p_voice->cstaff;\n\t\tp_voice2->color = p_voice->color;\n\t\tp_voice2->map_name = p_voice->map_name;\n\t\trange = parsys->voice[p_voice - voice_tb].range;\n\t\tfor (voice = 0; voice < MAXVOICE; voice++) {\n\t\t\tif (parsys->voice[voice].range > range)\n\t\t\t\tparsys->voice[voice].range += clone + 1;\n\t\t}\n\t\tparsys->voice[voice2].range = range + 1;\n\t\tvoice_link(p_voice2);\n\t\tif (clone) {\n\t\t\tfor (voice3 = MAXVOICE; --voice3 >= 0; ) {\n\t\t\t\tif (parsys->voice[voice3].range < 0)\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (voice3 > 0) {\n\t\t\t\tp_voice3 = &voice_tb[voice3];\n\t\t\t\tstrcpy(p_voice3->id, p_voice2->id);\n\t\t\t\tp_voice3->second = 1;\n\t\t\t\tparsys->voice[voice3].second = 1;\n\t\t\t\tp_voice3->scale = voice_tb[p_voice->clone].scale;\n\t\t\t\tparsys->voice[voice3].range = range + 2;\n\t\t\t\tvoice_link(p_voice3);\n\t\t\t\tp_voice2->clone = voice3;\n\t\t\t} else {\n\t\t\t\terror(1, s,\n\t\t\t\t \"Too many voices for overlay cloning\");\n\t\t\t}\n\t\t}\n\t}\n\tvoice = p_voice - voice_tb;\n//\tp_voice2->cstaff = p_voice2->staff = parsys->voice[voice2].staff\n//\t\t\t= parsys->voice[voice].staff;\n//\tif ((voice3 = p_voice2->clone) >= 0) {\n//\t\tp_voice3 = &voice_tb[voice3];\n//\t\tp_voice3->cstaff = p_voice3->staff\n//\t\t\t\t= parsys->voice[voice3].staff\n//\t\t\t\t= parsys->voice[p_voice->clone].staff;\n//\t}\n\n\tif (over_time < 0) {\t\t\t/* first '&' in a measure */\n\t\tint time;\n\n\t\tover_bar = 1;\n\t\tover_mxtime = p_voice->time;\n\t\tover_voice = voice;\n\t\ttime = p_voice2->time;\n\t\tfor (s = p_voice->last_sym; /*s*/; s = s->prev) {\n\t\t\tif (s->type == BAR\n\t\t\t || s->time <= time)\t/* (if start of tune) */\n\t\t\t\tbreak;\n\t\t}\n\t\tover_time = s->time;\n\t} else {\n\t\tif (over_mxtime == 0)\n\t\t\tover_mxtime = p_voice->time;\n\t\telse if (p_voice->time != over_mxtime)\n\t\t\terror(1, s, tx_wrong_dur);\n\t}\n\tp_voice2->time = over_time;\n\tcurvoice = p_voice2;\n}",
  12906. "project": "abcm2ps",
  12907. "hash": 106849796852152645656287252191337327464,
  12908. "size": 138,
  12909. "commit_id": "2f56e1179cab6affeb8afa9d6c324008fe40d8e3",
  12910. "message": "fix: array overflow when wrong duration in voice overlay\n\nIssue #83,",
  12911. "target": 0,
  12912. "dataset": "other",
  12913. "idx": 484351
  12914. },
  12915. {
  12916. "func": "static void gch_build(struct SYMBOL *s)\n{\n\tstruct gch *gch;\n\tchar *p, *q, antype, sep;\n\tfloat w, h_ann, h_gch, y_above, y_below, y_left, y_right;\n\tfloat xspc;\n\tint l, ix, box, gch_place;\n\n\tif (s->posit.gch == SL_HIDDEN)\n\t\treturn;\n\ts->gch = getarena(sizeof *s->gch * MAXGCH);\n\tmemset(s->gch, 0, sizeof *s->gch * MAXGCH);\n\n\tif (curvoice->transpose != 0)\n\t\tgch_transpose(s);\n\tif (cfmt.capo)\n\t\tgch_capo(s);\n\n\t/* split the guitar chords / annotations\n\t * and initialize their vertical offsets */\n\tgch_place = s->posit.gch == SL_BELOW ? -1 : 1;\n\th_gch = cfmt.font_tb[cfmt.gcf].size;\n\th_ann = cfmt.font_tb[cfmt.anf].size;\n\ty_above = y_below = y_left = y_right = 0;\n\tbox = cfmt.gchordbox;\n\tp = s->text;\n\tgch = s->gch;\n\tsep = '\\n';\n\tantype = 'g';\t\t\t/* (compiler warning) */\n\tfor (;;) {\n\t\tif (sep != 'n' && strchr(\"^_<>@\", *p)) {\n\t\t\tgch->font = cfmt.anf;\n\t\t\tantype = *p++;\n\t\t\tif (antype == '@') {\n\t\t\t\tint n;\n\t\t\t\tfloat xo, yo;\n\n\t\t\t\tif (sscanf(p, \"%f,%f%n\", &xo, &yo, &n) != 2) {\n\t\t\t\t\terror(1, s, \"Error in annotation \\\"@\\\"\");\n\t\t\t\t} else {\n\t\t\t\t\tp += n;\n\t\t\t\t\tif (*p == ' ')\n\t\t\t\t\t\tp++;\n\t\t\t\t\tgch->x = xo;\n\t\t\t\t\tgch->y = yo;\n\t\t\t\t}\n\t\t\t}\n\t\t} else if (sep == '\\n') {\n\t\t\tgch->font = cfmt.gcf;\n\t\t\tgch->box = box;\n\t\t\tantype = 'g';\n\t\t} else {\n\t\t\tgch->font = (gch - 1)->font;\n\t\t\tgch->box = (gch - 1)->box;\n\t\t}\n\t\tgch->type = antype;\n\t\tswitch (antype) {\n\t\tdefault:\t\t\t\t/* guitar chord */\n\t\t\tif (gch_place < 0)\n\t\t\t\tbreak;\t\t\t/* below */\n\t\t\ty_above += h_gch;\n\t\t\tif (box)\n\t\t\t\ty_above += 2;\n\t\t\tbreak;\n\t\tcase '^':\t\t\t\t/* above */\n\t\t\ty_above += h_ann;\n\t\t\tbreak;\n\t\tcase '_':\t\t\t\t/* below */\n\t\t\tbreak;\n\t\tcase '<':\t\t\t\t/* left */\n\t\t\ty_left += h_ann * 0.5;\n\t\t\tbreak;\n\t\tcase '>':\t\t\t\t/* right */\n\t\t\ty_right += h_ann * 0.5;\n\t\t\tbreak;\n\t\tcase '@':\t\t\t\t/* absolute */\n\t\t\tif (gch->x == 0 && gch->y == 0\n\t\t\t && gch != s->gch\n\t\t\t && s->gch->type == '@') {\t/* if not 1st line */\n\t\t\t\tgch->x = (gch - 1)->x;\n\t\t\t\tgch->y = (gch - 1)->y - h_ann;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tgch->idx = p - s->text;\n\t\tfor (;;) {\n\t\t\tswitch (*p) {\n\t\t\tdefault:\n\t\t\t\tp++;\n\t\t\t\tcontinue;\n\t\t\tcase '\\\\':\n\t\t\t\tp++;\n\t\t\t\tif (*p == 'n') {\n\t\t\t\t\tp[-1] = '\\0';\n\t\t\t\t\tbreak;\t\t/* sep = 'n' */\n\t\t\t\t}\n\t\t\t\tp++;\n\t\t\t\tcontinue;\n\t\t\tcase '&':\t\t\t/* skip \"&xxx;\" */\n\t\t\t\tfor (;;) {\n\t\t\t\t\tswitch (*p) {\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tp++;\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\tcase ';':\n\t\t\t\t\t\tp++;\n\t\t\t\t\tcase '\\0':\n\t\t\t\t\tcase '\\n':\n\t\t\t\t\tcase '\\\\':\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\tcase '\\0':\n\t\t\tcase ';':\n\t\t\tcase '\\n':\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tsep = *p;\n\t\tif (sep == '\\0')\n\t\t\tbreak;\n\t\t*p++ = '\\0';\n\t\tgch++;\n\t\tif (gch - s->gch >= MAXGCH) {\n\t\t\terror(1, s, \"Too many guitar chords / annotations\");\n\t\t\tbreak;\n\t\t}\n\t}\n\n\t/* change the accidentals in the guitar chords */\n\tfor (ix = 0, gch = s->gch; ix < MAXGCH; ix++, gch++) {\n\t\tif (gch->type == '\\0')\n\t\t\tbreak;\n\t\tif (gch->type != 'g')\n\t\t\tcontinue;\n\t\tp = s->text + gch->idx;\n\t\tq = p;\n\t\tfor (; *p != '\\0'; p++) {\n\t\t\tswitch (*p) {\n\t\t\tcase '#':\n\t\t\tcase 'b':\n\t\t\tcase '=':\n\t\t\t\tif (p == q\t/* 1st char or after a slash */\n\t\t\t\t || (p != q + 1\t/* or invert '\\' behaviour */\n\t\t\t\t && p[-1] == '\\\\'))\n\t\t\t\t\tbreak;\n\n\t\t\t\t/* set the accidentals as unused utf-8 values\n\t\t\t\t * (see subs.c) */\n\t\t\t\tswitch (*p) {\n\t\t\t\tcase '#':\n\t\t\t\t\t*p = 0x01;\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'b':\n\t\t\t\t\t*p = 0x02;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n/*\t\t\t\tcase '=': */\n\t\t\t\t\t*p = 0x03;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif (p[-1] == '\\\\') {\n\t\t\t\t\tp--;\n\t\t\t\t\tl = strlen(p);\n\t\t\t\t\tmemmove(p, p + 1, l);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ' ':\n\t\t\tcase '/':\n\t\t\t\tq = p + 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/* set the offsets and widths */\n/*fixme:utf8*/\n\tfor (ix = 0, gch = s->gch; ix < MAXGCH; ix++, gch++) {\n\t\tif (gch->type == '\\0')\n\t\t\tbreak;\n\t\tif (gch->type == '@')\n\t\t\tcontinue;\t\t/* no width */\n\t\tp = s->text + gch->idx;\n\t\tstr_font(gch->font);\n\t\tw = tex_str(p);\n\t\tgch->w = w; // + 4;\n\t\tswitch (gch->type) {\n\t\tcase '_':\t\t\t/* below */\n\t\t\txspc = w * GCHPRE;\n\t\t\tif (xspc > 8)\n\t\t\t\txspc = 8;\n\t\t\tgch->x = -xspc;\n\t\t\ty_below -= h_ann;\n\t\t\tgch->y = y_below;\n\t\t\tbreak;\n\t\tcase '^':\t\t\t/* above */\n\t\t\txspc = w * GCHPRE;\n\t\t\tif (xspc > 8)\n\t\t\t\txspc = 8;\n\t\t\tgch->x = -xspc;\n\t\t\ty_above -= h_ann;\n\t\t\tgch->y = y_above;\n\t\t\tbreak;\n\t\tdefault:\t\t\t/* guitar chord */\n\t\t\txspc = w * GCHPRE;\n\t\t\tif (xspc > 8)\n\t\t\t\txspc = 8;\n\t\t\tgch->x = -xspc;\n\t\t\tif (gch_place < 0) {\t/* below */\n\t\t\t\ty_below -= h_gch;\n\t\t\t\tgch->y = y_below;\n\t\t\t\tif (box) {\n\t\t\t\t\ty_below -= 2;\n\t\t\t\t\tgch->y -= 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\ty_above -= h_gch;\n\t\t\t\tgch->y = y_above;\n\t\t\t\tif (box) {\n\t\t\t\t\ty_above -= 2;\n\t\t\t\t\tgch->y -= 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbreak;\n\t\tcase '<':\t\t/* left */\n\t\t\tgch->x = -(w + 6);\n\t\t\ty_left -= h_ann;\n\t\t\tgch->y = y_left;\n\t\t\tbreak;\n\t\tcase '>':\t\t/* right */\n\t\t\tgch->x = 6;\n\t\t\ty_right -= h_ann;\n\t\t\tgch->y = y_right;\n\t\t\tbreak;\n\t\t}\n\t}\n}",
  12917. "project": "abcm2ps",
  12918. "hash": 198904723762461782356983904298016550837,
  12919. "size": 240,
  12920. "commit_id": "2f56e1179cab6affeb8afa9d6c324008fe40d8e3",
  12921. "message": "fix: array overflow when wrong duration in voice overlay\n\nIssue #83,",
  12922. "target": 0,
  12923. "dataset": "other",
  12924. "idx": 484347
  12925. },
  12926. {
  12927. "func": "void do_tune(void)\n{\n\tstruct VOICE_S *p_voice;\n\tstruct SYMBOL *s, *s1, *s2;\n\tint i;\n\n\t/* initialize */\n\tlvlarena(0);\n\tnstaff = 0;\n\tstaves_found = -1;\n\tfor (i = 0; i < MAXVOICE; i++) {\n\t\tp_voice = &voice_tb[i];\n\t\ts1 = (struct SYMBOL *) getarena(sizeof *s1);\n\t\tmemset(s1, 0, sizeof *s1);\n\t\ts1->type = CLEF;\n\t\ts1->voice = i;\n\t\tif (cfmt.autoclef) {\n\t\t\ts1->u.clef.type = AUTOCLEF;\n\t\t\ts1->sflags = S_CLEF_AUTO;\n\t\t} else {\n\t\t\ts1->u.clef.type = TREBLE;\n\t\t}\n\t\ts1->u.clef.line = 2;\t\t/* treble clef on 2nd line */\n\t\tp_voice->s_clef = s1;\n\t\tp_voice->meter.wmeasure = 1;\t// M:none\n\t\tp_voice->wmeasure = 1;\n\t\tp_voice->scale = 1;\n\t\tp_voice->clone = -1;\n\t\tp_voice->over = -1;\n\t\tp_voice->posit = cfmt.posit;\n\t\tp_voice->stafflines = NULL;\n//\t\tp_voice->staffscale = 0;\n\t}\n\tcurvoice = first_voice = voice_tb;\n\treset_deco();\n\tabc2win = 0;\n\tclip_start.bar = -1;\n\tclip_end.bar = (short unsigned) ~0 >> 1;\n\n\tparsys = NULL;\n\tsystem_new();\t\t\t/* create the 1st staff system */\n\tparsys->top_voice = parsys->voice[0].range = 0;\t/* implicit voice */\n\n\tif (!epsf) {\n//fixme: 8.6.2\n#if 1\n// fixme: should already be 0\n\t\tuse_buffer = 0;\n#else\n\t\tif (cfmt.oneperpage) {\n\t\t\tuse_buffer = 0;\n\t\t\tclose_page();\n\t\t} else {\n\t\t\tif (in_page)\t\t// ??\n\t\t\t\tuse_buffer = cfmt.splittune != 1;\n\t\t}\n#endif\n\t} else {\n\t\tuse_buffer = 1;\n\t\tmarg_init();\n\t}\n\n\t/* set the duration of all notes/rests\n\t *\t(this is needed for tuplets and the feathered beams) */\n\tfor (s = parse.first_sym; s; s = s->abc_next) {\n\t\tswitch (s->abc_type) {\n\t\tcase ABC_T_EOLN:\n\t\t\tif (s->u.eoln.type == 2)\n\t\t\t\tabc2win = 1;\n\t\t\tbreak;\n\t\tcase ABC_T_NOTE:\n\t\tcase ABC_T_REST:\n\t\t\ts->dur = s->u.note.notes[0].len;\n\t\t\tbreak;\n\t\t}\n\t}\n\n\tif (voice_tb[0].id[0] == '\\0') {\t/* single voice */\n\t\tvoice_tb[0].id[0] = '1';\t/* implicit V:1 */\n\t\tvoice_tb[0].id[1] = '\\0';\n\t}\n\n\t/* scan the tune */\n\tfor (s = parse.first_sym; s; s = s->abc_next) {\n\t\tif (s->flags & ABC_F_LYRIC_START)\n\t\t\tcurvoice->lyric_start = curvoice->last_sym;\n\t\tswitch (s->abc_type) {\n\t\tcase ABC_T_INFO:\n\t\t\ts = get_info(s);\n\t\t\tbreak;\n\t\tcase ABC_T_PSCOM:\n\t\t\ts = process_pscomment(s);\n\t\t\tbreak;\n\t\tcase ABC_T_NOTE:\n\t\tcase ABC_T_REST:\n\t\t\tif (curvoice->space\n\t\t\t && !(s->flags & ABC_F_GRACE)) {\n\t\t\t\tcurvoice->space = 0;\n\t\t\t\ts->flags |= ABC_F_SPACE;\n\t\t\t}\n\t\t\tget_note(s);\n\t\t\tbreak;\n\t\tcase ABC_T_BAR:\n\t\t\tif (over_bar)\n\t\t\t\tget_over(s);\n\t\t\tget_bar(s);\n\t\t\tbreak;\n\t\tcase ABC_T_CLEF:\n\t\t\tget_clef(s);\n\t\t\tbreak;\n\t\tcase ABC_T_EOLN:\n\t\t\tif (cfmt.breakoneoln\n\t\t\t || (s->flags & ABC_F_SPACE))\n\t\t\t\tcurvoice->space = 1;\n\t\t\tif (cfmt.continueall || cfmt.barsperstaff\n\t\t\t || s->u.eoln.type == 1)\t/* if '\\' */\n\t\t\t\tcontinue;\n\t\t\tif (s->u.eoln.type == 0\t\t/* if normal eoln */\n\t\t\t && abc2win\n\t\t\t && parse.abc_vers != (2 << 16))\n\t\t\t\tcontinue;\n\t\t\tif (parsys->voice[curvoice - voice_tb].range == 0\n\t\t\t && curvoice->last_sym)\n\t\t\t\tcurvoice->last_sym->sflags |= S_EOLN;\n\t\t\tif (!cfmt.alignbars)\n\t\t\t\tcontinue;\t\t/* normal */\n\n\t\t\t/* align bars */\n\t\t\twhile (s->abc_next) {\t\t/* treat the lyrics */\n\t\t\t\tif (s->abc_next->abc_type != ABC_T_INFO)\n\t\t\t\t\tbreak;\n\t\t\t\tswitch (s->abc_next->text[0]) {\n\t\t\t\tcase 'w':\n\t\t\t\t\ts = get_info(s->abc_next);\n\t\t\t\t\tcontinue;\n\t\t\t\tcase 'd':\n\t\t\t\tcase 's':\n\t\t\t\t\ts = s->abc_next;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ti = (curvoice - voice_tb) + 1;\n\t\t\tif (i < cfmt.alignbars) {\n\t\t\t\tcurvoice = &voice_tb[i];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tgenerate();\n\t\t\tbuffer_eob(0);\n\t\t\tcurvoice = &voice_tb[0];\n\t\t\tcontinue;\n\t\tcase ABC_T_MREST: {\n\t\t\tint dur;\n\n\t\t\tdur = curvoice->wmeasure * s->u.bar.len;\n\t\t\tif (curvoice->second) {\n\t\t\t\tcurvoice->time += dur;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tsym_link(s, MREST);\n\t\t\ts->dur = dur;\n\t\t\tcurvoice->time += dur;\n\t\t\tif (s->text)\n\t\t\t\tgch_build(s);\t/* build the guitar chords */\n\t\t\tif (s->u.bar.dc.n > 0)\n\t\t\t\tdeco_cnv(&s->u.bar.dc, s, NULL);\n\t\t\tbreak;\n\t\t }\n\t\tcase ABC_T_MREP: {\n\t\t\tint n;\n\n\t\t\ts2 = curvoice->last_sym;\n\t\t\tif (!s2 || s2->type != BAR) {\n\t\t\t\terror(1, s,\n\t\t\t\t \"No bar before measure repeat\");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (curvoice->ignore)\n\t\t\t\tbreak;\n\t\t\tn = s->u.bar.len;\n\t\t\tif (curvoice->second) {\n\t\t\t\tcurvoice->time += curvoice->wmeasure * n;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\ts2 = sym_add(curvoice, NOTEREST);\n\t\t\ts2->abc_type = ABC_T_REST;\n\t\t\ts2->flags |= ABC_F_INVIS;\n\t\t\ts2->dur = curvoice->wmeasure;\n\t\t\tcurvoice->time += s2->dur;\n\t\t\tif (n == 1) {\n\t\t\t\ts->abc_next->u.bar.len = n; /* <n> in the next bar */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\twhile (--n > 0) {\n\t\t\t\ts2 = sym_add(curvoice, BAR);\n\t\t\t\ts2->u.bar.type = B_SINGLE;\n\t\t\t\tif (n == s->u.bar.len - 1)\n\t\t\t\t\ts2->u.bar.len = s->u.bar.len;\n\t\t\t\ts2 = sym_add(curvoice, NOTEREST);\n\t\t\t\ts2->abc_type = ABC_T_REST;\n\t\t\t\ts2->flags |= ABC_F_INVIS;\n\t\t\t\ts2->dur = curvoice->wmeasure;\n\t\t\t\tcurvoice->time += s2->dur;\n\t\t\t}\n\t\t\tbreak;\n\t\t }\n\t\tcase ABC_T_V_OVER:\n\t\t\tget_over(s);\n\t\t\tcontinue;\n\t\tcase ABC_T_TUPLET:\n\t\t\tset_tuplet(s);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tcontinue;\n\t\t}\n\t\tif (s->type == 0)\n\t\t\tcontinue;\n\t\tif (curvoice->second)\n\t\t\ts->sflags |= S_SECOND;\n\t\tif (curvoice->floating)\n\t\t\ts->sflags |= S_FLOATING;\n\t}\n\n\tgen_ly(0);\n\tput_history();\n\tbuffer_eob(1);\n\tif (epsf) {\n\t\twrite_eps();\n\t} else {\n\t\twrite_buffer();\n//\t\tif (!cfmt.oneperpage && in_page)\n//\t\t\tuse_buffer = cfmt.splittune != 1;\n\t}\n\n\tif (info['X' - 'A']) {\n\t\tmemcpy(&cfmt, &dfmt, sizeof cfmt); /* restore global values */\n\t\tmemcpy(&info, &info_glob, sizeof info);\n\t\tmemcpy(deco, deco_glob, sizeof deco);\n\t\tmaps = maps_glob;\n\t\tinfo['X' - 'A'] = NULL;\n\t}\n\n\t/* free the parsing resources */\n\t{\n\t\tstruct brk_s *brk, *brk2;\n\n\t\tbrk = brks;\n\t\twhile (brk) {\n\t\t\tbrk2 = brk->next;\n\t\t\tfree(brk);\n\t\t\tbrk = brk2;\n\t\t}\n\t\tbrks = brk;\t\t/* (NULL) */\n\t}\n}",
  12928. "project": "abcm2ps",
  12929. "hash": 10286452578274153484723719583151117351,
  12930. "size": 255,
  12931. "commit_id": "2f56e1179cab6affeb8afa9d6c324008fe40d8e3",
  12932. "message": "fix: array overflow when wrong duration in voice overlay\n\nIssue #83,",
  12933. "target": 0,
  12934. "dataset": "other",
  12935. "idx": 484344
  12936. },
  12937. {
  12938. "func": "static void gch_capo(struct SYMBOL *s)\n{\n\tchar *p = s->text, *q, *r;\n\tint i, l, li = 0;\n\tstatic const char *capo_txt = \" (capo: %d)\";\n\tstatic signed char cap_trans[] =\n\t\t{0, 5, -2, 3, -4, 1, -6, -1, 4, -3, 2, -5};\n\n\t// search the chord symbols\n\tfor (;;) {\n\t\tif (!strchr(\"^_<>@\", *p))\n\t\t\tbreak;\n\t\tp = strchr(p, '\\n');\n\t\tif (!p)\n\t\t\treturn;\n\t\tp++;\n\t}\n\n\t// add a capo chord symbol\n\ti = p - s->text;\n\tq = strchr(p + 1, '\\n');\n\tif (q)\n\t\tl = q - p;\n\telse\n\t\tl = strlen(p);\n\tif (!capo) {\n\t\tcapo = 1;\n\t\tli = strlen(capo_txt);\n\t}\n\tr = (char *) getarena(strlen(s->text) + l + li + 1);\n\ti += l;\n\tstrncpy(r, s->text, i);\t\t// annotations + chord symbol\n\tr[i++] = '\\n';\n\tstrncpy(r + i, p, l);\t\t// capo\n\tif (li) {\n\t\tsprintf(r + i + l, capo_txt, cfmt.capo);\n\t\tl += li;\n\t}\n\tif (q)\n\t\tstrcpy(r + i + l, q);\t// ending annotations\n\ts->text = r;\n\tgch_tr1(s, i, cap_trans[cfmt.capo % 12]);\n}",
  12939. "project": "abcm2ps",
  12940. "hash": 297571697935838391035188625332640156407,
  12941. "size": 43,
  12942. "commit_id": "2f56e1179cab6affeb8afa9d6c324008fe40d8e3",
  12943. "message": "fix: array overflow when wrong duration in voice overlay\n\nIssue #83,",
  12944. "target": 0,
  12945. "dataset": "other",
  12946. "idx": 484342
  12947. },
  12948. {
  12949. "func": "static void gch_transpose(struct SYMBOL *s)\n{\n\tint in_ch = 0;\n\tint i2 = curvoice->ckey.sf - curvoice->okey.sf;\n\tchar *o = s->text, *p = o;\n\n\t// search the chord symbols\n\tfor (;;) {\n\t\tif (in_ch || !strchr(\"^_<>@\", *p)) {\n\t\t\tgch_tr1(s, p - s->text, i2);\n\t\t\tp = s->text + (p - o);\n\t\t\to = s->text;\n\t\t\tfor (p++; *p; p++) {\n\t\t\t\tif (strchr(\"\\t;\\n\", *p))\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!*p)\n\t\t\t\tbreak;\n\t\t\tswitch (*p) {\n\t\t\tcase '\\t':\n\t\t\t\tin_ch = 1;\n\t\t\t\tbreak;\n\t\t\tcase ';':\n\t\t\t\tin_ch = !strchr(\"^_<>@\", p[1]);\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tin_ch = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t} else {\n\t\t\tp = strchr(p, '\\n');\n\t\t\tif (!p)\n\t\t\t\tbreak;\n\t\t}\n\t\tp++;\n\t}\n}",
  12950. "project": "abcm2ps",
  12951. "hash": 197089611282988920788858462297844536403,
  12952. "size": 37,
  12953. "commit_id": "2f56e1179cab6affeb8afa9d6c324008fe40d8e3",
  12954. "message": "fix: array overflow when wrong duration in voice overlay\n\nIssue #83,",
  12955. "target": 0,
  12956. "dataset": "other",
  12957. "idx": 484350
  12958. },
  12959. {
  12960. "func": "static void gch_tr1(struct SYMBOL *s, int i, int i2)\n{\n\tchar *p = &s->text[i],\n\t\t*q = p + 1,\n\t\t*new_txt;\n\tint l, latin;\n\tint n, a, i1, i3, i4;\n\tstatic const char note_names[] = \"CDEFGAB\";\n\tstatic const char *latin_names[7] =\n\t\t\t{ \"Do\", \"Ré\", \"Mi\", \"Fa\", \"Sol\", \"La\", \"Si\" };\n\tstatic const char *acc_name[5] = {\"bb\", \"b\", \"\", \"#\", \"##\"};\n\n\t/* main chord */\n\tlatin = 0;\n\tswitch (*p) {\n\tcase 'A':\n\tcase 'B':\n\t\tn = *p - 'A' + 5;\n\t\tbreak;\n\tcase 'C':\n\tcase 'E':\n\tcase 'G':\n\t\tn = *p - 'C';\n\t\tbreak;\n\tcase 'D':\n\t\tif (p[1] == 'o') {\n\t\t\tlatin++;\n\t\t\tn = 0;\t\t/* Do */\n\t\t\tbreak;\n\t\t}\n\t\tn = 1;\n\t\tbreak;\n\tcase 'F':\n\t\tif (p[1] == 'a')\n\t\t\tlatin++;\t/* Fa */\n\t\tn = 3;\n\t\tbreak;\n\tcase 'L':\n\t\tlatin++;\t\t/* La */\n\t\tn = 5;\n\t\tbreak;\n\tcase 'M':\n\t\tlatin++;\t\t/* Mi */\n\t\tn = 2;\n\t\tbreak;\n\tcase 'R':\n\t\tlatin++;\n\t\tif (p[1] != 'e')\n\t\t\tlatin++;\t/* Ré */\n\t\tn = 1;\t\t\t/* Re */\n\t\tbreak;\n\tcase 'S':\n\t\tlatin++;\n\t\tif (p[1] == 'o') {\n\t\t\tlatin++;\n\t\t\tn = 4;\t\t/* Sol */\n\t\t} else {\n\t\t\tn = 6;\t\t/* Si */\n\t\t}\n\t\tbreak;\n\tcase '/':\t\t\t// bass only\n\t\tlatin--;\n\t\tbreak;\n\tdefault:\n\t\treturn;\n\t}\n\tq += latin;\n\n\t/* allocate a new string */\n\tnew_txt = getarena(strlen(s->text) + 6);\n\tl = p - s->text;\n\tmemcpy(new_txt, s->text, l);\n\ts->text = new_txt;\n\tnew_txt += l;\n\tp = q;\n\n\tif (latin >= 0) {\t\t\t// if some chord\n\t\ta = 0;\n\t\twhile (*p == '#') {\n\t\t\ta++;\n\t\t\tp++;\n\t\t}\n\t\twhile (*p == 'b') {\n\t\t\ta--;\n\t\t\tp++;\n\t\t}\n//\t\tif (*p == '=')\n//\t\t\tp++;\n\t\ti3 = cde2fcg[n] + i2 + a * 7;\n\t\ti4 = cgd2cde[(unsigned) ((i3 + 16 * 7) % 7)];\n\t\ti1 = ((i3 + 1 + 21) / 7 + 2 - 3 + 32 * 5) % 5;\n\t\t\t\t\t\t\t/* accidental */\n\t\tif (latin == 0)\n\t\t\t*new_txt++ = note_names[i4];\n\t\telse\n\t\t\tnew_txt += sprintf(new_txt, \"%s\", latin_names[i4]);\n\t\tnew_txt += sprintf(new_txt, \"%s\", acc_name[i1]);\n\t}\n\n\t/* bass */\n\twhile (*p != '\\0' && *p != '\\n' && *p != '/')\t// skip 'm'/'dim'..\n\t\t*new_txt++ = *p++;\n\tif (*p == '/') {\n\t\t*new_txt++ = *p++;\n//fixme: latin names not treated\n\t\tq = strchr(note_names, *p);\n\t\tif (q) {\n\t\t\tp++;\n\t\t\tn = q - note_names;\n\t\t\tif (*p == '#') {\n\t\t\t\ta = 1;\n\t\t\t\tp++;\n\t\t\t} else if (*p == 'b') {\n\t\t\t\ta = -1;\n\t\t\t\tp++;\n\t\t\t} else {\n\t\t\t\ta = 0;\n\t\t\t}\n\t\t\ti3 = cde2fcg[n] + i2 + a * 7;\n\t\t\ti4 = cgd2cde[(unsigned) ((i3 + 16 * 7) % 7)];\n\t\t\ti1 = ((i3 + 1 + 21) / 7 + 2 - 3 + 32 * 5) % 5;\n\t\t\t*new_txt++ = note_names[i4];\n\t\t\tnew_txt += sprintf(new_txt, \"%s\", acc_name[i1]);\n\t\t}\n\t}\n\tstrcpy(new_txt, p);\n}",
  12961. "project": "abcm2ps",
  12962. "hash": 224800842001487088171705246081088169612,
  12963. "size": 127,
  12964. "commit_id": "2f56e1179cab6affeb8afa9d6c324008fe40d8e3",
  12965. "message": "fix: array overflow when wrong duration in voice overlay\n\nIssue #83,",
  12966. "target": 0,
  12967. "dataset": "other",
  12968. "idx": 484345
  12969. }
  12970. ]
  12971. },
  12972. {
  12973. "call_depth": 3,
  12974. "longest_call_chain": [
  12975. "ff_layout_write_prepare_v3",
  12976. "ff_layout_write_prepare_common",
  12977. "ff_layout_write_record_layoutstats_start"
  12978. ],
  12979. "group_size": 4,
  12980. "functions": [
  12981. {
  12982. "func": "static int ff_layout_write_prepare_common(struct rpc_task *task,\n\t\t\t\t\t struct nfs_pgio_header *hdr)\n{\n\tif (unlikely(test_bit(NFS_CONTEXT_BAD, &hdr->args.context->flags))) {\n\t\trpc_exit(task, -EIO);\n\t\treturn -EIO;\n\t}\n\n\tff_layout_write_record_layoutstats_start(task, hdr);\n\treturn 0;\n}",
  12983. "project": "linux",
  12984. "hash": 228977133502718801944665082827458300360,
  12985. "size": 11,
  12986. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  12987. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  12988. "target": 0,
  12989. "dataset": "other",
  12990. "idx": 234445
  12991. },
  12992. {
  12993. "func": "static void ff_layout_write_prepare_v3(struct rpc_task *task, void *data)\n{\n\tstruct nfs_pgio_header *hdr = data;\n\n\tif (ff_layout_write_prepare_common(task, hdr))\n\t\treturn;\n\n\trpc_call_start(task);\n}",
  12994. "project": "linux",
  12995. "hash": 285423836771742919166407497962034331057,
  12996. "size": 9,
  12997. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  12998. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  12999. "target": 0,
  13000. "dataset": "other",
  13001. "idx": 234406
  13002. },
  13003. {
  13004. "func": "static void ff_layout_write_prepare_v4(struct rpc_task *task, void *data)\n{\n\tstruct nfs_pgio_header *hdr = data;\n\n\tif (nfs4_setup_sequence(hdr->ds_clp,\n\t\t\t\t&hdr->args.seq_args,\n\t\t\t\t&hdr->res.seq_res,\n\t\t\t\ttask))\n\t\treturn;\n\n\tff_layout_write_prepare_common(task, hdr);\n}",
  13005. "project": "linux",
  13006. "hash": 235163627451101528740660611843223898594,
  13007. "size": 12,
  13008. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  13009. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  13010. "target": 0,
  13011. "dataset": "other",
  13012. "idx": 234485
  13013. },
  13014. {
  13015. "func": "static void ff_layout_write_record_layoutstats_start(struct rpc_task *task,\n\t\tstruct nfs_pgio_header *hdr)\n{\n\tif (test_and_set_bit(NFS_IOHDR_STAT, &hdr->flags))\n\t\treturn;\n\tnfs4_ff_layout_stat_io_start_write(hdr->inode,\n\t\t\tFF_LAYOUT_COMP(hdr->lseg, hdr->pgio_mirror_idx),\n\t\t\thdr->args.count,\n\t\t\ttask->tk_start);\n}",
  13016. "project": "linux",
  13017. "hash": 310135400152460850835504622207794171768,
  13018. "size": 10,
  13019. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  13020. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  13021. "target": 0,
  13022. "dataset": "other",
  13023. "idx": 234490
  13024. }
  13025. ]
  13026. },
  13027. {
  13028. "call_depth": 5,
  13029. "longest_call_chain": [
  13030. "av1dmx_process",
  13031. "av1dmx_process_buffer",
  13032. "av1dmx_parse_vp9",
  13033. "av1dmx_check_pid",
  13034. "av1dmx_check_dur"
  13035. ],
  13036. "group_size": 12,
  13037. "functions": [
  13038. {
  13039. "func": "GF_Err av1dmx_parse_av1(GF_Filter *filter, GF_AV1DmxCtx *ctx)\n{\n\tGF_Err e = GF_OK;\n\tu64 start;\n\n\tif (!ctx->is_playing) {\n\t\tctx->state.frame_state.is_first_frame = GF_TRUE;\n\t}\n\n\t/*we process each TU and extract only the necessary OBUs*/\n\tstart = gf_bs_get_position(ctx->bs);\n\tswitch (ctx->bsmode) {\n\tcase OBUs:\n\t\t//first frame loaded !\n\t\tif (ctx->state.bs && gf_bs_get_position(ctx->state.bs) && (ctx->state.obu_type == OBU_TEMPORAL_DELIMITER)) {\n\t\t\te = GF_OK;\n\t\t} else {\n\t\t\te = aom_av1_parse_temporal_unit_from_section5(ctx->bs, &ctx->state);\n\t\t}\n\t\tbreak;\n\tcase AnnexB:\n\t\t//first TU loaded !\n\t\tif (ctx->state.bs && gf_bs_get_position(ctx->state.bs)) {\n\t\t\te = GF_OK;\n\t\t} else {\n\t\t\te = aom_av1_parse_temporal_unit_from_annexb(ctx->bs, &ctx->state);\n\t\t\tif (e==GF_BUFFER_TOO_SMALL) {\n\t\t\t\tgf_av1_reset_state(&ctx->state, GF_FALSE);\n\t\t\t\tgf_bs_seek(ctx->bs, start);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\tcase IVF:\n\t\t//first frame loaded !\n\t\tif (ctx->state.bs && gf_bs_get_position(ctx->state.bs)) {\n\t\t\te = GF_OK;\n\t\t} else {\n\t\t\te = aom_av1_parse_temporal_unit_from_ivf(ctx->bs, &ctx->state);\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\te = GF_NOT_SUPPORTED;\n\t}\n\n\t//check pid state\n\tav1dmx_check_pid(filter, ctx);\n\n\tif (e) return e;\n\n\n\tif (!ctx->opid) {\n\t\tif (ctx->state.obu_type != OBU_TEMPORAL_DELIMITER) {\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (\"[AV1Dmx] output pid not configured (no sequence header yet ?), skipping OBU\\n\"));\n\t\t}\n\t\tgf_av1_reset_state(&ctx->state, GF_FALSE);\n\t\treturn GF_OK;\n\t}\n\n\tif (!ctx->is_playing) {\n\t\t//don't reset state we would skip seq header obu in first frame\n\t\t//gf_av1_reset_state(&ctx->state, GF_FALSE);\n\t\treturn GF_OK;\n\t}\n\n\treturn av1dmx_parse_flush_sample(filter, ctx);\n\n}",
  13040. "project": "gpac",
  13041. "hash": 273581855298955648091568900274325479606,
  13042. "size": 67,
  13043. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13044. "message": "fixed #1719",
  13045. "target": 0,
  13046. "dataset": "other",
  13047. "idx": 236220
  13048. },
  13049. {
  13050. "func": "static void av1dmx_check_pid(GF_Filter *filter, GF_AV1DmxCtx *ctx)\n{\n\tu8 *dsi;\n\tu32 dsi_size, crc;\n\n\t//no config or no config change\n\tif (ctx->is_av1 && !gf_list_count(ctx->state.frame_state.header_obus)) return;\n\n\tif (!ctx->opid) {\n\t\tctx->opid = gf_filter_pid_new(filter);\n\t\tav1dmx_check_dur(filter, ctx);\n\t}\n\tdsi = NULL;\n\tdsi_size = 0;\n\n\tif (ctx->vp_cfg) {\n\t\tgf_odf_vp_cfg_write(ctx->vp_cfg, &dsi, &dsi_size, ctx->vp_cfg->codec_initdata_size ? GF_TRUE : GF_FALSE);\n\t} else if (ctx->is_av1) {\n\t\t//first or config changed, compute dsi\n\t\twhile (gf_list_count(ctx->state.config->obu_array)) {\n\t\t\tGF_AV1_OBUArrayEntry *a = (GF_AV1_OBUArrayEntry*) gf_list_pop_back(ctx->state.config->obu_array);\n\t\t\tif (a->obu) gf_free(a->obu);\n\t\t\tgf_free(a);\n\t\t}\n\t\tdsi = NULL;\n\t\tdsi_size = 0;\n\t\twhile (gf_list_count(ctx->state.frame_state.header_obus)) {\n\t\t\tGF_AV1_OBUArrayEntry *a = (GF_AV1_OBUArrayEntry*) gf_list_get(ctx->state.frame_state.header_obus, 0);\n\t\t\tgf_list_add(ctx->state.config->obu_array, a);\n\t\t\tgf_list_rem(ctx->state.frame_state.header_obus, 0);\n\t\t}\n\t\tgf_odf_av1_cfg_write(ctx->state.config, &dsi, &dsi_size);\n\n\t\tif ((!ctx->fps.num || !ctx->fps.den) && ctx->state.tb_num && ctx->state.tb_den && ! ( (ctx->state.tb_num<=1) && (ctx->state.tb_den<=1) ) ) {\n\t\t\tctx->cur_fps.num = ctx->state.tb_num;\n\t\t\tctx->cur_fps.den = ctx->state.tb_den;\n\t\t}\n\n\t}\n\tcrc = gf_crc_32(dsi, dsi_size);\n\n\tif (crc == ctx->dsi_crc) {\n\t\tgf_free(dsi);\n\t\treturn;\n\t}\n\tctx->dsi_crc = crc;\n\n\t//copy properties at init or reconfig\n\tgf_filter_pid_copy_properties(ctx->opid, ctx->ipid);\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_STREAM_TYPE, & PROP_UINT(GF_STREAM_VISUAL));\n\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_CODECID, & PROP_UINT(ctx->codecid));\n\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_TIMESCALE, & PROP_UINT(ctx->cur_fps.num));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_FPS, & PROP_FRAC(ctx->cur_fps));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_WIDTH, & PROP_UINT(ctx->state.width));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_HEIGHT, & PROP_UINT(ctx->state.height));\n\n\tif (ctx->duration.num)\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DURATION, & PROP_FRAC64(ctx->duration));\n\n\tif (ctx->bitrate) {\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_BITRATE, & PROP_UINT(ctx->bitrate));\n\t}\n\n\tif (dsi && dsi_size)\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DECODER_CONFIG, & PROP_DATA_NO_COPY(dsi, dsi_size));\n\n\tif (ctx->is_file && ctx->index) {\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_PLAYBACK_MODE, & PROP_UINT(GF_PLAYBACK_MODE_FASTFORWARD) );\n\t}\n\n\tif (ctx->is_av1) {\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_COLR_PRIMARIES, & PROP_UINT(ctx->state.color_primaries) );\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_COLR_TRANSFER, & PROP_UINT(ctx->state.transfer_characteristics) );\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_COLR_MX, & PROP_UINT(ctx->state.matrix_coefficients) );\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_COLR_RANGE, & PROP_BOOL(ctx->state.color_range) );\n\t}\n}",
  13051. "project": "gpac",
  13052. "hash": 179205899928458533149058165491804929493,
  13053. "size": 79,
  13054. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13055. "message": "fixed #1719",
  13056. "target": 0,
  13057. "dataset": "other",
  13058. "idx": 236214
  13059. },
  13060. {
  13061. "func": "GF_Err av1dmx_parse_vp9(GF_Filter *filter, GF_AV1DmxCtx *ctx)\n{\n\tBool key_frame = GF_FALSE;\n\tu64 frame_size = 0, pts = 0;\n\tu64 pos, pos_ivf_hdr;\n\tu32 width = 0, height = 0, renderWidth, renderHeight;\n\tu32 num_frames_in_superframe = 0, superframe_index_size = 0, i = 0;\n\tu32 frame_sizes[VP9_MAX_FRAMES_IN_SUPERFRAME];\n\tu8 *output;\n\tGF_Err e;\n\n\tpos_ivf_hdr = gf_bs_get_position(ctx->bs);\n\te = gf_media_parse_ivf_frame_header(ctx->bs, &frame_size, &pts);\n\tif (e) return e;\n\n\tpos = gf_bs_get_position(ctx->bs);\n\tif (gf_bs_available(ctx->bs) < frame_size) {\n\t\tgf_bs_seek(ctx->bs, pos_ivf_hdr);\n\t\treturn GF_EOS;\n\t}\n\n\tif (ctx->pts_from_file) {\n\t\tpts += ctx->cumulated_dur;\n\t\tif (ctx->last_pts && (ctx->last_pts>pts)) {\n\t\t\tpts -= ctx->cumulated_dur;\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[IVF/VP9] Corrupted timestamp \"LLU\" less than previous timestamp \"LLU\", assuming concatenation\\n\", pts, ctx->last_pts));\n\t\t\tctx->cumulated_dur = ctx->last_pts + ctx->cur_fps.den;\n\t\t\tctx->cumulated_dur -= pts;\n\t\t\tpts = ctx->cumulated_dur;\n\t\t}\n\t\tctx->last_pts = pts;\n\t}\n\n\t/*check if it is a superframe*/\n\te = gf_media_vp9_parse_superframe(ctx->bs, frame_size, &num_frames_in_superframe, frame_sizes, &superframe_index_size);\n\tif (e) {\n\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, (\"[VP9Dmx] Error parsing superframe structure\\n\"));\n\t\treturn e;\n\t}\n\n\tfor (i = 0; i < num_frames_in_superframe; ++i) {\n\t\tu64 pos2 = gf_bs_get_position(ctx->bs);\n\t\tif (gf_media_vp9_parse_sample(ctx->bs, ctx->vp_cfg, &key_frame, &width, &height, &renderWidth, &renderHeight) != GF_OK) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, (\"[VP9Dmx] Error parsing frame\\n\"));\n\t\t\treturn e;\n\t\t}\n\t\te = gf_bs_seek(ctx->bs, pos2 + frame_sizes[i]);\n\t\tif (e) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, (\"[VP9Dmx] Seek bad param (offset \"LLU\") (1)\", pos2 + frame_sizes[i]));\n\t\t\treturn e;\n\t\t}\n\t}\n\tif (gf_bs_get_position(ctx->bs) + superframe_index_size != pos + frame_size) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[VP9Dmx] Inconsistent IVF frame size of \"LLU\" bytes.\\n\", frame_size));\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\" Detected %d frames (+ %d bytes for the superframe index):\\n\", num_frames_in_superframe, superframe_index_size));\n\t\tfor (i = 0; i < num_frames_in_superframe; ++i) {\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\" superframe %d, size is %u bytes\\n\", i, frame_sizes[i]));\n\t\t}\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"\\n\"));\n\t}\n\te = gf_bs_seek(ctx->bs, pos + frame_size);\n\tif (e) {\n\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[VP9Dmx] Seek bad param (offset \"LLU\") (2)\", pos + frame_size));\n\t\treturn e;\n\t}\n\n\tu32 pck_size = (u32)(gf_bs_get_position(ctx->bs) - pos);\n\tassert(pck_size == frame_size);\n\n\t//check pid state\n\tav1dmx_check_pid(filter, ctx);\n\n\tif (!ctx->opid) {\n\t\treturn GF_OK;\n\t}\n\n\tif (!ctx->is_playing) {\n\t\tgf_bs_seek(ctx->bs, pos_ivf_hdr);\n\t\treturn GF_EOS;\n\t}\n\n\tGF_FilterPacket *pck = gf_filter_pck_new_alloc(ctx->opid, pck_size, &output);\n\tif (!pck) {\n\t\tgf_bs_seek(ctx->bs, pos_ivf_hdr);\n\t\treturn GF_OUT_OF_MEM;\n\t}\n\tif (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, pck);\n\n\tif (ctx->pts_from_file) {\n\t\tgf_filter_pck_set_cts(pck, pts);\n\t} else {\n\t\tgf_filter_pck_set_cts(pck, ctx->cts);\n\t}\n\n\n\tif (key_frame) {\n\t\tgf_filter_pck_set_sap(pck, GF_FILTER_SAP_1);\n\t}\n\n\tif (ctx->deps) {\n\t\tu8 flags = 0;\n\t\t//dependsOn\n\t\tflags = (key_frame) ? 2 : 1;\n\t\tflags <<= 2;\n\t\t//dependedOn\n\t\t//flags |= 2;\n\t\tflags <<= 2;\n\t\t//hasRedundant\n\t\t//flags |= ctx->has_redundant ? 1 : 2;\n\t\tgf_filter_pck_set_dependency_flags(pck, flags);\n\t}\n\n\tgf_bs_seek(ctx->bs, pos);\n\tgf_bs_read_data(ctx->bs, output, pck_size);\n\tgf_filter_pck_send(pck);\n\n\tav1dmx_update_cts(ctx);\n\treturn GF_OK;\n}",
  13062. "project": "gpac",
  13063. "hash": 62713025403556402800888009357318149177,
  13064. "size": 119,
  13065. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13066. "message": "fixed #1719",
  13067. "target": 0,
  13068. "dataset": "other",
  13069. "idx": 236215
  13070. },
  13071. {
  13072. "func": "static Bool av1dmx_process_event(GF_Filter *filter, const GF_FilterEvent *evt)\n{\n\tu32 i;\n\tu64 file_pos = 0;\n\tGF_FilterEvent fevt;\n\tGF_AV1DmxCtx *ctx = gf_filter_get_udta(filter);\n\n\tswitch (evt->base.type) {\n\tcase GF_FEVT_PLAY:\n\t\tif (!ctx->is_playing) {\n\t\t\tctx->is_playing = GF_TRUE;\n\t\t\tctx->cts = 0;\n\t\t}\n\t\tif (! ctx->is_file) {\n\t\t\tctx->buf_size = 0;\n\t\t\treturn GF_FALSE;\n\t\t}\n\t\tctx->start_range = evt->play.start_range;\n\t\tctx->in_seek = GF_TRUE;\n\n\t\tif (ctx->start_range) {\n\n\t\t\tif (ctx->index<0) {\n\t\t\t\tctx->index = -ctx->index;\n\t\t\t\tctx->file_loaded = GF_FALSE;\n\t\t\t\tctx->duration.den = ctx->duration.num = 0;\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_PARSER, (\"[AV1/VP9Demx] Play request from %d, building index\\n\", ctx->start_range));\n\t\t\t\tav1dmx_check_dur(filter, ctx);\n\t\t\t}\n\n\t\t\tfor (i=1; i<ctx->index_size; i++) {\n\t\t\t\tif (ctx->indexes[i].duration>ctx->start_range) {\n\t\t\t\t\tctx->cts = (u64) (ctx->indexes[i-1].duration * ctx->cur_fps.num);\n\t\t\t\t\tfile_pos = ctx->indexes[i-1].pos;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!ctx->initial_play_done) {\n\t\t\tctx->initial_play_done = GF_TRUE;\n\t\t\t//seek will not change the current source state, don't send a seek\n\t\t\tif (!file_pos)\n\t\t\t\treturn GF_TRUE;\n\t\t}\n\t\tctx->buf_size = 0;\n\t\tif (!file_pos)\n\t\t\tfile_pos = ctx->file_hdr_size;\n\n\t\t//post a seek\n\t\tGF_FEVT_INIT(fevt, GF_FEVT_SOURCE_SEEK, ctx->ipid);\n\t\tfevt.seek.start_offset = file_pos;\n\t\tgf_filter_pid_send_event(ctx->ipid, &fevt);\n\n\t\t//cancel event\n\t\treturn GF_TRUE;\n\n\tcase GF_FEVT_STOP:\n\t\t//don't cancel event\n\t\tctx->is_playing = GF_FALSE;\n\t\treturn GF_FALSE;\n\n\tcase GF_FEVT_SET_SPEED:\n\t\t//cancel event\n\t\treturn GF_TRUE;\n\tdefault:\n\t\tbreak;\n\t}\n\t//by default don't cancel event - to rework once we have downloading in place\n\treturn GF_FALSE;\n}",
  13073. "project": "gpac",
  13074. "hash": 151199563419142864109547595778322536027,
  13075. "size": 70,
  13076. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13077. "message": "fixed #1719",
  13078. "target": 0,
  13079. "dataset": "other",
  13080. "idx": 236219
  13081. },
  13082. {
  13083. "func": "GF_Err av1dmx_process_buffer(GF_Filter *filter, GF_AV1DmxCtx *ctx, const char *data, u32 data_size, Bool is_copy)\n{\n\tu32 last_obu_end = 0;\n\tGF_Err e = GF_OK;\n\n\tif (!ctx->bs) ctx->bs = gf_bs_new(data, data_size, GF_BITSTREAM_READ);\n\telse gf_bs_reassign_buffer(ctx->bs, data, data_size);\n\n#ifndef GPAC_DISABLE_LOG\n\tif (ctx->bsdbg && gf_log_tool_level_on(GF_LOG_PARSER, GF_LOG_DEBUG))\n\t\tgf_bs_set_logger(ctx->bs, av1dmx_bs_log, ctx);\n#endif\n\n\t//check ivf vs obu vs annexB\n\te = av1dmx_check_format(filter, ctx, ctx->bs, &last_obu_end);\n\tif (e) return e;\n\n\twhile (gf_bs_available(ctx->bs)) {\n\n\t\tif (ctx->is_vp9) {\n\t\t\te = av1dmx_parse_vp9(filter, ctx);\n\t\t} else if (ctx->is_av1) {\n\t\t\te = av1dmx_parse_av1(filter, ctx);\n\t\t} else {\n\t\t\te = av1dmx_parse_ivf(filter, ctx);\n\t\t}\n\n\t\tif (e!=GF_EOS)\n\t\t\tlast_obu_end = (u32) gf_bs_get_position(ctx->bs);\n\n\t\tif (e) {\n\t\t\tbreak;\n\t\t}\n\t\tif (!ctx->is_playing && ctx->opid)\n\t\t\tbreak;\n\t}\n\n\tif (is_copy && last_obu_end) {\n\t\tassert(ctx->buf_size>=last_obu_end);\n\t\tmemmove(ctx->buffer, ctx->buffer+last_obu_end, sizeof(char) * (ctx->buf_size-last_obu_end));\n\t\tctx->buf_size -= last_obu_end;\n\t}\n\tif (e==GF_EOS) return GF_OK;\n\tif (e==GF_BUFFER_TOO_SMALL) return GF_OK;\n\treturn e;\n}",
  13084. "project": "gpac",
  13085. "hash": 235484317529668612746088331136118347502,
  13086. "size": 46,
  13087. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13088. "message": "fixed #1719",
  13089. "target": 0,
  13090. "dataset": "other",
  13091. "idx": 236222
  13092. },
  13093. {
  13094. "func": "GF_Err av1dmx_check_format(GF_Filter *filter, GF_AV1DmxCtx *ctx, GF_BitStream *bs, u32 *last_obu_end)\n{\n\tGF_Err e;\n\tif (last_obu_end) (*last_obu_end) = 0;\n\t//probing av1 bs mode\n\tif (ctx->bsmode != NOT_SET) return GF_OK;\n\n\n\tif (!ctx->state.config)\n\t\tctx->state.config = gf_odf_av1_cfg_new();\n\n\tctx->is_av1 = ctx->is_vp9 = ctx->is_vpX = GF_FALSE;\n\tctx->codecid = 0;\n\tif (ctx->vp_cfg) gf_odf_vp_cfg_del(ctx->vp_cfg);\n\tctx->vp_cfg = NULL;\n\tctx->cur_fps = ctx->fps;\n\tif (!ctx->fps.num || !ctx->fps.den) {\n\t\tctx->cur_fps.num = 25000;\n\t\tctx->cur_fps.den = 1000;\n\t}\n\n\tctx->pts_from_file = GF_FALSE;\n\tif (gf_media_probe_ivf(bs)) {\n\t\tu32 width = 0, height = 0;\n\t\tu32 codec_fourcc = 0, timebase_den = 0, timebase_num = 0, num_frames = 0;\n\t\tctx->bsmode = IVF;\n\n\t\te = gf_media_parse_ivf_file_header(bs, &width, &height, &codec_fourcc, &timebase_num, &timebase_den, &num_frames);\n\t\tif (e) return e;\n\n\t\tswitch (codec_fourcc) {\n\t\tcase GF_4CC('A', 'V', '0', '1'):\n\t\t\tctx->is_av1 = GF_TRUE;\n\t\t\tctx->codecid = GF_CODECID_AV1;\n\t\t\tbreak;\n\t\tcase GF_4CC('V', 'P', '9', '0'):\n\t\t\tctx->is_vp9 = GF_TRUE;\n\t\t\tctx->codecid = GF_CODECID_VP9;\n\t\t\tctx->vp_cfg = gf_odf_vp_cfg_new();\n\t\t\tbreak;\n\t\tcase GF_4CC('V', 'P', '8', '0'):\n\t\t\tctx->codecid = GF_CODECID_VP8;\n\t\t\tctx->vp_cfg = gf_odf_vp_cfg_new();\n\t\t\tbreak;\n\t\tcase GF_4CC('V', 'P', '1', '0'):\n\t\t\tctx->codecid = GF_CODECID_VP10;\n\t\t\tctx->vp_cfg = gf_odf_vp_cfg_new();\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[IVF] %s parsing not implemented, import might be uncomplete or broken\\n\", gf_4cc_to_str(codec_fourcc) ));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tctx->codecid = codec_fourcc;\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[IVF] Unsupported codec FourCC %s\\n\", gf_4cc_to_str(codec_fourcc) ));\n\t\t\treturn GF_NON_COMPLIANT_BITSTREAM;\n\t\t}\n\t\tif (ctx->vp_cfg && !ctx->is_vp9) {\n\t\t\tctx->is_vpX = GF_TRUE;\n\t\t\tctx->vp_cfg->profile = 1;\n\t\t\tctx->vp_cfg->level = 10;\n\t\t\tctx->vp_cfg->bit_depth = 8;\n\t\t\t//leave the rest as 0\n\t\t}\n\n\t\tctx->state.width = ctx->state.width < width ? width : ctx->state.width;\n\t\tctx->state.height = ctx->state.height < height ? height : ctx->state.height;\n\t\tctx->state.tb_num = timebase_num;\n\t\tctx->state.tb_den = timebase_den;\n\n\t\tif ((!ctx->fps.num || !ctx->fps.den) && ctx->state.tb_num && ctx->state.tb_den && ! ( (ctx->state.tb_num<=1) && (ctx->state.tb_den<=1) ) ) {\n\t\t\tctx->cur_fps.num = ctx->state.tb_num;\n\t\t\tctx->cur_fps.den = ctx->state.tb_den;\n\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_PARSER, (\"[AV1Dmx] Detected IVF format FPS %d/%d\\n\", ctx->cur_fps.num, ctx->cur_fps.den));\n\t\t\tctx->pts_from_file = GF_TRUE;\n\t\t} else {\n\t\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_PARSER, (\"[AV1Dmx] Detected IVF format\\n\"));\n\t\t}\n\t\tctx->file_hdr_size = (u32) gf_bs_get_position(bs);\n\t\tif (last_obu_end) (*last_obu_end) = (u32) gf_bs_get_position(bs);\n\t\treturn GF_OK;\n\t} else if (gf_media_aom_probe_annexb(bs)) {\n\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[AV1Dmx] Detected Annex B format\\n\"));\n\t\tctx->bsmode = AnnexB;\n\t} else {\n\t\tgf_bs_seek(bs, 0);\n\t\te = aom_av1_parse_temporal_unit_from_section5(bs, &ctx->state);\n\t\tif (e && !gf_list_count(ctx->state.frame_state.frame_obus) ) {\n\t\t\tgf_filter_setup_failure(filter, e);\n\t\t\tctx->bsmode = UNSUPPORTED;\n\t\t\treturn e;\n\t\t}\n\t\tif (ctx->state.obu_type != OBU_TEMPORAL_DELIMITER) {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (\"[AV1Dmx] Error OBU stream start with %s, not a temporal delimiter - NOT SUPPORTED\\n\", gf_av1_get_obu_name(ctx->state.obu_type) ));\n\t\t\tgf_filter_setup_failure(filter, e);\n\t\t\tctx->bsmode = UNSUPPORTED;\n\t\t\treturn e;\n\t\t}\n\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[AV1Dmx] Detected OBUs Section 5 format\\n\"));\n\t\tctx->bsmode = OBUs;\n\n\t\tgf_av1_reset_state(&ctx->state, GF_FALSE);\n\t\tgf_bs_seek(bs, 0);\n\t}\n\tctx->is_av1 = GF_TRUE;\n\tctx->state.unframed = GF_TRUE;\n\tctx->codecid = GF_CODECID_AV1;\n\treturn GF_OK;\n}",
  13095. "project": "gpac",
  13096. "hash": 38647925056818503378120941409175055268,
  13097. "size": 106,
  13098. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13099. "message": "fixed #1719",
  13100. "target": 0,
  13101. "dataset": "other",
  13102. "idx": 236221
  13103. },
  13104. {
  13105. "func": "static void av1dmx_check_dur(GF_Filter *filter, GF_AV1DmxCtx *ctx)\n{\n\tFILE *stream;\n\tGF_Err e;\n\tGF_BitStream *bs;\n\tu64 duration, cur_dur, last_cdur, rate;\n\tAV1State av1state;\n\tconst char *filepath=NULL;\n\tconst GF_PropertyValue *p;\n\tif (!ctx->opid || ctx->timescale || ctx->file_loaded) return;\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_FILE_CACHED);\n\tif (p && p->value.boolean) ctx->file_loaded = GF_TRUE;\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_FILEPATH);\n\tif (!p || !p->value.string || !strncmp(p->value.string, \"gmem://\", 7)) {\n\t\tctx->is_file = GF_FALSE;\n\t\tctx->file_loaded = GF_TRUE;\n\t\treturn;\n\t}\n\tfilepath = p->value.string;\n\tctx->is_file = GF_TRUE;\n\n\tif (ctx->index<0) {\n\t\tif (gf_opts_get_bool(\"temp\", \"force_indexing\")) {\n\t\t\tctx->index = 1.0;\n\t\t} else {\n\t\t\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_DOWN_SIZE);\n\t\t\tif (!p || (p->value.longuint > 100000000)) {\n\t\t\t\tGF_LOG(GF_LOG_INFO, GF_LOG_PARSER, (\"[AV1/VP9] Source file larger than 100M, skipping indexing\\n\"));\n\t\t\t} else {\n\t\t\t\tctx->index = -ctx->index;\n\t\t\t}\n\t\t}\n\t}\n\tif (ctx->index<=0)\n\t\treturn;\n\n\tstream = gf_fopen(filepath, \"rb\");\n\tif (!stream) return;\n\n\tctx->index_size = 0;\n\n\tbs = gf_bs_from_file(stream, GF_BITSTREAM_READ);\n\n\tif (ctx->file_hdr_size) {\n\t\tgf_bs_seek(bs, ctx->file_hdr_size);\n\t}\n\tgf_av1_init_state(&av1state);\n\tav1state.skip_frames = GF_TRUE;\n\tav1state.config = gf_odf_av1_cfg_new();\n\n\tduration = 0;\n\tcur_dur = last_cdur = 0;\n\twhile (gf_bs_available(bs)) {\n\t\tBool is_sap=GF_FALSE;\n\t\tu64 pts = GF_FILTER_NO_TS;\n\t\tu64 frame_start = gf_bs_get_position(bs);\n\t\tgf_av1_reset_state(&av1state, GF_FALSE);\n\n\t\t/*we process each TU and extract only the necessary OBUs*/\n\t\tswitch (ctx->bsmode) {\n\t\tcase OBUs:\n\t\t\te = aom_av1_parse_temporal_unit_from_section5(bs, &av1state);\n\t\t\tbreak;\n\t\tcase AnnexB:\n\t\t\te = aom_av1_parse_temporal_unit_from_annexb(bs, &av1state);\n\t\t\tbreak;\n\t\tcase IVF:\n\t\t\tif (ctx->is_av1) {\n\t\t\t\te = aom_av1_parse_temporal_unit_from_ivf(bs, &av1state);\n\t\t\t} else {\n\t\t\t\tu64 frame_size;\n\t\t\t\te = gf_media_parse_ivf_frame_header(bs, &frame_size, &pts);\n\t\t\t\tif (!e) gf_bs_skip_bytes(bs, frame_size);\n\t\t \t\tis_sap = GF_TRUE;\n\t\t\t}\n\t\t\tbreak;\n\t\tdefault:\n\t\t\te = GF_NOT_SUPPORTED;\n\t\t}\n\t\tif (e)\n\t\t \tbreak;\n\n\t\tif (pts != GF_FILTER_NO_TS) {\n\t\t\tduration = pts;\n\t\t\tcur_dur = pts - last_cdur;\n\t\t} else {\n\t\t\tduration += ctx->cur_fps.den;\n\t\t\tcur_dur += ctx->cur_fps.den;\n\t\t}\n\t\tif (av1state.frame_state.key_frame)\n\t\t \tis_sap = GF_TRUE;\n\n\t\t//only index at I-frame start\n\t\tif (frame_start && is_sap && (cur_dur > ctx->index * ctx->cur_fps.num) ) {\n\t\t\tif (!ctx->index_alloc_size) ctx->index_alloc_size = 10;\n\t\t\telse if (ctx->index_alloc_size == ctx->index_size) ctx->index_alloc_size *= 2;\n\t\t\tctx->indexes = gf_realloc(ctx->indexes, sizeof(AV1Idx)*ctx->index_alloc_size);\n\t\t\tctx->indexes[ctx->index_size].pos = frame_start;\n\t\t\tctx->indexes[ctx->index_size].duration = (Double) duration;\n\t\t\tctx->indexes[ctx->index_size].duration /= ctx->cur_fps.num;\n\t\t\tctx->index_size ++;\n\t\t\tlast_cdur = cur_dur;\n\t\t\tcur_dur = 0;\n\t\t}\n\t}\n\trate = gf_bs_get_position(bs);\n\tgf_bs_del(bs);\n\tgf_fclose(stream);\n\tgf_odf_av1_cfg_del(av1state.config);\n\tgf_av1_reset_state(&av1state, GF_TRUE);\n\n\tif (!ctx->duration.num || (ctx->duration.num * ctx->cur_fps.num != duration * ctx->duration.den)) {\n\t\tctx->duration.num = (s32) duration;\n\t\tctx->duration.den = ctx->cur_fps.num;\n\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DURATION, & PROP_FRAC64(ctx->duration));\n\n\t\tif (duration && (!gf_sys_is_test_mode() || gf_opts_get_bool(\"temp\", \"force_indexing\"))) {\n\t\t\trate *= 8 * ctx->duration.den;\n\t\t\trate /= ctx->duration.num;\n\t\t\tctx->bitrate = (u32) rate;\n\t\t}\n\t}\n\n\t//currently not supported because of OBU size field rewrite - could work on some streams but we would\n\t//need to analyse all OBUs in the stream for that\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_CAN_DATAREF, & PROP_BOOL(GF_FALSE) );\n}",
  13106. "project": "gpac",
  13107. "hash": 66527526371699850120185361290627456561,
  13108. "size": 130,
  13109. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13110. "message": "fixed #1719",
  13111. "target": 0,
  13112. "dataset": "other",
  13113. "idx": 236213
  13114. },
  13115. {
  13116. "func": "static GFINLINE void av1dmx_update_cts(GF_AV1DmxCtx *ctx)\n{\n\tassert(ctx->cur_fps.num);\n\tassert(ctx->cur_fps.den);\n\n\tif (ctx->timescale) {\n\t\tu64 inc = ctx->cur_fps.den;\n\t\tinc *= ctx->timescale;\n\t\tinc /= ctx->cur_fps.num;\n\t\tctx->cts += inc;\n\t} else {\n\t\tctx->cts += ctx->cur_fps.den;\n\t}\n}",
  13117. "project": "gpac",
  13118. "hash": 126064430894865554566167737951610950196,
  13119. "size": 14,
  13120. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13121. "message": "fixed #1719",
  13122. "target": 0,
  13123. "dataset": "other",
  13124. "idx": 236212
  13125. },
  13126. {
  13127. "func": "static GF_Err av1dmx_parse_flush_sample(GF_Filter *filter, GF_AV1DmxCtx *ctx)\n{\n\tu32 pck_size;\n\tGF_FilterPacket *pck;\n\tu8 *output;\n\n\tgf_bs_get_content_no_truncate(ctx->state.bs, &ctx->state.frame_obus, &pck_size, &ctx->state.frame_obus_alloc);\n\n\tif (!pck_size) {\n\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[AV1Dmx] no frame OBU, skipping OBU\\n\"));\n\t\treturn GF_OK;\n\t}\n\n\tpck = gf_filter_pck_new_alloc(ctx->opid, pck_size, &output);\n\tif (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, pck);\n\n\tgf_filter_pck_set_cts(pck, ctx->cts);\n\tgf_filter_pck_set_sap(pck, ctx->state.frame_state.key_frame ? GF_FILTER_SAP_1 : 0);\n\n\tmemcpy(output, ctx->state.frame_obus, pck_size);\n\n\tif (ctx->deps) {\n\t\tu8 flags = 0;\n\t\t//dependsOn\n\t\tflags = ( ctx->state.frame_state.key_frame) ? 2 : 1;\n\t\tflags <<= 2;\n\t\t//dependedOn\n\t \tflags |= ctx->state.frame_state.refresh_frame_flags ? 1 : 2;\n\t\tflags <<= 2;\n\t\t//hasRedundant\n\t \t//flags |= ctx->has_redundant ? 1 : 2;\n\t \tgf_filter_pck_set_dependency_flags(pck, flags);\n\t}\n\n\tgf_filter_pck_send(pck);\n\n\tav1dmx_update_cts(ctx);\n\tgf_av1_reset_state(&ctx->state, GF_FALSE);\n\n\treturn GF_OK;\n\n}",
  13128. "project": "gpac",
  13129. "hash": 124123704759614734447704073729222685997,
  13130. "size": 42,
  13131. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13132. "message": "fixed #1719",
  13133. "target": 1,
  13134. "dataset": "other",
  13135. "idx": 195985
  13136. },
  13137. {
  13138. "func": "static GF_Err av1dmx_parse_flush_sample(GF_Filter *filter, GF_AV1DmxCtx *ctx)\n{\n\tu32 pck_size;\n\tGF_FilterPacket *pck;\n\tu8 *output;\n\n\tif (!ctx->opid)\n\t\treturn GF_NON_COMPLIANT_BITSTREAM;\n\t\t\n\tgf_bs_get_content_no_truncate(ctx->state.bs, &ctx->state.frame_obus, &pck_size, &ctx->state.frame_obus_alloc);\n\n\tif (!pck_size) {\n\t\tGF_LOG(GF_LOG_DEBUG, GF_LOG_CONTAINER, (\"[AV1Dmx] no frame OBU, skipping OBU\\n\"));\n\t\treturn GF_OK;\n\t}\n\n\tpck = gf_filter_pck_new_alloc(ctx->opid, pck_size, &output);\n\tif (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, pck);\n\n\tgf_filter_pck_set_cts(pck, ctx->cts);\n\tgf_filter_pck_set_sap(pck, ctx->state.frame_state.key_frame ? GF_FILTER_SAP_1 : 0);\n\n\tmemcpy(output, ctx->state.frame_obus, pck_size);\n\n\tif (ctx->deps) {\n\t\tu8 flags = 0;\n\t\t//dependsOn\n\t\tflags = ( ctx->state.frame_state.key_frame) ? 2 : 1;\n\t\tflags <<= 2;\n\t\t//dependedOn\n\t \tflags |= ctx->state.frame_state.refresh_frame_flags ? 1 : 2;\n\t\tflags <<= 2;\n\t\t//hasRedundant\n\t \t//flags |= ctx->has_redundant ? 1 : 2;\n\t \tgf_filter_pck_set_dependency_flags(pck, flags);\n\t}\n\n\tgf_filter_pck_send(pck);\n\n\tav1dmx_update_cts(ctx);\n\tgf_av1_reset_state(&ctx->state, GF_FALSE);\n\n\treturn GF_OK;\n\n}",
  13139. "project": "gpac",
  13140. "hash": 155851759706352627613263901786806712657,
  13141. "size": 45,
  13142. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13143. "message": "fixed #1719",
  13144. "target": 0,
  13145. "dataset": "other",
  13146. "idx": 236225
  13147. },
  13148. {
  13149. "func": "GF_Err av1dmx_process(GF_Filter *filter)\n{\n\tGF_Err e;\n\tGF_AV1DmxCtx *ctx = gf_filter_get_udta(filter);\n\tGF_FilterPacket *pck;\n\tchar *data;\n\tu32 pck_size;\n\n\tif (ctx->bsmode == UNSUPPORTED) return GF_EOS;\n\n\t//always reparse duration\n\tif (!ctx->duration.num)\n\t\tav1dmx_check_dur(filter, ctx);\n\n\tif (!ctx->is_playing && ctx->opid)\n\t\treturn GF_OK;\n\n\tpck = gf_filter_pid_get_packet(ctx->ipid);\n\tif (!pck) {\n\t\tif (gf_filter_pid_is_eos(ctx->ipid)) {\n\t\t\t//flush\n\t\t\twhile (ctx->buf_size) {\n\t\t\t\tu32 buf_size = ctx->buf_size;\n\t\t\t\te = av1dmx_process_buffer(filter, ctx, ctx->buffer, ctx->buf_size, GF_TRUE);\n\t\t\t\tif (e) break;\n\t\t\t\tif (buf_size == ctx->buf_size) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (ctx->state.bs && gf_bs_get_position(ctx->state.bs))\n\t\t\t\tav1dmx_parse_flush_sample(filter, ctx);\n\n\t\t\tctx->buf_size = 0;\n\t\t\tif (ctx->opid)\n\t\t\t\tgf_filter_pid_set_eos(ctx->opid);\n\t\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\t\tctx->src_pck = NULL;\n\t\t\treturn GF_EOS;\n\t\t}\n\t\treturn GF_OK;\n\t}\n\n\tif (ctx->opid) {\n\t\tif (!ctx->is_playing || gf_filter_pid_would_block(ctx->opid))\n\t\t\treturn GF_OK;\n\t}\n\n\tdata = (char *) gf_filter_pck_get_data(pck, &pck_size);\n\n\t//input pid sets some timescale - we flushed pending data , update cts\n\tif (ctx->timescale) {\n\t\tBool start, end;\n\t\tu64 cts;\n\n\t\te = GF_OK;\n\n\t\tgf_filter_pck_get_framing(pck, &start, &end);\n\t\t//middle or end of frame, reaggregation\n\t\tif (!start) {\n\t\t\tif (ctx->alloc_size < ctx->buf_size + pck_size) {\n\t\t\t\tctx->alloc_size = ctx->buf_size + pck_size;\n\t\t\t\tctx->buffer = gf_realloc(ctx->buffer, ctx->alloc_size);\n\t\t\t}\n\t\t\tmemcpy(ctx->buffer+ctx->buf_size, data, pck_size);\n\t\t\tctx->buf_size += pck_size;\n\n\t\t\t//end of frame, process av1\n\t\t\tif (end) {\n\t\t\t\te = av1dmx_process_buffer(filter, ctx, ctx->buffer, ctx->buf_size, GF_TRUE);\n\t\t\t}\n\t\t\tctx->buf_size=0;\n\t\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t\t\treturn e;\n\t\t}\n\t\t//flush of pending frame (might have lost something)\n\t\tif (ctx->buf_size) {\n\t\t\te = av1dmx_process_buffer(filter, ctx, ctx->buffer, ctx->buf_size, GF_TRUE);\n\t\t\tctx->buf_size = 0;\n\t\t\tif (e) return e;\n\t\t}\n\n\t\t//begining of a new frame\n\t\tcts = gf_filter_pck_get_cts(pck);\n\t\tif (cts != GF_FILTER_NO_TS)\n\t\t\tctx->cts = cts;\n\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\tctx->src_pck = pck;\n\t\tgf_filter_pck_ref_props(&ctx->src_pck);\n\t\tctx->buf_size = 0;\n\n\t\tif (!end) {\n\t\t\tif (ctx->alloc_size < ctx->buf_size + pck_size) {\n\t\t\t\tctx->alloc_size = ctx->buf_size + pck_size;\n\t\t\t\tctx->buffer = gf_realloc(ctx->buffer, ctx->alloc_size);\n\t\t\t}\n\t\t\tmemcpy(ctx->buffer+ctx->buf_size, data, pck_size);\n\t\t\tctx->buf_size += pck_size;\n\t\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t\t\treturn GF_OK;\n\t\t}\n\t\tassert(start && end);\n\t\t//process\n\t\te = av1dmx_process_buffer(filter, ctx, data, pck_size, GF_FALSE);\n\n\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t\treturn e;\n\t}\n\n\t//not from framed stream, copy buffer\n\tif (ctx->alloc_size < ctx->buf_size + pck_size) {\n\t\tctx->alloc_size = ctx->buf_size + pck_size;\n\t\tctx->buffer = gf_realloc(ctx->buffer, ctx->alloc_size);\n\t}\n\tmemcpy(ctx->buffer+ctx->buf_size, data, pck_size);\n\tctx->buf_size += pck_size;\n\te = av1dmx_process_buffer(filter, ctx, ctx->buffer, ctx->buf_size, GF_TRUE);\n\tgf_filter_pid_drop_packet(ctx->ipid);\n\treturn e;\n}",
  13150. "project": "gpac",
  13151. "hash": 13379975237514725027535547774306034474,
  13152. "size": 119,
  13153. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13154. "message": "fixed #1719",
  13155. "target": 0,
  13156. "dataset": "other",
  13157. "idx": 236218
  13158. },
  13159. {
  13160. "func": "GF_Err av1dmx_parse_ivf(GF_Filter *filter, GF_AV1DmxCtx *ctx)\n{\n\tGF_Err e;\n\tu32 pck_size;\n\tu64 frame_size = 0, pts = GF_FILTER_NO_TS;\n\tGF_FilterPacket *pck;\n\tu64 pos, pos_ivf_hdr;\n\tu8 *output;\n\n\tpos_ivf_hdr = gf_bs_get_position(ctx->bs);\n\te = gf_media_parse_ivf_frame_header(ctx->bs, &frame_size, &pts);\n\tif (e) return e;\n\n\tpos = gf_bs_get_position(ctx->bs);\n\tif (gf_bs_available(ctx->bs) < frame_size) {\n\t\tgf_bs_seek(ctx->bs, pos_ivf_hdr);\n\t\treturn GF_EOS;\n\t}\n\n\tif (ctx->pts_from_file) {\n\t\tpts += ctx->cumulated_dur;\n\t\tif (ctx->last_pts && (ctx->last_pts>pts)) {\n\t\t\tpts -= ctx->cumulated_dur;\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[IVF/AV1] Corrupted timestamp \"LLU\" less than previous timestamp \"LLU\", assuming concatenation\\n\", pts, ctx->last_pts));\n\t\t\tctx->cumulated_dur = ctx->last_pts + ctx->cur_fps.den;\n\t\t\tctx->cumulated_dur -= pts;\n\t\t\tpts = ctx->cumulated_dur;\n\t\t}\n\t\tctx->last_pts = pts;\n\t}\n\n\n\t//check pid state\n\tav1dmx_check_pid(filter, ctx);\n\n\tif (!ctx->opid) {\n\t\treturn GF_OK;\n\t}\n\n\tif (!ctx->is_playing) {\n\t\tgf_bs_seek(ctx->bs, pos_ivf_hdr);\n\t\treturn GF_EOS;\n\t}\n\n\tpck_size = (u32)frame_size;\n\tpck = gf_filter_pck_new_alloc(ctx->opid, pck_size, &output);\n\tif (!pck) {\n\t\tgf_bs_seek(ctx->bs, pos_ivf_hdr);\n\t\treturn GF_OUT_OF_MEM;\n\t}\n\tif (ctx->src_pck) gf_filter_pck_merge_properties(ctx->src_pck, pck);\n\n\tif (ctx->pts_from_file) {\n\t\tgf_filter_pck_set_cts(pck, pts);\n\t} else {\n\t\tgf_filter_pck_set_cts(pck, ctx->cts);\n\t}\n\n\tgf_bs_seek(ctx->bs, pos);\n\tgf_bs_read_data(ctx->bs, output, pck_size);\n\n\tif (output[0] & 0x80)\n\t\tgf_filter_pck_set_sap(pck, GF_FILTER_SAP_1);\n\telse\n\t\tgf_filter_pck_set_sap(pck, GF_FILTER_SAP_NONE);\n\n\tgf_filter_pck_send(pck);\n\n\tav1dmx_update_cts(ctx);\n\treturn GF_OK;\n}",
  13161. "project": "gpac",
  13162. "hash": 227710249253003161808554207868767011852,
  13163. "size": 71,
  13164. "commit_id": "13dad7d5ef74ca2e6fe4010f5b03eb12e9bbe0ec",
  13165. "message": "fixed #1719",
  13166. "target": 0,
  13167. "dataset": "other",
  13168. "idx": 236226
  13169. }
  13170. ]
  13171. },
  13172. {
  13173. "call_depth": 3,
  13174. "longest_call_chain": [
  13175. "ntlm_generate_timestamp",
  13176. "ntlm_current_time",
  13177. "GetSystemTimeAsFileTime"
  13178. ],
  13179. "group_size": 3,
  13180. "functions": [
  13181. {
  13182. "func": "void ntlm_current_time(BYTE* timestamp)\n{\n\tFILETIME filetime;\n\tULARGE_INTEGER time64;\n\tGetSystemTimeAsFileTime(&filetime);\n\ttime64.u.LowPart = filetime.dwLowDateTime;\n\ttime64.u.HighPart = filetime.dwHighDateTime;\n\tCopyMemory(timestamp, &(time64.QuadPart), 8);\n}",
  13183. "project": "FreeRDP",
  13184. "hash": 225703998966059836229608822757933918058,
  13185. "size": 9,
  13186. "commit_id": "c098f21fdaadca57ff649eee1674f6cc321a2ec4",
  13187. "message": "Fixed oob read in ntlm_read_ntlm_v2_response",
  13188. "target": 0,
  13189. "dataset": "other",
  13190. "idx": 424870
  13191. },
  13192. {
  13193. "func": "void ntlm_generate_timestamp(NTLM_CONTEXT* context)\n{\n\tif (memcmp(context->ChallengeTimestamp, NTLM_NULL_BUFFER, 8) != 0)\n\t\tCopyMemory(context->Timestamp, context->ChallengeTimestamp, 8);\n\telse\n\t\tntlm_current_time(context->Timestamp);\n}",
  13194. "project": "FreeRDP",
  13195. "hash": 222441413085543285216982206722651183181,
  13196. "size": 7,
  13197. "commit_id": "c098f21fdaadca57ff649eee1674f6cc321a2ec4",
  13198. "message": "Fixed oob read in ntlm_read_ntlm_v2_response",
  13199. "target": 0,
  13200. "dataset": "other",
  13201. "idx": 424861
  13202. },
  13203. {
  13204. "func": "gather_time_entropy(void)\n{\n#ifdef _WIN32\n FILETIME ft;\n GetSystemTimeAsFileTime(&ft); /* never fails */\n return ft.dwHighDateTime ^ ft.dwLowDateTime;\n#else\n struct timeval tv;\n int gettimeofday_res;\n\n gettimeofday_res = gettimeofday(&tv, NULL);\n assert (gettimeofday_res == 0);\n\n /* Microseconds time is <20 bits entropy */\n return tv.tv_usec;\n#endif\n}",
  13205. "project": "libexpat",
  13206. "hash": 191339567346544278956108244764301587072,
  13207. "size": 17,
  13208. "commit_id": "c4bf96bb51dd2a1b0e185374362ee136fe2c9d7f",
  13209. "message": "xmlparse.c: Fix external entity infinite loop bug (CVE-2017-9233)",
  13210. "target": 0,
  13211. "dataset": "other",
  13212. "idx": 308351
  13213. }
  13214. ]
  13215. },
  13216. {
  13217. "call_depth": 4,
  13218. "longest_call_chain": [
  13219. "vgacon_blank",
  13220. "vgacon_set_origin",
  13221. "vga_set_mem_top",
  13222. "write_vga"
  13223. ],
  13224. "group_size": 15,
  13225. "functions": [
  13226. {
  13227. "func": "static void vga_set_palette(struct vc_data *vc, const unsigned char *table)\n{\n\tint i, j;\n\n\tvga_w(vgastate.vgabase, VGA_PEL_MSK, 0xff);\n\tfor (i = j = 0; i < 16; i++) {\n\t\tvga_w(vgastate.vgabase, VGA_PEL_IW, table[i]);\n\t\tvga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);\n\t\tvga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);\n\t\tvga_w(vgastate.vgabase, VGA_PEL_D, vc->vc_palette[j++] >> 2);\n\t}\n}",
  13228. "project": "linux",
  13229. "hash": 69161396085857593232027150743840926718,
  13230. "size": 12,
  13231. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13232. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13233. "target": 0,
  13234. "dataset": "other",
  13235. "idx": 380799
  13236. },
  13237. {
  13238. "func": "static void vga_vesa_unblank(struct vgastate *state)\n{\n\t/* restore original values of VGA controller registers */\n\traw_spin_lock_irq(&vga_lock);\n\tvga_w(state->vgabase, VGA_MIS_W, vga_state.CrtMiscIO);\n\n\toutb_p(0x00, vga_video_port_reg);\t/* HorizontalTotal */\n\toutb_p(vga_state.HorizontalTotal, vga_video_port_val);\n\toutb_p(0x01, vga_video_port_reg);\t/* HorizDisplayEnd */\n\toutb_p(vga_state.HorizDisplayEnd, vga_video_port_val);\n\toutb_p(0x04, vga_video_port_reg);\t/* StartHorizRetrace */\n\toutb_p(vga_state.StartHorizRetrace, vga_video_port_val);\n\toutb_p(0x05, vga_video_port_reg);\t/* EndHorizRetrace */\n\toutb_p(vga_state.EndHorizRetrace, vga_video_port_val);\n\toutb_p(0x07, vga_video_port_reg);\t/* Overflow */\n\toutb_p(vga_state.Overflow, vga_video_port_val);\n\toutb_p(0x10, vga_video_port_reg);\t/* StartVertRetrace */\n\toutb_p(vga_state.StartVertRetrace, vga_video_port_val);\n\toutb_p(0x11, vga_video_port_reg);\t/* EndVertRetrace */\n\toutb_p(vga_state.EndVertRetrace, vga_video_port_val);\n\toutb_p(0x17, vga_video_port_reg);\t/* ModeControl */\n\toutb_p(vga_state.ModeControl, vga_video_port_val);\n\t/* ClockingMode */\n\tvga_wseq(state->vgabase, VGA_SEQ_CLOCK_MODE, vga_state.ClockingMode);\n\n\t/* restore index/control registers */\n\tvga_w(state->vgabase, VGA_SEQ_I, vga_state.SeqCtrlIndex);\n\toutb_p(vga_state.CrtCtrlIndex, vga_video_port_reg);\n\traw_spin_unlock_irq(&vga_lock);\n}",
  13239. "project": "linux",
  13240. "hash": 184406626081864079170054080672675019143,
  13241. "size": 30,
  13242. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13243. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13244. "target": 0,
  13245. "dataset": "other",
  13246. "idx": 380779
  13247. },
  13248. {
  13249. "func": "static void vgacon_cursor(struct vc_data *c, int mode)\n{\n\tif (c->vc_mode != KD_TEXT)\n\t\treturn;\n\n\tvgacon_restore_screen(c);\n\n\tswitch (mode) {\n\tcase CM_ERASE:\n\t\twrite_vga(14, (c->vc_pos - vga_vram_base) / 2);\n\t if (vga_video_type >= VIDEO_TYPE_VGAC)\n\t\t\tvgacon_set_cursor_size(c->state.x, 31, 30);\n\t\telse\n\t\t\tvgacon_set_cursor_size(c->state.x, 31, 31);\n\t\tbreak;\n\n\tcase CM_MOVE:\n\tcase CM_DRAW:\n\t\twrite_vga(14, (c->vc_pos - vga_vram_base) / 2);\n\t\tswitch (CUR_SIZE(c->vc_cursor_type)) {\n\t\tcase CUR_UNDERLINE:\n\t\t\tvgacon_set_cursor_size(c->state.x,\n\t\t\t\t\t c->vc_font.height -\n\t\t\t\t\t (c->vc_font.height <\n\t\t\t\t\t\t10 ? 2 : 3),\n\t\t\t\t\t c->vc_font.height -\n\t\t\t\t\t (c->vc_font.height <\n\t\t\t\t\t\t10 ? 1 : 2));\n\t\t\tbreak;\n\t\tcase CUR_TWO_THIRDS:\n\t\t\tvgacon_set_cursor_size(c->state.x,\n\t\t\t\t\t c->vc_font.height / 3,\n\t\t\t\t\t c->vc_font.height -\n\t\t\t\t\t (c->vc_font.height <\n\t\t\t\t\t\t10 ? 1 : 2));\n\t\t\tbreak;\n\t\tcase CUR_LOWER_THIRD:\n\t\t\tvgacon_set_cursor_size(c->state.x,\n\t\t\t\t\t (c->vc_font.height * 2) / 3,\n\t\t\t\t\t c->vc_font.height -\n\t\t\t\t\t (c->vc_font.height <\n\t\t\t\t\t\t10 ? 1 : 2));\n\t\t\tbreak;\n\t\tcase CUR_LOWER_HALF:\n\t\t\tvgacon_set_cursor_size(c->state.x,\n\t\t\t\t\t c->vc_font.height / 2,\n\t\t\t\t\t c->vc_font.height -\n\t\t\t\t\t (c->vc_font.height <\n\t\t\t\t\t\t10 ? 1 : 2));\n\t\t\tbreak;\n\t\tcase CUR_NONE:\n\t\t\tif (vga_video_type >= VIDEO_TYPE_VGAC)\n\t\t\t\tvgacon_set_cursor_size(c->state.x, 31, 30);\n\t\t\telse\n\t\t\t\tvgacon_set_cursor_size(c->state.x, 31, 31);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tvgacon_set_cursor_size(c->state.x, 1,\n\t\t\t\t\t c->vc_font.height);\n\t\t\tbreak;\n\t\t}\n\t\tbreak;\n\t}\n}",
  13250. "project": "linux",
  13251. "hash": 264369143806320210804445688532246786005,
  13252. "size": 64,
  13253. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13254. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13255. "target": 0,
  13256. "dataset": "other",
  13257. "idx": 380777
  13258. },
  13259. {
  13260. "func": "static void vgacon_set_palette(struct vc_data *vc, const unsigned char *table)\n{\n\tif (vga_video_type != VIDEO_TYPE_VGAC || vga_palette_blanked\n\t || !con_is_visible(vc))\n\t\treturn;\n\tvga_set_palette(vc, table);\n}",
  13261. "project": "linux",
  13262. "hash": 284953449934519854768778320975724655644,
  13263. "size": 7,
  13264. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13265. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13266. "target": 0,
  13267. "dataset": "other",
  13268. "idx": 380801
  13269. },
  13270. {
  13271. "func": "static void vgacon_scrolldelta(struct vc_data *c, int lines)\n{\n\tint start, end, count, soff;\n\n\tif (!lines) {\n\t\tvgacon_restore_screen(c);\n\t\treturn;\n\t}\n\n\tif (!vgacon_scrollback_cur->data)\n\t\treturn;\n\n\tif (!vgacon_scrollback_cur->save) {\n\t\tvgacon_cursor(c, CM_ERASE);\n\t\tvgacon_save_screen(c);\n\t\tc->vc_origin = (unsigned long)c->vc_screenbuf;\n\t\tvgacon_scrollback_cur->save = 1;\n\t}\n\n\tvgacon_scrollback_cur->restore = 0;\n\tstart = vgacon_scrollback_cur->cur + lines;\n\tend = start + abs(lines);\n\n\tif (start < 0)\n\t\tstart = 0;\n\n\tif (start > vgacon_scrollback_cur->cnt)\n\t\tstart = vgacon_scrollback_cur->cnt;\n\n\tif (end < 0)\n\t\tend = 0;\n\n\tif (end > vgacon_scrollback_cur->cnt)\n\t\tend = vgacon_scrollback_cur->cnt;\n\n\tvgacon_scrollback_cur->cur = start;\n\tcount = end - start;\n\tsoff = vgacon_scrollback_cur->tail -\n\t\t((vgacon_scrollback_cur->cnt - end) * c->vc_size_row);\n\tsoff -= count * c->vc_size_row;\n\n\tif (soff < 0)\n\t\tsoff += vgacon_scrollback_cur->size;\n\n\tcount = vgacon_scrollback_cur->cnt - start;\n\n\tif (count > c->vc_rows)\n\t\tcount = c->vc_rows;\n\n\tif (count) {\n\t\tint copysize;\n\n\t\tint diff = c->vc_rows - count;\n\t\tvoid *d = (void *) c->vc_visible_origin;\n\t\tvoid *s = (void *) c->vc_screenbuf;\n\n\t\tcount *= c->vc_size_row;\n\t\t/* how much memory to end of buffer left? */\n\t\tcopysize = min(count, vgacon_scrollback_cur->size - soff);\n\t\tscr_memcpyw(d, vgacon_scrollback_cur->data + soff, copysize);\n\t\td += copysize;\n\t\tcount -= copysize;\n\n\t\tif (count) {\n\t\t\tscr_memcpyw(d, vgacon_scrollback_cur->data, count);\n\t\t\td += count;\n\t\t}\n\n\t\tif (diff)\n\t\t\tscr_memcpyw(d, s, diff * c->vc_size_row);\n\t} else\n\t\tvgacon_cursor(c, CM_MOVE);\n}",
  13272. "project": "linux",
  13273. "hash": 64966259810882479597972966756653255745,
  13274. "size": 73,
  13275. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13276. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13277. "target": 1,
  13278. "dataset": "other",
  13279. "idx": 206374
  13280. },
  13281. {
  13282. "func": "static void vga_vesa_blank(struct vgastate *state, int mode)\n{\n\t/* save original values of VGA controller registers */\n\tif (!vga_vesa_blanked) {\n\t\traw_spin_lock_irq(&vga_lock);\n\t\tvga_state.SeqCtrlIndex = vga_r(state->vgabase, VGA_SEQ_I);\n\t\tvga_state.CrtCtrlIndex = inb_p(vga_video_port_reg);\n\t\tvga_state.CrtMiscIO = vga_r(state->vgabase, VGA_MIS_R);\n\t\traw_spin_unlock_irq(&vga_lock);\n\n\t\toutb_p(0x00, vga_video_port_reg);\t/* HorizontalTotal */\n\t\tvga_state.HorizontalTotal = inb_p(vga_video_port_val);\n\t\toutb_p(0x01, vga_video_port_reg);\t/* HorizDisplayEnd */\n\t\tvga_state.HorizDisplayEnd = inb_p(vga_video_port_val);\n\t\toutb_p(0x04, vga_video_port_reg);\t/* StartHorizRetrace */\n\t\tvga_state.StartHorizRetrace = inb_p(vga_video_port_val);\n\t\toutb_p(0x05, vga_video_port_reg);\t/* EndHorizRetrace */\n\t\tvga_state.EndHorizRetrace = inb_p(vga_video_port_val);\n\t\toutb_p(0x07, vga_video_port_reg);\t/* Overflow */\n\t\tvga_state.Overflow = inb_p(vga_video_port_val);\n\t\toutb_p(0x10, vga_video_port_reg);\t/* StartVertRetrace */\n\t\tvga_state.StartVertRetrace = inb_p(vga_video_port_val);\n\t\toutb_p(0x11, vga_video_port_reg);\t/* EndVertRetrace */\n\t\tvga_state.EndVertRetrace = inb_p(vga_video_port_val);\n\t\toutb_p(0x17, vga_video_port_reg);\t/* ModeControl */\n\t\tvga_state.ModeControl = inb_p(vga_video_port_val);\n\t\tvga_state.ClockingMode = vga_rseq(state->vgabase, VGA_SEQ_CLOCK_MODE);\n\t}\n\n\t/* assure that video is enabled */\n\t/* \"0x20\" is VIDEO_ENABLE_bit in register 01 of sequencer */\n\traw_spin_lock_irq(&vga_lock);\n\tvga_wseq(state->vgabase, VGA_SEQ_CLOCK_MODE, vga_state.ClockingMode | 0x20);\n\n\t/* test for vertical retrace in process.... */\n\tif ((vga_state.CrtMiscIO & 0x80) == 0x80)\n\t\tvga_w(state->vgabase, VGA_MIS_W, vga_state.CrtMiscIO & 0xEF);\n\n\t/*\n\t * Set <End of vertical retrace> to minimum (0) and\n\t * <Start of vertical Retrace> to maximum (incl. overflow)\n\t * Result: turn off vertical sync (VSync) pulse.\n\t */\n\tif (mode & VESA_VSYNC_SUSPEND) {\n\t\toutb_p(0x10, vga_video_port_reg);\t/* StartVertRetrace */\n\t\toutb_p(0xff, vga_video_port_val);\t/* maximum value */\n\t\toutb_p(0x11, vga_video_port_reg);\t/* EndVertRetrace */\n\t\toutb_p(0x40, vga_video_port_val);\t/* minimum (bits 0..3) */\n\t\toutb_p(0x07, vga_video_port_reg);\t/* Overflow */\n\t\toutb_p(vga_state.Overflow | 0x84, vga_video_port_val);\t/* bits 9,10 of vert. retrace */\n\t}\n\n\tif (mode & VESA_HSYNC_SUSPEND) {\n\t\t/*\n\t\t * Set <End of horizontal retrace> to minimum (0) and\n\t\t * <Start of horizontal Retrace> to maximum\n\t\t * Result: turn off horizontal sync (HSync) pulse.\n\t\t */\n\t\toutb_p(0x04, vga_video_port_reg);\t/* StartHorizRetrace */\n\t\toutb_p(0xff, vga_video_port_val);\t/* maximum */\n\t\toutb_p(0x05, vga_video_port_reg);\t/* EndHorizRetrace */\n\t\toutb_p(0x00, vga_video_port_val);\t/* minimum (0) */\n\t}\n\n\t/* restore both index registers */\n\tvga_w(state->vgabase, VGA_SEQ_I, vga_state.SeqCtrlIndex);\n\toutb_p(vga_state.CrtCtrlIndex, vga_video_port_reg);\n\traw_spin_unlock_irq(&vga_lock);\n}",
  13283. "project": "linux",
  13284. "hash": 169205194386474999338498297236531359746,
  13285. "size": 69,
  13286. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13287. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13288. "target": 0,
  13289. "dataset": "other",
  13290. "idx": 380793
  13291. },
  13292. {
  13293. "func": "static bool vgacon_scroll(struct vc_data *c, unsigned int t, unsigned int b,\n\t\tenum con_scroll dir, unsigned int lines)\n{\n\tunsigned long oldo;\n\tunsigned int delta;\n\n\tif (t || b != c->vc_rows || vga_is_gfx || c->vc_mode != KD_TEXT)\n\t\treturn false;\n\n\tif (!vga_hardscroll_enabled || lines >= c->vc_rows / 2)\n\t\treturn false;\n\n\tvgacon_restore_screen(c);\n\toldo = c->vc_origin;\n\tdelta = lines * c->vc_size_row;\n\tif (dir == SM_UP) {\n\t\tif (c->vc_scr_end + delta >= vga_vram_end) {\n\t\t\tscr_memcpyw((u16 *) vga_vram_base,\n\t\t\t\t (u16 *) (oldo + delta),\n\t\t\t\t c->vc_screenbuf_size - delta);\n\t\t\tc->vc_origin = vga_vram_base;\n\t\t\tvga_rolled_over = oldo - vga_vram_base;\n\t\t} else\n\t\t\tc->vc_origin += delta;\n\t\tscr_memsetw((u16 *) (c->vc_origin + c->vc_screenbuf_size -\n\t\t\t\t delta), c->vc_video_erase_char,\n\t\t\t delta);\n\t} else {\n\t\tif (oldo - delta < vga_vram_base) {\n\t\t\tscr_memmovew((u16 *) (vga_vram_end -\n\t\t\t\t\t c->vc_screenbuf_size +\n\t\t\t\t\t delta), (u16 *) oldo,\n\t\t\t\t c->vc_screenbuf_size - delta);\n\t\t\tc->vc_origin = vga_vram_end - c->vc_screenbuf_size;\n\t\t\tvga_rolled_over = 0;\n\t\t} else\n\t\t\tc->vc_origin -= delta;\n\t\tc->vc_scr_end = c->vc_origin + c->vc_screenbuf_size;\n\t\tscr_memsetw((u16 *) (c->vc_origin), c->vc_video_erase_char,\n\t\t\t delta);\n\t}\n\tc->vc_scr_end = c->vc_origin + c->vc_screenbuf_size;\n\tc->vc_visible_origin = c->vc_origin;\n\tvga_set_mem_top(c);\n\tc->vc_pos = (c->vc_pos - oldo) + c->vc_origin;\n\treturn true;\n}",
  13294. "project": "linux",
  13295. "hash": 6422331725750285546258064518217604095,
  13296. "size": 47,
  13297. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13298. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13299. "target": 0,
  13300. "dataset": "other",
  13301. "idx": 380794
  13302. },
  13303. {
  13304. "func": "static void vgacon_set_cursor_size(int xpos, int from, int to)\n{\n\tunsigned long flags;\n\tint curs, cure;\n\n\tif ((from == cursor_size_lastfrom) && (to == cursor_size_lastto))\n\t\treturn;\n\tcursor_size_lastfrom = from;\n\tcursor_size_lastto = to;\n\n\traw_spin_lock_irqsave(&vga_lock, flags);\n\tif (vga_video_type >= VIDEO_TYPE_VGAC) {\n\t\toutb_p(VGA_CRTC_CURSOR_START, vga_video_port_reg);\n\t\tcurs = inb_p(vga_video_port_val);\n\t\toutb_p(VGA_CRTC_CURSOR_END, vga_video_port_reg);\n\t\tcure = inb_p(vga_video_port_val);\n\t} else {\n\t\tcurs = 0;\n\t\tcure = 0;\n\t}\n\n\tcurs = (curs & 0xc0) | from;\n\tcure = (cure & 0xe0) | to;\n\n\toutb_p(VGA_CRTC_CURSOR_START, vga_video_port_reg);\n\toutb_p(curs, vga_video_port_val);\n\toutb_p(VGA_CRTC_CURSOR_END, vga_video_port_reg);\n\toutb_p(cure, vga_video_port_val);\n\traw_spin_unlock_irqrestore(&vga_lock, flags);\n}",
  13305. "project": "linux",
  13306. "hash": 98023379548510040458660830909970450666,
  13307. "size": 30,
  13308. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13309. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13310. "target": 0,
  13311. "dataset": "other",
  13312. "idx": 380789
  13313. },
  13314. {
  13315. "func": "static int vgacon_blank(struct vc_data *c, int blank, int mode_switch)\n{\n\tswitch (blank) {\n\tcase 0:\t\t/* Unblank */\n\t\tif (vga_vesa_blanked) {\n\t\t\tvga_vesa_unblank(&vgastate);\n\t\t\tvga_vesa_blanked = 0;\n\t\t}\n\t\tif (vga_palette_blanked) {\n\t\t\tvga_set_palette(c, color_table);\n\t\t\tvga_palette_blanked = false;\n\t\t\treturn 0;\n\t\t}\n\t\tvga_is_gfx = false;\n\t\t/* Tell console.c that it has to restore the screen itself */\n\t\treturn 1;\n\tcase 1:\t\t/* Normal blanking */\n\tcase -1:\t/* Obsolete */\n\t\tif (!mode_switch && vga_video_type == VIDEO_TYPE_VGAC) {\n\t\t\tvga_pal_blank(&vgastate);\n\t\t\tvga_palette_blanked = true;\n\t\t\treturn 0;\n\t\t}\n\t\tvgacon_set_origin(c);\n\t\tscr_memsetw((void *) vga_vram_base, BLANK,\n\t\t\t c->vc_screenbuf_size);\n\t\tif (mode_switch)\n\t\t\tvga_is_gfx = true;\n\t\treturn 1;\n\tdefault:\t\t/* VESA blanking */\n\t\tif (vga_video_type == VIDEO_TYPE_VGAC) {\n\t\t\tvga_vesa_blank(&vgastate, blank - 1);\n\t\t\tvga_vesa_blanked = blank;\n\t\t}\n\t\treturn 0;\n\t}\n}",
  13316. "project": "linux",
  13317. "hash": 313472742106039195020032312511805944801,
  13318. "size": 37,
  13319. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13320. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13321. "target": 0,
  13322. "dataset": "other",
  13323. "idx": 380780
  13324. },
  13325. {
  13326. "func": "static void vgacon_deinit(struct vc_data *c)\n{\n\t/* When closing the active console, reset video origin */\n\tif (con_is_visible(c)) {\n\t\tc->vc_visible_origin = vga_vram_base;\n\t\tvga_set_mem_top(c);\n\t}\n\n\tif (!--vgacon_refcount)\n\t\tcon_free_unimap(c);\n\tc->vc_uni_pagedir_loc = &c->vc_uni_pagedir;\n\tcon_set_default_unimap(c);\n}",
  13327. "project": "linux",
  13328. "hash": 233161550231503558770393112479094393957,
  13329. "size": 13,
  13330. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13331. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13332. "target": 0,
  13333. "dataset": "other",
  13334. "idx": 380791
  13335. },
  13336. {
  13337. "func": "static inline void write_vga(unsigned char reg, unsigned int val)\n{\n\tunsigned int v1, v2;\n\tunsigned long flags;\n\n\t/*\n\t * ddprintk might set the console position from interrupt\n\t * handlers, thus the write has to be IRQ-atomic.\n\t */\n\traw_spin_lock_irqsave(&vga_lock, flags);\n\tv1 = reg + (val & 0xff00);\n\tv2 = reg + 1 + ((val << 8) & 0xff00);\n\toutw(v1, vga_video_port_reg);\n\toutw(v2, vga_video_port_reg);\n\traw_spin_unlock_irqrestore(&vga_lock, flags);\n}",
  13338. "project": "linux",
  13339. "hash": 86666845087505016899583039047087987511,
  13340. "size": 16,
  13341. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13342. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13343. "target": 0,
  13344. "dataset": "other",
  13345. "idx": 380804
  13346. },
  13347. {
  13348. "func": "static inline void vga_set_mem_top(struct vc_data *c)\n{\n\twrite_vga(12, (c->vc_visible_origin - vga_vram_base) / 2);\n}",
  13349. "project": "linux",
  13350. "hash": 234695802227779534616768870462737489924,
  13351. "size": 4,
  13352. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13353. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13354. "target": 0,
  13355. "dataset": "other",
  13356. "idx": 380785
  13357. },
  13358. {
  13359. "func": "static int vgacon_set_origin(struct vc_data *c)\n{\n\tif (vga_is_gfx ||\t/* We don't play origin tricks in graphic modes */\n\t (console_blanked && !vga_palette_blanked))\t/* Nor we write to blanked screens */\n\t\treturn 0;\n\tc->vc_origin = c->vc_visible_origin = vga_vram_base;\n\tvga_set_mem_top(c);\n\tvga_rolled_over = 0;\n\treturn 1;\n}",
  13360. "project": "linux",
  13361. "hash": 76221709976647395378566495189091919731,
  13362. "size": 10,
  13363. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13364. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13365. "target": 0,
  13366. "dataset": "other",
  13367. "idx": 380798
  13368. },
  13369. {
  13370. "func": "static void vgacon_save_screen(struct vc_data *c)\n{\n\tstatic int vga_bootup_console = 0;\n\n\tif (!vga_bootup_console) {\n\t\t/* This is a gross hack, but here is the only place we can\n\t\t * set bootup console parameters without messing up generic\n\t\t * console initialization routines.\n\t\t */\n\t\tvga_bootup_console = 1;\n\t\tc->state.x = screen_info.orig_x;\n\t\tc->state.y = screen_info.orig_y;\n\t}\n\n\t/* We can't copy in more than the size of the video buffer,\n\t * or we'll be copying in VGA BIOS */\n\n\tif (!vga_is_gfx)\n\t\tscr_memcpyw((u16 *) c->vc_screenbuf, (u16 *) c->vc_origin,\n\t\t\t c->vc_screenbuf_size > vga_vram_size ? vga_vram_size : c->vc_screenbuf_size);\n}",
  13371. "project": "linux",
  13372. "hash": 119602094871467323630347578381677778314,
  13373. "size": 21,
  13374. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13375. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13376. "target": 0,
  13377. "dataset": "other",
  13378. "idx": 380800
  13379. },
  13380. {
  13381. "func": "static void vga_pal_blank(struct vgastate *state)\n{\n\tint i;\n\n\tvga_w(state->vgabase, VGA_PEL_MSK, 0xff);\n\tfor (i = 0; i < 16; i++) {\n\t\tvga_w(state->vgabase, VGA_PEL_IW, i);\n\t\tvga_w(state->vgabase, VGA_PEL_D, 0);\n\t\tvga_w(state->vgabase, VGA_PEL_D, 0);\n\t\tvga_w(state->vgabase, VGA_PEL_D, 0);\n\t}\n}",
  13382. "project": "linux",
  13383. "hash": 203400436583029701202633738517513553529,
  13384. "size": 12,
  13385. "commit_id": "973c096f6a85e5b5f2a295126ba6928d9a6afd45",
  13386. "message": "vgacon: remove software scrollback support\n\nYunhai Zhang recently fixed a VGA software scrollback bug in commit\nebfdfeeae8c0 (\"vgacon: Fix for missing check in scrollback handling\"),\nbut that then made people look more closely at some of this code, and\nthere were more problems on the vgacon side, but also the fbcon software\nscrollback.\n\nWe don't really have anybody who maintains this code - probably because\nnobody actually _uses_ it any more. Sure, people still use both VGA and\nthe framebuffer consoles, but they are no longer the main user\ninterfaces to the kernel, and haven't been for decades, so these kinds\nof extra features end up bitrotting and not really being used.\n\nSo rather than try to maintain a likely unused set of code, I'll just\naggressively remove it, and see if anybody even notices. Maybe there\nare people who haven't jumped on the whole GUI badnwagon yet, and think\nit's just a fad. And maybe those people use the scrollback code.\n\nIf that turns out to be the case, we can resurrect this again, once\nwe've found the sucker^Wmaintainer for it who actually uses it.\n\nReported-by: NopNop Nop <nopitydays@gmail.com>\nTested-by: Willy Tarreau <w@1wt.eu>\nCc: 张云海 <zhangyunhai@nsfocus.com>\nAcked-by: Andy Lutomirski <luto@amacapital.net>\nAcked-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  13387. "target": 0,
  13388. "dataset": "other",
  13389. "idx": 380778
  13390. }
  13391. ]
  13392. },
  13393. {
  13394. "call_depth": 5,
  13395. "longest_call_chain": [
  13396. "cil_reset_filecon",
  13397. "cil_reset_context",
  13398. "cil_reset_levelrange",
  13399. "cil_reset_level",
  13400. "cil_reset_cats"
  13401. ],
  13402. "group_size": 24,
  13403. "functions": [
  13404. {
  13405. "func": "static void cil_reset_iomemcon(struct cil_iomemcon *iomemcon)\n{\n\tif (iomemcon->context_str == NULL) {\n\t\tcil_reset_context(iomemcon->context);\n\t}\n}",
  13406. "project": "selinux",
  13407. "hash": 17294379785361724029176009118549344135,
  13408. "size": 6,
  13409. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13410. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13411. "target": 0,
  13412. "dataset": "other",
  13413. "idx": 416772
  13414. },
  13415. {
  13416. "func": "static void cil_reset_selinuxuser(struct cil_selinuxuser *selinuxuser)\n{\n\tif (selinuxuser->range_str == NULL) {\n\t\tcil_reset_levelrange(selinuxuser->range);\n\t}\n}",
  13417. "project": "selinux",
  13418. "hash": 47987057994886177309731877750012583777,
  13419. "size": 6,
  13420. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13421. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13422. "target": 0,
  13423. "dataset": "other",
  13424. "idx": 416751
  13425. },
  13426. {
  13427. "func": "static void cil_reset_pcidevicecon(struct cil_pcidevicecon *pcidevicecon)\n{\n\tif (pcidevicecon->context_str == NULL) {\n\t\tcil_reset_context(pcidevicecon->context);\n\t}\n}",
  13428. "project": "selinux",
  13429. "hash": 119525301942122478477613140710069458408,
  13430. "size": 6,
  13431. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13432. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13433. "target": 0,
  13434. "dataset": "other",
  13435. "idx": 416753
  13436. },
  13437. {
  13438. "func": "static void cil_reset_ioportcon(struct cil_ioportcon *ioportcon)\n{\n\tif (ioportcon->context_str == NULL) {\n\t\tcil_reset_context(ioportcon->context);\n\t}\n}",
  13439. "project": "selinux",
  13440. "hash": 1067741166550746201659876313177568207,
  13441. "size": 6,
  13442. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13443. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13444. "target": 0,
  13445. "dataset": "other",
  13446. "idx": 416749
  13447. },
  13448. {
  13449. "func": "static inline void cil_reset_levelrange(struct cil_levelrange *levelrange)\n{\n\tif (levelrange->low_str == NULL) {\n\t\tcil_reset_level(levelrange->low);\n\t}\n\n\tif (levelrange->high_str == NULL) {\n\t\tcil_reset_level(levelrange->high);\n\t}\n}",
  13450. "project": "selinux",
  13451. "hash": 58223510928110067588596973412546613930,
  13452. "size": 10,
  13453. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13454. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13455. "target": 0,
  13456. "dataset": "other",
  13457. "idx": 416795
  13458. },
  13459. {
  13460. "func": "static inline void cil_reset_userlevel(struct cil_userlevel *userlevel)\n{\n\tif (userlevel->level_str == NULL) {\n\t\tcil_reset_level(userlevel->level);\n\t}\n}",
  13461. "project": "selinux",
  13462. "hash": 19439091921131468623085362525437340917,
  13463. "size": 6,
  13464. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13465. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13466. "target": 0,
  13467. "dataset": "other",
  13468. "idx": 416785
  13469. },
  13470. {
  13471. "func": "static void cil_reset_genfscon(struct cil_genfscon *genfscon)\n{\n\tif (genfscon->context_str == NULL) {\n\t\tcil_reset_context(genfscon->context);\n\t}\n}",
  13472. "project": "selinux",
  13473. "hash": 42647376735197218470365773424791624792,
  13474. "size": 6,
  13475. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13476. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13477. "target": 0,
  13478. "dataset": "other",
  13479. "idx": 416799
  13480. },
  13481. {
  13482. "func": "static void cil_reset_devicetreecon(struct cil_devicetreecon *devicetreecon)\n{\n\tif (devicetreecon->context_str == NULL) {\n\t\tcil_reset_context(devicetreecon->context);\n\t}\n}",
  13483. "project": "selinux",
  13484. "hash": 315907578779480076783953336959060130874,
  13485. "size": 6,
  13486. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13487. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13488. "target": 0,
  13489. "dataset": "other",
  13490. "idx": 416791
  13491. },
  13492. {
  13493. "func": "static void cil_reset_senscat(struct cil_senscat *senscat)\n{\n\tcil_reset_cats(senscat->cats);\n}",
  13494. "project": "selinux",
  13495. "hash": 83999524537573071360332571034006686886,
  13496. "size": 4,
  13497. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13498. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13499. "target": 0,
  13500. "dataset": "other",
  13501. "idx": 416765
  13502. },
  13503. {
  13504. "func": "static inline void cil_reset_level(struct cil_level *level)\n{\n\tcil_reset_cats(level->cats);\n}",
  13505. "project": "selinux",
  13506. "hash": 50903987015025178212833048707576751187,
  13507. "size": 4,
  13508. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13509. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13510. "target": 0,
  13511. "dataset": "other",
  13512. "idx": 416779
  13513. },
  13514. {
  13515. "func": "static void cil_reset_filecon(struct cil_filecon *filecon)\n{\n\tif (filecon->context_str == NULL && filecon->context != NULL) {\n\t\tcil_reset_context(filecon->context);\n\t}\n}",
  13516. "project": "selinux",
  13517. "hash": 140530303651107143785230409512266245108,
  13518. "size": 6,
  13519. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13520. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13521. "target": 0,
  13522. "dataset": "other",
  13523. "idx": 416770
  13524. },
  13525. {
  13526. "func": "static void cil_reset_sidcontext(struct cil_sidcontext *sidcontext)\n{\n\tif (sidcontext->context_str == NULL) {\n\t\tcil_reset_context(sidcontext->context);\n\t}\n}",
  13527. "project": "selinux",
  13528. "hash": 22447463263912064098359945453477799690,
  13529. "size": 6,
  13530. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13531. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13532. "target": 0,
  13533. "dataset": "other",
  13534. "idx": 416794
  13535. },
  13536. {
  13537. "func": "static void cil_reset_catset(struct cil_catset *catset)\n{\n\tcil_reset_cats(catset->cats);\n}",
  13538. "project": "selinux",
  13539. "hash": 192528959249440385364899685664343911934,
  13540. "size": 4,
  13541. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13542. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13543. "target": 0,
  13544. "dataset": "other",
  13545. "idx": 416796
  13546. },
  13547. {
  13548. "func": "static inline void cil_reset_userrange(struct cil_userrange *userrange)\n{\n\tif (userrange->range_str == NULL) {\n\t\tcil_reset_levelrange(userrange->range);\n\t}\n}",
  13549. "project": "selinux",
  13550. "hash": 20344475556824189517246054653906967006,
  13551. "size": 6,
  13552. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13553. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13554. "target": 0,
  13555. "dataset": "other",
  13556. "idx": 416782
  13557. },
  13558. {
  13559. "func": "static void cil_reset_portcon(struct cil_portcon *portcon)\n{\n\tif (portcon->context_str == NULL) {\n\t\tcil_reset_context(portcon->context);\n\t}\n}",
  13560. "project": "selinux",
  13561. "hash": 32291371718995786756974044984262035491,
  13562. "size": 6,
  13563. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13564. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13565. "target": 0,
  13566. "dataset": "other",
  13567. "idx": 416778
  13568. },
  13569. {
  13570. "func": "static void cil_reset_fsuse(struct cil_fsuse *fsuse)\n{\n\tif (fsuse->context_str == NULL) {\n\t\tcil_reset_context(fsuse->context);\n\t}\n}",
  13571. "project": "selinux",
  13572. "hash": 157014338427233394563451864436247226043,
  13573. "size": 6,
  13574. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13575. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13576. "target": 0,
  13577. "dataset": "other",
  13578. "idx": 416746
  13579. },
  13580. {
  13581. "func": "static void cil_reset_ibendportcon(struct cil_ibendportcon *ibendportcon)\n{\n\tif (!ibendportcon->context_str) {\n\t\tcil_reset_context(ibendportcon->context);\n\t}\n}",
  13582. "project": "selinux",
  13583. "hash": 299537236405345857665973805548268892473,
  13584. "size": 6,
  13585. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13586. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13587. "target": 0,
  13588. "dataset": "other",
  13589. "idx": 416775
  13590. },
  13591. {
  13592. "func": "static void cil_reset_nodecon(struct cil_nodecon *nodecon)\n{\n\tif (nodecon->context_str == NULL) {\n\t\tcil_reset_context(nodecon->context);\n\t}\n}",
  13593. "project": "selinux",
  13594. "hash": 122761695387561201818911265790074064859,
  13595. "size": 6,
  13596. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13597. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13598. "target": 0,
  13599. "dataset": "other",
  13600. "idx": 416759
  13601. },
  13602. {
  13603. "func": "static inline void cil_reset_cats(struct cil_cats *cats)\n{\n\tif (cats != NULL) {\n\t\tcats->evaluated = CIL_FALSE;\n\t\tcil_list_destroy(&cats->datum_expr, CIL_FALSE);\n\t}\n}",
  13604. "project": "selinux",
  13605. "hash": 168046840476563336604361810946570798404,
  13606. "size": 7,
  13607. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13608. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13609. "target": 0,
  13610. "dataset": "other",
  13611. "idx": 416793
  13612. },
  13613. {
  13614. "func": "static void cil_reset_netifcon(struct cil_netifcon *netifcon)\n{\n\tif (netifcon->if_context_str == NULL) {\n\t\tcil_reset_context(netifcon->if_context);\n\t}\n\n\tif (netifcon->packet_context_str == NULL) {\n\t\tcil_reset_context(netifcon->packet_context);\n\t}\n}",
  13615. "project": "selinux",
  13616. "hash": 266989301306506351876653892961154046816,
  13617. "size": 10,
  13618. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13619. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13620. "target": 0,
  13621. "dataset": "other",
  13622. "idx": 416776
  13623. },
  13624. {
  13625. "func": "static void cil_reset_pirqcon(struct cil_pirqcon *pirqcon)\n{\n\tif (pirqcon->context_str == NULL) {\n\t\tcil_reset_context(pirqcon->context);\n\t}\n}",
  13626. "project": "selinux",
  13627. "hash": 84287819942665266242757458642560647373,
  13628. "size": 6,
  13629. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13630. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13631. "target": 0,
  13632. "dataset": "other",
  13633. "idx": 416763
  13634. },
  13635. {
  13636. "func": "static void cil_reset_ibpkeycon(struct cil_ibpkeycon *ibpkeycon)\n{\n\tif (!ibpkeycon->context_str)\n\t\tcil_reset_context(ibpkeycon->context);\n}",
  13637. "project": "selinux",
  13638. "hash": 93198655059093132959911041093836448149,
  13639. "size": 5,
  13640. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13641. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13642. "target": 0,
  13643. "dataset": "other",
  13644. "idx": 416797
  13645. },
  13646. {
  13647. "func": "static inline void cil_reset_context(struct cil_context *context)\n{\n\tif (context->range_str == NULL) {\n\t\tcil_reset_levelrange(context->range);\n\t}\n}",
  13648. "project": "selinux",
  13649. "hash": 101113658878170045320539907768714391773,
  13650. "size": 6,
  13651. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13652. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13653. "target": 0,
  13654. "dataset": "other",
  13655. "idx": 416788
  13656. },
  13657. {
  13658. "func": "static void cil_reset_rangetransition(struct cil_rangetransition *rangetrans)\n{\n\tif (rangetrans->range_str == NULL) {\n\t\tcil_reset_levelrange(rangetrans->range);\n\t}\n}",
  13659. "project": "selinux",
  13660. "hash": 197782370229658749608993956728894127665,
  13661. "size": 6,
  13662. "commit_id": "c49a8ea09501ad66e799ea41b8154b6770fec2c8",
  13663. "message": "libsepol/cil: cil_reset_classperms_set() should not reset classpermission\n\nIn struct cil_classperms_set, the set field is a pointer to a\nstruct cil_classpermission which is looked up in the symbol table.\nSince the cil_classperms_set does not create the cil_classpermission,\nit should not reset it.\n\nSet the set field to NULL instead of resetting the classpermission\nthat it points to.\n\nSigned-off-by: James Carter <jwcart2@gmail.com>",
  13664. "target": 0,
  13665. "dataset": "other",
  13666. "idx": 416761
  13667. }
  13668. ]
  13669. },
  13670. {
  13671. "call_depth": 3,
  13672. "longest_call_chain": [
  13673. "diff",
  13674. "search",
  13675. "matchlen"
  13676. ],
  13677. "group_size": 5,
  13678. "functions": [
  13679. {
  13680. "project": "bsdiff4",
  13681. "commit_id": "49a4cee2feef7deaf9d89e5e793a8824930284d7",
  13682. "target": 0,
  13683. "func": "static void qsufsort(off_t *I, off_t *V, unsigned char *old, off_t oldsize)\n{\n off_t buckets[256], i, h, len;\n\n for (i = 0; i < 256; i++)\n buckets[i] = 0;\n for (i = 0; i < oldsize; i++)\n buckets[old[i]]++;\n for (i = 1; i < 256; i++)\n buckets[i] += buckets[i - 1];\n for (i = 255; i > 0; i--)\n buckets[i] = buckets[i - 1];\n buckets[0] = 0;\n\n for (i = 0; i < oldsize; i++)\n I[++buckets[old[i]]] = i;\n I[0] = oldsize;\n for (i = 0; i < oldsize; i++)\n V[i] = buckets[old[i]];\n V[oldsize] = 0;\n for (i = 1; i < 256; i++)\n if (buckets[i] == buckets[i - 1] + 1)\n I[buckets[i]] = -1;\n I[0] = -1;\n\n for (h = 1; I[0] != -(oldsize + 1); h += h) {\n len = 0;\n for (i = 0; i < oldsize + 1;) {\n if (I[i] < 0) {\n len -= I[i];\n i -= I[i];\n } else {\n if (len)\n I[i - len] = -len;\n len = V[I[i]] + 1 - i;\n split(I, V, i, len, h);\n i += len;\n len=0;\n }\n }\n if (len)\n I[i - len] = -len;\n }\n\n for (i = 0; i < oldsize + 1; i++)\n I[V[i]] = i;\n}",
  13684. "idx": 519592,
  13685. "cwe": "CWE-787",
  13686. "hash": 312186853885179059534442670973859084161,
  13687. "dataset": "other"
  13688. },
  13689. {
  13690. "project": "bsdiff4",
  13691. "commit_id": "49a4cee2feef7deaf9d89e5e793a8824930284d7",
  13692. "target": 0,
  13693. "func": "static void split(off_t *I, off_t *V, off_t start, off_t len, off_t h)\n{\n off_t i, j, k, x, tmp, jj, kk;\n\n if (len < 16) {\n for (k = start; k < start + len; k += j) {\n j = 1;\n x = V[I[k] + h];\n for (i = 1; k + i < start + len; i++) {\n if (V[I[k + i] + h] < x) {\n x = V[I[k + i] + h];\n j = 0;\n }\n if (V[I[k + i] + h] == x) {\n tmp = I[k + j];\n I[k + j] = I[k + i];\n I[k + i] = tmp;\n j++;\n }\n }\n for (i = 0; i < j; i++)\n V[I[k + i]] = k + j - 1;\n if (j == 1)\n I[k] = -1;\n }\n\n } else {\n\n jj = 0;\n kk = 0;\n x = V[I[start + len / 2] + h];\n for (i = start; i < start + len; i++) {\n if (V[I[i] + h] < x)\n jj++;\n if (V[I[i] + h] == x)\n kk++;\n }\n jj += start;\n kk += jj;\n\n j = 0;\n k = 0;\n i = start;\n while (i < jj) {\n if (V[I[i] + h] < x) {\n i++;\n } else if (V[I[i] + h] == x) {\n tmp = I[i];\n I[i] = I[jj + j];\n I[jj + j] = tmp;\n j++;\n } else {\n tmp = I[i];\n I[i] = I[kk + k];\n I[kk + k] = tmp;\n k++;\n }\n }\n\n while (jj + j < kk) {\n if (V[I[jj + j] + h] == x) {\n j++;\n } else {\n tmp = I[jj + j];\n I[jj + j] = I[kk + k];\n I[kk + k] = tmp;\n k++;\n }\n }\n\n if (jj > start)\n split(I, V, start, jj - start, h);\n\n for (i = 0; i < kk - jj; i++)\n V[I[jj + i]] = kk - 1;\n if (jj == kk - 1)\n I[jj] = -1;\n if (start + len > kk)\n split(I, V, kk, start + len - kk, h);\n }\n}",
  13694. "idx": 519596,
  13695. "cwe": "CWE-787",
  13696. "hash": 66430564430039357204930906409815512737,
  13697. "dataset": "other"
  13698. },
  13699. {
  13700. "project": "bsdiff4",
  13701. "commit_id": "49a4cee2feef7deaf9d89e5e793a8824930284d7",
  13702. "target": 0,
  13703. "func": "static off_t matchlen(unsigned char *old, off_t oldsize,\n unsigned char *new, off_t newsize)\n{\n off_t i;\n\n for (i = 0; (i < oldsize) && (i < newsize); i++)\n if (old[i] != new[i])\n break;\n return i;\n}",
  13704. "idx": 519590,
  13705. "cwe": "CWE-787",
  13706. "hash": 118067552938773837291723287890347039335,
  13707. "dataset": "other"
  13708. },
  13709. {
  13710. "project": "bsdiff4",
  13711. "commit_id": "49a4cee2feef7deaf9d89e5e793a8824930284d7",
  13712. "target": 0,
  13713. "func": "static PyObject* diff(PyObject* self, PyObject* args)\n{\n off_t lastscan, lastpos, lastoffset, oldscore, scsc, overlap, Ss, lens;\n off_t *I, *V, dblen, eblen, scan, pos, len, s, Sf, lenf, Sb, lenb, i;\n PyObject *controlTuples, *tuple, *results, *temp;\n Py_ssize_t origDataLength, newDataLength;\n char *origData, *newData;\n unsigned char *db, *eb;\n\n if (!PyArg_ParseTuple(args, \"s#s#\",\n &origData, &origDataLength,\n &newData, &newDataLength))\n return NULL;\n\n /* create the control tuple */\n controlTuples = PyList_New(0);\n if (!controlTuples)\n return NULL;\n\n /* perform sort on original data */\n I = PyMem_Malloc((origDataLength + 1) * sizeof(off_t));\n if (!I) {\n Py_DECREF(controlTuples);\n return PyErr_NoMemory();\n }\n V = PyMem_Malloc((origDataLength + 1) * sizeof(off_t));\n if (!V) {\n Py_DECREF(controlTuples);\n PyMem_Free(I);\n return PyErr_NoMemory();\n }\n Py_BEGIN_ALLOW_THREADS /* release GIL */\n qsufsort(I, V, (unsigned char *) origData, origDataLength);\n Py_END_ALLOW_THREADS\n PyMem_Free(V);\n\n /* allocate memory for the diff and extra blocks */\n db = PyMem_Malloc(newDataLength + 1);\n if (!db) {\n Py_DECREF(controlTuples);\n PyMem_Free(I);\n return PyErr_NoMemory();\n }\n eb = PyMem_Malloc(newDataLength + 1);\n if (!eb) {\n Py_DECREF(controlTuples);\n PyMem_Free(I);\n PyMem_Free(db);\n return PyErr_NoMemory();\n }\n dblen = 0;\n eblen = 0;\n\n /* perform the diff */\n len = 0;\n scan = 0;\n lastscan = 0;\n lastpos = 0;\n lastoffset = 0;\n pos = 0;\n while (scan < newDataLength) {\n oldscore = 0;\n\n Py_BEGIN_ALLOW_THREADS /* release GIL */\n for (scsc = scan += len; scan < newDataLength; scan++) {\n len = search(I, (unsigned char *) origData, origDataLength,\n (unsigned char *) newData + scan,\n newDataLength - scan, 0, origDataLength, &pos);\n for (; scsc < scan + len; scsc++)\n if ((scsc + lastoffset < origDataLength) &&\n (origData[scsc + lastoffset] == newData[scsc]))\n oldscore++;\n if (((len == oldscore) && (len != 0)) || (len > oldscore + 8))\n break;\n if ((scan + lastoffset < origDataLength) &&\n (origData[scan + lastoffset] == newData[scan]))\n oldscore--;\n }\n Py_END_ALLOW_THREADS\n\n if ((len != oldscore) || (scan == newDataLength)) {\n s = 0;\n Sf = 0;\n lenf = 0;\n for (i = 0; (lastscan + i < scan) &&\n (lastpos + i < origDataLength);) {\n if (origData[lastpos + i] == newData[lastscan + i])\n s++;\n i++;\n if (s * 2 - i > Sf * 2 - lenf) {\n Sf = s;\n lenf = i;\n }\n }\n\n lenb = 0;\n if (scan < newDataLength) {\n s = 0;\n Sb = 0;\n for (i = 1; (scan >= lastscan + i) && (pos >= i); i++) {\n if (origData[pos - i] == newData[scan - i])\n s++;\n if (s * 2 - i > Sb * 2 - lenb) {\n Sb = s;\n lenb = i;\n }\n }\n }\n\n if (lastscan + lenf > scan - lenb) {\n overlap = (lastscan + lenf) - (scan - lenb);\n s = 0;\n Ss = 0;\n lens = 0;\n for (i = 0; i < overlap; i++) {\n if (newData[lastscan + lenf - overlap + i] ==\n origData[lastpos + lenf - overlap + i])\n s++;\n if (newData[scan - lenb + i]== origData[pos - lenb + i])\n s--;\n if (s > Ss) {\n Ss = s;\n lens = i + 1;\n }\n }\n\n lenf += lens - overlap;\n lenb -= lens;\n }\n\n for (i = 0; i < lenf; i++)\n db[dblen + i] = newData[lastscan + i] - origData[lastpos + i];\n for (i = 0; i < (scan - lenb) - (lastscan + lenf); i++)\n eb[eblen + i] = newData[lastscan + lenf + i];\n\n dblen += lenf;\n eblen += (scan - lenb) - (lastscan + lenf);\n\n tuple = PyTuple_New(3);\n if (!tuple) {\n Py_DECREF(controlTuples);\n PyMem_Free(I);\n PyMem_Free(db);\n PyMem_Free(eb);\n return NULL;\n }\n PyTuple_SET_ITEM(tuple, 0, PyLong_FromLong(lenf));\n PyTuple_SET_ITEM(tuple, 1,\n PyLong_FromLong((scan - lenb) - (lastscan + lenf)));\n PyTuple_SET_ITEM(tuple, 2,\n PyLong_FromLong((pos - lenb) - (lastpos + lenf)));\n if (PyList_Append(controlTuples, tuple) < 0) {\n Py_DECREF(controlTuples);\n Py_DECREF(tuple);\n PyMem_Free(I);\n PyMem_Free(db);\n PyMem_Free(eb);\n return NULL;\n }\n Py_DECREF(tuple);\n\n lastscan = scan - lenb;\n lastpos = pos - lenb;\n lastoffset = pos - scan;\n }\n }\n\n PyMem_Free(I);\n results = PyTuple_New(3);\n if (!results) {\n PyMem_Free(db);\n PyMem_Free(eb);\n return NULL;\n }\n PyTuple_SET_ITEM(results, 0, controlTuples);\n temp = PyBytes_FromStringAndSize((char *) db, dblen);\n PyMem_Free(db);\n if (!temp) {\n PyMem_Free(eb);\n Py_DECREF(results);\n return NULL;\n }\n PyTuple_SET_ITEM(results, 1, temp);\n temp = PyBytes_FromStringAndSize((char *) eb, eblen);\n PyMem_Free(eb);\n if (!temp) {\n Py_DECREF(results);\n return NULL;\n }\n PyTuple_SET_ITEM(results, 2, temp);\n\n return results;\n}",
  13714. "idx": 519597,
  13715. "cwe": "CWE-787",
  13716. "hash": 136576671654096117951821115191168181804,
  13717. "dataset": "other"
  13718. },
  13719. {
  13720. "project": "bsdiff4",
  13721. "commit_id": "49a4cee2feef7deaf9d89e5e793a8824930284d7",
  13722. "target": 0,
  13723. "func": "static off_t search(off_t *I,\n unsigned char *old, off_t oldsize,\n unsigned char *new, off_t newsize,\n off_t st, off_t en, off_t *pos)\n{\n off_t x, y;\n\n if (en - st < 2) {\n x = matchlen(old + I[st], oldsize - I[st], new, newsize);\n y = matchlen(old + I[en], oldsize - I[en], new, newsize);\n\n if (x > y) {\n *pos = I[st];\n return x;\n } else {\n *pos = I[en];\n return y;\n }\n }\n\n x = st + (en - st) / 2;\n if (memcmp(old + I[x], new, MIN(oldsize - I[x], newsize)) < 0) {\n return search(I, old, oldsize, new, newsize, x, en, pos);\n } else {\n return search(I, old, oldsize, new, newsize, st, x, pos);\n }\n}",
  13724. "idx": 519594,
  13725. "cwe": "CWE-787",
  13726. "hash": 145361571169878593493473941590284758962,
  13727. "dataset": "other"
  13728. }
  13729. ]
  13730. },
  13731. {
  13732. "call_depth": 3,
  13733. "longest_call_chain": [
  13734. "ofpbuf_use_stack",
  13735. "ofpbuf_put",
  13736. "put_be32"
  13737. ],
  13738. "group_size": 11,
  13739. "functions": [
  13740. {
  13741. "func": "decode_OFPAT_RAW_DEC_NW_TTL(struct ofpbuf *out)\n{\n uint16_t id = 0;\n struct ofpact_cnt_ids *ids;\n enum ofperr error = 0;\n\n ids = ofpact_put_DEC_TTL(out);\n ids->n_controllers = 1;\n ofpbuf_put(out, &id, sizeof id);\n ids = out->header;\n ofpact_finish_DEC_TTL(out, &ids);\n return error;\n}",
  13742. "project": "ovs",
  13743. "hash": 130239518441169416586243487462483186763,
  13744. "size": 13,
  13745. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13746. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13747. "target": 0,
  13748. "dataset": "other",
  13749. "idx": 280564
  13750. },
  13751. {
  13752. "func": "put_be16(struct ofpbuf *b, ovs_be16 x)\n{\n ofpbuf_put(b, &x, sizeof x);\n}",
  13753. "project": "ovs",
  13754. "hash": 126126618690884882217325586180178689899,
  13755. "size": 4,
  13756. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13757. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13758. "target": 0,
  13759. "dataset": "other",
  13760. "idx": 280691
  13761. },
  13762. {
  13763. "func": "ofpact_copy(struct ofpbuf *out, const struct ofpact *a)\n{\n ofpbuf_put(out, a, OFPACT_ALIGN(a->len));\n}",
  13764. "project": "ovs",
  13765. "hash": 318528760131616299637717263581731591457,
  13766. "size": 4,
  13767. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13768. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13769. "target": 0,
  13770. "dataset": "other",
  13771. "idx": 280714
  13772. },
  13773. {
  13774. "func": "decode_NXAST_RAW_NOTE(const struct nx_action_note *nan,\n enum ofp_version ofp_version OVS_UNUSED,\n struct ofpbuf *out)\n{\n struct ofpact_note *note;\n unsigned int length;\n\n length = ntohs(nan->len) - offsetof(struct nx_action_note, note);\n note = ofpact_put_NOTE(out);\n note->length = length;\n ofpbuf_put(out, nan->note, length);\n note = out->header;\n ofpact_finish_NOTE(out, &note);\n\n return 0;\n}",
  13775. "project": "ovs",
  13776. "hash": 191293389683504496358788231290077673977,
  13777. "size": 16,
  13778. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13779. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13780. "target": 0,
  13781. "dataset": "other",
  13782. "idx": 280753
  13783. },
  13784. {
  13785. "func": "put_be32(struct ofpbuf *b, ovs_be32 x)\n{\n ofpbuf_put(b, &x, sizeof x);\n}",
  13786. "project": "ovs",
  13787. "hash": 329313464429107578959359589517891819925,
  13788. "size": 4,
  13789. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13790. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13791. "target": 0,
  13792. "dataset": "other",
  13793. "idx": 280824
  13794. },
  13795. {
  13796. "func": "encode_NOTE(const struct ofpact_note *note,\n enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out)\n{\n size_t start_ofs = out->size;\n struct nx_action_note *nan;\n\n put_NXAST_NOTE(out);\n out->size = out->size - sizeof nan->note;\n\n ofpbuf_put(out, note->data, note->length);\n pad_ofpat(out, start_ofs);\n}",
  13797. "project": "ovs",
  13798. "hash": 97417207261621710791117408910375387443,
  13799. "size": 12,
  13800. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13801. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13802. "target": 0,
  13803. "dataset": "other",
  13804. "idx": 280500
  13805. },
  13806. {
  13807. "func": "encode_STACK_op(const struct ofpact_stack *stack_action,\n struct nx_action_stack *nasp)\n{\n struct ofpbuf b;\n ovs_be16 n_bits;\n\n nasp->offset = htons(stack_action->subfield.ofs);\n\n ofpbuf_use_stack(&b, nasp, ntohs(nasp->len));\n ofpbuf_put_uninit(&b, OBJECT_OFFSETOF(nasp, pad));\n nx_put_mff_header(&b, stack_action->subfield.field, 0, false);\n n_bits = htons(stack_action->subfield.n_bits);\n ofpbuf_put(&b, &n_bits, sizeof n_bits);\n}",
  13808. "project": "ovs",
  13809. "hash": 297782608420565508923593678585242248971,
  13810. "size": 14,
  13811. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13812. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13813. "target": 0,
  13814. "dataset": "other",
  13815. "idx": 280813
  13816. },
  13817. {
  13818. "func": "encode_STACK_PUSH(const struct ofpact_stack *stack,\n enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out)\n{\n encode_STACK_op(stack, put_NXAST_STACK_PUSH(out));\n}",
  13819. "project": "ovs",
  13820. "hash": 260078556911193373288772195673729324288,
  13821. "size": 5,
  13822. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13823. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13824. "target": 0,
  13825. "dataset": "other",
  13826. "idx": 280533
  13827. },
  13828. {
  13829. "func": "encode_STACK_POP(const struct ofpact_stack *stack,\n enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out)\n{\n encode_STACK_op(stack, put_NXAST_STACK_POP(out));\n}",
  13830. "project": "ovs",
  13831. "hash": 7150781408595981479720323736968631036,
  13832. "size": 5,
  13833. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13834. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13835. "target": 0,
  13836. "dataset": "other",
  13837. "idx": 280570
  13838. },
  13839. {
  13840. "func": "put_u32(struct ofpbuf *b, uint32_t x)\n{\n put_be32(b, htonl(x));\n}",
  13841. "project": "ovs",
  13842. "hash": 176251839261200854061667342430221863559,
  13843. "size": 4,
  13844. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13845. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13846. "target": 0,
  13847. "dataset": "other",
  13848. "idx": 280486
  13849. },
  13850. {
  13851. "func": "parse_noargs_dec_ttl(const struct ofpact_parse_params *pp)\n{\n struct ofpact_cnt_ids *ids;\n uint16_t id = 0;\n\n ofpact_put_DEC_TTL(pp->ofpacts);\n ofpbuf_put(pp->ofpacts, &id, sizeof id);\n ids = pp->ofpacts->header;\n ids->n_controllers++;\n ofpact_finish_DEC_TTL(pp->ofpacts, &ids);\n}",
  13852. "project": "ovs",
  13853. "hash": 255320333385340516493091930211986922232,
  13854. "size": 11,
  13855. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  13856. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  13857. "target": 0,
  13858. "dataset": "other",
  13859. "idx": 280804
  13860. }
  13861. ]
  13862. },
  13863. {
  13864. "call_depth": 4,
  13865. "longest_call_chain": [
  13866. "dissect_dvb_s2_modeadapt",
  13867. "dissect_dvb_s2_bb",
  13868. "dissect_dvb_s2_gse",
  13869. "proto_tree_add_item"
  13870. ],
  13871. "group_size": 23,
  13872. "functions": [
  13873. {
  13874. "func": "static int dissect_dvb_s2_gse(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)\n{\n int new_off = 0;\n int frag_len;\n guint16 gse_hdr, data_len, padding_len, gse_proto = 0;\n\n proto_item *ti;\n proto_item *ttf;\n proto_tree *dvb_s2_gse_tree, *dvb_s2_gse_ncr_tree;\n\n tvbuff_t *next_tvb, *data_tvb;\n gboolean dissected = FALSE;\n gboolean update_col_info = TRUE;\n\n static int * const gse_header_bitfields[] = {\n &hf_dvb_s2_gse_hdr_start,\n &hf_dvb_s2_gse_hdr_stop,\n &hf_dvb_s2_gse_hdr_labeltype,\n &hf_dvb_s2_gse_hdr_length,\n NULL\n };\n\n col_append_str(pinfo->cinfo, COL_INFO, \" GSE\");\n\n /* get the GSE header */\n gse_hdr = tvb_get_ntohs(tvb, DVB_S2_GSE_OFFS_HDR);\n\n /* check if this is just padding, which takes up the rest of the frame */\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) &&\n BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS) &&\n BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {\n\n padding_len = tvb_reported_length(tvb);\n proto_tree_add_uint_format(tree, hf_dvb_s2_gse_padding, tvb, new_off, padding_len, padding_len,\n \"DVB-S2 GSE Padding, Length: %d\", padding_len);\n col_append_str(pinfo->cinfo, COL_INFO, \" pad\");\n new_off += padding_len;\n\n return new_off;\n } else {\n /* Not padding, parse as a GSE Header */\n new_off += 2;\n frag_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK)+2;\n ti = proto_tree_add_item(tree, proto_dvb_s2_gse, tvb, 0, frag_len, ENC_NA);\n dvb_s2_gse_tree = proto_item_add_subtree(ti, ett_dvb_s2_gse);\n\n proto_tree_add_bitmask_with_flags(dvb_s2_gse_tree, tvb, DVB_S2_GSE_OFFS_HDR, hf_dvb_s2_gse_hdr,\n ett_dvb_s2_gse_hdr, gse_header_bitfields, ENC_BIG_ENDIAN, BMT_NO_TFS);\n\n /* Get the fragment ID for reassembly */\n guint8 fragid = tvb_get_guint8(tvb, new_off);\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) || BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n /* Not a start or end packet, add only the fragid */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_fragid, tvb, new_off, 1, ENC_BIG_ENDIAN);\n\n new_off += 1;\n }\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n /* Start packet, add the fragment size */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_totlength, tvb, new_off, 2, ENC_BIG_ENDIAN);\n col_append_str(pinfo->cinfo, COL_INFO, \"(frag) \");\n\n new_off += 2;\n }\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS)) {\n /* Start packet, decode the header */\n gse_proto = tvb_get_ntohs(tvb, new_off);\n\n /* Protocol Type */\n if (gse_proto <= 1535) {\n /* Type 1 (Next-Header Type field) */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto_next_header, tvb, new_off, 2, ENC_BIG_ENDIAN);\n }\n else {\n /* Type 2 (EtherType compatible Type Fields) */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto_ethertype, tvb, new_off, 2, ENC_BIG_ENDIAN);\n }\n new_off += 2;\n\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {\n /* 6 byte label */\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n col_append_str(pinfo->cinfo, COL_INFO, \"6 \");\n\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_label6, tvb, new_off, 6, ENC_NA);\n\n new_off += 6;\n } else if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) &&\n BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {\n /* 3 byte label */\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n col_append_str(pinfo->cinfo, COL_INFO, \"3 \");\n\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_label3, tvb, new_off, 3, ENC_BIG_ENDIAN);\n\n new_off += 3;\n } else {\n /* 0 byte label */\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n col_append_str(pinfo->cinfo, COL_INFO, \"0 \");\n }\n if (gse_proto < 0x0600 && gse_proto >= 0x100) {\n /* Only display optional extension headers */\n /* TODO: needs to be tested */\n\n /* TODO: implementation needs to be checked (len of ext-header??) */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_exthdr, tvb, new_off, 1, ENC_BIG_ENDIAN);\n\n new_off += 1;\n }\n }\n else\n {\n /* correct cinfo */\n col_append_str(pinfo->cinfo, COL_INFO, \"(frag) \");\n }\n\n next_tvb = tvb_new_subset_remaining(tvb, new_off);\n\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE) - DVB_S2_GSE_CRC32_LEN;\n } else {\n data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE);\n }\n\n data_tvb = NULL;\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) || BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n fragment_head *dvbs2_frag_head = NULL;\n int offset = new_off;\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS)) {\n offset -= 2; /* re-include GSE type in reassembled data */\n data_len += 2;\n }\n dvbs2_frag_head = fragment_add_seq_next(&dvbs2_reassembly_table, tvb, offset,\n pinfo, fragid, NULL, data_len, BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS));\n\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n dvbs2_frag_head = fragment_end_seq_next(&dvbs2_reassembly_table, pinfo, fragid, NULL);\n\n data_tvb = process_reassembled_data(tvb, new_off, pinfo, \"Reassembled DVB-S2\",\n dvbs2_frag_head, &dvbs2_frag_items, &update_col_info, tree);\n }\n\n if (data_tvb != NULL) {\n /* We have a reassembled packet. Extract the gse_proto from it. */\n gse_proto = tvb_get_ntohs(data_tvb, 0);\n /* And then remove it from the reassembled data */\n data_tvb = tvb_new_subset_remaining(data_tvb, 2);\n } else {\n data_tvb = tvb_new_subset_length(tvb, new_off, data_len);\n }\n\n switch (gse_proto) {\n case ETHERTYPE_IP:\n if (dvb_s2_full_dissection)\n {\n new_off += call_dissector(ip_handle, next_tvb, pinfo, tree);\n dissected = TRUE;\n }\n break;\n\n case ETHERTYPE_IPv6:\n if (dvb_s2_full_dissection)\n {\n new_off += call_dissector(ipv6_handle, next_tvb, pinfo, tree);\n dissected = TRUE;\n }\n break;\n\n case ETHERTYPE_VLAN:\n if (dvb_s2_full_dissection)\n {\n new_off += call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);\n dissected = TRUE;\n }\n break;\n\n case DVB_RCS2_SIGNAL_TABLE:\n call_dissector(dvb_s2_table_handle, data_tvb, pinfo, tree);\n new_off += data_len;\n dissected = TRUE;\n break;\n\n case DVB_RCS2_NCR:\n ttf = proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_ncr, tvb, new_off, data_len, ENC_NA);\n dvb_s2_gse_ncr_tree = proto_item_add_subtree(ttf, ett_dvb_s2_gse_ncr);\n proto_tree_add_item(dvb_s2_gse_ncr_tree, hf_dvb_s2_gse_data, tvb, new_off, data_len, ENC_NA);\n new_off += data_len;\n dissected = TRUE;\n break;\n\n default:\n /* Not handled! TODO: expert info? */\n break;\n }\n\n if (!dissected) {\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_data, tvb, new_off, data_len, ENC_NA);\n new_off += data_len;\n }\n\n /* add crc32 if last fragment */\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_crc32, tvb, new_off, DVB_S2_GSE_CRC32_LEN, ENC_BIG_ENDIAN);\n new_off += DVB_S2_GSE_CRC32_LEN;\n }\n }\n\n return new_off;\n}",
  13875. "project": "wireshark",
  13876. "hash": 332483595863232337377912983497727022384,
  13877. "size": 210,
  13878. "commit_id": "0137c24d60934f131b25506a88c9464e4dc827de",
  13879. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.",
  13880. "target": 0,
  13881. "dataset": "other",
  13882. "idx": 283347
  13883. },
  13884. {
  13885. "func": "static int dissect_dvb_s2_gse(tvbuff_t *tvb, int cur_off, proto_tree *tree, packet_info *pinfo, int bytes_available)\n{\n int new_off = 0;\n int frag_len;\n guint16 gse_hdr, data_len, padding_len, gse_proto = 0;\n\n proto_item *ti;\n proto_item *ttf;\n proto_tree *dvb_s2_gse_tree, *dvb_s2_gse_ncr_tree;\n\n tvbuff_t *next_tvb, *data_tvb;\n gboolean dissected = FALSE;\n gboolean update_col_info = TRUE;\n\n static int * const gse_header_bitfields[] = {\n &hf_dvb_s2_gse_hdr_start,\n &hf_dvb_s2_gse_hdr_stop,\n &hf_dvb_s2_gse_hdr_labeltype,\n &hf_dvb_s2_gse_hdr_length,\n NULL\n };\n\n col_append_str(pinfo->cinfo, COL_INFO, \" GSE\");\n\n /* get the GSE header */\n gse_hdr = tvb_get_ntohs(tvb, cur_off + DVB_S2_GSE_OFFS_HDR);\n\n /* check if this is just padding, which takes up the rest of the frame */\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) &&\n BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS) &&\n BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {\n\n padding_len = bytes_available;\n proto_tree_add_uint_format(tree, hf_dvb_s2_gse_padding, tvb, cur_off + new_off, padding_len, padding_len,\n \"DVB-S2 GSE Padding, Length: %d\", padding_len);\n col_append_str(pinfo->cinfo, COL_INFO, \" pad\");\n new_off += padding_len;\n\n return new_off;\n } else {\n /* Not padding, parse as a GSE Header */\n new_off += 2;\n frag_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK)+2;\n ti = proto_tree_add_item(tree, proto_dvb_s2_gse, tvb, cur_off, frag_len, ENC_NA);\n dvb_s2_gse_tree = proto_item_add_subtree(ti, ett_dvb_s2_gse);\n\n proto_tree_add_bitmask_with_flags(dvb_s2_gse_tree, tvb, cur_off + DVB_S2_GSE_OFFS_HDR, hf_dvb_s2_gse_hdr,\n ett_dvb_s2_gse_hdr, gse_header_bitfields, ENC_BIG_ENDIAN, BMT_NO_TFS);\n\n /* Get the fragment ID for reassembly */\n guint8 fragid = tvb_get_guint8(tvb, cur_off + new_off);\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) || BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n /* Not a start or end packet, add only the fragid */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_fragid, tvb, cur_off + new_off, 1, ENC_BIG_ENDIAN);\n\n new_off += 1;\n }\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n /* Start packet, add the fragment size */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_totlength, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN);\n col_append_str(pinfo->cinfo, COL_INFO, \"(frag) \");\n\n new_off += 2;\n }\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS)) {\n /* Start packet, decode the header */\n gse_proto = tvb_get_ntohs(tvb, cur_off + new_off);\n\n /* Protocol Type */\n if (gse_proto <= 1535) {\n /* Type 1 (Next-Header Type field) */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto_next_header, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN);\n }\n else {\n /* Type 2 (EtherType compatible Type Fields) */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_proto_ethertype, tvb, cur_off + new_off, 2, ENC_BIG_ENDIAN);\n }\n new_off += 2;\n\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) && BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {\n /* 6 byte label */\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n col_append_str(pinfo->cinfo, COL_INFO, \"6 \");\n\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_label6, tvb, cur_off + new_off, 6, ENC_NA);\n\n new_off += 6;\n } else if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS1) &&\n BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_LABELTYPE_POS2)) {\n /* 3 byte label */\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n col_append_str(pinfo->cinfo, COL_INFO, \"3 \");\n\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_label3, tvb, cur_off + new_off, 3, ENC_BIG_ENDIAN);\n\n new_off += 3;\n } else {\n /* 0 byte label */\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n col_append_str(pinfo->cinfo, COL_INFO, \"0 \");\n }\n if (gse_proto < 0x0600 && gse_proto >= 0x100) {\n /* Only display optional extension headers */\n /* TODO: needs to be tested */\n\n /* TODO: implementation needs to be checked (len of ext-header??) */\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_exthdr, tvb, cur_off + new_off, 1, ENC_BIG_ENDIAN);\n\n new_off += 1;\n }\n }\n else\n {\n /* correct cinfo */\n col_append_str(pinfo->cinfo, COL_INFO, \"(frag) \");\n }\n\n next_tvb = tvb_new_subset_remaining(tvb, cur_off + new_off);\n\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE) - DVB_S2_GSE_CRC32_LEN;\n } else {\n data_len = (gse_hdr & DVB_S2_GSE_HDR_LENGTH_MASK) - (new_off - DVB_S2_GSE_MINSIZE);\n }\n\n data_tvb = NULL;\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) || BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n fragment_head *dvbs2_frag_head = NULL;\n int offset = cur_off + new_off;\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_START_POS)) {\n offset -= 2; /* re-include GSE type in reassembled data */\n data_len += 2;\n }\n dvbs2_frag_head = fragment_add_seq_next(&dvbs2_reassembly_table, tvb, offset,\n pinfo, fragid, NULL, data_len, BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_STOP_POS));\n\n if (BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS))\n dvbs2_frag_head = fragment_end_seq_next(&dvbs2_reassembly_table, pinfo, fragid, NULL);\n\n data_tvb = process_reassembled_data(tvb, cur_off + new_off, pinfo, \"Reassembled DVB-S2\",\n dvbs2_frag_head, &dvbs2_frag_items, &update_col_info, tree);\n }\n\n if (data_tvb != NULL) {\n /* We have a reassembled packet. Extract the gse_proto from it. */\n gse_proto = tvb_get_ntohs(data_tvb, 0);\n /* And then remove it from the reassembled data */\n data_tvb = tvb_new_subset_remaining(data_tvb, 2);\n } else {\n data_tvb = tvb_new_subset_length(tvb, cur_off + new_off, data_len);\n }\n\n switch (gse_proto) {\n case ETHERTYPE_IP:\n if (dvb_s2_full_dissection)\n {\n new_off += call_dissector(ip_handle, next_tvb, pinfo, tree);\n dissected = TRUE;\n }\n break;\n\n case ETHERTYPE_IPv6:\n if (dvb_s2_full_dissection)\n {\n new_off += call_dissector(ipv6_handle, next_tvb, pinfo, tree);\n dissected = TRUE;\n }\n break;\n\n case ETHERTYPE_VLAN:\n if (dvb_s2_full_dissection)\n {\n new_off += call_dissector(eth_withoutfcs_handle, next_tvb, pinfo, tree);\n dissected = TRUE;\n }\n break;\n\n case DVB_RCS2_SIGNAL_TABLE:\n call_dissector(dvb_s2_table_handle, data_tvb, pinfo, tree);\n new_off += data_len;\n dissected = TRUE;\n break;\n\n case DVB_RCS2_NCR:\n ttf = proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_ncr, tvb, cur_off + new_off, data_len, ENC_NA);\n dvb_s2_gse_ncr_tree = proto_item_add_subtree(ttf, ett_dvb_s2_gse_ncr);\n proto_tree_add_item(dvb_s2_gse_ncr_tree, hf_dvb_s2_gse_data, tvb, cur_off + new_off, data_len, ENC_NA);\n new_off += data_len;\n dissected = TRUE;\n break;\n\n default:\n /* Not handled! TODO: expert info? */\n break;\n }\n\n if (!dissected) {\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_data, tvb, cur_off + new_off, data_len, ENC_NA);\n new_off += data_len;\n }\n\n /* add crc32 if last fragment */\n if (BIT_IS_CLEAR(gse_hdr, DVB_S2_GSE_HDR_START_POS) && BIT_IS_SET(gse_hdr, DVB_S2_GSE_HDR_STOP_POS)) {\n proto_tree_add_item(dvb_s2_gse_tree, hf_dvb_s2_gse_crc32, tvb, cur_off + new_off, DVB_S2_GSE_CRC32_LEN, ENC_BIG_ENDIAN);\n new_off += DVB_S2_GSE_CRC32_LEN;\n }\n }\n\n return new_off;\n}",
  13886. "project": "wireshark",
  13887. "hash": 239216512787203232815472442179418930376,
  13888. "size": 210,
  13889. "commit_id": "0d8be1fb797b3d65f1c2c204da76af8e8de6d3cc",
  13890. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.\n\n\n(cherry picked from commit 0137c24d60934f131b25506a88c9464e4dc827de)",
  13891. "target": 0,
  13892. "dataset": "other",
  13893. "idx": 475260
  13894. },
  13895. {
  13896. "func": "mptcp_analysis_add_subflows(packet_info *pinfo _U_, tvbuff_t *tvb,\n proto_tree *parent_tree, struct mptcp_analysis* mptcpd)\n{\n wmem_list_frame_t *it;\n proto_tree *tree;\n proto_item *item;\n\n item=proto_tree_add_item(parent_tree, hf_mptcp_analysis_subflows, tvb, 0, 0, ENC_NA);\n PROTO_ITEM_SET_GENERATED(item);\n\n tree=proto_item_add_subtree(item, ett_mptcp_analysis_subflows);\n\n /* for the analysis, we set each subflow tcp stream id */\n for(it = wmem_list_head(mptcpd->subflows); it != NULL; it = wmem_list_frame_next(it)) {\n struct tcp_analysis *sf = (struct tcp_analysis *)wmem_list_frame_data(it);\n proto_item *subflow_item;\n subflow_item=proto_tree_add_uint(tree, hf_mptcp_analysis_subflows_stream_id, tvb, 0, 0, sf->stream);\n PROTO_ITEM_SET_HIDDEN(subflow_item);\n\n proto_item_append_text(item, \" %d\", sf->stream);\n }\n\n PROTO_ITEM_SET_GENERATED(item);\n}",
  13897. "project": "wireshark",
  13898. "hash": 229540375069498975967414832924739189284,
  13899. "size": 24,
  13900. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  13901. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  13902. "target": 0,
  13903. "dataset": "other",
  13904. "idx": 385204
  13905. },
  13906. {
  13907. "func": "static guint8 compute_crc8(tvbuff_t *p, guint8 len, guint8 offset)\n{\n int i;\n guint8 crc = 0, tmp;\n\n for (i = 0; i < len; i++) {\n tmp = tvb_get_guint8(p, offset++);\n crc = crc8_table[crc ^ tmp];\n }\n return crc;\n}",
  13908. "project": "wireshark",
  13909. "hash": 86277274294827179960284729000500653909,
  13910. "size": 11,
  13911. "commit_id": "0137c24d60934f131b25506a88c9464e4dc827de",
  13912. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.",
  13913. "target": 0,
  13914. "dataset": "other",
  13915. "idx": 283345
  13916. },
  13917. {
  13918. "func": "dissect_tcpopt_md5(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_tree *field_tree;\n proto_item *item;\n proto_item *length_item;\n int offset = 0, optlen = tvb_reported_length(tvb);\n\n item = proto_tree_add_item(tree, proto_tcp_option_md5, tvb, offset, -1, ENC_NA);\n field_tree = proto_item_add_subtree(item, ett_tcp_opt_md5);\n\n col_append_lstr(pinfo->cinfo, COL_INFO, \" MD5\", COL_ADD_LSTR_TERMINATOR);\n proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb,\n offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(field_tree, hf_tcp_option_len, tvb,\n offset + 1, 1, ENC_BIG_ENDIAN);\n\n if (!tcp_option_len_check(length_item, pinfo, optlen, TCPOLEN_MD5))\n return tvb_captured_length(tvb);\n\n proto_tree_add_item(field_tree, hf_tcp_option_md5_digest, tvb,\n offset + 2, optlen - 2, ENC_NA);\n\n return tvb_captured_length(tvb);\n}",
  13919. "project": "wireshark",
  13920. "hash": 229530356732808834061798770817848972068,
  13921. "size": 24,
  13922. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  13923. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  13924. "target": 0,
  13925. "dataset": "other",
  13926. "idx": 385186
  13927. },
  13928. {
  13929. "func": "dnp3_append_2item_text(proto_item *item1, proto_item *item2, const gchar *text)\n{\n proto_item_append_text(item1, \"%s\", text);\n proto_item_append_text(item2, \"%s\", text);\n}",
  13930. "project": "wireshark",
  13931. "hash": 172275225429037143393024449344197922195,
  13932. "size": 5,
  13933. "commit_id": "618661b22e34a59b21117db723d8ff91e064d4ba",
  13934. "message": "dnp: plug a memory leak.\n\nIf we're throwing away the data, *throw away the data* - free it, as\nwe're not using it as the backing data for a tvbuff.",
  13935. "target": 0,
  13936. "dataset": "other",
  13937. "idx": 335505
  13938. },
  13939. {
  13940. "func": "rvbd_probe_resp_add_info(proto_item *pitem, packet_info *pinfo, tvbuff_t *tvb, int ip_offset, guint16 port)\n{\n proto_item_append_text(pitem, \", Server Steelhead: %s:%u\", tvb_ip_to_str(tvb, ip_offset), port);\n\n col_prepend_fstr(pinfo->cinfo, COL_INFO, \"SA+, \");\n}",
  13941. "project": "wireshark",
  13942. "hash": 35361955294164077367943438059540926693,
  13943. "size": 6,
  13944. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  13945. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  13946. "target": 0,
  13947. "dataset": "other",
  13948. "idx": 385198
  13949. },
  13950. {
  13951. "func": "static gboolean test_dvb_s2_crc(tvbuff_t *tvb, guint offset) {\n\n guint8 input8;\n\n /* only check BB Header and return */\n if (tvb_captured_length(tvb) < (offset + DVB_S2_BB_HEADER_LEN))\n return FALSE;\n\n input8 = tvb_get_guint8(tvb, offset + DVB_S2_BB_OFFS_CRC);\n\n if (compute_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, offset) != input8)\n return FALSE;\n else\n return TRUE;\n}",
  13952. "project": "wireshark",
  13953. "hash": 178223073981686552311440261799744038755,
  13954. "size": 15,
  13955. "commit_id": "0137c24d60934f131b25506a88c9464e4dc827de",
  13956. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.",
  13957. "target": 0,
  13958. "dataset": "other",
  13959. "idx": 283343
  13960. },
  13961. {
  13962. "func": "print_pdu_tracking_data(packet_info *pinfo, tvbuff_t *tvb, proto_tree *tcp_tree, struct tcp_multisegment_pdu *msp)\n{\n proto_item *item;\n\n col_prepend_fence_fstr(pinfo->cinfo, COL_INFO, \"[Continuation to #%u] \", msp->first_frame);\n item=proto_tree_add_uint(tcp_tree, hf_tcp_continuation_to,\n tvb, 0, 0, msp->first_frame);\n PROTO_ITEM_SET_GENERATED(item);\n}",
  13963. "project": "wireshark",
  13964. "hash": 317886403689526237342760239131645238935,
  13965. "size": 9,
  13966. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  13967. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  13968. "target": 0,
  13969. "dataset": "other",
  13970. "idx": 385185
  13971. },
  13972. {
  13973. "func": "static int dissect_dvb_s2_bb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)\n{\n proto_item *ti;\n proto_tree *dvb_s2_bb_tree;\n\n guint8 input8, matype1;\n guint8 sync_flag = 0;\n guint16 input16, bb_data_len = 0, user_packet_length;\n\n int sub_dissected = 0, flag_is_ms = 0, new_off = 0;\n\n static int * const bb_header_bitfields[] = {\n &hf_dvb_s2_bb_matype1_gs,\n &hf_dvb_s2_bb_matype1_mis,\n &hf_dvb_s2_bb_matype1_acm,\n &hf_dvb_s2_bb_matype1_issyi,\n &hf_dvb_s2_bb_matype1_npd,\n &hf_dvb_s2_bb_matype1_low_ro,\n NULL\n };\n\n col_append_str(pinfo->cinfo, COL_PROTOCOL, \"BB \");\n col_append_str(pinfo->cinfo, COL_INFO, \"Baseband \");\n\n /* create display subtree for the protocol */\n ti = proto_tree_add_item(tree, proto_dvb_s2_bb, tvb, 0, DVB_S2_BB_HEADER_LEN, ENC_NA);\n dvb_s2_bb_tree = proto_item_add_subtree(ti, ett_dvb_s2_bb);\n\n matype1 = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_MATYPE1);\n new_off += 1;\n\n if (BIT_IS_CLEAR(matype1, DVB_S2_BB_MIS_POS))\n flag_is_ms = 1;\n\n proto_tree_add_bitmask_with_flags(dvb_s2_bb_tree, tvb, DVB_S2_BB_OFFS_MATYPE1, hf_dvb_s2_bb_matype1,\n ett_dvb_s2_bb_matype1, bb_header_bitfields, ENC_BIG_ENDIAN, BMT_NO_FLAGS);\n\n input8 = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_MATYPE1);\n\n if ((pinfo->fd->num == 1) && (_use_low_rolloff_value != 0)) {\n _use_low_rolloff_value = 0;\n }\n if (((input8 & 0x03) == 3) && !_use_low_rolloff_value) {\n _use_low_rolloff_value = 1;\n }\n if (_use_low_rolloff_value) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_low_ro, tvb,\n DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_high_ro, tvb,\n DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n }\n\n input8 = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_MATYPE2);\n new_off += 1;\n if (flag_is_ms) {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"Input Stream Identifier (ISI): %d\",\n input8);\n } else {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"reserved\");\n }\n\n user_packet_length = input16 = tvb_get_ntohs(tvb, DVB_S2_BB_OFFS_UPL);\n new_off += 2;\n\n proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_upl, tvb,\n DVB_S2_BB_OFFS_UPL, 2, input16, \"User Packet Length: %d bits (%d bytes)\",\n (guint16) input16, (guint16) input16 / 8);\n\n bb_data_len = input16 = tvb_get_ntohs(tvb, DVB_S2_BB_OFFS_DFL);\n bb_data_len /= 8;\n new_off += 2;\n\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_dfl, tvb,\n DVB_S2_BB_OFFS_DFL, 2, input16, \"%d bits (%d bytes)\", input16, input16 / 8);\n\n new_off += 1;\n sync_flag = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_SYNC);\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_sync, tvb, DVB_S2_BB_OFFS_SYNC, 1, ENC_BIG_ENDIAN);\n\n new_off += 2;\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_syncd, tvb, DVB_S2_BB_OFFS_SYNCD, 2, ENC_BIG_ENDIAN);\n\n new_off += 1;\n proto_tree_add_checksum(dvb_s2_bb_tree, tvb, DVB_S2_BB_OFFS_CRC, hf_dvb_s2_bb_crc, hf_dvb_s2_bb_crc_status, &ei_dvb_s2_bb_crc, pinfo,\n compute_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, 0), ENC_NA, PROTO_CHECKSUM_VERIFY);\n\n switch (matype1 & DVB_S2_BB_TSGS_MASK) {\n case DVB_S2_BB_TSGS_GENERIC_CONTINUOUS:\n /* Check GSE constraints on the BB header per 9.2.1 of ETSI TS 102 771 */\n if (BIT_IS_SET(matype1, DVB_S2_BB_ISSYI_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_issy_invalid);\n }\n if (BIT_IS_SET(matype1, DVB_S2_BB_NPD_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_npd_invalid);\n }\n if (user_packet_length != 0x0000) {\n expert_add_info_format(pinfo, ti, &ei_dvb_s2_bb_upl_invalid,\n \"UPL is 0x%04x. It must be 0x0000 for GSE packets.\", user_packet_length);\n }\n\n\n if (dvb_s2_df_dissection) {\n while (bb_data_len) {\n if (sync_flag == DVB_S2_BB_SYNC_EIP_CRC32 && bb_data_len == DVB_S2_BB_EIP_CRC32_LEN) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_eip_crc32, tvb, new_off, bb_data_len, ENC_NA);\n bb_data_len = 0;\n new_off += DVB_S2_BB_EIP_CRC32_LEN;\n } else {\n /* start DVB-GSE dissector */\n sub_dissected = dissect_dvb_s2_gse(tvb_new_subset_length(tvb, new_off, bb_data_len), pinfo, tree, NULL);\n new_off += sub_dissected;\n\n if ((sub_dissected <= bb_data_len) && (sub_dissected >= DVB_S2_GSE_MINSIZE)) {\n bb_data_len -= sub_dissected;\n if (bb_data_len < DVB_S2_GSE_MINSIZE)\n bb_data_len = 0;\n }\n }\n }\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_df, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n }\n break;\n\n case DVB_S2_BB_TSGS_GENERIC_PACKETIZED:\n proto_tree_add_item(tree, hf_dvb_s2_bb_packetized, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n case DVB_S2_BB_TSGS_TRANSPORT_STREAM:\n proto_tree_add_item(tree, hf_dvb_s2_bb_transport, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n default:\n proto_tree_add_item(tree, hf_dvb_s2_bb_reserved, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_reserved);\n break;\n }\n\n return new_off;\n}",
  13974. "project": "wireshark",
  13975. "hash": 210796043791253976716955079241114200072,
  13976. "size": 147,
  13977. "commit_id": "0137c24d60934f131b25506a88c9464e4dc827de",
  13978. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.",
  13979. "target": 1,
  13980. "dataset": "other",
  13981. "idx": 198763
  13982. },
  13983. {
  13984. "func": "static int dissect_dvb_s2_bb(tvbuff_t *tvb, int cur_off, proto_tree *tree, packet_info *pinfo)\n{\n proto_item *ti;\n proto_tree *dvb_s2_bb_tree;\n\n guint8 input8, matype1;\n guint8 sync_flag = 0;\n guint16 input16, bb_data_len = 0, user_packet_length;\n\n int sub_dissected = 0, flag_is_ms = 0, new_off = 0;\n\n static int * const bb_header_bitfields[] = {\n &hf_dvb_s2_bb_matype1_gs,\n &hf_dvb_s2_bb_matype1_mis,\n &hf_dvb_s2_bb_matype1_acm,\n &hf_dvb_s2_bb_matype1_issyi,\n &hf_dvb_s2_bb_matype1_npd,\n &hf_dvb_s2_bb_matype1_low_ro,\n NULL\n };\n\n col_append_str(pinfo->cinfo, COL_PROTOCOL, \"BB \");\n col_append_str(pinfo->cinfo, COL_INFO, \"Baseband \");\n\n /* create display subtree for the protocol */\n ti = proto_tree_add_item(tree, proto_dvb_s2_bb, tvb, cur_off, DVB_S2_BB_HEADER_LEN, ENC_NA);\n dvb_s2_bb_tree = proto_item_add_subtree(ti, ett_dvb_s2_bb);\n\n matype1 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1);\n new_off += 1;\n\n if (BIT_IS_CLEAR(matype1, DVB_S2_BB_MIS_POS))\n flag_is_ms = 1;\n\n proto_tree_add_bitmask_with_flags(dvb_s2_bb_tree, tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1, hf_dvb_s2_bb_matype1,\n ett_dvb_s2_bb_matype1, bb_header_bitfields, ENC_BIG_ENDIAN, BMT_NO_FLAGS);\n\n input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1);\n\n if ((pinfo->fd->num == 1) && (_use_low_rolloff_value != 0)) {\n _use_low_rolloff_value = 0;\n }\n if (((input8 & 0x03) == 3) && !_use_low_rolloff_value) {\n _use_low_rolloff_value = 1;\n }\n if (_use_low_rolloff_value) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_low_ro, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_high_ro, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n }\n\n input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE2);\n new_off += 1;\n if (flag_is_ms) {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"Input Stream Identifier (ISI): %d\",\n input8);\n } else {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"reserved\");\n }\n\n user_packet_length = input16 = tvb_get_ntohs(tvb, cur_off + DVB_S2_BB_OFFS_UPL);\n new_off += 2;\n\n proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_upl, tvb,\n cur_off + DVB_S2_BB_OFFS_UPL, 2, input16, \"User Packet Length: %d bits (%d bytes)\",\n (guint16) input16, (guint16) input16 / 8);\n\n bb_data_len = input16 = tvb_get_ntohs(tvb, cur_off + DVB_S2_BB_OFFS_DFL);\n bb_data_len /= 8;\n new_off += 2;\n\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_dfl, tvb,\n cur_off + DVB_S2_BB_OFFS_DFL, 2, input16, \"%d bits (%d bytes)\", input16, input16 / 8);\n\n new_off += 1;\n sync_flag = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_SYNC);\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_sync, tvb, cur_off + DVB_S2_BB_OFFS_SYNC, 1, ENC_BIG_ENDIAN);\n\n new_off += 2;\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_syncd, tvb, cur_off + DVB_S2_BB_OFFS_SYNCD, 2, ENC_BIG_ENDIAN);\n\n new_off += 1;\n proto_tree_add_checksum(dvb_s2_bb_tree, tvb, cur_off + DVB_S2_BB_OFFS_CRC, hf_dvb_s2_bb_crc, hf_dvb_s2_bb_crc_status, &ei_dvb_s2_bb_crc, pinfo,\n compute_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, cur_off), ENC_NA, PROTO_CHECKSUM_VERIFY);\n\n switch (matype1 & DVB_S2_BB_TSGS_MASK) {\n case DVB_S2_BB_TSGS_GENERIC_CONTINUOUS:\n /* Check GSE constraints on the BB header per 9.2.1 of ETSI TS 102 771 */\n if (BIT_IS_SET(matype1, DVB_S2_BB_ISSYI_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_issy_invalid);\n }\n if (BIT_IS_SET(matype1, DVB_S2_BB_NPD_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_npd_invalid);\n }\n if (user_packet_length != 0x0000) {\n expert_add_info_format(pinfo, ti, &ei_dvb_s2_bb_upl_invalid,\n \"UPL is 0x%04x. It must be 0x0000 for GSE packets.\", user_packet_length);\n }\n\n\n if (dvb_s2_df_dissection) {\n while (bb_data_len) {\n if (sync_flag == DVB_S2_BB_SYNC_EIP_CRC32 && bb_data_len == DVB_S2_BB_EIP_CRC32_LEN) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_eip_crc32, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n bb_data_len = 0;\n new_off += DVB_S2_BB_EIP_CRC32_LEN;\n } else {\n /* start DVB-GSE dissector */\n sub_dissected = dissect_dvb_s2_gse(tvb, cur_off + new_off, tree, pinfo, bb_data_len);\n new_off += sub_dissected;\n\n if ((sub_dissected <= bb_data_len) && (sub_dissected >= DVB_S2_GSE_MINSIZE)) {\n bb_data_len -= sub_dissected;\n if (bb_data_len < DVB_S2_GSE_MINSIZE)\n bb_data_len = 0;\n }\n }\n }\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_df, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n }\n break;\n\n case DVB_S2_BB_TSGS_GENERIC_PACKETIZED:\n proto_tree_add_item(tree, hf_dvb_s2_bb_packetized, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n case DVB_S2_BB_TSGS_TRANSPORT_STREAM:\n proto_tree_add_item(tree, hf_dvb_s2_bb_transport, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n default:\n proto_tree_add_item(tree, hf_dvb_s2_bb_reserved, tvb, cur_off + new_off,bb_data_len, ENC_NA);\n new_off += bb_data_len;\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_reserved);\n break;\n }\n\n return new_off;\n}",
  13985. "project": "wireshark",
  13986. "hash": 308318766763033510949212779797367389554,
  13987. "size": 147,
  13988. "commit_id": "0d8be1fb797b3d65f1c2c204da76af8e8de6d3cc",
  13989. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.\n\n\n(cherry picked from commit 0137c24d60934f131b25506a88c9464e4dc827de)",
  13990. "target": 1,
  13991. "dataset": "other",
  13992. "idx": 214056
  13993. },
  13994. {
  13995. "func": "static int dissect_dvb_s2_bb(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)\n{\n proto_item *ti;\n proto_tree *dvb_s2_bb_tree;\n\n guint8 input8, matype1;\n guint8 sync_flag = 0;\n guint16 input16, bb_data_len = 0, user_packet_length;\n\n int sub_dissected = 0, flag_is_ms = 0, new_off = 0;\n\n static int * const bb_header_bitfields[] = {\n &hf_dvb_s2_bb_matype1_gs,\n &hf_dvb_s2_bb_matype1_mis,\n &hf_dvb_s2_bb_matype1_acm,\n &hf_dvb_s2_bb_matype1_issyi,\n &hf_dvb_s2_bb_matype1_npd,\n &hf_dvb_s2_bb_matype1_low_ro,\n NULL\n };\n\n col_append_str(pinfo->cinfo, COL_PROTOCOL, \"BB \");\n col_append_str(pinfo->cinfo, COL_INFO, \"Baseband \");\n\n /* create display subtree for the protocol */\n ti = proto_tree_add_item(tree, proto_dvb_s2_bb, tvb, 0, DVB_S2_BB_HEADER_LEN, ENC_NA);\n dvb_s2_bb_tree = proto_item_add_subtree(ti, ett_dvb_s2_bb);\n\n matype1 = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_MATYPE1);\n new_off += 1;\n\n if (BIT_IS_CLEAR(matype1, DVB_S2_BB_MIS_POS))\n flag_is_ms = 1;\n\n proto_tree_add_bitmask_with_flags(dvb_s2_bb_tree, tvb, DVB_S2_BB_OFFS_MATYPE1, hf_dvb_s2_bb_matype1,\n ett_dvb_s2_bb_matype1, bb_header_bitfields, ENC_BIG_ENDIAN, BMT_NO_FLAGS);\n\n input8 = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_MATYPE1);\n\n if ((pinfo->fd->num == 1) && (_use_low_rolloff_value != 0)) {\n _use_low_rolloff_value = 0;\n }\n if (((input8 & 0x03) == 3) && !_use_low_rolloff_value) {\n _use_low_rolloff_value = 1;\n }\n if (_use_low_rolloff_value) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_low_ro, tvb,\n DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_high_ro, tvb,\n DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n }\n\n input8 = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_MATYPE2);\n new_off += 1;\n if (flag_is_ms) {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"Input Stream Identifier (ISI): %d\",\n input8);\n } else {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"reserved\");\n }\n\n user_packet_length = input16 = tvb_get_ntohs(tvb, DVB_S2_BB_OFFS_UPL);\n new_off += 2;\n\n proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_upl, tvb,\n DVB_S2_BB_OFFS_UPL, 2, input16, \"User Packet Length: %d bits (%d bytes)\",\n (guint16) input16, (guint16) input16 / 8);\n\n bb_data_len = input16 = tvb_get_ntohs(tvb, DVB_S2_BB_OFFS_DFL);\n bb_data_len /= 8;\n new_off += 2;\n\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_dfl, tvb,\n DVB_S2_BB_OFFS_DFL, 2, input16, \"%d bits (%d bytes)\", input16, input16 / 8);\n\n new_off += 1;\n sync_flag = tvb_get_guint8(tvb, DVB_S2_BB_OFFS_SYNC);\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_sync, tvb, DVB_S2_BB_OFFS_SYNC, 1, ENC_BIG_ENDIAN);\n\n new_off += 2;\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_syncd, tvb, DVB_S2_BB_OFFS_SYNCD, 2, ENC_BIG_ENDIAN);\n\n new_off += 1;\n proto_tree_add_checksum(dvb_s2_bb_tree, tvb, DVB_S2_BB_OFFS_CRC, hf_dvb_s2_bb_crc, hf_dvb_s2_bb_crc_status, &ei_dvb_s2_bb_crc, pinfo,\n compute_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, 0), ENC_NA, PROTO_CHECKSUM_VERIFY);\n\n switch (matype1 & DVB_S2_BB_TSGS_MASK) {\n case DVB_S2_BB_TSGS_GENERIC_CONTINUOUS:\n /* Check GSE constraints on the BB header per 9.2.1 of ETSI TS 102 771 */\n if (BIT_IS_SET(matype1, DVB_S2_BB_ISSYI_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_issy_invalid);\n }\n if (BIT_IS_SET(matype1, DVB_S2_BB_NPD_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_npd_invalid);\n }\n if (user_packet_length != 0x0000) {\n expert_add_info_format(pinfo, ti, &ei_dvb_s2_bb_upl_invalid,\n \"UPL is 0x%04x. It must be 0x0000 for GSE packets.\", user_packet_length);\n }\n\n\n if (dvb_s2_df_dissection) {\n while (bb_data_len) {\n if (sync_flag == DVB_S2_BB_SYNC_EIP_CRC32 && bb_data_len == DVB_S2_BB_EIP_CRC32_LEN) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_eip_crc32, tvb, new_off, bb_data_len, ENC_NA);\n bb_data_len = 0;\n new_off += DVB_S2_BB_EIP_CRC32_LEN;\n } else {\n /* start DVB-GSE dissector */\n sub_dissected = dissect_dvb_s2_gse(tvb_new_subset_length(tvb, new_off, bb_data_len), pinfo, tree, NULL);\n new_off += sub_dissected;\n\n if ((sub_dissected <= bb_data_len) && (sub_dissected >= DVB_S2_GSE_MINSIZE)) {\n bb_data_len -= sub_dissected;\n if (bb_data_len < DVB_S2_GSE_MINSIZE)\n bb_data_len = 0;\n } else {\n bb_data_len = 0;\n }\n }\n }\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_df, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n }\n break;\n\n case DVB_S2_BB_TSGS_GENERIC_PACKETIZED:\n proto_tree_add_item(tree, hf_dvb_s2_bb_packetized, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n case DVB_S2_BB_TSGS_TRANSPORT_STREAM:\n proto_tree_add_item(tree, hf_dvb_s2_bb_transport, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n default:\n proto_tree_add_item(tree, hf_dvb_s2_bb_reserved, tvb, new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_reserved);\n break;\n }\n\n return new_off;\n}",
  13996. "project": "wireshark",
  13997. "hash": 330364968381030963517562341505385463003,
  13998. "size": 149,
  13999. "commit_id": "0137c24d60934f131b25506a88c9464e4dc827de",
  14000. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.",
  14001. "target": 0,
  14002. "dataset": "other",
  14003. "idx": 283344
  14004. },
  14005. {
  14006. "func": "static int dissect_dvb_s2_bb(tvbuff_t *tvb, int cur_off, proto_tree *tree, packet_info *pinfo)\n{\n proto_item *ti;\n proto_tree *dvb_s2_bb_tree;\n\n guint8 input8, matype1;\n guint8 sync_flag = 0;\n guint16 input16, bb_data_len = 0, user_packet_length;\n\n int sub_dissected = 0, flag_is_ms = 0, new_off = 0;\n\n static int * const bb_header_bitfields[] = {\n &hf_dvb_s2_bb_matype1_gs,\n &hf_dvb_s2_bb_matype1_mis,\n &hf_dvb_s2_bb_matype1_acm,\n &hf_dvb_s2_bb_matype1_issyi,\n &hf_dvb_s2_bb_matype1_npd,\n &hf_dvb_s2_bb_matype1_low_ro,\n NULL\n };\n\n col_append_str(pinfo->cinfo, COL_PROTOCOL, \"BB \");\n col_append_str(pinfo->cinfo, COL_INFO, \"Baseband \");\n\n /* create display subtree for the protocol */\n ti = proto_tree_add_item(tree, proto_dvb_s2_bb, tvb, cur_off, DVB_S2_BB_HEADER_LEN, ENC_NA);\n dvb_s2_bb_tree = proto_item_add_subtree(ti, ett_dvb_s2_bb);\n\n matype1 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1);\n new_off += 1;\n\n if (BIT_IS_CLEAR(matype1, DVB_S2_BB_MIS_POS))\n flag_is_ms = 1;\n\n proto_tree_add_bitmask_with_flags(dvb_s2_bb_tree, tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1, hf_dvb_s2_bb_matype1,\n ett_dvb_s2_bb_matype1, bb_header_bitfields, ENC_BIG_ENDIAN, BMT_NO_FLAGS);\n\n input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE1);\n\n if ((pinfo->fd->num == 1) && (_use_low_rolloff_value != 0)) {\n _use_low_rolloff_value = 0;\n }\n if (((input8 & 0x03) == 3) && !_use_low_rolloff_value) {\n _use_low_rolloff_value = 1;\n }\n if (_use_low_rolloff_value) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_low_ro, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_matype1_high_ro, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE1, 1, ENC_BIG_ENDIAN);\n }\n\n input8 = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_MATYPE2);\n new_off += 1;\n if (flag_is_ms) {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"Input Stream Identifier (ISI): %d\",\n input8);\n } else {\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_matype2, tvb,\n cur_off + DVB_S2_BB_OFFS_MATYPE2, 1, input8, \"reserved\");\n }\n\n user_packet_length = input16 = tvb_get_ntohs(tvb, cur_off + DVB_S2_BB_OFFS_UPL);\n new_off += 2;\n\n proto_tree_add_uint_format(dvb_s2_bb_tree, hf_dvb_s2_bb_upl, tvb,\n cur_off + DVB_S2_BB_OFFS_UPL, 2, input16, \"User Packet Length: %d bits (%d bytes)\",\n (guint16) input16, (guint16) input16 / 8);\n\n bb_data_len = input16 = tvb_get_ntohs(tvb, cur_off + DVB_S2_BB_OFFS_DFL);\n bb_data_len /= 8;\n new_off += 2;\n\n proto_tree_add_uint_format_value(dvb_s2_bb_tree, hf_dvb_s2_bb_dfl, tvb,\n cur_off + DVB_S2_BB_OFFS_DFL, 2, input16, \"%d bits (%d bytes)\", input16, input16 / 8);\n\n new_off += 1;\n sync_flag = tvb_get_guint8(tvb, cur_off + DVB_S2_BB_OFFS_SYNC);\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_sync, tvb, cur_off + DVB_S2_BB_OFFS_SYNC, 1, ENC_BIG_ENDIAN);\n\n new_off += 2;\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_syncd, tvb, cur_off + DVB_S2_BB_OFFS_SYNCD, 2, ENC_BIG_ENDIAN);\n\n new_off += 1;\n proto_tree_add_checksum(dvb_s2_bb_tree, tvb, cur_off + DVB_S2_BB_OFFS_CRC, hf_dvb_s2_bb_crc, hf_dvb_s2_bb_crc_status, &ei_dvb_s2_bb_crc, pinfo,\n compute_crc8(tvb, DVB_S2_BB_HEADER_LEN - 1, cur_off), ENC_NA, PROTO_CHECKSUM_VERIFY);\n\n switch (matype1 & DVB_S2_BB_TSGS_MASK) {\n case DVB_S2_BB_TSGS_GENERIC_CONTINUOUS:\n /* Check GSE constraints on the BB header per 9.2.1 of ETSI TS 102 771 */\n if (BIT_IS_SET(matype1, DVB_S2_BB_ISSYI_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_issy_invalid);\n }\n if (BIT_IS_SET(matype1, DVB_S2_BB_NPD_POS)) {\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_npd_invalid);\n }\n if (user_packet_length != 0x0000) {\n expert_add_info_format(pinfo, ti, &ei_dvb_s2_bb_upl_invalid,\n \"UPL is 0x%04x. It must be 0x0000 for GSE packets.\", user_packet_length);\n }\n\n\n if (dvb_s2_df_dissection) {\n while (bb_data_len) {\n if (sync_flag == DVB_S2_BB_SYNC_EIP_CRC32 && bb_data_len == DVB_S2_BB_EIP_CRC32_LEN) {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_eip_crc32, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n bb_data_len = 0;\n new_off += DVB_S2_BB_EIP_CRC32_LEN;\n } else {\n /* start DVB-GSE dissector */\n sub_dissected = dissect_dvb_s2_gse(tvb, cur_off + new_off, tree, pinfo, bb_data_len);\n new_off += sub_dissected;\n\n if ((sub_dissected <= bb_data_len) && (sub_dissected >= DVB_S2_GSE_MINSIZE)) {\n bb_data_len -= sub_dissected;\n if (bb_data_len < DVB_S2_GSE_MINSIZE)\n bb_data_len = 0;\n } else {\n bb_data_len = 0;\n }\n }\n }\n } else {\n proto_tree_add_item(dvb_s2_bb_tree, hf_dvb_s2_bb_df, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n }\n break;\n\n case DVB_S2_BB_TSGS_GENERIC_PACKETIZED:\n proto_tree_add_item(tree, hf_dvb_s2_bb_packetized, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n case DVB_S2_BB_TSGS_TRANSPORT_STREAM:\n proto_tree_add_item(tree, hf_dvb_s2_bb_transport, tvb, cur_off + new_off, bb_data_len, ENC_NA);\n new_off += bb_data_len;\n break;\n\n default:\n proto_tree_add_item(tree, hf_dvb_s2_bb_reserved, tvb, cur_off + new_off,bb_data_len, ENC_NA);\n new_off += bb_data_len;\n expert_add_info(pinfo, ti, &ei_dvb_s2_bb_reserved);\n break;\n }\n\n return new_off;\n}",
  14007. "project": "wireshark",
  14008. "hash": 292878332668751229125261027041642584721,
  14009. "size": 149,
  14010. "commit_id": "0d8be1fb797b3d65f1c2c204da76af8e8de6d3cc",
  14011. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.\n\n\n(cherry picked from commit 0137c24d60934f131b25506a88c9464e4dc827de)",
  14012. "target": 0,
  14013. "dataset": "other",
  14014. "idx": 475261
  14015. },
  14016. {
  14017. "func": "dissect_tcpopt_mss(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_item *item;\n proto_tree *exp_tree;\n proto_item *length_item;\n int offset = 0;\n guint32 mss;\n\n item = proto_tree_add_item(tree, proto_tcp_option_mss, tvb, offset, -1, ENC_NA);\n exp_tree = proto_item_add_subtree(item, ett_tcp_option_mss);\n\n proto_tree_add_item(exp_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(exp_tree, hf_tcp_option_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN);\n\n if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_MSS))\n return tvb_captured_length(tvb);\n\n proto_tree_add_item_ret_uint(exp_tree, hf_tcp_option_mss_val, tvb, offset + 2, 2, ENC_BIG_ENDIAN, &mss);\n proto_item_append_text(item, \": %u bytes\", mss);\n tcp_info_append_uint(pinfo, \"MSS\", mss);\n\n return tvb_captured_length(tvb);\n}",
  14018. "project": "wireshark",
  14019. "hash": 232438216178225219490428027693659376926,
  14020. "size": 23,
  14021. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14022. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14023. "target": 0,
  14024. "dataset": "other",
  14025. "idx": 385178
  14026. },
  14027. {
  14028. "func": "dissect_tcpopt_echo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_tree *field_tree;\n proto_item *item;\n proto_item *length_item;\n guint32 echo;\n int offset = 0;\n\n item = proto_tree_add_item(tree, proto_tcp_option_echo, tvb, offset, -1, ENC_NA);\n field_tree = proto_item_add_subtree(item, ett_tcp_opt_echo);\n\n proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb,\n offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(field_tree, hf_tcp_option_len, tvb,\n offset + 1, 1, ENC_BIG_ENDIAN);\n\n if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_ECHO))\n return tvb_captured_length(tvb);\n\n proto_tree_add_item_ret_uint(field_tree, hf_tcp_option_echo, tvb,\n offset + 2, 4, ENC_BIG_ENDIAN, &echo);\n\n proto_item_append_text(item, \": %u\", echo);\n tcp_info_append_uint(pinfo, \"ECHO\", echo);\n\n return tvb_captured_length(tvb);\n}",
  14029. "project": "wireshark",
  14030. "hash": 90281857778135584085831143555859834102,
  14031. "size": 27,
  14032. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14033. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14034. "target": 0,
  14035. "dataset": "other",
  14036. "idx": 385182
  14037. },
  14038. {
  14039. "func": "dissect_tcpopt_cc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_tree *field_tree;\n proto_item *item;\n proto_item *length_item;\n int offset = 0;\n guint32 cc;\n\n item = proto_tree_add_item(tree, proto_tcp_option_cc, tvb, offset, -1, ENC_NA);\n field_tree = proto_item_add_subtree(item, ett_tcp_opt_cc);\n\n proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb,\n offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(field_tree, hf_tcp_option_len, tvb,\n offset + 1, 1, ENC_BIG_ENDIAN);\n\n if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_CC))\n return tvb_captured_length(tvb);\n\n proto_tree_add_item_ret_uint(field_tree, hf_tcp_option_cc, tvb,\n offset + 2, 4, ENC_BIG_ENDIAN, &cc);\n\n tcp_info_append_uint(pinfo, \"CC\", cc);\n return tvb_captured_length(tvb);\n}",
  14040. "project": "wireshark",
  14041. "hash": 310857710779264305685913829554533078653,
  14042. "size": 25,
  14043. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14044. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14045. "target": 0,
  14046. "dataset": "other",
  14047. "idx": 385190
  14048. },
  14049. {
  14050. "func": "dissect_tcpopt_sack_perm(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_item *item;\n proto_tree *exp_tree;\n proto_item *length_item;\n int offset = 0;\n\n item = proto_tree_add_item(tree, proto_tcp_option_sack_perm, tvb, offset, -1, ENC_NA);\n exp_tree = proto_item_add_subtree(item, ett_tcp_option_sack_perm);\n\n proto_tree_add_item(exp_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(exp_tree, hf_tcp_option_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN);\n\n tcp_info_append_uint(pinfo, \"SACK_PERM\", TRUE);\n\n if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_SACK_PERM))\n return tvb_captured_length(tvb);\n\n return tvb_captured_length(tvb);\n}",
  14051. "project": "wireshark",
  14052. "hash": 37583654037644651258534690389342268178,
  14053. "size": 20,
  14054. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14055. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14056. "target": 0,
  14057. "dataset": "other",
  14058. "idx": 385218
  14059. },
  14060. {
  14061. "func": "dissect_tcpopt_user_to(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_item *tf;\n proto_tree *field_tree;\n proto_item *length_item;\n guint16 to;\n int offset = 0;\n\n tf = proto_tree_add_item(tree, proto_tcp_option_user_to, tvb, offset, -1, ENC_NA);\n field_tree = proto_item_add_subtree(tf, ett_tcp_option_user_to);\n\n proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb,\n offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(field_tree, hf_tcp_option_len, tvb,\n offset + 1, 1, ENC_BIG_ENDIAN);\n\n if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_USER_TO))\n return tvb_captured_length(tvb);\n\n proto_tree_add_item(field_tree, hf_tcp_option_user_to_granularity, tvb, offset + 2, 2, ENC_BIG_ENDIAN);\n to = tvb_get_ntohs(tvb, offset + 2) & 0x7FFF;\n proto_tree_add_item(field_tree, hf_tcp_option_user_to_val, tvb, offset + 2, 2, ENC_BIG_ENDIAN);\n\n tcp_info_append_uint(pinfo, \"USER_TO\", to);\n return tvb_captured_length(tvb);\n}",
  14062. "project": "wireshark",
  14063. "hash": 57629197246312946152418648770168822844,
  14064. "size": 26,
  14065. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14066. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14067. "target": 0,
  14068. "dataset": "other",
  14069. "idx": 385222
  14070. },
  14071. {
  14072. "func": "dissect_tcpopt_qs(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_tree *field_tree;\n proto_item *item;\n proto_item *length_item;\n guint8 rate;\n int offset = 0;\n\n item = proto_tree_add_item(tree, proto_tcp_option_qs, tvb, offset, -1, ENC_NA);\n field_tree = proto_item_add_subtree(item, ett_tcp_opt_qs);\n\n proto_tree_add_item(field_tree, hf_tcp_option_kind, tvb,\n offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(field_tree, hf_tcp_option_len, tvb,\n offset + 1, 1, ENC_BIG_ENDIAN);\n\n if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), TCPOLEN_QS))\n return tvb_captured_length(tvb);\n\n rate = tvb_get_guint8(tvb, offset + 2) & 0x0f;\n col_append_lstr(pinfo->cinfo, COL_INFO,\n \" QSresp=\", val_to_str_ext_const(rate, &qs_rate_vals_ext, \"Unknown\"),\n COL_ADD_LSTR_TERMINATOR);\n proto_tree_add_item(field_tree, hf_tcp_option_qs_rate, tvb,\n offset + 2, 1, ENC_BIG_ENDIAN);\n proto_tree_add_item(field_tree, hf_tcp_option_qs_ttl_diff, tvb,\n offset + 3, 1, ENC_BIG_ENDIAN);\n\n return tvb_captured_length(tvb);\n}",
  14073. "project": "wireshark",
  14074. "hash": 102026317412875715497011472030359010166,
  14075. "size": 30,
  14076. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14077. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14078. "target": 0,
  14079. "dataset": "other",
  14080. "idx": 385229
  14081. },
  14082. {
  14083. "func": "dissect_tcpopt_unknown(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, void* data _U_)\n{\n proto_item *item;\n proto_tree *exp_tree;\n int offset = 0, optlen = tvb_reported_length(tvb);\n\n item = proto_tree_add_item(tree, proto_tcp_option_unknown, tvb, offset, -1, ENC_NA);\n exp_tree = proto_item_add_subtree(item, ett_tcp_unknown_opt);\n\n proto_tree_add_item(exp_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN);\n proto_tree_add_item(exp_tree, hf_tcp_option_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN);\n if (optlen > 2)\n proto_tree_add_item(exp_tree, hf_tcp_option_unknown_payload, tvb, offset + 2, optlen - 2, ENC_NA);\n\n return tvb_captured_length(tvb);\n}",
  14084. "project": "wireshark",
  14085. "hash": 59727358969455991189456479393865057491,
  14086. "size": 16,
  14087. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14088. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14089. "target": 0,
  14090. "dataset": "other",
  14091. "idx": 385240
  14092. },
  14093. {
  14094. "func": "dissect_tcpopt_default_option(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int proto, int ett)\n{\n proto_item *item;\n proto_tree *exp_tree;\n proto_item *length_item;\n int offset = 0;\n\n item = proto_tree_add_item(tree, proto, tvb, offset, -1, ENC_NA);\n exp_tree = proto_item_add_subtree(item, ett);\n\n proto_tree_add_item(exp_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN);\n length_item = proto_tree_add_item(exp_tree, hf_tcp_option_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN);\n\n if (!tcp_option_len_check(length_item, pinfo, tvb_reported_length(tvb), 2))\n return tvb_captured_length(tvb);\n\n return tvb_captured_length(tvb);\n}",
  14095. "project": "wireshark",
  14096. "hash": 238363883239916033955174161570019592520,
  14097. "size": 18,
  14098. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14099. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14100. "target": 0,
  14101. "dataset": "other",
  14102. "idx": 385244
  14103. },
  14104. {
  14105. "func": "dissect_tcpopt_tfo(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void* data _U_)\n{\n proto_item *item;\n proto_tree *exp_tree;\n int offset = 0;\n\n item = proto_tree_add_item(tree, proto_tcp_option_tfo, tvb, offset, -1, ENC_NA);\n exp_tree = proto_item_add_subtree(item, ett_tcp_option_exp);\n proto_tree_add_item(exp_tree, hf_tcp_option_kind, tvb, offset, 1, ENC_BIG_ENDIAN);\n proto_tree_add_item(exp_tree, hf_tcp_option_len, tvb, offset + 1, 1, ENC_BIG_ENDIAN);\n\n dissect_tcpopt_tfo_payload(tvb, offset, tvb_reported_length(tvb), pinfo, exp_tree, data);\n return tvb_captured_length(tvb);\n}",
  14106. "project": "wireshark",
  14107. "hash": 27277478292117465627477490514233762438,
  14108. "size": 14,
  14109. "commit_id": "7f3fe6164a68b76d9988c4253b24d43f498f1753",
  14110. "message": "TCP: do not use an unknown status when the checksum is 0xffff\n\nOtherwise it triggers an assert when adding the column as the field is\ndefined as BASE_NONE and not BASE_DEC or BASE_HEX. Thus an unknown value\n(not in proto_checksum_vals[)array) cannot be represented.\nMark the checksum as bad even if we process the packet.\nCloses #16816\n\nConflicts:\n\tepan/dissectors/packet-tcp.c",
  14111. "target": 0,
  14112. "dataset": "other",
  14113. "idx": 385265
  14114. },
  14115. {
  14116. "func": "static int dissect_dvb_s2_modeadapt(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data _U_)\n{\n int cur_off = 0, modeadapt_len, modeadapt_type, matched_headers = 0;\n\n proto_item *ti, *tf;\n proto_tree *dvb_s2_modeadapt_tree;\n proto_tree *dvb_s2_modeadapt_acm_tree;\n\n unsigned int modcod, mc;\n static int * const modeadapt_acm_bitfields[] = {\n &hf_dvb_s2_modeadapt_acm_fecframe,\n &hf_dvb_s2_modeadapt_acm_pilot,\n &hf_dvb_s2_modeadapt_acm_modcod,\n NULL\n };\n\n /* Check that there's enough data */\n if (tvb_captured_length(tvb) < DVB_S2_MODEADAPT_MINSIZE)\n return 0;\n\n /* There are four different mode adaptation formats, with different\n length headers. Two of them have a sync byte at the beginning, but\n the other two do not. In every case, the mode adaptation header is\n followed by the baseband header, which is protected by a CRC-8.\n The CRC-8 is weak protection, so it can match by accident, leading\n to an ambiguity in identifying which format is in use. We will\n check for ambiguity and report it. */\n /* Try L.1 format: no header. */\n if (test_dvb_s2_crc(tvb, DVB_S2_MODEADAPT_L1SIZE)) {\n matched_headers++;\n modeadapt_type = DVB_S2_MODEADAPT_TYPE_L1;\n modeadapt_len = DVB_S2_MODEADAPT_L1SIZE;\n }\n\n /* Try L.2 format: header includes sync byte */\n if ((tvb_get_guint8(tvb, DVB_S2_MODEADAPT_OFFS_SYNCBYTE) == DVB_S2_MODEADAPT_SYNCBYTE) &&\n test_dvb_s2_crc(tvb, DVB_S2_MODEADAPT_L2SIZE)) {\n matched_headers++;\n modeadapt_type = DVB_S2_MODEADAPT_TYPE_L2;\n modeadapt_len = DVB_S2_MODEADAPT_L2SIZE;\n }\n\n /* Try L.3 format: header includes sync byte */\n if ((tvb_get_guint8(tvb, DVB_S2_MODEADAPT_OFFS_SYNCBYTE) == DVB_S2_MODEADAPT_SYNCBYTE) &&\n test_dvb_s2_crc(tvb, DVB_S2_MODEADAPT_L3SIZE)) {\n matched_headers++;\n modeadapt_type = DVB_S2_MODEADAPT_TYPE_L3;\n modeadapt_len = DVB_S2_MODEADAPT_L3SIZE;\n }\n\n /* Try L.4 format: header does not include sync byte */\n if (test_dvb_s2_crc(tvb, DVB_S2_MODEADAPT_L4SIZE)) {\n matched_headers++;\n modeadapt_type = DVB_S2_MODEADAPT_TYPE_L4;\n modeadapt_len = DVB_S2_MODEADAPT_L4SIZE;\n }\n\n if (matched_headers == 0) {\n /* This does not look like a DVB-S2-BB frame at all. We are a\n heuristic dissector, so we should just punt and let another\n dissector have a try at this one. */\n return 0;\n }\n\n col_set_str(pinfo->cinfo, COL_PROTOCOL, \"DVB-S2 \");\n col_set_str(pinfo->cinfo, COL_INFO, \"DVB-S2 \");\n\n /* If there's a mode adaptation header, create display subtree for it */\n if (modeadapt_len > 0) {\n /* ti = proto_tree_add_item(tree, proto_dvb_s2_modeadapt, tvb, 0, modeadapt_len, ENC_NA); */\n ti = proto_tree_add_protocol_format(tree, proto_dvb_s2_modeadapt, tvb, 0, modeadapt_len,\n \"DVB-S2 Mode Adaptation Header L.%d\", modeadapt_type);\n dvb_s2_modeadapt_tree = proto_item_add_subtree(ti, ett_dvb_s2_modeadapt);\n\n if (matched_headers > 1) {\n expert_add_info_format(pinfo, ti, &ei_dvb_s2_bb_header_ambiguous,\n \"Mode adaptation header format is ambiguous. Assuming L.%d\", modeadapt_type);\n }\n\n /* SYNC byte if used in this header format; value has already been checked */\n if (modeadapt_type == DVB_S2_MODEADAPT_TYPE_L2 ||\n modeadapt_type == DVB_S2_MODEADAPT_TYPE_L3) {\n proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_sync, tvb, cur_off, 1, ENC_BIG_ENDIAN);\n cur_off++;\n }\n\n /* ACM byte and subfields if used in this header format */\n if (modeadapt_type == DVB_S2_MODEADAPT_TYPE_L2 ||\n modeadapt_type == DVB_S2_MODEADAPT_TYPE_L3 ||\n modeadapt_type == DVB_S2_MODEADAPT_TYPE_L4) {\n mc = tvb_get_guint8(tvb, 1);\n //mc = tvb_get_letohs(tvb, 0);\n if (mc & 0x80) {\n modcod = 0x80;\n modcod |= ((mc & 0x1F) << 2);\n modcod |= ((mc & 0x40) >> 5);\n tf = proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_acm, tvb,\n DVB_S2_MODEADAPT_OFFS_ACMBYTE, 1, ENC_BIG_ENDIAN);\n\n dvb_s2_modeadapt_acm_tree = proto_item_add_subtree(tf, ett_dvb_s2_modeadapt_acm);\n\n proto_tree_add_item(dvb_s2_modeadapt_acm_tree, hf_dvb_s2_modeadapt_acm_pilot, tvb,\n DVB_S2_MODEADAPT_OFFS_ACMBYTE, 1, ENC_BIG_ENDIAN);\n proto_tree_add_uint_format_value(dvb_s2_modeadapt_acm_tree, hf_dvb_s2_modeadapt_acm_modcod_s2x, tvb,\n DVB_S2_MODEADAPT_OFFS_ACMBYTE, 1, mc, \"DVBS2X %s(%d)\", modeadapt_modcods[modcod].strptr, modcod);\n } else {\n proto_tree_add_bitmask_with_flags(dvb_s2_modeadapt_tree, tvb, DVB_S2_MODEADAPT_OFFS_ACMBYTE, hf_dvb_s2_modeadapt_acm,\n ett_dvb_s2_modeadapt_acm, modeadapt_acm_bitfields, ENC_BIG_ENDIAN, BMT_NO_FLAGS);\n }\n cur_off++;\n }\n\n /* CNI and Frame No if used in this header format */\n if (modeadapt_type == DVB_S2_MODEADAPT_TYPE_L3 ||\n modeadapt_type == DVB_S2_MODEADAPT_TYPE_L4) {\n proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_cni, tvb, cur_off, 1, ENC_BIG_ENDIAN);\n cur_off++;\n\n proto_tree_add_item(dvb_s2_modeadapt_tree, hf_dvb_s2_modeadapt_frameno, tvb, cur_off, 1, ENC_BIG_ENDIAN);\n cur_off++;\n }\n }\n\n /* start DVB-BB dissector */\n cur_off += dissect_dvb_s2_bb(tvb_new_subset_remaining(tvb, cur_off), pinfo, tree, NULL);\n\n return cur_off;\n}",
  14117. "project": "wireshark",
  14118. "hash": 242884105123716874533443846056283316493,
  14119. "size": 128,
  14120. "commit_id": "0137c24d60934f131b25506a88c9464e4dc827de",
  14121. "message": "DVB-S2-BB: Prevent infinite loop\n\nCommit 4bf4ee88f0544727e7f89f3f288c6afd2f650a4c removed an else\nstatement that broke out of the BBFrame processing loop. Without\nit, infinite loops might be possible if the GSE frames have bit errors\nin the length field.",
  14122. "target": 0,
  14123. "dataset": "other",
  14124. "idx": 283342
  14125. }
  14126. ]
  14127. },
  14128. {
  14129. "call_depth": 3,
  14130. "longest_call_chain": [
  14131. "sm501_2d_engine_write",
  14132. "sm501_2d_operation",
  14133. "get_fb_addr"
  14134. ],
  14135. "group_size": 16,
  14136. "functions": [
  14137. {
  14138. "func": "static inline void hwc_invalidate(SM501State *s, int crt)\n{\n int w = get_width(s, crt);\n int h = get_height(s, crt);\n int bpp = get_bpp(s, crt);\n int start = get_hwc_y(s, crt);\n int end = MIN(h, start + SM501_HWC_HEIGHT) + 1;\n\n start *= w * bpp;\n end *= w * bpp;\n\n memory_region_set_dirty(&s->local_mem_region,\n get_fb_addr(s, crt) + start, end - start);\n}",
  14139. "project": "qemu",
  14140. "hash": 49211853481247619002959759084523246825,
  14141. "size": 14,
  14142. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14143. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14144. "target": 0,
  14145. "dataset": "other",
  14146. "idx": 367039
  14147. },
  14148. {
  14149. "func": "static void sm501_2d_engine_write(void *opaque, hwaddr addr,\n uint64_t value, unsigned size)\n{\n SM501State *s = (SM501State *)opaque;\n SM501_DPRINTF(\"sm501 2d engine regs : write addr=%x, val=%x\\n\",\n (unsigned)addr, (unsigned)value);\n\n switch (addr) {\n case SM501_2D_SOURCE:\n s->twoD_source = value;\n break;\n case SM501_2D_DESTINATION:\n s->twoD_destination = value;\n break;\n case SM501_2D_DIMENSION:\n s->twoD_dimension = value;\n break;\n case SM501_2D_CONTROL:\n s->twoD_control = value;\n\n /* do 2d operation if start flag is set. */\n if (value & 0x80000000) {\n sm501_2d_operation(s);\n s->twoD_control &= ~0x80000000; /* start flag down */\n }\n\n break;\n case SM501_2D_PITCH:\n s->twoD_pitch = value;\n break;\n case SM501_2D_FOREGROUND:\n s->twoD_foreground = value;\n break;\n case SM501_2D_BACKGROUND:\n s->twoD_background = value;\n break;\n case SM501_2D_STRETCH:\n s->twoD_stretch = value;\n break;\n case SM501_2D_COLOR_COMPARE:\n s->twoD_color_compare = value;\n break;\n case SM501_2D_COLOR_COMPARE_MASK:\n s->twoD_color_compare_mask = value;\n break;\n case SM501_2D_MASK:\n s->twoD_mask = value;\n break;\n case SM501_2D_CLIP_TL:\n s->twoD_clip_tl = value;\n break;\n case SM501_2D_CLIP_BR:\n s->twoD_clip_br = value;\n break;\n case SM501_2D_MONO_PATTERN_LOW:\n s->twoD_mono_pattern_low = value;\n break;\n case SM501_2D_MONO_PATTERN_HIGH:\n s->twoD_mono_pattern_high = value;\n break;\n case SM501_2D_WINDOW_WIDTH:\n s->twoD_window_width = value;\n break;\n case SM501_2D_SOURCE_BASE:\n s->twoD_source_base = value;\n break;\n case SM501_2D_DESTINATION_BASE:\n s->twoD_destination_base = value;\n break;\n case SM501_2D_ALPHA:\n s->twoD_alpha = value;\n break;\n case SM501_2D_WRAP:\n s->twoD_wrap = value;\n break;\n case SM501_2D_STATUS:\n /* ignored, writing 0 should clear interrupt status */\n break;\n default:\n qemu_log_mask(LOG_UNIMP, \"sm501: not implemented 2d engine register \"\n \"write. addr=%\" HWADDR_PRIx\n \", val=%\" PRIx64 \"\\n\", addr, value);\n }\n}",
  14150. "project": "qemu",
  14151. "hash": 105892952783258788960856014032481353334,
  14152. "size": 84,
  14153. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14154. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14155. "target": 0,
  14156. "dataset": "other",
  14157. "idx": 367022
  14158. },
  14159. {
  14160. "func": "static inline uint32_t get_hwc_y(SM501State *state, int crt)\n{\n uint32_t location = crt ? state->dc_crt_hwc_location\n : state->dc_panel_hwc_location;\n return (location & 0x07FF0000) >> 16;\n}",
  14161. "project": "qemu",
  14162. "hash": 160459258730664320496076582458424436667,
  14163. "size": 6,
  14164. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14165. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14166. "target": 0,
  14167. "dataset": "other",
  14168. "idx": 367041
  14169. },
  14170. {
  14171. "func": "static inline int get_depth_index(DisplaySurface *surface)\n{\n switch (surface_bits_per_pixel(surface)) {\n default:\n case 8:\n return 0;\n case 15:\n return 1;\n case 16:\n return 2;\n case 32:\n if (is_surface_bgr(surface)) {\n return 4;\n } else {\n return 3;\n }\n }\n}",
  14172. "project": "qemu",
  14173. "hash": 297176416044820571830937427545108877922,
  14174. "size": 18,
  14175. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14176. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14177. "target": 0,
  14178. "dataset": "other",
  14179. "idx": 367043
  14180. },
  14181. {
  14182. "func": "static inline uint32_t get_hwc_x(SM501State *state, int crt)\n{\n uint32_t location = crt ? state->dc_crt_hwc_location\n : state->dc_panel_hwc_location;\n return location & 0x000007FF;\n}",
  14183. "project": "qemu",
  14184. "hash": 315111674068672371369231021285203866338,
  14185. "size": 6,
  14186. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14187. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14188. "target": 0,
  14189. "dataset": "other",
  14190. "idx": 367032
  14191. },
  14192. {
  14193. "func": "static inline int get_height(SM501State *s, int crt)\n{\n int height = crt ? s->dc_crt_v_total : s->dc_panel_v_total;\n return (height & 0x00000FFF) + 1;\n}",
  14194. "project": "qemu",
  14195. "hash": 314738027251647568342834821331471116979,
  14196. "size": 5,
  14197. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14198. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14199. "target": 0,
  14200. "dataset": "other",
  14201. "idx": 367042
  14202. },
  14203. {
  14204. "func": "static inline int is_hwc_enabled(SM501State *state, int crt)\n{\n uint32_t addr = crt ? state->dc_crt_hwc_addr : state->dc_panel_hwc_addr;\n return addr & SM501_HWC_EN;\n}",
  14205. "project": "qemu",
  14206. "hash": 52911544485249073061907614747222957354,
  14207. "size": 5,
  14208. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14209. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14210. "target": 0,
  14211. "dataset": "other",
  14212. "idx": 367044
  14213. },
  14214. {
  14215. "func": "static void sm501_disp_ctrl_write(void *opaque, hwaddr addr,\n uint64_t value, unsigned size)\n{\n SM501State *s = (SM501State *)opaque;\n SM501_DPRINTF(\"sm501 disp ctrl regs : write addr=%x, val=%x\\n\",\n (unsigned)addr, (unsigned)value);\n\n switch (addr) {\n case SM501_DC_PANEL_CONTROL:\n s->dc_panel_control = value & 0x0FFF73FF;\n break;\n case SM501_DC_PANEL_PANNING_CONTROL:\n s->dc_panel_panning_control = value & 0xFF3FFF3F;\n break;\n case SM501_DC_PANEL_COLOR_KEY:\n /* Not implemented yet */\n break;\n case SM501_DC_PANEL_FB_ADDR:\n s->dc_panel_fb_addr = value & 0x8FFFFFF0;\n if (value & 0x8000000) {\n qemu_log_mask(LOG_UNIMP, \"Panel external memory not supported\\n\");\n }\n s->do_full_update = true;\n break;\n case SM501_DC_PANEL_FB_OFFSET:\n s->dc_panel_fb_offset = value & 0x3FF03FF0;\n break;\n case SM501_DC_PANEL_FB_WIDTH:\n s->dc_panel_fb_width = value & 0x0FFF0FFF;\n break;\n case SM501_DC_PANEL_FB_HEIGHT:\n s->dc_panel_fb_height = value & 0x0FFF0FFF;\n break;\n case SM501_DC_PANEL_TL_LOC:\n s->dc_panel_tl_location = value & 0x07FF07FF;\n break;\n case SM501_DC_PANEL_BR_LOC:\n s->dc_panel_br_location = value & 0x07FF07FF;\n break;\n\n case SM501_DC_PANEL_H_TOT:\n s->dc_panel_h_total = value & 0x0FFF0FFF;\n break;\n case SM501_DC_PANEL_H_SYNC:\n s->dc_panel_h_sync = value & 0x00FF0FFF;\n break;\n case SM501_DC_PANEL_V_TOT:\n s->dc_panel_v_total = value & 0x0FFF0FFF;\n break;\n case SM501_DC_PANEL_V_SYNC:\n s->dc_panel_v_sync = value & 0x003F0FFF;\n break;\n\n case SM501_DC_PANEL_HWC_ADDR:\n value &= 0x8FFFFFF0;\n if (value != s->dc_panel_hwc_addr) {\n hwc_invalidate(s, 0);\n s->dc_panel_hwc_addr = value;\n }\n break;\n case SM501_DC_PANEL_HWC_LOC:\n value &= 0x0FFF0FFF;\n if (value != s->dc_panel_hwc_location) {\n hwc_invalidate(s, 0);\n s->dc_panel_hwc_location = value;\n }\n break;\n case SM501_DC_PANEL_HWC_COLOR_1_2:\n s->dc_panel_hwc_color_1_2 = value;\n break;\n case SM501_DC_PANEL_HWC_COLOR_3:\n s->dc_panel_hwc_color_3 = value & 0x0000FFFF;\n break;\n\n case SM501_DC_VIDEO_CONTROL:\n s->dc_video_control = value & 0x00037FFF;\n break;\n\n case SM501_DC_CRT_CONTROL:\n s->dc_crt_control = value & 0x0003FFFF;\n break;\n case SM501_DC_CRT_FB_ADDR:\n s->dc_crt_fb_addr = value & 0x8FFFFFF0;\n if (value & 0x8000000) {\n qemu_log_mask(LOG_UNIMP, \"CRT external memory not supported\\n\");\n }\n s->do_full_update = true;\n break;\n case SM501_DC_CRT_FB_OFFSET:\n s->dc_crt_fb_offset = value & 0x3FF03FF0;\n break;\n case SM501_DC_CRT_H_TOT:\n s->dc_crt_h_total = value & 0x0FFF0FFF;\n break;\n case SM501_DC_CRT_H_SYNC:\n s->dc_crt_h_sync = value & 0x00FF0FFF;\n break;\n case SM501_DC_CRT_V_TOT:\n s->dc_crt_v_total = value & 0x0FFF0FFF;\n break;\n case SM501_DC_CRT_V_SYNC:\n s->dc_crt_v_sync = value & 0x003F0FFF;\n break;\n\n case SM501_DC_CRT_HWC_ADDR:\n value &= 0x8FFFFFF0;\n if (value != s->dc_crt_hwc_addr) {\n hwc_invalidate(s, 1);\n s->dc_crt_hwc_addr = value;\n }\n break;\n case SM501_DC_CRT_HWC_LOC:\n value &= 0x0FFF0FFF;\n if (value != s->dc_crt_hwc_location) {\n hwc_invalidate(s, 1);\n s->dc_crt_hwc_location = value;\n }\n break;\n case SM501_DC_CRT_HWC_COLOR_1_2:\n s->dc_crt_hwc_color_1_2 = value;\n break;\n case SM501_DC_CRT_HWC_COLOR_3:\n s->dc_crt_hwc_color_3 = value & 0x0000FFFF;\n break;\n\n case SM501_DC_PANEL_PALETTE ... SM501_DC_PANEL_PALETTE + 0x400 * 3 - 4:\n sm501_palette_write(opaque, addr - SM501_DC_PANEL_PALETTE, value);\n break;\n\n default:\n qemu_log_mask(LOG_UNIMP, \"sm501: not implemented disp ctrl register \"\n \"write. addr=%\" HWADDR_PRIx\n \", val=%\" PRIx64 \"\\n\", addr, value);\n }\n}",
  14216. "project": "qemu",
  14217. "hash": 76155965093107486801739365570345389669,
  14218. "size": 135,
  14219. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14220. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14221. "target": 0,
  14222. "dataset": "other",
  14223. "idx": 367051
  14224. },
  14225. {
  14226. "func": "static inline int get_bpp(SM501State *s, int crt)\n{\n int bpp = crt ? s->dc_crt_control : s->dc_panel_control;\n return 1 << (bpp & 3);\n}",
  14227. "project": "qemu",
  14228. "hash": 74150363724103389218376743923423681513,
  14229. "size": 5,
  14230. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14231. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14232. "target": 0,
  14233. "dataset": "other",
  14234. "idx": 367028
  14235. },
  14236. {
  14237. "func": "static inline int get_width(SM501State *s, int crt)\n{\n int width = crt ? s->dc_crt_h_total : s->dc_panel_h_total;\n return (width & 0x00000FFF) + 1;\n}",
  14238. "project": "qemu",
  14239. "hash": 72598563128143567110701545177639403368,
  14240. "size": 5,
  14241. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14242. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14243. "target": 0,
  14244. "dataset": "other",
  14245. "idx": 367037
  14246. },
  14247. {
  14248. "func": "static void sm501_palette_write(void *opaque, hwaddr addr,\n uint32_t value)\n{\n SM501State *s = (SM501State *)opaque;\n SM501_DPRINTF(\"sm501 palette write addr=%x, val=%x\\n\",\n (int)addr, value);\n\n /* TODO : consider BYTE/WORD access */\n /* TODO : consider endian */\n\n assert(range_covers_byte(0, 0x400 * 3, addr));\n *(uint32_t *)&s->dc_palette[addr] = value;\n s->do_full_update = true;\n}",
  14249. "project": "qemu",
  14250. "hash": 299348227447027593925553329038089657088,
  14251. "size": 14,
  14252. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14253. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14254. "target": 0,
  14255. "dataset": "other",
  14256. "idx": 367040
  14257. },
  14258. {
  14259. "func": "static void sm501_update_display(void *opaque)\n{\n SM501State *s = (SM501State *)opaque;\n DisplaySurface *surface = qemu_console_surface(s->con);\n DirtyBitmapSnapshot *snap;\n int y, c_x = 0, c_y = 0;\n int crt = (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0;\n int width = get_width(s, crt);\n int height = get_height(s, crt);\n int src_bpp = get_bpp(s, crt);\n int dst_bpp = surface_bytes_per_pixel(surface);\n int dst_depth_index = get_depth_index(surface);\n draw_line_func *draw_line = NULL;\n draw_hwc_line_func *draw_hwc_line = NULL;\n int full_update = 0;\n int y_start = -1;\n ram_addr_t offset;\n uint32_t *palette;\n uint8_t hwc_palette[3 * 3];\n uint8_t *hwc_src = NULL;\n\n if (!((crt ? s->dc_crt_control : s->dc_panel_control)\n & SM501_DC_CRT_CONTROL_ENABLE)) {\n return;\n }\n\n palette = (uint32_t *)(crt ? &s->dc_palette[SM501_DC_CRT_PALETTE -\n SM501_DC_PANEL_PALETTE]\n : &s->dc_palette[0]);\n\n /* choose draw_line function */\n switch (src_bpp) {\n case 1:\n draw_line = draw_line8_funcs[dst_depth_index];\n break;\n case 2:\n draw_line = draw_line16_funcs[dst_depth_index];\n break;\n case 4:\n draw_line = draw_line32_funcs[dst_depth_index];\n break;\n default:\n qemu_log_mask(LOG_GUEST_ERROR, \"sm501: update display\"\n \"invalid control register value.\\n\");\n return;\n }\n\n /* set up to draw hardware cursor */\n if (is_hwc_enabled(s, crt)) {\n /* choose cursor draw line function */\n draw_hwc_line = draw_hwc_line_funcs[dst_depth_index];\n hwc_src = get_hwc_address(s, crt);\n c_x = get_hwc_x(s, crt);\n c_y = get_hwc_y(s, crt);\n get_hwc_palette(s, crt, hwc_palette);\n }\n\n /* adjust console size */\n if (s->last_width != width || s->last_height != height) {\n qemu_console_resize(s->con, width, height);\n surface = qemu_console_surface(s->con);\n s->last_width = width;\n s->last_height = height;\n full_update = 1;\n }\n\n /* someone else requested a full update */\n if (s->do_full_update) {\n s->do_full_update = false;\n full_update = 1;\n }\n\n /* draw each line according to conditions */\n offset = get_fb_addr(s, crt);\n snap = memory_region_snapshot_and_clear_dirty(&s->local_mem_region,\n offset, width * height * src_bpp, DIRTY_MEMORY_VGA);\n for (y = 0; y < height; y++, offset += width * src_bpp) {\n int update, update_hwc;\n\n /* check if hardware cursor is enabled and we're within its range */\n update_hwc = draw_hwc_line && c_y <= y && y < c_y + SM501_HWC_HEIGHT;\n update = full_update || update_hwc;\n /* check dirty flags for each line */\n update |= memory_region_snapshot_get_dirty(&s->local_mem_region, snap,\n offset, width * src_bpp);\n\n /* draw line and change status */\n if (update) {\n uint8_t *d = surface_data(surface);\n d += y * width * dst_bpp;\n\n /* draw graphics layer */\n draw_line(d, s->local_mem + offset, width, palette);\n\n /* draw hardware cursor */\n if (update_hwc) {\n draw_hwc_line(d, hwc_src, width, hwc_palette, c_x, y - c_y);\n }\n\n if (y_start < 0) {\n y_start = y;\n }\n } else {\n if (y_start >= 0) {\n /* flush to display */\n dpy_gfx_update(s->con, 0, y_start, width, y - y_start);\n y_start = -1;\n }\n }\n }\n g_free(snap);\n\n /* complete flush to display */\n if (y_start >= 0) {\n dpy_gfx_update(s->con, 0, y_start, width, y - y_start);\n }\n}",
  14260. "project": "qemu",
  14261. "hash": 297137882338984229453453035036409106954,
  14262. "size": 117,
  14263. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14264. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14265. "target": 0,
  14266. "dataset": "other",
  14267. "idx": 367030
  14268. },
  14269. {
  14270. "func": "static void sm501_2d_operation(SM501State *s)\n{\n int cmd = (s->twoD_control >> 16) & 0x1F;\n int rtl = s->twoD_control & BIT(27);\n int format = (s->twoD_stretch >> 20) & 0x3;\n int rop_mode = (s->twoD_control >> 15) & 0x1; /* 1 for rop2, else rop3 */\n /* 1 if rop2 source is the pattern, otherwise the source is the bitmap */\n int rop2_source_is_pattern = (s->twoD_control >> 14) & 0x1;\n int rop = s->twoD_control & 0xFF;\n int dst_x = (s->twoD_destination >> 16) & 0x01FFF;\n int dst_y = s->twoD_destination & 0xFFFF;\n int width = (s->twoD_dimension >> 16) & 0x1FFF;\n int height = s->twoD_dimension & 0xFFFF;\n uint32_t dst_base = s->twoD_destination_base & 0x03FFFFFF;\n uint8_t *dst = s->local_mem + dst_base;\n int dst_pitch = (s->twoD_pitch >> 16) & 0x1FFF;\n int crt = (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0;\n int fb_len = get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt);\n\n if ((s->twoD_stretch >> 16) & 0xF) {\n qemu_log_mask(LOG_UNIMP, \"sm501: only XY addressing is supported.\\n\");\n return;\n }\n\n if (rop_mode == 0) {\n if (rop != 0xcc) {\n /* Anything other than plain copies are not supported */\n qemu_log_mask(LOG_UNIMP, \"sm501: rop3 mode with rop %x is not \"\n \"supported.\\n\", rop);\n }\n } else {\n if (rop2_source_is_pattern && rop != 0x5) {\n /* For pattern source, we support only inverse dest */\n qemu_log_mask(LOG_UNIMP, \"sm501: rop2 source being the pattern and \"\n \"rop %x is not supported.\\n\", rop);\n } else {\n if (rop != 0x5 && rop != 0xc) {\n /* Anything other than plain copies or inverse dest is not\n * supported */\n qemu_log_mask(LOG_UNIMP, \"sm501: rop mode %x is not \"\n \"supported.\\n\", rop);\n }\n }\n }\n\n if (s->twoD_source_base & BIT(27) || s->twoD_destination_base & BIT(27)) {\n qemu_log_mask(LOG_UNIMP, \"sm501: only local memory is supported.\\n\");\n return;\n }\n\n switch (cmd) {\n case 0x00: /* copy area */\n {\n int src_x = (s->twoD_source >> 16) & 0x01FFF;\n int src_y = s->twoD_source & 0xFFFF;\n uint32_t src_base = s->twoD_source_base & 0x03FFFFFF;\n uint8_t *src = s->local_mem + src_base;\n int src_pitch = s->twoD_pitch & 0x1FFF;\n\n#define COPY_AREA(_bpp, _pixel_type, rtl) { \\\n int y, x, index_d, index_s; \\\n for (y = 0; y < height; y++) { \\\n for (x = 0; x < width; x++) { \\\n _pixel_type val; \\\n \\\n if (rtl) { \\\n index_s = ((src_y - y) * src_pitch + src_x - x) * _bpp; \\\n index_d = ((dst_y - y) * dst_pitch + dst_x - x) * _bpp; \\\n } else { \\\n index_s = ((src_y + y) * src_pitch + src_x + x) * _bpp; \\\n index_d = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \\\n } \\\n if (rop_mode == 1 && rop == 5) { \\\n /* Invert dest */ \\\n val = ~*(_pixel_type *)&dst[index_d]; \\\n } else { \\\n val = *(_pixel_type *)&src[index_s]; \\\n } \\\n *(_pixel_type *)&dst[index_d] = val; \\\n } \\\n } \\\n }\n switch (format) {\n case 0:\n COPY_AREA(1, uint8_t, rtl);\n break;\n case 1:\n COPY_AREA(2, uint16_t, rtl);\n break;\n case 2:\n COPY_AREA(4, uint32_t, rtl);\n break;\n }\n break;\n }\n case 0x01: /* fill rectangle */\n {\n uint32_t color = s->twoD_foreground;\n\n#define FILL_RECT(_bpp, _pixel_type) { \\\n int y, x; \\\n for (y = 0; y < height; y++) { \\\n for (x = 0; x < width; x++) { \\\n int index = ((dst_y + y) * dst_pitch + dst_x + x) * _bpp; \\\n *(_pixel_type *)&dst[index] = (_pixel_type)color; \\\n } \\\n } \\\n }\n\n switch (format) {\n case 0:\n FILL_RECT(1, uint8_t);\n break;\n case 1:\n color = cpu_to_le16(color);\n FILL_RECT(2, uint16_t);\n break;\n case 2:\n color = cpu_to_le32(color);\n FILL_RECT(4, uint32_t);\n break;\n }\n break;\n }\n default:\n qemu_log_mask(LOG_UNIMP, \"sm501: not implemented 2D operation: %d\\n\",\n cmd);\n return;\n }\n\n if (dst_base >= get_fb_addr(s, crt) &&\n dst_base <= get_fb_addr(s, crt) + fb_len) {\n int dst_len = MIN(fb_len, ((dst_y + height - 1) * dst_pitch +\n dst_x + width) * (1 << format));\n if (dst_len) {\n memory_region_set_dirty(&s->local_mem_region, dst_base, dst_len);\n }\n }\n}",
  14271. "project": "qemu",
  14272. "hash": 231921026198244072541449258178431781416,
  14273. "size": 139,
  14274. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14275. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14276. "target": 1,
  14277. "dataset": "other",
  14278. "idx": 204867
  14279. },
  14280. {
  14281. "func": "static void sm501_2d_operation(SM501State *s)\n{\n int cmd = (s->twoD_control >> 16) & 0x1F;\n int rtl = s->twoD_control & BIT(27);\n int format = (s->twoD_stretch >> 20) & 0x3;\n int rop_mode = (s->twoD_control >> 15) & 0x1; /* 1 for rop2, else rop3 */\n /* 1 if rop2 source is the pattern, otherwise the source is the bitmap */\n int rop2_source_is_pattern = (s->twoD_control >> 14) & 0x1;\n int rop = s->twoD_control & 0xFF;\n unsigned int dst_x = (s->twoD_destination >> 16) & 0x01FFF;\n unsigned int dst_y = s->twoD_destination & 0xFFFF;\n unsigned int width = (s->twoD_dimension >> 16) & 0x1FFF;\n unsigned int height = s->twoD_dimension & 0xFFFF;\n uint32_t dst_base = s->twoD_destination_base & 0x03FFFFFF;\n unsigned int dst_pitch = (s->twoD_pitch >> 16) & 0x1FFF;\n int crt = (s->dc_crt_control & SM501_DC_CRT_CONTROL_SEL) ? 1 : 0;\n int fb_len = get_width(s, crt) * get_height(s, crt) * get_bpp(s, crt);\n\n if ((s->twoD_stretch >> 16) & 0xF) {\n qemu_log_mask(LOG_UNIMP, \"sm501: only XY addressing is supported.\\n\");\n return;\n }\n\n if (s->twoD_source_base & BIT(27) || s->twoD_destination_base & BIT(27)) {\n qemu_log_mask(LOG_UNIMP, \"sm501: only local memory is supported.\\n\");\n return;\n }\n\n if (!dst_pitch) {\n qemu_log_mask(LOG_GUEST_ERROR, \"sm501: Zero dest pitch.\\n\");\n return;\n }\n\n if (!width || !height) {\n qemu_log_mask(LOG_GUEST_ERROR, \"sm501: Zero size 2D op.\\n\");\n return;\n }\n\n if (rtl) {\n dst_x -= width - 1;\n dst_y -= height - 1;\n }\n\n if (dst_base >= get_local_mem_size(s) || dst_base +\n (dst_x + width + (dst_y + height) * (dst_pitch + width)) *\n (1 << format) >= get_local_mem_size(s)) {\n qemu_log_mask(LOG_GUEST_ERROR, \"sm501: 2D op dest is outside vram.\\n\");\n return;\n }\n\n switch (cmd) {\n case 0: /* BitBlt */\n {\n unsigned int src_x = (s->twoD_source >> 16) & 0x01FFF;\n unsigned int src_y = s->twoD_source & 0xFFFF;\n uint32_t src_base = s->twoD_source_base & 0x03FFFFFF;\n unsigned int src_pitch = s->twoD_pitch & 0x1FFF;\n\n if (!src_pitch) {\n qemu_log_mask(LOG_GUEST_ERROR, \"sm501: Zero src pitch.\\n\");\n return;\n }\n\n if (rtl) {\n src_x -= width - 1;\n src_y -= height - 1;\n }\n\n if (src_base >= get_local_mem_size(s) || src_base +\n (src_x + width + (src_y + height) * (src_pitch + width)) *\n (1 << format) >= get_local_mem_size(s)) {\n qemu_log_mask(LOG_GUEST_ERROR,\n \"sm501: 2D op src is outside vram.\\n\");\n return;\n }\n\n if ((rop_mode && rop == 0x5) || (!rop_mode && rop == 0x55)) {\n /* Invert dest, is there a way to do this with pixman? */\n unsigned int x, y, i;\n uint8_t *d = s->local_mem + dst_base;\n\n for (y = 0; y < height; y++) {\n i = (dst_x + (dst_y + y) * dst_pitch) * (1 << format);\n for (x = 0; x < width; x++, i += (1 << format)) {\n switch (format) {\n case 0:\n d[i] = ~d[i];\n break;\n case 1:\n *(uint16_t *)&d[i] = ~*(uint16_t *)&d[i];\n break;\n case 2:\n *(uint32_t *)&d[i] = ~*(uint32_t *)&d[i];\n break;\n }\n }\n }\n } else {\n /* Do copy src for unimplemented ops, better than unpainted area */\n if ((rop_mode && (rop != 0xc || rop2_source_is_pattern)) ||\n (!rop_mode && rop != 0xcc)) {\n qemu_log_mask(LOG_UNIMP,\n \"sm501: rop%d op %x%s not implemented\\n\",\n (rop_mode ? 2 : 3), rop,\n (rop2_source_is_pattern ?\n \" with pattern source\" : \"\"));\n }\n /* Check for overlaps, this could be made more exact */\n uint32_t sb, se, db, de;\n sb = src_base + src_x + src_y * (width + src_pitch);\n se = sb + width + height * (width + src_pitch);\n db = dst_base + dst_x + dst_y * (width + dst_pitch);\n de = db + width + height * (width + dst_pitch);\n if (rtl && ((db >= sb && db <= se) || (de >= sb && de <= se))) {\n /* regions may overlap: copy via temporary */\n int llb = width * (1 << format);\n int tmp_stride = DIV_ROUND_UP(llb, sizeof(uint32_t));\n uint32_t *tmp = g_malloc(tmp_stride * sizeof(uint32_t) *\n height);\n pixman_blt((uint32_t *)&s->local_mem[src_base], tmp,\n src_pitch * (1 << format) / sizeof(uint32_t),\n tmp_stride, 8 * (1 << format), 8 * (1 << format),\n src_x, src_y, 0, 0, width, height);\n pixman_blt(tmp, (uint32_t *)&s->local_mem[dst_base],\n tmp_stride,\n dst_pitch * (1 << format) / sizeof(uint32_t),\n 8 * (1 << format), 8 * (1 << format),\n 0, 0, dst_x, dst_y, width, height);\n g_free(tmp);\n } else {\n pixman_blt((uint32_t *)&s->local_mem[src_base],\n (uint32_t *)&s->local_mem[dst_base],\n src_pitch * (1 << format) / sizeof(uint32_t),\n dst_pitch * (1 << format) / sizeof(uint32_t),\n 8 * (1 << format), 8 * (1 << format),\n src_x, src_y, dst_x, dst_y, width, height);\n }\n }\n break;\n }\n case 1: /* Rectangle Fill */\n {\n uint32_t color = s->twoD_foreground;\n\n if (format == 2) {\n color = cpu_to_le32(color);\n } else if (format == 1) {\n color = cpu_to_le16(color);\n }\n\n pixman_fill((uint32_t *)&s->local_mem[dst_base],\n dst_pitch * (1 << format) / sizeof(uint32_t),\n 8 * (1 << format), dst_x, dst_y, width, height, color);\n break;\n }\n default:\n qemu_log_mask(LOG_UNIMP, \"sm501: not implemented 2D operation: %d\\n\",\n cmd);\n return;\n }\n\n if (dst_base >= get_fb_addr(s, crt) &&\n dst_base <= get_fb_addr(s, crt) + fb_len) {\n int dst_len = MIN(fb_len, ((dst_y + height - 1) * dst_pitch +\n dst_x + width) * (1 << format));\n if (dst_len) {\n memory_region_set_dirty(&s->local_mem_region, dst_base, dst_len);\n }\n }\n}",
  14282. "project": "qemu",
  14283. "hash": 193599277263988750788636095730957842514,
  14284. "size": 170,
  14285. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14286. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14287. "target": 0,
  14288. "dataset": "other",
  14289. "idx": 367048
  14290. },
  14291. {
  14292. "func": "static inline void get_hwc_palette(SM501State *state, int crt, uint8_t *palette)\n{\n int i;\n uint32_t color_reg;\n uint16_t rgb565;\n\n for (i = 0; i < 3; i++) {\n if (i + 1 == 3) {\n color_reg = crt ? state->dc_crt_hwc_color_3\n : state->dc_panel_hwc_color_3;\n } else {\n color_reg = crt ? state->dc_crt_hwc_color_1_2\n : state->dc_panel_hwc_color_1_2;\n }\n\n if (i + 1 == 2) {\n rgb565 = (color_reg >> 16) & 0xFFFF;\n } else {\n rgb565 = color_reg & 0xFFFF;\n }\n palette[i * 3 + 0] = ((rgb565 >> 11) * 527 + 23) >> 6; /* r */\n palette[i * 3 + 1] = (((rgb565 >> 5) & 0x3f) * 259 + 33) >> 6; /* g */\n palette[i * 3 + 2] = ((rgb565 & 0x1f) * 527 + 23) >> 6; /* b */\n }\n}",
  14293. "project": "qemu",
  14294. "hash": 234605290825547818258321512605029953833,
  14295. "size": 25,
  14296. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14297. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14298. "target": 0,
  14299. "dataset": "other",
  14300. "idx": 367033
  14301. },
  14302. {
  14303. "func": "static ram_addr_t get_fb_addr(SM501State *s, int crt)\n{\n return (crt ? s->dc_crt_fb_addr : s->dc_panel_fb_addr) & 0x3FFFFF0;\n}",
  14304. "project": "qemu",
  14305. "hash": 65919623857096050051872707777007043422,
  14306. "size": 4,
  14307. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  14308. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  14309. "target": 0,
  14310. "dataset": "other",
  14311. "idx": 367046
  14312. }
  14313. ]
  14314. },
  14315. {
  14316. "call_depth": 3,
  14317. "longest_call_chain": [
  14318. "Item_date_literal_for_invalid_dates",
  14319. "Item_date_literal",
  14320. "Item_temporal_literal"
  14321. ],
  14322. "group_size": 5,
  14323. "functions": [
  14324. {
  14325. "func": " Item_date_literal_for_invalid_dates(THD *thd, MYSQL_TIME *ltime)\n :Item_date_literal(thd, ltime) { }",
  14326. "target": 0,
  14327. "cwe": [
  14328. "CWE-617"
  14329. ],
  14330. "project": "server",
  14331. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  14332. "hash": 229380278239657614383198296314294260978,
  14333. "size": 2,
  14334. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  14335. "dataset": "other",
  14336. "idx": 508998
  14337. },
  14338. {
  14339. "func": " Item_temporal_literal(THD *thd, MYSQL_TIME *ltime): Item_basic_constant(thd)\n {\n collation.set(&my_charset_numeric, DERIVATION_NUMERIC, MY_REPERTOIRE_ASCII);\n decimals= 0;\n cached_time= *ltime;\n }",
  14340. "target": 0,
  14341. "cwe": [
  14342. "CWE-617"
  14343. ],
  14344. "project": "server",
  14345. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  14346. "hash": 333902726742250299444990778797733486790,
  14347. "size": 6,
  14348. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  14349. "dataset": "other",
  14350. "idx": 508961
  14351. },
  14352. {
  14353. "func": " Item_datetime_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg):\n Item_temporal_literal(thd, ltime, dec_arg)\n {\n max_length= MAX_DATETIME_WIDTH + (decimals ? decimals + 1 : 0);\n fixed= 1;\n // See the comment on maybe_null in Item_date_literal\n maybe_null= !ltime->month || !ltime->day;\n }",
  14354. "target": 0,
  14355. "cwe": [
  14356. "CWE-617"
  14357. ],
  14358. "project": "server",
  14359. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  14360. "hash": 128106558223069508848112850381952981028,
  14361. "size": 8,
  14362. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  14363. "dataset": "other",
  14364. "idx": 509119
  14365. },
  14366. {
  14367. "func": " Item_time_literal(THD *thd, MYSQL_TIME *ltime, uint dec_arg):\n Item_temporal_literal(thd, ltime, dec_arg)\n {\n max_length= MIN_TIME_WIDTH + (decimals ? decimals + 1 : 0);\n fixed= 1;\n }",
  14368. "target": 0,
  14369. "cwe": [
  14370. "CWE-617"
  14371. ],
  14372. "project": "server",
  14373. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  14374. "hash": 109292535260091574556332471936288918796,
  14375. "size": 6,
  14376. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  14377. "dataset": "other",
  14378. "idx": 509153
  14379. },
  14380. {
  14381. "func": " Item_date_literal(THD *thd, MYSQL_TIME *ltime)\n :Item_temporal_literal(thd, ltime)\n {\n max_length= MAX_DATE_WIDTH;\n fixed= 1;\n /*\n If date has zero month or day, it can return NULL in case of\n NO_ZERO_DATE or NO_ZERO_IN_DATE.\n We can't just check the current sql_mode here in constructor,\n because sql_mode can change in case of prepared statements\n between PREPARE and EXECUTE.\n */\n maybe_null= !ltime->month || !ltime->day;\n }",
  14382. "target": 0,
  14383. "cwe": [
  14384. "CWE-617"
  14385. ],
  14386. "project": "server",
  14387. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  14388. "hash": 282667106903706339638738501080787819043,
  14389. "size": 14,
  14390. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  14391. "dataset": "other",
  14392. "idx": 508935
  14393. }
  14394. ]
  14395. },
  14396. {
  14397. "call_depth": 4,
  14398. "longest_call_chain": [
  14399. "find_impl",
  14400. "xmlXPathEval",
  14401. "xmlXPathEvalExpr",
  14402. "xmlXPathOptimizeExpression"
  14403. ],
  14404. "group_size": 8,
  14405. "functions": [
  14406. {
  14407. "func": " */\nxmlXPathObjectPtr\nxmlXPathEval(const xmlChar *str, xmlXPathContextPtr ctx) {\n xmlXPathParserContextPtr ctxt;\n xmlXPathObjectPtr res;\n\n CHECK_CTXT(ctx)\n\n xmlXPathInit();\n\n ctxt = xmlXPathNewParserContext(str, ctx);\n if (ctxt == NULL)\n return NULL;\n xmlXPathEvalExpr(ctxt);\n\n if (ctxt->error != XPATH_EXPRESSION_OK) {\n\tres = NULL;\n } else {\n\tres = valuePop(ctxt);\n if (res == NULL) {\n xmlGenericError(xmlGenericErrorContext,\n \"xmlXPathCompiledEval: No result on the stack.\\n\");\n } else if (ctxt->valueNr > 0) {\n xmlGenericError(xmlGenericErrorContext,\n \"xmlXPathCompiledEval: %d object(s) left on the stack.\\n\",\n ctxt->valueNr);\n }\n }\n\n xmlXPathFreeParserContext(ctxt);",
  14408. "project": "libxml2",
  14409. "hash": 15397346949911455492662650263481010792,
  14410. "size": 30,
  14411. "commit_id": "0f3b843b3534784ef57a4f9b874238aa1fda5a73",
  14412. "message": "Fix XPath stack frame logic\n\nMove the calls to xmlXPathSetFrame and xmlXPathPopFrame around in\nxmlXPathCompOpEvalPositionalPredicate to make sure that the context\nobject on the stack is actually protected. Otherwise, memory corruption\ncan occur when calling sloppily coded XPath extension functions.\n\nFixes bug 783160.",
  14413. "target": 0,
  14414. "dataset": "other",
  14415. "idx": 385350
  14416. },
  14417. {
  14418. "project": "ardour",
  14419. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  14420. "target": 1,
  14421. "func": "static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string& xpath)\n{\n\txmlXPathObject* result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt);\n\n\tif (!result) {\n\t\txmlXPathFreeContext(ctxt);\n\t\txmlFreeDoc(ctxt->doc);\n\n\t\tthrow XMLException(\"Invalid XPath: \" + xpath);\n\t}\n\n\tif (result->type != XPATH_NODESET) {\n\t\txmlXPathFreeObject(result);\n\t\txmlXPathFreeContext(ctxt);\n\t\txmlFreeDoc(ctxt->doc);\n\n\t\tthrow XMLException(\"Only nodeset result types are supported.\");\n\t}\n\n\txmlNodeSet* nodeset = result->nodesetval;\n\tXMLSharedNodeList* nodes = new XMLSharedNodeList();\n\tif (nodeset) {\n\t\tfor (int i = 0; i < nodeset->nodeNr; ++i) {\n\t\t\tXMLNode* node = readnode(nodeset->nodeTab[i]);\n\t\t\tnodes->push_back(boost::shared_ptr<XMLNode>(node));\n\t\t}\n\t} else {\n\t\t// return empty set\n\t}\n\n\txmlXPathFreeObject(result);\n\n\treturn nodes;\n}",
  14422. "idx": 217254,
  14423. "cwe": "CWE-416",
  14424. "hash": 54268186819182218721269174810414224706,
  14425. "dataset": "other"
  14426. },
  14427. {
  14428. "project": "ardour",
  14429. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  14430. "target": 0,
  14431. "func": "static XMLSharedNodeList* find_impl(xmlXPathContext* ctxt, const string& xpath)\n{\n\txmlXPathObject* result = xmlXPathEval((const xmlChar*)xpath.c_str(), ctxt);\n\n\tif (!result) {\n\t\txmlFreeDoc(ctxt->doc);\n\t\txmlXPathFreeContext(ctxt);\n\n\t\tthrow XMLException(\"Invalid XPath: \" + xpath);\n\t}\n\n\tif (result->type != XPATH_NODESET) {\n\t\txmlXPathFreeObject(result);\n\t\txmlFreeDoc(ctxt->doc);\n\t\txmlXPathFreeContext(ctxt);\n\n\t\tthrow XMLException(\"Only nodeset result types are supported.\");\n\t}\n\n\txmlNodeSet* nodeset = result->nodesetval;\n\tXMLSharedNodeList* nodes = new XMLSharedNodeList();\n\tif (nodeset) {\n\t\tfor (int i = 0; i < nodeset->nodeNr; ++i) {\n\t\t\tXMLNode* node = readnode(nodeset->nodeTab[i]);\n\t\t\tnodes->push_back(boost::shared_ptr<XMLNode>(node));\n\t\t}\n\t} else {\n\t\t// return empty set\n\t}\n\n\txmlXPathFreeObject(result);\n\n\treturn nodes;\n}",
  14432. "idx": 519644,
  14433. "cwe": "CWE-416",
  14434. "hash": 16148318620035569612064845448555816656,
  14435. "dataset": "other"
  14436. },
  14437. {
  14438. "func": "\nstatic void\nxmlXPathOptimizeExpression(xmlXPathCompExprPtr comp, xmlXPathStepOpPtr op)\n{\n /*\n * Try to rewrite \"descendant-or-self::node()/foo\" to an optimized\n * internal representation.\n */\n\n if ((op->op == XPATH_OP_COLLECT /* 11 */) &&\n (op->ch1 != -1) &&\n (op->ch2 == -1 /* no predicate */))\n {\n xmlXPathStepOpPtr prevop = &comp->steps[op->ch1];\n\n if ((prevop->op == XPATH_OP_COLLECT /* 11 */) &&\n ((xmlXPathAxisVal) prevop->value ==\n AXIS_DESCENDANT_OR_SELF) &&\n (prevop->ch2 == -1) &&\n ((xmlXPathTestVal) prevop->value2 == NODE_TEST_TYPE) &&\n ((xmlXPathTypeVal) prevop->value3 == NODE_TYPE_NODE))\n {\n /*\n * This is a \"descendant-or-self::node()\" without predicates.\n * Try to eliminate it.\n */\n\n switch ((xmlXPathAxisVal) op->value) {\n case AXIS_CHILD:\n case AXIS_DESCENDANT:\n /*\n * Convert \"descendant-or-self::node()/child::\" or\n * \"descendant-or-self::node()/descendant::\" to\n * \"descendant::\"\n */\n op->ch1 = prevop->ch1;\n op->value = AXIS_DESCENDANT;\n break;\n case AXIS_SELF:\n case AXIS_DESCENDANT_OR_SELF:\n /*\n * Convert \"descendant-or-self::node()/self::\" or\n * \"descendant-or-self::node()/descendant-or-self::\" to\n * to \"descendant-or-self::\"\n */\n op->ch1 = prevop->ch1;\n op->value = AXIS_DESCENDANT_OR_SELF;\n break;\n default:\n break;\n }\n\t}\n }\n\n /* OP_VALUE has invalid ch1. */\n if (op->op == XPATH_OP_VALUE)\n return;\n\n /* Recurse */\n if (op->ch1 != -1)\n xmlXPathOptimizeExpression(comp, &comp->steps[op->ch1]);\n if (op->ch2 != -1)",
  14439. "project": "libxml2",
  14440. "hash": 217837651282250935525823086582739608231,
  14441. "size": 62,
  14442. "commit_id": "0f3b843b3534784ef57a4f9b874238aa1fda5a73",
  14443. "message": "Fix XPath stack frame logic\n\nMove the calls to xmlXPathSetFrame and xmlXPathPopFrame around in\nxmlXPathCompOpEvalPositionalPredicate to make sure that the context\nobject on the stack is actually protected. Otherwise, memory corruption\ncan occur when calling sloppily coded XPath extension functions.\n\nFixes bug 783160.",
  14444. "target": 0,
  14445. "dataset": "other",
  14446. "idx": 385372
  14447. },
  14448. {
  14449. "func": " */\nstatic int\nxmlXPathCompiledEvalInternal(xmlXPathCompExprPtr comp,\n\t\t\t xmlXPathContextPtr ctxt,\n\t\t\t xmlXPathObjectPtr *resObjPtr,\n\t\t\t int toBool)\n{\n xmlXPathParserContextPtr pctxt;\n xmlXPathObjectPtr resObj;\n#ifndef LIBXML_THREAD_ENABLED\n static int reentance = 0;\n#endif\n int res;\n\n CHECK_CTXT_NEG(ctxt)\n\n if (comp == NULL)\n\treturn(-1);\n xmlXPathInit();\n\n#ifndef LIBXML_THREAD_ENABLED\n reentance++;\n if (reentance > 1)\n\txmlXPathDisableOptimizer = 1;\n#endif\n\n#ifdef DEBUG_EVAL_COUNTS\n comp->nb++;\n if ((comp->string != NULL) && (comp->nb > 100)) {\n\tfprintf(stderr, \"100 x %s\\n\", comp->string);\n\tcomp->nb = 0;\n }\n#endif\n pctxt = xmlXPathCompParserContext(comp, ctxt);\n res = xmlXPathRunEval(pctxt, toBool);\n\n if (pctxt->error != XPATH_EXPRESSION_OK) {\n resObj = NULL;\n } else {\n resObj = valuePop(pctxt);\n if (resObj == NULL) {\n if (!toBool)\n xmlGenericError(xmlGenericErrorContext,\n \"xmlXPathCompiledEval: No result on the stack.\\n\");\n } else if (pctxt->valueNr > 0) {\n xmlGenericError(xmlGenericErrorContext,\n \"xmlXPathCompiledEval: %d object(s) left on the stack.\\n\",\n pctxt->valueNr);\n }\n }\n\n if (resObjPtr)\n *resObjPtr = resObj;\n else\n xmlXPathReleaseObject(ctxt, resObj);\n\n pctxt->comp = NULL;\n xmlXPathFreeParserContext(pctxt);\n#ifndef LIBXML_THREAD_ENABLED\n reentance--;\n#endif\n",
  14450. "project": "libxml2",
  14451. "hash": 23977613311806536704883727357632897099,
  14452. "size": 62,
  14453. "commit_id": "0f3b843b3534784ef57a4f9b874238aa1fda5a73",
  14454. "message": "Fix XPath stack frame logic\n\nMove the calls to xmlXPathSetFrame and xmlXPathPopFrame around in\nxmlXPathCompOpEvalPositionalPredicate to make sure that the context\nobject on the stack is actually protected. Otherwise, memory corruption\ncan occur when calling sloppily coded XPath extension functions.\n\nFixes bug 783160.",
  14455. "target": 0,
  14456. "dataset": "other",
  14457. "idx": 385366
  14458. },
  14459. {
  14460. "func": " */\nxmlXPathCompExprPtr\nxmlXPathCtxtCompile(xmlXPathContextPtr ctxt, const xmlChar *str) {\n xmlXPathParserContextPtr pctxt;\n xmlXPathCompExprPtr comp;\n\n#ifdef XPATH_STREAMING\n comp = xmlXPathTryStreamCompile(ctxt, str);\n if (comp != NULL)\n return(comp);\n#endif\n\n xmlXPathInit();\n\n pctxt = xmlXPathNewParserContext(str, ctxt);\n if (pctxt == NULL)\n return NULL;\n xmlXPathCompileExpr(pctxt, 1);\n\n if( pctxt->error != XPATH_EXPRESSION_OK )\n {\n xmlXPathFreeParserContext(pctxt);\n return(NULL);\n }\n\n if (*pctxt->cur != 0) {\n\t/*\n\t * aleksey: in some cases this line prints *second* error message\n\t * (see bug #78858) and probably this should be fixed.\n\t * However, we are not sure that all error messages are printed\n\t * out in other places. It's not critical so we leave it as-is for now\n\t */\n\txmlXPatherror(pctxt, __FILE__, __LINE__, XPATH_EXPR_ERROR);\n\tcomp = NULL;\n } else {\n\tcomp = pctxt->comp;\n\tpctxt->comp = NULL;\n }\n xmlXPathFreeParserContext(pctxt);\n\n if (comp != NULL) {\n\tcomp->expr = xmlStrdup(str);\n#ifdef DEBUG_EVAL_COUNTS\n\tcomp->string = xmlStrdup(str);\n\tcomp->nb = 0;\n#endif\n\tif ((comp->nbStep > 1) && (comp->last >= 0)) {\n\t xmlXPathOptimizeExpression(comp, &comp->steps[comp->last]);\n\t}\n }",
  14461. "project": "libxml2",
  14462. "hash": 146219488063183863687061976661089820292,
  14463. "size": 50,
  14464. "commit_id": "0f3b843b3534784ef57a4f9b874238aa1fda5a73",
  14465. "message": "Fix XPath stack frame logic\n\nMove the calls to xmlXPathSetFrame and xmlXPathPopFrame around in\nxmlXPathCompOpEvalPositionalPredicate to make sure that the context\nobject on the stack is actually protected. Otherwise, memory corruption\ncan occur when calling sloppily coded XPath extension functions.\n\nFixes bug 783160.",
  14466. "target": 0,
  14467. "dataset": "other",
  14468. "idx": 385358
  14469. },
  14470. {
  14471. "func": " */\nvoid\nxmlXPathEvalExpr(xmlXPathParserContextPtr ctxt) {\n#ifdef XPATH_STREAMING\n xmlXPathCompExprPtr comp;\n#endif\n\n if (ctxt == NULL) return;\n\n#ifdef XPATH_STREAMING\n comp = xmlXPathTryStreamCompile(ctxt->context, ctxt->base);\n if (comp != NULL) {\n if (ctxt->comp != NULL)\n\t xmlXPathFreeCompExpr(ctxt->comp);\n ctxt->comp = comp;\n } else\n#endif\n {\n\txmlXPathCompileExpr(ctxt, 1);\n CHECK_ERROR;\n\n /* Check for trailing characters. */\n if (*ctxt->cur != 0)\n XP_ERROR(XPATH_EXPR_ERROR);\n\n\tif ((ctxt->comp->nbStep > 1) && (ctxt->comp->last >= 0))\n\t xmlXPathOptimizeExpression(ctxt->comp,\n\t\t&ctxt->comp->steps[ctxt->comp->last]);\n }\n",
  14472. "project": "libxml2",
  14473. "hash": 61204497316746030956175928442524571737,
  14474. "size": 30,
  14475. "commit_id": "0f3b843b3534784ef57a4f9b874238aa1fda5a73",
  14476. "message": "Fix XPath stack frame logic\n\nMove the calls to xmlXPathSetFrame and xmlXPathPopFrame around in\nxmlXPathCompOpEvalPositionalPredicate to make sure that the context\nobject on the stack is actually protected. Otherwise, memory corruption\ncan occur when calling sloppily coded XPath extension functions.\n\nFixes bug 783160.",
  14477. "target": 0,
  14478. "dataset": "other",
  14479. "idx": 385322
  14480. },
  14481. {
  14482. "func": " */\nvoid\nxmlXPathFreeParserContext(xmlXPathParserContextPtr ctxt) {\n int i;\n\n if (ctxt->valueTab != NULL) {\n for (i = 0; i < ctxt->valueNr; i++) {\n if (ctxt->context)\n xmlXPathReleaseObject(ctxt->context, ctxt->valueTab[i]);\n else\n xmlXPathFreeObject(ctxt->valueTab[i]);\n }\n xmlFree(ctxt->valueTab);\n }\n if (ctxt->comp != NULL) {\n#ifdef XPATH_STREAMING\n\tif (ctxt->comp->stream != NULL) {\n\t xmlFreePatternList(ctxt->comp->stream);\n\t ctxt->comp->stream = NULL;\n\t}\n#endif\n\txmlXPathFreeCompExpr(ctxt->comp);\n }",
  14483. "project": "libxml2",
  14484. "hash": 313070256777369079216055804346982777932,
  14485. "size": 23,
  14486. "commit_id": "0f3b843b3534784ef57a4f9b874238aa1fda5a73",
  14487. "message": "Fix XPath stack frame logic\n\nMove the calls to xmlXPathSetFrame and xmlXPathPopFrame around in\nxmlXPathCompOpEvalPositionalPredicate to make sure that the context\nobject on the stack is actually protected. Otherwise, memory corruption\ncan occur when calling sloppily coded XPath extension functions.\n\nFixes bug 783160.",
  14488. "target": 0,
  14489. "dataset": "other",
  14490. "idx": 385368
  14491. }
  14492. ]
  14493. },
  14494. {
  14495. "call_depth": 4,
  14496. "longest_call_chain": [
  14497. "random_big_prime",
  14498. "is_probably_prime",
  14499. "MR_primality_test",
  14500. "ModularPower"
  14501. ],
  14502. "group_size": 6,
  14503. "functions": [
  14504. {
  14505. "project": "serenity",
  14506. "commit_id": "48fbf6a88d4822a1e5470cf08f29464511bd72c1",
  14507. "target": 0,
  14508. "func": "UnsignedBigInteger random_number(const UnsignedBigInteger& min, const UnsignedBigInteger& max_excluded)\n{\n ASSERT(min < max_excluded);\n auto range = max_excluded.minus(min);\n UnsignedBigInteger base;\n auto size = range.trimmed_length() * sizeof(u32) + 2;\n // \"+2\" is intentional (see below).\n // Also, if we're about to crash anyway, at least produce a nice error:\n ASSERT(size < 8 * MiB);\n u8 buf[size];\n AK::fill_with_random(buf, size);\n UnsignedBigInteger random { buf, size };\n // At this point, `random` is a large number, in the range [0, 256^size).\n // To get down to the actual range, we could just compute random % range.\n // This introduces \"modulo bias\". However, since we added 2 to `size`,\n // we know that the generated range is at least 65536 times as large as the\n // required range! This means that the modulo bias is only 0.0015%, if all\n // inputs are chosen adversarially. Let's hope this is good enough.\n auto divmod = random.divided_by(range);\n // The proper way to fix this is to restart if `divmod.quotient` is maximal.\n return divmod.remainder.plus(min);\n}",
  14509. "idx": 519158,
  14510. "cwe": "CWE-120",
  14511. "hash": 318674707994639862887917054544112435500,
  14512. "dataset": "other"
  14513. },
  14514. {
  14515. "project": "serenity",
  14516. "commit_id": "48fbf6a88d4822a1e5470cf08f29464511bd72c1",
  14517. "target": 1,
  14518. "func": "static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInteger, 256>& tests)\n{\n // Written using Wikipedia:\n // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Miller%E2%80%93Rabin_test\n ASSERT(!(n < 4));\n auto predecessor = n.minus({ 1 });\n auto d = predecessor;\n size_t r = 0;\n\n {\n auto div_result = d.divided_by(2);\n while (div_result.remainder == 0) {\n d = div_result.quotient;\n div_result = d.divided_by(2);\n ++r;\n }\n }\n if (r == 0) {\n // n - 1 is odd, so n was even. But there is only one even prime:\n return n == 2;\n }\n\n for (auto a : tests) {\n // Technically: ASSERT(2 <= a && a <= n - 2)\n ASSERT(a < n);\n auto x = ModularPower(a, d, n);\n if (x == 1 || x == predecessor)\n continue;\n bool skip_this_witness = false;\n // r − 1 iterations.\n for (size_t i = 0; i < r - 1; ++i) {\n x = ModularPower(x, 2, n);\n if (x == predecessor) {\n skip_this_witness = true;\n break;\n }\n }\n if (skip_this_witness)\n continue;\n return false; // \"composite\"\n }\n\n return true; // \"probably prime\"\n}",
  14519. "idx": 217238,
  14520. "cwe": "CWE-120",
  14521. "hash": 179391134827512981723637669244439395484,
  14522. "dataset": "other"
  14523. },
  14524. {
  14525. "project": "serenity",
  14526. "commit_id": "48fbf6a88d4822a1e5470cf08f29464511bd72c1",
  14527. "target": 0,
  14528. "func": "static bool MR_primality_test(UnsignedBigInteger n, const Vector<UnsignedBigInteger, 256>& tests)\n{\n // Written using Wikipedia:\n // https://en.wikipedia.org/wiki/Miller%E2%80%93Rabin_primality_test#Miller%E2%80%93Rabin_test\n ASSERT(!(n < 4));\n auto predecessor = n.minus({ 1 });\n auto d = predecessor;\n size_t r = 0;\n\n {\n auto div_result = d.divided_by(2);\n while (div_result.remainder == 0) {\n d = div_result.quotient;\n div_result = d.divided_by(2);\n ++r;\n }\n }\n if (r == 0) {\n // n - 1 is odd, so n was even. But there is only one even prime:\n return n == 2;\n }\n\n for (auto& a : tests) {\n // Technically: ASSERT(2 <= a && a <= n - 2)\n ASSERT(a < n);\n auto x = ModularPower(a, d, n);\n if (x == 1 || x == predecessor)\n continue;\n bool skip_this_witness = false;\n // r − 1 iterations.\n for (size_t i = 0; i < r - 1; ++i) {\n x = ModularPower(x, 2, n);\n if (x == predecessor) {\n skip_this_witness = true;\n break;\n }\n }\n if (skip_this_witness)\n continue;\n return false; // \"composite\"\n }\n\n return true; // \"probably prime\"\n}",
  14529. "idx": 519155,
  14530. "cwe": "CWE-120",
  14531. "hash": 295059986924029830016313633716285228943,
  14532. "dataset": "other"
  14533. },
  14534. {
  14535. "project": "serenity",
  14536. "commit_id": "48fbf6a88d4822a1e5470cf08f29464511bd72c1",
  14537. "target": 0,
  14538. "func": "bool is_probably_prime(const UnsignedBigInteger& p)\n{\n // Is it a small number?\n if (p < 49) {\n u32 p_value = p.words()[0];\n // Is it a very small prime?\n if (p_value == 2 || p_value == 3 || p_value == 5 || p_value == 7)\n return true;\n // Is it the multiple of a very small prime?\n if (p_value % 2 == 0 || p_value % 3 == 0 || p_value % 5 == 0 || p_value % 7 == 0)\n return false;\n // Then it must be a prime, but not a very small prime, like 37.\n return true;\n }\n\n Vector<UnsignedBigInteger, 256> tests;\n // Make some good initial guesses that are guaranteed to find all primes < 2^64.\n tests.append(UnsignedBigInteger(2));\n tests.append(UnsignedBigInteger(3));\n tests.append(UnsignedBigInteger(5));\n tests.append(UnsignedBigInteger(7));\n tests.append(UnsignedBigInteger(11));\n tests.append(UnsignedBigInteger(13));\n UnsignedBigInteger seventeen { 17 };\n for (size_t i = tests.size(); i < 256; ++i) {\n tests.append(random_number(seventeen, p.minus(2)));\n }\n // Miller-Rabin's \"error\" is 8^-k. In adversarial cases, it's 4^-k.\n // With 200 random numbers, this would mean an error of about 2^-400.\n // So we don't need to worry too much about the quality of the random numbers.\n\n return MR_primality_test(p, tests);\n}",
  14539. "idx": 519157,
  14540. "cwe": "CWE-120",
  14541. "hash": 303144258765638568217567976170648422907,
  14542. "dataset": "other"
  14543. },
  14544. {
  14545. "project": "serenity",
  14546. "commit_id": "48fbf6a88d4822a1e5470cf08f29464511bd72c1",
  14547. "target": 0,
  14548. "func": "UnsignedBigInteger random_big_prime(size_t bits)\n{\n ASSERT(bits >= 33);\n UnsignedBigInteger min = UnsignedBigInteger::from_base10(\"6074001000\").shift_left(bits - 33);\n UnsignedBigInteger max = UnsignedBigInteger { 1 }.shift_left(bits).minus(1);\n for (;;) {\n auto p = random_number(min, max);\n if ((p.words()[0] & 1) == 0) {\n // An even number is definitely not a large prime.\n continue;\n }\n if (is_probably_prime(p))\n return p;\n }\n}",
  14549. "idx": 519162,
  14550. "cwe": "CWE-120",
  14551. "hash": 15687903180148109465653092026404669397,
  14552. "dataset": "other"
  14553. },
  14554. {
  14555. "project": "serenity",
  14556. "commit_id": "48fbf6a88d4822a1e5470cf08f29464511bd72c1",
  14557. "target": 0,
  14558. "func": "UnsignedBigInteger ModularPower(const UnsignedBigInteger& b, const UnsignedBigInteger& e, const UnsignedBigInteger& m)\n{\n if (m == 1)\n return 0;\n\n UnsignedBigInteger ep { e };\n UnsignedBigInteger base { b };\n UnsignedBigInteger exp { 1 };\n\n UnsignedBigInteger temp_1;\n UnsignedBigInteger temp_2;\n UnsignedBigInteger temp_3;\n UnsignedBigInteger temp_4;\n UnsignedBigInteger temp_multiply;\n UnsignedBigInteger temp_quotient;\n UnsignedBigInteger temp_remainder;\n\n while (!(ep < 1)) {\n if (ep.words()[0] % 2 == 1) {\n // exp = (exp * base) % m;\n UnsignedBigInteger::multiply_without_allocation(exp, base, temp_1, temp_2, temp_3, temp_4, temp_multiply);\n UnsignedBigInteger::divide_without_allocation(temp_multiply, m, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder);\n exp.set_to(temp_remainder);\n }\n\n // ep = ep / 2;\n UnsignedBigInteger::divide_u16_without_allocation(ep, 2, temp_quotient, temp_remainder);\n ep.set_to(temp_quotient);\n\n // base = (base * base) % m;\n UnsignedBigInteger::multiply_without_allocation(base, base, temp_1, temp_2, temp_3, temp_4, temp_multiply);\n UnsignedBigInteger::divide_without_allocation(temp_multiply, m, temp_1, temp_2, temp_3, temp_4, temp_quotient, temp_remainder);\n base.set_to(temp_remainder);\n }\n return exp;\n}",
  14559. "idx": 519156,
  14560. "cwe": "CWE-120",
  14561. "hash": 323652663057392381248334462293780609113,
  14562. "dataset": "other"
  14563. }
  14564. ]
  14565. },
  14566. {
  14567. "call_depth": 4,
  14568. "longest_call_chain": [
  14569. "delayed_free_task",
  14570. "free_task",
  14571. "release_task_stack",
  14572. "free_thread_stack"
  14573. ],
  14574. "group_size": 14,
  14575. "functions": [
  14576. {
  14577. "func": "void __weak arch_release_task_struct(struct task_struct *tsk)\n{\n}",
  14578. "project": "linux",
  14579. "hash": 178878164510362685562963763581695892096,
  14580. "size": 3,
  14581. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14582. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14583. "target": 0,
  14584. "dataset": "other",
  14585. "idx": 293717
  14586. },
  14587. {
  14588. "func": "void free_task(struct task_struct *tsk)\n{\n\tscs_release(tsk);\n\n#ifndef CONFIG_THREAD_INFO_IN_TASK\n\t/*\n\t * The task is finally done with both the stack and thread_info,\n\t * so free both.\n\t */\n\trelease_task_stack(tsk);\n#else\n\t/*\n\t * If the task had a separate stack allocation, it should be gone\n\t * by now.\n\t */\n\tWARN_ON_ONCE(refcount_read(&tsk->stack_refcount) != 0);\n#endif\n\trt_mutex_debug_task_free(tsk);\n\tftrace_graph_exit_task(tsk);\n\tarch_release_task_struct(tsk);\n\tif (tsk->flags & PF_KTHREAD)\n\t\tfree_kthread_struct(tsk);\n\tfree_task_struct(tsk);\n}",
  14589. "project": "linux",
  14590. "hash": 204860648129297551546894762060680524874,
  14591. "size": 24,
  14592. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14593. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14594. "target": 0,
  14595. "dataset": "other",
  14596. "idx": 293705
  14597. },
  14598. {
  14599. "func": "void put_task_stack(struct task_struct *tsk)\n{\n\tif (refcount_dec_and_test(&tsk->stack_refcount))\n\t\trelease_task_stack(tsk);\n}",
  14600. "project": "linux",
  14601. "hash": 47375553025110082232307730801809545754,
  14602. "size": 5,
  14603. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14604. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14605. "target": 0,
  14606. "dataset": "other",
  14607. "idx": 293716
  14608. },
  14609. {
  14610. "func": "static inline void free_task_struct(struct task_struct *tsk)\n{\n\tkmem_cache_free(task_struct_cachep, tsk);\n}",
  14611. "project": "linux",
  14612. "hash": 240269885863574603491225126330427503157,
  14613. "size": 4,
  14614. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14615. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14616. "target": 0,
  14617. "dataset": "other",
  14618. "idx": 293673
  14619. },
  14620. {
  14621. "func": "void __put_task_struct(struct task_struct *tsk)\n{\n\tWARN_ON(!tsk->exit_state);\n\tWARN_ON(refcount_read(&tsk->usage));\n\tWARN_ON(tsk == current);\n\n\tio_uring_free(tsk);\n\tcgroup_free(tsk);\n\ttask_numa_free(tsk, true);\n\tsecurity_task_free(tsk);\n\texit_creds(tsk);\n\tdelayacct_tsk_free(tsk);\n\tput_signal_struct(tsk->signal);\n\n\tif (!profile_handoff_task(tsk))\n\t\tfree_task(tsk);\n}",
  14622. "project": "linux",
  14623. "hash": 219873827166979006101262636184699260463,
  14624. "size": 17,
  14625. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14626. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14627. "target": 0,
  14628. "dataset": "other",
  14629. "idx": 293664
  14630. },
  14631. {
  14632. "func": "static void mmdrop_async(struct mm_struct *mm)\n{\n\tif (unlikely(atomic_dec_and_test(&mm->mm_count))) {\n\t\tINIT_WORK(&mm->async_put_work, mmdrop_async_fn);\n\t\tschedule_work(&mm->async_put_work);\n\t}\n}",
  14633. "project": "linux",
  14634. "hash": 48640535268283294199782867056893964272,
  14635. "size": 7,
  14636. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14637. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14638. "target": 0,
  14639. "dataset": "other",
  14640. "idx": 293668
  14641. },
  14642. {
  14643. "func": "static void free_thread_stack(struct task_struct *tsk)\n{\n\tkmem_cache_free(thread_stack_cache, tsk->stack);\n}",
  14644. "project": "linux",
  14645. "hash": 312303175618061311683749964165846341822,
  14646. "size": 4,
  14647. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14648. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14649. "target": 0,
  14650. "dataset": "other",
  14651. "idx": 293659
  14652. },
  14653. {
  14654. "func": "static inline void free_thread_stack(struct task_struct *tsk)\n{\n#ifdef CONFIG_VMAP_STACK\n\tstruct vm_struct *vm = task_stack_vm_area(tsk);\n\n\tif (vm) {\n\t\tint i;\n\n\t\tfor (i = 0; i < THREAD_SIZE / PAGE_SIZE; i++)\n\t\t\tmemcg_kmem_uncharge_page(vm->pages[i], 0);\n\n\t\tfor (i = 0; i < NR_CACHED_STACKS; i++) {\n\t\t\tif (this_cpu_cmpxchg(cached_stacks[i],\n\t\t\t\t\tNULL, tsk->stack_vm_area) != NULL)\n\t\t\t\tcontinue;\n\n\t\t\treturn;\n\t\t}\n\n\t\tvfree_atomic(tsk->stack);\n\t\treturn;\n\t}\n#endif\n\n\t__free_pages(virt_to_page(tsk->stack), THREAD_SIZE_ORDER);\n}",
  14655. "project": "linux",
  14656. "hash": 237378295918759014443437886979064401756,
  14657. "size": 26,
  14658. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14659. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14660. "target": 0,
  14661. "dataset": "other",
  14662. "idx": 293694
  14663. },
  14664. {
  14665. "func": "static void release_task_stack(struct task_struct *tsk)\n{\n\tif (WARN_ON(tsk->state != TASK_DEAD))\n\t\treturn; /* Better to leak the stack than to free prematurely */\n\n\taccount_kernel_stack(tsk, -1);\n\tfree_thread_stack(tsk);\n\ttsk->stack = NULL;\n#ifdef CONFIG_VMAP_STACK\n\ttsk->stack_vm_area = NULL;\n#endif\n}",
  14666. "project": "linux",
  14667. "hash": 312699088568944488479292764031952936873,
  14668. "size": 12,
  14669. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14670. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14671. "target": 0,
  14672. "dataset": "other",
  14673. "idx": 293696
  14674. },
  14675. {
  14676. "func": "static void account_kernel_stack(struct task_struct *tsk, int account)\n{\n\tvoid *stack = task_stack_page(tsk);\n\tstruct vm_struct *vm = task_stack_vm_area(tsk);\n\n\n\t/* All stack pages are in the same node. */\n\tif (vm)\n\t\tmod_lruvec_page_state(vm->pages[0], NR_KERNEL_STACK_KB,\n\t\t\t\t account * (THREAD_SIZE / 1024));\n\telse\n\t\tmod_lruvec_slab_state(stack, NR_KERNEL_STACK_KB,\n\t\t\t\t account * (THREAD_SIZE / 1024));\n}",
  14677. "project": "linux",
  14678. "hash": 257916025676168192754527698101924183339,
  14679. "size": 14,
  14680. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14681. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14682. "target": 0,
  14683. "dataset": "other",
  14684. "idx": 293686
  14685. },
  14686. {
  14687. "func": "static void __delayed_free_task(struct rcu_head *rhp)\n{\n\tstruct task_struct *tsk = container_of(rhp, struct task_struct, rcu);\n\n\tfree_task(tsk);\n}",
  14688. "project": "linux",
  14689. "hash": 96633240730792133603587881814603945289,
  14690. "size": 6,
  14691. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14692. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14693. "target": 0,
  14694. "dataset": "other",
  14695. "idx": 293638
  14696. },
  14697. {
  14698. "func": "static __always_inline void delayed_free_task(struct task_struct *tsk)\n{\n\tif (IS_ENABLED(CONFIG_MEMCG))\n\t\tcall_rcu(&tsk->rcu, __delayed_free_task);\n\telse\n\t\tfree_task(tsk);\n}",
  14699. "project": "linux",
  14700. "hash": 246231539372659290208161012985748615737,
  14701. "size": 7,
  14702. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14703. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14704. "target": 0,
  14705. "dataset": "other",
  14706. "idx": 293672
  14707. },
  14708. {
  14709. "func": "static inline void put_signal_struct(struct signal_struct *sig)\n{\n\tif (refcount_dec_and_test(&sig->sigcnt))\n\t\tfree_signal_struct(sig);\n}",
  14710. "project": "linux",
  14711. "hash": 230873831481255496698657162843354998495,
  14712. "size": 5,
  14713. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14714. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14715. "target": 0,
  14716. "dataset": "other",
  14717. "idx": 293663
  14718. },
  14719. {
  14720. "func": "static inline void free_signal_struct(struct signal_struct *sig)\n{\n\ttaskstats_tgid_free(sig);\n\tsched_autogroup_exit(sig);\n\t/*\n\t * __mmdrop is not safe to call from softirq context on x86 due to\n\t * pgd_dtor so postpone it to the async context\n\t */\n\tif (sig->oom_mm)\n\t\tmmdrop_async(sig->oom_mm);\n\tkmem_cache_free(signal_cachep, sig);\n}",
  14721. "project": "linux",
  14722. "hash": 63807950727592270091592729976286542850,
  14723. "size": 12,
  14724. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  14725. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  14726. "target": 0,
  14727. "dataset": "other",
  14728. "idx": 293658
  14729. }
  14730. ]
  14731. },
  14732. {
  14733. "call_depth": 3,
  14734. "longest_call_chain": [
  14735. "r_str_is_bool",
  14736. "r_str_is_true",
  14737. "r_str_casecmp"
  14738. ],
  14739. "group_size": 4,
  14740. "functions": [
  14741. {
  14742. "func": "R_API bool r_str_is_bool(const char *val) {\n\treturn r_str_is_true (val) || r_str_is_false (val);\n}",
  14743. "project": "radare2",
  14744. "hash": 79516922044337113871302780258506301854,
  14745. "size": 3,
  14746. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  14747. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  14748. "target": 0,
  14749. "dataset": "other",
  14750. "idx": 269079
  14751. },
  14752. {
  14753. "func": "R_API int r_str_casecmp(const char *s1, const char *s2) {\n#ifdef _MSC_VER\n\treturn stricmp (s1, s2);\n#else\n\treturn strcasecmp (s1, s2);\n#endif\n}",
  14754. "project": "radare2",
  14755. "hash": 329290754416988569277034297149091754333,
  14756. "size": 7,
  14757. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  14758. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  14759. "target": 0,
  14760. "dataset": "other",
  14761. "idx": 268839
  14762. },
  14763. {
  14764. "func": "R_API bool r_str_is_true(const char *s) {\n\treturn !r_str_casecmp (\"yes\", s)\n\t\t|| !r_str_casecmp (\"on\", s)\n\t\t|| !r_str_casecmp (\"true\", s)\n\t\t|| !r_str_casecmp (\"1\", s);\n}",
  14765. "project": "radare2",
  14766. "hash": 101725634936234610594664039120782744710,
  14767. "size": 6,
  14768. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  14769. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  14770. "target": 0,
  14771. "dataset": "other",
  14772. "idx": 269080
  14773. },
  14774. {
  14775. "func": "R_API bool r_str_is_false(const char *s) {\n\treturn !r_str_casecmp (\"no\", s)\n\t\t|| !r_str_casecmp (\"off\", s)\n\t\t|| !r_str_casecmp (\"false\", s)\n\t\t|| !r_str_casecmp (\"0\", s)\n\t\t|| !*s;\n}",
  14776. "project": "radare2",
  14777. "hash": 13612440070113323045282564977751967500,
  14778. "size": 7,
  14779. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  14780. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  14781. "target": 0,
  14782. "dataset": "other",
  14783. "idx": 268895
  14784. }
  14785. ]
  14786. },
  14787. {
  14788. "call_depth": 4,
  14789. "longest_call_chain": [
  14790. "nfs4_proc_create_session",
  14791. "_nfs4_proc_create_session",
  14792. "nfs4_verify_channel_attrs",
  14793. "nfs4_verify_back_channel_attrs"
  14794. ],
  14795. "group_size": 7,
  14796. "functions": [
  14797. {
  14798. "func": "static int nfs4_verify_channel_attrs(struct nfs41_create_session_args *args,\n\t\t\t\t struct nfs41_create_session_res *res)\n{\n\tint ret;\n\n\tret = nfs4_verify_fore_channel_attrs(args, res);\n\tif (ret)\n\t\treturn ret;\n\treturn nfs4_verify_back_channel_attrs(args, res);\n}",
  14799. "project": "linux",
  14800. "hash": 266510953336912229479592963968256532827,
  14801. "size": 10,
  14802. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  14803. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  14804. "target": 0,
  14805. "dataset": "other",
  14806. "idx": 431361
  14807. },
  14808. {
  14809. "func": "static int _nfs4_proc_create_session(struct nfs_client *clp,\n\t\tconst struct cred *cred)\n{\n\tstruct nfs4_session *session = clp->cl_session;\n\tstruct nfs41_create_session_args args = {\n\t\t.client = clp,\n\t\t.clientid = clp->cl_clientid,\n\t\t.seqid = clp->cl_seqid,\n\t\t.cb_program = NFS4_CALLBACK,\n\t};\n\tstruct nfs41_create_session_res res;\n\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE_SESSION],\n\t\t.rpc_argp = &args,\n\t\t.rpc_resp = &res,\n\t\t.rpc_cred = cred,\n\t};\n\tint status;\n\n\tnfs4_init_channel_attrs(&args, clp->cl_rpcclient);\n\targs.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN);\n\n\tstatus = rpc_call_sync(session->clp->cl_rpcclient, &msg,\n\t\t\t RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN);\n\ttrace_nfs4_create_session(clp, status);\n\n\tswitch (status) {\n\tcase -NFS4ERR_STALE_CLIENTID:\n\tcase -NFS4ERR_DELAY:\n\tcase -ETIMEDOUT:\n\tcase -EACCES:\n\tcase -EAGAIN:\n\t\tgoto out;\n\t}\n\n\tclp->cl_seqid++;\n\tif (!status) {\n\t\t/* Verify the session's negotiated channel_attrs values */\n\t\tstatus = nfs4_verify_channel_attrs(&args, &res);\n\t\t/* Increment the clientid slot sequence id */\n\t\tif (status)\n\t\t\tgoto out;\n\t\tnfs4_update_session(session, &res);\n\t}\nout:\n\treturn status;\n}",
  14810. "project": "linux",
  14811. "hash": 133204535520018525969067538801389583522,
  14812. "size": 48,
  14813. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  14814. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  14815. "target": 0,
  14816. "dataset": "other",
  14817. "idx": 430993
  14818. },
  14819. {
  14820. "func": "static int nfs4_verify_fore_channel_attrs(struct nfs41_create_session_args *args,\n\t\tstruct nfs41_create_session_res *res)\n{\n\tstruct nfs4_channel_attrs *sent = &args->fc_attrs;\n\tstruct nfs4_channel_attrs *rcvd = &res->fc_attrs;\n\n\tif (rcvd->max_resp_sz > sent->max_resp_sz)\n\t\treturn -EINVAL;\n\t/*\n\t * Our requested max_ops is the minimum we need; we're not\n\t * prepared to break up compounds into smaller pieces than that.\n\t * So, no point even trying to continue if the server won't\n\t * cooperate:\n\t */\n\tif (rcvd->max_ops < sent->max_ops)\n\t\treturn -EINVAL;\n\tif (rcvd->max_reqs == 0)\n\t\treturn -EINVAL;\n\tif (rcvd->max_reqs > NFS4_MAX_SLOT_TABLE)\n\t\trcvd->max_reqs = NFS4_MAX_SLOT_TABLE;\n\treturn 0;\n}",
  14821. "project": "linux",
  14822. "hash": 38463496589113317805269675468759555652,
  14823. "size": 22,
  14824. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  14825. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  14826. "target": 0,
  14827. "dataset": "other",
  14828. "idx": 431035
  14829. },
  14830. {
  14831. "func": "static void nfs4_init_channel_attrs(struct nfs41_create_session_args *args,\n\t\t\t\t struct rpc_clnt *clnt)\n{\n\tunsigned int max_rqst_sz, max_resp_sz;\n\tunsigned int max_bc_payload = rpc_max_bc_payload(clnt);\n\tunsigned int max_bc_slots = rpc_num_bc_slots(clnt);\n\n\tmax_rqst_sz = NFS_MAX_FILE_IO_SIZE + nfs41_maxwrite_overhead;\n\tmax_resp_sz = NFS_MAX_FILE_IO_SIZE + nfs41_maxread_overhead;\n\n\t/* Fore channel attributes */\n\targs->fc_attrs.max_rqst_sz = max_rqst_sz;\n\targs->fc_attrs.max_resp_sz = max_resp_sz;\n\targs->fc_attrs.max_ops = NFS4_MAX_OPS;\n\targs->fc_attrs.max_reqs = max_session_slots;\n\n\tdprintk(\"%s: Fore Channel : max_rqst_sz=%u max_resp_sz=%u \"\n\t\t\"max_ops=%u max_reqs=%u\\n\",\n\t\t__func__,\n\t\targs->fc_attrs.max_rqst_sz, args->fc_attrs.max_resp_sz,\n\t\targs->fc_attrs.max_ops, args->fc_attrs.max_reqs);\n\n\t/* Back channel attributes */\n\targs->bc_attrs.max_rqst_sz = max_bc_payload;\n\targs->bc_attrs.max_resp_sz = max_bc_payload;\n\targs->bc_attrs.max_resp_sz_cached = 0;\n\targs->bc_attrs.max_ops = NFS4_MAX_BACK_CHANNEL_OPS;\n\targs->bc_attrs.max_reqs = max_t(unsigned short, max_session_cb_slots, 1);\n\tif (args->bc_attrs.max_reqs > max_bc_slots)\n\t\targs->bc_attrs.max_reqs = max_bc_slots;\n\n\tdprintk(\"%s: Back Channel : max_rqst_sz=%u max_resp_sz=%u \"\n\t\t\"max_resp_sz_cached=%u max_ops=%u max_reqs=%u\\n\",\n\t\t__func__,\n\t\targs->bc_attrs.max_rqst_sz, args->bc_attrs.max_resp_sz,\n\t\targs->bc_attrs.max_resp_sz_cached, args->bc_attrs.max_ops,\n\t\targs->bc_attrs.max_reqs);\n}",
  14832. "project": "linux",
  14833. "hash": 18210667889500818106398555889191412805,
  14834. "size": 38,
  14835. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  14836. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  14837. "target": 0,
  14838. "dataset": "other",
  14839. "idx": 431071
  14840. },
  14841. {
  14842. "func": "static int nfs4_verify_back_channel_attrs(struct nfs41_create_session_args *args,\n\t\tstruct nfs41_create_session_res *res)\n{\n\tstruct nfs4_channel_attrs *sent = &args->bc_attrs;\n\tstruct nfs4_channel_attrs *rcvd = &res->bc_attrs;\n\n\tif (!(res->flags & SESSION4_BACK_CHAN))\n\t\tgoto out;\n\tif (rcvd->max_rqst_sz > sent->max_rqst_sz)\n\t\treturn -EINVAL;\n\tif (rcvd->max_resp_sz < sent->max_resp_sz)\n\t\treturn -EINVAL;\n\tif (rcvd->max_resp_sz_cached > sent->max_resp_sz_cached)\n\t\treturn -EINVAL;\n\tif (rcvd->max_ops > sent->max_ops)\n\t\treturn -EINVAL;\n\tif (rcvd->max_reqs > sent->max_reqs)\n\t\treturn -EINVAL;\nout:\n\treturn 0;\n}",
  14843. "project": "linux",
  14844. "hash": 86134186865172260243225302940714184311,
  14845. "size": 21,
  14846. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  14847. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  14848. "target": 0,
  14849. "dataset": "other",
  14850. "idx": 431362
  14851. },
  14852. {
  14853. "func": "int nfs4_proc_create_session(struct nfs_client *clp, const struct cred *cred)\n{\n\tint status;\n\tunsigned *ptr;\n\tstruct nfs4_session *session = clp->cl_session;\n\n\tdprintk(\"--> %s clp=%p session=%p\\n\", __func__, clp, session);\n\n\tstatus = _nfs4_proc_create_session(clp, cred);\n\tif (status)\n\t\tgoto out;\n\n\t/* Init or reset the session slot tables */\n\tstatus = nfs4_setup_session_slot_tables(session);\n\tdprintk(\"slot table setup returned %d\\n\", status);\n\tif (status)\n\t\tgoto out;\n\n\tptr = (unsigned *)&session->sess_id.data[0];\n\tdprintk(\"%s client>seqid %d sessionid %u:%u:%u:%u\\n\", __func__,\n\t\tclp->cl_seqid, ptr[0], ptr[1], ptr[2], ptr[3]);\nout:\n\tdprintk(\"<-- %s\\n\", __func__);\n\treturn status;\n}",
  14854. "project": "linux",
  14855. "hash": 277132752299906564156097443324441133079,
  14856. "size": 25,
  14857. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  14858. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  14859. "target": 0,
  14860. "dataset": "other",
  14861. "idx": 431497
  14862. },
  14863. {
  14864. "func": "static void nfs4_update_session(struct nfs4_session *session,\n\t\tstruct nfs41_create_session_res *res)\n{\n\tnfs4_copy_sessionid(&session->sess_id, &res->sessionid);\n\t/* Mark client id and session as being confirmed */\n\tsession->clp->cl_exchange_flags |= EXCHGID4_FLAG_CONFIRMED_R;\n\tset_bit(NFS4_SESSION_ESTABLISHED, &session->session_state);\n\tsession->flags = res->flags;\n\tmemcpy(&session->fc_attrs, &res->fc_attrs, sizeof(session->fc_attrs));\n\tif (res->flags & SESSION4_BACK_CHAN)\n\t\tmemcpy(&session->bc_attrs, &res->bc_attrs,\n\t\t\t\tsizeof(session->bc_attrs));\n}",
  14865. "project": "linux",
  14866. "hash": 74970151861589890047695037603655286360,
  14867. "size": 13,
  14868. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  14869. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  14870. "target": 0,
  14871. "dataset": "other",
  14872. "idx": 431408
  14873. }
  14874. ]
  14875. },
  14876. {
  14877. "call_depth": 3,
  14878. "longest_call_chain": [
  14879. "cli_scanxar",
  14880. "xar_get_toc_data_values",
  14881. "xar_get_numeric_from_xml_element"
  14882. ],
  14883. "group_size": 11,
  14884. "functions": [
  14885. {
  14886. "func": "static int xar_cleanup_temp_file(cli_ctx *ctx, int fd, char * tmpname)\n{\n int rc = CL_SUCCESS;\n if (fd > -1)\n close(fd);\n if (tmpname != NULL) {\n if (!ctx->engine->keeptmp) {\n if (cli_unlink(tmpname)) {\n cli_dbgmsg(\"cli_scanxar: error unlinking tmpfile %s\\n\", tmpname); \n rc = CL_EUNLINK;\n }\n }\n free(tmpname);\n }\n return rc;\n}",
  14887. "project": "clamav-devel",
  14888. "hash": 75249852686141599046506092970096971981,
  14889. "size": 16,
  14890. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14891. "message": "bb11588 - fix out of bounds read.",
  14892. "target": 0,
  14893. "dataset": "other",
  14894. "idx": 390685
  14895. },
  14896. {
  14897. "func": "static void xar_hash_update(void * hash_ctx, void * data, unsigned long size, int hash)\n{\n if (!hash_ctx || !data || !size)\n return;\n\n switch (hash) {\n case XAR_CKSUM_NONE:\n case XAR_CKSUM_OTHER:\n return;\n }\n\n cl_update_hash(hash_ctx, data, size);\n}",
  14898. "project": "clamav-devel",
  14899. "hash": 284001925521670430375654841780794105400,
  14900. "size": 13,
  14901. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14902. "message": "bb11588 - fix out of bounds read.",
  14903. "target": 0,
  14904. "dataset": "other",
  14905. "idx": 390688
  14906. },
  14907. {
  14908. "func": "static void * xar_hash_init(int hash, void **sc, void **mc)\n{\n if (!sc && !mc)\n return NULL;\n switch (hash) {\n case XAR_CKSUM_SHA1:\n *sc = cl_hash_init(\"sha1\");\n if (!(*sc)) {\n return NULL;\n }\n\n return *sc;\n case XAR_CKSUM_MD5:\n *mc = cl_hash_init(\"md5\");\n if (!(*mc)) {\n return NULL;\n }\n\n return *mc;\n case XAR_CKSUM_OTHER:\n case XAR_CKSUM_NONE:\n default:\n return NULL;\n }\n}",
  14909. "project": "clamav-devel",
  14910. "hash": 178031145895934483930951694005816827087,
  14911. "size": 25,
  14912. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14913. "message": "bb11588 - fix out of bounds read.",
  14914. "target": 0,
  14915. "dataset": "other",
  14916. "idx": 390692
  14917. },
  14918. {
  14919. "func": "static int xar_hash_check(int hash, const void * result, const void * expected)\n{\n int len;\n\n if (!result || !expected)\n return 1;\n switch (hash) {\n case XAR_CKSUM_SHA1:\n len = SHA1_HASH_SIZE;\n break;\n case XAR_CKSUM_MD5:\n len = CLI_HASH_MD5;\n break;\n case XAR_CKSUM_OTHER:\n case XAR_CKSUM_NONE:\n default:\n return 1;\n }\n return memcmp(result, expected, len);\n}",
  14920. "project": "clamav-devel",
  14921. "hash": 16464750489424958099095161220741826057,
  14922. "size": 20,
  14923. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14924. "message": "bb11588 - fix out of bounds read.",
  14925. "target": 1,
  14926. "dataset": "other",
  14927. "idx": 206998
  14928. },
  14929. {
  14930. "func": "static int xar_hash_check(int hash, const void * result, const void * expected)\n{\n int len;\n\n if (!result || !expected)\n return 1;\n switch (hash) {\n case XAR_CKSUM_SHA1:\n len = CLI_HASHLEN_SHA1;\n break;\n case XAR_CKSUM_MD5:\n len = CLI_HASHLEN_MD5;\n break;\n case XAR_CKSUM_OTHER:\n case XAR_CKSUM_NONE:\n default:\n return 1;\n }\n return memcmp(result, expected, len);\n}",
  14931. "project": "clamav-devel",
  14932. "hash": 298399301874156136344056006861919253944,
  14933. "size": 20,
  14934. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14935. "message": "bb11588 - fix out of bounds read.",
  14936. "target": 0,
  14937. "dataset": "other",
  14938. "idx": 390690
  14939. },
  14940. {
  14941. "func": "static int xar_get_toc_data_values(xmlTextReaderPtr reader, size_t *length, size_t *offset, size_t *size, int *encoding,\n unsigned char ** a_cksum, int * a_hash, unsigned char ** e_cksum, int * e_hash)\n{\n const xmlChar *name;\n int indata = 0, inea = 0;\n int rc, gotoffset=0, gotlength=0, gotsize=0;\n\n *a_cksum = NULL;\n *a_hash = XAR_CKSUM_NONE;\n *e_cksum = NULL;\n *e_hash = XAR_CKSUM_NONE;\n *encoding = CL_TYPE_ANY;\n\n rc = xmlTextReaderRead(reader);\n while (rc == 1) {\n name = xmlTextReaderConstLocalName(reader);\n if (indata || inea) {\n /* cli_dbgmsg(\"cli_scanxar: xmlTextReaderRead read %s\\n\", name); */\n if (xmlStrEqual(name, (const xmlChar *)\"offset\") && \n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n if (CL_SUCCESS == xar_get_numeric_from_xml_element(reader, offset))\n gotoffset=1;\n\n } else if (xmlStrEqual(name, (const xmlChar *)\"length\") &&\n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n if (CL_SUCCESS == xar_get_numeric_from_xml_element(reader, length))\n gotlength=1;\n\n } else if (xmlStrEqual(name, (const xmlChar *)\"size\") &&\n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n if (CL_SUCCESS == xar_get_numeric_from_xml_element(reader, size))\n gotsize=1;\n\n } else if (xmlStrEqual(name, (const xmlChar *)\"archived-checksum\") &&\n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n cli_dbgmsg(\"cli_scanxar: <archived-checksum>:\\n\");\n xar_get_checksum_values(reader, a_cksum, a_hash);\n \n } else if ((xmlStrEqual(name, (const xmlChar *)\"extracted-checksum\") ||\n xmlStrEqual(name, (const xmlChar *)\"unarchived-checksum\")) &&\n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n cli_dbgmsg(\"cli_scanxar: <extracted-checksum>:\\n\");\n xar_get_checksum_values(reader, e_cksum, e_hash);\n\n } else if (xmlStrEqual(name, (const xmlChar *)\"encoding\") &&\n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n xmlChar * style = xmlTextReaderGetAttribute(reader, (const xmlChar *)\"style\");\n if (style == NULL) {\n cli_dbgmsg(\"cli_scaxar: xmlTextReaderGetAttribute no style attribute \"\n \"for encoding element\\n\");\n *encoding = CL_TYPE_ANY;\n } else if (xmlStrEqual(style, (const xmlChar *)\"application/x-gzip\")) {\n cli_dbgmsg(\"cli_scanxar: encoding = application/x-gzip.\\n\");\n *encoding = CL_TYPE_GZ; \n } else if (xmlStrEqual(style, (const xmlChar *)\"application/octet-stream\")) {\n cli_dbgmsg(\"cli_scanxar: encoding = application/octet-stream.\\n\");\n *encoding = CL_TYPE_ANY; \n } else if (xmlStrEqual(style, (const xmlChar *)\"application/x-bzip2\")) {\n cli_dbgmsg(\"cli_scanxar: encoding = application/x-bzip2.\\n\");\n *encoding = CL_TYPE_BZ;\n } else if (xmlStrEqual(style, (const xmlChar *)\"application/x-lzma\")) {\n cli_dbgmsg(\"cli_scanxar: encoding = application/x-lzma.\\n\");\n *encoding = CL_TYPE_7Z;\n } else if (xmlStrEqual(style, (const xmlChar *)\"application/x-xz\")) {\n cli_dbgmsg(\"cli_scanxar: encoding = application/x-xz.\\n\");\n *encoding = CL_TYPE_XZ;\n } else {\n cli_dbgmsg(\"cli_scaxar: unknown style value=%s for encoding element\\n\", style);\n *encoding = CL_TYPE_ANY;\n }\n if (style != NULL)\n xmlFree(style);\n\n } else if (indata && xmlStrEqual(name, (const xmlChar *)\"data\") &&\n xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {\n break;\n\n } else if (inea && xmlStrEqual(name, (const xmlChar *)\"ea\") &&\n xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) {\n break;\n }\n \n } else {\n if (xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n if (xmlStrEqual(name, (const xmlChar *)\"data\")) {\n cli_dbgmsg(\"cli_scanxar: xmlTextReaderRead read <data>\\n\");\n indata = 1;\n } else if (xmlStrEqual(name, (const xmlChar *)\"ea\")) {\n cli_dbgmsg(\"cli_scanxar: xmlTextReaderRead read <ea>\\n\");\n inea = 1;\n }\n } else if ((xmlTextReaderNodeType(reader) == XML_READER_TYPE_END_ELEMENT) &&\n xmlStrEqual(name, (const xmlChar *)\"xar\")) {\n cli_dbgmsg(\"cli_scanxar: finished parsing xar TOC.\\n\"); \n break;\n }\n }\n rc = xmlTextReaderRead(reader);\n }\n \n if (gotoffset && gotlength && gotsize) {\n rc = CL_SUCCESS;\n }\n else if (0 == gotoffset + gotlength + gotsize)\n rc = CL_BREAK;\n else\n rc = CL_EFORMAT;\n\n return rc;\n}",
  14942. "project": "clamav-devel",
  14943. "hash": 102653424820925841262555234476601874539,
  14944. "size": 110,
  14945. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14946. "message": "bb11588 - fix out of bounds read.",
  14947. "target": 0,
  14948. "dataset": "other",
  14949. "idx": 390687
  14950. },
  14951. {
  14952. "func": "static int xar_scan_subdocuments(xmlTextReaderPtr reader, cli_ctx *ctx)\n{\n int rc = CL_SUCCESS, subdoc_len, fd;\n xmlChar * subdoc;\n const xmlChar *name;\n char * tmpname;\n\n while (xmlTextReaderRead(reader) == 1) {\n name = xmlTextReaderConstLocalName(reader);\n if (name == NULL) {\n cli_dbgmsg(\"cli_scanxar: xmlTextReaderConstLocalName() no name.\\n\");\n rc = CL_EFORMAT;\n break;\n }\n if (xmlStrEqual(name, (const xmlChar *)\"toc\") && \n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT)\n return CL_SUCCESS;\n if (xmlStrEqual(name, (const xmlChar *)\"subdoc\") && \n xmlTextReaderNodeType(reader) == XML_READER_TYPE_ELEMENT) {\n subdoc = xmlTextReaderReadInnerXml(reader);\n if (subdoc == NULL) {\n cli_dbgmsg(\"cli_scanxar: no content in subdoc element.\\n\");\n xmlTextReaderNext(reader);\n continue;\n }\n subdoc_len = xmlStrlen(subdoc);\n cli_dbgmsg(\"cli_scanxar: in-memory scan of xml subdocument, len %i.\\n\", subdoc_len);\n rc = cli_mem_scandesc(subdoc, subdoc_len, ctx);\n if (rc == CL_VIRUS && SCAN_ALL)\n rc = CL_SUCCESS;\n \n /* make a file to leave if --leave-temps in effect */\n if(ctx->engine->keeptmp) {\n if ((rc = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &fd)) != CL_SUCCESS) {\n cli_dbgmsg(\"cli_scanxar: Can't create temporary file for subdocument.\\n\");\n } else {\n cli_dbgmsg(\"cli_scanxar: Writing subdoc to temp file %s.\\n\", tmpname);\n if (cli_writen(fd, subdoc, subdoc_len) < 0) {\n cli_dbgmsg(\"cli_scanxar: cli_writen error writing subdoc temporary file.\\n\");\n rc = CL_EWRITE;\n }\n rc = xar_cleanup_temp_file(ctx, fd, tmpname);\n }\n }\n\n xmlFree(subdoc);\n if (rc != CL_SUCCESS)\n return rc;\n xmlTextReaderNext(reader);\n } \n }\n return rc;\n}",
  14953. "project": "clamav-devel",
  14954. "hash": 3448610867985354337000629770249118702,
  14955. "size": 53,
  14956. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14957. "message": "bb11588 - fix out of bounds read.",
  14958. "target": 0,
  14959. "dataset": "other",
  14960. "idx": 390693
  14961. },
  14962. {
  14963. "func": "static int xar_get_numeric_from_xml_element(xmlTextReaderPtr reader, size_t * value)\n{\n const xmlChar * numstr;\n ssize_t numval;\n\n if (xmlTextReaderRead(reader) == 1 && xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT) {\n numstr = xmlTextReaderConstValue(reader);\n if (numstr) {\n numval = atol((const char *)numstr);\n if (numval < 0) {\n cli_dbgmsg(\"cli_scanxar: XML element value %li\\n\", *value);\n return CL_EFORMAT;\n }\n *value = numval;\n return CL_SUCCESS;\n }\n }\n cli_dbgmsg(\"cli_scanxar: No text for XML element\\n\");\n return CL_EFORMAT;\n}",
  14964. "project": "clamav-devel",
  14965. "hash": 203146065281075354208308568415269831507,
  14966. "size": 20,
  14967. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14968. "message": "bb11588 - fix out of bounds read.",
  14969. "target": 0,
  14970. "dataset": "other",
  14971. "idx": 390694
  14972. },
  14973. {
  14974. "func": "static void xar_hash_final(void * hash_ctx, void * result, int hash)\n{\n if (!hash_ctx || !result)\n return;\n\n switch (hash) {\n case XAR_CKSUM_OTHER:\n case XAR_CKSUM_NONE:\n return;\n }\n\n cl_finish_hash(hash_ctx, result);\n}",
  14975. "project": "clamav-devel",
  14976. "hash": 211205057933858471625379548920718965896,
  14977. "size": 13,
  14978. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14979. "message": "bb11588 - fix out of bounds read.",
  14980. "target": 0,
  14981. "dataset": "other",
  14982. "idx": 390689
  14983. },
  14984. {
  14985. "func": "static void xar_get_checksum_values(xmlTextReaderPtr reader, unsigned char ** cksum, int * hash)\n{\n xmlChar * style = xmlTextReaderGetAttribute(reader, (const xmlChar *)\"style\");\n const xmlChar * xmlval;\n\n *hash = XAR_CKSUM_NONE;\n if (style == NULL) {\n cli_dbgmsg(\"cli_scaxar: xmlTextReaderGetAttribute no style attribute \"\n \"for checksum element\\n\");\n } else {\n cli_dbgmsg(\"cli_scanxar: checksum algorithm is %s.\\n\", style); \n if (0 == xmlStrcasecmp(style, (const xmlChar *)\"sha1\")) {\n *hash = XAR_CKSUM_SHA1;\n } else if (0 == xmlStrcasecmp(style, (const xmlChar *)\"md5\")) {\n *hash = XAR_CKSUM_MD5;\n } else {\n cli_dbgmsg(\"cli_scanxar: checksum algorithm %s is unsupported.\\n\", style);\n *hash = XAR_CKSUM_OTHER;\n }\n }\n if (style != NULL)\n xmlFree(style);\n\n if (xmlTextReaderRead(reader) == 1 && xmlTextReaderNodeType(reader) == XML_READER_TYPE_TEXT) {\n xmlval = xmlTextReaderConstValue(reader);\n if (xmlval) {\n cli_dbgmsg(\"cli_scanxar: checksum value is %s.\\n\", xmlval);\n if (*hash == XAR_CKSUM_SHA1 && xmlStrlen(xmlval) == 2 * CLI_HASHLEN_SHA1 ||\n *hash == XAR_CKSUM_MD5 && xmlStrlen(xmlval) == 2 * CLI_HASHLEN_MD5)\n {\n *cksum = xmlStrdup(xmlval); \n } \n else\n {\n cli_dbgmsg(\"cli_scanxar: checksum type is unknown or length is invalid.\\n\");\n *hash = XAR_CKSUM_OTHER;\n *cksum = NULL;\n }\n } else {\n *cksum = NULL;\n cli_dbgmsg(\"cli_scanxar: xmlTextReaderConstValue() returns NULL for checksum value.\\n\"); \n }\n }\n else\n cli_dbgmsg(\"cli_scanxar: No text for XML checksum element.\\n\");\n}",
  14986. "project": "clamav-devel",
  14987. "hash": 12714023224432776650168353506659776513,
  14988. "size": 46,
  14989. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  14990. "message": "bb11588 - fix out of bounds read.",
  14991. "target": 0,
  14992. "dataset": "other",
  14993. "idx": 390691
  14994. },
  14995. {
  14996. "func": "int cli_scanxar(cli_ctx *ctx)\n{\n int rc = CL_SUCCESS;\n unsigned int cksum_fails = 0;\n unsigned int extract_errors = 0;\n#if HAVE_LIBXML2\n int fd = -1;\n struct xar_header hdr;\n fmap_t *map = *ctx->fmap;\n size_t length, offset, size, at;\n int encoding;\n z_stream strm;\n char *toc, *tmpname;\n xmlTextReaderPtr reader = NULL;\n int a_hash, e_hash;\n unsigned char *a_cksum = NULL, *e_cksum = NULL;\n void *a_hash_ctx = NULL, *e_hash_ctx = NULL;\n char result[SHA1_HASH_SIZE];\n\n memset(&strm, 0x00, sizeof(z_stream));\n\n /* retrieve xar header */\n if (fmap_readn(*ctx->fmap, &hdr, 0, sizeof(hdr)) != sizeof(hdr)) {\n cli_dbgmsg(\"cli_scanxar: Invalid header, too short.\\n\");\n return CL_EFORMAT;\n }\n hdr.magic = be32_to_host(hdr.magic);\n\n if (hdr.magic == XAR_HEADER_MAGIC) {\n cli_dbgmsg(\"cli_scanxar: Matched magic\\n\");\n }\n else {\n cli_dbgmsg(\"cli_scanxar: Invalid magic\\n\");\n return CL_EFORMAT;\n }\n hdr.size = be16_to_host(hdr.size);\n hdr.version = be16_to_host(hdr.version);\n hdr.toc_length_compressed = be64_to_host(hdr.toc_length_compressed);\n hdr.toc_length_decompressed = be64_to_host(hdr.toc_length_decompressed);\n hdr.chksum_alg = be32_to_host(hdr.chksum_alg);\n\n /* cli_dbgmsg(\"hdr.magic %x\\n\", hdr.magic); */\n /* cli_dbgmsg(\"hdr.size %i\\n\", hdr.size); */\n /* cli_dbgmsg(\"hdr.version %i\\n\", hdr.version); */\n /* cli_dbgmsg(\"hdr.toc_length_compressed %lu\\n\", hdr.toc_length_compressed); */\n /* cli_dbgmsg(\"hdr.toc_length_decompressed %lu\\n\", hdr.toc_length_decompressed); */\n /* cli_dbgmsg(\"hdr.chksum_alg %i\\n\", hdr.chksum_alg); */\n \n /* Uncompress TOC */\n strm.next_in = (unsigned char *)fmap_need_off_once(*ctx->fmap, hdr.size, hdr.toc_length_compressed);\n if (strm.next_in == NULL) {\n cli_dbgmsg(\"cli_scanxar: fmap_need_off_once fails on TOC.\\n\");\n return CL_EREAD;\n }\n strm.avail_in = hdr.toc_length_compressed; \n toc = cli_malloc(hdr.toc_length_decompressed+1);\n if (toc == NULL) {\n cli_dbgmsg(\"cli_scanxar: cli_malloc fails on TOC decompress buffer.\\n\");\n return CL_EMEM;\n }\n toc[hdr.toc_length_decompressed] = '\\0';\n strm.avail_out = hdr.toc_length_decompressed;\n strm.next_out = (unsigned char *)toc;\n rc = inflateInit(&strm);\n if (rc != Z_OK) {\n cli_dbgmsg(\"cli_scanxar:inflateInit error %i \\n\", rc);\n rc = CL_EFORMAT;\n goto exit_toc;\n } \n rc = inflate(&strm, Z_SYNC_FLUSH);\n if (rc != Z_OK && rc != Z_STREAM_END) {\n cli_dbgmsg(\"cli_scanxar:inflate error %i \\n\", rc);\n rc = CL_EFORMAT;\n goto exit_toc;\n }\n rc = inflateEnd(&strm);\n if (rc != Z_OK) {\n cli_dbgmsg(\"cli_scanxar:inflateEnd error %i \\n\", rc);\n rc = CL_EFORMAT;\n goto exit_toc;\n }\n\n if (hdr.toc_length_decompressed != strm.total_out) {\n cli_dbgmsg(\"TOC decompress length %\" PRIu64 \" does not match amount decompressed %lu\\n\",\n hdr.toc_length_decompressed, strm.total_out);\n toc[strm.total_out] = '\\0';\n hdr.toc_length_decompressed = strm.total_out;\n }\n\n /* cli_dbgmsg(\"cli_scanxar: TOC xml:\\n%s\\n\", toc); */\n /* printf(\"cli_scanxar: TOC xml:\\n%s\\n\", toc); */\n /* cli_dbgmsg(\"cli_scanxar: TOC end:\\n\"); */\n /* printf(\"cli_scanxar: TOC end:\\n\"); */\n\n /* scan the xml */\n cli_dbgmsg(\"cli_scanxar: scanning xar TOC xml in memory.\\n\"); \n rc = cli_mem_scandesc(toc, hdr.toc_length_decompressed, ctx);\n if (rc != CL_SUCCESS) {\n if (rc != CL_VIRUS || !SCAN_ALL)\n goto exit_toc; \n }\n\n /* make a file to leave if --leave-temps in effect */\n if(ctx->engine->keeptmp) {\n if ((rc = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &fd)) != CL_SUCCESS) {\n cli_dbgmsg(\"cli_scanxar: Can't create temporary file for TOC.\\n\");\n goto exit_toc;\n }\n if (cli_writen(fd, toc, hdr.toc_length_decompressed) < 0) {\n cli_dbgmsg(\"cli_scanxar: cli_writen error writing TOC.\\n\");\n rc = CL_EWRITE;\n xar_cleanup_temp_file(ctx, fd, tmpname);\n goto exit_toc;\n }\n rc = xar_cleanup_temp_file(ctx, fd, tmpname);\n if (rc != CL_SUCCESS)\n goto exit_toc;\n }\n\n reader = xmlReaderForMemory(toc, hdr.toc_length_decompressed, \"noname.xml\", NULL, CLAMAV_MIN_XMLREADER_FLAGS);\n if (reader == NULL) {\n cli_dbgmsg(\"cli_scanxar: xmlReaderForMemory error for TOC\\n\");\n goto exit_toc;\n }\n\n rc = xar_scan_subdocuments(reader, ctx);\n if (rc != CL_SUCCESS) {\n cli_dbgmsg(\"xar_scan_subdocuments returns %i.\\n\", rc);\n goto exit_reader;\n }\n\n /* Walk the TOC XML and extract files */\n fd = -1;\n tmpname = NULL;\n while (CL_SUCCESS == (rc = xar_get_toc_data_values(reader, &length, &offset, &size, &encoding,\n &a_cksum, &a_hash, &e_cksum, &e_hash))) {\n int do_extract_cksum = 1;\n unsigned char * blockp;\n void *a_sc, *e_sc;\n void *a_mc, *e_mc;\n char * expected;\n\n /* clean up temp file from previous loop iteration */\n if (fd > -1 && tmpname) {\n rc = xar_cleanup_temp_file(ctx, fd, tmpname);\n if (rc != CL_SUCCESS)\n goto exit_reader;\n }\n\n at = offset + hdr.toc_length_compressed + hdr.size;\n\n if ((rc = cli_gentempfd(ctx->engine->tmpdir, &tmpname, &fd)) != CL_SUCCESS) {\n cli_dbgmsg(\"cli_scanxar: Can't generate temporary file.\\n\");\n goto exit_reader;\n }\n\n cli_dbgmsg(\"cli_scanxar: decompress into temp file:\\n%s, size %zu,\\n\"\n \"from xar heap offset %zu length %zu\\n\",\n tmpname, size, offset, length);\n\n\n a_hash_ctx = xar_hash_init(a_hash, &a_sc, &a_mc);\n e_hash_ctx = xar_hash_init(e_hash, &e_sc, &e_mc);\n\n switch (encoding) {\n case CL_TYPE_GZ:\n /* inflate gzip directly because file segments do not contain magic */\n memset(&strm, 0, sizeof(strm));\n if ((rc = inflateInit(&strm)) != Z_OK) {\n cli_dbgmsg(\"cli_scanxar: InflateInit failed: %d\\n\", rc);\n rc = CL_EFORMAT;\n extract_errors++;\n break;\n }\n \n while ((size_t)at < map->len && (unsigned long)at < offset+hdr.toc_length_compressed+hdr.size+length) {\n unsigned long avail_in;\n void * next_in;\n unsigned int bytes = MIN(map->len - at, map->pgsz);\n bytes = MIN(length, bytes);\n if(!(strm.next_in = next_in = (void*)fmap_need_off_once(map, at, bytes))) {\n cli_dbgmsg(\"cli_scanxar: Can't read %u bytes @ %lu.\\n\", bytes, (long unsigned)at);\n inflateEnd(&strm);\n rc = CL_EREAD;\n goto exit_tmpfile;\n }\n at += bytes;\n strm.avail_in = avail_in = bytes;\n do {\n int inf, outsize = 0;\n unsigned char buff[FILEBUFF];\n strm.avail_out = sizeof(buff);\n strm.next_out = buff;\n inf = inflate(&strm, Z_SYNC_FLUSH);\n if (inf != Z_OK && inf != Z_STREAM_END && inf != Z_BUF_ERROR) {\n cli_dbgmsg(\"cli_scanxar: inflate error %i %s.\\n\", inf, strm.msg?strm.msg:\"\");\n rc = CL_EFORMAT;\n extract_errors++;\n break;\n }\n\n bytes = sizeof(buff) - strm.avail_out;\n\n if (e_hash_ctx != NULL)\n xar_hash_update(e_hash_ctx, buff, bytes, e_hash);\n \n if (cli_writen(fd, buff, bytes) < 0) {\n cli_dbgmsg(\"cli_scanxar: cli_writen error file %s.\\n\", tmpname);\n inflateEnd(&strm);\n rc = CL_EWRITE;\n goto exit_tmpfile;\n }\n outsize += sizeof(buff) - strm.avail_out;\n if (cli_checklimits(\"cli_scanxar\", ctx, outsize, 0, 0) != CL_CLEAN) {\n break;\n }\n if (inf == Z_STREAM_END) {\n break;\n }\n } while (strm.avail_out == 0);\n\n if (rc != CL_SUCCESS)\n break;\n\n avail_in -= strm.avail_in;\n if (a_hash_ctx != NULL)\n xar_hash_update(a_hash_ctx, next_in, avail_in, a_hash);\n }\n\n inflateEnd(&strm);\n break;\n case CL_TYPE_7Z:\n#define CLI_LZMA_OBUF_SIZE 1024*1024\n#define CLI_LZMA_HDR_SIZE LZMA_PROPS_SIZE+8\n#define CLI_LZMA_IBUF_SIZE CLI_LZMA_OBUF_SIZE>>2 /* estimated compression ratio 25% */\n {\n struct CLI_LZMA lz;\n unsigned long in_remaining = MIN(length, map->len - at);\n unsigned long out_size = 0;\n unsigned char * buff = __lzma_wrap_alloc(NULL, CLI_LZMA_OBUF_SIZE);\n int lret;\n\n if (length > in_remaining)\n length = in_remaining;\n\n memset(&lz, 0, sizeof(lz));\n if (buff == NULL) {\n cli_dbgmsg(\"cli_scanxar: memory request for lzma decompression buffer fails.\\n\");\n rc = CL_EMEM;\n goto exit_tmpfile;\n \n }\n\n blockp = (void*)fmap_need_off_once(map, at, CLI_LZMA_HDR_SIZE);\n if (blockp == NULL) {\n char errbuff[128];\n cli_strerror(errno, errbuff, sizeof(errbuff));\n cli_dbgmsg(\"cli_scanxar: Can't read %i bytes @ %li, errno:%s.\\n\",\n CLI_LZMA_HDR_SIZE, at, errbuff);\n rc = CL_EREAD;\n __lzma_wrap_free(NULL, buff);\n goto exit_tmpfile;\n }\n\n lz.next_in = blockp;\n lz.avail_in = CLI_LZMA_HDR_SIZE;\n\n if (a_hash_ctx != NULL)\n xar_hash_update(a_hash_ctx, blockp, CLI_LZMA_HDR_SIZE, a_hash);\n\n lret = cli_LzmaInit(&lz, 0);\n if (lret != LZMA_RESULT_OK) {\n cli_dbgmsg(\"cli_scanxar: cli_LzmaInit() fails: %i.\\n\", lret);\n rc = CL_EFORMAT;\n __lzma_wrap_free(NULL, buff);\n extract_errors++;\n break;\n }\n\n at += CLI_LZMA_HDR_SIZE;\n in_remaining -= CLI_LZMA_HDR_SIZE;\n while ((size_t)at < map->len && (unsigned long)at < offset+hdr.toc_length_compressed+hdr.size+length) {\n SizeT avail_in;\n SizeT avail_out;\n void * next_in;\n unsigned long in_consumed;\n\n lz.next_out = buff;\n lz.avail_out = CLI_LZMA_OBUF_SIZE;\n lz.avail_in = avail_in = MIN(CLI_LZMA_IBUF_SIZE, in_remaining);\n lz.next_in = next_in = (void*)fmap_need_off_once(map, at, lz.avail_in);\n if (lz.next_in == NULL) {\n char errbuff[128];\n cli_strerror(errno, errbuff, sizeof(errbuff));\n cli_dbgmsg(\"cli_scanxar: Can't read %li bytes @ %li, errno: %s.\\n\",\n lz.avail_in, at, errbuff);\n rc = CL_EREAD;\n __lzma_wrap_free(NULL, buff);\n cli_LzmaShutdown(&lz);\n goto exit_tmpfile;\n }\n\n lret = cli_LzmaDecode(&lz);\n if (lret != LZMA_RESULT_OK && lret != LZMA_STREAM_END) {\n cli_dbgmsg(\"cli_scanxar: cli_LzmaDecode() fails: %i.\\n\", lret);\n rc = CL_EFORMAT;\n extract_errors++;\n break;\n }\n\n in_consumed = avail_in - lz.avail_in;\n in_remaining -= in_consumed;\n at += in_consumed;\n avail_out = CLI_LZMA_OBUF_SIZE - lz.avail_out;\n \n if (avail_out == 0)\n cli_dbgmsg(\"cli_scanxar: cli_LzmaDecode() produces no output for \"\n \"avail_in %llu, avail_out %llu.\\n\",\n (long long unsigned)avail_in, (long long unsigned)avail_out);\n\n if (a_hash_ctx != NULL)\n xar_hash_update(a_hash_ctx, next_in, in_consumed, a_hash); \n if (e_hash_ctx != NULL)\n xar_hash_update(e_hash_ctx, buff, avail_out, e_hash);\n\n /* Write a decompressed block. */\n /* cli_dbgmsg(\"Writing %li bytes to LZMA decompress temp file, \" */\n /* \"consumed %li of %li available compressed bytes.\\n\", */\n /* avail_out, in_consumed, avail_in); */\n\n if (cli_writen(fd, buff, avail_out) < 0) {\n cli_dbgmsg(\"cli_scanxar: cli_writen error writing lzma temp file for %llu bytes.\\n\",\n (long long unsigned)avail_out);\n __lzma_wrap_free(NULL, buff);\n cli_LzmaShutdown(&lz);\n rc = CL_EWRITE;\n goto exit_tmpfile;\n }\n\n /* Check file size limitation. */\n out_size += avail_out;\n if (cli_checklimits(\"cli_scanxar\", ctx, out_size, 0, 0) != CL_CLEAN) {\n break;\n }\n\n if (lret == LZMA_STREAM_END)\n break;\n }\n\n cli_LzmaShutdown(&lz);\n __lzma_wrap_free(NULL, buff);\n }\n break; \n case CL_TYPE_ANY:\n default:\n case CL_TYPE_BZ:\n case CL_TYPE_XZ:\n /* for uncompressed, bzip2, xz, and unknown, just pull the file, cli_magic_scandesc does the rest */\n do_extract_cksum = 0;\n {\n size_t writelen = MIN(map->len - at, length);\n\n if (ctx->engine->maxfilesize)\n writelen = MIN((size_t)(ctx->engine->maxfilesize), writelen);\n \n if (!(blockp = (void*)fmap_need_off_once(map, at, writelen))) {\n char errbuff[128];\n cli_strerror(errno, errbuff, sizeof(errbuff));\n cli_dbgmsg(\"cli_scanxar: Can't read %zu bytes @ %zu, errno:%s.\\n\",\n writelen, at, errbuff);\n rc = CL_EREAD;\n goto exit_tmpfile;\n }\n \n if (a_hash_ctx != NULL)\n xar_hash_update(a_hash_ctx, blockp, writelen, a_hash);\n \n if (cli_writen(fd, blockp, writelen) < 0) {\n cli_dbgmsg(\"cli_scanxar: cli_writen error %zu bytes @ %li.\\n\", writelen, at);\n rc = CL_EWRITE;\n goto exit_tmpfile;\n }\n /*break;*/\n } \n } /* end of switch */\n\n if (rc == CL_SUCCESS) {\n if (a_hash_ctx != NULL) {\n xar_hash_final(a_hash_ctx, result, a_hash);\n a_hash_ctx = NULL;\n } else {\n cli_dbgmsg(\"cli_scanxar: archived-checksum missing.\\n\");\n cksum_fails++;\n }\n if (a_cksum != NULL) {\n expected = cli_hex2str((char *)a_cksum);\n if (xar_hash_check(a_hash, result, expected) != 0) {\n cli_dbgmsg(\"cli_scanxar: archived-checksum mismatch.\\n\");\n cksum_fails++;\n } else {\n cli_dbgmsg(\"cli_scanxar: archived-checksum matched.\\n\"); \n }\n free(expected);\n }\n\n if (e_hash_ctx != NULL) {\n xar_hash_final(e_hash_ctx, result, e_hash);\n e_hash_ctx = NULL;\n } else {\n cli_dbgmsg(\"cli_scanxar: extracted-checksum(unarchived-checksum) missing.\\n\");\n cksum_fails++;\n }\n if (e_cksum != NULL) {\n if (do_extract_cksum) {\n expected = cli_hex2str((char *)e_cksum);\n if (xar_hash_check(e_hash, result, expected) != 0) {\n cli_dbgmsg(\"cli_scanxar: extracted-checksum mismatch.\\n\");\n cksum_fails++;\n } else {\n cli_dbgmsg(\"cli_scanxar: extracted-checksum matched.\\n\"); \n }\n free(expected);\n }\n }\n \n rc = cli_magic_scandesc(fd, ctx);\n if (rc != CL_SUCCESS) {\n if (rc == CL_VIRUS) {\n cli_dbgmsg(\"cli_scanxar: Infected with %s\\n\", cli_get_last_virus(ctx));\n if (!SCAN_ALL)\n goto exit_tmpfile;\n } else if (rc != CL_BREAK) {\n cli_dbgmsg(\"cli_scanxar: cli_magic_scandesc error %i\\n\", rc);\n goto exit_tmpfile;\n }\n }\n }\n \n if (a_cksum != NULL) {\n xmlFree(a_cksum);\n a_cksum = NULL;\n }\n if (e_cksum != NULL) {\n xmlFree(e_cksum);\n e_cksum = NULL;\n }\n }\n\n exit_tmpfile:\n xar_cleanup_temp_file(ctx, fd, tmpname);\n if (a_hash_ctx != NULL)\n xar_hash_final(a_hash_ctx, result, a_hash);\n if (e_hash_ctx != NULL)\n xar_hash_final(e_hash_ctx, result, e_hash);\n \n exit_reader:\n if (a_cksum != NULL)\n xmlFree(a_cksum); \n if (e_cksum != NULL)\n xmlFree(e_cksum);\n xmlTextReaderClose(reader);\n xmlFreeTextReader(reader);\n\n exit_toc:\n free(toc);\n if (rc == CL_BREAK)\n rc = CL_SUCCESS;\n#else\n cli_dbgmsg(\"cli_scanxar: can't scan xar files, need libxml2.\\n\");\n#endif\n if (cksum_fails + extract_errors != 0) {\n cli_dbgmsg(\"cli_scanxar: %u checksum errors and %u extraction errors.\\n\",\n cksum_fails, extract_errors);\n }\n\n return rc;\n}",
  14997. "project": "clamav-devel",
  14998. "hash": 63844451803940368534812304900745450586,
  14999. "size": 477,
  15000. "commit_id": "d96a6b8bcc7439fa7e3876207aa0a8e79c8451b6",
  15001. "message": "bb11588 - fix out of bounds read.",
  15002. "target": 0,
  15003. "dataset": "other",
  15004. "idx": 390686
  15005. }
  15006. ]
  15007. },
  15008. {
  15009. "call_depth": 3,
  15010. "longest_call_chain": [
  15011. "mt_input_configured",
  15012. "mt_touch_input_configured",
  15013. "mt_post_parse"
  15014. ],
  15015. "group_size": 4,
  15016. "functions": [
  15017. {
  15018. "func": "static void mt_post_parse_default_settings(struct mt_device *td,\n\t\t\t\t\t struct mt_application *app)\n{\n\t__s32 quirks = app->quirks;\n\n\t/* unknown serial device needs special quirks */\n\tif (list_is_singular(&app->mt_usages)) {\n\t\tquirks |= MT_QUIRK_ALWAYS_VALID;\n\t\tquirks &= ~MT_QUIRK_NOT_SEEN_MEANS_UP;\n\t\tquirks &= ~MT_QUIRK_VALID_IS_INRANGE;\n\t\tquirks &= ~MT_QUIRK_VALID_IS_CONFIDENCE;\n\t\tquirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE;\n\t}\n\n\tapp->quirks = quirks;\n}",
  15019. "project": "linux",
  15020. "hash": 58152714186148892912353046127509225987,
  15021. "size": 16,
  15022. "commit_id": "35556bed836f8dc07ac55f69c8d17dce3e7f0e25",
  15023. "message": "HID: core: Sanitize event code and type when mapping input\n\nWhen calling into hid_map_usage(), the passed event code is\nblindly stored as is, even if it doesn't fit in the associated bitmap.\n\nThis event code can come from a variety of sources, including devices\nmasquerading as input devices, only a bit more \"programmable\".\n\nInstead of taking the event code at face value, check that it actually\nfits the corresponding bitmap, and if it doesn't:\n- spit out a warning so that we know which device is acting up\n- NULLify the bitmap pointer so that we catch unexpected uses\n\nCode paths that can make use of untrusted inputs can now check\nthat the mapping was indeed correct and bail out if not.\n\nCc: stable@vger.kernel.org\nSigned-off-by: Marc Zyngier <maz@kernel.org>\nSigned-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>",
  15024. "target": 0,
  15025. "dataset": "other",
  15026. "idx": 458393
  15027. },
  15028. {
  15029. "func": "static void mt_post_parse(struct mt_device *td, struct mt_application *app)\n{\n\tif (!app->have_contact_count)\n\t\tapp->quirks &= ~MT_QUIRK_CONTACT_CNT_ACCURATE;\n}",
  15030. "project": "linux",
  15031. "hash": 213504921520913391093751786629722542600,
  15032. "size": 5,
  15033. "commit_id": "35556bed836f8dc07ac55f69c8d17dce3e7f0e25",
  15034. "message": "HID: core: Sanitize event code and type when mapping input\n\nWhen calling into hid_map_usage(), the passed event code is\nblindly stored as is, even if it doesn't fit in the associated bitmap.\n\nThis event code can come from a variety of sources, including devices\nmasquerading as input devices, only a bit more \"programmable\".\n\nInstead of taking the event code at face value, check that it actually\nfits the corresponding bitmap, and if it doesn't:\n- spit out a warning so that we know which device is acting up\n- NULLify the bitmap pointer so that we catch unexpected uses\n\nCode paths that can make use of untrusted inputs can now check\nthat the mapping was indeed correct and bail out if not.\n\nCc: stable@vger.kernel.org\nSigned-off-by: Marc Zyngier <maz@kernel.org>\nSigned-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>",
  15035. "target": 0,
  15036. "dataset": "other",
  15037. "idx": 458347
  15038. },
  15039. {
  15040. "func": "static int mt_input_configured(struct hid_device *hdev, struct hid_input *hi)\n{\n\tstruct mt_device *td = hid_get_drvdata(hdev);\n\tchar *name;\n\tconst char *suffix = NULL;\n\tstruct mt_report_data *rdata;\n\tstruct mt_application *mt_application = NULL;\n\tstruct hid_report *report;\n\tint ret;\n\n\tlist_for_each_entry(report, &hi->reports, hidinput_list) {\n\t\trdata = mt_find_report_data(td, report);\n\t\tif (!rdata) {\n\t\t\thid_err(hdev, \"failed to allocate data for report\\n\");\n\t\t\treturn -ENOMEM;\n\t\t}\n\n\t\tmt_application = rdata->application;\n\n\t\tif (rdata->is_mt_collection) {\n\t\t\tret = mt_touch_input_configured(hdev, hi,\n\t\t\t\t\t\t\tmt_application);\n\t\t\tif (ret)\n\t\t\t\treturn ret;\n\t\t}\n\t}\n\n\tswitch (hi->application) {\n\tcase HID_GD_KEYBOARD:\n\tcase HID_GD_KEYPAD:\n\tcase HID_GD_MOUSE:\n\tcase HID_DG_TOUCHPAD:\n\tcase HID_GD_SYSTEM_CONTROL:\n\tcase HID_CP_CONSUMER_CONTROL:\n\tcase HID_GD_WIRELESS_RADIO_CTLS:\n\tcase HID_GD_SYSTEM_MULTIAXIS:\n\t\t/* already handled by hid core */\n\t\tbreak;\n\tcase HID_DG_TOUCHSCREEN:\n\t\t/* we do not set suffix = \"Touchscreen\" */\n\t\thi->input->name = hdev->name;\n\t\tbreak;\n\tcase HID_DG_STYLUS:\n\t\t/* force BTN_STYLUS to allow tablet matching in udev */\n\t\t__set_bit(BTN_STYLUS, hi->input->keybit);\n\t\tbreak;\n\tcase HID_VD_ASUS_CUSTOM_MEDIA_KEYS:\n\t\tsuffix = \"Custom Media Keys\";\n\t\tbreak;\n\tcase HID_DG_PEN:\n\t\tsuffix = \"Stylus\";\n\t\tbreak;\n\tdefault:\n\t\tsuffix = \"UNKNOWN\";\n\t\tbreak;\n\t}\n\n\tif (suffix) {\n\t\tname = devm_kzalloc(&hi->input->dev,\n\t\t\t\t strlen(hdev->name) + strlen(suffix) + 2,\n\t\t\t\t GFP_KERNEL);\n\t\tif (name) {\n\t\t\tsprintf(name, \"%s %s\", hdev->name, suffix);\n\t\t\thi->input->name = name;\n\t\t}\n\t}\n\n\treturn 0;\n}",
  15041. "project": "linux",
  15042. "hash": 266436603296759703726440869455037074673,
  15043. "size": 69,
  15044. "commit_id": "35556bed836f8dc07ac55f69c8d17dce3e7f0e25",
  15045. "message": "HID: core: Sanitize event code and type when mapping input\n\nWhen calling into hid_map_usage(), the passed event code is\nblindly stored as is, even if it doesn't fit in the associated bitmap.\n\nThis event code can come from a variety of sources, including devices\nmasquerading as input devices, only a bit more \"programmable\".\n\nInstead of taking the event code at face value, check that it actually\nfits the corresponding bitmap, and if it doesn't:\n- spit out a warning so that we know which device is acting up\n- NULLify the bitmap pointer so that we catch unexpected uses\n\nCode paths that can make use of untrusted inputs can now check\nthat the mapping was indeed correct and bail out if not.\n\nCc: stable@vger.kernel.org\nSigned-off-by: Marc Zyngier <maz@kernel.org>\nSigned-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>",
  15046. "target": 0,
  15047. "dataset": "other",
  15048. "idx": 458354
  15049. },
  15050. {
  15051. "func": "static int mt_touch_input_configured(struct hid_device *hdev,\n\t\t\t\t struct hid_input *hi,\n\t\t\t\t struct mt_application *app)\n{\n\tstruct mt_device *td = hid_get_drvdata(hdev);\n\tstruct mt_class *cls = &td->mtclass;\n\tstruct input_dev *input = hi->input;\n\tint ret;\n\n\tif (!td->maxcontacts)\n\t\ttd->maxcontacts = MT_DEFAULT_MAXCONTACT;\n\n\tmt_post_parse(td, app);\n\tif (td->serial_maybe)\n\t\tmt_post_parse_default_settings(td, app);\n\n\tif (cls->is_indirect)\n\t\tapp->mt_flags |= INPUT_MT_POINTER;\n\n\tif (app->quirks & MT_QUIRK_NOT_SEEN_MEANS_UP)\n\t\tapp->mt_flags |= INPUT_MT_DROP_UNUSED;\n\n\t/* check for clickpads */\n\tif ((app->mt_flags & INPUT_MT_POINTER) &&\n\t (app->buttons_count == 1))\n\t\ttd->is_buttonpad = true;\n\n\tif (td->is_buttonpad)\n\t\t__set_bit(INPUT_PROP_BUTTONPAD, input->propbit);\n\n\tapp->pending_palm_slots = devm_kcalloc(&hi->input->dev,\n\t\t\t\t\t BITS_TO_LONGS(td->maxcontacts),\n\t\t\t\t\t sizeof(long),\n\t\t\t\t\t GFP_KERNEL);\n\tif (!app->pending_palm_slots)\n\t\treturn -ENOMEM;\n\n\tret = input_mt_init_slots(input, td->maxcontacts, app->mt_flags);\n\tif (ret)\n\t\treturn ret;\n\n\tapp->mt_flags = 0;\n\treturn 0;\n}",
  15052. "project": "linux",
  15053. "hash": 283822497685535133601448597004996256847,
  15054. "size": 44,
  15055. "commit_id": "35556bed836f8dc07ac55f69c8d17dce3e7f0e25",
  15056. "message": "HID: core: Sanitize event code and type when mapping input\n\nWhen calling into hid_map_usage(), the passed event code is\nblindly stored as is, even if it doesn't fit in the associated bitmap.\n\nThis event code can come from a variety of sources, including devices\nmasquerading as input devices, only a bit more \"programmable\".\n\nInstead of taking the event code at face value, check that it actually\nfits the corresponding bitmap, and if it doesn't:\n- spit out a warning so that we know which device is acting up\n- NULLify the bitmap pointer so that we catch unexpected uses\n\nCode paths that can make use of untrusted inputs can now check\nthat the mapping was indeed correct and bail out if not.\n\nCc: stable@vger.kernel.org\nSigned-off-by: Marc Zyngier <maz@kernel.org>\nSigned-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>",
  15057. "target": 0,
  15058. "dataset": "other",
  15059. "idx": 458406
  15060. }
  15061. ]
  15062. },
  15063. {
  15064. "call_depth": 3,
  15065. "longest_call_chain": [
  15066. "const_item_cache",
  15067. "Used_tables_and_const_cache",
  15068. "Item_args"
  15069. ],
  15070. "group_size": 17,
  15071. "functions": [
  15072. {
  15073. "func": " Used_tables_and_const_cache()\n :used_tables_cache(0),\n const_item_cache(true)\n { }",
  15074. "target": 0,
  15075. "cwe": [
  15076. "CWE-617"
  15077. ],
  15078. "project": "server",
  15079. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15080. "hash": 70170292268823126681646886511297141458,
  15081. "size": 4,
  15082. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15083. "dataset": "other",
  15084. "idx": 509027
  15085. },
  15086. {
  15087. "func": " Used_tables_and_const_cache(const Used_tables_and_const_cache *other)\n :used_tables_cache(other->used_tables_cache),\n const_item_cache(other->const_item_cache)\n { }",
  15088. "target": 0,
  15089. "cwe": [
  15090. "CWE-617"
  15091. ],
  15092. "project": "server",
  15093. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15094. "hash": 129347766320708436552887556270497611520,
  15095. "size": 4,
  15096. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15097. "dataset": "other",
  15098. "idx": 509279
  15099. },
  15100. {
  15101. "func": " Item_func_or_sum(THD *thd, List<Item> &list):\n Item_result_field(thd), Item_args(thd, list) { }",
  15102. "target": 0,
  15103. "cwe": [
  15104. "CWE-617"
  15105. ],
  15106. "project": "server",
  15107. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15108. "hash": 93801493894189936125723614342375676583,
  15109. "size": 2,
  15110. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15111. "dataset": "other",
  15112. "idx": 508993
  15113. },
  15114. {
  15115. "func": " Item_args(THD *thd, List<Item> &list)\n {\n set_arguments(thd, list);\n }",
  15116. "target": 0,
  15117. "cwe": [
  15118. "CWE-617"
  15119. ],
  15120. "project": "server",
  15121. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15122. "hash": 107473002294933021114198266023758839804,
  15123. "size": 4,
  15124. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15125. "dataset": "other",
  15126. "idx": 509015
  15127. },
  15128. {
  15129. "func": " Item_args(THD *thd, Item *a, Item *b, Item *c, Item *d)\n {\n arg_count= 0;\n if ((args= (Item**) thd_alloc(thd, sizeof(Item*) * 4)))\n {\n arg_count= 4;\n args[0]= a; args[1]= b; args[2]= c; args[3]= d;\n }\n }",
  15130. "target": 0,
  15131. "cwe": [
  15132. "CWE-617"
  15133. ],
  15134. "project": "server",
  15135. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15136. "hash": 98758509636609230532018393515442874480,
  15137. "size": 9,
  15138. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15139. "dataset": "other",
  15140. "idx": 509052
  15141. },
  15142. {
  15143. "func": " Item_args(THD *thd, Item *a, Item *b, Item *c, Item *d, Item* e)\n {\n arg_count= 5;\n if ((args= (Item**) thd_alloc(thd, sizeof(Item*) * 5)))\n {\n arg_count= 5;\n args[0]= a; args[1]= b; args[2]= c; args[3]= d; args[4]= e;\n }\n }",
  15144. "target": 0,
  15145. "cwe": [
  15146. "CWE-617"
  15147. ],
  15148. "project": "server",
  15149. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15150. "hash": 82753295150051949649760613834725297095,
  15151. "size": 9,
  15152. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15153. "dataset": "other",
  15154. "idx": 509113
  15155. },
  15156. {
  15157. "func": " Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c, Item *d, Item *e):\n Item_result_field(thd), Item_args(thd, a, b, c, d, e) { }",
  15158. "target": 0,
  15159. "cwe": [
  15160. "CWE-617"
  15161. ],
  15162. "project": "server",
  15163. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15164. "hash": 29791013221365034714959362410181658469,
  15165. "size": 2,
  15166. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15167. "dataset": "other",
  15168. "idx": 509156
  15169. },
  15170. {
  15171. "func": " Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c, Item *d):\n Item_result_field(thd), Item_args(thd, a, b, c, d) { }",
  15172. "target": 0,
  15173. "cwe": [
  15174. "CWE-617"
  15175. ],
  15176. "project": "server",
  15177. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15178. "hash": 253063585750248010350977435121311080952,
  15179. "size": 2,
  15180. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15181. "dataset": "other",
  15182. "idx": 509267
  15183. },
  15184. {
  15185. "func": " Item_func_or_sum(THD *thd, Item *a, Item *b):\n Item_result_field(thd), Item_args(a, b) { }",
  15186. "target": 0,
  15187. "cwe": [
  15188. "CWE-617"
  15189. ],
  15190. "project": "server",
  15191. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15192. "hash": 188631549360207284087954855294399784867,
  15193. "size": 2,
  15194. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15195. "dataset": "other",
  15196. "idx": 509311
  15197. },
  15198. {
  15199. "func": " Item_func_or_sum(THD *thd, Item *a, Item *b, Item *c):\n Item_result_field(thd), Item_args(thd, a, b, c) { }",
  15200. "target": 0,
  15201. "cwe": [
  15202. "CWE-617"
  15203. ],
  15204. "project": "server",
  15205. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15206. "hash": 130706807230659488529929597216420655911,
  15207. "size": 2,
  15208. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15209. "dataset": "other",
  15210. "idx": 509325
  15211. },
  15212. {
  15213. "func": " Item_func_or_sum(THD *thd, Item *a): Item_result_field(thd), Item_args(a) { }",
  15214. "target": 0,
  15215. "cwe": [
  15216. "CWE-617"
  15217. ],
  15218. "project": "server",
  15219. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15220. "hash": 119541379773122882135542307744678575193,
  15221. "size": 1,
  15222. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15223. "dataset": "other",
  15224. "idx": 509354
  15225. },
  15226. {
  15227. "func": " Item_func_or_sum(THD *thd): Item_result_field(thd), Item_args() {}",
  15228. "target": 0,
  15229. "cwe": [
  15230. "CWE-617"
  15231. ],
  15232. "project": "server",
  15233. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15234. "hash": 50476602307086361413307091018138685320,
  15235. "size": 1,
  15236. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15237. "dataset": "other",
  15238. "idx": 509436
  15239. },
  15240. {
  15241. "func": " Item_args(THD *thd, Item *a, Item *b, Item *c)\n {\n arg_count= 0;\n if ((args= (Item**) thd_alloc(thd, sizeof(Item*) * 3)))\n {\n arg_count= 3;\n args[0]= a; args[1]= b; args[2]= c;\n }\n }",
  15242. "target": 0,
  15243. "cwe": [
  15244. "CWE-617"
  15245. ],
  15246. "project": "server",
  15247. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15248. "hash": 2322469865541057066563100503472676470,
  15249. "size": 9,
  15250. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15251. "dataset": "other",
  15252. "idx": 509463
  15253. },
  15254. {
  15255. "func": " Item_args(void)\n :args(NULL), arg_count(0)\n { }",
  15256. "target": 0,
  15257. "cwe": [
  15258. "CWE-617"
  15259. ],
  15260. "project": "server",
  15261. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15262. "hash": 61081988329386483319425005015179181665,
  15263. "size": 3,
  15264. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15265. "dataset": "other",
  15266. "idx": 509004
  15267. },
  15268. {
  15269. "func": " Item_args(Item *a)\n :args(tmp_arg), arg_count(1)\n {\n args[0]= a;\n }",
  15270. "target": 0,
  15271. "cwe": [
  15272. "CWE-617"
  15273. ],
  15274. "project": "server",
  15275. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15276. "hash": 39732291047470280382794240015165951105,
  15277. "size": 5,
  15278. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15279. "dataset": "other",
  15280. "idx": 509295
  15281. },
  15282. {
  15283. "func": " Item_args(Item *a, Item *b)\n :args(tmp_arg), arg_count(2)\n {\n args[0]= a; args[1]= b;\n }",
  15284. "target": 0,
  15285. "cwe": [
  15286. "CWE-617"
  15287. ],
  15288. "project": "server",
  15289. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15290. "hash": 59211100634841026195075519384401584121,
  15291. "size": 5,
  15292. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15293. "dataset": "other",
  15294. "idx": 509315
  15295. },
  15296. {
  15297. "func": " Item_func_or_sum(THD *thd, Item_func_or_sum *item):\n Item_result_field(thd, item), Item_args(thd, item),\n Used_tables_and_const_cache(item) { }",
  15298. "target": 0,
  15299. "cwe": [
  15300. "CWE-617"
  15301. ],
  15302. "project": "server",
  15303. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  15304. "hash": 151721658218341219919413360088132809029,
  15305. "size": 3,
  15306. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  15307. "dataset": "other",
  15308. "idx": 509355
  15309. }
  15310. ]
  15311. },
  15312. {
  15313. "call_depth": 3,
  15314. "longest_call_chain": [
  15315. "ff_layout_read_done_cb",
  15316. "ff_layout_async_handle_error",
  15317. "ff_layout_async_handle_error_v3"
  15318. ],
  15319. "group_size": 7,
  15320. "functions": [
  15321. {
  15322. "func": "static int ff_layout_commit_done_cb(struct rpc_task *task,\n\t\t\t\t struct nfs_commit_data *data)\n{\n\tint err;\n\n\tif (task->tk_status < 0) {\n\t\tff_layout_io_track_ds_error(data->lseg, data->ds_commit_index,\n\t\t\t\t\t data->args.offset, data->args.count,\n\t\t\t\t\t &data->res.op_status, OP_COMMIT,\n\t\t\t\t\t task->tk_status);\n\t\ttrace_ff_layout_commit_error(data);\n\t}\n\n\terr = ff_layout_async_handle_error(task, NULL, data->ds_clp,\n\t\t\t\t\t data->lseg, data->ds_commit_index);\n\n\ttrace_nfs4_pnfs_commit_ds(data, err);\n\tswitch (err) {\n\tcase -NFS4ERR_RESET_TO_PNFS:\n\t\tpnfs_generic_prepare_to_resend_writes(data);\n\t\treturn -EAGAIN;\n\tcase -NFS4ERR_RESET_TO_MDS:\n\t\tpnfs_generic_prepare_to_resend_writes(data);\n\t\treturn -EAGAIN;\n\tcase -EAGAIN:\n\t\trpc_restart_call_prepare(task);\n\t\treturn -EAGAIN;\n\t}\n\n\tff_layout_set_layoutcommit(data->inode, data->lseg, data->lwb);\n\n\treturn 0;\n}",
  15323. "project": "linux",
  15324. "hash": 106318797871217730338365737523274006652,
  15325. "size": 33,
  15326. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  15327. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  15328. "target": 0,
  15329. "dataset": "other",
  15330. "idx": 234437
  15331. },
  15332. {
  15333. "func": "static int ff_layout_async_handle_error_v3(struct rpc_task *task,\n\t\t\t\t\t struct pnfs_layout_segment *lseg,\n\t\t\t\t\t u32 idx)\n{\n\tstruct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);\n\n\tswitch (task->tk_status) {\n\t/* File access problems. Don't mark the device as unavailable */\n\tcase -EACCES:\n\tcase -ESTALE:\n\tcase -EISDIR:\n\tcase -EBADHANDLE:\n\tcase -ELOOP:\n\tcase -ENOSPC:\n\t\tbreak;\n\tcase -EJUKEBOX:\n\t\tnfs_inc_stats(lseg->pls_layout->plh_inode, NFSIOS_DELAY);\n\t\tgoto out_retry;\n\tdefault:\n\t\tdprintk(\"%s DS connection error %d\\n\", __func__,\n\t\t\ttask->tk_status);\n\t\tnfs4_delete_deviceid(devid->ld, devid->nfs_client,\n\t\t\t\t&devid->deviceid);\n\t}\n\t/* FIXME: Need to prevent infinite looping here. */\n\treturn -NFS4ERR_RESET_TO_PNFS;\nout_retry:\n\ttask->tk_status = 0;\n\trpc_restart_call_prepare(task);\n\trpc_delay(task, NFS_JUKEBOX_RETRY_TIME);\n\treturn -EAGAIN;\n}",
  15334. "project": "linux",
  15335. "hash": 50022064211193577675270940169020858967,
  15336. "size": 32,
  15337. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  15338. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  15339. "target": 0,
  15340. "dataset": "other",
  15341. "idx": 234394
  15342. },
  15343. {
  15344. "func": "static int ff_layout_write_done_cb(struct rpc_task *task,\n\t\t\t\tstruct nfs_pgio_header *hdr)\n{\n\tloff_t end_offs = 0;\n\tint err;\n\n\tif (task->tk_status < 0) {\n\t\tff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx,\n\t\t\t\t\t hdr->args.offset, hdr->args.count,\n\t\t\t\t\t &hdr->res.op_status, OP_WRITE,\n\t\t\t\t\t task->tk_status);\n\t\ttrace_ff_layout_write_error(hdr);\n\t}\n\n\terr = ff_layout_async_handle_error(task, hdr->args.context->state,\n\t\t\t\t\t hdr->ds_clp, hdr->lseg,\n\t\t\t\t\t hdr->pgio_mirror_idx);\n\n\ttrace_nfs4_pnfs_write(hdr, err);\n\tclear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags);\n\tclear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags);\n\tswitch (err) {\n\tcase -NFS4ERR_RESET_TO_PNFS:\n\t\tset_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags);\n\t\treturn task->tk_status;\n\tcase -NFS4ERR_RESET_TO_MDS:\n\t\tset_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags);\n\t\treturn task->tk_status;\n\tcase -EAGAIN:\n\t\treturn -EAGAIN;\n\t}\n\n\tif (hdr->res.verf->committed == NFS_FILE_SYNC ||\n\t hdr->res.verf->committed == NFS_DATA_SYNC)\n\t\tend_offs = hdr->mds_offset + (loff_t)hdr->res.count;\n\n\t/* Note: if the write is unstable, don't set end_offs until commit */\n\tff_layout_set_layoutcommit(hdr->inode, hdr->lseg, end_offs);\n\n\t/* zero out fattr since we don't care DS attr at all */\n\thdr->fattr.valid = 0;\n\tif (task->tk_status >= 0)\n\t\tnfs_writeback_update_inode(hdr);\n\n\treturn 0;\n}",
  15345. "project": "linux",
  15346. "hash": 168398118774376998007428881702397687610,
  15347. "size": 46,
  15348. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  15349. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  15350. "target": 0,
  15351. "dataset": "other",
  15352. "idx": 234478
  15353. },
  15354. {
  15355. "func": "static void ff_layout_io_track_ds_error(struct pnfs_layout_segment *lseg,\n\t\t\t\t\tu32 idx, u64 offset, u64 length,\n\t\t\t\t\tu32 *op_status, int opnum, int error)\n{\n\tstruct nfs4_ff_layout_mirror *mirror;\n\tu32 status = *op_status;\n\tint err;\n\n\tif (status == 0) {\n\t\tswitch (error) {\n\t\tcase -ETIMEDOUT:\n\t\tcase -EPFNOSUPPORT:\n\t\tcase -EPROTONOSUPPORT:\n\t\tcase -EOPNOTSUPP:\n\t\tcase -ECONNREFUSED:\n\t\tcase -ECONNRESET:\n\t\tcase -EHOSTDOWN:\n\t\tcase -EHOSTUNREACH:\n\t\tcase -ENETUNREACH:\n\t\tcase -EADDRINUSE:\n\t\tcase -ENOBUFS:\n\t\tcase -EPIPE:\n\t\tcase -EPERM:\n\t\t\t*op_status = status = NFS4ERR_NXIO;\n\t\t\tbreak;\n\t\tcase -EACCES:\n\t\t\t*op_status = status = NFS4ERR_ACCESS;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn;\n\t\t}\n\t}\n\n\tmirror = FF_LAYOUT_COMP(lseg, idx);\n\terr = ff_layout_track_ds_error(FF_LAYOUT_FROM_HDR(lseg->pls_layout),\n\t\t\t\t mirror, offset, length, status, opnum,\n\t\t\t\t GFP_NOIO);\n\n\tswitch (status) {\n\tcase NFS4ERR_DELAY:\n\tcase NFS4ERR_GRACE:\n\t\tbreak;\n\tcase NFS4ERR_NXIO:\n\t\tff_layout_mark_ds_unreachable(lseg, idx);\n\t\t/*\n\t\t * Don't return the layout if this is a read and we still\n\t\t * have layouts to try\n\t\t */\n\t\tif (opnum == OP_READ)\n\t\t\tbreak;\n\t\tfallthrough;\n\tdefault:\n\t\tpnfs_error_mark_layout_for_return(lseg->pls_layout->plh_inode,\n\t\t\t\t\t\t lseg);\n\t}\n\n\tdprintk(\"%s: err %d op %d status %u\\n\", __func__, err, opnum, status);\n}",
  15356. "project": "linux",
  15357. "hash": 220799155530918833183643254086886191150,
  15358. "size": 58,
  15359. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  15360. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  15361. "target": 0,
  15362. "dataset": "other",
  15363. "idx": 234389
  15364. },
  15365. {
  15366. "func": "static int ff_layout_async_handle_error(struct rpc_task *task,\n\t\t\t\t\tstruct nfs4_state *state,\n\t\t\t\t\tstruct nfs_client *clp,\n\t\t\t\t\tstruct pnfs_layout_segment *lseg,\n\t\t\t\t\tu32 idx)\n{\n\tint vers = clp->cl_nfs_mod->rpc_vers->number;\n\n\tif (task->tk_status >= 0) {\n\t\tff_layout_mark_ds_reachable(lseg, idx);\n\t\treturn 0;\n\t}\n\n\t/* Handle the case of an invalid layout segment */\n\tif (!pnfs_is_valid_lseg(lseg))\n\t\treturn -NFS4ERR_RESET_TO_PNFS;\n\n\tswitch (vers) {\n\tcase 3:\n\t\treturn ff_layout_async_handle_error_v3(task, lseg, idx);\n\tcase 4:\n\t\treturn ff_layout_async_handle_error_v4(task, state, clp,\n\t\t\t\t\t\t lseg, idx);\n\tdefault:\n\t\t/* should never happen */\n\t\tWARN_ON_ONCE(1);\n\t\treturn 0;\n\t}\n}",
  15367. "project": "linux",
  15368. "hash": 215930583568728152231241471725064740567,
  15369. "size": 29,
  15370. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  15371. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  15372. "target": 0,
  15373. "dataset": "other",
  15374. "idx": 234436
  15375. },
  15376. {
  15377. "func": "static int ff_layout_read_done_cb(struct rpc_task *task,\n\t\t\t\tstruct nfs_pgio_header *hdr)\n{\n\tint err;\n\n\tif (task->tk_status < 0) {\n\t\tff_layout_io_track_ds_error(hdr->lseg, hdr->pgio_mirror_idx,\n\t\t\t\t\t hdr->args.offset, hdr->args.count,\n\t\t\t\t\t &hdr->res.op_status, OP_READ,\n\t\t\t\t\t task->tk_status);\n\t\ttrace_ff_layout_read_error(hdr);\n\t}\n\n\terr = ff_layout_async_handle_error(task, hdr->args.context->state,\n\t\t\t\t\t hdr->ds_clp, hdr->lseg,\n\t\t\t\t\t hdr->pgio_mirror_idx);\n\n\ttrace_nfs4_pnfs_read(hdr, err);\n\tclear_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags);\n\tclear_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags);\n\tswitch (err) {\n\tcase -NFS4ERR_RESET_TO_PNFS:\n\t\tset_bit(NFS_IOHDR_RESEND_PNFS, &hdr->flags);\n\t\treturn task->tk_status;\n\tcase -NFS4ERR_RESET_TO_MDS:\n\t\tset_bit(NFS_IOHDR_RESEND_MDS, &hdr->flags);\n\t\treturn task->tk_status;\n\tcase -EAGAIN:\n\t\tgoto out_eagain;\n\t}\n\n\treturn 0;\nout_eagain:\n\trpc_restart_call_prepare(task);\n\treturn -EAGAIN;\n}",
  15378. "project": "linux",
  15379. "hash": 330872505513758726857852614562189654275,
  15380. "size": 36,
  15381. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  15382. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  15383. "target": 0,
  15384. "dataset": "other",
  15385. "idx": 234498
  15386. },
  15387. {
  15388. "func": "static int ff_layout_async_handle_error_v4(struct rpc_task *task,\n\t\t\t\t\t struct nfs4_state *state,\n\t\t\t\t\t struct nfs_client *clp,\n\t\t\t\t\t struct pnfs_layout_segment *lseg,\n\t\t\t\t\t u32 idx)\n{\n\tstruct pnfs_layout_hdr *lo = lseg->pls_layout;\n\tstruct inode *inode = lo->plh_inode;\n\tstruct nfs4_deviceid_node *devid = FF_LAYOUT_DEVID_NODE(lseg, idx);\n\tstruct nfs4_slot_table *tbl = &clp->cl_session->fc_slot_table;\n\n\tswitch (task->tk_status) {\n\tcase -NFS4ERR_BADSESSION:\n\tcase -NFS4ERR_BADSLOT:\n\tcase -NFS4ERR_BAD_HIGH_SLOT:\n\tcase -NFS4ERR_DEADSESSION:\n\tcase -NFS4ERR_CONN_NOT_BOUND_TO_SESSION:\n\tcase -NFS4ERR_SEQ_FALSE_RETRY:\n\tcase -NFS4ERR_SEQ_MISORDERED:\n\t\tdprintk(\"%s ERROR %d, Reset session. Exchangeid \"\n\t\t\t\"flags 0x%x\\n\", __func__, task->tk_status,\n\t\t\tclp->cl_exchange_flags);\n\t\tnfs4_schedule_session_recovery(clp->cl_session, task->tk_status);\n\t\tbreak;\n\tcase -NFS4ERR_DELAY:\n\tcase -NFS4ERR_GRACE:\n\t\trpc_delay(task, FF_LAYOUT_POLL_RETRY_MAX);\n\t\tbreak;\n\tcase -NFS4ERR_RETRY_UNCACHED_REP:\n\t\tbreak;\n\t/* Invalidate Layout errors */\n\tcase -NFS4ERR_PNFS_NO_LAYOUT:\n\tcase -ESTALE: /* mapped NFS4ERR_STALE */\n\tcase -EBADHANDLE: /* mapped NFS4ERR_BADHANDLE */\n\tcase -EISDIR: /* mapped NFS4ERR_ISDIR */\n\tcase -NFS4ERR_FHEXPIRED:\n\tcase -NFS4ERR_WRONG_TYPE:\n\t\tdprintk(\"%s Invalid layout error %d\\n\", __func__,\n\t\t\ttask->tk_status);\n\t\t/*\n\t\t * Destroy layout so new i/o will get a new layout.\n\t\t * Layout will not be destroyed until all current lseg\n\t\t * references are put. Mark layout as invalid to resend failed\n\t\t * i/o and all i/o waiting on the slot table to the MDS until\n\t\t * layout is destroyed and a new valid layout is obtained.\n\t\t */\n\t\tpnfs_destroy_layout(NFS_I(inode));\n\t\trpc_wake_up(&tbl->slot_tbl_waitq);\n\t\tgoto reset;\n\t/* RPC connection errors */\n\tcase -ECONNREFUSED:\n\tcase -EHOSTDOWN:\n\tcase -EHOSTUNREACH:\n\tcase -ENETUNREACH:\n\tcase -EIO:\n\tcase -ETIMEDOUT:\n\tcase -EPIPE:\n\t\tdprintk(\"%s DS connection error %d\\n\", __func__,\n\t\t\ttask->tk_status);\n\t\tnfs4_delete_deviceid(devid->ld, devid->nfs_client,\n\t\t\t\t&devid->deviceid);\n\t\trpc_wake_up(&tbl->slot_tbl_waitq);\n\t\tfallthrough;\n\tdefault:\n\t\tif (ff_layout_avoid_mds_available_ds(lseg))\n\t\t\treturn -NFS4ERR_RESET_TO_PNFS;\nreset:\n\t\tdprintk(\"%s Retry through MDS. Error %d\\n\", __func__,\n\t\t\ttask->tk_status);\n\t\treturn -NFS4ERR_RESET_TO_MDS;\n\t}\n\ttask->tk_status = 0;\n\treturn -EAGAIN;\n}",
  15389. "project": "linux",
  15390. "hash": 286251947122498055108704360251986480348,
  15391. "size": 74,
  15392. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  15393. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  15394. "target": 0,
  15395. "dataset": "other",
  15396. "idx": 234424
  15397. }
  15398. ]
  15399. },
  15400. {
  15401. "call_depth": 3,
  15402. "longest_call_chain": [
  15403. "check_bugs",
  15404. "taa_select_mitigation",
  15405. "mds_select_mitigation"
  15406. ],
  15407. "group_size": 5,
  15408. "functions": [
  15409. {
  15410. "func": "static void __init mds_print_mitigation(void)\n{\n\tif (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off())\n\t\treturn;\n\n\tpr_info(\"%s\\n\", mds_strings[mds_mitigation]);\n}",
  15411. "project": "linux",
  15412. "hash": 280770500787910336824923803341770506427,
  15413. "size": 7,
  15414. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15415. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15416. "target": 0,
  15417. "dataset": "other",
  15418. "idx": 338782
  15419. },
  15420. {
  15421. "func": "static void __init taa_select_mitigation(void)\n{\n\tu64 ia32_cap;\n\n\tif (!boot_cpu_has_bug(X86_BUG_TAA)) {\n\t\ttaa_mitigation = TAA_MITIGATION_OFF;\n\t\treturn;\n\t}\n\n\t/* TSX previously disabled by tsx=off */\n\tif (!boot_cpu_has(X86_FEATURE_RTM)) {\n\t\ttaa_mitigation = TAA_MITIGATION_TSX_DISABLED;\n\t\tgoto out;\n\t}\n\n\tif (cpu_mitigations_off()) {\n\t\ttaa_mitigation = TAA_MITIGATION_OFF;\n\t\treturn;\n\t}\n\n\t/*\n\t * TAA mitigation via VERW is turned off if both\n\t * tsx_async_abort=off and mds=off are specified.\n\t */\n\tif (taa_mitigation == TAA_MITIGATION_OFF &&\n\t mds_mitigation == MDS_MITIGATION_OFF)\n\t\tgoto out;\n\n\tif (boot_cpu_has(X86_FEATURE_MD_CLEAR))\n\t\ttaa_mitigation = TAA_MITIGATION_VERW;\n\telse\n\t\ttaa_mitigation = TAA_MITIGATION_UCODE_NEEDED;\n\n\t/*\n\t * VERW doesn't clear the CPU buffers when MD_CLEAR=1 and MDS_NO=1.\n\t * A microcode update fixes this behavior to clear CPU buffers. It also\n\t * adds support for MSR_IA32_TSX_CTRL which is enumerated by the\n\t * ARCH_CAP_TSX_CTRL_MSR bit.\n\t *\n\t * On MDS_NO=1 CPUs if ARCH_CAP_TSX_CTRL_MSR is not set, microcode\n\t * update is required.\n\t */\n\tia32_cap = x86_read_arch_cap_msr();\n\tif ( (ia32_cap & ARCH_CAP_MDS_NO) &&\n\t !(ia32_cap & ARCH_CAP_TSX_CTRL_MSR))\n\t\ttaa_mitigation = TAA_MITIGATION_UCODE_NEEDED;\n\n\t/*\n\t * TSX is enabled, select alternate mitigation for TAA which is\n\t * the same as MDS. Enable MDS static branch to clear CPU buffers.\n\t *\n\t * For guests that can't determine whether the correct microcode is\n\t * present on host, enable the mitigation for UCODE_NEEDED as well.\n\t */\n\tstatic_branch_enable(&mds_user_clear);\n\n\tif (taa_nosmt || cpu_mitigations_auto_nosmt())\n\t\tcpu_smt_disable(false);\n\n\t/*\n\t * Update MDS mitigation, if necessary, as the mds_user_clear is\n\t * now enabled for TAA mitigation.\n\t */\n\tif (mds_mitigation == MDS_MITIGATION_OFF &&\n\t boot_cpu_has_bug(X86_BUG_MDS)) {\n\t\tmds_mitigation = MDS_MITIGATION_FULL;\n\t\tmds_select_mitigation();\n\t}\nout:\n\tpr_info(\"%s\\n\", taa_strings[taa_mitigation]);\n}",
  15422. "project": "linux",
  15423. "hash": 164904901481830093158124385210891913323,
  15424. "size": 71,
  15425. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15426. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15427. "target": 0,
  15428. "dataset": "other",
  15429. "idx": 338795
  15430. },
  15431. {
  15432. "func": "void __init check_bugs(void)\n{\n\tidentify_boot_cpu();\n\n\t/*\n\t * identify_boot_cpu() initialized SMT support information, let the\n\t * core code know.\n\t */\n\tcpu_smt_check_topology();\n\n\tif (!IS_ENABLED(CONFIG_SMP)) {\n\t\tpr_info(\"CPU: \");\n\t\tprint_cpu_info(&boot_cpu_data);\n\t}\n\n\t/*\n\t * Read the SPEC_CTRL MSR to account for reserved bits which may\n\t * have unknown values. AMD64_LS_CFG MSR is cached in the early AMD\n\t * init code as it is not enumerated and depends on the family.\n\t */\n\tif (boot_cpu_has(X86_FEATURE_MSR_SPEC_CTRL))\n\t\trdmsrl(MSR_IA32_SPEC_CTRL, x86_spec_ctrl_base);\n\n\t/* Allow STIBP in MSR_SPEC_CTRL if supported */\n\tif (boot_cpu_has(X86_FEATURE_STIBP))\n\t\tx86_spec_ctrl_mask |= SPEC_CTRL_STIBP;\n\n\t/* Select the proper CPU mitigations before patching alternatives: */\n\tspectre_v1_select_mitigation();\n\tspectre_v2_select_mitigation();\n\tssb_select_mitigation();\n\tl1tf_select_mitigation();\n\tmds_select_mitigation();\n\ttaa_select_mitigation();\n\n\t/*\n\t * As MDS and TAA mitigations are inter-related, print MDS\n\t * mitigation until after TAA mitigation selection is done.\n\t */\n\tmds_print_mitigation();\n\n\tarch_smt_update();\n\n#ifdef CONFIG_X86_32\n\t/*\n\t * Check whether we are able to run this kernel safely on SMP.\n\t *\n\t * - i386 is no longer supported.\n\t * - In order to run on anything without a TSC, we need to be\n\t * compiled for a i486.\n\t */\n\tif (boot_cpu_data.x86 < 4)\n\t\tpanic(\"Kernel requires i486+ for 'invlpg' and other features\");\n\n\tinit_utsname()->machine[1] =\n\t\t'0' + (boot_cpu_data.x86 > 6 ? 6 : boot_cpu_data.x86);\n\talternative_instructions();\n\n\tfpu__init_check_bugs();\n#else /* CONFIG_X86_64 */\n\talternative_instructions();\n\n\t/*\n\t * Make sure the first 2MB area is not mapped by huge pages\n\t * There are typically fixed size MTRRs in there and overlapping\n\t * MTRRs into large pages causes slow downs.\n\t *\n\t * Right now we don't do that with gbpages because there seems\n\t * very little benefit for that case.\n\t */\n\tif (!direct_gbpages)\n\t\tset_memory_4k((unsigned long)__va(0), 1);\n#endif\n}",
  15433. "project": "linux",
  15434. "hash": 76335874925632396404664250494341450697,
  15435. "size": 74,
  15436. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15437. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15438. "target": 0,
  15439. "dataset": "other",
  15440. "idx": 338794
  15441. },
  15442. {
  15443. "func": "static void __init spectre_v1_select_mitigation(void)\n{\n\tif (!boot_cpu_has_bug(X86_BUG_SPECTRE_V1) || cpu_mitigations_off()) {\n\t\tspectre_v1_mitigation = SPECTRE_V1_MITIGATION_NONE;\n\t\treturn;\n\t}\n\n\tif (spectre_v1_mitigation == SPECTRE_V1_MITIGATION_AUTO) {\n\t\t/*\n\t\t * With Spectre v1, a user can speculatively control either\n\t\t * path of a conditional swapgs with a user-controlled GS\n\t\t * value. The mitigation is to add lfences to both code paths.\n\t\t *\n\t\t * If FSGSBASE is enabled, the user can put a kernel address in\n\t\t * GS, in which case SMAP provides no protection.\n\t\t *\n\t\t * [ NOTE: Don't check for X86_FEATURE_FSGSBASE until the\n\t\t *\t FSGSBASE enablement patches have been merged. ]\n\t\t *\n\t\t * If FSGSBASE is disabled, the user can only put a user space\n\t\t * address in GS. That makes an attack harder, but still\n\t\t * possible if there's no SMAP protection.\n\t\t */\n\t\tif (!smap_works_speculatively()) {\n\t\t\t/*\n\t\t\t * Mitigation can be provided from SWAPGS itself or\n\t\t\t * PTI as the CR3 write in the Meltdown mitigation\n\t\t\t * is serializing.\n\t\t\t *\n\t\t\t * If neither is there, mitigate with an LFENCE to\n\t\t\t * stop speculation through swapgs.\n\t\t\t */\n\t\t\tif (boot_cpu_has_bug(X86_BUG_SWAPGS) &&\n\t\t\t !boot_cpu_has(X86_FEATURE_PTI))\n\t\t\t\tsetup_force_cpu_cap(X86_FEATURE_FENCE_SWAPGS_USER);\n\n\t\t\t/*\n\t\t\t * Enable lfences in the kernel entry (non-swapgs)\n\t\t\t * paths, to prevent user entry from speculatively\n\t\t\t * skipping swapgs.\n\t\t\t */\n\t\t\tsetup_force_cpu_cap(X86_FEATURE_FENCE_SWAPGS_KERNEL);\n\t\t}\n\t}\n\n\tpr_info(\"%s\\n\", spectre_v1_strings[spectre_v1_mitigation]);\n}",
  15444. "project": "linux",
  15445. "hash": 168535794606349637416505184367991382173,
  15446. "size": 47,
  15447. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15448. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15449. "target": 0,
  15450. "dataset": "other",
  15451. "idx": 338786
  15452. },
  15453. {
  15454. "func": "static void __init mds_select_mitigation(void)\n{\n\tif (!boot_cpu_has_bug(X86_BUG_MDS) || cpu_mitigations_off()) {\n\t\tmds_mitigation = MDS_MITIGATION_OFF;\n\t\treturn;\n\t}\n\n\tif (mds_mitigation == MDS_MITIGATION_FULL) {\n\t\tif (!boot_cpu_has(X86_FEATURE_MD_CLEAR))\n\t\t\tmds_mitigation = MDS_MITIGATION_VMWERV;\n\n\t\tstatic_branch_enable(&mds_user_clear);\n\n\t\tif (!boot_cpu_has(X86_BUG_MSBDS_ONLY) &&\n\t\t (mds_nosmt || cpu_mitigations_auto_nosmt()))\n\t\t\tcpu_smt_disable(false);\n\t}\n}",
  15455. "project": "linux",
  15456. "hash": 212321058658908919627083140446984070305,
  15457. "size": 18,
  15458. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15459. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15460. "target": 0,
  15461. "dataset": "other",
  15462. "idx": 338799
  15463. }
  15464. ]
  15465. },
  15466. {
  15467. "call_depth": 3,
  15468. "longest_call_chain": [
  15469. "dccp_init",
  15470. "dccp_mib_init",
  15471. "snmp_mib_init"
  15472. ],
  15473. "group_size": 6,
  15474. "functions": [
  15475. {
  15476. "func": "static void __exit dccp_fini(void)\n{\n\tdccp_mib_exit();\n\tfree_pages((unsigned long)dccp_hashinfo.bhash,\n\t\t get_order(dccp_hashinfo.bhash_size *\n\t\t\t sizeof(struct inet_bind_hashbucket)));\n\tfree_pages((unsigned long)dccp_hashinfo.ehash,\n\t\t get_order(dccp_hashinfo.ehash_size *\n\t\t\t sizeof(struct inet_ehash_bucket)));\n\tinet_ehash_locks_free(&dccp_hashinfo);\n\tkmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);\n\tdccp_ackvec_exit();\n\tdccp_sysctl_exit();\n}",
  15477. "target": 0,
  15478. "cwe": [
  15479. "CWE-189"
  15480. ],
  15481. "project": "linux-2.6",
  15482. "commit_id": "3e8a0a559c66ee9e7468195691a56fefc3589740",
  15483. "hash": 190055893379003472168334972294472966259,
  15484. "size": 14,
  15485. "message": "dccp: change L/R must have at least one byte in the dccpsf_val field\n \nThanks to Eugene Teo for reporting this problem.\n \nSigned-off-by: Eugene Teo <eugenete@kernel.sg>\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nSigned-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15486. "dataset": "other",
  15487. "idx": 488796
  15488. },
  15489. {
  15490. "func": "static inline int dccp_mib_init(void)\n{\n\treturn snmp_mib_init((void**)dccp_statistics, sizeof(struct dccp_mib));\n}",
  15491. "target": 0,
  15492. "cwe": [
  15493. "CWE-189"
  15494. ],
  15495. "project": "linux-2.6",
  15496. "commit_id": "3e8a0a559c66ee9e7468195691a56fefc3589740",
  15497. "hash": 164086936351459293495267536318594293464,
  15498. "size": 4,
  15499. "message": "dccp: change L/R must have at least one byte in the dccpsf_val field\n \nThanks to Eugene Teo for reporting this problem.\n \nSigned-off-by: Eugene Teo <eugenete@kernel.sg>\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nSigned-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15500. "dataset": "other",
  15501. "idx": 488798
  15502. },
  15503. {
  15504. "func": "static int __init dccp_init(void)\n{\n\tunsigned long goal;\n\tint ehash_order, bhash_order, i;\n\tint rc = -ENOBUFS;\n\n\tBUILD_BUG_ON(sizeof(struct dccp_skb_cb) >\n\t\t FIELD_SIZEOF(struct sk_buff, cb));\n\n\tdccp_hashinfo.bind_bucket_cachep =\n\t\tkmem_cache_create(\"dccp_bind_bucket\",\n\t\t\t\t sizeof(struct inet_bind_bucket), 0,\n\t\t\t\t SLAB_HWCACHE_ALIGN, NULL);\n\tif (!dccp_hashinfo.bind_bucket_cachep)\n\t\tgoto out;\n\n\t/*\n\t * Size and allocate the main established and bind bucket\n\t * hash tables.\n\t *\n\t * The methodology is similar to that of the buffer cache.\n\t */\n\tif (num_physpages >= (128 * 1024))\n\t\tgoal = num_physpages >> (21 - PAGE_SHIFT);\n\telse\n\t\tgoal = num_physpages >> (23 - PAGE_SHIFT);\n\n\tif (thash_entries)\n\t\tgoal = (thash_entries *\n\t\t\tsizeof(struct inet_ehash_bucket)) >> PAGE_SHIFT;\n\tfor (ehash_order = 0; (1UL << ehash_order) < goal; ehash_order++)\n\t\t;\n\tdo {\n\t\tdccp_hashinfo.ehash_size = (1UL << ehash_order) * PAGE_SIZE /\n\t\t\t\t\tsizeof(struct inet_ehash_bucket);\n\t\twhile (dccp_hashinfo.ehash_size &\n\t\t (dccp_hashinfo.ehash_size - 1))\n\t\t\tdccp_hashinfo.ehash_size--;\n\t\tdccp_hashinfo.ehash = (struct inet_ehash_bucket *)\n\t\t\t__get_free_pages(GFP_ATOMIC, ehash_order);\n\t} while (!dccp_hashinfo.ehash && --ehash_order > 0);\n\n\tif (!dccp_hashinfo.ehash) {\n\t\tDCCP_CRIT(\"Failed to allocate DCCP established hash table\");\n\t\tgoto out_free_bind_bucket_cachep;\n\t}\n\n\tfor (i = 0; i < dccp_hashinfo.ehash_size; i++) {\n\t\tINIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].chain);\n\t\tINIT_HLIST_HEAD(&dccp_hashinfo.ehash[i].twchain);\n\t}\n\n\tif (inet_ehash_locks_alloc(&dccp_hashinfo))\n\t\t\tgoto out_free_dccp_ehash;\n\n\tbhash_order = ehash_order;\n\n\tdo {\n\t\tdccp_hashinfo.bhash_size = (1UL << bhash_order) * PAGE_SIZE /\n\t\t\t\t\tsizeof(struct inet_bind_hashbucket);\n\t\tif ((dccp_hashinfo.bhash_size > (64 * 1024)) &&\n\t\t bhash_order > 0)\n\t\t\tcontinue;\n\t\tdccp_hashinfo.bhash = (struct inet_bind_hashbucket *)\n\t\t\t__get_free_pages(GFP_ATOMIC, bhash_order);\n\t} while (!dccp_hashinfo.bhash && --bhash_order >= 0);\n\n\tif (!dccp_hashinfo.bhash) {\n\t\tDCCP_CRIT(\"Failed to allocate DCCP bind hash table\");\n\t\tgoto out_free_dccp_locks;\n\t}\n\n\tfor (i = 0; i < dccp_hashinfo.bhash_size; i++) {\n\t\tspin_lock_init(&dccp_hashinfo.bhash[i].lock);\n\t\tINIT_HLIST_HEAD(&dccp_hashinfo.bhash[i].chain);\n\t}\n\n\trc = dccp_mib_init();\n\tif (rc)\n\t\tgoto out_free_dccp_bhash;\n\n\trc = dccp_ackvec_init();\n\tif (rc)\n\t\tgoto out_free_dccp_mib;\n\n\trc = dccp_sysctl_init();\n\tif (rc)\n\t\tgoto out_ackvec_exit;\n\n\tdccp_timestamping_init();\nout:\n\treturn rc;\nout_ackvec_exit:\n\tdccp_ackvec_exit();\nout_free_dccp_mib:\n\tdccp_mib_exit();\nout_free_dccp_bhash:\n\tfree_pages((unsigned long)dccp_hashinfo.bhash, bhash_order);\n\tdccp_hashinfo.bhash = NULL;\nout_free_dccp_locks:\n\tinet_ehash_locks_free(&dccp_hashinfo);\nout_free_dccp_ehash:\n\tfree_pages((unsigned long)dccp_hashinfo.ehash, ehash_order);\n\tdccp_hashinfo.ehash = NULL;\nout_free_bind_bucket_cachep:\n\tkmem_cache_destroy(dccp_hashinfo.bind_bucket_cachep);\n\tdccp_hashinfo.bind_bucket_cachep = NULL;\n\tgoto out;\n}",
  15505. "target": 0,
  15506. "cwe": [
  15507. "CWE-189"
  15508. ],
  15509. "project": "linux-2.6",
  15510. "commit_id": "3e8a0a559c66ee9e7468195691a56fefc3589740",
  15511. "hash": 328252653652822182901531598760031729982,
  15512. "size": 109,
  15513. "message": "dccp: change L/R must have at least one byte in the dccpsf_val field\n \nThanks to Eugene Teo for reporting this problem.\n \nSigned-off-by: Eugene Teo <eugenete@kernel.sg>\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nSigned-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15514. "dataset": "other",
  15515. "idx": 488805
  15516. },
  15517. {
  15518. "func": "snmp_init()\n{\n snmp_mib_init();\n process_start(&snmp_process, NULL);\n}",
  15519. "project": "contiki-ng",
  15520. "hash": 302207721629871095598808499346739555224,
  15521. "size": 5,
  15522. "commit_id": "12c824386ab60de757de5001974d73b32e19ad71",
  15523. "message": "Refactored SNMP engine after vulnerabilities",
  15524. "target": 0,
  15525. "dataset": "other",
  15526. "idx": 224956
  15527. },
  15528. {
  15529. "func": "snmp_mib_init(void)\n{\n list_init(snmp_mib);\n}",
  15530. "project": "contiki-ng",
  15531. "hash": 199964273214820744309972483913192659544,
  15532. "size": 4,
  15533. "commit_id": "12c824386ab60de757de5001974d73b32e19ad71",
  15534. "message": "Refactored SNMP engine after vulnerabilities",
  15535. "target": 0,
  15536. "dataset": "other",
  15537. "idx": 224930
  15538. },
  15539. {
  15540. "func": "static inline void dccp_mib_exit(void)\n{\n\tsnmp_mib_free((void**)dccp_statistics);\n}",
  15541. "target": 0,
  15542. "cwe": [
  15543. "CWE-189"
  15544. ],
  15545. "project": "linux-2.6",
  15546. "commit_id": "3e8a0a559c66ee9e7468195691a56fefc3589740",
  15547. "hash": 25836332755363829221843816390968203489,
  15548. "size": 4,
  15549. "message": "dccp: change L/R must have at least one byte in the dccpsf_val field\n \nThanks to Eugene Teo for reporting this problem.\n \nSigned-off-by: Eugene Teo <eugenete@kernel.sg>\nSigned-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>\nSigned-off-by: Gerrit Renker <gerrit@erg.abdn.ac.uk>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15550. "dataset": "other",
  15551. "idx": 488802
  15552. }
  15553. ]
  15554. },
  15555. {
  15556. "call_depth": 3,
  15557. "longest_call_chain": [
  15558. "cpu_show_itlb_multihit",
  15559. "cpu_show_common",
  15560. "itlb_multihit_show_state"
  15561. ],
  15562. "group_size": 7,
  15563. "functions": [
  15564. {
  15565. "func": "static ssize_t tsx_async_abort_show_state(char *buf)\n{\n\tif ((taa_mitigation == TAA_MITIGATION_TSX_DISABLED) ||\n\t (taa_mitigation == TAA_MITIGATION_OFF))\n\t\treturn sprintf(buf, \"%s\\n\", taa_strings[taa_mitigation]);\n\n\tif (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {\n\t\treturn sprintf(buf, \"%s; SMT Host state unknown\\n\",\n\t\t\t taa_strings[taa_mitigation]);\n\t}\n\n\treturn sprintf(buf, \"%s; SMT %s\\n\", taa_strings[taa_mitigation],\n\t\t sched_smt_active() ? \"vulnerable\" : \"disabled\");\n}",
  15566. "project": "linux",
  15567. "hash": 104708513657214179616846996395406457780,
  15568. "size": 14,
  15569. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15570. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15571. "target": 0,
  15572. "dataset": "other",
  15573. "idx": 338785
  15574. },
  15575. {
  15576. "func": "ssize_t cpu_show_tsx_async_abort(struct device *dev, struct device_attribute *attr, char *buf)\n{\n\treturn cpu_show_common(dev, attr, buf, X86_BUG_TAA);\n}",
  15577. "project": "linux",
  15578. "hash": 236998040862335715449383732030417267316,
  15579. "size": 4,
  15580. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15581. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15582. "target": 0,
  15583. "dataset": "other",
  15584. "idx": 338791
  15585. },
  15586. {
  15587. "func": "static ssize_t cpu_show_common(struct device *dev, struct device_attribute *attr,\n\t\t\t char *buf, unsigned int bug)\n{\n\tif (!boot_cpu_has_bug(bug))\n\t\treturn sprintf(buf, \"Not affected\\n\");\n\n\tswitch (bug) {\n\tcase X86_BUG_CPU_MELTDOWN:\n\t\tif (boot_cpu_has(X86_FEATURE_PTI))\n\t\t\treturn sprintf(buf, \"Mitigation: PTI\\n\");\n\n\t\tif (hypervisor_is_type(X86_HYPER_XEN_PV))\n\t\t\treturn sprintf(buf, \"Unknown (XEN PV detected, hypervisor mitigation required)\\n\");\n\n\t\tbreak;\n\n\tcase X86_BUG_SPECTRE_V1:\n\t\treturn sprintf(buf, \"%s\\n\", spectre_v1_strings[spectre_v1_mitigation]);\n\n\tcase X86_BUG_SPECTRE_V2:\n\t\treturn sprintf(buf, \"%s%s%s%s%s%s\\n\", spectre_v2_strings[spectre_v2_enabled],\n\t\t\t ibpb_state(),\n\t\t\t boot_cpu_has(X86_FEATURE_USE_IBRS_FW) ? \", IBRS_FW\" : \"\",\n\t\t\t stibp_state(),\n\t\t\t boot_cpu_has(X86_FEATURE_RSB_CTXSW) ? \", RSB filling\" : \"\",\n\t\t\t spectre_v2_module_string());\n\n\tcase X86_BUG_SPEC_STORE_BYPASS:\n\t\treturn sprintf(buf, \"%s\\n\", ssb_strings[ssb_mode]);\n\n\tcase X86_BUG_L1TF:\n\t\tif (boot_cpu_has(X86_FEATURE_L1TF_PTEINV))\n\t\t\treturn l1tf_show_state(buf);\n\t\tbreak;\n\n\tcase X86_BUG_MDS:\n\t\treturn mds_show_state(buf);\n\n\tcase X86_BUG_TAA:\n\t\treturn tsx_async_abort_show_state(buf);\n\n\tcase X86_BUG_ITLB_MULTIHIT:\n\t\treturn itlb_multihit_show_state(buf);\n\n\tdefault:\n\t\tbreak;\n\t}\n\n\treturn sprintf(buf, \"Vulnerable\\n\");\n}",
  15588. "project": "linux",
  15589. "hash": 95682371023483428363749884475800348152,
  15590. "size": 50,
  15591. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15592. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15593. "target": 0,
  15594. "dataset": "other",
  15595. "idx": 338798
  15596. },
  15597. {
  15598. "func": "ssize_t cpu_show_itlb_multihit(struct device *dev, struct device_attribute *attr, char *buf)\n{\n\treturn cpu_show_common(dev, attr, buf, X86_BUG_ITLB_MULTIHIT);\n}",
  15599. "project": "linux",
  15600. "hash": 4530321038342188693603711881396914185,
  15601. "size": 4,
  15602. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15603. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15604. "target": 0,
  15605. "dataset": "other",
  15606. "idx": 338788
  15607. },
  15608. {
  15609. "func": "static ssize_t mds_show_state(char *buf)\n{\n\tif (boot_cpu_has(X86_FEATURE_HYPERVISOR)) {\n\t\treturn sprintf(buf, \"%s; SMT Host state unknown\\n\",\n\t\t\t mds_strings[mds_mitigation]);\n\t}\n\n\tif (boot_cpu_has(X86_BUG_MSBDS_ONLY)) {\n\t\treturn sprintf(buf, \"%s; SMT %s\\n\", mds_strings[mds_mitigation],\n\t\t\t (mds_mitigation == MDS_MITIGATION_OFF ? \"vulnerable\" :\n\t\t\t sched_smt_active() ? \"mitigated\" : \"disabled\"));\n\t}\n\n\treturn sprintf(buf, \"%s; SMT %s\\n\", mds_strings[mds_mitigation],\n\t\t sched_smt_active() ? \"vulnerable\" : \"disabled\");\n}",
  15610. "project": "linux",
  15611. "hash": 195159808629626755671724994198411283574,
  15612. "size": 16,
  15613. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15614. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15615. "target": 0,
  15616. "dataset": "other",
  15617. "idx": 338797
  15618. },
  15619. {
  15620. "func": "static ssize_t itlb_multihit_show_state(char *buf)\n{\n\tif (itlb_multihit_kvm_mitigation)\n\t\treturn sprintf(buf, \"KVM: Mitigation: Split huge pages\\n\");\n\telse\n\t\treturn sprintf(buf, \"KVM: Vulnerable\\n\");\n}",
  15621. "project": "linux",
  15622. "hash": 247261437386362177109715730807061065997,
  15623. "size": 7,
  15624. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15625. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15626. "target": 0,
  15627. "dataset": "other",
  15628. "idx": 338784
  15629. },
  15630. {
  15631. "func": "static ssize_t itlb_multihit_show_state(char *buf)\n{\n\treturn sprintf(buf, \"Processor vulnerable\\n\");\n}",
  15632. "project": "linux",
  15633. "hash": 38382346743495850530974314169520436007,
  15634. "size": 4,
  15635. "commit_id": "4d8df8cbb9156b0a0ab3f802b80cb5db57acc0bf",
  15636. "message": "x86/speculation: PR_SPEC_FORCE_DISABLE enforcement for indirect branches.\n\nCurrently, it is possible to enable indirect branch speculation even after\nit was force-disabled using the PR_SPEC_FORCE_DISABLE option. Moreover, the\nPR_GET_SPECULATION_CTRL command gives afterwards an incorrect result\n(force-disabled when it is in fact enabled). This also is inconsistent\nvs. STIBP and the documention which cleary states that\nPR_SPEC_FORCE_DISABLE cannot be undone.\n\nFix this by actually enforcing force-disabled indirect branch\nspeculation. PR_SPEC_ENABLE called after PR_SPEC_FORCE_DISABLE now fails\nwith -EPERM as described in the documentation.\n\nFixes: 9137bb27e60e (\"x86/speculation: Add prctl() control for indirect branch speculation\")\nSigned-off-by: Anthony Steinhauser <asteinhauser@google.com>\nSigned-off-by: Thomas Gleixner <tglx@linutronix.de>\nCc: stable@vger.kernel.org",
  15637. "target": 0,
  15638. "dataset": "other",
  15639. "idx": 338796
  15640. }
  15641. ]
  15642. },
  15643. {
  15644. "call_depth": 3,
  15645. "longest_call_chain": [
  15646. "recv_files",
  15647. "discard_receive_data",
  15648. "receive_data"
  15649. ],
  15650. "group_size": 3,
  15651. "functions": [
  15652. {
  15653. "func": "static void discard_receive_data(int f_in, OFF_T length)\n{\n\treceive_data(f_in, NULL, -1, 0, NULL, -1, length);\n}",
  15654. "project": "rsync",
  15655. "hash": 114352644162312922294073732524964751395,
  15656. "size": 4,
  15657. "commit_id": "5509597decdbd7b91994210f700329d8a35e70a1",
  15658. "message": "Check daemon filter against fnamecmp in recv_files().",
  15659. "target": 0,
  15660. "dataset": "other",
  15661. "idx": 331483
  15662. },
  15663. {
  15664. "func": "static int receive_data(int f_in, char *fname_r, int fd_r, OFF_T size_r,\n\t\t\tconst char *fname, int fd, OFF_T total_size)\n{\n\tstatic char file_sum1[MAX_DIGEST_LEN];\n\tstruct map_struct *mapbuf;\n\tstruct sum_struct sum;\n\tint sum_len;\n\tint32 len;\n\tOFF_T offset = 0;\n\tOFF_T offset2;\n\tchar *data;\n\tint32 i;\n\tchar *map = NULL;\n\n#ifdef SUPPORT_PREALLOCATION\n\tif (preallocate_files && fd != -1 && total_size > 0 && (!inplace || total_size > size_r)) {\n\t\t/* Try to preallocate enough space for file's eventual length. Can\n\t\t * reduce fragmentation on filesystems like ext4, xfs, and NTFS. */\n\t\tif ((preallocated_len = do_fallocate(fd, 0, total_size)) < 0)\n\t\t\trsyserr(FWARNING, errno, \"do_fallocate %s\", full_fname(fname));\n\t} else\n#endif\n\tif (inplace) {\n#ifdef HAVE_FTRUNCATE\n\t\t/* The most compatible way to create a sparse file is to start with no length. */\n\t\tif (sparse_files > 0 && whole_file && fd >= 0 && do_ftruncate(fd, 0) == 0)\n\t\t\tpreallocated_len = 0;\n\t\telse\n#endif\n\t\t\tpreallocated_len = size_r;\n\t} else\n\t\tpreallocated_len = 0;\n\n\tread_sum_head(f_in, &sum);\n\n\tif (fd_r >= 0 && size_r > 0) {\n\t\tint32 read_size = MAX(sum.blength * 2, 16*1024);\n\t\tmapbuf = map_file(fd_r, size_r, read_size, sum.blength);\n\t\tif (DEBUG_GTE(DELTASUM, 2)) {\n\t\t\trprintf(FINFO, \"recv mapped %s of size %s\\n\",\n\t\t\t\tfname_r, big_num(size_r));\n\t\t}\n\t} else\n\t\tmapbuf = NULL;\n\n\tsum_init(xfersum_type, checksum_seed);\n\n\tif (append_mode > 0) {\n\t\tOFF_T j;\n\t\tsum.flength = (OFF_T)sum.count * sum.blength;\n\t\tif (sum.remainder)\n\t\t\tsum.flength -= sum.blength - sum.remainder;\n\t\tif (append_mode == 2 && mapbuf) {\n\t\t\tfor (j = CHUNK_SIZE; j < sum.flength; j += CHUNK_SIZE) {\n\t\t\t\tif (INFO_GTE(PROGRESS, 1))\n\t\t\t\t\tshow_progress(offset, total_size);\n\t\t\t\tsum_update(map_ptr(mapbuf, offset, CHUNK_SIZE),\n\t\t\t\t\t CHUNK_SIZE);\n\t\t\t\toffset = j;\n\t\t\t}\n\t\t\tif (offset < sum.flength) {\n\t\t\t\tint32 len = (int32)(sum.flength - offset);\n\t\t\t\tif (INFO_GTE(PROGRESS, 1))\n\t\t\t\t\tshow_progress(offset, total_size);\n\t\t\t\tsum_update(map_ptr(mapbuf, offset, len), len);\n\t\t\t}\n\t\t}\n\t\toffset = sum.flength;\n\t\tif (fd != -1 && (j = do_lseek(fd, offset, SEEK_SET)) != offset) {\n\t\t\trsyserr(FERROR_XFER, errno, \"lseek of %s returned %s, not %s\",\n\t\t\t\tfull_fname(fname), big_num(j), big_num(offset));\n\t\t\texit_cleanup(RERR_FILEIO);\n\t\t}\n\t}\n\n\twhile ((i = recv_token(f_in, &data)) != 0) {\n\t\tif (INFO_GTE(PROGRESS, 1))\n\t\t\tshow_progress(offset, total_size);\n\n\t\tif (allowed_lull)\n\t\t\tmaybe_send_keepalive(time(NULL), MSK_ALLOW_FLUSH | MSK_ACTIVE_RECEIVER);\n\n\t\tif (i > 0) {\n\t\t\tif (DEBUG_GTE(DELTASUM, 3)) {\n\t\t\t\trprintf(FINFO,\"data recv %d at %s\\n\",\n\t\t\t\t\ti, big_num(offset));\n\t\t\t}\n\n\t\t\tstats.literal_data += i;\n\t\t\tcleanup_got_literal = 1;\n\n\t\t\tsum_update(data, i);\n\n\t\t\tif (fd != -1 && write_file(fd, 0, offset, data, i) != i)\n\t\t\t\tgoto report_write_error;\n\t\t\toffset += i;\n\t\t\tcontinue;\n\t\t}\n\n\t\ti = -(i+1);\n\t\toffset2 = i * (OFF_T)sum.blength;\n\t\tlen = sum.blength;\n\t\tif (i == (int)sum.count-1 && sum.remainder != 0)\n\t\t\tlen = sum.remainder;\n\n\t\tstats.matched_data += len;\n\n\t\tif (DEBUG_GTE(DELTASUM, 3)) {\n\t\t\trprintf(FINFO,\n\t\t\t\t\"chunk[%d] of size %ld at %s offset=%s%s\\n\",\n\t\t\t\ti, (long)len, big_num(offset2), big_num(offset),\n\t\t\t\tupdating_basis_or_equiv && offset == offset2 ? \" (seek)\" : \"\");\n\t\t}\n\n\t\tif (mapbuf) {\n\t\t\tmap = map_ptr(mapbuf,offset2,len);\n\n\t\t\tsee_token(map, len);\n\t\t\tsum_update(map, len);\n\t\t}\n\n\t\tif (updating_basis_or_equiv) {\n\t\t\tif (offset == offset2 && fd != -1) {\n\t\t\t\tif (skip_matched(fd, offset, map, len) < 0)\n\t\t\t\t\tgoto report_write_error;\n\t\t\t\toffset += len;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\t\tif (fd != -1 && map && write_file(fd, 0, offset, map, len) != (int)len)\n\t\t\tgoto report_write_error;\n\t\toffset += len;\n\t}\n\n\tif (fd != -1 && offset > 0) {\n\t\tif (sparse_files > 0) {\n\t\t\tif (sparse_end(fd, offset) != 0)\n\t\t\t\tgoto report_write_error;\n\t\t} else if (flush_write_file(fd) < 0) {\n\t\t report_write_error:\n\t\t\trsyserr(FERROR_XFER, errno, \"write failed on %s\", full_fname(fname));\n\t\t\texit_cleanup(RERR_FILEIO);\n\t\t}\n\t}\n\n#ifdef HAVE_FTRUNCATE\n\t/* inplace: New data could be shorter than old data.\n\t * preallocate_files: total_size could have been an overestimate.\n\t * Cut off any extra preallocated zeros from dest file. */\n\tif ((inplace || preallocated_len > offset) && fd != -1 && do_ftruncate(fd, offset) < 0) {\n\t\trsyserr(FERROR_XFER, errno, \"ftruncate failed on %s\",\n\t\t\tfull_fname(fname));\n\t}\n#endif\n\n\tif (INFO_GTE(PROGRESS, 1))\n\t\tend_progress(total_size);\n\n\tsum_len = sum_end(file_sum1);\n\n\tif (mapbuf)\n\t\tunmap_file(mapbuf);\n\n\tread_buf(f_in, sender_file_sum, sum_len);\n\tif (DEBUG_GTE(DELTASUM, 2))\n\t\trprintf(FINFO,\"got file_sum\\n\");\n\tif (fd != -1 && memcmp(file_sum1, sender_file_sum, sum_len) != 0)\n\t\treturn 0;\n\treturn 1;\n}",
  15665. "project": "rsync",
  15666. "hash": 100059875466960767778580851539656074765,
  15667. "size": 170,
  15668. "commit_id": "5509597decdbd7b91994210f700329d8a35e70a1",
  15669. "message": "Check daemon filter against fnamecmp in recv_files().",
  15670. "target": 0,
  15671. "dataset": "other",
  15672. "idx": 331481
  15673. },
  15674. {
  15675. "func": "int recv_files(int f_in, int f_out, char *local_name)\n{\n\tint fd1,fd2;\n\tSTRUCT_STAT st;\n\tint iflags, xlen;\n\tchar *fname, fbuf[MAXPATHLEN];\n\tchar xname[MAXPATHLEN];\n\tchar fnametmp[MAXPATHLEN];\n\tchar *fnamecmp, *partialptr;\n\tchar fnamecmpbuf[MAXPATHLEN];\n\tuchar fnamecmp_type;\n\tstruct file_struct *file;\n\tint itemizing = am_server ? logfile_format_has_i : stdout_format_has_i;\n\tenum logcode log_code = log_before_transfer ? FLOG : FINFO;\n\tint max_phase = protocol_version >= 29 ? 2 : 1;\n\tint dflt_perms = (ACCESSPERMS & ~orig_umask);\n#ifdef SUPPORT_ACLS\n\tconst char *parent_dirname = \"\";\n#endif\n\tint ndx, recv_ok;\n\n\tif (DEBUG_GTE(RECV, 1))\n\t\trprintf(FINFO, \"recv_files(%d) starting\\n\", cur_flist->used);\n\n\tif (delay_updates)\n\t\tdelayed_bits = bitbag_create(cur_flist->used + 1);\n\n\twhile (1) {\n\t\tcleanup_disable();\n\n\t\t/* This call also sets cur_flist. */\n\t\tndx = read_ndx_and_attrs(f_in, f_out, &iflags, &fnamecmp_type,\n\t\t\t\t\t xname, &xlen);\n\t\tif (ndx == NDX_DONE) {\n\t\t\tif (!am_server && INFO_GTE(PROGRESS, 2) && cur_flist) {\n\t\t\t\tset_current_file_index(NULL, 0);\n\t\t\t\tend_progress(0);\n\t\t\t}\n\t\t\tif (inc_recurse && first_flist) {\n\t\t\t\tif (read_batch) {\n\t\t\t\t\tndx = first_flist->used + first_flist->ndx_start;\n\t\t\t\t\tgen_wants_ndx(ndx, first_flist->flist_num);\n\t\t\t\t}\n\t\t\t\tflist_free(first_flist);\n\t\t\t\tif (first_flist)\n\t\t\t\t\tcontinue;\n\t\t\t} else if (read_batch && first_flist) {\n\t\t\t\tndx = first_flist->used;\n\t\t\t\tgen_wants_ndx(ndx, first_flist->flist_num);\n\t\t\t}\n\t\t\tif (++phase > max_phase)\n\t\t\t\tbreak;\n\t\t\tif (DEBUG_GTE(RECV, 1))\n\t\t\t\trprintf(FINFO, \"recv_files phase=%d\\n\", phase);\n\t\t\tif (phase == 2 && delay_updates)\n\t\t\t\thandle_delayed_updates(local_name);\n\t\t\twrite_int(f_out, NDX_DONE);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (ndx - cur_flist->ndx_start >= 0)\n\t\t\tfile = cur_flist->files[ndx - cur_flist->ndx_start];\n\t\telse\n\t\t\tfile = dir_flist->files[cur_flist->parent_ndx];\n\t\tfname = local_name ? local_name : f_name(file, fbuf);\n\n\t\tif (daemon_filter_list.head\n\t\t && check_filter(&daemon_filter_list, FLOG, fname, 0) < 0) {\n\t\t\trprintf(FERROR, \"attempt to hack rsync failed.\\n\");\n\t\t\texit_cleanup(RERR_PROTOCOL);\n\t\t}\n\n\t\tif (DEBUG_GTE(RECV, 1))\n\t\t\trprintf(FINFO, \"recv_files(%s)\\n\", fname);\n\n#ifdef SUPPORT_XATTRS\n\t\tif (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers\n\t\t && !(want_xattr_optim && BITS_SET(iflags, ITEM_XNAME_FOLLOWS|ITEM_LOCAL_CHANGE)))\n\t\t\trecv_xattr_request(file, f_in);\n#endif\n\n\t\tif (!(iflags & ITEM_TRANSFER)) {\n\t\t\tmaybe_log_item(file, iflags, itemizing, xname);\n#ifdef SUPPORT_XATTRS\n\t\t\tif (preserve_xattrs && iflags & ITEM_REPORT_XATTR && do_xfers\n\t\t\t && !BITS_SET(iflags, ITEM_XNAME_FOLLOWS|ITEM_LOCAL_CHANGE))\n\t\t\t\tset_file_attrs(fname, file, NULL, fname, 0);\n#endif\n\t\t\tif (iflags & ITEM_IS_NEW) {\n\t\t\t\tstats.created_files++;\n\t\t\t\tif (S_ISREG(file->mode)) {\n\t\t\t\t\t/* Nothing further to count. */\n\t\t\t\t} else if (S_ISDIR(file->mode))\n\t\t\t\t\tstats.created_dirs++;\n#ifdef SUPPORT_LINKS\n\t\t\t\telse if (S_ISLNK(file->mode))\n\t\t\t\t\tstats.created_symlinks++;\n#endif\n\t\t\t\telse if (IS_DEVICE(file->mode))\n\t\t\t\t\tstats.created_devices++;\n\t\t\t\telse\n\t\t\t\t\tstats.created_specials++;\n\t\t\t}\n\t\t\tcontinue;\n\t\t}\n\t\tif (phase == 2) {\n\t\t\trprintf(FERROR,\n\t\t\t\t\"got transfer request in phase 2 [%s]\\n\",\n\t\t\t\twho_am_i());\n\t\t\texit_cleanup(RERR_PROTOCOL);\n\t\t}\n\n\t\tif (file->flags & FLAG_FILE_SENT) {\n\t\t\tif (csum_length == SHORT_SUM_LENGTH) {\n\t\t\t\tif (keep_partial && !partial_dir)\n\t\t\t\t\tmake_backups = -make_backups; /* prevents double backup */\n\t\t\t\tif (append_mode)\n\t\t\t\t\tsparse_files = -sparse_files;\n\t\t\t\tappend_mode = -append_mode;\n\t\t\t\tcsum_length = SUM_LENGTH;\n\t\t\t\tredoing = 1;\n\t\t\t}\n\t\t} else {\n\t\t\tif (csum_length != SHORT_SUM_LENGTH) {\n\t\t\t\tif (keep_partial && !partial_dir)\n\t\t\t\t\tmake_backups = -make_backups;\n\t\t\t\tif (append_mode)\n\t\t\t\t\tsparse_files = -sparse_files;\n\t\t\t\tappend_mode = -append_mode;\n\t\t\t\tcsum_length = SHORT_SUM_LENGTH;\n\t\t\t\tredoing = 0;\n\t\t\t}\n\t\t\tif (iflags & ITEM_IS_NEW)\n\t\t\t\tstats.created_files++;\n\t\t}\n\n\t\tif (!am_server && INFO_GTE(PROGRESS, 1))\n\t\t\tset_current_file_index(file, ndx);\n\t\tstats.xferred_files++;\n\t\tstats.total_transferred_size += F_LENGTH(file);\n\n\t\tcleanup_got_literal = 0;\n\n\t\tif (read_batch) {\n\t\t\tint wanted = redoing\n\t\t\t\t ? we_want_redo(ndx)\n\t\t\t\t : gen_wants_ndx(ndx, cur_flist->flist_num);\n\t\t\tif (!wanted) {\n\t\t\t\trprintf(FINFO,\n\t\t\t\t\t\"(Skipping batched update for%s \\\"%s\\\")\\n\",\n\t\t\t\t\tredoing ? \" resend of\" : \"\",\n\t\t\t\t\tfname);\n\t\t\t\tdiscard_receive_data(f_in, F_LENGTH(file));\n\t\t\t\tfile->flags |= FLAG_FILE_SENT;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t}\n\n\t\tremember_initial_stats();\n\n\t\tif (!do_xfers) { /* log the transfer */\n\t\t\tlog_item(FCLIENT, file, iflags, NULL);\n\t\t\tif (read_batch)\n\t\t\t\tdiscard_receive_data(f_in, F_LENGTH(file));\n\t\t\tcontinue;\n\t\t}\n\t\tif (write_batch < 0) {\n\t\t\tlog_item(FCLIENT, file, iflags, NULL);\n\t\t\tif (!am_server)\n\t\t\t\tdiscard_receive_data(f_in, F_LENGTH(file));\n\t\t\tif (inc_recurse)\n\t\t\t\tsend_msg_int(MSG_SUCCESS, ndx);\n\t\t\tcontinue;\n\t\t}\n\n\t\tpartialptr = partial_dir ? partial_dir_fname(fname) : fname;\n\n\t\tif (protocol_version >= 29) {\n\t\t\tswitch (fnamecmp_type) {\n\t\t\tcase FNAMECMP_FNAME:\n\t\t\t\tfnamecmp = fname;\n\t\t\t\tbreak;\n\t\t\tcase FNAMECMP_PARTIAL_DIR:\n\t\t\t\tfnamecmp = partialptr;\n\t\t\t\tbreak;\n\t\t\tcase FNAMECMP_BACKUP:\n\t\t\t\tfnamecmp = get_backup_name(fname);\n\t\t\t\tbreak;\n\t\t\tcase FNAMECMP_FUZZY:\n\t\t\t\tif (file->dirname) {\n\t\t\t\t\tpathjoin(fnamecmpbuf, sizeof fnamecmpbuf, file->dirname, xname);\n\t\t\t\t\tfnamecmp = fnamecmpbuf;\n\t\t\t\t} else\n\t\t\t\t\tfnamecmp = xname;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tif (fnamecmp_type > FNAMECMP_FUZZY && fnamecmp_type-FNAMECMP_FUZZY <= basis_dir_cnt) {\n\t\t\t\t\tfnamecmp_type -= FNAMECMP_FUZZY + 1;\n\t\t\t\t\tif (file->dirname) {\n\t\t\t\t\t\tstringjoin(fnamecmpbuf, sizeof fnamecmpbuf,\n\t\t\t\t\t\t\t basis_dir[fnamecmp_type], \"/\", file->dirname, \"/\", xname, NULL);\n\t\t\t\t\t} else\n\t\t\t\t\t\tpathjoin(fnamecmpbuf, sizeof fnamecmpbuf, basis_dir[fnamecmp_type], xname);\n\t\t\t\t} else if (fnamecmp_type >= basis_dir_cnt) {\n\t\t\t\t\trprintf(FERROR,\n\t\t\t\t\t\t\"invalid basis_dir index: %d.\\n\",\n\t\t\t\t\t\tfnamecmp_type);\n\t\t\t\t\texit_cleanup(RERR_PROTOCOL);\n\t\t\t\t} else\n\t\t\t\t\tpathjoin(fnamecmpbuf, sizeof fnamecmpbuf, basis_dir[fnamecmp_type], fname);\n\t\t\t\tfnamecmp = fnamecmpbuf;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif (!fnamecmp || (daemon_filter_list.head\n\t\t\t && check_filter(&daemon_filter_list, FLOG, fnamecmp, 0) < 0)) {\n\t\t\t\tfnamecmp = fname;\n\t\t\t\tfnamecmp_type = FNAMECMP_FNAME;\n\t\t\t}\n\t\t} else {\n\t\t\t/* Reminder: --inplace && --partial-dir are never\n\t\t\t * enabled at the same time. */\n\t\t\tif (inplace && make_backups > 0) {\n\t\t\t\tif (!(fnamecmp = get_backup_name(fname)))\n\t\t\t\t\tfnamecmp = fname;\n\t\t\t\telse\n\t\t\t\t\tfnamecmp_type = FNAMECMP_BACKUP;\n\t\t\t} else if (partial_dir && partialptr)\n\t\t\t\tfnamecmp = partialptr;\n\t\t\telse\n\t\t\t\tfnamecmp = fname;\n\t\t}\n\n\t\t/* open the file */\n\t\tfd1 = do_open(fnamecmp, O_RDONLY, 0);\n\n\t\tif (fd1 == -1 && protocol_version < 29) {\n\t\t\tif (fnamecmp != fname) {\n\t\t\t\tfnamecmp = fname;\n\t\t\t\tfd1 = do_open(fnamecmp, O_RDONLY, 0);\n\t\t\t}\n\n\t\t\tif (fd1 == -1 && basis_dir[0]) {\n\t\t\t\t/* pre-29 allowed only one alternate basis */\n\t\t\t\tpathjoin(fnamecmpbuf, sizeof fnamecmpbuf,\n\t\t\t\t\t basis_dir[0], fname);\n\t\t\t\tfnamecmp = fnamecmpbuf;\n\t\t\t\tfd1 = do_open(fnamecmp, O_RDONLY, 0);\n\t\t\t}\n\t\t}\n\n\t\tupdating_basis_or_equiv = inplace\n\t\t && (fnamecmp == fname || fnamecmp_type == FNAMECMP_BACKUP);\n\n\t\tif (fd1 == -1) {\n\t\t\tst.st_mode = 0;\n\t\t\tst.st_size = 0;\n\t\t} else if (do_fstat(fd1,&st) != 0) {\n\t\t\trsyserr(FERROR_XFER, errno, \"fstat %s failed\",\n\t\t\t\tfull_fname(fnamecmp));\n\t\t\tdiscard_receive_data(f_in, F_LENGTH(file));\n\t\t\tclose(fd1);\n\t\t\tif (inc_recurse)\n\t\t\t\tsend_msg_int(MSG_NO_SEND, ndx);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (fd1 != -1 && S_ISDIR(st.st_mode) && fnamecmp == fname) {\n\t\t\t/* this special handling for directories\n\t\t\t * wouldn't be necessary if robust_rename()\n\t\t\t * and the underlying robust_unlink could cope\n\t\t\t * with directories\n\t\t\t */\n\t\t\trprintf(FERROR_XFER, \"recv_files: %s is a directory\\n\",\n\t\t\t\tfull_fname(fnamecmp));\n\t\t\tdiscard_receive_data(f_in, F_LENGTH(file));\n\t\t\tclose(fd1);\n\t\t\tif (inc_recurse)\n\t\t\t\tsend_msg_int(MSG_NO_SEND, ndx);\n\t\t\tcontinue;\n\t\t}\n\n\t\tif (fd1 != -1 && !S_ISREG(st.st_mode)) {\n\t\t\tclose(fd1);\n\t\t\tfd1 = -1;\n\t\t}\n\n\t\t/* If we're not preserving permissions, change the file-list's\n\t\t * mode based on the local permissions and some heuristics. */\n\t\tif (!preserve_perms) {\n\t\t\tint exists = fd1 != -1;\n#ifdef SUPPORT_ACLS\n\t\t\tconst char *dn = file->dirname ? file->dirname : \".\";\n\t\t\tif (parent_dirname != dn\n\t\t\t && strcmp(parent_dirname, dn) != 0) {\n\t\t\t\tdflt_perms = default_perms_for_dir(dn);\n\t\t\t\tparent_dirname = dn;\n\t\t\t}\n#endif\n\t\t\tfile->mode = dest_mode(file->mode, st.st_mode,\n\t\t\t\t\t dflt_perms, exists);\n\t\t}\n\n\t\t/* We now check to see if we are writing the file \"inplace\" */\n\t\tif (inplace) {\n\t\t\tfd2 = do_open(fname, O_WRONLY|O_CREAT, 0600);\n\t\t\tif (fd2 == -1) {\n\t\t\t\trsyserr(FERROR_XFER, errno, \"open %s failed\",\n\t\t\t\t\tfull_fname(fname));\n\t\t\t} else if (updating_basis_or_equiv)\n\t\t\t\tcleanup_set(NULL, NULL, file, fd1, fd2);\n\t\t} else {\n\t\t\tfd2 = open_tmpfile(fnametmp, fname, file);\n\t\t\tif (fd2 != -1)\n\t\t\t\tcleanup_set(fnametmp, partialptr, file, fd1, fd2);\n\t\t}\n\n\t\tif (fd2 == -1) {\n\t\t\tdiscard_receive_data(f_in, F_LENGTH(file));\n\t\t\tif (fd1 != -1)\n\t\t\t\tclose(fd1);\n\t\t\tif (inc_recurse)\n\t\t\t\tsend_msg_int(MSG_NO_SEND, ndx);\n\t\t\tcontinue;\n\t\t}\n\n\t\t/* log the transfer */\n\t\tif (log_before_transfer)\n\t\t\tlog_item(FCLIENT, file, iflags, NULL);\n\t\telse if (!am_server && INFO_GTE(NAME, 1) && INFO_EQ(PROGRESS, 1))\n\t\t\trprintf(FINFO, \"%s\\n\", fname);\n\n\t\t/* recv file data */\n\t\trecv_ok = receive_data(f_in, fnamecmp, fd1, st.st_size,\n\t\t\t\t fname, fd2, F_LENGTH(file));\n\n\t\tlog_item(log_code, file, iflags, NULL);\n\n\t\tif (fd1 != -1)\n\t\t\tclose(fd1);\n\t\tif (close(fd2) < 0) {\n\t\t\trsyserr(FERROR, errno, \"close failed on %s\",\n\t\t\t\tfull_fname(fnametmp));\n\t\t\texit_cleanup(RERR_FILEIO);\n\t\t}\n\n\t\tif ((recv_ok && (!delay_updates || !partialptr)) || inplace) {\n\t\t\tif (partialptr == fname)\n\t\t\t\tpartialptr = NULL;\n\t\t\tif (!finish_transfer(fname, fnametmp, fnamecmp,\n\t\t\t\t\t partialptr, file, recv_ok, 1))\n\t\t\t\trecv_ok = -1;\n\t\t\telse if (fnamecmp == partialptr) {\n\t\t\t\tdo_unlink(partialptr);\n\t\t\t\thandle_partial_dir(partialptr, PDIR_DELETE);\n\t\t\t}\n\t\t} else if (keep_partial && partialptr) {\n\t\t\tif (!handle_partial_dir(partialptr, PDIR_CREATE)) {\n\t\t\t\trprintf(FERROR,\n\t\t\t\t \"Unable to create partial-dir for %s -- discarding %s.\\n\",\n\t\t\t\t local_name ? local_name : f_name(file, NULL),\n\t\t\t\t recv_ok ? \"completed file\" : \"partial file\");\n\t\t\t\tdo_unlink(fnametmp);\n\t\t\t\trecv_ok = -1;\n\t\t\t} else if (!finish_transfer(partialptr, fnametmp, fnamecmp, NULL,\n\t\t\t\t\t\t file, recv_ok, !partial_dir))\n\t\t\t\trecv_ok = -1;\n\t\t\telse if (delay_updates && recv_ok) {\n\t\t\t\tbitbag_set_bit(delayed_bits, ndx);\n\t\t\t\trecv_ok = 2;\n\t\t\t} else\n\t\t\t\tpartialptr = NULL;\n\t\t} else\n\t\t\tdo_unlink(fnametmp);\n\n\t\tcleanup_disable();\n\n\t\tif (read_batch)\n\t\t\tfile->flags |= FLAG_FILE_SENT;\n\n\t\tswitch (recv_ok) {\n\t\tcase 2:\n\t\t\tbreak;\n\t\tcase 1:\n\t\t\tif (remove_source_files || inc_recurse\n\t\t\t || (preserve_hard_links && F_IS_HLINKED(file)))\n\t\t\t\tsend_msg_int(MSG_SUCCESS, ndx);\n\t\t\tbreak;\n\t\tcase 0: {\n\t\t\tenum logcode msgtype = redoing ? FERROR_XFER : FWARNING;\n\t\t\tif (msgtype == FERROR_XFER || INFO_GTE(NAME, 1)) {\n\t\t\t\tchar *errstr, *redostr, *keptstr;\n\t\t\t\tif (!(keep_partial && partialptr) && !inplace)\n\t\t\t\t\tkeptstr = \"discarded\";\n\t\t\t\telse if (partial_dir)\n\t\t\t\t\tkeptstr = \"put into partial-dir\";\n\t\t\t\telse\n\t\t\t\t\tkeptstr = \"retained\";\n\t\t\t\tif (msgtype == FERROR_XFER) {\n\t\t\t\t\terrstr = \"ERROR\";\n\t\t\t\t\tredostr = \"\";\n\t\t\t\t} else {\n\t\t\t\t\terrstr = \"WARNING\";\n\t\t\t\t\tredostr = read_batch ? \" (may try again)\"\n\t\t\t\t\t\t\t : \" (will try again)\";\n\t\t\t\t}\n\t\t\t\trprintf(msgtype,\n\t\t\t\t\t\"%s: %s failed verification -- update %s%s.\\n\",\n\t\t\t\t\terrstr, local_name ? f_name(file, NULL) : fname,\n\t\t\t\t\tkeptstr, redostr);\n\t\t\t}\n\t\t\tif (!redoing) {\n\t\t\t\tif (read_batch)\n\t\t\t\t\tflist_ndx_push(&batch_redo_list, ndx);\n\t\t\t\tsend_msg_int(MSG_REDO, ndx);\n\t\t\t\tfile->flags |= FLAG_FILE_SENT;\n\t\t\t} else if (inc_recurse)\n\t\t\t\tsend_msg_int(MSG_NO_SEND, ndx);\n\t\t\tbreak;\n\t\t }\n\t\tcase -1:\n\t\t\tif (inc_recurse)\n\t\t\t\tsend_msg_int(MSG_NO_SEND, ndx);\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (make_backups < 0)\n\t\tmake_backups = -make_backups;\n\n\tif (phase == 2 && delay_updates) /* for protocol_version < 29 */\n\t\thandle_delayed_updates(local_name);\n\n\tif (DEBUG_GTE(RECV, 1))\n\t\trprintf(FINFO,\"recv_files finished\\n\");\n\n\treturn 0;\n}",
  15676. "project": "rsync",
  15677. "hash": 244732624564333247167184328379269669359,
  15678. "size": 436,
  15679. "commit_id": "5509597decdbd7b91994210f700329d8a35e70a1",
  15680. "message": "Check daemon filter against fnamecmp in recv_files().",
  15681. "target": 0,
  15682. "dataset": "other",
  15683. "idx": 331482
  15684. }
  15685. ]
  15686. },
  15687. {
  15688. "call_depth": 3,
  15689. "longest_call_chain": [
  15690. "udp_poll",
  15691. "first_packet_length",
  15692. "udp_rmem_release"
  15693. ],
  15694. "group_size": 8,
  15695. "functions": [
  15696. {
  15697. "func": "int udp_ioctl(struct sock *sk, int cmd, unsigned long arg)\n{\n\tswitch (cmd) {\n\tcase SIOCOUTQ:\n\t{\n\t\tint amount = sk_wmem_alloc_get(sk);\n\n\t\treturn put_user(amount, (int __user *)arg);\n\t}\n\n\tcase SIOCINQ:\n\t{\n\t\tint amount = max_t(int, 0, first_packet_length(sk));\n\n\t\treturn put_user(amount, (int __user *)arg);\n\t}\n\n\tdefault:\n\t\treturn -ENOIOCTLCMD;\n\t}\n\n\treturn 0;\n}",
  15698. "project": "net",
  15699. "hash": 120962100401498763170457169314375584625,
  15700. "size": 23,
  15701. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15702. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15703. "target": 0,
  15704. "dataset": "other",
  15705. "idx": 468965
  15706. },
  15707. {
  15708. "func": "void udp_destruct_sock(struct sock *sk)\n{\n\t/* reclaim completely the forward allocated memory */\n\tstruct udp_sock *up = udp_sk(sk);\n\tunsigned int total = 0;\n\tstruct sk_buff *skb;\n\n\tskb_queue_splice_tail_init(&sk->sk_receive_queue, &up->reader_queue);\n\twhile ((skb = __skb_dequeue(&up->reader_queue)) != NULL) {\n\t\ttotal += skb->truesize;\n\t\tkfree_skb(skb);\n\t}\n\tudp_rmem_release(sk, total, 0, true);\n\n\tinet_sock_destruct(sk);\n}",
  15709. "project": "net",
  15710. "hash": 116880709217895828331023872406156009191,
  15711. "size": 16,
  15712. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15713. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15714. "target": 0,
  15715. "dataset": "other",
  15716. "idx": 468945
  15717. },
  15718. {
  15719. "func": "void udp_skb_destructor(struct sock *sk, struct sk_buff *skb)\n{\n\tprefetch(&skb->data);\n\tudp_rmem_release(sk, udp_skb_truesize(skb), 1, false);\n}",
  15720. "project": "net",
  15721. "hash": 199481324456231259283204727422534667667,
  15722. "size": 5,
  15723. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15724. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15725. "target": 0,
  15726. "dataset": "other",
  15727. "idx": 468964
  15728. },
  15729. {
  15730. "func": "static int udp_skb_truesize(struct sk_buff *skb)\n{\n\treturn udp_skb_scratch(skb)->_tsize_state & ~UDP_SKB_IS_STATELESS;\n}",
  15731. "project": "net",
  15732. "hash": 6159384903572035018144194830241980933,
  15733. "size": 4,
  15734. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15735. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15736. "target": 0,
  15737. "dataset": "other",
  15738. "idx": 469010
  15739. },
  15740. {
  15741. "func": "static void udp_rmem_release(struct sock *sk, int size, int partial,\n\t\t\t bool rx_queue_lock_held)\n{\n\tstruct udp_sock *up = udp_sk(sk);\n\tstruct sk_buff_head *sk_queue;\n\tint amt;\n\n\tif (likely(partial)) {\n\t\tup->forward_deficit += size;\n\t\tsize = up->forward_deficit;\n\t\tif (size < (sk->sk_rcvbuf >> 2) &&\n\t\t !skb_queue_empty(&up->reader_queue))\n\t\t\treturn;\n\t} else {\n\t\tsize += up->forward_deficit;\n\t}\n\tup->forward_deficit = 0;\n\n\t/* acquire the sk_receive_queue for fwd allocated memory scheduling,\n\t * if the called don't held it already\n\t */\n\tsk_queue = &sk->sk_receive_queue;\n\tif (!rx_queue_lock_held)\n\t\tspin_lock(&sk_queue->lock);\n\n\n\tsk->sk_forward_alloc += size;\n\tamt = (sk->sk_forward_alloc - partial) & ~(SK_MEM_QUANTUM - 1);\n\tsk->sk_forward_alloc -= amt;\n\n\tif (amt)\n\t\t__sk_mem_reduce_allocated(sk, amt >> SK_MEM_QUANTUM_SHIFT);\n\n\tatomic_sub(size, &sk->sk_rmem_alloc);\n\n\t/* this can save us from acquiring the rx queue lock on next receive */\n\tskb_queue_splice_tail_init(sk_queue, &up->reader_queue);\n\n\tif (!rx_queue_lock_held)\n\t\tspin_unlock(&sk_queue->lock);\n}",
  15742. "project": "net",
  15743. "hash": 105722958314149919733039418185314064127,
  15744. "size": 41,
  15745. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15746. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15747. "target": 0,
  15748. "dataset": "other",
  15749. "idx": 468975
  15750. },
  15751. {
  15752. "func": "static int first_packet_length(struct sock *sk)\n{\n\tstruct sk_buff_head *rcvq = &udp_sk(sk)->reader_queue;\n\tstruct sk_buff_head *sk_queue = &sk->sk_receive_queue;\n\tstruct sk_buff *skb;\n\tint total = 0;\n\tint res;\n\n\tspin_lock_bh(&rcvq->lock);\n\tskb = __first_packet_length(sk, rcvq, &total);\n\tif (!skb && !skb_queue_empty(sk_queue)) {\n\t\tspin_lock(&sk_queue->lock);\n\t\tskb_queue_splice_tail_init(sk_queue, rcvq);\n\t\tspin_unlock(&sk_queue->lock);\n\n\t\tskb = __first_packet_length(sk, rcvq, &total);\n\t}\n\tres = skb ? skb->len : -1;\n\tif (total)\n\t\tudp_rmem_release(sk, total, 1, false);\n\tspin_unlock_bh(&rcvq->lock);\n\treturn res;\n}",
  15753. "project": "net",
  15754. "hash": 322205601108753937201992705031139158101,
  15755. "size": 23,
  15756. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15757. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15758. "target": 0,
  15759. "dataset": "other",
  15760. "idx": 468962
  15761. },
  15762. {
  15763. "func": "static void udp_skb_dtor_locked(struct sock *sk, struct sk_buff *skb)\n{\n\tprefetch(&skb->data);\n\tudp_rmem_release(sk, udp_skb_truesize(skb), 1, true);\n}",
  15764. "project": "net",
  15765. "hash": 292787375836543840733900810221168422654,
  15766. "size": 5,
  15767. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15768. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15769. "target": 0,
  15770. "dataset": "other",
  15771. "idx": 468978
  15772. },
  15773. {
  15774. "func": "unsigned int udp_poll(struct file *file, struct socket *sock, poll_table *wait)\n{\n\tunsigned int mask = datagram_poll(file, sock, wait);\n\tstruct sock *sk = sock->sk;\n\n\tif (!skb_queue_empty(&udp_sk(sk)->reader_queue))\n\t\tmask |= POLLIN | POLLRDNORM;\n\n\tsock_rps_record_flow(sk);\n\n\t/* Check for false positives due to checksum errors */\n\tif ((mask & POLLRDNORM) && !(file->f_flags & O_NONBLOCK) &&\n\t !(sk->sk_shutdown & RCV_SHUTDOWN) && first_packet_length(sk) == -1)\n\t\tmask &= ~(POLLIN | POLLRDNORM);\n\n\treturn mask;\n\n}",
  15775. "project": "net",
  15776. "hash": 230401472447803839373376035104255326912,
  15777. "size": 18,
  15778. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  15779. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  15780. "target": 0,
  15781. "dataset": "other",
  15782. "idx": 469006
  15783. }
  15784. ]
  15785. },
  15786. {
  15787. "call_depth": 3,
  15788. "longest_call_chain": [
  15789. "_snapshotNameImpl",
  15790. "getHeuristicTypeName",
  15791. "getNameIfExists"
  15792. ],
  15793. "group_size": 3,
  15794. "functions": [
  15795. {
  15796. "func": "std::string JSObject::getHeuristicTypeName(GC *gc) {\n PointerBase *const base = gc->getPointerBase();\n if (auto constructorVal = tryGetNamedNoAlloc(\n this, base, Predefined::getSymbolID(Predefined::constructor))) {\n if (auto *constructor = dyn_vmcast<JSObject>(*constructorVal)) {\n auto name = constructor->getNameIfExists(base);\n // If the constructor's name doesn't exist, or it is just the object\n // constructor, attempt to find a different name.\n if (!name.empty() && name != \"Object\")\n return name;\n }\n }\n\n std::string name = getVT()->base.snapshotMetaData.defaultNameForNode(this);\n // A constructor's name was not found, check if the object is in dictionary\n // mode.\n if (getClass(base)->isDictionary()) {\n return name + \"(Dictionary)\";\n }\n\n // If it's not an Object, the CellKind is most likely good enough on its own\n if (getKind() != CellKind::ObjectKind) {\n return name;\n }\n\n // If the object isn't a dictionary, and it has only a few property names,\n // make the name based on those property names.\n std::vector<std::string> propertyNames;\n HiddenClass::forEachPropertyNoAlloc(\n getClass(base),\n base,\n [gc, &propertyNames](SymbolID id, NamedPropertyDescriptor) {\n if (InternalProperty::isInternal(id)) {\n // Internal properties aren't user-visible, skip them.\n return;\n }\n propertyNames.emplace_back(gc->convertSymbolToUTF8(id));\n });\n // NOTE: One option is to sort the property names before truncation, to\n // reduce the number of groups; however, by not sorting them it makes it\n // easier to spot sets of objects with the same properties but in different\n // orders, and thus find HiddenClass optimizations to make.\n\n // For objects with a lot of properties but aren't in dictionary mode yet,\n // keep the number displayed small.\n constexpr int kMaxPropertiesForTypeName = 5;\n bool truncated = false;\n if (propertyNames.size() > kMaxPropertiesForTypeName) {\n propertyNames.erase(\n propertyNames.begin() + kMaxPropertiesForTypeName, propertyNames.end());\n truncated = true;\n }\n // The final name should look like Object(a, b, c).\n if (propertyNames.empty()) {\n // Don't add parentheses for objects with no properties.\n return name;\n }\n name += \"(\";\n bool first = true;\n for (const auto &prop : propertyNames) {\n if (!first) {\n name += \", \";\n }\n first = false;\n name += prop;\n }\n if (truncated) {\n // No need to check for comma edge case because this only happens for\n // greater than one property.\n static_assert(\n kMaxPropertiesForTypeName >= 1,\n \"Property truncation should not happen for 0 properties\");\n name += \", ...\";\n }\n name += \")\";\n return name;\n}",
  15797. "project": "hermes",
  15798. "hash": 12586279669668606067802000336333479755,
  15799. "size": 77,
  15800. "commit_id": "fe52854cdf6725c2eaa9e125995da76e6ceb27da",
  15801. "message": "[CVE-2020-1911] Look up HostObject computed properties on the right object in the prototype chain.\n\nSummary:\nThe change in the hermes repository fixes the security vulnerability\nCVE-2020-1911. This vulnerability only affects applications which\nallow evaluation of uncontrolled, untrusted JavaScript code not\nshipped with the app, so React Native apps will generally not be affected.\n\nThis revision includes a test for the bug. The test is generic JSI\ncode, so it is included in the hermes and react-native repositories.\n\nChangelog: [Internal]\n\nReviewed By: tmikov\n\nDifferential Revision: D23322992\n\nfbshipit-source-id: 4e88c974afe1ad33a263f9cac03e9dc98d33649a",
  15802. "target": 0,
  15803. "dataset": "other",
  15804. "idx": 230263
  15805. },
  15806. {
  15807. "func": "std::string JSObject::getNameIfExists(PointerBase *base) {\n // Try \"displayName\" first, if it is defined.\n if (auto nameVal = tryGetNamedNoAlloc(\n this, base, Predefined::getSymbolID(Predefined::displayName))) {\n if (auto *name = dyn_vmcast<StringPrimitive>(*nameVal)) {\n return converter(name);\n }\n }\n // Next, use \"name\" if it is defined.\n if (auto nameVal = tryGetNamedNoAlloc(\n this, base, Predefined::getSymbolID(Predefined::name))) {\n if (auto *name = dyn_vmcast<StringPrimitive>(*nameVal)) {\n return converter(name);\n }\n }\n // There is no other way to access the \"name\" property on an object.\n return \"\";\n}",
  15808. "project": "hermes",
  15809. "hash": 234964102134813904610779888039415598461,
  15810. "size": 18,
  15811. "commit_id": "fe52854cdf6725c2eaa9e125995da76e6ceb27da",
  15812. "message": "[CVE-2020-1911] Look up HostObject computed properties on the right object in the prototype chain.\n\nSummary:\nThe change in the hermes repository fixes the security vulnerability\nCVE-2020-1911. This vulnerability only affects applications which\nallow evaluation of uncontrolled, untrusted JavaScript code not\nshipped with the app, so React Native apps will generally not be affected.\n\nThis revision includes a test for the bug. The test is generic JSI\ncode, so it is included in the hermes and react-native repositories.\n\nChangelog: [Internal]\n\nReviewed By: tmikov\n\nDifferential Revision: D23322992\n\nfbshipit-source-id: 4e88c974afe1ad33a263f9cac03e9dc98d33649a",
  15813. "target": 0,
  15814. "dataset": "other",
  15815. "idx": 230209
  15816. },
  15817. {
  15818. "func": "std::string JSObject::_snapshotNameImpl(GCCell *cell, GC *gc) {\n auto *const self = vmcast<JSObject>(cell);\n return self->getHeuristicTypeName(gc);\n}",
  15819. "project": "hermes",
  15820. "hash": 48077880543902754098911231243701628391,
  15821. "size": 4,
  15822. "commit_id": "fe52854cdf6725c2eaa9e125995da76e6ceb27da",
  15823. "message": "[CVE-2020-1911] Look up HostObject computed properties on the right object in the prototype chain.\n\nSummary:\nThe change in the hermes repository fixes the security vulnerability\nCVE-2020-1911. This vulnerability only affects applications which\nallow evaluation of uncontrolled, untrusted JavaScript code not\nshipped with the app, so React Native apps will generally not be affected.\n\nThis revision includes a test for the bug. The test is generic JSI\ncode, so it is included in the hermes and react-native repositories.\n\nChangelog: [Internal]\n\nReviewed By: tmikov\n\nDifferential Revision: D23322992\n\nfbshipit-source-id: 4e88c974afe1ad33a263f9cac03e9dc98d33649a",
  15824. "target": 0,
  15825. "dataset": "other",
  15826. "idx": 230239
  15827. }
  15828. ]
  15829. },
  15830. {
  15831. "call_depth": 4,
  15832. "longest_call_chain": [
  15833. "ctnetlink_nlmsg_size",
  15834. "ctnetlink_secctx_size",
  15835. "nla_total_size",
  15836. "ctnetlink_proto_size"
  15837. ],
  15838. "group_size": 7,
  15839. "functions": [
  15840. {
  15841. "func": "static size_t ctnetlink_nlmsg_size(const struct nf_conn *ct)\n{\n\treturn NLMSG_ALIGN(sizeof(struct nfgenmsg))\n\t + 3 * nla_total_size(0) /* CTA_TUPLE_ORIG|REPL|MASTER */\n\t + 3 * nla_total_size(0) /* CTA_TUPLE_IP */\n\t + 3 * nla_total_size(0) /* CTA_TUPLE_PROTO */\n\t + 3 * nla_total_size(sizeof(u_int8_t)) /* CTA_PROTO_NUM */\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_ID */\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_STATUS */\n\t + ctnetlink_acct_size(ct)\n\t + ctnetlink_timestamp_size(ct)\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_TIMEOUT */\n\t + nla_total_size(0) /* CTA_PROTOINFO */\n\t + nla_total_size(0) /* CTA_HELP */\n\t + nla_total_size(NF_CT_HELPER_NAME_LEN) /* CTA_HELP_NAME */\n\t + ctnetlink_secctx_size(ct)\n#if IS_ENABLED(CONFIG_NF_NAT)\n\t + 2 * nla_total_size(0) /* CTA_NAT_SEQ_ADJ_ORIG|REPL */\n\t + 6 * nla_total_size(sizeof(u_int32_t)) /* CTA_NAT_SEQ_OFFSET */\n#endif\n#ifdef CONFIG_NF_CONNTRACK_MARK\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */\n#endif\n#ifdef CONFIG_NF_CONNTRACK_ZONES\n\t + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE|CTA_TUPLE_ZONE */\n#endif\n\t + ctnetlink_proto_size(ct)\n\t + ctnetlink_label_size(ct)\n\t ;\n}",
  15842. "project": "linux",
  15843. "hash": 10508667409239925453713131944438936864,
  15844. "size": 30,
  15845. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  15846. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  15847. "target": 0,
  15848. "dataset": "other",
  15849. "idx": 394192
  15850. },
  15851. {
  15852. "func": "static inline int ctnetlink_secctx_size(const struct nf_conn *ct)\n{\n#ifdef CONFIG_NF_CONNTRACK_SECMARK\n\tint len, ret;\n\n\tret = security_secid_to_secctx(ct->secmark, NULL, &len);\n\tif (ret)\n\t\treturn 0;\n\n\treturn nla_total_size(0) /* CTA_SECCTX */\n\t + nla_total_size(sizeof(char) * len); /* CTA_SECCTX_NAME */\n#else\n\treturn 0;\n#endif\n}",
  15853. "project": "linux",
  15854. "hash": 120117122907379011975926738167909948965,
  15855. "size": 15,
  15856. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  15857. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  15858. "target": 0,
  15859. "dataset": "other",
  15860. "idx": 394256
  15861. },
  15862. {
  15863. "func": "static inline size_t ctnetlink_acct_size(const struct nf_conn *ct)\n{\n\tif (!nf_ct_ext_exist(ct, NF_CT_EXT_ACCT))\n\t\treturn 0;\n\treturn 2 * nla_total_size(0) /* CTA_COUNTERS_ORIG|REPL */\n\t + 2 * nla_total_size_64bit(sizeof(uint64_t)) /* CTA_COUNTERS_PACKETS */\n\t + 2 * nla_total_size_64bit(sizeof(uint64_t)) /* CTA_COUNTERS_BYTES */\n\t ;\n}",
  15864. "project": "linux",
  15865. "hash": 209742134164270150457682267534773323570,
  15866. "size": 9,
  15867. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  15868. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  15869. "target": 0,
  15870. "dataset": "other",
  15871. "idx": 394157
  15872. },
  15873. {
  15874. "func": "ctnetlink_glue_build_size(const struct nf_conn *ct)\n{\n\treturn 3 * nla_total_size(0) /* CTA_TUPLE_ORIG|REPL|MASTER */\n\t + 3 * nla_total_size(0) /* CTA_TUPLE_IP */\n\t + 3 * nla_total_size(0) /* CTA_TUPLE_PROTO */\n\t + 3 * nla_total_size(sizeof(u_int8_t)) /* CTA_PROTO_NUM */\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_ID */\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_STATUS */\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_TIMEOUT */\n\t + nla_total_size(0) /* CTA_PROTOINFO */\n\t + nla_total_size(0) /* CTA_HELP */\n\t + nla_total_size(NF_CT_HELPER_NAME_LEN) /* CTA_HELP_NAME */\n\t + ctnetlink_secctx_size(ct)\n#if IS_ENABLED(CONFIG_NF_NAT)\n\t + 2 * nla_total_size(0) /* CTA_NAT_SEQ_ADJ_ORIG|REPL */\n\t + 6 * nla_total_size(sizeof(u_int32_t)) /* CTA_NAT_SEQ_OFFSET */\n#endif\n#ifdef CONFIG_NF_CONNTRACK_MARK\n\t + nla_total_size(sizeof(u_int32_t)) /* CTA_MARK */\n#endif\n#ifdef CONFIG_NF_CONNTRACK_ZONES\n\t + nla_total_size(sizeof(u_int16_t)) /* CTA_ZONE|CTA_TUPLE_ZONE */\n#endif\n\t + ctnetlink_proto_size(ct)\n\t ;\n}",
  15875. "project": "linux",
  15876. "hash": 11624736612410175409698437205778309312,
  15877. "size": 26,
  15878. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  15879. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  15880. "target": 0,
  15881. "dataset": "other",
  15882. "idx": 394229
  15883. },
  15884. {
  15885. "func": "static inline int ctnetlink_label_size(const struct nf_conn *ct)\n{\n\tstruct nf_conn_labels *labels = nf_ct_labels_find(ct);\n\n\tif (!labels)\n\t\treturn 0;\n\treturn nla_total_size(sizeof(labels->bits));\n}",
  15886. "project": "linux",
  15887. "hash": 100893474637785996937883921194205667491,
  15888. "size": 8,
  15889. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  15890. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  15891. "target": 0,
  15892. "dataset": "other",
  15893. "idx": 394249
  15894. },
  15895. {
  15896. "func": "static size_t ctnetlink_proto_size(const struct nf_conn *ct)\n{\n\tconst struct nf_conntrack_l4proto *l4proto;\n\tsize_t len, len4 = 0;\n\n\tlen = nla_policy_len(cta_ip_nla_policy, CTA_IP_MAX + 1);\n\tlen *= 3u; /* ORIG, REPLY, MASTER */\n\n\tl4proto = nf_ct_l4proto_find(nf_ct_protonum(ct));\n\tlen += l4proto->nlattr_size;\n\tif (l4proto->nlattr_tuple_size) {\n\t\tlen4 = l4proto->nlattr_tuple_size();\n\t\tlen4 *= 3u; /* ORIG, REPLY, MASTER */\n\t}\n\n\treturn len + len4;\n}",
  15897. "project": "linux",
  15898. "hash": 147783029463433981062373150270326550127,
  15899. "size": 17,
  15900. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  15901. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  15902. "target": 0,
  15903. "dataset": "other",
  15904. "idx": 394196
  15905. },
  15906. {
  15907. "func": "static inline size_t ctnetlink_timestamp_size(const struct nf_conn *ct)\n{\n#ifdef CONFIG_NF_CONNTRACK_TIMESTAMP\n\tif (!nf_ct_ext_exist(ct, NF_CT_EXT_TSTAMP))\n\t\treturn 0;\n\treturn nla_total_size(0) + 2 * nla_total_size_64bit(sizeof(uint64_t));\n#else\n\treturn 0;\n#endif\n}",
  15908. "project": "linux",
  15909. "hash": 258757370984477944418178129779359369313,
  15910. "size": 10,
  15911. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  15912. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  15913. "target": 0,
  15914. "dataset": "other",
  15915. "idx": 394198
  15916. }
  15917. ]
  15918. },
  15919. {
  15920. "call_depth": 3,
  15921. "longest_call_chain": [
  15922. "SetResampleFilter",
  15923. "ScaleResampleFilter",
  15924. "ClampUpAxes"
  15925. ],
  15926. "group_size": 4,
  15927. "functions": [
  15928. {
  15929. "func": "MagickExport void SetResampleFilter(ResampleFilter *resample_filter,\n const FilterType filter)\n{\n ResizeFilter\n *resize_filter;\n\n assert(resample_filter != (ResampleFilter *) NULL);\n assert(resample_filter->signature == MagickCoreSignature);\n\n resample_filter->do_interpolate = MagickFalse;\n resample_filter->filter = filter;\n\n /* Default cylindrical filter is a Cubic Keys filter */\n if ( filter == UndefinedFilter )\n resample_filter->filter = RobidouxFilter;\n\n if ( resample_filter->filter == PointFilter ) {\n resample_filter->do_interpolate = MagickTrue;\n return; /* EWA turned off - nothing more to do */\n }\n\n resize_filter = AcquireResizeFilter(resample_filter->image,\n resample_filter->filter,MagickTrue,resample_filter->exception);\n if (resize_filter == (ResizeFilter *) NULL) {\n (void) ThrowMagickException(resample_filter->exception,GetMagickModule(),\n ModuleError, \"UnableToSetFilteringValue\",\n \"Fall back to Interpolated 'Point' filter\");\n resample_filter->filter = PointFilter;\n resample_filter->do_interpolate = MagickTrue;\n return; /* EWA turned off - nothing more to do */\n }\n\n /* Get the practical working support for the filter,\n * after any API call blur factors have been accoded for.\n */\n#if EWA\n resample_filter->support = GetResizeFilterSupport(resize_filter);\n#else\n resample_filter->support = 2.0; /* fixed support size for HQ-EWA */\n#endif\n\n#if FILTER_LUT\n /* Fill the LUT with the weights from the selected filter function */\n { int\n Q;\n double\n r_scale;\n\n /* Scale radius so the filter LUT covers the full support range */\n r_scale = resample_filter->support*sqrt(1.0/(double)WLUT_WIDTH);\n for(Q=0; Q<WLUT_WIDTH; Q++)\n resample_filter->filter_lut[Q] = (double)\n GetResizeFilterWeight(resize_filter,sqrt((double)Q)*r_scale);\n\n /* finished with the resize filter */\n resize_filter = DestroyResizeFilter(resize_filter);\n }\n#else\n /* save the filter and the scaled ellipse bounds needed for filter */\n resample_filter->filter_def = resize_filter;\n resample_filter->F = resample_filter->support*resample_filter->support;\n#endif\n\n /*\n Adjust the scaling of the default unit circle\n This assumes that any real scaling changes will always\n take place AFTER the filter method has been initialized.\n */\n ScaleResampleFilter(resample_filter, 1.0, 0.0, 0.0, 1.0);\n\n#if 0\n /*\n This is old code kept as a reference only. Basically it generates\n a Gaussian bell curve, with sigma = 0.5 if the support is 2.0\n\n Create Normal Gaussian 2D Filter Weighted Lookup Table.\n A normal EWA guassual lookup would use exp(Q*ALPHA)\n where Q = distance squared from 0.0 (center) to 1.0 (edge)\n and ALPHA = -4.0*ln(2.0) ==> -2.77258872223978123767\n The table is of length 1024, and equates to support radius of 2.0\n thus needs to be scaled by ALPHA*4/1024 and any blur factor squared\n\n The it comes from reference code provided by Fred Weinhaus.\n */\n r_scale = -2.77258872223978123767/(WLUT_WIDTH*blur*blur);\n for(Q=0; Q<WLUT_WIDTH; Q++)\n resample_filter->filter_lut[Q] = exp((double)Q*r_scale);\n resample_filter->support = WLUT_WIDTH;\n#endif\n\n#if FILTER_LUT\n#if defined(MAGICKCORE_OPENMP_SUPPORT)\n #pragma omp single\n#endif\n {\n if (IsStringTrue(GetImageArtifact(resample_filter->image,\n \"resample:verbose\")) != MagickFalse)\n {\n int\n Q;\n double\n r_scale;\n\n /* Debug output of the filter weighting LUT\n Gnuplot the LUT data, the x scale index has been adjusted\n plot [0:2][-.2:1] \"lut.dat\" with lines\n The filter values should be normalized for comparision\n */\n printf(\"#\\n\");\n printf(\"# Resampling Filter LUT (%d values) for '%s' filter\\n\",\n WLUT_WIDTH, CommandOptionToMnemonic(MagickFilterOptions,\n resample_filter->filter) );\n printf(\"#\\n\");\n printf(\"# Note: values in table are using a squared radius lookup.\\n\");\n printf(\"# As such its distribution is not uniform.\\n\");\n printf(\"#\\n\");\n printf(\"# The X value is the support distance for the Y weight\\n\");\n printf(\"# so you can use gnuplot to plot this cylindrical filter\\n\");\n printf(\"# plot [0:2][-.2:1] \\\"lut.dat\\\" with lines\\n\");\n printf(\"#\\n\");\n\n /* Scale radius so the filter LUT covers the full support range */\n r_scale = resample_filter->support*sqrt(1.0/(double)WLUT_WIDTH);\n for(Q=0; Q<WLUT_WIDTH; Q++)\n printf(\"%8.*g %.*g\\n\",\n GetMagickPrecision(),sqrt((double)Q)*r_scale,\n GetMagickPrecision(),resample_filter->filter_lut[Q] );\n printf(\"\\n\\n\"); /* generate a 'break' in gnuplot if multiple outputs */\n }\n /* Output the above once only for each image, and each setting\n (void) DeleteImageArtifact(resample_filter->image,\"resample:verbose\");\n */\n }\n#endif /* FILTER_LUT */\n return;\n}",
  15930. "project": "ImageMagick",
  15931. "hash": 272635026819998067997891334203445004129,
  15932. "size": 136,
  15933. "commit_id": "8d25d94a363b104acd6ff23df7470aeedb806c51",
  15934. "message": "https://github.com/ImageMagick/ImageMagick/issues/3195",
  15935. "target": 0,
  15936. "dataset": "other",
  15937. "idx": 406506
  15938. },
  15939. {
  15940. "func": "MagickExport void ScaleResampleFilter(ResampleFilter *resample_filter,\n const double dux,const double duy,const double dvx,const double dvy)\n{\n double A,B,C,F;\n\n assert(resample_filter != (ResampleFilter *) NULL);\n assert(resample_filter->signature == MagickCoreSignature);\n\n resample_filter->limit_reached = MagickFalse;\n\n /* A 'point' filter forces use of interpolation instead of area sampling */\n if ( resample_filter->filter == PointFilter )\n return; /* EWA turned off - nothing to do */\n\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"# -----\\n\" );\n (void) FormatLocaleFile(stderr, \"dux=%lf; dvx=%lf; duy=%lf; dvy=%lf;\\n\",\n dux, dvx, duy, dvy);\n#endif\n\n /* Find Ellipse Coefficents such that\n A*u^2 + B*u*v + C*v^2 = F\n With u,v relative to point around which we are resampling.\n And the given scaling dx,dy vectors in u,v space\n du/dx,dv/dx and du/dy,dv/dy\n */\n#if EWA\n /* Direct conversion of derivatives into elliptical coefficients\n However when magnifying images, the scaling vectors will be small\n resulting in a ellipse that is too small to sample properly.\n As such we need to clamp the major/minor axis to a minumum of 1.0\n to prevent it getting too small.\n */\n#if EWA_CLAMP\n { double major_mag,\n minor_mag,\n major_x,\n major_y,\n minor_x,\n minor_y;\n\n ClampUpAxes(dux,dvx,duy,dvy, &major_mag, &minor_mag,\n &major_x, &major_y, &minor_x, &minor_y);\n major_x *= major_mag; major_y *= major_mag;\n minor_x *= minor_mag; minor_y *= minor_mag;\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"major_x=%lf; major_y=%lf; minor_x=%lf; minor_y=%lf;\\n\",\n major_x, major_y, minor_x, minor_y);\n#endif\n A = major_y*major_y+minor_y*minor_y;\n B = -2.0*(major_x*major_y+minor_x*minor_y);\n C = major_x*major_x+minor_x*minor_x;\n F = major_mag*minor_mag;\n F *= F; /* square it */\n }\n#else /* raw unclamped EWA */\n A = dvx*dvx+dvy*dvy;\n B = -2.0*(dux*dvx+duy*dvy);\n C = dux*dux+duy*duy;\n F = dux*dvy-duy*dvx;\n F *= F; /* square it */\n#endif /* EWA_CLAMP */\n\n#else /* HQ_EWA */\n /*\n This Paul Heckbert's \"Higher Quality EWA\" formula, from page 60 in his\n thesis, which adds a unit circle to the elliptical area so as to do both\n Reconstruction and Prefiltering of the pixels in the resampling. It also\n means it is always likely to have at least 4 pixels within the area of the\n ellipse, for weighted averaging. No scaling will result with F == 4.0 and\n a circle of radius 2.0, and F smaller than this means magnification is\n being used.\n\n NOTE: This method produces a very blury result at near unity scale while\n producing perfect results for strong minitification and magnifications.\n\n However filter support is fixed to 2.0 (no good for Windowed Sinc filters)\n */\n A = dvx*dvx+dvy*dvy+1;\n B = -2.0*(dux*dvx+duy*dvy);\n C = dux*dux+duy*duy+1;\n F = A*C - B*B/4;\n#endif\n\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"A=%lf; B=%lf; C=%lf; F=%lf\\n\", A,B,C,F);\n\n /* Figure out the various information directly about the ellipse.\n This information currently not needed at this time, but may be\n needed later for better limit determination.\n\n It is also good to have as a record for future debugging\n */\n { double alpha, beta, gamma, Major, Minor;\n double Eccentricity, Ellipse_Area, Ellipse_Angle;\n\n alpha = A+C;\n beta = A-C;\n gamma = sqrt(beta*beta + B*B );\n\n if ( alpha - gamma <= MagickEpsilon )\n Major=MagickMaximumValue;\n else\n Major=sqrt(2*F/(alpha - gamma));\n Minor = sqrt(2*F/(alpha + gamma));\n\n (void) FormatLocaleFile(stderr, \"# Major=%lf; Minor=%lf\\n\", Major, Minor );\n\n /* other information about ellipse include... */\n Eccentricity = Major/Minor;\n Ellipse_Area = MagickPI*Major*Minor;\n Ellipse_Angle = atan2(B, A-C);\n\n (void) FormatLocaleFile(stderr, \"# Angle=%lf Area=%lf\\n\",\n (double) RadiansToDegrees(Ellipse_Angle), Ellipse_Area);\n }\n#endif\n\n /* If one or both of the scaling vectors is impossibly large\n (producing a very large raw F value), we may as well not bother\n doing any form of resampling since resampled area is very large.\n In this case some alternative means of pixel sampling, such as\n the average of the whole image is needed to get a reasonable\n result. Calculate only as needed.\n */\n if ( (4*A*C - B*B) > MagickMaximumValue ) {\n resample_filter->limit_reached = MagickTrue;\n return;\n }\n\n /* Scale ellipse to match the filters support\n (that is, multiply F by the square of the support)\n Simplier to just multiply it by the support twice!\n */\n F *= resample_filter->support;\n F *= resample_filter->support;\n\n /* Orthogonal bounds of the ellipse */\n resample_filter->Ulimit = sqrt(C*F/(A*C-0.25*B*B));\n resample_filter->Vlimit = sqrt(A*F/(A*C-0.25*B*B));\n\n /* Horizontally aligned parallelogram fitted to Ellipse */\n resample_filter->Uwidth = sqrt(F/A); /* Half of the parallelogram width */\n resample_filter->slope = -B/(2.0*A); /* Reciprocal slope of the parallelogram */\n\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"Ulimit=%lf; Vlimit=%lf; UWidth=%lf; Slope=%lf;\\n\",\n resample_filter->Ulimit, resample_filter->Vlimit,\n resample_filter->Uwidth, resample_filter->slope );\n#endif\n\n /* Check the absolute area of the parallelogram involved.\n * This limit needs more work, as it is too slow for larger images\n * with tiled views of the horizon.\n */\n if ( (resample_filter->Uwidth * resample_filter->Vlimit)\n > (4.0*resample_filter->image_area)) {\n resample_filter->limit_reached = MagickTrue;\n return;\n }\n\n /* Scale ellipse formula to directly index the Filter Lookup Table */\n { double scale;\n#if FILTER_LUT\n /* scale so that F = WLUT_WIDTH; -- hardcoded */\n scale = (double)WLUT_WIDTH/F;\n#else\n /* scale so that F = resample_filter->F (support^2) */\n scale = resample_filter->F/F;\n#endif\n resample_filter->A = A*scale;\n resample_filter->B = B*scale;\n resample_filter->C = C*scale;\n }\n}",
  15941. "project": "ImageMagick",
  15942. "hash": 231019287981565352051359680228225257165,
  15943. "size": 175,
  15944. "commit_id": "8d25d94a363b104acd6ff23df7470aeedb806c51",
  15945. "message": "https://github.com/ImageMagick/ImageMagick/issues/3195",
  15946. "target": 1,
  15947. "dataset": "other",
  15948. "idx": 208186
  15949. },
  15950. {
  15951. "func": "MagickExport void ScaleResampleFilter(ResampleFilter *resample_filter,\n const double dux,const double duy,const double dvx,const double dvy)\n{\n double A,B,C,F;\n\n assert(resample_filter != (ResampleFilter *) NULL);\n assert(resample_filter->signature == MagickCoreSignature);\n\n resample_filter->limit_reached = MagickFalse;\n\n /* A 'point' filter forces use of interpolation instead of area sampling */\n if ( resample_filter->filter == PointFilter )\n return; /* EWA turned off - nothing to do */\n\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"# -----\\n\" );\n (void) FormatLocaleFile(stderr, \"dux=%lf; dvx=%lf; duy=%lf; dvy=%lf;\\n\",\n dux, dvx, duy, dvy);\n#endif\n\n /* Find Ellipse Coefficents such that\n A*u^2 + B*u*v + C*v^2 = F\n With u,v relative to point around which we are resampling.\n And the given scaling dx,dy vectors in u,v space\n du/dx,dv/dx and du/dy,dv/dy\n */\n#if EWA\n /* Direct conversion of derivatives into elliptical coefficients\n However when magnifying images, the scaling vectors will be small\n resulting in a ellipse that is too small to sample properly.\n As such we need to clamp the major/minor axis to a minumum of 1.0\n to prevent it getting too small.\n */\n#if EWA_CLAMP\n { double major_mag,\n minor_mag,\n major_x,\n major_y,\n minor_x,\n minor_y;\n\n ClampUpAxes(dux,dvx,duy,dvy, &major_mag, &minor_mag,\n &major_x, &major_y, &minor_x, &minor_y);\n major_x *= major_mag; major_y *= major_mag;\n minor_x *= minor_mag; minor_y *= minor_mag;\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"major_x=%lf; major_y=%lf; minor_x=%lf; minor_y=%lf;\\n\",\n major_x, major_y, minor_x, minor_y);\n#endif\n A = major_y*major_y+minor_y*minor_y;\n B = -2.0*(major_x*major_y+minor_x*minor_y);\n C = major_x*major_x+minor_x*minor_x;\n F = major_mag*minor_mag;\n F *= F; /* square it */\n }\n#else /* raw unclamped EWA */\n A = dvx*dvx+dvy*dvy;\n B = -2.0*(dux*dvx+duy*dvy);\n C = dux*dux+duy*duy;\n F = dux*dvy-duy*dvx;\n F *= F; /* square it */\n#endif /* EWA_CLAMP */\n\n#else /* HQ_EWA */\n /*\n This Paul Heckbert's \"Higher Quality EWA\" formula, from page 60 in his\n thesis, which adds a unit circle to the elliptical area so as to do both\n Reconstruction and Prefiltering of the pixels in the resampling. It also\n means it is always likely to have at least 4 pixels within the area of the\n ellipse, for weighted averaging. No scaling will result with F == 4.0 and\n a circle of radius 2.0, and F smaller than this means magnification is\n being used.\n\n NOTE: This method produces a very blury result at near unity scale while\n producing perfect results for strong minitification and magnifications.\n\n However filter support is fixed to 2.0 (no good for Windowed Sinc filters)\n */\n A = dvx*dvx+dvy*dvy+1;\n B = -2.0*(dux*dvx+duy*dvy);\n C = dux*dux+duy*duy+1;\n F = A*C - B*B/4;\n#endif\n\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"A=%lf; B=%lf; C=%lf; F=%lf\\n\", A,B,C,F);\n\n /* Figure out the various information directly about the ellipse.\n This information currently not needed at this time, but may be\n needed later for better limit determination.\n\n It is also good to have as a record for future debugging\n */\n { double alpha, beta, gamma, Major, Minor;\n double Eccentricity, Ellipse_Area, Ellipse_Angle;\n\n alpha = A+C;\n beta = A-C;\n gamma = sqrt(beta*beta + B*B );\n\n if ( alpha - gamma <= MagickEpsilon )\n Major=MagickMaximumValue;\n else\n Major=sqrt(2*F/(alpha - gamma));\n Minor = sqrt(2*F/(alpha + gamma));\n\n (void) FormatLocaleFile(stderr, \"# Major=%lf; Minor=%lf\\n\", Major, Minor );\n\n /* other information about ellipse include... */\n Eccentricity = Major/Minor;\n Ellipse_Area = MagickPI*Major*Minor;\n Ellipse_Angle = atan2(B, A-C);\n\n (void) FormatLocaleFile(stderr, \"# Angle=%lf Area=%lf\\n\",\n (double) RadiansToDegrees(Ellipse_Angle), Ellipse_Area);\n }\n#endif\n\n /* If one or both of the scaling vectors is impossibly large\n (producing a very large raw F value), we may as well not bother\n doing any form of resampling since resampled area is very large.\n In this case some alternative means of pixel sampling, such as\n the average of the whole image is needed to get a reasonable\n result. Calculate only as needed.\n */\n if ( (4*A*C - B*B) > MagickMaximumValue ) {\n resample_filter->limit_reached = MagickTrue;\n return;\n }\n\n /* Scale ellipse to match the filters support\n (that is, multiply F by the square of the support)\n Simplier to just multiply it by the support twice!\n */\n F *= resample_filter->support;\n F *= resample_filter->support;\n\n /* Orthogonal bounds of the ellipse */\n resample_filter->Ulimit = sqrt(C*F/(A*C-0.25*B*B));\n resample_filter->Vlimit = sqrt(A*F/(A*C-0.25*B*B));\n\n /* Horizontally aligned parallelogram fitted to Ellipse */\n resample_filter->Uwidth = sqrt(F/A); /* Half of the parallelogram width */\n resample_filter->slope = -B/(2.0*A); /* Reciprocal slope of the parallelogram */\n\n#if DEBUG_ELLIPSE\n (void) FormatLocaleFile(stderr, \"Ulimit=%lf; Vlimit=%lf; UWidth=%lf; Slope=%lf;\\n\",\n resample_filter->Ulimit, resample_filter->Vlimit,\n resample_filter->Uwidth, resample_filter->slope );\n#endif\n\n /* Check the absolute area of the parallelogram involved.\n * This limit needs more work, as it is too slow for larger images\n * with tiled views of the horizon.\n */\n if ( (resample_filter->Uwidth * resample_filter->Vlimit)\n > (4.0*resample_filter->image_area)) {\n resample_filter->limit_reached = MagickTrue;\n return;\n }\n\n /* Scale ellipse formula to directly index the Filter Lookup Table */\n { double scale;\n#if FILTER_LUT\n /* scale so that F = WLUT_WIDTH; -- hardcoded */\n scale=(double) WLUT_WIDTH*PerceptibleReciprocal(F);\n#else\n /* scale so that F = resample_filter->F (support^2) */\n scale=resample_filter->F*PerceptibleReciprocal(F);\n#endif\n resample_filter->A = A*scale;\n resample_filter->B = B*scale;\n resample_filter->C = C*scale;\n }\n}",
  15952. "project": "ImageMagick",
  15953. "hash": 159696077506715638875467992554706158674,
  15954. "size": 175,
  15955. "commit_id": "8d25d94a363b104acd6ff23df7470aeedb806c51",
  15956. "message": "https://github.com/ImageMagick/ImageMagick/issues/3195",
  15957. "target": 0,
  15958. "dataset": "other",
  15959. "idx": 406508
  15960. },
  15961. {
  15962. "func": "static inline void ClampUpAxes(const double dux,\n\t\t\t const double dvx,\n\t\t\t const double duy,\n\t\t\t const double dvy,\n\t\t\t double *major_mag,\n\t\t\t double *minor_mag,\n\t\t\t double *major_unit_x,\n\t\t\t double *major_unit_y,\n\t\t\t double *minor_unit_x,\n\t\t\t double *minor_unit_y)\n{\n /*\n * ClampUpAxes takes an input 2x2 matrix\n *\n * [ a b ] = [ dux duy ]\n * [ c d ] = [ dvx dvy ]\n *\n * and computes from it the major and minor axis vectors [major_x,\n * major_y] and [minor_x,minor_y] of the smallest ellipse containing\n * both the unit disk and the ellipse which is the image of the unit\n * disk by the linear transformation\n *\n * [ dux duy ] [S] = [s]\n * [ dvx dvy ] [T] = [t]\n *\n * (The vector [S,T] is the difference between a position in output\n * space and [X,Y]; the vector [s,t] is the difference between a\n * position in input space and [x,y].)\n */\n /*\n * Output:\n *\n * major_mag is the half-length of the major axis of the \"new\"\n * ellipse.\n *\n * minor_mag is the half-length of the minor axis of the \"new\"\n * ellipse.\n *\n * major_unit_x is the x-coordinate of the major axis direction vector\n * of both the \"old\" and \"new\" ellipses.\n *\n * major_unit_y is the y-coordinate of the major axis direction vector.\n *\n * minor_unit_x is the x-coordinate of the minor axis direction vector.\n *\n * minor_unit_y is the y-coordinate of the minor axis direction vector.\n *\n * Unit vectors are useful for computing projections, in particular,\n * to compute the distance between a point in output space and the\n * center of a unit disk in output space, using the position of the\n * corresponding point [s,t] in input space. Following the clamping,\n * the square of this distance is\n *\n * ( ( s * major_unit_x + t * major_unit_y ) / major_mag )^2\n * +\n * ( ( s * minor_unit_x + t * minor_unit_y ) / minor_mag )^2\n *\n * If such distances will be computed for many [s,t]'s, it makes\n * sense to actually compute the reciprocal of major_mag and\n * minor_mag and multiply them by the above unit lengths.\n *\n * Now, if you want to modify the input pair of tangent vectors so\n * that it defines the modified ellipse, all you have to do is set\n *\n * newdux = major_mag * major_unit_x\n * newdvx = major_mag * major_unit_y\n * newduy = minor_mag * minor_unit_x = minor_mag * -major_unit_y\n * newdvy = minor_mag * minor_unit_y = minor_mag * major_unit_x\n *\n * and use these tangent vectors as if they were the original ones.\n * Usually, this is a drastic change in the tangent vectors even if\n * the singular values are not clamped; for example, the minor axis\n * vector always points in a direction which is 90 degrees\n * counterclockwise from the direction of the major axis vector.\n */\n /*\n * Discussion:\n *\n * GOAL: Fix things so that the pullback, in input space, of a disk\n * of radius r in output space is an ellipse which contains, at\n * least, a disc of radius r. (Make this hold for any r>0.)\n *\n * ESSENCE OF THE METHOD: Compute the product of the first two\n * factors of an SVD of the linear transformation defining the\n * ellipse and make sure that both its columns have norm at least 1.\n * Because rotations and reflexions map disks to themselves, it is\n * not necessary to compute the third (rightmost) factor of the SVD.\n *\n * DETAILS: Find the singular values and (unit) left singular\n * vectors of Jinv, clampling up the singular values to 1, and\n * multiply the unit left singular vectors by the new singular\n * values in order to get the minor and major ellipse axis vectors.\n *\n * Image resampling context:\n *\n * The Jacobian matrix of the transformation at the output point\n * under consideration is defined as follows:\n *\n * Consider the transformation (x,y) -> (X,Y) from input locations\n * to output locations. (Anthony Thyssen, elsewhere in resample.c,\n * uses the notation (u,v) -> (x,y).)\n *\n * The Jacobian matrix of the transformation at (x,y) is equal to\n *\n * J = [ A, B ] = [ dX/dx, dX/dy ]\n * [ C, D ] [ dY/dx, dY/dy ]\n *\n * that is, the vector [A,C] is the tangent vector corresponding to\n * input changes in the horizontal direction, and the vector [B,D]\n * is the tangent vector corresponding to input changes in the\n * vertical direction.\n *\n * In the context of resampling, it is natural to use the inverse\n * Jacobian matrix Jinv because resampling is generally performed by\n * pulling pixel locations in the output image back to locations in\n * the input image. Jinv is\n *\n * Jinv = [ a, b ] = [ dx/dX, dx/dY ]\n * [ c, d ] [ dy/dX, dy/dY ]\n *\n * Note: Jinv can be computed from J with the following matrix\n * formula:\n *\n * Jinv = 1/(A*D-B*C) [ D, -B ]\n * [ -C, A ]\n *\n * What we do is modify Jinv so that it generates an ellipse which\n * is as close as possible to the original but which contains the\n * unit disk. This can be accomplished as follows:\n *\n * Let\n *\n * Jinv = U Sigma V^T\n *\n * be an SVD decomposition of Jinv. (The SVD is not unique, but the\n * final ellipse does not depend on the particular SVD.)\n *\n * We could clamp up the entries of the diagonal matrix Sigma so\n * that they are at least 1, and then set\n *\n * Jinv = U newSigma V^T.\n *\n * However, we do not need to compute V for the following reason:\n * V^T is an orthogonal matrix (that is, it represents a combination\n * of rotations and reflexions) so that it maps the unit circle to\n * itself. For this reason, the exact value of V does not affect the\n * final ellipse, and we can choose V to be the identity\n * matrix. This gives\n *\n * Jinv = U newSigma.\n *\n * In the end, we return the two diagonal entries of newSigma\n * together with the two columns of U.\n */\n /*\n * ClampUpAxes was written by Nicolas Robidoux and Chantal Racette\n * of Laurentian University with insightful suggestions from Anthony\n * Thyssen and funding from the National Science and Engineering\n * Research Council of Canada. It is distinguished from its\n * predecessors by its efficient handling of degenerate cases.\n *\n * The idea of clamping up the EWA ellipse's major and minor axes so\n * that the result contains the reconstruction kernel filter support\n * is taken from Andreas Gustaffson's Masters thesis \"Interactive\n * Image Warping\", Helsinki University of Technology, Faculty of\n * Information Technology, 59 pages, 1993 (see Section 3.6).\n *\n * The use of the SVD to clamp up the singular values of the\n * Jacobian matrix of the pullback transformation for EWA resampling\n * is taken from the astrophysicist Craig DeForest. It is\n * implemented in his PDL::Transform code (PDL = Perl Data\n * Language).\n */\n const double a = dux;\n const double b = duy;\n const double c = dvx;\n const double d = dvy;\n /*\n * n is the matrix Jinv * transpose(Jinv). Eigenvalues of n are the\n * squares of the singular values of Jinv.\n */\n const double aa = a*a;\n const double bb = b*b;\n const double cc = c*c;\n const double dd = d*d;\n /*\n * Eigenvectors of n are left singular vectors of Jinv.\n */\n const double n11 = aa+bb;\n const double n12 = a*c+b*d;\n const double n21 = n12;\n const double n22 = cc+dd;\n const double det = a*d-b*c;\n const double twice_det = det+det;\n const double frobenius_squared = n11+n22;\n const double discriminant =\n (frobenius_squared+twice_det)*(frobenius_squared-twice_det);\n /*\n * In exact arithmetic, discriminant can't be negative. In floating\n * point, it can, because of the bad conditioning of SVD\n * decompositions done through the associated normal matrix.\n */\n const double sqrt_discriminant =\n sqrt(discriminant > 0.0 ? discriminant : 0.0);\n /*\n * s1 is the largest singular value of the inverse Jacobian\n * matrix. In other words, its reciprocal is the smallest singular\n * value of the Jacobian matrix itself.\n * If s1 = 0, both singular values are 0, and any orthogonal pair of\n * left and right factors produces a singular decomposition of Jinv.\n */\n /*\n * Initially, we only compute the squares of the singular values.\n */\n const double s1s1 = 0.5*(frobenius_squared+sqrt_discriminant);\n /*\n * s2 the smallest singular value of the inverse Jacobian\n * matrix. Its reciprocal is the largest singular value of the\n * Jacobian matrix itself.\n */\n const double s2s2 = 0.5*(frobenius_squared-sqrt_discriminant);\n const double s1s1minusn11 = s1s1-n11;\n const double s1s1minusn22 = s1s1-n22;\n /*\n * u1, the first column of the U factor of a singular decomposition\n * of Jinv, is a (non-normalized) left singular vector corresponding\n * to s1. It has entries u11 and u21. We compute u1 from the fact\n * that it is an eigenvector of n corresponding to the eigenvalue\n * s1^2.\n */\n const double s1s1minusn11_squared = s1s1minusn11*s1s1minusn11;\n const double s1s1minusn22_squared = s1s1minusn22*s1s1minusn22;\n /*\n * The following selects the largest row of n-s1^2 I as the one\n * which is used to find the eigenvector. If both s1^2-n11 and\n * s1^2-n22 are zero, n-s1^2 I is the zero matrix. In that case,\n * any vector is an eigenvector; in addition, norm below is equal to\n * zero, and, in exact arithmetic, this is the only case in which\n * norm = 0. So, setting u1 to the simple but arbitrary vector [1,0]\n * if norm = 0 safely takes care of all cases.\n */\n const double temp_u11 =\n ( (s1s1minusn11_squared>=s1s1minusn22_squared) ? n12 : s1s1minusn22 );\n const double temp_u21 =\n ( (s1s1minusn11_squared>=s1s1minusn22_squared) ? s1s1minusn11 : n21 );\n const double norm = sqrt(temp_u11*temp_u11+temp_u21*temp_u21);\n /*\n * Finalize the entries of first left singular vector (associated\n * with the largest singular value).\n */\n const double u11 = ( (norm>0.0) ? temp_u11/norm : 1.0 );\n const double u21 = ( (norm>0.0) ? temp_u21/norm : 0.0 );\n /*\n * Clamp the singular values up to 1.\n */\n *major_mag = ( (s1s1<=1.0) ? 1.0 : sqrt(s1s1) );\n *minor_mag = ( (s2s2<=1.0) ? 1.0 : sqrt(s2s2) );\n /*\n * Return the unit major and minor axis direction vectors.\n */\n *major_unit_x = u11;\n *major_unit_y = u21;\n *minor_unit_x = -u21;\n *minor_unit_y = u11;\n}",
  15963. "project": "ImageMagick",
  15964. "hash": 3821216432839019935069421826917237175,
  15965. "size": 265,
  15966. "commit_id": "8d25d94a363b104acd6ff23df7470aeedb806c51",
  15967. "message": "https://github.com/ImageMagick/ImageMagick/issues/3195",
  15968. "target": 0,
  15969. "dataset": "other",
  15970. "idx": 406503
  15971. }
  15972. ]
  15973. },
  15974. {
  15975. "call_depth": 4,
  15976. "longest_call_chain": [
  15977. "reoptimize",
  15978. "sort_and_filter_keyuse",
  15979. "generate_derived_keys",
  15980. "generate_derived_keys_for_table"
  15981. ],
  15982. "group_size": 7,
  15983. "functions": [
  15984. {
  15985. "func": "void JOIN::save_query_plan(Join_plan_state *save_to)\n{\n DYNAMIC_ARRAY tmp_keyuse;\n /* Swap the current and the backup keyuse internal arrays. */\n tmp_keyuse= keyuse;\n keyuse= save_to->keyuse; /* keyuse is reset to an empty array. */\n save_to->keyuse= tmp_keyuse;\n\n for (uint i= 0; i < table_count; i++)\n {\n save_to->join_tab_keyuse[i]= join_tab[i].keyuse;\n join_tab[i].keyuse= NULL;\n save_to->join_tab_checked_keys[i]= join_tab[i].checked_keys;\n join_tab[i].checked_keys.clear_all();\n }\n memcpy((uchar*) save_to->best_positions, (uchar*) best_positions,\n sizeof(POSITION) * (table_count + 1));\n memset((uchar*) best_positions, 0, sizeof(POSITION) * (table_count + 1));\n \n /* Save SJM nests */\n List_iterator<TABLE_LIST> it(select_lex->sj_nests);\n TABLE_LIST *tlist;\n SJ_MATERIALIZATION_INFO **p_info= save_to->sj_mat_info;\n while ((tlist= it++))\n {\n *(p_info++)= tlist->sj_mat_info;\n }\n}",
  15986. "target": 0,
  15987. "cwe": [],
  15988. "project": "server",
  15989. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  15990. "hash": 162011539998697303733224577679114086727,
  15991. "size": 28,
  15992. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  15993. "dataset": "other",
  15994. "idx": 508603
  15995. },
  15996. {
  15997. "func": "void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)\n{\n KEYUSE *end,*keyuse= dynamic_element(keyuse_array, 0, KEYUSE*);\n\n for (end= keyuse+ keyuse_array->elements ; keyuse < end ; keyuse++)\n {\n table_map map;\n /*\n If we find a ref, assume this table matches a proportional\n part of this table.\n For example 100 records matching a table with 5000 records\n gives 5000/100 = 50 records per key\n Constant tables are ignored.\n To avoid bad matches, we don't make ref_table_rows less than 100.\n */\n keyuse->ref_table_rows= ~(ha_rows) 0;\t// If no ref\n if (keyuse->used_tables &\n\t(map= (keyuse->used_tables & ~join->const_table_map &\n\t ~OUTER_REF_TABLE_BIT)))\n {\n uint n_tables= my_count_bits(map);\n if (n_tables == 1)\t\t\t// Only one table\n {\n DBUG_ASSERT(!(map & PSEUDO_TABLE_BITS)); // Must be a real table\n Table_map_iterator it(map);\n int tablenr= it.next_bit();\n DBUG_ASSERT(tablenr != Table_map_iterator::BITMAP_END);\n\tTABLE *tmp_table=join->table[tablenr];\n if (tmp_table) // already created\n keyuse->ref_table_rows= MY_MAX(tmp_table->file->stats.records, 100);\n }\n }\n /*\n Outer reference (external field) is constant for single executing\n of subquery\n */\n if (keyuse->used_tables == OUTER_REF_TABLE_BIT)\n keyuse->ref_table_rows= 1;\n }\n}",
  15998. "target": 0,
  15999. "cwe": [],
  16000. "project": "server",
  16001. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  16002. "hash": 120929170831977725675266114752273713348,
  16003. "size": 40,
  16004. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  16005. "dataset": "other",
  16006. "idx": 508690
  16007. },
  16008. {
  16009. "func": "void JOIN::reset_query_plan()\n{\n for (uint i= 0; i < table_count; i++)\n {\n join_tab[i].keyuse= NULL;\n join_tab[i].checked_keys.clear_all();\n }\n}",
  16010. "target": 0,
  16011. "cwe": [],
  16012. "project": "server",
  16013. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  16014. "hash": 261841307357917191129910538949682751948,
  16015. "size": 8,
  16016. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  16017. "dataset": "other",
  16018. "idx": 508466
  16019. },
  16020. {
  16021. "func": "bool generate_derived_keys_for_table(KEYUSE *keyuse, uint count, uint keys)\n{\n TABLE *table= keyuse->table;\n if (table->alloc_keys(keys))\n return TRUE;\n uint key_count= 0;\n KEYUSE *first_keyuse= keyuse;\n uint prev_part= keyuse->keypart;\n uint parts= 0;\n uint i= 0;\n\n for ( ; i < count && key_count < keys; )\n {\n do\n {\n keyuse->key= table->s->keys;\n keyuse->keypart_map= (key_part_map) (1 << parts); \n keyuse++;\n i++;\n } \n while (i < count && keyuse->used_tables == first_keyuse->used_tables &&\n keyuse->keypart == prev_part);\n parts++;\n if (i < count && keyuse->used_tables == first_keyuse->used_tables)\n {\n prev_part= keyuse->keypart;\n }\n else\n {\n KEYUSE *save_first_keyuse= first_keyuse;\n if (table->check_tmp_key(table->s->keys, parts,\n get_next_field_for_derived_key_simple,\n (uchar *) &first_keyuse))\n\n {\n first_keyuse= save_first_keyuse;\n if (table->add_tmp_key(table->s->keys, parts, \n get_next_field_for_derived_key, \n (uchar *) &first_keyuse,\n FALSE))\n return TRUE;\n table->reginfo.join_tab->keys.set_bit(table->s->keys);\n }\n else\n {\n /* Mark keyuses for this key to be excluded */\n for (KEYUSE *curr=save_first_keyuse; curr < keyuse; curr++)\n\t{\n curr->key= MAX_KEY;\n }\n }\n first_keyuse= keyuse;\n key_count++;\n parts= 0;\n prev_part= keyuse->keypart;\n }\n } \n\n return FALSE;\n}",
  16022. "target": 0,
  16023. "cwe": [],
  16024. "project": "server",
  16025. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  16026. "hash": 230294648487314583666233567836385950967,
  16027. "size": 60,
  16028. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  16029. "dataset": "other",
  16030. "idx": 508604
  16031. },
  16032. {
  16033. "func": "JOIN::reoptimize(Item *added_where, table_map join_tables,\n Join_plan_state *save_to)\n{\n DYNAMIC_ARRAY added_keyuse;\n SARGABLE_PARAM *sargables= 0; /* Used only as a dummy parameter. */\n uint org_keyuse_elements;\n\n /* Re-run the REF optimizer to take into account the new conditions. */\n if (update_ref_and_keys(thd, &added_keyuse, join_tab, table_count, added_where,\n ~outer_join, select_lex, &sargables))\n {\n delete_dynamic(&added_keyuse);\n return REOPT_ERROR;\n }\n\n if (!added_keyuse.elements)\n {\n delete_dynamic(&added_keyuse);\n return REOPT_OLD_PLAN;\n }\n\n if (save_to)\n save_query_plan(save_to);\n else\n reset_query_plan();\n\n if (!keyuse.buffer &&\n my_init_dynamic_array(&keyuse, sizeof(KEYUSE), 20, 64,\n MYF(MY_THREAD_SPECIFIC)))\n {\n delete_dynamic(&added_keyuse);\n return REOPT_ERROR;\n }\n\n org_keyuse_elements= save_to ? save_to->keyuse.elements : keyuse.elements;\n allocate_dynamic(&keyuse, org_keyuse_elements + added_keyuse.elements);\n\n /* If needed, add the access methods from the original query plan. */\n if (save_to)\n {\n DBUG_ASSERT(!keyuse.elements);\n keyuse.elements= save_to->keyuse.elements;\n if (size_t e= keyuse.elements)\n memcpy(keyuse.buffer,\n save_to->keyuse.buffer, e * keyuse.size_of_element);\n }\n\n /* Add the new access methods to the keyuse array. */\n memcpy(keyuse.buffer + keyuse.elements * keyuse.size_of_element,\n added_keyuse.buffer,\n (size_t) added_keyuse.elements * added_keyuse.size_of_element);\n keyuse.elements+= added_keyuse.elements;\n /* added_keyuse contents is copied, and it is no longer needed. */\n delete_dynamic(&added_keyuse);\n\n if (sort_and_filter_keyuse(thd, &keyuse, true))\n return REOPT_ERROR;\n optimize_keyuse(this, &keyuse);\n\n if (optimize_semijoin_nests(this, join_tables))\n return REOPT_ERROR;\n\n /* Re-run the join optimizer to compute a new query plan. */\n if (choose_plan(this, join_tables))\n return REOPT_ERROR;\n\n return REOPT_NEW_PLAN;\n}",
  16034. "target": 0,
  16035. "cwe": [],
  16036. "project": "server",
  16037. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  16038. "hash": 75666197854928182620552515543537699218,
  16039. "size": 68,
  16040. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  16041. "dataset": "other",
  16042. "idx": 508423
  16043. },
  16044. {
  16045. "func": "bool sort_and_filter_keyuse(THD *thd, DYNAMIC_ARRAY *keyuse,\n bool skip_unprefixed_keyparts)\n{\n KEYUSE key_end, *prev, *save_pos, *use;\n uint found_eq_constant, i;\n\n DBUG_ASSERT(keyuse->elements);\n\n my_qsort(keyuse->buffer, keyuse->elements, sizeof(KEYUSE),\n (qsort_cmp) sort_keyuse);\n\n bzero((char*) &key_end, sizeof(key_end)); /* Add for easy testing */\n if (insert_dynamic(keyuse, (uchar*) &key_end))\n return TRUE;\n\n if (optimizer_flag(thd, OPTIMIZER_SWITCH_DERIVED_WITH_KEYS))\n generate_derived_keys(keyuse);\n\n use= save_pos= dynamic_element(keyuse,0,KEYUSE*);\n prev= &key_end;\n found_eq_constant= 0;\n for (i=0 ; i < keyuse->elements-1 ; i++,use++)\n {\n if (!use->is_for_hash_join())\n {\n if (!(use->used_tables & ~OUTER_REF_TABLE_BIT) && \n use->optimize != KEY_OPTIMIZE_REF_OR_NULL)\n use->table->const_key_parts[use->key]|= use->keypart_map;\n if (use->keypart != FT_KEYPART)\n {\n if (use->key == prev->key && use->table == prev->table)\n {\n if ((prev->keypart+1 < use->keypart && skip_unprefixed_keyparts) ||\n (prev->keypart == use->keypart && found_eq_constant))\n continue;\t\t\t\t/* remove */\n }\n else if (use->keypart != 0 && skip_unprefixed_keyparts)\n continue; /* remove - first found must be 0 */\n }\n\n prev= use;\n found_eq_constant= !use->used_tables;\n use->table->reginfo.join_tab->checked_keys.set_bit(use->key);\n }\n /*\n Old gcc used a memcpy(), which is undefined if save_pos==use:\n http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19410\n http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39480\n This also disables a valgrind warning, so better to have the test.\n */\n if (save_pos != use)\n *save_pos= *use;\n /* Save ptr to first use */\n if (!use->table->reginfo.join_tab->keyuse)\n use->table->reginfo.join_tab->keyuse= save_pos;\n save_pos++;\n }\n i= (uint) (save_pos-(KEYUSE*) keyuse->buffer);\n (void) set_dynamic(keyuse,(uchar*) &key_end,i);\n keyuse->elements= i;\n\n return FALSE;\n}",
  16046. "target": 0,
  16047. "cwe": [],
  16048. "project": "server",
  16049. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  16050. "hash": 270395890466385312065376189926284758775,
  16051. "size": 63,
  16052. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  16053. "dataset": "other",
  16054. "idx": 508612
  16055. },
  16056. {
  16057. "func": "bool generate_derived_keys(DYNAMIC_ARRAY *keyuse_array)\n{\n KEYUSE *keyuse= dynamic_element(keyuse_array, 0, KEYUSE*);\n uint elements= keyuse_array->elements;\n TABLE *prev_table= 0;\n for (uint i= 0; i < elements; i++, keyuse++)\n {\n if (!keyuse->table)\n break;\n KEYUSE *first_table_keyuse= NULL;\n table_map last_used_tables= 0;\n uint count= 0;\n uint keys= 0;\n TABLE_LIST *derived= NULL;\n if (keyuse->table != prev_table)\n derived= keyuse->table->pos_in_table_list;\n while (derived && derived->is_materialized_derived())\n {\n if (keyuse->table != prev_table)\n {\n prev_table= keyuse->table;\n while (keyuse->table == prev_table && keyuse->key != MAX_KEY)\n\t{\n keyuse++;\n i++;\n }\n if (keyuse->table != prev_table)\n\t{\n keyuse--;\n i--;\n derived= NULL;\n continue;\n }\n first_table_keyuse= keyuse;\n last_used_tables= keyuse->used_tables;\n count= 0;\n keys= 0;\n }\n else if (keyuse->used_tables != last_used_tables)\n {\n keys++;\n last_used_tables= keyuse->used_tables;\n }\n count++;\n keyuse++;\n i++;\n if (keyuse->table != prev_table)\n {\n if (generate_derived_keys_for_table(first_table_keyuse, count, ++keys))\n return TRUE;\n keyuse--;\n i--;\n\tderived= NULL;\n }\n }\n }\n return FALSE;\n}",
  16058. "target": 0,
  16059. "cwe": [],
  16060. "project": "server",
  16061. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  16062. "hash": 297768314615660910310727454257539309288,
  16063. "size": 58,
  16064. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  16065. "dataset": "other",
  16066. "idx": 508639
  16067. }
  16068. ]
  16069. },
  16070. {
  16071. "call_depth": 4,
  16072. "longest_call_chain": [
  16073. "didFinishSpeaking",
  16074. "handleSpeakingCompleted",
  16075. "fireEvent",
  16076. "executionContext"
  16077. ],
  16078. "group_size": 22,
  16079. "functions": [
  16080. {
  16081. "project": "Chrome",
  16082. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16083. "target": 0,
  16084. "func": "void SpeechSynthesis::resume()\n{\n if (!currentSpeechUtterance())\n return;\n m_platformSpeechSynthesizer->resume();\n}\n",
  16085. "cwe": "",
  16086. "big_vul_idx": 129900,
  16087. "idx": 116225,
  16088. "hash": 211830265481063403535988771688867702984
  16089. },
  16090. {
  16091. "project": "Chrome",
  16092. "commit_id": "6834289784ed45b5524de0fb7ef43ae283b0d6d3",
  16093. "target": 0,
  16094. "func": "void AudioContext::resolvePromisesForSuspendOnMainThread()\n{\n ASSERT(isMainThread());\n AutoLocker locker(this);\n\n if (m_destinationNode)\n stopRendering();\n\n for (auto& resolver : m_suspendResolvers) {\n if (m_contextState == Closed) {\n resolver->reject(\n DOMException::create(InvalidStateError, \"Cannot suspend a context that has been closed\"));\n } else {\n resolver->resolve();\n }\n }\n\n m_suspendResolvers.clear();\n}\n",
  16095. "cwe": "",
  16096. "big_vul_idx": 139685,
  16097. "idx": 124833,
  16098. "hash": 118943594186034240752100234636332638888
  16099. },
  16100. {
  16101. "project": "Chrome",
  16102. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16103. "target": 1,
  16104. "func": "void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utterance, bool errorOccurred)\n {\n ASSERT(utterance);\n \n bool didJustFinishCurrentUtterance = false;\n if (utterance == currentSpeechUtterance()) {\n m_utteranceQueue.removeFirst();\n didJustFinishCurrentUtterance = true;\n }\n\n fireEvent(errorOccurred ? EventTypeNames::error : EventTypeNames::end, utterance, 0, String());\n\n if (didJustFinishCurrentUtterance && !m_utteranceQueue.isEmpty())\n startSpeakingImmediately();\n}\n",
  16105. "cwe": "",
  16106. "big_vul_idx": 185386,
  16107. "idx": 6244,
  16108. "hash": 51064366369637881630682008748783014232
  16109. },
  16110. {
  16111. "project": "Chrome",
  16112. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16113. "target": 0,
  16114. "func": "void SpeechSynthesis::handleSpeakingCompleted(SpeechSynthesisUtterance* utterance, bool errorOccurred)\n {\n ASSERT(utterance);\n \n // Keep the utterance around long enough to fire an event on it in case m_utteranceQueue\n // is holding the last reference to it.\n RefPtrWillBeRawPtr<SpeechSynthesisUtterance> protect(utterance);\n\n bool didJustFinishCurrentUtterance = false;\n if (utterance == currentSpeechUtterance()) {\n m_utteranceQueue.removeFirst();\n didJustFinishCurrentUtterance = true;\n }\n\n fireEvent(errorOccurred ? EventTypeNames::error : EventTypeNames::end, utterance, 0, String());\n\n if (didJustFinishCurrentUtterance && !m_utteranceQueue.isEmpty())\n startSpeakingImmediately();\n}\n",
  16115. "cwe": "",
  16116. "big_vul_idx": 185386,
  16117. "idx": 163331,
  16118. "hash": 23380105532145118333362184433256570897
  16119. },
  16120. {
  16121. "project": "Chrome",
  16122. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16123. "target": 0,
  16124. "func": "void SpeechSynthesis::boundaryEventOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance, SpeechBoundary boundary, unsigned charIndex)\n{\n DEFINE_STATIC_LOCAL(const String, wordBoundaryString, (\"word\"));\n DEFINE_STATIC_LOCAL(const String, sentenceBoundaryString, (\"sentence\"));\n\n switch (boundary) {\n case SpeechWordBoundary:\n fireEvent(EventTypeNames::boundary, static_cast<SpeechSynthesisUtterance*>(utterance->client()), charIndex, wordBoundaryString);\n break;\n case SpeechSentenceBoundary:\n fireEvent(EventTypeNames::boundary, static_cast<SpeechSynthesisUtterance*>(utterance->client()), charIndex, sentenceBoundaryString);\n break;\n default:\n ASSERT_NOT_REACHED();\n }\n}\n",
  16125. "cwe": "",
  16126. "big_vul_idx": 129886,
  16127. "idx": 116211,
  16128. "hash": 99679462228640680760071758425709711418
  16129. },
  16130. {
  16131. "project": "Chrome",
  16132. "commit_id": "6834289784ed45b5524de0fb7ef43ae283b0d6d3",
  16133. "target": 0,
  16134. "func": "void AudioContext::startRendering()\n{\n ASSERT(isMainThread());\n ASSERT(m_destinationNode);\n\n if (m_contextState == Suspended) {\n destination()->startRendering();\n setContextState(Running);\n }\n}\n",
  16135. "cwe": "",
  16136. "big_vul_idx": 139688,
  16137. "idx": 124836,
  16138. "hash": 142662764461032600377284385191665947202
  16139. },
  16140. {
  16141. "project": "Chrome",
  16142. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16143. "target": 0,
  16144. "func": "void SpeechSynthesis::fireEvent(const AtomicString& type, SpeechSynthesisUtterance* utterance, unsigned long charIndex, const String& name)\n{\n if (!executionContext()->activeDOMObjectsAreStopped())\n utterance->dispatchEvent(SpeechSynthesisEvent::create(type, charIndex, (currentTime() - utterance->startTime()), name));\n}\n",
  16145. "cwe": "",
  16146. "big_vul_idx": 129894,
  16147. "idx": 116219,
  16148. "hash": 332886004579278944427313270883617145253
  16149. },
  16150. {
  16151. "project": "Chrome",
  16152. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16153. "target": 0,
  16154. "func": "void SpeechSynthesis::speakingErrorOccurred(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance)\n{\n if (utterance->client())\n handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), true);\n}\n",
  16155. "cwe": "",
  16156. "big_vul_idx": 129904,
  16157. "idx": 116229,
  16158. "hash": 231677242442625066328288469107298179746
  16159. },
  16160. {
  16161. "project": "Chrome",
  16162. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16163. "target": 0,
  16164. "func": "void SpeechSynthesis::didStartSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance)\n{\n if (utterance->client())\n fireEvent(EventTypeNames::start, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String());\n}\n",
  16165. "cwe": "",
  16166. "big_vul_idx": 129892,
  16167. "idx": 116217,
  16168. "hash": 9214081021639232300638298244261428429
  16169. },
  16170. {
  16171. "project": "Chrome",
  16172. "commit_id": "6834289784ed45b5524de0fb7ef43ae283b0d6d3",
  16173. "target": 0,
  16174. "func": "ScriptPromise AudioContext::resumeContext(ScriptState* scriptState)\n{\n ASSERT(isMainThread());\n AutoLocker locker(this);\n\n if (isOfflineContext()) {\n return ScriptPromise::rejectWithDOMException(\n scriptState,\n DOMException::create(\n InvalidStateError,\n \"cannot resume an OfflineAudioContext\"));\n }\n\n RefPtrWillBeRawPtr<ScriptPromiseResolver> resolver = ScriptPromiseResolver::create(scriptState);\n ScriptPromise promise = resolver->promise();\n\n if (m_destinationNode)\n startRendering();\n\n m_resumeResolvers.append(resolver);\n\n return promise;\n}\n",
  16175. "cwe": "",
  16176. "big_vul_idx": 139686,
  16177. "idx": 124834,
  16178. "hash": 318570413813050108211516841774464416601
  16179. },
  16180. {
  16181. "project": "Chrome",
  16182. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16183. "target": 0,
  16184. "func": "SpeechSynthesisUtterance* SpeechSynthesis::currentSpeechUtterance() const\n{\n if (!m_utteranceQueue.isEmpty())\n return m_utteranceQueue.first().get();\n return 0;\n}\n",
  16185. "cwe": "",
  16186. "big_vul_idx": 129889,
  16187. "idx": 116214,
  16188. "hash": 168156307974646343211506977179694426483
  16189. },
  16190. {
  16191. "project": "Chrome",
  16192. "commit_id": "6834289784ed45b5524de0fb7ef43ae283b0d6d3",
  16193. "target": 0,
  16194. "func": "void AudioContext::setContextState(AudioContextState newState)\n{\n ASSERT(isMainThread());\n\n switch (newState) {\n case Suspended:\n ASSERT(m_contextState == Running);\n break;\n case Running:\n ASSERT(m_contextState == Suspended);\n break;\n case Closed:\n ASSERT(m_contextState != Closed);\n break;\n }\n\n if (newState == m_contextState) {\n return;\n }\n\n m_contextState = newState;\n\n if (executionContext())\n executionContext()->postTask(createSameThreadTask(&AudioContext::notifyStateChange, this));\n}\n",
  16195. "cwe": "",
  16196. "big_vul_idx": 139687,
  16197. "idx": 124835,
  16198. "hash": 287189053384613982133619486169028517125
  16199. },
  16200. {
  16201. "project": "Chrome",
  16202. "commit_id": "6834289784ed45b5524de0fb7ef43ae283b0d6d3",
  16203. "target": 0,
  16204. "func": "void AudioContext::stopRendering()\n{\n ASSERT(isMainThread());\n ASSERT(m_destinationNode);\n ASSERT(!isOfflineContext());\n\n if (m_contextState == Running) {\n destination()->stopRendering();\n setContextState(Suspended);\n }\n}\n",
  16205. "cwe": "",
  16206. "big_vul_idx": 139691,
  16207. "idx": 124839,
  16208. "hash": 21252299144639789814578235777964790818
  16209. },
  16210. {
  16211. "project": "Chrome",
  16212. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16213. "target": 0,
  16214. "func": "ExecutionContext* SpeechSynthesis::executionContext() const\n{\n return ContextLifecycleObserver::executionContext();\n}\n",
  16215. "cwe": "",
  16216. "big_vul_idx": 129893,
  16217. "idx": 116218,
  16218. "hash": 333478678279043922693098382899862568553
  16219. },
  16220. {
  16221. "project": "Chrome",
  16222. "commit_id": "6834289784ed45b5524de0fb7ef43ae283b0d6d3",
  16223. "target": 0,
  16224. "func": "ExecutionContext* AudioContext::executionContext() const\n{\n return m_isStopScheduled ? 0 : ActiveDOMObject::executionContext();\n}\n",
  16225. "cwe": "",
  16226. "big_vul_idx": 139655,
  16227. "idx": 124805,
  16228. "hash": 184737248806572005970236803996746836487
  16229. },
  16230. {
  16231. "project": "Chrome",
  16232. "commit_id": "6834289784ed45b5524de0fb7ef43ae283b0d6d3",
  16233. "target": 0,
  16234. "func": "void AudioContext::fireCompletionEvent()\n{\n ASSERT(isMainThread());\n if (!isMainThread())\n return;\n\n AudioBuffer* renderedBuffer = m_renderTarget.get();\n\n setContextState(Closed);\n\n ASSERT(renderedBuffer);\n if (!renderedBuffer)\n return;\n\n if (executionContext()) {\n dispatchEvent(OfflineAudioCompletionEvent::create(renderedBuffer));\n m_offlineResolver->resolve(renderedBuffer);\n }\n}\n",
  16235. "cwe": "",
  16236. "big_vul_idx": 139656,
  16237. "idx": 124806,
  16238. "hash": 152452498610149100042179351223628836058
  16239. },
  16240. {
  16241. "project": "Chrome",
  16242. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16243. "target": 0,
  16244. "func": "void SpeechSynthesis::speak(SpeechSynthesisUtterance* utterance, ExceptionState& exceptionState)\n{\n if (!utterance) {\n exceptionState.throwTypeError(\"Invalid utterance argument\");\n return;\n }\n\n m_utteranceQueue.append(utterance);\n\n if (m_utteranceQueue.size() == 1)\n startSpeakingImmediately();\n}\n",
  16245. "cwe": "",
  16246. "big_vul_idx": 129902,
  16247. "idx": 116227,
  16248. "hash": 334525451552508820490739815215112912633
  16249. },
  16250. {
  16251. "project": "Chrome",
  16252. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16253. "target": 0,
  16254. "func": "bool SpeechSynthesis::speaking() const\n{\n return currentSpeechUtterance();\n}\n",
  16255. "cwe": "",
  16256. "big_vul_idx": 129903,
  16257. "idx": 116228,
  16258. "hash": 264136037019701147145396860730088626650
  16259. },
  16260. {
  16261. "project": "Chrome",
  16262. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16263. "target": 0,
  16264. "func": "void SpeechSynthesis::startSpeakingImmediately()\n{\n SpeechSynthesisUtterance* utterance = currentSpeechUtterance();\n ASSERT(utterance);\n\n utterance->setStartTime(monotonicallyIncreasingTime());\n m_isPaused = false;\n m_platformSpeechSynthesizer->speak(utterance->platformUtterance());\n}\n",
  16265. "cwe": "",
  16266. "big_vul_idx": 129905,
  16267. "idx": 116230,
  16268. "hash": 272953521684895724697749690104131444667
  16269. },
  16270. {
  16271. "project": "Chrome",
  16272. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16273. "target": 0,
  16274. "func": "void SpeechSynthesis::didFinishSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance)\n{\n if (utterance->client())\n handleSpeakingCompleted(static_cast<SpeechSynthesisUtterance*>(utterance->client()), false);\n}\n",
  16275. "cwe": "",
  16276. "big_vul_idx": 129890,
  16277. "idx": 116215,
  16278. "hash": 336613363302777058118338465950575464528
  16279. },
  16280. {
  16281. "project": "Chrome",
  16282. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16283. "target": 0,
  16284. "func": "void SpeechSynthesis::voicesDidChange()\n{\n m_voiceList.clear();\n if (!executionContext()->activeDOMObjectsAreStopped())\n dispatchEvent(Event::create(EventTypeNames::voiceschanged));\n}\n",
  16285. "cwe": "",
  16286. "big_vul_idx": 129907,
  16287. "idx": 116232,
  16288. "hash": 206142822381456278081516244950130128741
  16289. },
  16290. {
  16291. "project": "Chrome",
  16292. "commit_id": "9a3dbf43f97aa7cb6b4399f9b11ce1de20f0680f",
  16293. "target": 0,
  16294. "func": "void SpeechSynthesis::didResumeSpeaking(PassRefPtr<PlatformSpeechSynthesisUtterance> utterance)\n{\n m_isPaused = false;\n if (utterance->client())\n fireEvent(EventTypeNames::resume, static_cast<SpeechSynthesisUtterance*>(utterance->client()), 0, String());\n}\n",
  16295. "cwe": "",
  16296. "big_vul_idx": 129891,
  16297. "idx": 116216,
  16298. "hash": 99913652828689165379332448190660030838
  16299. }
  16300. ]
  16301. },
  16302. {
  16303. "call_depth": 3,
  16304. "longest_call_chain": [
  16305. "h2_stream_out_prepare",
  16306. "add_buffered_data",
  16307. "H2_STREAM_OUT_LOG"
  16308. ],
  16309. "group_size": 4,
  16310. "functions": [
  16311. {
  16312. "func": "static void prep_output(h2_stream *stream) {\n conn_rec *c = stream->session->c;\n if (!stream->out_buffer) {\n stream->out_buffer = apr_brigade_create(stream->pool, c->bucket_alloc);\n }\n}",
  16313. "project": "httpd",
  16314. "hash": 40136342181080009612585093025690477718,
  16315. "size": 6,
  16316. "commit_id": "f990e5ecad40b100a8a5c7c1033c46044a9cb244",
  16317. "message": "mod_htt2: fix incomplete sync with latest changes in github, adjust version number.\n\n\n\ngit-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889119 13f79535-47bb-0310-9956-ffa450edef68",
  16318. "target": 0,
  16319. "dataset": "other",
  16320. "idx": 284256
  16321. },
  16322. {
  16323. "func": "static void H2_STREAM_OUT_LOG(int lvl, h2_stream *s, const char *tag)\n{\n if (APLOG_C_IS_LEVEL(s->session->c, lvl)) {\n conn_rec *c = s->session->c;\n char buffer[4 * 1024];\n apr_size_t len, bmax = sizeof(buffer)/sizeof(buffer[0]);\n \n len = h2_util_bb_print(buffer, bmax, tag, \"\", s->out_buffer);\n ap_log_cerror(APLOG_MARK, lvl, 0, c, \n H2_STRM_MSG(s, \"out-buffer(%s)\"), len? buffer : \"empty\");\n }\n}",
  16324. "project": "httpd",
  16325. "hash": 4454358511278732331951495783433715179,
  16326. "size": 12,
  16327. "commit_id": "f990e5ecad40b100a8a5c7c1033c46044a9cb244",
  16328. "message": "mod_htt2: fix incomplete sync with latest changes in github, adjust version number.\n\n\n\ngit-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889119 13f79535-47bb-0310-9956-ffa450edef68",
  16329. "target": 0,
  16330. "dataset": "other",
  16331. "idx": 284236
  16332. },
  16333. {
  16334. "func": "apr_status_t h2_stream_out_prepare(h2_stream *stream, apr_off_t *plen, \n int *peos, h2_headers **pheaders)\n{\n apr_status_t status = APR_SUCCESS;\n apr_off_t requested, missing, max_chunk = H2_DATA_CHUNK_SIZE;\n conn_rec *c;\n int complete, was_closed = 0;\n\n ap_assert(stream);\n \n if (stream->rst_error) {\n *plen = 0;\n *peos = 1;\n return APR_ECONNRESET;\n }\n \n c = stream->session->c;\n prep_output(stream);\n\n /* determine how much we'd like to send. We cannot send more than\n * is requested. But we can reduce the size in case the master\n * connection operates in smaller chunks. (TSL warmup) */\n if (stream->session->io.write_size > 0) {\n max_chunk = stream->session->io.write_size - H2_FRAME_HDR_LEN; \n }\n requested = (*plen > 0)? H2MIN(*plen, max_chunk) : max_chunk;\n \n /* count the buffered data until eos or a headers bucket */\n status = add_buffered_data(stream, requested, plen, peos, &complete, pheaders);\n \n if (status == APR_EAGAIN) {\n /* TODO: ugly, someone needs to retrieve the response first */\n h2_mplx_m_keep_active(stream->session->mplx, stream);\n ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,\n H2_STRM_MSG(stream, \"prep, response eagain\"));\n return status;\n }\n else if (status != APR_SUCCESS) {\n return status;\n }\n \n if (pheaders && *pheaders) {\n return APR_SUCCESS;\n }\n \n /* If there we do not have enough buffered data to satisfy the requested\n * length *and* we counted the _complete_ buffer (and did not stop in the middle\n * because of meta data there), lets see if we can read more from the\n * output beam */\n missing = H2MIN(requested, stream->max_mem) - *plen;\n if (complete && !*peos && missing > 0) {\n apr_status_t rv = APR_EOF;\n \n if (stream->output) {\n H2_STREAM_OUT_LOG(APLOG_TRACE2, stream, \"pre\");\n h2_beam_log(stream->output, c, APLOG_TRACE2, \"pre read output\");\n rv = h2_beam_receive(stream->output, stream->out_buffer,\n APR_NONBLOCK_READ, stream->max_mem - *plen, &was_closed);\n H2_STREAM_OUT_LOG(APLOG_TRACE2, stream, \"post\");\n h2_beam_log(stream->output, c, APLOG_TRACE2, \"post read output\");\n }\n \n if (rv == APR_SUCCESS) {\n /* count the buffer again, now that we have read output */\n status = add_buffered_data(stream, requested, plen, peos, &complete, pheaders);\n }\n else if (APR_STATUS_IS_EOF(rv)) {\n apr_bucket *eos = apr_bucket_eos_create(c->bucket_alloc);\n APR_BRIGADE_INSERT_TAIL(stream->out_buffer, eos);\n *peos = 1;\n }\n else if (APR_STATUS_IS_EAGAIN(rv)) {\n /* we set this is the status of this call only if there\n * is no buffered data, see check below */\n }\n else {\n /* real error reading. Give this back directly, even though\n * we may have something buffered. */\n status = rv;\n }\n }\n \n if (status == APR_SUCCESS) {\n if (*peos || *plen) {\n ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,\n H2_STRM_MSG(stream, \"prepare, len=%ld eos=%d\"),\n (long)*plen, *peos);\n }\n else {\n status = was_closed? APR_EOF : APR_EAGAIN;\n ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, c,\n H2_STRM_MSG(stream, \"prepare, no data\"));\n }\n }\n return status;\n}",
  16335. "project": "httpd",
  16336. "hash": 290708227288198158575844724080324981344,
  16337. "size": 96,
  16338. "commit_id": "f990e5ecad40b100a8a5c7c1033c46044a9cb244",
  16339. "message": "mod_htt2: fix incomplete sync with latest changes in github, adjust version number.\n\n\n\ngit-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889119 13f79535-47bb-0310-9956-ffa450edef68",
  16340. "target": 0,
  16341. "dataset": "other",
  16342. "idx": 284272
  16343. },
  16344. {
  16345. "func": "static apr_status_t add_buffered_data(h2_stream *stream, apr_off_t requested,\n apr_off_t *plen, int *peos, int *is_all, \n h2_headers **pheaders)\n{\n apr_bucket *b, *e;\n \n *peos = 0;\n *plen = 0;\n *is_all = 0;\n if (pheaders) {\n *pheaders = NULL;\n }\n\n H2_STREAM_OUT_LOG(APLOG_TRACE2, stream, \"add_buffered_data\");\n b = APR_BRIGADE_FIRST(stream->out_buffer);\n while (b != APR_BRIGADE_SENTINEL(stream->out_buffer)) {\n e = APR_BUCKET_NEXT(b);\n if (APR_BUCKET_IS_METADATA(b)) {\n if (APR_BUCKET_IS_FLUSH(b)) {\n APR_BUCKET_REMOVE(b);\n apr_bucket_destroy(b);\n }\n else if (APR_BUCKET_IS_EOS(b)) {\n *peos = 1;\n return APR_SUCCESS;\n }\n else if (H2_BUCKET_IS_HEADERS(b)) {\n if (*plen > 0) {\n /* data before the response, can only return up to here */\n return APR_SUCCESS;\n }\n else if (pheaders) {\n *pheaders = h2_bucket_headers_get(b);\n APR_BUCKET_REMOVE(b);\n apr_bucket_destroy(b);\n ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c,\n H2_STRM_MSG(stream, \"prep, -> response %d\"), \n (*pheaders)->status);\n return APR_SUCCESS;\n }\n else {\n return APR_EAGAIN;\n }\n }\n }\n else if (b->length == 0) {\n APR_BUCKET_REMOVE(b);\n apr_bucket_destroy(b);\n }\n else {\n ap_assert(b->length != (apr_size_t)-1);\n *plen += b->length;\n if (*plen >= requested) {\n *plen = requested;\n return APR_SUCCESS;\n }\n }\n b = e;\n }\n *is_all = 1;\n return APR_SUCCESS;\n}",
  16346. "project": "httpd",
  16347. "hash": 51145852825175780237413583367581077395,
  16348. "size": 62,
  16349. "commit_id": "f990e5ecad40b100a8a5c7c1033c46044a9cb244",
  16350. "message": "mod_htt2: fix incomplete sync with latest changes in github, adjust version number.\n\n\n\ngit-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1889119 13f79535-47bb-0310-9956-ffa450edef68",
  16351. "target": 0,
  16352. "dataset": "other",
  16353. "idx": 284250
  16354. }
  16355. ]
  16356. },
  16357. {
  16358. "call_depth": 3,
  16359. "longest_call_chain": [
  16360. "ASSERT_EQ",
  16361. "addIndex",
  16362. "runQuery"
  16363. ],
  16364. "group_size": 363,
  16365. "functions": [
  16366. {
  16367. "func": "TEST_F(QueryPlannerTest, PlansForMultipleIndexesOnTheSameKeyPatternAreGenerated) {\n CollatorInterfaceMock reverseCollator(CollatorInterfaceMock::MockType::kReverseString);\n CollatorInterfaceMock equalCollator(CollatorInterfaceMock::MockType::kAlwaysEqual);\n addIndex(BSON(\"a\" << 1), &reverseCollator, \"reverse\"_sd);\n addIndex(BSON(\"a\" << 1), &equalCollator, \"forward\"_sd);\n\n runQuery(BSON(\"a\" << 1));\n\n assertNumSolutions(3U);\n assertSolutionExists(\"{fetch: {node: {ixscan: {name: 'reverse'}}}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {name: 'forward'}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16368. "project": "mongo",
  16369. "hash": 198455623842677816529388024126112735953,
  16370. "size": 13,
  16371. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16372. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16373. "target": 0,
  16374. "dataset": "other",
  16375. "idx": 392969
  16376. },
  16377. {
  16378. "func": "TEST_F(QueryPlannerTest, OrInexactWithExact2) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuery(fromjson(\"{$or: [{a: 'foo'}, {a: /bar/}, {b: 'foo'}, {b: /bar/}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {or: {nodes: [\"\n \"{ixscan: {filter: {$or:[{a:'foo'},{a:/bar/}]},\"\n \"pattern: {a: 1}}},\"\n \"{ixscan: {filter: {$or:[{b:'foo'},{b:/bar/}]},\"\n \"pattern: {b: 1}}}]}}}}\");\n}",
  16379. "project": "mongo",
  16380. "hash": 121851799113668835604488149568830179506,
  16381. "size": 14,
  16382. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16383. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16384. "target": 0,
  16385. "dataset": "other",
  16386. "idx": 392948
  16387. },
  16388. {
  16389. "func": "TEST_F(QueryPlannerTest, HintValid) {\n addIndex(BSON(\"a\" << 1));\n runQueryHint(BSONObj(), fromjson(\"{a: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  16390. "project": "mongo",
  16391. "hash": 80260565493629234458422808208166681699,
  16392. "size": 9,
  16393. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16394. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16395. "target": 0,
  16396. "dataset": "other",
  16397. "idx": 392949
  16398. },
  16399. {
  16400. "func": "TEST_F(QueryPlannerTest, HintElemMatch) {\n // true means multikey\n addIndex(fromjson(\"{'a.b': 1}\"), true);\n runQueryHint(fromjson(\"{'a.b': 1, a: {$elemMatch: {b: 2}}}\"), fromjson(\"{'a.b': 1}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{fetch: {filter: {$and: [{a:{$elemMatch:{b:2}}}, {'a.b': 1}]}, \"\n \"node: {ixscan: {filter: null, pattern: {'a.b': 1}, bounds: \"\n \"{'a.b': [[2, 2, true, true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:{$elemMatch:{b:2}}}, \"\n \"node: {ixscan: {filter: null, pattern: {'a.b': 1}, bounds: \"\n \"{'a.b': [[1, 1, true, true]]}}}}}\");\n}",
  16401. "project": "mongo",
  16402. "hash": 208788891778337833415501622287396895159,
  16403. "size": 15,
  16404. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16405. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16406. "target": 0,
  16407. "dataset": "other",
  16408. "idx": 392950
  16409. },
  16410. {
  16411. "func": "TEST_F(QueryPlannerTest, CoveredOrUniqueIndexLookup) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1),\n false, // multikey\n false, // sparse,\n true); // unique\n\n runQuerySortProj(fromjson(\"{a: 1, b: 1}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}}}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  16412. "project": "mongo",
  16413. "hash": 181558871967494917879506872330818680867,
  16414. "size": 19,
  16415. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16416. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16417. "target": 0,
  16418. "dataset": "other",
  16419. "idx": 392951
  16420. },
  16421. {
  16422. "func": "TEST_F(QueryPlannerTest, IntersectCompoundInsteadThreeCompoundIndices) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1 << \"d\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << -1 << \"b\" << -1 << \"d\" << 1));\n runQuery(fromjson(\"{a: 1, b: 1, c: 1, d: 1}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\n \"{fetch: {filter: {$and: [{c:1},{d:1}]}, node: \"\n \"{ixscan: {filter: null, pattern: {a:1,b:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and:[{a:1},{b:1}]}, node: \"\n \"{ixscan: {filter: null, pattern: {c:1,d:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {a:1,c:-1,b:-1,d:1}}}}}\");\n}",
  16423. "project": "mongo",
  16424. "hash": 56171061150211752971823251648158435172,
  16425. "size": 18,
  16426. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16427. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16428. "target": 0,
  16429. "dataset": "other",
  16430. "idx": 392952
  16431. },
  16432. {
  16433. "func": "TEST_F(QueryPlannerTest, BasicSkipWithIndex) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuerySkipNToReturn(BSON(\"a\" << 5), 8, 0);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{skip: {n: 8, node: {cscan: {dir: 1, filter: {a: 5}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {skip: {n: 8, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}}}\");\n}",
  16434. "project": "mongo",
  16435. "hash": 43554898719219323611706682011882093421,
  16436. "size": 11,
  16437. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16438. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16439. "target": 0,
  16440. "dataset": "other",
  16441. "idx": 392953
  16442. },
  16443. {
  16444. "func": "TEST_F(QueryPlannerTest, MergeSort) {\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"b\" << 1 << \"c\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a:1}, {b:1}]}\"), fromjson(\"{c:1}\"), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: 1, c: 1}}}, {ixscan: {pattern: {b: 1, c: 1}}}]}}}}\");\n}",
  16445. "project": "mongo",
  16446. "hash": 304608409789006145410705713397100329782,
  16447. "size": 13,
  16448. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16449. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16450. "target": 0,
  16451. "dataset": "other",
  16452. "idx": 392954
  16453. },
  16454. {
  16455. "func": "TEST_F(QueryPlannerTest, MaxMinReverseIndexDir) {\n addIndex(BSON(\"a\" << -1));\n\n // Because the index is descending, the min is numerically larger than the max.\n runQueryFull(BSONObj(),\n fromjson(\"{a: -1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 8}\"),\n fromjson(\"{a: 2}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: 1, pattern: {a: -1}}}}}\");\n}",
  16456. "project": "mongo",
  16457. "hash": 125156759562937299237711571070140397694,
  16458. "size": 17,
  16459. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16460. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16461. "target": 0,
  16462. "dataset": "other",
  16463. "idx": 392956
  16464. },
  16465. {
  16466. "func": "TEST_F(QueryPlannerTest, OrElemMatchObjectBeneathAnd) {\n // true means multikey\n addIndex(BSON(\"a.b\" << 1), true);\n runQuery(\n fromjson(\"{$or: [{'a.b': 0, a: {$elemMatch: {b: {$lte: 1}}}},\"\n \"{a: {$elemMatch: {b: {$gte: 4}}}}]}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {$and:[{a:{$elemMatch:{b:{$lte:1}}}},{'a.b':0}]},\"\n \"node: {ixscan: {filter: null, pattern: {'a.b': 1}, \"\n \"bounds: {'a.b': [[-Infinity,1,true,true]]}}}}},\"\n \"{fetch: {filter: {a:{$elemMatch:{b:{$gte:4}}}}, node: \"\n \"{ixscan: {filter: null, pattern: {'a.b': 1},\"\n \"bounds: {'a.b': [[4,Infinity,true,true]]}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {a:{$elemMatch:{b:{$lte:1}}}},\"\n \"node: {ixscan: {filter: null, pattern: {'a.b': 1}, \"\n \"bounds: {'a.b': [[0,0,true,true]]}}}}},\"\n \"{fetch: {filter: {a:{$elemMatch:{b:{$gte:4}}}}, node: \"\n \"{ixscan: {filter: null, pattern: {'a.b': 1},\"\n \"bounds: {'a.b': [[4,Infinity,true,true]]}}}}}]}}\");\n}",
  16467. "project": "mongo",
  16468. "hash": 181527015787656973917680646316306299266,
  16469. "size": 26,
  16470. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16471. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16472. "target": 0,
  16473. "dataset": "other",
  16474. "idx": 392957
  16475. },
  16476. {
  16477. "func": "TEST_F(QueryPlannerTest, UniqueIndexLookupBelowOrBelowAnd) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"d\" << 1),\n false, // multikey\n false, // sparse,\n true); // unique\n\n runQuery(fromjson(\"{e: 1, $or: [{a: 1, b: 1}, {c: 1, d: 1}]}\"));\n\n // Only two plans because we throw out plans for the right branch of the $or that do not\n // use equality over the unique index.\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{fetch: {filter: {e: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {a: 1}, node: {ixscan: {pattern: {b: 1}}}}},\"\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {d: 1}}}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {e: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}}}}},\"\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {d: 1}}}}}\"\n \"]}}}}\");\n}",
  16478. "project": "mongo",
  16479. "hash": 52588037895952951347109009505852321196,
  16480. "size": 27,
  16481. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16482. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16483. "target": 0,
  16484. "dataset": "other",
  16485. "idx": 392960
  16486. },
  16487. {
  16488. "func": "TEST_F(QueryPlannerTest, MaxMinSortEqualityFirstSortSecond) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n // Run an empty query, sort {b: 1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{b: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 1, b: 1}\"),\n fromjson(\"{a: 1, b: 2}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  16489. "project": "mongo",
  16490. "hash": 21219611244008279236198559574896527764,
  16491. "size": 17,
  16492. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16493. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16494. "target": 0,
  16495. "dataset": "other",
  16496. "idx": 392961
  16497. },
  16498. {
  16499. "func": "TEST_F(QueryPlannerTest, DoublyContainedOr) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n addIndex(BSON(\"d\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{$or: [{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}, {d: 8}]}, {e: 9}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {e: 9}, node: {or: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \"\n \"true]]}}}]}},\"\n \"{ixscan: {pattern: {d: 1}, bounds: {d: [[8, 8, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16500. "project": "mongo",
  16501. "hash": 295041144891101498662123554239506488915,
  16502. "size": 19,
  16503. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16504. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16505. "target": 0,
  16506. "dataset": "other",
  16507. "idx": 392962
  16508. },
  16509. {
  16510. "func": "TEST_F(QueryPlannerTest, BasicLimitNoIndex) {\n addIndex(BSON(\"a\" << 1));\n\n runQuerySkipNToReturn(BSON(\"x\" << 5), 0, -3);\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{limit: {n: 3, node: {cscan: {dir: 1, filter: {x: 5}}}}}\");\n}",
  16511. "project": "mongo",
  16512. "hash": 254294725460736824874547505476587464790,
  16513. "size": 8,
  16514. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16515. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16516. "target": 0,
  16517. "dataset": "other",
  16518. "idx": 392963
  16519. },
  16520. {
  16521. "func": "TEST_F(QueryPlannerTest, ContainedOrMultikeyCannotCompoundFields) {\n const bool multikey = true;\n addIndex(BSON(\"a.c\" << 1 << \"a.b\" << 1), multikey);\n addIndex(BSON(\"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{'a.b': 5}, {$or: [{'a.c': 6}, {d: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {'a.b': 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {'a.c': 1, 'a.b': 1}, bounds: {'a.c': [[6, 6, true, true]], 'a.b': \"\n \"[['MinKey', 'MaxKey', true, true]]}}},\"\n \"{ixscan: {pattern: {d: 1}, bounds: {d: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16522. "project": "mongo",
  16523. "hash": 29540912720737471750019215660318320637,
  16524. "size": 15,
  16525. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16526. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16527. "target": 0,
  16528. "dataset": "other",
  16529. "idx": 392964
  16530. },
  16531. {
  16532. "func": "TEST_F(QueryPlannerTest, OrOnlyOneBranchCanUseIndex) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a:1}, {b:2}]}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  16533. "project": "mongo",
  16534. "hash": 306862859382702101704454013802556213843,
  16535. "size": 7,
  16536. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16537. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16538. "target": 0,
  16539. "dataset": "other",
  16540. "idx": 392965
  16541. },
  16542. {
  16543. "func": "TEST_F(QueryPlannerTest, NoKeepWithIndexedSort) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProjSkipNToReturn(fromjson(\"{a: {$in: [1, 2]}}\"), BSON(\"b\" << 1), BSONObj(), 0, 1);\n\n // cscan solution exists but we didn't turn on the \"always include a collscan.\"\n assertNumSolutions(1);\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: 1, b: 1}}}, {ixscan: {pattern: {a: 1, b: 1}}}]}}}}\");\n}",
  16544. "project": "mongo",
  16545. "hash": 135593506136778899895372036752482372004,
  16546. "size": 11,
  16547. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16548. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16549. "target": 0,
  16550. "dataset": "other",
  16551. "idx": 392966
  16552. },
  16553. {
  16554. "func": "TEST_F(QueryPlannerTest, OrOfAnd6) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{$or: [{a:{$in:[1]},b:{$in:[1]}}, {a:{$in:[1,5]},b:{$in:[1,5]}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a:1,b:1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [[1,1,true,true]]}}}, \"\n \"{ixscan: {pattern: {a:1,b:1}, bounds: \"\n \"{a: [[1,1,true,true], [5,5,true,true]], \"\n \" b: [[1,1,true,true], [5,5,true,true]]}}}]}}}}\");\n}",
  16555. "project": "mongo",
  16556. "hash": 285352732317452116289367520200409281972,
  16557. "size": 14,
  16558. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16559. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16560. "target": 0,
  16561. "dataset": "other",
  16562. "idx": 392967
  16563. },
  16564. {
  16565. "func": "TEST_F(QueryPlannerTest, OrOfAnd2) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a:{$gt:2,$lt:10}}, {a:{$gt:0,$lt:15}}, {a:{$gt:20}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a:1}, bounds: {a: [[2,10,false,false]]}}}, \"\n \"{ixscan: {pattern: {a:1}, bounds: {a: [[0,15,false,false]]}}}, \"\n \"{ixscan: {pattern: {a:1}, bounds: \"\n \"{a: [[20,Infinity,false,true]]}}}]}}}}\");\n}",
  16566. "project": "mongo",
  16567. "hash": 282003058567225016454846367400133573468,
  16568. "size": 13,
  16569. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16570. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16571. "target": 0,
  16572. "dataset": "other",
  16573. "idx": 392968
  16574. },
  16575. {
  16576. "func": "TEST_F(QueryPlannerTest, PlannerAddsFetchToIxscanForCountWhenFetchFilterNonempty) {\n params.options = QueryPlannerParams::IS_COUNT;\n addIndex(BSON(\"x\" << 1));\n runQuery(BSON(\"y\" << 3 << \"x\" << 5));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{fetch: {filter: {y: 3}, node: {ixscan: \"\n \"{pattern: {x: 1}, bounds: {x: [[5,5,true,true]]}}}}}\");\n}",
  16577. "project": "mongo",
  16578. "hash": 270349135524847438804280100205822850245,
  16579. "size": 9,
  16580. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16581. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16582. "target": 0,
  16583. "dataset": "other",
  16584. "idx": 392970
  16585. },
  16586. {
  16587. "func": "TEST_F(QueryPlannerTest, ContainedOrNotPredicateIsLeadingFieldInBothBranchesIndexIntersection) {\n params.options = QueryPlannerParams::INCLUDE_COLLSCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{$nor: [{a: 5}]}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(6);\n // The filter is {$not: {a: 5}}, but there is no way to write a BSON expression that will parse\n // to that MatchExpression.\n assertSolutionExists(\n \"{fetch: {node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], c: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n // The AND_HASH stage is not really needed, since the predicate {a: 5} is covered by the indexed\n // OR.\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [[6, 6, true, true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], c: [[7, 7, true, true]]}}}]}},\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [[6, 6, true, true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], c: [[7, 7, true, true]]}}}]}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], c: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16588. "project": "mongo",
  16589. "hash": 133642935940917176662062021108660170205,
  16590. "size": 51,
  16591. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16592. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16593. "target": 0,
  16594. "dataset": "other",
  16595. "idx": 392971
  16596. },
  16597. {
  16598. "func": "TEST_F(QueryPlannerTest, OrNaturalHint) {\n addIndex(BSON(\"a\" << 1));\n runQueryHint(fromjson(\"{$or: [{a:1}, {a:3}]}\"), fromjson(\"{$natural:1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  16599. "project": "mongo",
  16600. "hash": 1865491846805003053665503949778414955,
  16601. "size": 7,
  16602. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16603. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16604. "target": 0,
  16605. "dataset": "other",
  16606. "idx": 392973
  16607. },
  16608. {
  16609. "func": "TEST_F(QueryPlannerTest, SnapshotUseId) {\n params.options = QueryPlannerParams::SNAPSHOT_USE_ID;\n\n addIndex(BSON(\"a\" << 1));\n runQuerySnapshot(fromjson(\"{a: {$gt: 0}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: {a:{$gt:0}}, node: \"\n \"{ixscan: {filter: null, pattern: {_id: 1}}}}}\");\n}",
  16610. "project": "mongo",
  16611. "hash": 333301148259395283688982947776999369092,
  16612. "size": 11,
  16613. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16614. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16615. "target": 0,
  16616. "dataset": "other",
  16617. "idx": 392974
  16618. },
  16619. {
  16620. "func": "TEST_F(QueryPlannerTest, NegationTypeOperator) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$type: 16}}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  16621. "project": "mongo",
  16622. "hash": 257471595677310198167228440611286154681,
  16623. "size": 7,
  16624. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16625. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16626. "target": 0,
  16627. "dataset": "other",
  16628. "idx": 392975
  16629. },
  16630. {
  16631. "func": "TEST_F(QueryPlannerTest, ShardFilterNestedProjCovered) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\" << 1 << \"b.c\" << 1);\n addIndex(BSON(\"a\" << 1 << \"b.c\" << 1));\n\n runQuerySortProj(fromjson(\"{a: 1}\"), BSONObj(), fromjson(\"{_id: 0, a: 1, 'b.c': 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, 'b.c': 1 }, type: 'default', node: \"\n \"{sharding_filter: {node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, 'b.c': 1}}}}}}}\");\n}",
  16632. "project": "mongo",
  16633. "hash": 17018540278954353104665224830406999671,
  16634. "size": 13,
  16635. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16636. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16637. "target": 0,
  16638. "dataset": "other",
  16639. "idx": 392976
  16640. },
  16641. {
  16642. "func": "TEST_F(QueryPlannerTest, ContainedOr) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16643. "project": "mongo",
  16644. "hash": 186660324589391123840831133164117743543,
  16645. "size": 15,
  16646. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16647. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16648. "target": 0,
  16649. "dataset": "other",
  16650. "idx": 392977
  16651. },
  16652. {
  16653. "func": "TEST_F(QueryPlannerTest, IntersectBasicTwoPredCompoundMatchesIdxOrder2) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{a:1, b:1}\"));\n\n assertNumSolutions(3U);\n\n assertSolutionExists(\n \"{fetch: {filter: {b:1}, node: \"\n \"{ixscan: {filter: null, pattern: {a:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:1}, node: \"\n \"{ixscan: {filter: null, pattern: {b:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1}}},\"\n \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\");\n}",
  16654. "project": "mongo",
  16655. "hash": 327508292717420954844687111566340891558,
  16656. "size": 19,
  16657. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16658. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16659. "target": 0,
  16660. "dataset": "other",
  16661. "idx": 392978
  16662. },
  16663. {
  16664. "func": "TEST_F(QueryPlannerTest, SolutionSetStableWhenOrEnumerationLimitIsReached) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"d\" << 1));\n addIndex(BSON(\"e\" << 1));\n addIndex(BSON(\"f\" << 1));\n addIndex(BSON(\"f\" << 1 << \"y\" << 1));\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"c\" << 1 << \"x\" << 1));\n\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {$or: [{a: 1, b: 1, c: 1}, {d: 1, e: 1, f: 1}]}}\"));\n\n assertNumSolutions(10U);\n\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {b: {$eq: 1}, c: {$eq: 1} }, node: {ixscan: {pattern: {a: \"\n \"1}}}}}, {fetch: {filter: {e: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {d: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {a: {$eq: 1}, c: {$eq: 1} }, node: {ixscan: {pattern: {b: \"\n \"1}}}}}, {fetch: {filter: {e: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {d: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {a: {$eq: 1}, b: {$eq: 1} }, node: {ixscan: {pattern: {c: \"\n \"1}}}}}, {fetch: {filter: {e: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {d: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {a: {$eq: 1}, b: {$eq: 1} }, node: {ixscan: {pattern: {c: \"\n \"1, x: 1}}}}}, {fetch: {filter: {e: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {d: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {b: {$eq: 1}, c: {$eq: 1} }, node: {ixscan: {pattern: {a: \"\n \"1}}}}}, {fetch: {filter: {d: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {e: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {a: {$eq: 1}, c: {$eq: 1} }, node: {ixscan: {pattern: {b: \"\n \"1}}}}}, {fetch: {filter: {d: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {e: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {a: {$eq: 1}, b: {$eq: 1} }, node: {ixscan: {pattern: {c: \"\n \"1}}}}}, {fetch: {filter: {d: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {e: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {a: {$eq: 1}, b: {$eq: 1} }, node: {ixscan: {pattern: {c: \"\n \"1, x: 1}}}}}, {fetch: {filter: {d: {$eq: 1}, f: {$eq: 1} }, node: {ixscan: {pattern: {e: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {b: {$eq: 1}, c: {$eq: 1} }, node: {ixscan: {pattern: {a: \"\n \"1}}}}}, {fetch: {filter: {d: {$eq: 1}, e: {$eq: 1} }, node: {ixscan: {pattern: {f: \"\n \"1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {a: {$eq: 1}, c: {$eq: 1} }, node: {ixscan: {pattern: {b: \"\n \"1}}}}}, {fetch: {filter: {d: {$eq: 1}, e: {$eq: 1} }, node: {ixscan: {pattern: {f: \"\n \"1}}}}}]}}\");\n}",
  16665. "project": "mongo",
  16666. "hash": 111447291020624182952308140967815206000,
  16667. "size": 57,
  16668. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16669. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16670. "target": 0,
  16671. "dataset": "other",
  16672. "idx": 392979
  16673. },
  16674. {
  16675. "func": "TEST_F(QueryPlannerTest, NonPrefixRegexCovering) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{a: /foo/}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1, filter: {a: /foo/}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: {a: /foo/}, pattern: {a: 1}}}}}\");\n}",
  16676. "project": "mongo",
  16677. "hash": 1721131087690443165402550830441622189,
  16678. "size": 12,
  16679. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16680. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16681. "target": 0,
  16682. "dataset": "other",
  16683. "idx": 392980
  16684. },
  16685. {
  16686. "func": "TEST_F(QueryPlannerTest, TooManyToExplodeOr) {\n addIndex(BSON(\"a\" << 1 << \"e\" << 1));\n addIndex(BSON(\"b\" << 1 << \"e\" << 1));\n addIndex(BSON(\"c\" << 1 << \"e\" << 1));\n addIndex(BSON(\"d\" << 1 << \"e\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a: {$in: [1,2,3,4,5,6]},\"\n \"b: {$in: [1,2,3,4,5,6]}},\"\n \"{c: {$in: [1,2,3,4,5,6]},\"\n \"d: {$in: [1,2,3,4,5,6]}}]}\"),\n BSON(\"e\" << 1),\n BSONObj());\n\n // We cap the # of ixscans we're willing to create, so we don't get explosion. Instead\n // we get 5 different solutions which all use a blocking sort.\n assertNumSolutions(5U);\n assertSolutionExists(\n \"{sort: {pattern: {e: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {e: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{or: {nodes: [\"\n \"{fetch: {node: {ixscan: {pattern: {a: 1, e: 1}}}}},\"\n \"{fetch: {node: {ixscan: {pattern: {c: 1, e: 1}}}}}]}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {e: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{or: {nodes: [\"\n \"{fetch: {node: {ixscan: {pattern: {b: 1, e: 1}}}}},\"\n \"{fetch: {node: {ixscan: {pattern: {c: 1, e: 1}}}}}]}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {e: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{or: {nodes: [\"\n \"{fetch: {node: {ixscan: {pattern: {a: 1, e: 1}}}}},\"\n \"{fetch: {node: {ixscan: {pattern: {d: 1, e: 1}}}}}]}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {e: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{or: {nodes: [\"\n \"{fetch: {node: {ixscan: {pattern: {b: 1, e: 1}}}}},\"\n \"{fetch: {node: {ixscan: {pattern: {d: 1, e: 1}}}}}]}}}}}}\");\n}",
  16687. "project": "mongo",
  16688. "hash": 256571774132281737223534625893788359343,
  16689. "size": 39,
  16690. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16691. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16692. "target": 0,
  16693. "dataset": "other",
  16694. "idx": 392981
  16695. },
  16696. {
  16697. "func": "TEST_F(QueryPlannerTest, CannotTrimIxisectAndHashWithOrChild) {\n params.options = QueryPlannerParams::CANNOT_TRIM_IXISECT;\n params.options |= QueryPlannerParams::INDEX_INTERSECTION;\n params.options |= QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{c: 1, $or: [{a: 1}, {b: 1, d: 1}]}\"));\n\n assertNumSolutions(3U);\n\n assertSolutionExists(\n \"{fetch: {filter: {c: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {d: 1}, node: {ixscan: {filter: null,\"\n \"pattern: {b: 1}, bounds: {b: [[1,1,true,true]]}}}}},\"\n \"{ixscan: {filter: null, pattern: {a: 1},\"\n \"bounds: {a: [[1,1,true,true]]}}}]}}}}\");\n\n assertSolutionExists(\n \"{fetch: {filter: {$or:[{b:1,d:1},{a:1}]}, node:\"\n \"{ixscan: {filter: null, pattern: {c: 1}}}}}\");\n\n assertSolutionExists(\n \"{fetch: {filter: {c:1,$or:[{a:1},{b:1,d:1}]}, node:{andHash:{nodes:[\"\n \"{or: {nodes: [\"\n \"{fetch: {filter: {d:1}, node: {ixscan: {pattern: {b: 1}}}}},\"\n \"{ixscan: {filter: null, pattern: {a: 1}}}]}},\"\n \"{ixscan: {filter: null, pattern: {c: 1}}}]}}}}\");\n}",
  16698. "project": "mongo",
  16699. "hash": 86853219372656470344511613642272737214,
  16700. "size": 31,
  16701. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16702. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16703. "target": 0,
  16704. "dataset": "other",
  16705. "idx": 392982
  16706. },
  16707. {
  16708. "func": "TEST_F(QueryPlannerTest, EqCanUseHashedIndexWithRegex) {\n addIndex(BSON(\"a\"\n << \"hashed\"));\n runQuery(fromjson(\"{a: {$eq: /abc/}}\"));\n ASSERT_EQUALS(getNumSolutions(), 2U);\n}",
  16709. "project": "mongo",
  16710. "hash": 329184939987602600701929125985720067854,
  16711. "size": 6,
  16712. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16713. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16714. "target": 0,
  16715. "dataset": "other",
  16716. "idx": 392983
  16717. },
  16718. {
  16719. "func": "TEST_F(QueryPlannerTest, NegatedRangeStrGT) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$gt: 'a'}}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {i:1}, \"\n \"bounds: {i: [['MinKey','a',true,true], \"\n \"[{},'MaxKey',true,true]]}}}}}\");\n}",
  16720. "project": "mongo",
  16721. "hash": 16473380221722057748412641445386411996,
  16722. "size": 11,
  16723. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16724. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16725. "target": 0,
  16726. "dataset": "other",
  16727. "idx": 392984
  16728. },
  16729. {
  16730. "func": "TEST_F(QueryPlannerTest, ContainedOrCombineWithAnd) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1 << \"d\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {$and: [{c: 7}, {d: 8}]}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1, d: 1, a: 1}, bounds: {c: [[7, 7, true, true]], d: [[8, 8, true, \"\n \"true]], a: [[5, 5, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16731. "project": "mongo",
  16732. "hash": 311708074705498963752449838217220008251,
  16733. "size": 15,
  16734. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16735. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16736. "target": 0,
  16737. "dataset": "other",
  16738. "idx": 392985
  16739. },
  16740. {
  16741. "func": "TEST_F(QueryPlannerTest, BasicSort) {\n addIndex(BSON(\"x\" << 1));\n runQuerySortProj(BSONObj(), BSON(\"x\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {x: 1}, limit: 0, node: {sortKeyGen:\"\n \"{node: {cscan: {dir: 1, filter: {}}}}}}}\");\n}",
  16742. "project": "mongo",
  16743. "hash": 217265805864792420472348568227788134682,
  16744. "size": 12,
  16745. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16746. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16747. "target": 0,
  16748. "dataset": "other",
  16749. "idx": 392986
  16750. },
  16751. {
  16752. "func": "TEST_F(QueryPlannerTest, CantExplodeWithEmptyBounds2) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQuerySortProj(fromjson(\"{a: {$gt: 3, $lt: 0}}\"), BSON(\"b\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a:1,b:1,c:1}}}}}}}}}\");\n}",
  16753. "project": "mongo",
  16754. "hash": 19533249080697270634894586683073855428,
  16755. "size": 12,
  16756. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16757. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16758. "target": 0,
  16759. "dataset": "other",
  16760. "idx": 392987
  16761. },
  16762. {
  16763. "func": "TEST_F(QueryPlannerTest, OrElemMatchObject) {\n // true means multikey\n addIndex(BSON(\"a.b\" << 1), true);\n runQuery(\n fromjson(\"{$or: [{a: {$elemMatch: {b: {$lte: 1}}}},\"\n \"{a: {$elemMatch: {b: {$gte: 4}}}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {a:{$elemMatch:{b:{$gte:4}}}}, node: \"\n \"{ixscan: {filter: null, pattern: {'a.b': 1}}}}},\"\n \"{fetch: {filter: {a:{$elemMatch:{b:{$lte:1}}}}, node: \"\n \"{ixscan: {filter: null, pattern: {'a.b': 1}}}}}]}}\");\n}",
  16764. "project": "mongo",
  16765. "hash": 315969726725406376553296370162391589634,
  16766. "size": 16,
  16767. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16768. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16769. "target": 0,
  16770. "dataset": "other",
  16771. "idx": 392988
  16772. },
  16773. {
  16774. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicateIsLeadingFieldIndexIntersection) {\n params.options = QueryPlannerParams::INCLUDE_COLLSCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}]}},\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16775. "project": "mongo",
  16776. "hash": 113082058653984962432990439989387551304,
  16777. "size": 29,
  16778. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16779. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16780. "target": 0,
  16781. "dataset": "other",
  16782. "idx": 392989
  16783. },
  16784. {
  16785. "func": "TEST_F(QueryPlannerTest, BasicCompound) {\n addIndex(BSON(\"x\" << 1 << \"y\" << 1));\n runQuery(fromjson(\"{ x : 5, y: 10}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1, y: 1}}}}}\");\n}",
  16786. "project": "mongo",
  16787. "hash": 105814914349035462271666363771612204247,
  16788. "size": 10,
  16789. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16790. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16791. "target": 0,
  16792. "dataset": "other",
  16793. "idx": 392990
  16794. },
  16795. {
  16796. "func": "TEST_F(QueryPlannerTest, RootedOrOfAndDontCollapseDifferentBounds) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1 << \"d\" << 1));\n runQuery(fromjson(\"{$or: [{a: 1, b: 2}, {c: 3, d: 4}, {a: 1, b: 99}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, filter: null,\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1}, filter: null,\"\n \"bounds: {a: [[1,1,true,true]], b: [[99,99,true,true]]}}},\"\n \"{ixscan: {pattern: {c: 1, d: 1}, filter: null,\"\n \"bounds: {c: [[3,3,true,true]], d: [[4,4,true,true]]}}}]}}}}\");\n}",
  16797. "project": "mongo",
  16798. "hash": 72171021966273478200249639131774740917,
  16799. "size": 16,
  16800. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16801. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16802. "target": 0,
  16803. "dataset": "other",
  16804. "idx": 392991
  16805. },
  16806. {
  16807. "func": "TEST_F(QueryPlannerTest, NoSplitLimitedSortAsCommandBatchSize) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n params.options |= QueryPlannerParams::SPLIT_LIMITED_SORT;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n\n runQueryAsCommand(fromjson(\"{find: 'testns', filter: {a: 1}, sort: {b: 1}, batchSize: 3}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{fetch: {filter: {a: 1}, node: {ixscan: \"\n \"{filter: null, pattern: {b: 1}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: {fetch: {filter: null,\"\n \"node: {ixscan: {pattern: {a: 1}}}}}}}}}\");\n}",
  16808. "project": "mongo",
  16809. "hash": 89611039149358332783786100965974241560,
  16810. "size": 16,
  16811. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16812. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16813. "target": 0,
  16814. "dataset": "other",
  16815. "idx": 392992
  16816. },
  16817. {
  16818. "func": "TEST_F(QueryPlannerTest, OrWithExactAndInexact3) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuery(\n fromjson(\"{$or: [{a: {$in: [/z/, /x/]}}, {a: 'w'},\"\n \"{b: {$exists: false}}, {b: {$in: ['p']}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {filter: {$or:[{a:{$in:[/z/, /x/]}}, {a:'w'}]}, \"\n \"pattern: {a: 1}}}, \"\n \"{fetch: {filter: {$or:[{b:{$exists:false}}, {b:{$eq:'p'}}]},\"\n \"node: {ixscan: {filter: null, pattern: {b: 1}}}}}]}}}}\");\n}",
  16819. "project": "mongo",
  16820. "hash": 330275366425900250861806301466654184146,
  16821. "size": 16,
  16822. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16823. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16824. "target": 0,
  16825. "dataset": "other",
  16826. "idx": 392993
  16827. },
  16828. {
  16829. "func": "TEST_F(QueryPlannerTest, OrWithExactAndInexact) {\n addIndex(BSON(\"name\" << 1));\n runQuery(fromjson(\"{name: {$in: ['thomas', /^alexand(er|ra)/]}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: {name: {$in: ['thomas', /^alexand(er|ra)/]}}, \"\n \"pattern: {name: 1}}}}}\");\n}",
  16830. "project": "mongo",
  16831. "hash": 80207113361846877295728454726582812225,
  16832. "size": 11,
  16833. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16834. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16835. "target": 0,
  16836. "dataset": "other",
  16837. "idx": 392994
  16838. },
  16839. {
  16840. "func": "TEST_F(QueryPlannerTest, MergeSortReverseSubtreeContainedOr) {\n addIndex(BSON(\"a\" << 1 << \"e\" << 1));\n addIndex(BSON(\"c\" << 1 << \"e\" << -1));\n addIndex(BSON(\"d\" << 1 << \"e\" << -1));\n runQueryAsCommand(fromjson(\n \"{find: 'testns', filter: {$or: [{a: 1}, {b: 1, $or: [{c: 1}, {d: 1}]}]}, sort: {e: 1}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {e: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: 1, e: 1}, dir: 1}}, {fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {c: 1, e: -1}, dir: -1}}, {ixscan: {pattern: {d: 1, e: -1}, dir: \"\n \"-1}}]}}}}]}}}}\");\n}",
  16841. "project": "mongo",
  16842. "hash": 257909252366485045235124496144368749923,
  16843. "size": 17,
  16844. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16845. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16846. "target": 0,
  16847. "dataset": "other",
  16848. "idx": 392995
  16849. },
  16850. {
  16851. "func": "TEST_F(QueryPlannerTest, NegatedRangeStrGTE) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$gte: 'a'}}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {i:1}, \"\n \"bounds: {i: [['MinKey','a',true,false], \"\n \"[{},'MaxKey',true,true]]}}}}}\");\n}",
  16852. "project": "mongo",
  16853. "hash": 171392284488014382554287816096243117123,
  16854. "size": 11,
  16855. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16856. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16857. "target": 0,
  16858. "dataset": "other",
  16859. "idx": 392996
  16860. },
  16861. {
  16862. "func": "TEST_F(QueryPlannerTest, MaxMinBadHintSelectsReverseIndex) {\n // There are both ascending and descending indices on 'a'.\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << -1));\n\n // A query hinting on {a: 1} is bad if min is {a: 8} and {a: 2} because this\n // min/max pairing requires a descending index.\n runInvalidQueryFull(BSONObj(),\n BSONObj(),\n BSONObj(),\n 0,\n 0,\n fromjson(\"{a: 1}\"),\n fromjson(\"{a: 8}\"),\n fromjson(\"{a: 2}\"),\n false);\n}",
  16863. "project": "mongo",
  16864. "hash": 188808043404630753684467616325081895391,
  16865. "size": 17,
  16866. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16867. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16868. "target": 0,
  16869. "dataset": "other",
  16870. "idx": 392997
  16871. },
  16872. {
  16873. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCompoundTrailingFields) {\n MultikeyPaths multikeyPaths{{}, {0U}, {}};\n addIndex(BSON(\"b\" << 1 << \"a\" << 1 << \"c\" << 1), multikeyPaths);\n addIndex(BSON(\"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1, c: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]], c: [[7, 7, true, true]]}}},\"\n \"{ixscan: {pattern: {d: 1}, bounds: {d: [[8, 8, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16874. "project": "mongo",
  16875. "hash": 63749766463167541448626050265849282862,
  16876. "size": 15,
  16877. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16878. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16879. "target": 0,
  16880. "dataset": "other",
  16881. "idx": 392998
  16882. },
  16883. {
  16884. "func": "TEST_F(QueryPlannerTest, HintInvalid) {\n addIndex(BSON(\"a\" << 1));\n runInvalidQueryHint(BSONObj(), fromjson(\"{b: 1}\"));\n}",
  16885. "project": "mongo",
  16886. "hash": 254027827072996822099551485740747826636,
  16887. "size": 4,
  16888. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16889. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16890. "target": 0,
  16891. "dataset": "other",
  16892. "idx": 392999
  16893. },
  16894. {
  16895. "func": "TEST_F(QueryPlannerTest, ExplodeMustReverseScans2) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << -1));\n runQuerySortProj(fromjson(\"{a: {$in: [1, 2]}, b: {$in: [3, 4]}}\"), BSON(\"c\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a:1, b:1, c:-1}}},\"\n \"{ixscan: {pattern: {a:1, b:1, c:-1}}},\"\n \"{ixscan: {pattern: {a:1, b:1, c:-1}}},\"\n \"{ixscan: {pattern: {a:1, b:1, c:-1}}}]}}}}\");\n}",
  16896. "project": "mongo",
  16897. "hash": 253692919097848429964890428623868225272,
  16898. "size": 15,
  16899. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16900. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16901. "target": 0,
  16902. "dataset": "other",
  16903. "idx": 393000
  16904. },
  16905. {
  16906. "func": "TEST_F(QueryPlannerTest, InWithoutSort) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n // No sort means we don't bother to blow up the bounds.\n runQuerySortProjSkipNToReturn(fromjson(\"{a: {$in: [1, 2]}}\"), BSONObj(), BSONObj(), 0, 1);\n\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1}}}}}\");\n}",
  16907. "project": "mongo",
  16908. "hash": 179176570109185465288913271039293422577,
  16909. "size": 8,
  16910. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16911. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16912. "target": 0,
  16913. "dataset": "other",
  16914. "idx": 393001
  16915. },
  16916. {
  16917. "func": "TEST_F(QueryPlannerTest, ContainedOrOnePredicateIsLeadingField) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {b: 6}, {$or: [{c: 7}, {d: 8}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]], c: [[7, 7, true, true]]}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, d: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]], d: [[8, 8, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{c: 7}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]], c: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{c: 7}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1, d: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]], d: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16918. "project": "mongo",
  16919. "hash": 204881056938452422231519917956654328764,
  16920. "size": 25,
  16921. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16922. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16923. "target": 0,
  16924. "dataset": "other",
  16925. "idx": 393002
  16926. },
  16927. {
  16928. "func": "TEST_F(QueryPlannerTest, AndHashRequiresKeepMutations) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n params.options |= QueryPlannerParams::INDEX_INTERSECTION;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuery(fromjson(\"{a: {$gte: 0}, b: {$gte: 0}}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\"{fetch: {filter: {a: {$gte: 0}}, node: {ixscan: {pattern: {b: 1}}}}}\");\n assertSolutionExists(\"{fetch: {filter: {b: {$gte: 0}}, node: {ixscan: {pattern: {a: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {keep: {node: {andHash: {nodes: [\"\n \"{ixscan: {pattern: {a: 1}}},\"\n \"{ixscan: {pattern: {b: 1}}}]}}}}}}\");\n}",
  16929. "project": "mongo",
  16930. "hash": 201750723870327355456982862463363885595,
  16931. "size": 16,
  16932. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16933. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16934. "target": 0,
  16935. "dataset": "other",
  16936. "idx": 393003
  16937. },
  16938. {
  16939. "func": "TEST_F(QueryPlannerTest, OrInexactCoveredMultikey) {\n // true means multikey\n addIndex(BSON(\"names\" << 1), true);\n runQuery(fromjson(\"{$or: [{names: 'dave'}, {names: /joe/}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{names: 'dave'}, {names: /joe/}]}, \"\n \"node: {ixscan: {filter: null, pattern: {names: 1}}}}}\");\n}",
  16940. "project": "mongo",
  16941. "hash": 147805261840231643687455081438597065978,
  16942. "size": 11,
  16943. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16944. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16945. "target": 0,
  16946. "dataset": "other",
  16947. "idx": 393004
  16948. },
  16949. {
  16950. "func": "TEST_F(QueryPlannerTest, NoKeepWithGeoNear) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n addIndex(BSON(\"a\"\n << \"2d\"));\n runQuery(fromjson(\"{a: {$near: [0,0], $maxDistance:0.3 }}\"));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{geoNear2d: {a: '2d'}}\");\n}",
  16951. "project": "mongo",
  16952. "hash": 46587417641888873059257343524561468977,
  16953. "size": 8,
  16954. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16955. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16956. "target": 0,
  16957. "dataset": "other",
  16958. "idx": 393005
  16959. },
  16960. {
  16961. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicateIsLeadingFieldInBothBranchesIndexIntersection) {\n params.options = QueryPlannerParams::INCLUDE_COLLSCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(6);\n assertSolutionExists(\n \"{fetch: {node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[5, 5, true, true]], c: [[7, 7, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[5, 5, true, true]], c: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n // The AND_HASH stage is not really needed, since the predicate {a: 5} is covered by the indexed\n // OR.\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[5, 5, true, true]], c: [[7, 7, true, \"\n \"true]]}}}]}},\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[5, 5, true, true]], c: [[7, 7, true, \"\n \"true]]}}}]}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[5, 5, true, true]], c: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  16962. "project": "mongo",
  16963. "hash": 292357845707641846819653086566596803916,
  16964. "size": 48,
  16965. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16966. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16967. "target": 0,
  16968. "dataset": "other",
  16969. "idx": 393006
  16970. },
  16971. {
  16972. "func": "TEST_F(QueryPlannerTest, CompoundMultikeyBounds) {\n // true means multikey\n addIndex(BSON(\"a\" << 1 << \"b\" << 1), true);\n runQuery(fromjson(\"{a: 1, b: 3}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {filter: {$and:[{a:1},{b:3}]}, dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {filter: null, \"\n \"pattern: {a:1,b:1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [[3,3,true,true]]}}}}}\");\n}",
  16973. "project": "mongo",
  16974. "hash": 65080053636428819698754824329221170690,
  16975. "size": 12,
  16976. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16977. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16978. "target": 0,
  16979. "dataset": "other",
  16980. "idx": 393007
  16981. },
  16982. {
  16983. "func": "TEST_F(QueryPlannerTest, IndexBoundsOrOfNegations) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a: {$ne: 3}}, {a: {$ne: 4}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [['MinKey','MaxKey',true,true]]}}}}}\");\n}",
  16984. "project": "mongo",
  16985. "hash": 308495835767918118845200146424409035317,
  16986. "size": 10,
  16987. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16988. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  16989. "target": 0,
  16990. "dataset": "other",
  16991. "idx": 393008
  16992. },
  16993. {
  16994. "func": "TEST_F(QueryPlannerTest, ShardFilterHashProjNotCovered) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\"\n << \"hashed\");\n addIndex(BSON(\"a\"\n << \"hashed\"));\n\n runQuerySortProj(fromjson(\"{a: 1}\"), BSONObj(), fromjson(\"{_id : 0, a : 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0,a: 1}, type: 'simple', node: \"\n \"{sharding_filter : {node: \"\n \"{fetch: {node: \"\n \"{ixscan: {pattern: {a: 'hashed'}}}}}}}}}\");\n}",
  16995. "project": "mongo",
  16996. "hash": 256607511838731294561951487423280807566,
  16997. "size": 16,
  16998. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  16999. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17000. "target": 0,
  17001. "dataset": "other",
  17002. "idx": 393009
  17003. },
  17004. {
  17005. "func": "TEST_F(QueryPlannerTest, NegationElemMatchValue) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$elemMatch: {$gt: 3, $lt: 10}}}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  17006. "project": "mongo",
  17007. "hash": 301863786277944404947064628795464270349,
  17008. "size": 7,
  17009. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17010. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17011. "target": 0,
  17012. "dataset": "other",
  17013. "idx": 393011
  17014. },
  17015. {
  17016. "func": "TEST_F(QueryPlannerTest, MergeSortReverseScanOneIndex) {\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"b\" << 1 << \"c\" << -1));\n runQueryAsCommand(fromjson(\"{find: 'testns', filter: {$or: [{a: 1}, {b: 1}]}, sort: {c: 1}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: 1, c: 1}, dir: 1}}, {ixscan: {pattern: {b: 1, c: -1}, dir: \"\n \"-1}}]}}}}\");\n}",
  17017. "project": "mongo",
  17018. "hash": 246771225247675752168497710062761102402,
  17019. "size": 14,
  17020. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17021. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17022. "target": 0,
  17023. "dataset": "other",
  17024. "idx": 393012
  17025. },
  17026. {
  17027. "func": "TEST_F(QueryPlannerTest, MaxMinSortInequalityFirstSortSecond) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n // Run an empty query, sort {b: 1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{b: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 1, b: 1}\"),\n fromjson(\"{a: 2, b: 2}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}}}}}\");\n}",
  17028. "project": "mongo",
  17029. "hash": 340009197622907316766942197406348903425,
  17030. "size": 20,
  17031. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17032. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17033. "target": 0,
  17034. "dataset": "other",
  17035. "idx": 393013
  17036. },
  17037. {
  17038. "func": "TEST_F(QueryPlannerTest, ShardFilterBasicIndex) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\" << 1);\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n\n runQuery(fromjson(\"{b: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sharding_filter: {node: \"\n \"{fetch: {node: \"\n \"{ixscan: {pattern: {b: 1}}}}}}}\");\n}",
  17039. "project": "mongo",
  17040. "hash": 280036162655895132848721440302903005488,
  17041. "size": 14,
  17042. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17043. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17044. "target": 0,
  17045. "dataset": "other",
  17046. "idx": 393014
  17047. },
  17048. {
  17049. "func": "TEST_F(QueryPlannerTest, OrOfAnd5) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(\n fromjson(\"{$or: [{a:{$gt:1,$lt:5}, c:6}, \"\n \"{a:3, b:{$gt:1,$lt:2}, c:{$gt:0,$lt:10}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c:6}, node: {ixscan: {pattern: {a:1,b:1}, \"\n \"bounds: {a: [[1,5,false,false]], \"\n \"b: [['MinKey','MaxKey',true,true]]}}}}}, \"\n \"{fetch: {filter: {$and:[{c:{$lt:10}},{c:{$gt:0}}]}, node: \"\n \"{ixscan: {pattern: {a:1,b:1}, \"\n \" bounds: {a:[[3,3,true,true]], b:[[1,2,false,false]]}}}}}]}}\");\n}",
  17050. "project": "mongo",
  17051. "hash": 315864866036752405754514415109542515448,
  17052. "size": 17,
  17053. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17054. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17055. "target": 0,
  17056. "dataset": "other",
  17057. "idx": 393015
  17058. },
  17059. {
  17060. "func": "TEST_F(QueryPlannerTest, MaxMinNoMatchingIndexDir) {\n addIndex(BSON(\"a\" << -1));\n runInvalidQueryHintMinMax(BSONObj(), fromjson(\"{a: 2}\"), BSONObj(), fromjson(\"{a: 8}\"));\n}",
  17061. "project": "mongo",
  17062. "hash": 47116083361197320502349107660036890275,
  17063. "size": 4,
  17064. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17065. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17066. "target": 0,
  17067. "dataset": "other",
  17068. "idx": 393016
  17069. },
  17070. {
  17071. "func": "TEST_F(QueryPlannerTest, ContainedOrOfAndCollapseIdenticalScansTwoFilters) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{c: 1, $or: [{a:1, b:2, d:3}, {a:1, b:2, e:4}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {c: 1}, node: {fetch: {filter: {$or:[{e:4},{d:3}]},\"\n \"node: {ixscan: {pattern: {a: 1, b: 1}, filter: null,\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]}}}}}}}\");\n}",
  17072. "project": "mongo",
  17073. "hash": 94573423014970399571799794720696452894,
  17074. "size": 11,
  17075. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17076. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17077. "target": 0,
  17078. "dataset": "other",
  17079. "idx": 393017
  17080. },
  17081. {
  17082. "func": "TEST_F(QueryPlannerTest, OrBelowElemMatchInexactCovered) {\n // true means multikey\n addIndex(BSON(\"a.b\" << 1), true);\n runQuery(fromjson(\"{a: {$elemMatch: {$or: [{b: 'x'}, {b: /z/}]}}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a: {$elemMatch: {$or: [{b: 'x'}, {b: /z/}]}}},\"\n \"node: {ixscan: {filter: null, pattern: {'a.b': 1}}}}}\");\n}",
  17083. "project": "mongo",
  17084. "hash": 249421474257303892820494755838651214778,
  17085. "size": 11,
  17086. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17087. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17088. "target": 0,
  17089. "dataset": "other",
  17090. "idx": 393018
  17091. },
  17092. {
  17093. "func": "TEST_F(QueryPlannerTest, ExprEqCanUseIndex) {\n params.options &= ~QueryPlannerParams::INCLUDE_COLLSCAN;\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{a: {$_internalExprEq: 1}}\"));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a: 1}, bounds: {a: \"\n \"[[1,1,true,true]]}}}}}\");\n}",
  17094. "project": "mongo",
  17095. "hash": 82706706519063471628812327978665828108,
  17096. "size": 9,
  17097. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17098. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17099. "target": 0,
  17100. "dataset": "other",
  17101. "idx": 393019
  17102. },
  17103. {
  17104. "func": "TEST_F(QueryPlannerTest, CompoundIndexWithEqualityPredicatesProvidesSort) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{a: 1, b: 1}\"), fromjson(\"{b: 1}\"), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {filter: null,\"\n \"pattern: {a: 1, b: 1}, \"\n \"bounds: {a:[[1,1,true,true]], b:[[1,1,true,true]]}}}}}\");\n}",
  17105. "project": "mongo",
  17106. "hash": 288207533621246512419167638735060929032,
  17107. "size": 11,
  17108. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17109. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17110. "target": 0,
  17111. "dataset": "other",
  17112. "idx": 393020
  17113. },
  17114. {
  17115. "func": "TEST_F(QueryPlannerTest, IntersectBasicTwoPredCompound) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuery(fromjson(\"{a:1, b:1, c:1}\"));\n\n // There's an andSorted not andHash because the two seeks are point intervals.\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1, c:1}}},\"\n \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\");\n}",
  17116. "project": "mongo",
  17117. "hash": 149844425839868898647380989459656924885,
  17118. "size": 12,
  17119. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17120. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17121. "target": 0,
  17122. "dataset": "other",
  17123. "idx": 393021
  17124. },
  17125. {
  17126. "func": "TEST_F(QueryPlannerTest, BasicSortElim) {\n addIndex(BSON(\"x\" << 1));\n // query, sort, proj\n runQuerySortProj(fromjson(\"{ x : {$gt: 1}}\"), fromjson(\"{x: 1}\"), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {x: 1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1, filter: {x: {$gt: 1}}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {filter: null, pattern: {x: 1}}}}}\");\n}",
  17127. "project": "mongo",
  17128. "hash": 229306703282193775966730898380016579819,
  17129. "size": 12,
  17130. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17131. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17132. "target": 0,
  17133. "dataset": "other",
  17134. "idx": 393022
  17135. },
  17136. {
  17137. "func": "TEST_F(QueryPlannerTest, CannotTrimIxisectParam) {\n params.options = QueryPlannerParams::CANNOT_TRIM_IXISECT;\n params.options |= QueryPlannerParams::INDEX_INTERSECTION;\n params.options |= QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n\n runQuery(fromjson(\"{a: 1, b: 1, c: 1}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\n \"{fetch: {filter: {b: 1, c: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a: 1, c: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {b: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:1,b:1,c:1}, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1}}},\"\n \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\");\n}",
  17138. "project": "mongo",
  17139. "hash": 11676837453775382192995946067663770705,
  17140. "size": 22,
  17141. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17142. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17143. "target": 0,
  17144. "dataset": "other",
  17145. "idx": 393023
  17146. },
  17147. {
  17148. "func": "TEST_F(QueryPlannerTest, BasicSoftLimitWithIndex) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuerySkipNToReturn(BSON(\"a\" << 5), 0, 5);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: 5}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  17149. "project": "mongo",
  17150. "hash": 136573306049577053991198550483676659906,
  17151. "size": 11,
  17152. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17153. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17154. "target": 0,
  17155. "dataset": "other",
  17156. "idx": 393024
  17157. },
  17158. {
  17159. "func": "TEST_F(QueryPlannerTest, OrEnumerationLimit2) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"d\" << 1));\n\n // 3 $or clauses, and a few other preds. Each $or clause can\n // generate up to the max number of allowed $or enumerations.\n runQuery(\n fromjson(\"{$or: [{a: 1, b: 1, c: 1, d: 1},\"\n \"{a: 2, b: 2, c: 2, d: 2},\"\n \"{a: 3, b: 3, c: 3, d: 3}]}\"));\n\n assertNumSolutions(internalQueryEnumerationMaxOrSolutions.load());\n}",
  17160. "project": "mongo",
  17161. "hash": 186926425248054729013655628157880001452,
  17162. "size": 16,
  17163. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17164. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17165. "target": 0,
  17166. "dataset": "other",
  17167. "idx": 393025
  17168. },
  17169. {
  17170. "func": "TEST_F(QueryPlannerTest, ExplodeIxscanWithFilter) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuerySortProj(fromjson(\"{$and: [{b: {$regex: 'foo', $options: 'i'}},\"\n \"{a: {$in: [1, 2]}}]}\"),\n BSON(\"b\" << 1),\n BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a:1, b:1},\"\n \"filter: {b: {$regex: 'foo', $options: 'i'}}}},\"\n \"{ixscan: {pattern: {a:1, b:1},\"\n \"filter: {b: {$regex: 'foo', $options: 'i'}}}}]}}}}\");\n}",
  17171. "project": "mongo",
  17172. "hash": 323321915181604253517702372309211591566,
  17173. "size": 19,
  17174. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17175. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17176. "target": 0,
  17177. "dataset": "other",
  17178. "idx": 393026
  17179. },
  17180. {
  17181. "func": "TEST_F(QueryPlannerTest, ContainedOrMultikeyCannotCompoundTrailingFields) {\n const bool multikey = true;\n addIndex(BSON(\"d\" << 1 << \"a.b\" << 1 << \"a.c\" << 1), multikey);\n addIndex(BSON(\"e\" << 1));\n\n runQuery(fromjson(\"{$and: [{'a.b': 5}, {$or: [{$and: [{'a.c': 6}, {d: 7}]}, {e: 8}]}]}\"));\n assertNumSolutions(2);\n std::vector<std::string> alternates;\n alternates.push_back(\n \"{fetch: {filter: {'a.b': 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {d: 1, 'a.b': 1, 'a.c': 1}, bounds: {d: [[7, 7, true, true]], 'a.b': \"\n \"[['MinKey', 'MaxKey', true, true]], 'a.c': [[6, 6, true, true]]}}},\"\n \"{ixscan: {pattern: {e: 1}, bounds: {e: [[8, 8, true, true]]}}}\"\n \"]}}}}\");\n alternates.push_back(\n \"{fetch: {filter: {'a.b': 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {d: 1, 'a.b': 1, 'a.c': 1}, bounds: {d: [[7, 7, true, true]], 'a.b': \"\n \"[[5, 5, true, true]], 'a.c': [['MinKey', 'MaxKey', true, true]]}}},\"\n \"{ixscan: {pattern: {e: 1}, bounds: {e: [[8, 8, true, true]]}}}\"\n \"]}}}}\");\n assertHasOneSolutionOf(alternates);\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17182. "project": "mongo",
  17183. "hash": 108806431802968283830709725783603164546,
  17184. "size": 23,
  17185. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17186. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17187. "target": 0,
  17188. "dataset": "other",
  17189. "idx": 393027
  17190. },
  17191. {
  17192. "func": "TEST_F(QueryPlannerTest, BasicLimitWithIndex) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuerySkipNToReturn(BSON(\"a\" << 5), 0, -5);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{limit: {n: 5, node: {cscan: {dir: 1, filter: {a: 5}}}}}\");\n assertSolutionExists(\n \"{limit: {n: 5, node: {fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}}}\");\n}",
  17193. "project": "mongo",
  17194. "hash": 216680114454975719460616136600135480327,
  17195. "size": 11,
  17196. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17197. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17198. "target": 0,
  17199. "dataset": "other",
  17200. "idx": 393028
  17201. },
  17202. {
  17203. "func": "TEST_F(QueryPlannerTest, OrEnumerationLimit) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n\n // 6 $or clauses, each with 2 indexed predicates\n // means 2^6 = 64 possibilities. We should hit the limit.\n runQuery(\n fromjson(\"{$or: [{a: 1, b: 1},\"\n \"{a: 2, b: 2},\"\n \"{a: 3, b: 3},\"\n \"{a: 4, b: 4},\"\n \"{a: 5, b: 5},\"\n \"{a: 6, b: 6}]}\"));\n\n assertNumSolutions(internalQueryEnumerationMaxOrSolutions.load());\n}",
  17204. "project": "mongo",
  17205. "hash": 12563365889603733115756717927688492969,
  17206. "size": 17,
  17207. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17208. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17209. "target": 0,
  17210. "dataset": "other",
  17211. "idx": 393029
  17212. },
  17213. {
  17214. "func": "TEST_F(QueryPlannerTest, ContainedOrOneChildUsesPredicate) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17215. "project": "mongo",
  17216. "hash": 88302958427687332050141195064404650386,
  17217. "size": 14,
  17218. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17219. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17220. "target": 0,
  17221. "dataset": "other",
  17222. "idx": 393030
  17223. },
  17224. {
  17225. "func": "TEST_F(QueryPlannerTest, HintValidWithSort) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuerySortHint(fromjson(\"{a: 100, b: 200}\"), fromjson(\"{b: 1}\"), fromjson(\"{a: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {filter: {b: 200}, \"\n \"node: {ixscan: {filter: null, pattern: {a: 1}}}}}}}}}\");\n}",
  17226. "project": "mongo",
  17227. "hash": 263561557685358682501691940568755512181,
  17228. "size": 11,
  17229. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17230. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17231. "target": 0,
  17232. "dataset": "other",
  17233. "idx": 393031
  17234. },
  17235. {
  17236. "func": "TEST_F(QueryPlannerTest, NoMergeSortIfNoSortWanted) {\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"b\" << 1 << \"c\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a:1}, {b:1}]}\"), BSONObj(), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$or: [{a:1}, {b:1}]}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a: 1, c: 1}}}, \"\n \"{ixscan: {filter: null, pattern: {b: 1, c: 1}}}]}}}}\");\n}",
  17237. "project": "mongo",
  17238. "hash": 176414212959603994818548590698874808730,
  17239. "size": 12,
  17240. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17241. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17242. "target": 0,
  17243. "dataset": "other",
  17244. "idx": 393032
  17245. },
  17246. {
  17247. "func": "TEST_F(QueryPlannerTest, SortElimTrailingFields) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQuerySortProj(fromjson(\"{a: 5}\"), BSON(\"b\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1, filter: {a: 5}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1, b: 1, c: 1}}}}}\");\n}",
  17248. "project": "mongo",
  17249. "hash": 16987594989702138190093065652549352375,
  17250. "size": 12,
  17251. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17252. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17253. "target": 0,
  17254. "dataset": "other",
  17255. "idx": 393033
  17256. },
  17257. {
  17258. "func": "TEST_F(QueryPlannerTest, IntersectCompoundInsteadUnusedField) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQuery(fromjson(\"{a: 1, b: 1}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\n \"{fetch: {filter: {b:1}, node: \"\n \"{ixscan: {filter: null, pattern: {a:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:1}, node: \"\n \"{ixscan: {filter: null, pattern: {b:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {a:1,b:1,c:1}}}}}\");\n}",
  17259. "project": "mongo",
  17260. "hash": 2712004810855055011353504534437315710,
  17261. "size": 18,
  17262. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17263. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17264. "target": 0,
  17265. "dataset": "other",
  17266. "idx": 393034
  17267. },
  17268. {
  17269. "func": "TEST_F(QueryPlannerTest, ExplodeMustReverseScans) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1 << \"d\" << 1));\n runQuerySortProj(fromjson(\"{a: {$in: [1, 2]}, b: {$in: [3, 4]}}\"), BSON(\"c\" << -1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: -1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a:1, b:1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a:1, b:1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a:1, b:1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a:1, b:1, c:1, d:1}}}]}}}}\");\n}",
  17270. "project": "mongo",
  17271. "hash": 146769320426054888791981351758308396900,
  17272. "size": 15,
  17273. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17274. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17275. "target": 0,
  17276. "dataset": "other",
  17277. "idx": 393035
  17278. },
  17279. {
  17280. "func": "TEST_F(QueryPlannerTest, MutationsFromFetchWithSort) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{a: 5}\"), fromjson(\"{b:1}\"), BSONObj());\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a:1}}}}}}}}}\");\n}",
  17281. "project": "mongo",
  17282. "hash": 130562391370393391067840268791278074530,
  17283. "size": 8,
  17284. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17285. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17286. "target": 0,
  17287. "dataset": "other",
  17288. "idx": 393036
  17289. },
  17290. {
  17291. "func": "TEST_F(QueryPlannerTest, MaxValid) {\n addIndex(BSON(\"a\" << 1));\n runQueryHintMinMax(BSONObj(), BSONObj(), BSONObj(), fromjson(\"{a: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  17292. "project": "mongo",
  17293. "hash": 325431969958168753245260824478048698244,
  17294. "size": 9,
  17295. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17296. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17297. "target": 0,
  17298. "dataset": "other",
  17299. "idx": 393037
  17300. },
  17301. {
  17302. "func": "TEST_F(QueryPlannerTest, NaturalSortAndHint) {\n addIndex(BSON(\"x\" << 1));\n\n // Non-empty query, -1 sort, no hint.\n runQuerySortHint(fromjson(\"{x: {$exists: true}}\"), BSON(\"$natural\" << -1), BSONObj());\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: -1}}\");\n\n // Non-empty query, 1 sort, no hint.\n runQuerySortHint(fromjson(\"{x: {$exists: true}}\"), BSON(\"$natural\" << 1), BSONObj());\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n\n // Non-empty query, -1 sort, -1 hint.\n runQuerySortHint(\n fromjson(\"{x: {$exists: true}}\"), BSON(\"$natural\" << -1), BSON(\"$natural\" << -1));\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: -1}}\");\n\n // Non-empty query, 1 sort, 1 hint.\n runQuerySortHint(\n fromjson(\"{x: {$exists: true}}\"), BSON(\"$natural\" << 1), BSON(\"$natural\" << 1));\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n\n // Empty query, -1 sort, no hint.\n runQuerySortHint(BSONObj(), BSON(\"$natural\" << -1), BSONObj());\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: -1}}\");\n\n // Empty query, 1 sort, no hint.\n runQuerySortHint(BSONObj(), BSON(\"$natural\" << 1), BSONObj());\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n\n // Empty query, -1 sort, -1 hint.\n runQuerySortHint(BSONObj(), BSON(\"$natural\" << -1), BSON(\"$natural\" << -1));\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: -1}}\");\n\n // Empty query, 1 sort, 1 hint.\n runQuerySortHint(BSONObj(), BSON(\"$natural\" << 1), BSON(\"$natural\" << 1));\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  17303. "project": "mongo",
  17304. "hash": 148941295028424344356570677567516792118,
  17305. "size": 45,
  17306. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17307. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17308. "target": 0,
  17309. "dataset": "other",
  17310. "idx": 393038
  17311. },
  17312. {
  17313. "func": "TEST_F(QueryPlannerTest, MaxBadHint) {\n addIndex(BSON(\"b\" << 1));\n runInvalidQueryHintMinMax(BSONObj(), fromjson(\"{b: 1}\"), BSONObj(), fromjson(\"{a: 1}\"));\n}",
  17314. "project": "mongo",
  17315. "hash": 279565397587732800378386422663635996357,
  17316. "size": 4,
  17317. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17318. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17319. "target": 0,
  17320. "dataset": "other",
  17321. "idx": 393039
  17322. },
  17323. {
  17324. "func": "TEST_F(QueryPlannerTest, OrWithExactAndInexact2) {\n addIndex(BSON(\"name\" << 1));\n runQuery(\n fromjson(\"{$or: [{name: {$in: ['thomas', /^alexand(er|ra)/]}},\"\n \"{name: {$exists: false}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{name: {$in: ['thomas', /^alexand(er|ra)/]}},\"\n \"{name: {$exists: false}}]}, \"\n \"node: {ixscan: {filter: null, pattern: {name: 1}}}}}\");\n}",
  17325. "project": "mongo",
  17326. "hash": 54825404466061056502205623957494387581,
  17327. "size": 13,
  17328. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17329. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17330. "target": 0,
  17331. "dataset": "other",
  17332. "idx": 393040
  17333. },
  17334. {
  17335. "func": "TEST_F(QueryPlannerTest, HintedNotCoveredProjectionIndexFilteredOut) {\n params.options = QueryPlannerParams::NO_UNCOVERED_PROJECTIONS;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQueryAsCommand(fromjson(\n \"{find: 'testns', filter: {a: 1}, projection: {a: 1, b: 1, _id: 0}, hint: {a: 1}}\"));\n assertNumSolutions(0U);\n}",
  17336. "project": "mongo",
  17337. "hash": 110178675444283869993985129460021496947,
  17338. "size": 8,
  17339. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17340. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17341. "target": 0,
  17342. "dataset": "other",
  17343. "idx": 393041
  17344. },
  17345. {
  17346. "func": "TEST_F(QueryPlannerTest, ContainedOrOfAndCollapseIndenticalScansWithFilter) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{c: 1, $or: [{a:1, b:2}, {a:1, b:2, d:3}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {a: 1, b: 1}},\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]},\"\n \"filter: null}}}\");\n}",
  17347. "project": "mongo",
  17348. "hash": 294247082396239864461305151826020065402,
  17349. "size": 11,
  17350. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17351. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17352. "target": 0,
  17353. "dataset": "other",
  17354. "idx": 393042
  17355. },
  17356. {
  17357. "func": "TEST_F(QueryPlannerTest, IntersectCompoundInsteadBasic) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{a: 1, b: 1}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\n \"{fetch: {filter: {b:1}, node: \"\n \"{ixscan: {filter: null, pattern: {a:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:1}, node: \"\n \"{ixscan: {filter: null, pattern: {b:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {a:1,b:1}}}}}\");\n}",
  17358. "project": "mongo",
  17359. "hash": 236236628014254833218246422530933693806,
  17360. "size": 18,
  17361. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17362. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17363. "target": 0,
  17364. "dataset": "other",
  17365. "idx": 393043
  17366. },
  17367. {
  17368. "func": "TEST_F(QueryPlannerTest, ExplodeOrForSort) {\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"b\" << 1 << \"c\" << 1));\n\n runQuerySortProj(fromjson(\"{$or: [{a: 1}, {a: 2}, {b: 2}]}\"), BSON(\"c\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {bounds: {a: [[1,1,true,true]], \"\n \"c: [['MinKey','MaxKey',true,true]]},\"\n \"pattern: {a:1, c:1}}},\"\n \"{ixscan: {bounds: {a: [[2,2,true,true]], \"\n \"c: [['MinKey','MaxKey',true,true]]},\"\n \"pattern: {a:1, c:1}}},\"\n \"{ixscan: {bounds: {b: [[2,2,true,true]], \"\n \"c: [['MinKey','MaxKey',true,true]]},\"\n \"pattern: {b:1, c:1}}}]}}}}\");\n}",
  17369. "project": "mongo",
  17370. "hash": 301197963884544668691151903362937749703,
  17371. "size": 22,
  17372. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17373. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17374. "target": 0,
  17375. "dataset": "other",
  17376. "idx": 393044
  17377. },
  17378. {
  17379. "func": "TEST_F(QueryPlannerTest, CantExplodeOrForSort) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n addIndex(BSON(\"d\" << 1 << \"c\" << 1));\n\n runQuerySortProj(fromjson(\"{$or: [{a: {$in: [1, 2]}}, {d: 3}]}\"), BSON(\"c\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1}}},\"\n \"{ixscan: {pattern: {d: 1, c: 1}}}]}}}}}}}}\");\n}",
  17380. "project": "mongo",
  17381. "hash": 313534492925381290023987760478354537661,
  17382. "size": 16,
  17383. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17384. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17385. "target": 0,
  17386. "dataset": "other",
  17387. "idx": 393046
  17388. },
  17389. {
  17390. "func": "TEST_F(QueryPlannerTest, NegationAndIndexOnEqualityAndNegationBranches) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuerySortProj(fromjson(\"{$and: [{a: 1}, {b: 2}, {b: {$ne: 1}}]}\"), BSONObj(), BSONObj());\n\n assertNumSolutions(3U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1}, \"\n \"bounds: {a: [[1,1,true,true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {b: 1}, \"\n \"bounds: {b: [[2,2,true,true]]}}}}}\");\n}",
  17391. "project": "mongo",
  17392. "hash": 90428922145846670203658811574386682602,
  17393. "size": 14,
  17394. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17395. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17396. "target": 0,
  17397. "dataset": "other",
  17398. "idx": 393047
  17399. },
  17400. {
  17401. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfIndexIsMultikey) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n constexpr bool isMultikey = true;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1), isMultikey);\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1, b: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  17402. "project": "mongo",
  17403. "hash": 67824370838596103314249133757458924945,
  17404. "size": 10,
  17405. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17406. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17407. "target": 0,
  17408. "dataset": "other",
  17409. "idx": 393048
  17410. },
  17411. {
  17412. "func": "TEST_F(QueryPlannerTest, NestedContainedOrOneChildUsesPredicate) {\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n addIndex(BSON(\"d\" << 1));\n addIndex(BSON(\"f\" << 1));\n addIndex(BSON(\"g\" << 1 << \"a\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{a: 5}, {$or: [{$and: [{b: 6}, {$or: [{c: 7}, {d: 8}]}]}, \"\n \"{$and: [{e: 9}, {$or: [{f: 10}, {g: 11}]}]}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{fetch: {filter: {b: 6}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {d: 1}, bounds: {d: [[8, 8, true, true]]}}}\"\n \"]}}}},\"\n \"{fetch: {filter: {e: 9}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {f: 1}, bounds: {f: [[10, 10, true, true]]}}},\"\n \"{ixscan: {pattern: {g: 1, a: 1}, bounds: {g: [[11, 11, true, true]], a: [[5, 5, true, \"\n \"true]]}}}\"\n \"]}}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17413. "project": "mongo",
  17414. "hash": 182504597930256776552086401266519197264,
  17415. "size": 25,
  17416. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17417. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17418. "target": 0,
  17419. "dataset": "other",
  17420. "idx": 393049
  17421. },
  17422. {
  17423. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCannotCombineLeadingFields) {\n MultikeyPaths multikeyPaths{{0U}};\n addIndex(BSON(\"a\" << 1), multikeyPaths);\n addIndex(BSON(\"b\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{a: {$lte: 10}}, {b: 6}]}]}\"));\n assertNumSolutions(3);\n assertSolutionExists(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1}, bounds: {a: [[-Infinity, 10, true, true]]}}},\"\n \"{ixscan: {pattern: {b: 1}, bounds: {b: [[6, 6, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{a: {$lte: 10}}, {b: 6}]}, node: \"\n \"{ixscan: {pattern: {a: 1}, bounds: {a: [[0, Infinity, true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17424. "project": "mongo",
  17425. "hash": 204700848872716995336126661421749812209,
  17426. "size": 18,
  17427. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17428. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17429. "target": 0,
  17430. "dataset": "other",
  17431. "idx": 393050
  17432. },
  17433. {
  17434. "func": "TEST_F(QueryPlannerTest, KeyPatternOverflowsInt) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << -2147483649LL));\n\n runQuerySortProj(fromjson(\"{a: {$gte: 3, $lte: 5}}\"), fromjson(\"{a: 1}\"), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a: -2147483649}, \"\n \"bounds: {a: [[3, 5, true, true]]}}}}}\");\n}",
  17435. "project": "mongo",
  17436. "hash": 21619438660311298596378788499241154021,
  17437. "size": 12,
  17438. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17439. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17440. "target": 0,
  17441. "dataset": "other",
  17442. "idx": 393051
  17443. },
  17444. {
  17445. "func": "TEST_F(QueryPlannerTest, NegationCantUseSparseIndex) {\n // false means not multikey, true means sparse\n addIndex(BSON(\"i\" << 1), false, true);\n runQuery(fromjson(\"{i: {$ne: 4}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  17446. "project": "mongo",
  17447. "hash": 224491270161673708968355837627632586833,
  17448. "size": 8,
  17449. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17450. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17451. "target": 0,
  17452. "dataset": "other",
  17453. "idx": 393052
  17454. },
  17455. {
  17456. "func": "TEST_F(QueryPlannerTest, CannotTrimIxisectParamBeneathOr) {\n params.options = QueryPlannerParams::CANNOT_TRIM_IXISECT;\n params.options |= QueryPlannerParams::INDEX_INTERSECTION;\n params.options |= QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{d: 1, $or: [{a: 1}, {b: 1, c: 1}]}\"));\n\n assertNumSolutions(3U);\n\n assertSolutionExists(\n \"{fetch: {filter: {d: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {c: 1}, node: {ixscan: {filter: null,\"\n \"pattern: {b: 1}, bounds: {b: [[1,1,true,true]]}}}}},\"\n \"{ixscan: {filter: null, pattern: {a: 1},\"\n \"bounds: {a: [[1,1,true,true]]}}}]}}}}\");\n\n assertSolutionExists(\n \"{fetch: {filter: {d: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {b: 1}, node: {ixscan: {filter: null,\"\n \"pattern: {c: 1}, bounds: {c: [[1,1,true,true]]}}}}},\"\n \"{ixscan: {filter: null, pattern: {a: 1},\"\n \"bounds: {a: [[1,1,true,true]]}}}]}}}}\");\n\n assertSolutionExists(\n \"{fetch: {filter: {d: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {b: 1, c: 1}, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {b: 1}}},\"\n \"{ixscan: {filter: null, pattern: {c: 1}}}]}}}},\"\n \"{ixscan: {filter: null, pattern: {a: 1}}}]}}}}\");\n}",
  17457. "project": "mongo",
  17458. "hash": 287878070076194237041234257702319431461,
  17459. "size": 34,
  17460. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17461. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17462. "target": 0,
  17463. "dataset": "other",
  17464. "idx": 393053
  17465. },
  17466. {
  17467. "func": "TEST_F(QueryPlannerTest, ContainedOrOfAndCollapseIndenticalScans) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{c: 1, $or: [{a:1, b:2}, {a:1, b:2}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {a: 1, b: 1}},\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]},\"\n \"filter: null}}}\");\n}",
  17468. "project": "mongo",
  17469. "hash": 314626882257712031420936932308636629115,
  17470. "size": 11,
  17471. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17472. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17473. "target": 0,
  17474. "dataset": "other",
  17475. "idx": 393054
  17476. },
  17477. {
  17478. "func": "TEST_F(QueryPlannerTest, ShardFilterCompoundProjCovered) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\" << 1 << \"b\" << 1);\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuerySortProj(fromjson(\"{a: 1}\"), BSONObj(), fromjson(\"{_id: 0, a: 1, b: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1 }, type: 'coveredIndex', node: \"\n \"{sharding_filter: {node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}}}}}}}\");\n}",
  17479. "project": "mongo",
  17480. "hash": 132556060129769586873550761639238046074,
  17481. "size": 13,
  17482. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17483. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17484. "target": 0,
  17485. "dataset": "other",
  17486. "idx": 393055
  17487. },
  17488. {
  17489. "func": "TEST_F(QueryPlannerTest, CantUseHashedIndexToProvideSort) {\n addIndex(BSON(\"x\"\n << \"hashed\"));\n runQuerySortProj(BSONObj(), BSON(\"x\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{sort: {pattern: {x: 1}, limit: 0, node: {sortKeyGen:\"\n \"{node: {cscan: {dir: 1, filter: {}}}}}}}\");\n}",
  17490. "project": "mongo",
  17491. "hash": 80397399340831779005679673679813319935,
  17492. "size": 10,
  17493. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17494. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17495. "target": 0,
  17496. "dataset": "other",
  17497. "idx": 393056
  17498. },
  17499. {
  17500. "func": "TEST_F(QueryPlannerTest, ExistsBounds) {\n addIndex(BSON(\"b\" << 1));\n\n runQuery(fromjson(\"{b: {$exists: true}}\"));\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b: {$exists: true}}, node: \"\n \"{ixscan: {pattern: {b: 1}, bounds: \"\n \"{b: [['MinKey', 'MaxKey', true, true]]}}}}}\");\n\n // This ends up being a double negation, which we currently don't index.\n runQuery(fromjson(\"{b: {$not: {$exists: false}}}\"));\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n\n runQuery(fromjson(\"{b: {$exists: false}}\"));\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b: {$exists: false}}, node: \"\n \"{ixscan: {pattern: {b: 1}, bounds: \"\n \"{b: [[null, null, true, true]]}}}}}\");\n\n runQuery(fromjson(\"{b: {$not: {$exists: true}}}\"));\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b: {$exists: false}}, node: \"\n \"{ixscan: {pattern: {b: 1}, bounds: \"\n \"{b: [[null, null, true, true]]}}}}}\");\n}",
  17501. "project": "mongo",
  17502. "hash": 322497916871602623416434372546885465071,
  17503. "size": 32,
  17504. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17505. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17506. "target": 0,
  17507. "dataset": "other",
  17508. "idx": 393057
  17509. },
  17510. {
  17511. "func": "TEST_F(QueryPlannerTest, NegationAndIndexOnEquality) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{$and: [{a: 1}, {b: {$ne: 1}}]}\"), BSONObj(), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1},\"\n \"bounds: {a: [[1,1,true,true]]}}}}}\");\n}",
  17512. "project": "mongo",
  17513. "hash": 169209607824306825659158708761227391471,
  17514. "size": 10,
  17515. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17516. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17517. "target": 0,
  17518. "dataset": "other",
  17519. "idx": 393059
  17520. },
  17521. {
  17522. "func": "TEST_F(QueryPlannerTest, NegationOrNotIn) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a: 1}, {b: {$nin: [1]}}]}\"), BSONObj(), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  17523. "project": "mongo",
  17524. "hash": 318778560782654500883962009180987063611,
  17525. "size": 7,
  17526. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17527. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17528. "target": 0,
  17529. "dataset": "other",
  17530. "idx": 393060
  17531. },
  17532. {
  17533. "func": "TEST_F(QueryPlannerTest, NonPrefixRegexOrCovering) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(\n fromjson(\"{$or: [{a: /0/}, {a: /1/}]}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1, filter: {$or: [{a: /0/}, {a: /1/}]}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: {$or: [{a: /0/}, {a: /1/}]}, pattern: {a: 1}}}}}\");\n}",
  17534. "project": "mongo",
  17535. "hash": 63497059621928700789167414524087467836,
  17536. "size": 13,
  17537. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17538. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17539. "target": 0,
  17540. "dataset": "other",
  17541. "idx": 393061
  17542. },
  17543. {
  17544. "func": "TEST_F(QueryPlannerTest, InCompoundIndexFirst) {\n addIndex(fromjson(\"{a: 1, b: 1}\"));\n runQuery(fromjson(\"{a: {$in: [1, 2]}, b: 3}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {b: 3, a: {$in: [1, 2]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {pattern: {a: 1, b: 1}}}}}\");\n}",
  17545. "project": "mongo",
  17546. "hash": 117938382842480105477250149398010167016,
  17547. "size": 10,
  17548. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17549. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17550. "target": 0,
  17551. "dataset": "other",
  17552. "idx": 393062
  17553. },
  17554. {
  17555. "func": "TEST_F(QueryPlannerTest, GreaterThanEqual) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSON(\"x\" << BSON(\"$gte\" << 5)));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: {$gte: 5}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n}",
  17556. "project": "mongo",
  17557. "hash": 336276631503935954118167664468931309404,
  17558. "size": 11,
  17559. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17560. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17561. "target": 0,
  17562. "dataset": "other",
  17563. "idx": 393063
  17564. },
  17565. {
  17566. "func": "TEST_F(QueryPlannerTest, EnumerateNestedOr2) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"d\" << 1));\n addIndex(BSON(\"e\" << 1));\n addIndex(BSON(\"f\" << 1));\n\n runQuery(fromjson(\"{a: 1, b: 1, $or: [{c: 1, d: 1}, {e: 1, f: 1}]}\"));\n\n assertNumSolutions(6U);\n\n // Four possibilities from indexing the $or.\n assertSolutionExists(\n \"{fetch: {filter: {a: 1, b: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {d: 1}, node: {ixscan: {pattern: {c: 1}}}}},\"\n \"{fetch: {filter: {f: 1}, node: {ixscan: {pattern: {e: 1}}}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a: 1, b: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {d: 1}}}}},\"\n \"{fetch: {filter: {f: 1}, node: {ixscan: {pattern: {e: 1}}}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a: 1, b: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {d: 1}, node: {ixscan: {pattern: {c: 1}}}}},\"\n \"{fetch: {filter: {e: 1}, node: {ixscan: {pattern: {f: 1}}}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a: 1, b: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {d: 1}}}}},\"\n \"{fetch: {filter: {e: 1}, node: {ixscan: {pattern: {f: 1}}}}}\"\n \"]}}}}\");\n\n // Two possibilties from outside the $or.\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {a: 1}}}}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {b: 1}}}}}\");\n}",
  17567. "project": "mongo",
  17568. "hash": 278769644651541766488468533379689396940,
  17569. "size": 39,
  17570. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17571. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17572. "target": 0,
  17573. "dataset": "other",
  17574. "idx": 393065
  17575. },
  17576. {
  17577. "func": "TEST_F(QueryPlannerTest, IndexFilterAppliedTrue) {\n params.indexFiltersApplied = true;\n\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSON(\"x\" << 5));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: 5}}}\");\n assertSolutionExists(\"{fetch: {filter: null, node: {ixscan: {pattern: {x: 1}}}}}\");\n\n // Check indexFilterApplied in query solutions;\n for (auto it = solns.begin(); it != solns.end(); ++it) {\n QuerySolution* soln = it->get();\n ASSERT_EQUALS(params.indexFiltersApplied, soln->indexFilterApplied);\n }\n}",
  17578. "project": "mongo",
  17579. "hash": 189658958116736798977957814322350794991,
  17580. "size": 17,
  17581. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17582. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17583. "target": 0,
  17584. "dataset": "other",
  17585. "idx": 393066
  17586. },
  17587. {
  17588. "func": "TEST_F(QueryPlannerTest, ExistsTrueSparseIndex) {\n addIndex(BSON(\"x\" << 1), false, true);\n\n runQuery(fromjson(\"{x: {$exists: true}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  17589. "project": "mongo",
  17590. "hash": 240231571515747403968780181209208071828,
  17591. "size": 9,
  17592. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17593. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17594. "target": 0,
  17595. "dataset": "other",
  17596. "idx": 393067
  17597. },
  17598. {
  17599. "func": "TEST_F(QueryPlannerTest, IndexBoundsUnindexedSortHint) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortHint(fromjson(\"{$or: [{a: 1}, {a: 2}]}\"), BSON(\"b\" << 1), BSON(\"a\" << 1));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: {fetch: \"\n \"{filter: null, node: {ixscan: {filter: null, \"\n \"pattern: {a:1}, bounds: {a: [[1,1,true,true], [2,2,true,true]]}}}}}}}}}\");\n}",
  17600. "project": "mongo",
  17601. "hash": 49557392537646226373039605865187272673,
  17602. "size": 10,
  17603. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17604. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17605. "target": 0,
  17606. "dataset": "other",
  17607. "idx": 393068
  17608. },
  17609. {
  17610. "func": "TEST_F(QueryPlannerTest, ContainedOrCombineLeadingFieldsMoveToAnd) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{$and: [{a: {$lte: 10}}, {b: 6}]}, {c: 7}]}]}\"));\n assertNumSolutions(3);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[0, 10, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[0, Infinity, \"\n \"true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{a: {$lte: 10}}, {b: 6}]}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[0, Infinity, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17611. "project": "mongo",
  17612. "hash": 179941219093230375067489261424761317843,
  17613. "size": 21,
  17614. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17615. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17616. "target": 0,
  17617. "dataset": "other",
  17618. "idx": 393069
  17619. },
  17620. {
  17621. "func": "TEST_F(QueryPlannerTest, MultipleContainedOrWithIndexIntersectionEnabled) {\n params.options = QueryPlannerParams::INCLUDE_COLLSCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"d\" << 1 << \"a\" << 1));\n addIndex(BSON(\"e\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}, {$or: [{d: 8}, {e: 9}]}]}\"));\n\n assertNumSolutions(6U);\n\n // Non-ixisect solutions.\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{d: 8}, {e: 9}], a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {b: 1, a: 1},\"\n \"bounds: {b: [[6,6,true,true]], a: [[5,5,true,true]]}}},\"\n \"{ixscan: {filter: null, pattern: {c: 1}, bounds: {c: [[7,7,true,true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}], a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {d: 1, a: 1},\"\n \"bounds: {d: [[8,8,true,true]], a: [[5,5,true,true]]}}},\"\n \"{ixscan: {filter: null, pattern: {e: 1}, bounds: {e: [[9,9,true,true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and: [{$or: [{b: 6}, {c: 7}]}, {$or: [{d: 8}, {e: 9}]}]}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}, bounds: {a: [[5,5,true,true]]}}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n\n // Ixisect solutions.\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{d: 8}, {e: 9}]}, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {b: 1, a: 1},\"\n \"bounds: {b: [[6,6,true,true]], a: [[5,5,true,true]]}}},\"\n \"{ixscan: {filter: null, pattern: {c: 1}, bounds: {c: [[7,7,true,true]]}}}\"\n \"]}},\"\n \"{ixscan: {filter: null, pattern: {a: 1}, bounds: {a: [[5,5,true,true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {d: 1, a: 1},\"\n \"bounds: {d: [[8,8,true,true]], a: [[5,5,true,true]]}}},\"\n \"{ixscan: {filter: null, pattern: {e: 1}, bounds: {e: [[9,9,true,true]]}}}\"\n \"]}},\"\n \"{ixscan: {filter: null, pattern: {a: 1}, bounds: {a: [[5,5,true,true]]}}}\"\n \"]}}}}\");\n}",
  17622. "project": "mongo",
  17623. "hash": 143544704585300300963806837761999254985,
  17624. "size": 50,
  17625. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17626. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17627. "target": 0,
  17628. "dataset": "other",
  17629. "idx": 393070
  17630. },
  17631. {
  17632. "func": "TEST_F(QueryPlannerTest, CoveredSkipWithIndex) {\n addIndex(fromjson(\"{a: 1, b: 1}\"));\n\n runQuerySortProjSkipNToReturn(\n fromjson(\"{a: 5}\"), BSONObj(), fromjson(\"{_id: 0, a: 1, b: 1}\"), 8, 0);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \"\n \"{skip: {n: 8, node: {cscan: {dir: 1, filter: {a: 5}}}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, \"\n \"node: {skip: {n: 8, node: {ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}}}\");\n}",
  17633. "project": "mongo",
  17634. "hash": 5210377698578808862033022787247383907,
  17635. "size": 14,
  17636. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17637. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17638. "target": 0,
  17639. "dataset": "other",
  17640. "idx": 393071
  17641. },
  17642. {
  17643. "func": "TEST_F(QueryPlannerTest, TwoPlansElemMatch) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"arr.x\" << 1 << \"a\" << 1));\n\n runQuery(\n fromjson(\"{arr: { $elemMatch : { x : 5 , y : 5 } },\"\n \" a : 55 , b : { $in : [ 1 , 5 , 8 ] } }\"));\n\n // 2 indexed solns and one non-indexed\n ASSERT_EQUALS(getNumSolutions(), 3U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1}, bounds: \"\n \"{a: [[55,55,true,true]], b: [[1,1,true,true], \"\n \"[5,5,true,true], [8,8,true,true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and: [{arr:{$elemMatch:{x:5,y:5}}},\"\n \"{b:{$in:[1,5,8]}}]}, \"\n \"node: {ixscan: {pattern: {'arr.x':1,a:1}, bounds: \"\n \"{'arr.x': [[5,5,true,true]], 'a':[[55,55,true,true]]}}}}}\");\n}",
  17644. "project": "mongo",
  17645. "hash": 118984698218554988999959333737391584356,
  17646. "size": 21,
  17647. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17648. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17649. "target": 0,
  17650. "dataset": "other",
  17651. "idx": 393072
  17652. },
  17653. {
  17654. "func": "TEST_F(QueryPlannerTest, RootedOrOfAndCollapseIndenticalScans) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{$or: [{a:1, b:2}, {a:1, b:2}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a: 1, b: 1}},\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]},\"\n \"filter: null}}}\");\n}",
  17655. "project": "mongo",
  17656. "hash": 166710255973449787152827913505784783652,
  17657. "size": 11,
  17658. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17659. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17660. "target": 0,
  17661. "dataset": "other",
  17662. "idx": 393073
  17663. },
  17664. {
  17665. "func": "TEST_F(QueryPlannerTest, EqualityIndexScan) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSON(\"x\" << 5));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: 5}}}\");\n assertSolutionExists(\"{fetch: {filter: null, node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  17666. "project": "mongo",
  17667. "hash": 326092435937096363734738875172309593404,
  17668. "size": 9,
  17669. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17670. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17671. "target": 0,
  17672. "dataset": "other",
  17673. "idx": 393074
  17674. },
  17675. {
  17676. "func": "TEST_F(QueryPlannerTest, MinBadHint) {\n addIndex(BSON(\"b\" << 1));\n runInvalidQueryHintMinMax(BSONObj(), fromjson(\"{b: 1}\"), fromjson(\"{a: 1}\"), BSONObj());\n}",
  17677. "project": "mongo",
  17678. "hash": 190896516882203812977861984773346693680,
  17679. "size": 4,
  17680. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17681. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17682. "target": 0,
  17683. "dataset": "other",
  17684. "idx": 393075
  17685. },
  17686. {
  17687. "func": "TEST_F(QueryPlannerTest, InCantUseHashedIndexWithRegex) {\n addIndex(BSON(\"a\"\n << \"hashed\"));\n runQuery(fromjson(\"{a: {$in: [/abc/]}}\"));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n}",
  17688. "project": "mongo",
  17689. "hash": 54941173205593023570748747854296584564,
  17690. "size": 6,
  17691. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17692. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17693. "target": 0,
  17694. "dataset": "other",
  17695. "idx": 393076
  17696. },
  17697. {
  17698. "func": "TEST_F(QueryPlannerTest, ContainedOrMultikeyCannotCombineTrailingFields) {\n const bool multikey = true;\n addIndex(BSON(\"b\" << 1 << \"a\" << 1), multikey);\n addIndex(BSON(\"c\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{$and: [{a: {$lte: 10}}, {b: 6}]}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n std::vector<std::string> alternates;\n alternates.push_back(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[-Infinity, 10, \"\n \"true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n alternates.push_back(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[0, Infinity, \"\n \"true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertHasOneSolutionOf(alternates);\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17699. "project": "mongo",
  17700. "hash": 234746786509050281467708164526401986588,
  17701. "size": 24,
  17702. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17703. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17704. "target": 0,
  17705. "dataset": "other",
  17706. "idx": 393077
  17707. },
  17708. {
  17709. "func": "TEST_F(QueryPlannerTest, MinValid) {\n addIndex(BSON(\"a\" << 1));\n runQueryHintMinMax(BSONObj(), BSONObj(), fromjson(\"{a: 1}\"), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  17710. "project": "mongo",
  17711. "hash": 215685150172519314550076586708974278625,
  17712. "size": 9,
  17713. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17714. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17715. "target": 0,
  17716. "dataset": "other",
  17717. "idx": 393078
  17718. },
  17719. {
  17720. "func": "TEST_F(QueryPlannerTest, ExistsFalseOnUnindexedField) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(fromjson(\"{x: 1, y: {$exists: false}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  17721. "project": "mongo",
  17722. "hash": 258544296604760320003781636372786603135,
  17723. "size": 9,
  17724. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17725. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17726. "target": 0,
  17727. "dataset": "other",
  17728. "idx": 393079
  17729. },
  17730. {
  17731. "func": "TEST_F(QueryPlannerTest, NoKeepWithMergeSort) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{a: {$in: [1, 2]}}\"), BSON(\"b\" << 1), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {mergeSort: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1},\"\n \"bounds: {a: [[1,1,true,true]], b: [['MinKey','MaxKey',true,true]]}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1},\"\n \"bounds: {a: [[2,2,true,true]], b: [['MinKey','MaxKey',true,true]]}}}]}}}}\");\n}",
  17732. "project": "mongo",
  17733. "hash": 281277428925317092296859584141107029258,
  17734. "size": 14,
  17735. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17736. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17737. "target": 0,
  17738. "dataset": "other",
  17739. "idx": 393080
  17740. },
  17741. {
  17742. "func": "TEST_F(QueryPlannerTest, EquivalentAndsOne) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{$and: [{a: 1}, {b: {$all: [10, 20]}}]}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$and:[{a:1},{b:10},{b:20}]}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  17743. "project": "mongo",
  17744. "hash": 203947649638564956088069352970299332139,
  17745. "size": 10,
  17746. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17747. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17748. "target": 0,
  17749. "dataset": "other",
  17750. "idx": 393081
  17751. },
  17752. {
  17753. "func": "TEST_F(QueryPlannerTest, IndexBoundsIndexedSort) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a: 1}, {a: 2}]}\"), BSON(\"a\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {a:1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {filter: {$or:[{a:1},{a:2}]}, dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {filter: null, \"\n \"pattern: {a:1}, bounds: {a: [[1,1,true,true], [2,2,true,true]]}}}}}\");\n}",
  17754. "project": "mongo",
  17755. "hash": 120980686074387831921221065078965824456,
  17756. "size": 12,
  17757. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17758. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17759. "target": 0,
  17760. "dataset": "other",
  17761. "idx": 393082
  17762. },
  17763. {
  17764. "func": "TEST_F(QueryPlannerTest, ContainedOrCombineLeadingFields) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{a: {$lte: 10}}, {b: 6}]}]}\"));\n assertNumSolutions(3);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1}, bounds: {a: [[0, 10, true, true]]}}},\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[0, Infinity, \"\n \"true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{a: {$lte: 10}}, {b: 6}]}, node: \"\n \"{ixscan: {pattern: {a: 1}, bounds: {a: [[0, Infinity, true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17765. "project": "mongo",
  17766. "hash": 8865997958710290982057721444453019203,
  17767. "size": 18,
  17768. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17769. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17770. "target": 0,
  17771. "dataset": "other",
  17772. "idx": 393083
  17773. },
  17774. {
  17775. "func": "TEST_F(QueryPlannerTest, NegationElemMatchObject2) {\n addIndex(BSON(\"i.j\" << 1));\n runQuery(fromjson(\"{i: {$not: {$elemMatch: {j: {$ne: 1}}}}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  17776. "project": "mongo",
  17777. "hash": 274970740790647541508240656247791061209,
  17778. "size": 7,
  17779. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17780. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17781. "target": 0,
  17782. "dataset": "other",
  17783. "idx": 393084
  17784. },
  17785. {
  17786. "func": "TEST_F(QueryPlannerTest, OrCollapsesToSingleScan3) {\n addIndex(BSON(\"a\" << 1));\n runQueryHint(fromjson(\"{$or: [{a:1},{a:3}]}\"), fromjson(\"{a:1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [[1,1,true,true], [3,3,true,true]]}}}}}\");\n}",
  17787. "project": "mongo",
  17788. "hash": 236976622139717227175467876454793846369,
  17789. "size": 9,
  17790. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17791. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17792. "target": 0,
  17793. "dataset": "other",
  17794. "idx": 393085
  17795. },
  17796. {
  17797. "func": "TEST_F(QueryPlannerTest, SimpleOr) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a: 20}, {a: 21}]}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$or: [{a: 20}, {a: 21}]}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a:1}}}}}\");\n}",
  17798. "project": "mongo",
  17799. "hash": 132340635615388957326144182701125024965,
  17800. "size": 10,
  17801. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17802. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17803. "target": 0,
  17804. "dataset": "other",
  17805. "idx": 393086
  17806. },
  17807. {
  17808. "func": "TEST_F(QueryPlannerTest, MaxMinSort) {\n addIndex(BSON(\"a\" << 1));\n\n // Run an empty query, sort {a: 1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{a: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 2}\"),\n fromjson(\"{a: 8}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  17809. "project": "mongo",
  17810. "hash": 207247680011754907183128321285004596295,
  17811. "size": 17,
  17812. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17813. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17814. "target": 0,
  17815. "dataset": "other",
  17816. "idx": 393087
  17817. },
  17818. {
  17819. "func": "TEST_F(QueryPlannerTest, CannotIntersectSubnodes) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"d\" << 1));\n\n runQuery(fromjson(\"{$or: [{a: 1}, {b: 1}], $or: [{c: 1}, {d: 1}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{c: 1}, {d: 1}]}, node: {or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a: 1}}},\"\n \"{ixscan: {filter: null, pattern: {b: 1}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{a: 1}, {b: 1}]}, node: {or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {c: 1}}},\"\n \"{ixscan: {filter: null, pattern: {d: 1}}}\"\n \"]}}}}\");\n}",
  17820. "project": "mongo",
  17821. "hash": 96296272792594088194661105123571262934,
  17822. "size": 21,
  17823. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17824. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17825. "target": 0,
  17826. "dataset": "other",
  17827. "idx": 393088
  17828. },
  17829. {
  17830. "func": "TEST_F(QueryPlannerTest, OrWithAndChild) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a: 20}, {$and: [{a:1}, {b:7}]}]}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a: 1}}}, \"\n \"{fetch: {filter: {b: 7}, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1}}}}}]}}}}\");\n}",
  17831. "project": "mongo",
  17832. "hash": 336051970745652966577623280357161794801,
  17833. "size": 12,
  17834. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17835. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17836. "target": 0,
  17837. "dataset": "other",
  17838. "idx": 393089
  17839. },
  17840. {
  17841. "func": "TEST_F(QueryPlannerTest, IntersectManySelfIntersections) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n // True means multikey.\n addIndex(BSON(\"a\" << 1), true);\n\n // This one goes to 11.\n runQuery(fromjson(\"{a:1, a:2, a:3, a:4, a:5, a:6, a:7, a:8, a:9, a:10, a:11}\"));\n\n // But this one only goes to 10.\n assertSolutionExists(\n \"{fetch: {filter: {a:11}, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 1\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 2\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 3\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 4\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 5\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 6\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 7\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 8\n \"{ixscan: {filter: null, pattern: {a:1}}},\" // 9\n \"{ixscan: {filter: null, pattern: {a:1}}}]}}}}\"); // 10\n}",
  17842. "project": "mongo",
  17843. "hash": 128154009910910669420129969422000203694,
  17844. "size": 22,
  17845. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17846. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17847. "target": 0,
  17848. "dataset": "other",
  17849. "idx": 393090
  17850. },
  17851. {
  17852. "func": "TEST_F(QueryPlannerTest, OrOfAnd4) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(\n fromjson(\"{$or: [{a:{$gt:1,$lt:5}, b:{$gt:0,$lt:3}, c:6}, \"\n \"{a:3, b:{$gt:1,$lt:2}, c:{$gt:0,$lt:10}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c:6}, node: {ixscan: {pattern: {a:1,b:1}, \"\n \"bounds: {a: [[1,5,false,false]], b: [[0,3,false,false]]}}}}}, \"\n \"{fetch: {filter: {$and:[{c:{$lt:10}},{c:{$gt:0}}]}, node: \"\n \"{ixscan: {pattern: {a:1,b:1}, \"\n \" bounds: {a:[[3,3,true,true]], b:[[1,2,false,false]]}}}}}]}}\");\n}",
  17853. "project": "mongo",
  17854. "hash": 314269255720389838652249571268809778403,
  17855. "size": 16,
  17856. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17857. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17858. "target": 0,
  17859. "dataset": "other",
  17860. "idx": 393091
  17861. },
  17862. {
  17863. "func": "TEST_F(QueryPlannerTest, CompoundIndexBoundsLastFieldMissing) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQuery(fromjson(\"{a: 5, b: {$gt: 7}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: \"\n \"{a: [[5,5,true,true]], b: [[7,Infinity,false,true]], \"\n \" c: [['MinKey','MaxKey',true,true]]}}}}}\");\n}",
  17864. "project": "mongo",
  17865. "hash": 14580253076646201879303519621129531453,
  17866. "size": 11,
  17867. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17868. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17869. "target": 0,
  17870. "dataset": "other",
  17871. "idx": 393092
  17872. },
  17873. {
  17874. "func": "TEST_F(QueryPlannerTest, LockstepOrEnumerationSanityCheckTwoChildrenOneIndexEach) {\n params.options =\n QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::ENUMERATE_OR_CHILDREN_LOCKSTEP;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n\n runQueryAsCommand(fromjson(\"{find: 'testns', filter: {a: 1, $or: [{b: 1}, {c: 2}]}}\"));\n\n assertNumSolutions(3U);\n\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [{ixscan: {pattern: {a: 1, b: 1}}}, {ixscan: \"\n \"{pattern: {a: 1, c: 1}}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: {$eq: 1}}, {c: {$eq: 2}}]}, node: {ixscan: {pattern: {a: 1, \"\n \"b: 1}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: {$eq: 1}}, {c: {$eq: 2}}]}, node: {ixscan: {pattern: {a: 1, \"\n \"c: 1}}}}}}}\");\n}",
  17875. "project": "mongo",
  17876. "hash": 136357904830911574059266309454618808282,
  17877. "size": 20,
  17878. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17879. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17880. "target": 0,
  17881. "dataset": "other",
  17882. "idx": 393093
  17883. },
  17884. {
  17885. "func": "TEST_F(QueryPlannerTest, AndOfAnd) {\n addIndex(BSON(\"x\" << 1));\n runQuery(fromjson(\"{$and: [ {$and: [ {x: 2.5}]}, {x: {$gt: 1}}, {x: {$lt: 3}} ] }\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n}",
  17886. "project": "mongo",
  17887. "hash": 92957565637392107287247459206695280722,
  17888. "size": 10,
  17889. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17890. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17891. "target": 0,
  17892. "dataset": "other",
  17893. "idx": 393094
  17894. },
  17895. {
  17896. "func": "TEST_F(QueryPlannerTest, EqualityIndexScanWithTrailingFields) {\n addIndex(BSON(\"x\" << 1 << \"y\" << 1));\n\n runQuery(BSON(\"x\" << 5));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: 5}}}\");\n assertSolutionExists(\"{fetch: {filter: null, node: {ixscan: {pattern: {x: 1, y: 1}}}}}\");\n}",
  17897. "project": "mongo",
  17898. "hash": 94604599607497996008766425326439876819,
  17899. "size": 9,
  17900. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17901. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17902. "target": 0,
  17903. "dataset": "other",
  17904. "idx": 393095
  17905. },
  17906. {
  17907. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicateIsLeadingFieldMoveToAndWithFilter) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{fetch: {filter: {c: 7}, node: {ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, \"\n \"true]], b: [[6, 6, true, \"\n \"true]]}}}}},\"\n \"{ixscan: {pattern: {a: 1, d: 1}, bounds: {a: [[5, 5, true, true]], d: [[8, 8, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, d: 1}, bounds: {a: [[5, 5, true, true]], d: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17908. "project": "mongo",
  17909. "hash": 69992925967680897263237800751296478895,
  17910. "size": 26,
  17911. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17912. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17913. "target": 0,
  17914. "dataset": "other",
  17915. "idx": 393096
  17916. },
  17917. {
  17918. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCombineTrailingFields) {\n MultikeyPaths multikeyPaths{{0U}, {}};\n addIndex(BSON(\"b\" << 1 << \"a\" << 1), multikeyPaths);\n addIndex(BSON(\"c\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{$and: [{a: {$lte: 10}}, {b: 6}]}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[0, 10, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17919. "project": "mongo",
  17920. "hash": 252184710683510687707732199477476903995,
  17921. "size": 16,
  17922. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17923. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17924. "target": 0,
  17925. "dataset": "other",
  17926. "idx": 393097
  17927. },
  17928. {
  17929. "func": "TEST_F(QueryPlannerTest, ContainedOrMultiplePredicates) {\n addIndex(BSON(\"c\" << 1 << \"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"d\" << 1 << \"b\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {b: 6}, {$or: [{c: 7}, {d: 8}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {c: 1, a: 1, b: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \"\n \"true]], b: [[6, 6, true, true]]}}},\"\n \"{ixscan: {pattern: {d: 1, b: 1, a: 1}, bounds: {d: [[8, 8, true, true]], b: [[6, 6, true, \"\n \"true]], a: [[5, 5, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  17930. "project": "mongo",
  17931. "hash": 88937427857987812214739886446817430514,
  17932. "size": 15,
  17933. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17934. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17935. "target": 0,
  17936. "dataset": "other",
  17937. "idx": 393098
  17938. },
  17939. {
  17940. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionDoesNotUseCoveredIxscanIfDisabled) {\n params.options &= ~QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  17941. "project": "mongo",
  17942. "hash": 67096756890534520138498288143847481766,
  17943. "size": 9,
  17944. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17945. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17946. "target": 0,
  17947. "dataset": "other",
  17948. "idx": 393099
  17949. },
  17950. {
  17951. "func": "TEST_F(QueryPlannerTest, NegationAndIndexOnInequality) {\n addIndex(BSON(\"b\" << 1));\n runQuerySortProj(fromjson(\"{$and: [{a: 1}, {b: {$ne: 1}}]}\"), BSONObj(), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:1}, node: {ixscan: {pattern: {b:1}, \"\n \"bounds: {b: [['MinKey',1,true,false], \"\n \"[1,'MaxKey',false,true]]}}}}}\");\n}",
  17952. "project": "mongo",
  17953. "hash": 104707670049001259389543063048121966590,
  17954. "size": 11,
  17955. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17956. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17957. "target": 0,
  17958. "dataset": "other",
  17959. "idx": 393100
  17960. },
  17961. {
  17962. "func": "TEST_F(QueryPlannerTest, IndexFilterAppliedDefault) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSON(\"x\" << 5));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: 5}}}\");\n assertSolutionExists(\"{fetch: {filter: null, node: {ixscan: {pattern: {x: 1}}}}}\");\n\n // Check indexFilterApplied in query solutions;\n for (auto it = solns.begin(); it != solns.end(); ++it) {\n QuerySolution* soln = it->get();\n ASSERT_FALSE(soln->indexFilterApplied);\n }\n}",
  17963. "project": "mongo",
  17964. "hash": 68683081860518375518372909711333411770,
  17965. "size": 15,
  17966. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17967. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17968. "target": 0,
  17969. "dataset": "other",
  17970. "idx": 393101
  17971. },
  17972. {
  17973. "func": "TEST_F(QueryPlannerTest, HintValidWithPredicate) {\n addIndex(BSON(\"a\" << 1));\n runQueryHint(fromjson(\"{a: {$gt: 1}}\"), fromjson(\"{a: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  17974. "project": "mongo",
  17975. "hash": 114440008817823715890532637685348792734,
  17976. "size": 9,
  17977. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17978. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17979. "target": 0,
  17980. "dataset": "other",
  17981. "idx": 393102
  17982. },
  17983. {
  17984. "func": "TEST_F(QueryPlannerTest, CantExplodeWithEmptyBounds) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{a: {$in: []}}\"), BSON(\"b\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1}}}}}}}}}\");\n}",
  17985. "project": "mongo",
  17986. "hash": 151694033800007838348726534410531802976,
  17987. "size": 12,
  17988. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  17989. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  17990. "target": 0,
  17991. "dataset": "other",
  17992. "idx": 393103
  17993. },
  17994. {
  17995. "func": "TEST_F(QueryPlannerTest, MergeSortReverseScanOneIndexNotExplodeForSort) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << -1 << \"b\" << -1));\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {$or: [{a: 1, b: 1}, {a: {$lt: 0}}]}, sort: {a: -1}}\"));\n\n assertNumSolutions(5U);\n assertSolutionExists(\n \"{sort: {pattern: {a: -1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: -1, b: -1}, dir: 1}}, {ixscan: {pattern: {a: 1}, dir: -1}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}, dir: -1}}}}, {ixscan: \"\n \"{pattern: {a: 1}, dir: -1}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}, dir: -1}}}}, {ixscan: \"\n \"{pattern: {a: -1, b: -1}, dir: 1}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: -1, b: -1}, dir: 1}}, {ixscan: {pattern: {a: -1, b: -1}, dir: \"\n \"1}}]}}}}\");\n}",
  17996. "project": "mongo",
  17997. "hash": 205284572304512423122804778369769674489,
  17998. "size": 26,
  17999. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18000. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18001. "target": 0,
  18002. "dataset": "other",
  18003. "idx": 393104
  18004. },
  18005. {
  18006. "func": "TEST_F(QueryPlannerTest, AndWithOrWithOneIndex) {\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{b:1}, {c:7}], a:20}\"));\n\n // Logical rewrite gives us at least one of these:\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n size_t matches = 0;\n matches += numSolutionMatches(\n \"{fetch: {filter: {$or: [{b: 1}, {c: 7}]}, \"\n \"node: {ixscan: {filter: null, pattern: {a: 1}}}}}\");\n matches += numSolutionMatches(\n \"{or: {filter: null, nodes: [\"\n \"{fetch: {filter: {b:1}, node: {\"\n \"ixscan: {filter: null, pattern: {a:1}}}}},\"\n \"{fetch: {filter: {c:7}, node: {\"\n \"ixscan: {filter: null, pattern: {a:1}}}}}]}}\");\n ASSERT_GREATER_THAN_OR_EQUALS(matches, 1U);\n}",
  18007. "project": "mongo",
  18008. "hash": 51247089642623315446635160600220763636,
  18009. "size": 19,
  18010. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18011. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18012. "target": 0,
  18013. "dataset": "other",
  18014. "idx": 393105
  18015. },
  18016. {
  18017. "func": "TEST_F(QueryPlannerTest, AndWithNestedNE) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{a: {$gt: -1, $lt: 1, $ne: 0}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [[-1,0,false,false], \"\n \"[0,1,false,false]]}}}}}\");\n}",
  18018. "project": "mongo",
  18019. "hash": 181397326204497552481354510134768743553,
  18020. "size": 11,
  18021. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18022. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18023. "target": 0,
  18024. "dataset": "other",
  18025. "idx": 393106
  18026. },
  18027. {
  18028. "func": "TEST_F(QueryPlannerTest, InCompoundIndexLast) {\n addIndex(fromjson(\"{a: 1, b: 1}\"));\n runQuery(fromjson(\"{a: 3, b: {$in: [1, 2]}}\"));\n\n assertNumSolutions(2U);\n // TODO: update filter in cscan solution when SERVER-12024 is implemented\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: 3, b: {$in: [1, 2]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {pattern: {a: 1, b: 1}}}}}\");\n}",
  18029. "project": "mongo",
  18030. "hash": 25930871364075823668237546908957554849,
  18031. "size": 11,
  18032. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18033. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18034. "target": 0,
  18035. "dataset": "other",
  18036. "idx": 393107
  18037. },
  18038. {
  18039. "func": "TEST_F(QueryPlannerTest, ContainedOrOnePredicateIsLeadingFieldMoveToAnd) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1 << \"d\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"e\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {b: 6}, {$or: [{$and: [{c: 7}, {d: 8}]}, {e: 9}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1, d: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, \"\n \"true, true]], c: [[7, 7, true, true]], d: [[8, 8, true, true]]}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, e: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]], e: [[9, 9, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{c: 7}, {d: 8}]}, {e: 9}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1, d: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, \"\n \"true, true]], c: [['MinKey', 'MaxKey', true, true]], d: [['MinKey', 'MaxKey', true, \"\n \"true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{c: 7}, {d: 8}]}, {e: 9}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1, e: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]], e: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18040. "project": "mongo",
  18041. "hash": 112559289622790329075782054940952515177,
  18042. "size": 26,
  18043. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18044. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18045. "target": 0,
  18046. "dataset": "other",
  18047. "idx": 393108
  18048. },
  18049. {
  18050. "func": "TEST_F(QueryPlannerTest, HintOnNonUniqueIndex) {\n params.options = QueryPlannerParams::INDEX_INTERSECTION;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1),\n false, // multikey\n false, // sparse,\n true); // unique\n\n runQueryHint(fromjson(\"{a: 1, b: 1}\"), BSON(\"a\" << 1));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: {b: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  18051. "project": "mongo",
  18052. "hash": 224866965562239345031883546879691035582,
  18053. "size": 16,
  18054. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18055. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18056. "target": 0,
  18057. "dataset": "other",
  18058. "idx": 393109
  18059. },
  18060. {
  18061. "func": "TEST_F(QueryPlannerTest, ExistsFalse) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(fromjson(\"{x: {$exists: false}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  18062. "project": "mongo",
  18063. "hash": 227594385996837949211728398260286870129,
  18064. "size": 9,
  18065. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18066. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18067. "target": 0,
  18068. "dataset": "other",
  18069. "idx": 393110
  18070. },
  18071. {
  18072. "func": "TEST_F(QueryPlannerTest, CompoundIndexBoundsIntersectRanges) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n runQuery(fromjson(\"{a: {$gt: 1, $lt: 10}, c: {$gt: 1, $lt: 10}}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1,b:1,c:1}, \"\n \"bounds: {a: [[1,10,false,false]], \"\n \"b: [['MinKey','MaxKey',true,true]], \"\n \"c: [[1,10,false,false]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1,c:1}, \"\n \"bounds: {a: [[1,10,false,false]], \"\n \"c: [[1,10,false,false]]}}}}}\");\n}",
  18073. "project": "mongo",
  18074. "hash": 85055604089079010422131829598692069913,
  18075. "size": 17,
  18076. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18077. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18078. "target": 0,
  18079. "dataset": "other",
  18080. "idx": 393111
  18081. },
  18082. {
  18083. "func": "TEST_F(QueryPlannerTest, IntersectSortFromAndHash) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuerySortProj(fromjson(\"{a: 1, b:{$gt: 1}}\"), fromjson(\"{b:1}\"), BSONObj());\n\n // This provides the sort.\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1}}},\"\n \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\");\n\n // Rearrange the preds, shouldn't matter.\n runQuerySortProj(fromjson(\"{b: 1, a:{$lt: 7}}\"), fromjson(\"{b:1}\"), BSONObj());\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1}}},\"\n \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\");\n}",
  18084. "project": "mongo",
  18085. "hash": 28696748727592543561130985684629145600,
  18086. "size": 19,
  18087. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18088. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18089. "target": 0,
  18090. "dataset": "other",
  18091. "idx": 393112
  18092. },
  18093. {
  18094. "func": "TEST_F(QueryPlannerTest, IntersectDisableAndHash) {\n bool oldEnableHashIntersection = internalQueryPlannerEnableHashIntersection.load();\n\n // Turn index intersection on but disable hash-based intersection.\n internalQueryPlannerEnableHashIntersection.store(false);\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{a: {$gt: 1}, b: 1, c: 1}\"));\n\n // We should do an AND_SORT intersection of {b: 1} and {c: 1}, but no AND_HASH plans.\n assertNumSolutions(4U);\n assertSolutionExists(\n \"{fetch: {filter: {b: 1, c: 1}, node: {ixscan: \"\n \"{pattern: {a: 1}, bounds: {a: [[1,Infinity,false,true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:{$gt:1},c:1}, node: {ixscan: \"\n \"{pattern: {b: 1}, bounds: {b: [[1,1,true,true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:{$gt:1},b:1}, node: {ixscan: \"\n \"{pattern: {c: 1}, bounds: {c: [[1,1,true,true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:{$gt:1}}, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {b:1}}},\"\n \"{ixscan: {filter: null, pattern: {c:1}}}]}}}}\");\n\n // Restore the old value of the has intersection switch.\n internalQueryPlannerEnableHashIntersection.store(oldEnableHashIntersection);\n}",
  18095. "project": "mongo",
  18096. "hash": 2741026491913753697350982249706160109,
  18097. "size": 32,
  18098. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18099. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18100. "target": 0,
  18101. "dataset": "other",
  18102. "idx": 393114
  18103. },
  18104. {
  18105. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionDoesNotConsiderNonHintedIndices) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}, hint: {_id: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {_id: 1}, \"\n \"bounds: {_id: [['MinKey', 'MaxKey', true, true]]}}}}}}}\");\n}",
  18106. "project": "mongo",
  18107. "hash": 269430267631611915312885807690905614074,
  18108. "size": 11,
  18109. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18110. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18111. "target": 0,
  18112. "dataset": "other",
  18113. "idx": 393115
  18114. },
  18115. {
  18116. "func": "TEST_F(QueryPlannerTest, SkipAndSoftLimit) {\n addIndex(BSON(\"x\" << 1));\n\n runQuerySkipNToReturn(BSON(\"x\" << BSON(\"$lte\" << 4)), 7, 2);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{skip: {n: 7, node: \"\n \"{cscan: {dir: 1, filter: {x: {$lte: 4}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {skip: {n: 7, node: \"\n \"{ixscan: {filter: null, pattern: {x: 1}}}}}}}\");\n}",
  18117. "project": "mongo",
  18118. "hash": 19195583342749883536600700774447572747,
  18119. "size": 13,
  18120. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18121. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18122. "target": 0,
  18123. "dataset": "other",
  18124. "idx": 393116
  18125. },
  18126. {
  18127. "func": "TEST_F(QueryPlannerTest, SparseIndexIgnoreForSort) {\n addIndex(fromjson(\"{a: 1}\"), false, true);\n runQuerySortProj(BSONObj(), fromjson(\"{a: 1}\"), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sort: {pattern: {a: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n}",
  18128. "project": "mongo",
  18129. "hash": 285116630948301740183124799453291865231,
  18130. "size": 9,
  18131. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18132. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18133. "target": 0,
  18134. "dataset": "other",
  18135. "idx": 393117
  18136. },
  18137. {
  18138. "func": "TEST_F(QueryPlannerTest, NoKeepWithNToReturn) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n params.options |= QueryPlannerParams::SPLIT_LIMITED_SORT;\n addIndex(BSON(\"a\" << 1));\n runQuerySortProjSkipNToReturn(fromjson(\"{a: 1}\"), fromjson(\"{b: 1}\"), BSONObj(), 0, 3);\n\n assertSolutionExists(\n \"{ensureSorted: {pattern: {b: 1}, node: \"\n \"{or: {nodes: [\"\n \"{sort: {pattern: {b: 1}, limit: 3, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a: 1}}}}}}}}}, \"\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a: 1}}}}}}}}}]}}}}\");\n}",
  18139. "project": "mongo",
  18140. "hash": 47535862105249636382089692049132519826,
  18141. "size": 14,
  18142. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18143. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18144. "target": 0,
  18145. "dataset": "other",
  18146. "idx": 393118
  18147. },
  18148. {
  18149. "func": "TEST_F(QueryPlannerTest, NestedContainedOr) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"d\" << 1 << \"a\" << 1));\n addIndex(BSON(\"e\" << 1 << \"a\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {$and: [{c: 7}, {$or: [{d: 8}, {e: 9}]}]}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{fetch: {filter: {c: 7}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {d: 1, a: 1}, bounds: {d: [[8, 8, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {e: 1, a: 1}, bounds: {e: [[9, 9, true, true]], a: [[5, 5, true, \"\n \"true]]}}}\"\n \"]}}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18150. "project": "mongo",
  18151. "hash": 312090570179748625350709009432784232356,
  18152. "size": 21,
  18153. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18154. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18155. "target": 0,
  18156. "dataset": "other",
  18157. "idx": 393119
  18158. },
  18159. {
  18160. "func": "TEST_F(QueryPlannerTest, NonTopLevelIndexedNegation) {\n addIndex(BSON(\"state\" << 1));\n addIndex(BSON(\"is_draft\" << 1));\n addIndex(BSON(\"published_date\" << 1));\n addIndex(BSON(\"newsroom_id\" << 1));\n\n BSONObj queryObj = fromjson(\n \"{$and:[{$or:[{is_draft:false},{creator_id:1}]},\"\n \"{$or:[{state:3,is_draft:false},\"\n \"{published_date:{$ne:null}}]},\"\n \"{newsroom_id:{$in:[1]}}]}\");\n runQuery(queryObj);\n}",
  18161. "project": "mongo",
  18162. "hash": 18628006739077539370574963735698974218,
  18163. "size": 13,
  18164. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18165. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18166. "target": 0,
  18167. "dataset": "other",
  18168. "idx": 393120
  18169. },
  18170. {
  18171. "func": "TEST_F(QueryPlannerTest, NegationElemMatchObject) {\n addIndex(BSON(\"i.j\" << 1));\n runQuery(fromjson(\"{i: {$not: {$elemMatch: {j: 1}}}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  18172. "project": "mongo",
  18173. "hash": 47104090888158532563672915398649406454,
  18174. "size": 7,
  18175. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18176. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18177. "target": 0,
  18178. "dataset": "other",
  18179. "idx": 393121
  18180. },
  18181. {
  18182. "func": "TEST_F(QueryPlannerTest, IndexBoundsAndWithNestedOr) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$and: [{a: 1, $or: [{a: 2}, {a: 3}]}]}\"));\n\n // Given that the index over 'a' isn't multikey, we ideally won't generate any solutions\n // since we know the query describes an empty set if 'a' isn't multikey. Any solutions\n // below are \"this is how it currently works\" instead of \"this is how it should work.\"\n\n // It's kind of iffy to look for indexed solutions so we don't...\n size_t matches = 0;\n matches += numSolutionMatches(\n \"{cscan: {dir: 1, filter: \"\n \"{$or: [{a: 2, a:1}, {a: 3, a:1}]}}}\");\n matches += numSolutionMatches(\n \"{cscan: {dir: 1, filter: \"\n \"{$and: [{$or: [{a: 2}, {a: 3}]}, {a: 1}]}}}\");\n ASSERT_GREATER_THAN_OR_EQUALS(matches, 1U);\n}",
  18183. "project": "mongo",
  18184. "hash": 159002609811706012158833029323994655703,
  18185. "size": 18,
  18186. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18187. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18188. "target": 0,
  18189. "dataset": "other",
  18190. "idx": 393122
  18191. },
  18192. {
  18193. "func": "TEST_F(QueryPlannerTest, OrCollapsesToSingleScan2) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a:{$lt:2}}, {a:{$lt:4}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [[-Infinity,4,true,false]]}}}}}\");\n}",
  18194. "project": "mongo",
  18195. "hash": 38262344488296403139276575465236163256,
  18196. "size": 10,
  18197. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18198. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18199. "target": 0,
  18200. "dataset": "other",
  18201. "idx": 393123
  18202. },
  18203. {
  18204. "func": "TEST_F(QueryPlannerTest, OrOfAnd) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a:{$gt:2,$lt:10}}, {a:{$gt:0,$lt:5}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a:1}, bounds: {a: [[2,10,false,false]]}}}, \"\n \"{ixscan: {pattern: {a:1}, bounds: \"\n \"{a: [[0,5,false,false]]}}}]}}}}\");\n}",
  18205. "project": "mongo",
  18206. "hash": 71104803924299292643580863808461969409,
  18207. "size": 12,
  18208. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18209. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18210. "target": 0,
  18211. "dataset": "other",
  18212. "idx": 393125
  18213. },
  18214. {
  18215. "func": "TEST_F(QueryPlannerTest, NinUsesMultikeyIndex) {\n // true means multikey\n addIndex(BSON(\"a\" << 1), true);\n runQuery(fromjson(\"{a: {$nin: [4, 10]}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:{$nin:[4,10]}}, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [['MinKey',4,true,false],\"\n \"[4,10,false,false],\"\n \"[10,'MaxKey',false,true]]}}}}}\");\n}",
  18216. "project": "mongo",
  18217. "hash": 189075725688925288294691147759767024117,
  18218. "size": 13,
  18219. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18220. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18221. "target": 0,
  18222. "dataset": "other",
  18223. "idx": 393126
  18224. },
  18225. {
  18226. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithoutProjectionUsesCollscan) {\n addIndex(BSON(\"a\" << 1));\n runQuery(BSONObj());\n assertNumSolutions(1);\n assertSolutionExists(\"{cscan: {dir: 1}}}\");\n}",
  18227. "project": "mongo",
  18228. "hash": 165684767679492404304197809872900206566,
  18229. "size": 6,
  18230. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18231. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18232. "target": 0,
  18233. "dataset": "other",
  18234. "idx": 393127
  18235. },
  18236. {
  18237. "func": "TEST_F(QueryPlannerTest, Mod) {\n addIndex(BSON(\"a\" << 1));\n\n runQuery(fromjson(\"{a: {$mod: [2, 0]}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: {$mod: [2, 0]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: {a: {$mod: [2, 0]}}, pattern: {a: 1}}}}}\");\n}",
  18238. "project": "mongo",
  18239. "hash": 94133996522280422417840378664704840339,
  18240. "size": 11,
  18241. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18242. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18243. "target": 0,
  18244. "dataset": "other",
  18245. "idx": 393128
  18246. },
  18247. {
  18248. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCompoundFields) {\n MultikeyPaths multikeyPaths{{0U}, {0U}};\n addIndex(BSON(\"b\" << 1 << \"a\" << 1), multikeyPaths);\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18249. "project": "mongo",
  18250. "hash": 179274665551208333571071153583077013705,
  18251. "size": 15,
  18252. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18253. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18254. "target": 0,
  18255. "dataset": "other",
  18256. "idx": 393129
  18257. },
  18258. {
  18259. "func": "TEST_F(QueryPlannerTest, NaturalHint) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuerySortHint(BSON(\"a\" << 1), BSON(\"b\" << 1), BSON(\"$natural\" << 1));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {filter: {a: 1}, dir: 1}}}}}}\");\n}",
  18260. "project": "mongo",
  18261. "hash": 32972094775364650856806941277453852330,
  18262. "size": 10,
  18263. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18264. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18265. "target": 0,
  18266. "dataset": "other",
  18267. "idx": 393130
  18268. },
  18269. {
  18270. "func": "TEST_F(QueryPlannerTest, NegationIndexForSort) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{a: {$ne: 1}}\"), fromjson(\"{a: 1}\"), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {a: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1}, \"\n \"bounds: {a: [['MinKey',1,true,false], \"\n \"[1,'MaxKey',false,true]]}}}}}\");\n}",
  18271. "project": "mongo",
  18272. "hash": 311373871131537740093799403318532880270,
  18273. "size": 13,
  18274. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18275. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18276. "target": 0,
  18277. "dataset": "other",
  18278. "idx": 393131
  18279. },
  18280. {
  18281. "func": "TEST_F(QueryPlannerTest, SparseIndexPreferCompoundIndexForSort) {\n addIndex(fromjson(\"{a: 1}\"), false, true);\n addIndex(fromjson(\"{a: 1, b: 1}\"));\n runQuerySortProj(BSONObj(), fromjson(\"{a: 1}\"), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {a: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  18282. "project": "mongo",
  18283. "hash": 210933572012156853282452468185686296489,
  18284. "size": 13,
  18285. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18286. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18287. "target": 0,
  18288. "dataset": "other",
  18289. "idx": 393132
  18290. },
  18291. {
  18292. "func": "TEST_F(QueryPlannerTest, ProjNonCovering) {\n addIndex(BSON(\"x\" << 1));\n runQuerySortProj(fromjson(\"{ x : {$gt: 1}}\"), BSONObj(), fromjson(\"{x: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {x: 1}, node: {cscan: \"\n \"{dir: 1, filter: {x: {$gt: 1}}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {x: 1}, node: {fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {x: 1}}}}}}}\");\n}",
  18293. "project": "mongo",
  18294. "hash": 291102650667039666966913997383414551345,
  18295. "size": 12,
  18296. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18297. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18298. "target": 0,
  18299. "dataset": "other",
  18300. "idx": 393133
  18301. },
  18302. {
  18303. "func": "TEST_F(QueryPlannerTest, HintedBlockingSortIndexFilteredOut) {\n params.options = QueryPlannerParams::NO_BLOCKING_SORT;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {a: 1, b: 1}, sort: {b: 1}, hint: {a: 1}}\"));\n assertNumSolutions(0U);\n}",
  18304. "project": "mongo",
  18305. "hash": 208017026680893034377949748665036955433,
  18306. "size": 8,
  18307. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18308. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18309. "target": 0,
  18310. "dataset": "other",
  18311. "idx": 393134
  18312. },
  18313. {
  18314. "func": "TEST_F(QueryPlannerTest, CompoundIndexBoundsStringBounds) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{a: {$gt: 'foo'}, b: {$gte: 'bar'}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {filter: null, pattern: \"\n \"{a: 1, b: 1}, bounds: {a: [['foo',{},false,false]], \"\n \"b:[['bar',{},true,false]]}}}}}\");\n}",
  18315. "project": "mongo",
  18316. "hash": 19022480509473876679059075551135185938,
  18317. "size": 11,
  18318. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18319. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18320. "target": 0,
  18321. "dataset": "other",
  18322. "idx": 393135
  18323. },
  18324. {
  18325. "func": "TEST_F(QueryPlannerTest,\n EmptyQueryWithProjectionDoesNotUseCoveredIxscanOnDotttedNonMultikeyIndexIfDisabled) {\n params.options &= ~QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a.b\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, 'a.b': 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, 'a.b': 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  18326. "project": "mongo",
  18327. "hash": 39463928021061846426497787279457730487,
  18328. "size": 10,
  18329. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18330. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18331. "target": 0,
  18332. "dataset": "other",
  18333. "idx": 393136
  18334. },
  18335. {
  18336. "func": "TEST_F(QueryPlannerTest, NegatePredOnCompoundIndex) {\n addIndex(BSON(\"x\" << 1 << \"a\" << 1));\n runQuery(fromjson(\"{x: 1, a: {$ne: 1}, b: {$ne: 2}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {x:1,a:1}, bounds: \"\n \"{x: [[1,1,true,true]], \"\n \"a: [['MinKey',1,true,false], [1,'MaxKey',false,true]]}}}}}\");\n}",
  18337. "project": "mongo",
  18338. "hash": 340265329963639780111056058294837163796,
  18339. "size": 11,
  18340. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18341. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18342. "target": 0,
  18343. "dataset": "other",
  18344. "idx": 393137
  18345. },
  18346. {
  18347. "func": "TEST_F(QueryPlannerTest, NonPrefixRegexInCovering) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{a: {$in: [/foo/, /bar/]}}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1, filter: {a:{$in:[/foo/,/bar/]}}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: {a:{$in:[/foo/,/bar/]}}, pattern: {a: 1}}}}}\");\n}",
  18348. "project": "mongo",
  18349. "hash": 272861909429850640186217357412211547583,
  18350. "size": 12,
  18351. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18352. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18353. "target": 0,
  18354. "dataset": "other",
  18355. "idx": 393138
  18356. },
  18357. {
  18358. "func": "TEST_F(QueryPlannerTest, ContainedOrMultikeyCompoundTrailingFields) {\n const bool multikey = true;\n addIndex(BSON(\"b\" << 1 << \"a\" << 1 << \"c\" << 1), multikey);\n addIndex(BSON(\"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1, c: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]], c: [[7, 7, true, true]]}}},\"\n \"{ixscan: {pattern: {d: 1}, bounds: {d: [[8, 8, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18359. "project": "mongo",
  18360. "hash": 235350325707264513663024522844480001883,
  18361. "size": 15,
  18362. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18363. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18364. "target": 0,
  18365. "dataset": "other",
  18366. "idx": 393139
  18367. },
  18368. {
  18369. "func": "TEST_F(QueryPlannerTest, MaxMinReverseSort) {\n addIndex(BSON(\"a\" << 1));\n\n // Run an empty query, sort {a: -1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{a: -1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 2}\"),\n fromjson(\"{a: 8}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: -1, pattern: {a: 1}}}}}\");\n}",
  18370. "project": "mongo",
  18371. "hash": 154133800178629729706759664177027670038,
  18372. "size": 17,
  18373. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18374. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18375. "target": 0,
  18376. "dataset": "other",
  18377. "idx": 393140
  18378. },
  18379. {
  18380. "func": "TEST_F(QueryPlannerTest, PrefixRegex) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{a: /^foo/}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: /^foo/}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1}}}}}\");\n}",
  18381. "project": "mongo",
  18382. "hash": 86716536525162325629780804228716712691,
  18383. "size": 10,
  18384. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18385. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18386. "target": 0,
  18387. "dataset": "other",
  18388. "idx": 393141
  18389. },
  18390. {
  18391. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicatesAreLeadingFields) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: {$gte: 0}}, {a: {$lte: 10}}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[0, 10, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[0, 10, true, true]], c: [[7, 7, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[0, 10, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[0, 10, true, true]], c: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18392. "project": "mongo",
  18393. "hash": 314772004902643906786386325300005948948,
  18394. "size": 25,
  18395. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18396. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18397. "target": 0,
  18398. "dataset": "other",
  18399. "idx": 393143
  18400. },
  18401. {
  18402. "func": "TEST_F(QueryPlannerTest, CannotTrimIxisectParamSelfIntersection) {\n params.options = QueryPlannerParams::CANNOT_TRIM_IXISECT;\n params.options = QueryPlannerParams::INDEX_INTERSECTION;\n params.options |= QueryPlannerParams::NO_TABLE_SCAN;\n\n // true means multikey\n addIndex(BSON(\"a\" << 1), true);\n\n runQuery(fromjson(\"{a: {$all: [1, 2, 3]}}\"));\n\n assertNumSolutions(4U);\n assertSolutionExists(\n \"{fetch: {filter: {$and: [{a:2}, {a:3}]}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and: [{a:1}, {a:3}]}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and: [{a:2}, {a:3}]}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1},\"\n \"bounds: {a: [[1,1,true,true]]}}},\"\n \"{ixscan: {filter: null, pattern: {a:1},\"\n \"bounds: {a: [[2,2,true,true]]}}},\"\n \"{ixscan: {filter: null, pattern: {a:1},\"\n \"bounds: {a: [[3,3,true,true]]}}}]}}}}\");\n}",
  18403. "project": "mongo",
  18404. "hash": 321730225155722303971865047915520983628,
  18405. "size": 29,
  18406. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18407. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18408. "target": 0,
  18409. "dataset": "other",
  18410. "idx": 393144
  18411. },
  18412. {
  18413. "func": "TEST_F(QueryPlannerTest, LockstepOrEnumerationSanityCheckTwoChildrenTwoIndexesEach) {\n params.options =\n QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::ENUMERATE_OR_CHILDREN_LOCKSTEP;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {a: 1, $or: [{b: 1, c: 1}, {b: 2, c: 2}]}}\"));\n\n assertNumSolutions(6U);\n\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {c: {$eq: 1} }, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {b: {$eq: 1} }, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {c: {$eq: 1} }, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [{fetch: {filter: {b: {$eq: 1} }, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}]}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: {$eq: 1}, c: {$eq: 1}}, {b: {$eq: 2}, c: {$eq: 2}}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: {$eq: 1}, c: {$eq: 1}}, {b: {$eq: 2}, c: {$eq: 2}}]}, node: \"\n \"{ixscan: {pattern: {a: 1, c: 1}}}}}}}\");\n}",
  18414. "project": "mongo",
  18415. "hash": 285125256619263256245324705150972080721,
  18416. "size": 30,
  18417. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18418. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18419. "target": 0,
  18420. "dataset": "other",
  18421. "idx": 393145
  18422. },
  18423. {
  18424. "func": "TEST_F(QueryPlannerTest, ExistsTrue) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(fromjson(\"{x: {$exists: true}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  18425. "project": "mongo",
  18426. "hash": 215187873589315216592901979553385568822,
  18427. "size": 9,
  18428. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18429. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18430. "target": 0,
  18431. "dataset": "other",
  18432. "idx": 393146
  18433. },
  18434. {
  18435. "func": "TEST_F(QueryPlannerTest, MergeSortReverseIxscanBelowFetch) {\n addIndex(BSON(\"a\" << 1 << \"d\" << 1));\n addIndex(BSON(\"b\" << 1 << \"d\" << -1));\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {$or: [{a: 1}, {b: 1, c: 1}]}, sort: {d: 1}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {d: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: 1, d: 1}, dir: 1}}, {fetch: {node: {ixscan: {pattern: {b: 1, d: \"\n \"-1}, dir: -1}}}}]}}}}\");\n}",
  18436. "project": "mongo",
  18437. "hash": 82165649784077631158535975188816161366,
  18438. "size": 15,
  18439. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18440. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18441. "target": 0,
  18442. "dataset": "other",
  18443. "idx": 393147
  18444. },
  18445. {
  18446. "func": "TEST_F(QueryPlannerTest, InSparseIndex) {\n addIndex(fromjson(\"{a: 1}\"),\n false, // multikey\n true); // sparse\n runQuery(fromjson(\"{a: {$in: [null]}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: {$eq: null}}}}\");\n}",
  18447. "project": "mongo",
  18448. "hash": 161401535817456127043855244231103474093,
  18449. "size": 9,
  18450. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18451. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18452. "target": 0,
  18453. "dataset": "other",
  18454. "idx": 393148
  18455. },
  18456. {
  18457. "func": "TEST_F(QueryPlannerTest, NoTableScanOrWithAndChild) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a: 20}, {$and: [{a:1}, {b:7}]}]}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a: 1}}}, \"\n \"{fetch: {filter: {b: 7}, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1}}}}}]}}}}\");\n}",
  18458. "project": "mongo",
  18459. "hash": 184625780542982313268379852965947497499,
  18460. "size": 12,
  18461. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18462. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18463. "target": 0,
  18464. "dataset": "other",
  18465. "idx": 393149
  18466. },
  18467. {
  18468. "func": "TEST_F(QueryPlannerTest, LessThanEqual) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSON(\"x\" << BSON(\"$lte\" << 5)));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: {$lte: 5}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n}",
  18469. "project": "mongo",
  18470. "hash": 48548720472398212390079240085558142800,
  18471. "size": 11,
  18472. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18473. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18474. "target": 0,
  18475. "dataset": "other",
  18476. "idx": 393150
  18477. },
  18478. {
  18479. "func": "TEST_F(QueryPlannerTest, AndWithUnindexedOrChild) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{a:20, $or: [{b:1}, {c:7}]}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n\n // Logical rewrite means we could get one of these two outcomes:\n size_t matches = 0;\n matches += numSolutionMatches(\n \"{fetch: {filter: {$or: [{b: 1}, {c: 7}]}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n matches += numSolutionMatches(\n \"{or: {filter: null, nodes: [\"\n \"{fetch: {filter: {b:1}, node: {\"\n \"ixscan: {filter: null, pattern: {a:1}}}}},\"\n \"{fetch: {filter: {c:7}, node: {\"\n \"ixscan: {filter: null, pattern: {a:1}}}}}]}}\");\n ASSERT_GREATER_THAN_OR_EQUALS(matches, 1U);\n}",
  18480. "project": "mongo",
  18481. "hash": 217071064264483469147999168340712153094,
  18482. "size": 20,
  18483. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18484. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18485. "target": 0,
  18486. "dataset": "other",
  18487. "idx": 393151
  18488. },
  18489. {
  18490. "func": "TEST_F(QueryPlannerTest, ContainedOrIntersect) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{a: {$gte: 5}}, {$or: [{b: 6}, {$and: [{c: 7}, {a: {$lte: 8}}]}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, Infinity, \"\n \"true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 8, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18491. "project": "mongo",
  18492. "hash": 219269843606528417929541137086835169921,
  18493. "size": 16,
  18494. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18495. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18496. "target": 0,
  18497. "dataset": "other",
  18498. "idx": 393152
  18499. },
  18500. {
  18501. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicatesAreLeadingFieldsMoveToAnd) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"d\" << 1));\n\n runQuery(fromjson(\n \"{$and: [{a: {$gte: 0}}, {a: {$lte: 10}}, {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[0, 10, true, true]], b: [[6, 6, \"\n \"true, true]], c: [[7, 7, true, true]]}}},\"\n \"{ixscan: {pattern: {a: 1, d: 1}, bounds: {a: [[0, 10, true, true]], d: [[8, 8, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[0, 10, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]], c: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, d: 1}, bounds: {a: [[0, 10, true, true]], d: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18502. "project": "mongo",
  18503. "hash": 52297236962623610797940964974594353064,
  18504. "size": 26,
  18505. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18506. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18507. "target": 0,
  18508. "dataset": "other",
  18509. "idx": 393153
  18510. },
  18511. {
  18512. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionDoesNotUseCoveredIxscanOnCompoundIndexIfDisabled) {\n params.options &= ~QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1, c: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, c: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  18513. "project": "mongo",
  18514. "hash": 284368121696452654522558531405027962742,
  18515. "size": 9,
  18516. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18517. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18518. "target": 0,
  18519. "dataset": "other",
  18520. "idx": 393154
  18521. },
  18522. {
  18523. "func": "TEST_F(QueryPlannerTest, CompoundFieldsOrder) {\n addIndex(BSON(\"x\" << 1 << \"y\" << 1 << \"z\" << 1));\n runQuery(fromjson(\"{ x : 5, z: 10, y:1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1, y: 1, z: 1}}}}}\");\n}",
  18524. "project": "mongo",
  18525. "hash": 251476823645389948597701305906415393207,
  18526. "size": 10,
  18527. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18528. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18529. "target": 0,
  18530. "dataset": "other",
  18531. "idx": 393155
  18532. },
  18533. {
  18534. "func": "TEST_F(QueryPlannerTest, MaxMinReverseIndexDirSort) {\n addIndex(BSON(\"a\" << -1));\n\n // Min/max specifies a forward scan with bounds [{a: 8}, {a: 2}]. Asking for\n // an ascending sort reverses the direction of the scan to [{a: 2}, {a: 8}].\n runQueryFull(BSONObj(),\n fromjson(\"{a: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 8}\"),\n fromjson(\"{a: 2}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {filter: null, dir: -1,\"\n \"pattern: {a: -1}}}}}\");\n}",
  18535. "project": "mongo",
  18536. "hash": 243775843498881033257027231717119105251,
  18537. "size": 20,
  18538. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18539. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18540. "target": 0,
  18541. "dataset": "other",
  18542. "idx": 393156
  18543. },
  18544. {
  18545. "func": "TEST_F(QueryPlannerTest, ShardFilterCollScan) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\" << 1);\n addIndex(BSON(\"a\" << 1));\n\n runQuery(fromjson(\"{b: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sharding_filter: {node: \"\n \"{cscan: {dir: 1}}}}}}}\");\n}",
  18546. "project": "mongo",
  18547. "hash": 295161209025689723701040013431749949033,
  18548. "size": 12,
  18549. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18550. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18551. "target": 0,
  18552. "dataset": "other",
  18553. "idx": 393157
  18554. },
  18555. {
  18556. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfIndexIsGeo) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\"\n << \"2dsphere\"));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  18557. "project": "mongo",
  18558. "hash": 179802140775363423863920912413842380631,
  18559. "size": 10,
  18560. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18561. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18562. "target": 0,
  18563. "dataset": "other",
  18564. "idx": 393159
  18565. },
  18566. {
  18567. "func": "TEST_F(QueryPlannerTest, IndexBoundsUnindexedSort) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a: 1}, {a: 2}]}\"), BSON(\"b\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {filter: {$or:[{a:1},{a:2}]}, dir: 1}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {b:1}, limit: 0, node: {sortKeyGen: {node: {fetch: \"\n \"{filter: null, node: {ixscan: {filter: null, \"\n \"pattern: {a:1}, bounds: {a: [[1,1,true,true], [2,2,true,true]]}}}}}}}}}\");\n}",
  18568. "project": "mongo",
  18569. "hash": 9277367493605477143732042837924376781,
  18570. "size": 13,
  18571. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18572. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18573. "target": 0,
  18574. "dataset": "other",
  18575. "idx": 393160
  18576. },
  18577. {
  18578. "func": "TEST_F(QueryPlannerTest, PrefixRegexCovering) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{a: /^foo/}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1, filter: {a: /^foo/}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  18579. "project": "mongo",
  18580. "hash": 311431270902625889692529502282541159186,
  18581. "size": 12,
  18582. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18583. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18584. "target": 0,
  18585. "dataset": "other",
  18586. "idx": 393161
  18587. },
  18588. {
  18589. "func": "TEST_F(QueryPlannerTest, ContainedOrMultikeyCannotCombineLeadingFields) {\n const bool multikey = true;\n addIndex(BSON(\"a\" << 1), multikey);\n addIndex(BSON(\"b\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{a: {$lte: 10}}, {b: 6}]}]}\"));\n assertNumSolutions(3);\n assertSolutionExists(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1}, bounds: {a: [[-Infinity, 10, true, true]]}}},\"\n \"{ixscan: {pattern: {b: 1}, bounds: {b: [[6, 6, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{a: {$lte: 10}}, {b: 6}]}, node: \"\n \"{ixscan: {pattern: {a: 1}, bounds: {a: [[0, Infinity, true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18590. "project": "mongo",
  18591. "hash": 302802874574040760957486237515939397161,
  18592. "size": 18,
  18593. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18594. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18595. "target": 0,
  18596. "dataset": "other",
  18597. "idx": 393162
  18598. },
  18599. {
  18600. "func": "TEST_F(QueryPlannerTest, EnumerateNestedOr) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{d: 1, $or: [{a: 1, b: 1}, {c: 1}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{fetch: {filter: {d: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}}}}},\"\n \"{ixscan: {pattern: {c: 1}}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {d: 1}, node: {or: {nodes: [\"\n \"{fetch: {filter: {a: 1}, node: {ixscan: {pattern: {b: 1}}}}},\"\n \"{ixscan: {pattern: {c: 1}}}]}}}}\");\n}",
  18601. "project": "mongo",
  18602. "hash": 154207944156356859619878163763149502029,
  18603. "size": 18,
  18604. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18605. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18606. "target": 0,
  18607. "dataset": "other",
  18608. "idx": 393163
  18609. },
  18610. {
  18611. "func": "TEST_F(QueryPlannerTest, ExplodeRootedOrForSortWorksWithShardingFilter) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n params.options |= QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"c\" << 1);\n\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a: 1}, {a: 3}]}\"), fromjson(\"{b: 1}\"), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sharding_filter: {node: {fetch: {filter: null, node: {mergeSort: {nodes: [\"\n \"{ixscan: {pattern: {a:1,b:1}, filter: null, bounds: {a: [[1,1,true,true]], b: \"\n \"[['MinKey','MaxKey',true,true]]}}},\"\n \"{ixscan: {pattern: {a:1,b:1}, filter: null, bounds: {a: [[3,3,true,true]], b: \"\n \"[['MinKey','MaxKey',true,true]]}}}]}}}}}}\");\n}",
  18612. "project": "mongo",
  18613. "hash": 223056328393791071858081114501692468349,
  18614. "size": 16,
  18615. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18616. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18617. "target": 0,
  18618. "dataset": "other",
  18619. "idx": 393164
  18620. },
  18621. {
  18622. "func": "TEST_F(QueryPlannerTest, BasicSortBooleanIndexKeyPattern) {\n addIndex(BSON(\"a\" << true));\n runQuerySortProj(fromjson(\"{ a : 5 }\"), BSON(\"a\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {a: 1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1, filter: {a: 5}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: true}}}}}\");\n}",
  18623. "project": "mongo",
  18624. "hash": 196353157435157459969239543022343631520,
  18625. "size": 12,
  18626. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18627. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18628. "target": 0,
  18629. "dataset": "other",
  18630. "idx": 393165
  18631. },
  18632. {
  18633. "func": "TEST_F(QueryPlannerTest, ExistsTrueOnUnindexedField) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(fromjson(\"{x: 1, y: {$exists: true}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  18634. "project": "mongo",
  18635. "hash": 173077958261379426221333356423824656169,
  18636. "size": 9,
  18637. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18638. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18639. "target": 0,
  18640. "dataset": "other",
  18641. "idx": 393166
  18642. },
  18643. {
  18644. "func": "TEST_F(QueryPlannerTest, CompoundIndexBoundsMiddleFieldMissing) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQuery(fromjson(\"{a: 1, c: {$lt: 3}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [['MinKey','MaxKey',true,true]], \"\n \" c: [[-Infinity,3,true,false]]}}}}}\");\n}",
  18645. "project": "mongo",
  18646. "hash": 95066557517224502906487325929496091023,
  18647. "size": 11,
  18648. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18649. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18650. "target": 0,
  18651. "dataset": "other",
  18652. "idx": 393167
  18653. },
  18654. {
  18655. "func": "TEST_F(QueryPlannerTest, TwoPlans) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuery(fromjson(\"{a:1, b:{$gt:2,$lt:2}}\"));\n\n // 2 indexed solns and one non-indexed\n ASSERT_EQUALS(getNumSolutions(), 3U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$and:[{b:{$lt:2}},{a:1},{b:{$gt:2}}]}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and:[{b:{$lt:2}},{b:{$gt:2}}]}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  18656. "project": "mongo",
  18657. "hash": 151034042724149636564765890778143225684,
  18658. "size": 16,
  18659. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18660. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18661. "target": 0,
  18662. "dataset": "other",
  18663. "idx": 393168
  18664. },
  18665. {
  18666. "func": "TEST_F(QueryPlannerTest, ExplodeOrForSort2) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n addIndex(BSON(\"d\" << 1 << \"c\" << 1));\n\n runQuerySortProj(\n fromjson(\"{$or: [{a: 1, b: {$in: [1, 2]}}, {d: 3}]}\"), BSON(\"c\" << 1), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {bounds: {a: [[1,1,true,true]], b: [[1,1,true,true]],\"\n \"c: [['MinKey','MaxKey',true,true]]},\"\n \"pattern: {a:1, b:1, c:1}}},\"\n \"{ixscan: {bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]],\"\n \"c: [['MinKey','MaxKey',true,true]]},\"\n \"pattern: {a:1, b:1, c:1}}},\"\n \"{ixscan: {bounds: {d: [[3,3,true,true]], \"\n \"c: [['MinKey','MaxKey',true,true]]},\"\n \"pattern: {d:1, c:1}}}]}}}}\");\n}",
  18667. "project": "mongo",
  18668. "hash": 116077711498581484002411100225355116222,
  18669. "size": 23,
  18670. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18671. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18672. "target": 0,
  18673. "dataset": "other",
  18674. "idx": 393169
  18675. },
  18676. {
  18677. "func": "TEST_F(QueryPlannerTest, ContainedOrOfAndCollapseIndenticalScansWithFilter2) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{c: 1, $or: [{a:{$gte:1,$lte:1}, b:2}, {a:1, b:2, d:3}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {c: 1}, node: {fetch: {filter: null, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}},\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]},\"\n \"filter: null}}}}}\");\n}",
  18678. "project": "mongo",
  18679. "hash": 234793157774344462037389906774123165371,
  18680. "size": 12,
  18681. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18682. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18683. "target": 0,
  18684. "dataset": "other",
  18685. "idx": 393170
  18686. },
  18687. {
  18688. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicateIsLeadingFieldAndTrailingField) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(3);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18689. "project": "mongo",
  18690. "hash": 166977247108111645114169261503301330735,
  18691. "size": 20,
  18692. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18693. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18694. "target": 0,
  18695. "dataset": "other",
  18696. "idx": 393171
  18697. },
  18698. {
  18699. "func": "TEST_F(QueryPlannerTest, IntersectBasicTwoPred) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuery(fromjson(\"{a:1, b:{$gt: 1}}\"));\n\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1}}},\"\n \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\");\n}",
  18700. "project": "mongo",
  18701. "hash": 23026182779594714780989019582842878633,
  18702. "size": 11,
  18703. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18704. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18705. "target": 0,
  18706. "dataset": "other",
  18707. "idx": 393172
  18708. },
  18709. {
  18710. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfIndexIsSparse) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n constexpr bool isMultikey = false;\n constexpr bool isSparse = true;\n addIndex(BSON(\"a\" << 1), isMultikey, isSparse);\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1, b: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  18711. "project": "mongo",
  18712. "hash": 221169555752755985523274736351666854391,
  18713. "size": 11,
  18714. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18715. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18716. "target": 0,
  18717. "dataset": "other",
  18718. "idx": 393173
  18719. },
  18720. {
  18721. "func": "TEST_F(QueryPlannerTest, MergeSortEvenIfSameIndex) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a:1}, {a:7}]}\"), fromjson(\"{b:1}\"), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n // TODO the second solution should be mergeSort rather than just sort\n}",
  18722. "project": "mongo",
  18723. "hash": 321491436300512563726301236595896610381,
  18724. "size": 10,
  18725. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18726. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18727. "target": 0,
  18728. "dataset": "other",
  18729. "idx": 393175
  18730. },
  18731. {
  18732. "func": "TEST_F(QueryPlannerTest, InBasic) {\n addIndex(fromjson(\"{a: 1}\"));\n runQuery(fromjson(\"{a: {$in: [1, 2]}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: {$in: [1, 2]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {pattern: {a: 1}}}}}\");\n}",
  18733. "project": "mongo",
  18734. "hash": 318849519797985624060386969991928165203,
  18735. "size": 10,
  18736. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18737. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18738. "target": 0,
  18739. "dataset": "other",
  18740. "idx": 393177
  18741. },
  18742. {
  18743. "func": "TEST_F(QueryPlannerTest, TwoRegexSameFieldCovering) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(\n fromjson(\"{$and: [{a: /0/}, {a: /1/}]}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1, filter: {$and:[{a:/0/},{a:/1/}]}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: {$and:[{a:/0/},{a:/1/}]}, pattern: {a: 1}}}}}\");\n}",
  18744. "project": "mongo",
  18745. "hash": 315269374129082715172937789155598021540,
  18746. "size": 13,
  18747. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18748. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18749. "target": 0,
  18750. "dataset": "other",
  18751. "idx": 393178
  18752. },
  18753. {
  18754. "func": "TEST_F(QueryPlannerTest, ReverseScanForSort) {\n addIndex(BSON(\"_id\" << 1));\n runQuerySortProj(BSONObj(), fromjson(\"{_id: -1}\"), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {_id: -1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {_id: 1}}}}}\");\n}",
  18755. "project": "mongo",
  18756. "hash": 85714287407402125314839246392292272967,
  18757. "size": 12,
  18758. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18759. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18760. "target": 0,
  18761. "dataset": "other",
  18762. "idx": 393179
  18763. },
  18764. {
  18765. "func": "TEST_F(QueryPlannerTest, NegatedRangeIntGT) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$gt: 5}}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {i:1}, \"\n \"bounds: {i: [['MinKey',5,true,true], \"\n \"[Infinity,'MaxKey',false,true]]}}}}}\");\n}",
  18766. "project": "mongo",
  18767. "hash": 306130653680980354433799517842382479410,
  18768. "size": 11,
  18769. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18770. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18771. "target": 0,
  18772. "dataset": "other",
  18773. "idx": 393180
  18774. },
  18775. {
  18776. "func": "TEST_F(QueryPlannerTest, OrCollapsesToSingleScan) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a:{$gt:2}}, {a:{$gt:0}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [[0,Infinity,false,true]]}}}}}\");\n}",
  18777. "project": "mongo",
  18778. "hash": 306765206728189923926291631380796683142,
  18779. "size": 10,
  18780. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18781. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18782. "target": 0,
  18783. "dataset": "other",
  18784. "idx": 393181
  18785. },
  18786. {
  18787. "func": "TEST_F(QueryPlannerTest, ThreeRegexSameFieldMultikey) {\n // true means multikey\n addIndex(BSON(\"a\" << 1), true);\n runQuery(fromjson(\"{$and: [{a: /0/}, {a: /1/}, {a: /2/}]}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 4U);\n assertSolutionExists(\"{cscan: {filter: {$and:[{a:/0/},{a:/1/},{a:/2/}]}, dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and:[{a:/0/},{a:/1/},{a:/2/}]}, node: {ixscan: \"\n \"{pattern: {a: 1}, filter: null, \"\n \"bounds: {a: [['', {}, true, false], [/0/, /0/, true, true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and:[{a:/1/},{a:/0/},{a:/2/}]}, node: {ixscan: \"\n \"{pattern: {a: 1}, filter: null, \"\n \"bounds: {a: [['', {}, true, false], [/1/, /1/, true, true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and:[{a:/2/},{a:/0/},{a:/1/}]}, node: {ixscan: \"\n \"{pattern: {a: 1}, filter: null, \"\n \"bounds: {a: [['', {}, true, false], [/2/, /2/, true, true]]}}}}}\");\n}",
  18788. "project": "mongo",
  18789. "hash": 43238156433451253146193749748567081545,
  18790. "size": 20,
  18791. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18792. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18793. "target": 0,
  18794. "dataset": "other",
  18795. "idx": 393182
  18796. },
  18797. {
  18798. "func": "TEST_F(QueryPlannerTest, CannotMergeSort) {\n addIndex(BSON(\"a\" << 1 << \"c\" << -1));\n addIndex(BSON(\"b\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', filter: {$or: [{a: 1}, {b: 1}]}, sort: {c: 1}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {c: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {or: {nodes: [{ixscan: {pattern: {a: 1, c: -1}, dir: -1}}, {ixscan: \"\n \"{pattern: {b: 1}, dir: 1}}]}}}}}}}}\");\n}",
  18799. "project": "mongo",
  18800. "hash": 208153405307421163058306753422198229061,
  18801. "size": 14,
  18802. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18803. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18804. "target": 0,
  18805. "dataset": "other",
  18806. "idx": 393183
  18807. },
  18808. {
  18809. "func": "TEST_F(QueryPlannerTest, BasicSoftLimitNoIndex) {\n addIndex(BSON(\"a\" << 1));\n\n runQuerySkipNToReturn(BSON(\"x\" << 5), 0, 3);\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: 5}}}\");\n}",
  18810. "project": "mongo",
  18811. "hash": 77372661973811270140762705533366912985,
  18812. "size": 8,
  18813. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18814. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18815. "target": 0,
  18816. "dataset": "other",
  18817. "idx": 393184
  18818. },
  18819. {
  18820. "func": "TEST_F(QueryPlannerTest, TwoNegatedRanges) {\n addIndex(BSON(\"i\" << 1));\n runQuery(\n fromjson(\"{$and: [{i: {$not: {$lte: 'b'}}}, \"\n \"{i: {$not: {$gte: 'f'}}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {i:1}, \"\n \"bounds: {i: [['MinKey','',true,false], \"\n \"['b','f',false,false], \"\n \"[{},'MaxKey',true,true]]}}}}}\");\n}",
  18821. "project": "mongo",
  18822. "hash": 153249551047060386727096438447639269570,
  18823. "size": 14,
  18824. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18825. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18826. "target": 0,
  18827. "dataset": "other",
  18828. "idx": 393185
  18829. },
  18830. {
  18831. "func": "TEST_F(QueryPlannerTest, NegationTopLevel) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{a: {$ne: 1}}\"), BSONObj(), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [['MinKey',1,true,false], \"\n \"[1,'MaxKey',false,true]]}}}}}\");\n}",
  18832. "project": "mongo",
  18833. "hash": 168192228741273659772125581646255615807,
  18834. "size": 11,
  18835. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18836. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18837. "target": 0,
  18838. "dataset": "other",
  18839. "idx": 393186
  18840. },
  18841. {
  18842. "func": "TEST_F(QueryPlannerTest, FloatingPointInKeyPattern) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << -0.1));\n\n runQuerySortProj(fromjson(\"{a: {$gte: 3, $lte: 5}}\"), fromjson(\"{a: 1}\"), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a: -0.1}, \"\n \"bounds: {a: [[3, 5, true, true]]}}}}}\");\n}",
  18843. "project": "mongo",
  18844. "hash": 286691476812444589773697367642737715463,
  18845. "size": 12,
  18846. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18847. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18848. "target": 0,
  18849. "dataset": "other",
  18850. "idx": 393187
  18851. },
  18852. {
  18853. "func": "TEST_F(QueryPlannerTest, SkipAndLimit) {\n addIndex(BSON(\"x\" << 1));\n\n runQuerySkipNToReturn(BSON(\"x\" << BSON(\"$lte\" << 4)), 7, -2);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{limit: {n: 2, node: {skip: {n: 7, node: \"\n \"{cscan: {dir: 1, filter: {x: {$lte: 4}}}}}}}}\");\n assertSolutionExists(\n \"{limit: {n: 2, node: {fetch: {filter: null, node: \"\n \"{skip: {n: 7, node: {ixscan: {filter: null, pattern: {x: 1}}}}}}}}}\");\n}",
  18854. "project": "mongo",
  18855. "hash": 265422249042537165994666638062500637878,
  18856. "size": 13,
  18857. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18858. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18859. "target": 0,
  18860. "dataset": "other",
  18861. "idx": 393188
  18862. },
  18863. {
  18864. "func": "TEST_F(QueryPlannerTest, TwoRegexCompoundIndexCovering) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{a: /0/, b: /1/}\"), BSONObj(), fromjson(\"{_id: 0, a: 1, b: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \"\n \"{cscan: {dir: 1, filter: {$and:[{a:/0/},{b:/1/}]}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \"\n \"{ixscan: {filter: {$and:[{a:/0/},{b:/1/}]}, pattern: {a: 1, b: 1}}}}}\");\n}",
  18865. "project": "mongo",
  18866. "hash": 192605243810301198641322872099575383686,
  18867. "size": 12,
  18868. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18869. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18870. "target": 0,
  18871. "dataset": "other",
  18872. "idx": 393189
  18873. },
  18874. {
  18875. "func": "TEST_F(QueryPlannerTest, ExprEqCannotUseMultikeyFieldOfIndex) {\n MultikeyPaths multikeyPaths{{0U}};\n addIndex(BSON(\"a.b\" << 1), multikeyPaths);\n runQuery(fromjson(\"{'a.b': {$_internalExprEq: 1}}\"));\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {'a.b': {$_internalExprEq: 1}}}}\");\n}",
  18876. "project": "mongo",
  18877. "hash": 100633174443057579879212358774571304395,
  18878. "size": 7,
  18879. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18880. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18881. "target": 0,
  18882. "dataset": "other",
  18883. "idx": 393190
  18884. },
  18885. {
  18886. "func": "TEST_F(QueryPlannerTest, ContainedOrMultikeyCompoundFields) {\n const bool multikey = true;\n addIndex(BSON(\"b\" << 1 << \"a\" << 1), multikey);\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[5, 5, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18887. "project": "mongo",
  18888. "hash": 15375010445291283421528413986698638330,
  18889. "size": 15,
  18890. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18891. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18892. "target": 0,
  18893. "dataset": "other",
  18894. "idx": 393191
  18895. },
  18896. {
  18897. "func": "TEST_F(QueryPlannerTest, OrInexactWithExact) {\n addIndex(BSON(\"name\" << 1));\n runQuery(fromjson(\"{$or: [{name: 'thomas'}, {name: /^alexand(er|ra)/}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {filter:\"\n \"{$or: [{name: 'thomas'}, {name: /^alexand(er|ra)/}]},\"\n \"pattern: {name: 1}}}}}\");\n}",
  18898. "project": "mongo",
  18899. "hash": 151745332370733700431467502224240564773,
  18900. "size": 11,
  18901. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18902. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18903. "target": 0,
  18904. "dataset": "other",
  18905. "idx": 393192
  18906. },
  18907. {
  18908. "func": "TEST_F(QueryPlannerTest, ExprEqCanUseSparseIndex) {\n params.options &= ~QueryPlannerParams::INCLUDE_COLLSCAN;\n addIndex(fromjson(\"{a: 1}\"), false, true);\n runQuery(fromjson(\"{a: {$_internalExprEq: 1}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1}, bounds: {a: [[1,1,true,true]]}}}}}\");\n}",
  18909. "project": "mongo",
  18910. "hash": 161330988553834747839259936575264480054,
  18911. "size": 10,
  18912. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18913. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18914. "target": 0,
  18915. "dataset": "other",
  18916. "idx": 393193
  18917. },
  18918. {
  18919. "func": "TEST_F(QueryPlannerTest, NegationCantUseSparseIndex2) {\n // false means not multikey, true means sparse\n addIndex(BSON(\"i\" << 1 << \"j\" << 1), false, true);\n runQuery(fromjson(\"{i: 4, j: {$ne: 5}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {i:1,j:1}, bounds: \"\n \"{i: [[4,4,true,true]], j: [['MinKey','MaxKey',true,true]]}}}}}\");\n}",
  18920. "project": "mongo",
  18921. "hash": 334795813909830717694429663507788993879,
  18922. "size": 11,
  18923. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18924. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18925. "target": 0,
  18926. "dataset": "other",
  18927. "idx": 393194
  18928. },
  18929. {
  18930. "func": "TEST_F(QueryPlannerTest, LessThan) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSON(\"x\" << BSON(\"$lt\" << 5)));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: {$lt: 5}}}}\");\n assertSolutionExists(\"{fetch: {filter: null, node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  18931. "project": "mongo",
  18932. "hash": 324792856112295364093025757115356456477,
  18933. "size": 9,
  18934. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18935. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18936. "target": 0,
  18937. "dataset": "other",
  18938. "idx": 393195
  18939. },
  18940. {
  18941. "func": "TEST_F(QueryPlannerTest, ContainedOrNotNextInIndex) {\n addIndex(BSON(\"b\" << 1 << \"d\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, d: 1, a: 1}, bounds: {b: [[6, 6, true, true]], d: [['MinKey', \"\n \"'MaxKey', true, true]], a: [[5, 5, true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  18942. "project": "mongo",
  18943. "hash": 175993236333193109990671788757594357590,
  18944. "size": 15,
  18945. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18946. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18947. "target": 0,
  18948. "dataset": "other",
  18949. "idx": 393196
  18950. },
  18951. {
  18952. "func": "TEST_F(QueryPlannerTest, ExprEqCanUseHashedIndexWithRegex) {\n params.options &= ~QueryPlannerParams::INCLUDE_COLLSCAN;\n addIndex(BSON(\"a\"\n << \"hashed\"));\n runQuery(fromjson(\"{a: {$_internalExprEq: /abc/}}\"));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{fetch: {filter: {a: {$_internalExprEq: /abc/}}, node: {ixscan: {filter: null, pattern: \"\n \"{a: 'hashed'}}}}}\");\n}",
  18953. "project": "mongo",
  18954. "hash": 58810176882044022760209544165295739635,
  18955. "size": 10,
  18956. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18957. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18958. "target": 0,
  18959. "dataset": "other",
  18960. "idx": 393200
  18961. },
  18962. {
  18963. "func": "TEST_F(QueryPlannerTest, MergeSortReverseScans) {\n addIndex(BSON(\"a\" << 1));\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {$or: [{a: 1, b: 1}, {a: {$lt: 0}}]}, sort: {a: -1}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {a: -1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}, dir: -1}}}}, {ixscan: \"\n \"{pattern: {a: 1}, dir: -1}}]}}}}\");\n}",
  18964. "project": "mongo",
  18965. "hash": 223713562483828822373120244123509385617,
  18966. "size": 14,
  18967. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18968. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18969. "target": 0,
  18970. "dataset": "other",
  18971. "idx": 393201
  18972. },
  18973. {
  18974. "func": "TEST_F(QueryPlannerTest, SkipEvaluatesAfterFetchWithPredicate) {\n addIndex(fromjson(\"{a: 1}\"));\n\n runQuerySkipNToReturn(fromjson(\"{a: 5, b: 7}\"), 8, 0);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{skip: {n: 8, node: {cscan: {dir: 1, filter: {a: 5, b: 7}}}}}\");\n\n // When a plan includes a fetch with no predicate, the skip should execute first, so we avoid\n // fetching a document that we will always discard. When the fetch does have a predicate (as in\n // this case), however, that optimization would be invalid; we need to fetch the document and\n // evaluate the filter to determine if the document should count towards the number of skipped\n // documents.\n assertSolutionExists(\n \"{skip: {n: 8, node: {fetch: {filter: {b: 7}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}}}\");\n}",
  18975. "project": "mongo",
  18976. "hash": 56590584602232051647119691815967789600,
  18977. "size": 17,
  18978. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18979. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18980. "target": 0,
  18981. "dataset": "other",
  18982. "idx": 393202
  18983. },
  18984. {
  18985. "func": "TEST_F(QueryPlannerTest, CantExplodeMetaSort) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\"\n << \"text\"));\n runQuerySortProj(fromjson(\"{a: {$in: [1, 2]}, b: {$in: [3, 4]}}\"),\n fromjson(\"{c: {$meta: 'textScore'}}\"),\n fromjson(\"{c: {$meta: 'textScore'}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{proj: {spec: {c:{$meta:'textScore'}}, node: \"\n \"{sort: {pattern: {c:{$meta:'textScore'}}, limit: 0, node: {sortKeyGen: {node: \"\n \"{cscan: {filter: {a:{$in:[1,2]},b:{$in:[3,4]}}, dir: 1}}}}}}}}\");\n}",
  18986. "project": "mongo",
  18987. "hash": 210713691270574875350164270103377551829,
  18988. "size": 13,
  18989. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  18990. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  18991. "target": 0,
  18992. "dataset": "other",
  18993. "idx": 393203
  18994. },
  18995. {
  18996. "func": "TEST_F(QueryPlannerTest, OrWithoutEnoughIndices) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a: 20}, {b: 21}]}\"));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$or: [{a: 20}, {b: 21}]}}}\");\n}",
  18997. "project": "mongo",
  18998. "hash": 206972381442052191498477780518053794189,
  18999. "size": 6,
  19000. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19001. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19002. "target": 0,
  19003. "dataset": "other",
  19004. "idx": 393204
  19005. },
  19006. {
  19007. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCoveredIxscanIfEnabled) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1},\"\n \"bounds: {a: [['MinKey', 'MaxKey', true, true]]}}}}}\");\n}",
  19008. "project": "mongo",
  19009. "hash": 10868820168502603564336929929614977513,
  19010. "size": 10,
  19011. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19012. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19013. "target": 0,
  19014. "dataset": "other",
  19015. "idx": 393205
  19016. },
  19017. {
  19018. "func": "TEST_F(QueryPlannerTest, EquivalentAndsTwo) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{$and: [{a: 1, b: 10}, {a: 1, b: 20}]}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$and:[{a:1},{a:1},{b:10},{b:20}]}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  19019. "project": "mongo",
  19020. "hash": 247502227033580830208306005591349752334,
  19021. "size": 10,
  19022. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19023. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19024. "target": 0,
  19025. "dataset": "other",
  19026. "idx": 393206
  19027. },
  19028. {
  19029. "func": "TEST_F(QueryPlannerTest, BasicSkipNoIndex) {\n addIndex(BSON(\"a\" << 1));\n\n runQuerySkipNToReturn(BSON(\"x\" << 5), 3, 0);\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{skip: {n: 3, node: {cscan: {dir: 1, filter: {x: 5}}}}}\");\n}",
  19030. "project": "mongo",
  19031. "hash": 64753601750188874452901028644740317866,
  19032. "size": 8,
  19033. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19034. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19035. "target": 0,
  19036. "dataset": "other",
  19037. "idx": 393207
  19038. },
  19039. {
  19040. "func": "TEST_F(QueryPlannerTest, SortElimCompound) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{ a : 5 }\"), BSON(\"b\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1, filter: {a: 5}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  19041. "project": "mongo",
  19042. "hash": 95767658245122191095296789867015347747,
  19043. "size": 12,
  19044. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19045. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19046. "target": 0,
  19047. "dataset": "other",
  19048. "idx": 393208
  19049. },
  19050. {
  19051. "func": "TEST_F(QueryPlannerTest, NinCantUseMultikeyIndex) {\n // true means multikey\n addIndex(BSON(\"a\" << 1), true);\n runQuery(fromjson(\"{a: {$nin: [4, /foobar/]}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  19052. "project": "mongo",
  19053. "hash": 139310992598856673397374984907313661204,
  19054. "size": 8,
  19055. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19056. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19057. "target": 0,
  19058. "dataset": "other",
  19059. "idx": 393209
  19060. },
  19061. {
  19062. "func": "TEST_F(QueryPlannerTest, ContainedOrNotPredicateIsLeadingFieldIndexIntersection) {\n params.options = QueryPlannerParams::INCLUDE_COLLSCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{$nor: [{a: 5}]}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(4);\n // The filter is {$not: {a: 5}}, but there is no way to write a BSON expression that will parse\n // to that MatchExpression.\n assertSolutionExists(\n \"{fetch: {node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andHash: {nodes: [\"\n \"{or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [[6, 6, true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}]}},\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [['MinKey', 5, true, false], [5, 'MaxKey', \"\n \"false, true]], b: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19063. "project": "mongo",
  19064. "hash": 78719646834053107602690510991454415008,
  19065. "size": 32,
  19066. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19067. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19068. "target": 0,
  19069. "dataset": "other",
  19070. "idx": 393210
  19071. },
  19072. {
  19073. "func": "TEST_F(QueryPlannerTest, ShardFilterNoIndexNotCovered) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\"\n << \"hashed\");\n addIndex(BSON(\"b\" << 1));\n\n runQuerySortProj(fromjson(\"{b: 1}\"), BSONObj(), fromjson(\"{_id : 0, a : 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0,a: 1}, type: 'simple', node: \"\n \"{sharding_filter : {node: \"\n \"{fetch: {node: \"\n \"{ixscan: {pattern: {b: 1}}}}}}}}}\");\n}",
  19074. "project": "mongo",
  19075. "hash": 30287526048141003541512583871605285257,
  19076. "size": 15,
  19077. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19078. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19079. "target": 0,
  19080. "dataset": "other",
  19081. "idx": 393211
  19082. },
  19083. {
  19084. "func": "TEST_F(QueryPlannerTest, TwoPredicatesAnding) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(fromjson(\"{$and: [ {x: {$gt: 1}}, {x: {$lt: 3}} ] }\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n}",
  19085. "project": "mongo",
  19086. "hash": 160215520489601922129923979062527756653,
  19087. "size": 11,
  19088. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19089. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19090. "target": 0,
  19091. "dataset": "other",
  19092. "idx": 393212
  19093. },
  19094. {
  19095. "func": "TEST_F(QueryPlannerTest, MaxMinSelectCorrectlyOrderedIndex) {\n // There are both ascending and descending indices on 'a'.\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << -1));\n\n // The ordering of min and max means that we *must* use the descending index.\n runQueryFull(BSONObj(),\n BSONObj(),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 8}\"),\n fromjson(\"{a: 2}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: 1, pattern: {a: -1}}}}}\");\n\n // If we switch the ordering, then we use the ascending index.\n // The ordering of min and max means that we *must* use the descending index.\n runQueryFull(BSONObj(),\n BSONObj(),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 2}\"),\n fromjson(\"{a: 8}\"),\n false);\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: 1, pattern: {a: 1}}}}}\");\n}",
  19096. "project": "mongo",
  19097. "hash": 235364431847662062598757596126103551765,
  19098. "size": 34,
  19099. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19100. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19101. "target": 0,
  19102. "dataset": "other",
  19103. "idx": 393213
  19104. },
  19105. {
  19106. "func": "TEST_F(QueryPlannerTest, CompoundMissingField) {\n addIndex(BSON(\"x\" << 1 << \"y\" << 1 << \"z\" << 1));\n runQuery(fromjson(\"{ x : 5, z: 10}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {x: 1, y: 1, z: 1}}}}}\");\n}",
  19107. "project": "mongo",
  19108. "hash": 268638335118842772406663936192729859412,
  19109. "size": 10,
  19110. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19111. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19112. "target": 0,
  19113. "dataset": "other",
  19114. "idx": 393214
  19115. },
  19116. {
  19117. "func": "TEST_F(QueryPlannerTest, OrOnlyOneBranchCanUseIndexHinted) {\n addIndex(BSON(\"a\" << 1));\n runQueryHint(fromjson(\"{$or: [{a:1}, {b:2}]}\"), fromjson(\"{a:1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: {$or:[{a:1},{b:2}]}, node: {ixscan: \"\n \"{pattern: {a:1}, bounds: \"\n \"{a: [['MinKey','MaxKey',true,true]]}}}}}\");\n}",
  19118. "project": "mongo",
  19119. "hash": 844428593714537003033668038639165152,
  19120. "size": 10,
  19121. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19122. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19123. "target": 0,
  19124. "dataset": "other",
  19125. "idx": 393215
  19126. },
  19127. {
  19128. "func": "TEST_F(QueryPlannerTest, SortKeyMetaProjection) {\n addIndex(BSON(\"a\" << 1));\n\n runQuerySortProj(BSONObj(), fromjson(\"{a: 1}\"), fromjson(\"{b: {$meta: 'sortKey'}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{proj: {spec: {b: {$meta: 'sortKey'}}, node: \"\n \"{sort: {limit: 0, pattern: {a: 1}, node: {sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {b: {$meta: 'sortKey'}}, node: \"\n \"{sortKeyGen: {node: {fetch: {filter: null, node: \"\n \"{ixscan: {pattern: {a: 1}}}}}}}}}\");\n}",
  19129. "project": "mongo",
  19130. "hash": 237092162179255154896430698318702011975,
  19131. "size": 15,
  19132. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19133. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19134. "target": 0,
  19135. "dataset": "other",
  19136. "idx": 393216
  19137. },
  19138. {
  19139. "func": "TEST_F(QueryPlannerTest, BasicSortWithIndexablePred) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuerySortProj(fromjson(\"{ a : 5 }\"), BSON(\"b\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 3U);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1, filter: {a: 5}}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {ixscan: \"\n \"{filter: null, pattern: {b: 1}}}}}\");\n}",
  19140. "project": "mongo",
  19141. "hash": 270126948759373489440274037281626483011,
  19142. "size": 17,
  19143. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19144. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19145. "target": 0,
  19146. "dataset": "other",
  19147. "idx": 393217
  19148. },
  19149. {
  19150. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCannotCompoundTrailingFields) {\n MultikeyPaths multikeyPaths{{}, {0U}, {0U}};\n addIndex(BSON(\"d\" << 1 << \"a.b\" << 1 << \"a.c\" << 1), multikeyPaths);\n addIndex(BSON(\"e\" << 1));\n\n runQuery(fromjson(\"{$and: [{'a.b': 5}, {$or: [{$and: [{'a.c': 6}, {d: 7}]}, {e: 8}]}]}\"));\n assertNumSolutions(2);\n // When we have path-level multikey info, we ensure that predicates are assigned in order of\n // index position.\n assertSolutionExists(\n \"{fetch: {filter: {'a.b': 5}, node: {or: {nodes: [\"\n \"{fetch: {filter: {'a.c': 6}, node: {ixscan: {pattern: {d: 1, 'a.b': 1, 'a.c': 1}, bounds: \"\n \"{d: [[7, 7, true, true]], 'a.b': [[5, 5, true, true]], 'a.c': [['MinKey', 'MaxKey', true, \"\n \"true]]}}}}},\"\n \"{ixscan: {pattern: {e: 1}, bounds: {e: [[8, 8, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19151. "project": "mongo",
  19152. "hash": 194124131615109613155608141746836300771,
  19153. "size": 18,
  19154. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19155. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19156. "target": 0,
  19157. "dataset": "other",
  19158. "idx": 393218
  19159. },
  19160. {
  19161. "func": "TEST_F(QueryPlannerTest, NEOnMultikeyIndex) {\n // true means multikey\n addIndex(BSON(\"a\" << 1), true);\n runQuery(fromjson(\"{a: {$ne: 3}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:{$ne:3}}, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [['MinKey',3,true,false],\"\n \"[3,'MaxKey',false,true]]}}}}}\");\n}",
  19162. "project": "mongo",
  19163. "hash": 195703923024323525090410956645776603360,
  19164. "size": 12,
  19165. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19166. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19167. "target": 0,
  19168. "dataset": "other",
  19169. "idx": 393219
  19170. },
  19171. {
  19172. "func": "TEST_F(QueryPlannerTest, ExistsTrueSparseIndexOnOtherField) {\n addIndex(BSON(\"x\" << 1), false, true);\n\n runQuery(fromjson(\"{x: 1, y: {$exists: true}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  19173. "project": "mongo",
  19174. "hash": 96578923105475870390769497387857170937,
  19175. "size": 9,
  19176. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19177. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19178. "target": 0,
  19179. "dataset": "other",
  19180. "idx": 393221
  19181. },
  19182. {
  19183. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCoveredIxscanOnCompoundIndexIfEnabled) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1, c: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, c: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, b: 1, c: 1}, bounds:\"\n \"{a: [['MinKey', 'MaxKey', true, true]], b: [['MinKey', 'MaxKey', true, true]],\"\n \"c: [['MinKey', 'MaxKey', true, true]]}}}}}\");\n}",
  19184. "project": "mongo",
  19185. "hash": 65788526622789342512446821883119801746,
  19186. "size": 11,
  19187. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19188. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19189. "target": 0,
  19190. "dataset": "other",
  19191. "idx": 393222
  19192. },
  19193. {
  19194. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCannotCombineTrailingFields) {\n MultikeyPaths multikeyPaths{{}, {0U}};\n addIndex(BSON(\"b\" << 1 << \"a\" << 1), multikeyPaths);\n addIndex(BSON(\"c\" << 1));\n\n runQuery(\n fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{$and: [{a: {$lte: 10}}, {b: 6}]}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n std::vector<std::string> alternates;\n alternates.push_back(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[-Infinity, 10, \"\n \"true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n alternates.push_back(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [[0, Infinity, \"\n \"true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertHasOneSolutionOf(alternates);\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19195. "project": "mongo",
  19196. "hash": 318338111642482582800051922432935491150,
  19197. "size": 24,
  19198. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19199. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19200. "target": 0,
  19201. "dataset": "other",
  19202. "idx": 393223
  19203. },
  19204. {
  19205. "func": "TEST_F(QueryPlannerTest, InBasicOrEquivalent) {\n addIndex(fromjson(\"{a: 1}\"));\n runQuery(fromjson(\"{$or: [{a: 1}, {a: 2}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$or: [{a: 1}, {a: 2}]}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, \"\n \"node: {ixscan: {pattern: {a: 1}}}}}\");\n}",
  19206. "project": "mongo",
  19207. "hash": 306757085151648739285713856991045558199,
  19208. "size": 10,
  19209. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19210. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19211. "target": 0,
  19212. "dataset": "other",
  19213. "idx": 393224
  19214. },
  19215. {
  19216. "func": "TEST_F(QueryPlannerTest, UniqueIndexLookupBelowOr) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"d\" << 1),\n false, // multikey\n false, // sparse,\n true); // unique\n\n runQuery(fromjson(\"{$or: [{a: 1, b: 1}, {c: 1, d: 1}]}\"));\n\n // Only two plans because we throw out plans for the right branch of the $or that do not\n // use equality over the unique index.\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {a: 1}, node: {ixscan: {pattern: {b: 1}}}}},\"\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {d: 1}}}}}]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: 1}, node: {ixscan: {pattern: {a: 1}}}}},\"\n \"{fetch: {filter: {c: 1}, node: {ixscan: {pattern: {d: 1}}}}}]}}\");\n}",
  19217. "project": "mongo",
  19218. "hash": 226569899534658630229660343689250815206,
  19219. "size": 25,
  19220. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19221. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19222. "target": 0,
  19223. "dataset": "other",
  19224. "idx": 393225
  19225. },
  19226. {
  19227. "func": "TEST_F(QueryPlannerTest, IntersectCanBeVeryBig) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n addIndex(BSON(\"d\" << 1));\n runQuery(\n fromjson(\"{$or: [{ 'a' : null, 'b' : 94, 'c' : null, 'd' : null },\"\n \"{ 'a' : null, 'b' : 98, 'c' : null, 'd' : null },\"\n \"{ 'a' : null, 'b' : 1, 'c' : null, 'd' : null },\"\n \"{ 'a' : null, 'b' : 2, 'c' : null, 'd' : null },\"\n \"{ 'a' : null, 'b' : 7, 'c' : null, 'd' : null },\"\n \"{ 'a' : null, 'b' : 9, 'c' : null, 'd' : null },\"\n \"{ 'a' : null, 'b' : 16, 'c' : null, 'd' : null }]}\"));\n\n assertNumSolutions(internalQueryEnumerationMaxOrSolutions.load());\n}",
  19228. "project": "mongo",
  19229. "hash": 9299196349185270280283034298215587880,
  19230. "size": 17,
  19231. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19232. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19233. "target": 0,
  19234. "dataset": "other",
  19235. "idx": 393226
  19236. },
  19237. {
  19238. "func": "TEST_F(QueryPlannerTest, ShardFilterBasicProjCovered) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\" << 1);\n addIndex(BSON(\"a\" << 1));\n\n runQuerySortProj(fromjson(\"{a: 1}\"), BSONObj(), fromjson(\"{_id : 0, a : 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, type: 'coveredIndex', node: \"\n \"{sharding_filter: {node: \"\n \"{ixscan: {pattern: {a: 1}}}}}}}\");\n}",
  19239. "project": "mongo",
  19240. "hash": 113640684696618958161039581142048098838,
  19241. "size": 13,
  19242. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19243. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19244. "target": 0,
  19245. "dataset": "other",
  19246. "idx": 393227
  19247. },
  19248. {
  19249. "func": "TEST_F(QueryPlannerTest, OrAllThreeTightnesses) {\n addIndex(BSON(\"names\" << 1));\n runQuery(\n fromjson(\"{$or: [{names: 'frank'}, {names: /^al(ice)|(ex)/},\"\n \"{names: {$elemMatch: {$eq: 'thomas'}}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: \"\n \"{$or: [{names: 'frank'}, {names: /^al(ice)|(ex)/},\"\n \"{names: {$elemMatch: {$eq: 'thomas'}}}]}, \"\n \"node: {ixscan: {filter: null, pattern: {names: 1}}}}}\");\n}",
  19250. "project": "mongo",
  19251. "hash": 76054873363046234122938585051691634558,
  19252. "size": 14,
  19253. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19254. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19255. "target": 0,
  19256. "dataset": "other",
  19257. "idx": 393228
  19258. },
  19259. {
  19260. "func": "TEST_F(QueryPlannerTest, SortElimTrailingFieldsReverse) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1 << \"d\" << 1));\n runQuerySortProj(fromjson(\"{a: 5, b: 6}\"), BSON(\"c\" << -1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {c: -1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1, filter: {a: 5, b: 6}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, dir: -1, pattern: {a: 1, b: 1, c: 1, d: 1}}}}}\");\n}",
  19261. "project": "mongo",
  19262. "hash": 233987492566321264599110097497755083359,
  19263. "size": 12,
  19264. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19265. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19266. "target": 0,
  19267. "dataset": "other",
  19268. "idx": 393229
  19269. },
  19270. {
  19271. "func": "TEST_F(QueryPlannerTest, Snapshot) {\n addIndex(BSON(\"a\" << 1));\n runQuerySnapshot(fromjson(\"{a: {$gt: 0}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {filter: {a: {$gt: 0}}, dir: 1}}\");\n}",
  19272. "project": "mongo",
  19273. "hash": 7170949193140007369903571950806473724,
  19274. "size": 7,
  19275. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19276. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19277. "target": 0,
  19278. "dataset": "other",
  19279. "idx": 393230
  19280. },
  19281. {
  19282. "func": "TEST_F(QueryPlannerTest, CantUseTextIndexToProvideSort) {\n addIndex(BSON(\"x\" << 1 << \"_fts\"\n << \"text\"\n << \"_ftsx\"\n << 1));\n runQuerySortProj(BSONObj(), BSON(\"x\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{sort: {pattern: {x: 1}, limit: 0, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1, filter: {}}}}}}}\");\n}",
  19283. "project": "mongo",
  19284. "hash": 242662865878506734203566027376475142253,
  19285. "size": 12,
  19286. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19287. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19288. "target": 0,
  19289. "dataset": "other",
  19290. "idx": 393231
  19291. },
  19292. {
  19293. "func": "TEST_F(QueryPlannerTest, CompoundMultikeyBoundsNoIntersect) {\n // true means multikey\n addIndex(BSON(\"a\" << 1 << \"b\" << 1), true);\n runQuery(fromjson(\"{a: 1, b: {$gt: 3, $lte: 5}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b:{$gt:3}}, node: {ixscan: {filter: null, \"\n \"pattern: {a:1,b:1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [[-Infinity,5,true,true]]}}}}}\");\n}",
  19294. "project": "mongo",
  19295. "hash": 182947058509243366376748797604966455943,
  19296. "size": 12,
  19297. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19298. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19299. "target": 0,
  19300. "dataset": "other",
  19301. "idx": 393232
  19302. },
  19303. {
  19304. "func": "TEST_F(QueryPlannerTest, UniqueIndexLookup) {\n params.options = QueryPlannerParams::INDEX_INTERSECTION;\n params.options |= QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1),\n false, // multikey\n false, // sparse,\n true); // unique\n\n runQuery(fromjson(\"{a: 1, b: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: {a: 1}, node: \"\n \"{ixscan: {filter: null, pattern: {b: 1}}}}}\");\n}",
  19305. "project": "mongo",
  19306. "hash": 178839466912917964846012794667942939529,
  19307. "size": 17,
  19308. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19309. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19310. "target": 0,
  19311. "dataset": "other",
  19312. "idx": 393233
  19313. },
  19314. {
  19315. "func": "TEST_F(QueryPlannerTest, InWithSort) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProjSkipNToReturn(fromjson(\"{a: {$in: [1, 2]}}\"), BSON(\"b\" << 1), BSONObj(), 0, 1);\n\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 1, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: 1, b: 1}}}, {ixscan: {pattern: {a: 1, b: 1}}}]}}}}\");\n}",
  19316. "project": "mongo",
  19317. "hash": 273755553949269817428905661298829130989,
  19318. "size": 11,
  19319. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19320. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19321. "target": 0,
  19322. "dataset": "other",
  19323. "idx": 393234
  19324. },
  19325. {
  19326. "func": "TEST_F(QueryPlannerTest, NegatedRangeIntGTE) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$gte: 5}}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {i:1}, \"\n \"bounds: {i: [['MinKey',5,true,false], \"\n \"[Infinity,'MaxKey',false,true]]}}}}}\");\n}",
  19327. "project": "mongo",
  19328. "hash": 3448141573223037376539295803701781455,
  19329. "size": 11,
  19330. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19331. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19332. "target": 0,
  19333. "dataset": "other",
  19334. "idx": 393235
  19335. },
  19336. {
  19337. "func": "TEST_F(QueryPlannerTest, InWithSortAndLimitTrailingField) {\n addIndex(BSON(\"a\" << 1 << \"b\" << -1 << \"c\" << 1));\n runQuerySortProjSkipNToReturn(fromjson(\"{a: {$in: [1, 2]}, b: {$gte: 0}}\"),\n fromjson(\"{b: -1}\"),\n BSONObj(), // no projection\n 0, // no skip\n -1); // .limit(1)\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{sort: {pattern: {b:-1}, limit: 1, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{limit: {n: 1, node: {fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a:1,b:-1,c:1}}}, \"\n \" {ixscan: {pattern: {a:1,b:-1,c:1}}}]}}}}}}\");\n}",
  19338. "project": "mongo",
  19339. "hash": 182146240797766507358268848548597485782,
  19340. "size": 17,
  19341. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19342. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19343. "target": 0,
  19344. "dataset": "other",
  19345. "idx": 393236
  19346. },
  19347. {
  19348. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicateIsLeadingFieldInIndex) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[5, 5, true, true]], c: [[7, 7, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[5, 5, true, true]], c: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19349. "project": "mongo",
  19350. "hash": 225963543493379286480617356294114060219,
  19351. "size": 25,
  19352. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19353. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19354. "target": 0,
  19355. "dataset": "other",
  19356. "idx": 393237
  19357. },
  19358. {
  19359. "func": "TEST_F(QueryPlannerTest, ShardFilterKeyPrefixIndexCovered) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\" << 1);\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"_id\" << 1));\n\n runQuerySortProj(fromjson(\"{a: 1}\"), BSONObj(), fromjson(\"{a : 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{proj: {spec: {a: 1}, type: 'coveredIndex', node: \"\n \"{sharding_filter : {node: \"\n \"{ixscan: {pattern: {a: 1, b: 1, _id: 1}}}}}}}\");\n}",
  19360. "project": "mongo",
  19361. "hash": 297620939790682734755562987155996044242,
  19362. "size": 13,
  19363. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19364. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19365. "target": 0,
  19366. "dataset": "other",
  19367. "idx": 393238
  19368. },
  19369. {
  19370. "func": "TEST_F(QueryPlannerTest, RootedOrOfAndCollapseTwoScansButNotThird) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1 << \"d\" << 1));\n runQuery(fromjson(\"{$or: [{a: 1, b: 2}, {c: 3, d: 4}, {a: 1, b: 2}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, filter: null,\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]}}},\"\n \"{ixscan: {pattern: {c: 1, d: 1}, filter: null,\"\n \"bounds: {c: [[3,3,true,true]], d: [[4,4,true,true]]}}}]}}}}\");\n}",
  19371. "project": "mongo",
  19372. "hash": 28195936180963258348567439769441523171,
  19373. "size": 14,
  19374. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19375. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19376. "target": 0,
  19377. "dataset": "other",
  19378. "idx": 393239
  19379. },
  19380. {
  19381. "func": "TEST_F(QueryPlannerTest, NegationOr) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(fromjson(\"{$or: [{a: 1}, {b: {$ne: 1}}]}\"), BSONObj(), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  19382. "project": "mongo",
  19383. "hash": 224463110277626159335491728539604931698,
  19384. "size": 7,
  19385. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19386. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19387. "target": 0,
  19388. "dataset": "other",
  19389. "idx": 393240
  19390. },
  19391. {
  19392. "func": "TEST_F(QueryPlannerTest, ManyInWithSort) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1 << \"d\" << 1));\n runQuerySortProjSkipNToReturn(fromjson(\"{a: {$in: [1, 2]}, b:{$in:[1,2]}, c:{$in:[1,2]}}\"),\n BSON(\"d\" << 1),\n BSONObj(),\n 0,\n 1);\n\n assertSolutionExists(\n \"{sort: {pattern: {d: 1}, limit: 1, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {mergeSort: {nodes: \"\n \"[{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}}]}}}}\");\n}",
  19393. "project": "mongo",
  19394. "hash": 321714766832778506105148206851118285899,
  19395. "size": 22,
  19396. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19397. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19398. "target": 0,
  19399. "dataset": "other",
  19400. "idx": 393241
  19401. },
  19402. {
  19403. "func": "TEST_F(QueryPlannerTest, SplitLimitedSort) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n params.options |= QueryPlannerParams::SPLIT_LIMITED_SORT;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n\n runQuerySortProjSkipNToReturn(fromjson(\"{a: 1}\"), fromjson(\"{b: 1}\"), BSONObj(), 0, 3);\n\n assertNumSolutions(2U);\n // First solution has no blocking stage; no need to split.\n assertSolutionExists(\n \"{fetch: {filter: {a:1}, node: \"\n \"{ixscan: {filter: null, pattern: {b: 1}}}}}\");\n // Second solution has a blocking sort with a limit: it gets split and\n // joined with an OR stage.\n assertSolutionExists(\n \"{ensureSorted: {pattern: {b: 1}, node: \"\n \"{or: {nodes: [\"\n \"{sort: {pattern: {b: 1}, limit: 3, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a: 1}}}}}}}}}, \"\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a: 1}}}}}}}}}]}}}}\");\n}",
  19404. "project": "mongo",
  19405. "hash": 244343410673275345691539793170292777230,
  19406. "size": 23,
  19407. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19408. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19409. "target": 0,
  19410. "dataset": "other",
  19411. "idx": 393242
  19412. },
  19413. {
  19414. "func": "TEST_F(QueryPlannerTest, LockstepOrEnumerationSanityCheckTwoChildrenDifferentNumSolutions) {\n params.options =\n QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::ENUMERATE_OR_CHILDREN_LOCKSTEP;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n\n runQueryAsCommand(fromjson(\"{find: 'testns', filter: {a: 1, $or: [{b: 1}, {b: 2, c: 2}]}}\"));\n\n assertNumSolutions(4U);\n\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [{ixscan: {pattern: {a: 1, b: 1}}}, {fetch: \"\n \"{filter: {c: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [{ixscan: {pattern: {a: 1, b: 1}}}, {fetch: \"\n \"{filter: {b: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: {$eq: 1}}, {b: {$eq: 2}, c: {$eq: 2}}]}, node: {ixscan: \"\n \"{pattern: {a: 1, b: 1}}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: {$eq: 1}}, {b: {$eq: 2}, c: {$eq: 2}}]}, node: {ixscan: \"\n \"{pattern: {a: 1, c: 1}}}}}}}\");\n}",
  19415. "project": "mongo",
  19416. "hash": 113916296173215800031368142004172515382,
  19417. "size": 23,
  19418. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19419. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19420. "target": 0,
  19421. "dataset": "other",
  19422. "idx": 393244
  19423. },
  19424. {
  19425. "func": "TEST_F(QueryPlannerTest, ThreeRegexSameFieldCovering) {\n addIndex(BSON(\"a\" << 1));\n runQuerySortProj(\n fromjson(\"{$and: [{a: /0/}, {a: /1/}, {a: /2/}]}\"), BSONObj(), fromjson(\"{_id: 0, a: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1, filter: {$and:[{a:/0/},{a:/1/},{a:/2/}]}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{ixscan: {filter: {$and:[{a:/0/},{a:/1/},{a:/2/}]}, pattern: {a: 1}}}}}\");\n}",
  19426. "project": "mongo",
  19427. "hash": 153107348566801693994050438169893219254,
  19428. "size": 13,
  19429. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19430. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19431. "target": 0,
  19432. "dataset": "other",
  19433. "idx": 393245
  19434. },
  19435. {
  19436. "func": "TEST_F(QueryPlannerTest, ExistsFalseSparseIndexOnOtherField) {\n addIndex(BSON(\"x\" << 1), false, true);\n\n runQuery(fromjson(\"{x: 1, y: {$exists: false}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\"{fetch: {node: {ixscan: {pattern: {x: 1}}}}}\");\n}",
  19437. "project": "mongo",
  19438. "hash": 329405160526919277810374197042528639061,
  19439. "size": 9,
  19440. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19441. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19442. "target": 0,
  19443. "dataset": "other",
  19444. "idx": 393246
  19445. },
  19446. {
  19447. "func": "TEST_F(QueryPlannerTest, TooManyToExplode) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1 << \"d\" << 1));\n runQuerySortProjSkipNToReturn(fromjson(\"{a: {$in: [1,2,3,4,5,6]},\"\n \"b:{$in:[1,2,3,4,5,6,7,8]},\"\n \"c:{$in:[1,2,3,4,5,6,7,8]}}\"),\n BSON(\"d\" << 1),\n BSONObj(),\n 0,\n 1);\n\n // We cap the # of ixscans we're willing to create.\n assertNumSolutions(2);\n assertSolutionExists(\n \"{sort: {pattern: {d: 1}, limit: 1, node: {sortKeyGen: \"\n \"{node: {cscan: {dir: 1}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {d: 1}, limit: 1, node: {sortKeyGen: {node: \"\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1, c:1, d:1}}}}}}}}}\");\n}",
  19448. "project": "mongo",
  19449. "hash": 174897599360843013237859339899311051244,
  19450. "size": 19,
  19451. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19452. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19453. "target": 0,
  19454. "dataset": "other",
  19455. "idx": 393247
  19456. },
  19457. {
  19458. "func": "TEST_F(QueryPlannerTest, IntersectBasicTwoPredCompoundMatchesIdxOrder1) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuery(fromjson(\"{a:1, b:1}\"));\n\n assertNumSolutions(3U);\n\n assertSolutionExists(\n \"{fetch: {filter: {b:1}, node: \"\n \"{ixscan: {filter: null, pattern: {a:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:1}, node: \"\n \"{ixscan: {filter: null, pattern: {b:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {a:1}}},\"\n \"{ixscan: {filter: null, pattern: {b:1}}}]}}}}\");\n}",
  19459. "project": "mongo",
  19460. "hash": 262535984780057536678420307738828511339,
  19461. "size": 19,
  19462. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19463. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19464. "target": 0,
  19465. "dataset": "other",
  19466. "idx": 393249
  19467. },
  19468. {
  19469. "func": "TEST_F(QueryPlannerTest, CannotSnapshotWithGeoNear) {\n // Snapshot is skipped with geonear queries.\n addIndex(BSON(\"a\"\n << \"2d\"));\n runQuerySnapshot(fromjson(\"{a: {$near: [0,0]}}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{geoNear2d: {a: '2d'}}\");\n}",
  19470. "project": "mongo",
  19471. "hash": 174758414770418918464730071548361354992,
  19472. "size": 9,
  19473. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19474. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19475. "target": 0,
  19476. "dataset": "other",
  19477. "idx": 393250
  19478. },
  19479. {
  19480. "func": "TEST_F(QueryPlannerTest, CompoundAndNonCompoundIndices) {\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1), true);\n runQuery(fromjson(\"{a: 1, b: {$gt: 2, $lt: 2}}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 3U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$and:[{b:{$lt:2}},{b:{$gt:2}}]}, node: \"\n \"{ixscan: {pattern: {a:1}, bounds: {a: [[1,1,true,true]]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b:{$gt:2}}, node: \"\n \"{ixscan: {pattern: {a:1,b:1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [[-Infinity,2,true,false]]}}}}}\");\n}",
  19481. "project": "mongo",
  19482. "hash": 100976914605888038753037488244398650517,
  19483. "size": 15,
  19484. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19485. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19486. "target": 0,
  19487. "dataset": "other",
  19488. "idx": 393251
  19489. },
  19490. {
  19491. "func": "TEST_F(QueryPlannerTest, CompoundIndexBoundsRangeAndEquality) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{a: {$gt: 8}, b: 6}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1}, bounds: \"\n \"{a: [[8,Infinity,false,true]], b:[[6,6,true,true]]}}}}}\");\n}",
  19492. "project": "mongo",
  19493. "hash": 303913323491822068072328094607254401805,
  19494. "size": 10,
  19495. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19496. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19497. "target": 0,
  19498. "dataset": "other",
  19499. "idx": 393252
  19500. },
  19501. {
  19502. "func": "TEST_F(QueryPlannerTest, SortKeyMetaProjectionCovered) {\n addIndex(BSON(\"a\" << 1));\n\n runQuerySortProj(\n BSONObj(), fromjson(\"{a: 1}\"), fromjson(\"{_id: 0, a: 1, b: {$meta: 'sortKey'}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: {$meta: 'sortKey'}}, node: \"\n \"{sort: {limit: 0, pattern: {a: 1}, node: \"\n \"{sortKeyGen: {node: \"\n \"{cscan: {dir: 1}}}}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: {$meta: 'sortKey'}}, node: \"\n \"{sortKeyGen: {node: \"\n \"{ixscan: {pattern: {a: 1}}}}}}}\");\n}",
  19503. "project": "mongo",
  19504. "hash": 242166331468940430880233709378215765089,
  19505. "size": 17,
  19506. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19507. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19508. "target": 0,
  19509. "dataset": "other",
  19510. "idx": 393253
  19511. },
  19512. {
  19513. "func": "TEST_F(QueryPlannerTest, AndSortedRequiresKeepMutations) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n params.options |= QueryPlannerParams::INDEX_INTERSECTION;\n\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n runQuery(fromjson(\"{a: 2, b: 3}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\"{fetch: {filter: {a: 2}, node: {ixscan: {pattern: {b: 1}}}}}\");\n assertSolutionExists(\"{fetch: {filter: {b: 3}, node: {ixscan: {pattern: {a: 1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {keep: {node: {andSorted: {nodes: [\"\n \"{ixscan: {pattern: {a: 1}}},\"\n \"{ixscan: {pattern: {b: 1}}}]}}}}}}\");\n}",
  19514. "project": "mongo",
  19515. "hash": 253260122049949321831971579853336369142,
  19516. "size": 16,
  19517. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19518. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19519. "target": 0,
  19520. "dataset": "other",
  19521. "idx": 393254
  19522. },
  19523. {
  19524. "func": "TEST_F(QueryPlannerTest, CompoundIndexBoundsEqualityThenIn) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{a: 5, b: {$in: [2,6,11]}}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {filter: null, pattern: \"\n \"{a: 1, b: 1}, bounds: {a: [[5,5,true,true]], \"\n \"b:[[2,2,true,true],[6,6,true,true],[11,11,true,true]]}}}}}\");\n}",
  19525. "project": "mongo",
  19526. "hash": 78441643973693397503121918533120937642,
  19527. "size": 11,
  19528. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19529. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19530. "target": 0,
  19531. "dataset": "other",
  19532. "idx": 393255
  19533. },
  19534. {
  19535. "func": "TEST_F(QueryPlannerTest, ExprEqCanUseHashedIndex) {\n params.options &= ~QueryPlannerParams::INCLUDE_COLLSCAN;\n addIndex(BSON(\"a\"\n << \"hashed\"));\n runQuery(fromjson(\"{a: {$_internalExprEq: 1}}\"));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{fetch: {filter: {a: {$_internalExprEq: 1}}, node: {ixscan: {filter: null, pattern: {a: \"\n \"'hashed'}}}}}\");\n}",
  19536. "project": "mongo",
  19537. "hash": 45470536484900512823885057839057168384,
  19538. "size": 10,
  19539. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19540. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19541. "target": 0,
  19542. "dataset": "other",
  19543. "idx": 393256
  19544. },
  19545. {
  19546. "func": "TEST_F(QueryPlannerTest, ShardFilterBasicCovered) {\n params.options = QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"a\" << 1);\n addIndex(BSON(\"a\" << 1));\n\n runQuery(fromjson(\"{a: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {node: \"\n \"{sharding_filter: {node: \"\n \"{ixscan: {pattern: {a: 1}}}}}}}\");\n}",
  19547. "project": "mongo",
  19548. "hash": 238744588386417890390600708409490648755,
  19549. "size": 13,
  19550. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19551. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19552. "target": 0,
  19553. "dataset": "other",
  19554. "idx": 393257
  19555. },
  19556. {
  19557. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfNoCoveredIxscans) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {a: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {a: 1}, node:\"\n \"{cscan: {dir: 1}}}}\");\n}",
  19558. "project": "mongo",
  19559. "hash": 290928087262263208529349436503578400209,
  19560. "size": 9,
  19561. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19562. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19563. "target": 0,
  19564. "dataset": "other",
  19565. "idx": 393258
  19566. },
  19567. {
  19568. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfIndexIsPartial) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n AlwaysFalseMatchExpression matchExpr;\n addIndex(BSON(\"a\" << 1), &matchExpr);\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  19569. "project": "mongo",
  19570. "hash": 211604223019744552254625915390710138285,
  19571. "size": 10,
  19572. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19573. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19574. "target": 0,
  19575. "dataset": "other",
  19576. "idx": 393259
  19577. },
  19578. {
  19579. "func": "TEST_F(QueryPlannerTest, NoFetchNoKeep) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n addIndex(BSON(\"x\" << 1));\n // query, sort, proj\n runQuerySortProj(fromjson(\"{ x : {$gt: 1}}\"), BSONObj(), fromjson(\"{_id: 0, x: 1}\"));\n\n // cscan is a soln but we override the params that say to include it.\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, x: 1}, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n}",
  19580. "project": "mongo",
  19581. "hash": 277376313941274197280489738479057459039,
  19582. "size": 12,
  19583. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19584. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19585. "target": 0,
  19586. "dataset": "other",
  19587. "idx": 393260
  19588. },
  19589. {
  19590. "func": "TEST_F(QueryPlannerTest, RootedOrOfAndCollapseTwoScansButNotThirdWithFilters) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1 << \"d\" << 1));\n runQuery(fromjson(\"{$or: [{a:1, b:2, e:5}, {c:3, d:4}, {a:1, b:2, f:6}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{fetch: {filter: {$or: [{f:6},{e:5}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, filter: null,\"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]}}}}},\"\n \"{ixscan: {pattern: {c: 1, d: 1}, filter: null,\"\n \"bounds: {c: [[3,3,true,true]], d: [[4,4,true,true]]}}}]}}}}\");\n}",
  19591. "project": "mongo",
  19592. "hash": 202393875852333046546800452343344317933,
  19593. "size": 15,
  19594. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19595. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19596. "target": 0,
  19597. "dataset": "other",
  19598. "idx": 393261
  19599. },
  19600. {
  19601. "func": "TEST_F(QueryPlannerTest, NonPrefixRegexAnd) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{a: /foo/, b: 2}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {$and: [{b: 2}, {a: /foo/}]}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: {a: /foo/}, pattern: {a: 1, b: 1}}}}}\");\n}",
  19602. "project": "mongo",
  19603. "hash": 220691407855418747782596468263328542908,
  19604. "size": 10,
  19605. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19606. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19607. "target": 0,
  19608. "dataset": "other",
  19609. "idx": 393262
  19610. },
  19611. {
  19612. "func": "TEST_F(QueryPlannerTest, SparseIndexForQuery) {\n addIndex(fromjson(\"{a: 1}\"), false, true);\n runQuerySortProj(fromjson(\"{a: 1}\"), BSONObj(), BSONObj());\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: 1}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1}}}}}\");\n}",
  19613. "project": "mongo",
  19614. "hash": 253238169784656761122932246735508259773,
  19615. "size": 10,
  19616. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19617. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19618. "target": 0,
  19619. "dataset": "other",
  19620. "idx": 393263
  19621. },
  19622. {
  19623. "func": "TEST_F(QueryPlannerTest, ExplodeForSortWorksWithShardingFilter) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n params.options |= QueryPlannerParams::INCLUDE_SHARD_FILTER;\n params.shardKey = BSON(\"c\" << 1);\n\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{a: {$in: [1, 3]}}\"), fromjson(\"{b: 1}\"), BSONObj());\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sharding_filter: {node: {fetch: {filter: null, node: {mergeSort: {nodes: [\"\n \"{ixscan: {pattern: {a:1,b:1}, filter: null, bounds: {a: [[1,1,true,true]], b: \"\n \"[['MinKey','MaxKey',true,true]]}}},\"\n \"{ixscan: {pattern: {a:1,b:1}, filter: null, bounds: {a: [[3,3,true,true]], b: \"\n \"[['MinKey','MaxKey',true,true]]}}}]}}}}}}\");\n}",
  19624. "project": "mongo",
  19625. "hash": 334860856459779809487785211062748929787,
  19626. "size": 16,
  19627. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19628. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19629. "target": 0,
  19630. "dataset": "other",
  19631. "idx": 393264
  19632. },
  19633. {
  19634. "func": "TEST_F(QueryPlannerTest, ExprEqCanUseSparseIndexForEqualityToNull) {\n params.options &= ~QueryPlannerParams::INCLUDE_COLLSCAN;\n addIndex(fromjson(\"{a: 1}\"), false, true);\n runQuery(fromjson(\"{a: {$_internalExprEq: null}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: {a: {$_internalExprEq: null}}, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1}, bounds: {a: [[null,null,true,true]]}}}}}\");\n}",
  19635. "project": "mongo",
  19636. "hash": 272938113521193643590583578514502893559,
  19637. "size": 10,
  19638. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19639. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19640. "target": 0,
  19641. "dataset": "other",
  19642. "idx": 393265
  19643. },
  19644. {
  19645. "func": "TEST_F(QueryPlannerTest, NonPrefixRegex) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{a: /foo/}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {a: /foo/}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: {a: /foo/}, pattern: {a: 1}}}}}\");\n}",
  19646. "project": "mongo",
  19647. "hash": 58888288642162884179227581976788910826,
  19648. "size": 10,
  19649. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19650. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19651. "target": 0,
  19652. "dataset": "other",
  19653. "idx": 393266
  19654. },
  19655. {
  19656. "func": "TEST_F(QueryPlannerTest, CantUseHashedIndexToProvideSortWithIndexablePred) {\n addIndex(BSON(\"x\"\n << \"hashed\"));\n runQuerySortProj(BSON(\"x\" << BSON(\"$in\" << BSON_ARRAY(0 << 1))), BSON(\"x\" << 1), BSONObj());\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{sort: {pattern: {x: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: \"\n \"{ixscan: {pattern: {x: 'hashed'}}}}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {x: 1}, limit: 0, node: {sortKeyGen: {node:\"\n \"{cscan: {dir: 1, filter: {x: {$in: [0, 1]}}}}}}}}\");\n}",
  19657. "project": "mongo",
  19658. "hash": 182456968720263497029298469352426557002,
  19659. "size": 14,
  19660. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19661. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19662. "target": 0,
  19663. "dataset": "other",
  19664. "idx": 393267
  19665. },
  19666. {
  19667. "func": "TEST_F(QueryPlannerTest, IntersectCompoundInsteadUnusedField2) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1 << \"d\" << 1));\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n runQuery(fromjson(\"{a: 1, c: 1}\"));\n\n assertNumSolutions(3U);\n assertSolutionExists(\n \"{fetch: {filter: {c:1}, node: \"\n \"{ixscan: {filter: null, pattern: {a:1,b:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a:1}, node: \"\n \"{ixscan: {filter: null, pattern: {c:1,d:1}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: \"\n \"{ixscan: {filter: null, pattern: {a:1,b:1,c:1}}}}}\");\n}",
  19668. "project": "mongo",
  19669. "hash": 277064692569477904442279866369232506178,
  19670. "size": 18,
  19671. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19672. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19673. "target": 0,
  19674. "dataset": "other",
  19675. "idx": 393268
  19676. },
  19677. {
  19678. "func": "TEST_F(QueryPlannerTest, GreaterThan) {\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSON(\"x\" << BSON(\"$gt\" << 5)));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {x: {$gt: 5}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n}",
  19679. "project": "mongo",
  19680. "hash": 289483424517436880639404561237405340033,
  19681. "size": 11,
  19682. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19683. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19684. "target": 0,
  19685. "dataset": "other",
  19686. "idx": 393269
  19687. },
  19688. {
  19689. "func": "TEST_F(QueryPlannerTest, IntersectSubtreeAndPred) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n runQuery(fromjson(\"{a: 1, $or: [{b:1}, {c:1}]}\"));\n\n // This (can be) rewritten to $or:[ {a:1, b:1}, {c:1, d:1}]. We don't look for the various\n // single $or solutions as that's tested elsewhere. We look for the intersect solution,\n // where each AND inside of the root OR is an and_sorted.\n size_t matches = 0;\n matches += numSolutionMatches(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {'a':1}}},\"\n \"{ixscan: {filter: null, pattern: {'b':1}}}]}},\"\n \"{andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {'a':1}}},\"\n \"{ixscan: {filter: null, pattern: {'c':1}}}]}}]}}}}\");\n matches += numSolutionMatches(\n \"{fetch: {filter: null, node: {andHash: {nodes:[\"\n \"{or: {nodes: [{ixscan:{filter:null, pattern:{b:1}}},\"\n \"{ixscan:{filter:null, pattern:{c:1}}}]}},\"\n \"{ixscan:{filter: null, pattern:{a:1}}}]}}}}\");\n ASSERT_GREATER_THAN_OR_EQUALS(matches, 1U);\n}",
  19690. "project": "mongo",
  19691. "hash": 169707938116751669836765944772245757198,
  19692. "size": 26,
  19693. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19694. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19695. "target": 0,
  19696. "dataset": "other",
  19697. "idx": 393270
  19698. },
  19699. {
  19700. "func": "TEST_F(QueryPlannerTest, NorWithSingleChildCanUseIndexAfterComplementingBounds) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$nor: [{a: {$lt: 3}}]}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: {pattern: {a: 1}, bounds:\"\n \"{a: [['MinKey', -Infinity, true, false], [3, 'MaxKey', true, true]]}}}}}\");\n}",
  19701. "project": "mongo",
  19702. "hash": 222772881100399348754526516748782218758,
  19703. "size": 11,
  19704. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19705. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19706. "target": 0,
  19707. "dataset": "other",
  19708. "idx": 393271
  19709. },
  19710. {
  19711. "func": "TEST_F(QueryPlannerTest, CantUseCompound) {\n addIndex(BSON(\"x\" << 1 << \"y\" << 1));\n runQuery(fromjson(\"{ y: 10}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{cscan: {dir: 1, filter: {y: 10}}}\");\n}",
  19712. "project": "mongo",
  19713. "hash": 161850587053192943290220532687269000036,
  19714. "size": 7,
  19715. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19716. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19717. "target": 0,
  19718. "dataset": "other",
  19719. "idx": 393272
  19720. },
  19721. {
  19722. "func": "TEST_F(QueryPlannerTest, ContainedOrNot) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{$nor: [{a: 5}]}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [[6, 6, true, true]], a: [['MinKey', 5, \"\n \"true, false], [5, 'MaxKey', false, true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [['MinKey', 5, \"\n \"true, false], [5, 'MaxKey', false, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19723. "project": "mongo",
  19724. "hash": 40906831780605085557890608155888552053,
  19725. "size": 15,
  19726. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19727. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19728. "target": 0,
  19729. "dataset": "other",
  19730. "idx": 393273
  19731. },
  19732. {
  19733. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicateIsLeadingFieldForOneOrBranch) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"c\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{b: 6}, {c: 7}]}]}\"));\n assertNumSolutions(3);\n assertSolutionExists(\n \"{fetch: {filter: {a: 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]]}}},\"\n \"{ixscan: {pattern: {c: 1}, bounds: {c: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{b: 6}, {c: 7}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19734. "project": "mongo",
  19735. "hash": 332840356974925368121906284476087523787,
  19736. "size": 19,
  19737. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19738. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19739. "target": 0,
  19740. "dataset": "other",
  19741. "idx": 393274
  19742. },
  19743. {
  19744. "func": "TEST_F(QueryPlannerTest, ContainedOrPushdownIndexedExpr) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuery(\n fromjson(\"{$expr: {$and: [{$eq: ['$d', 'd']}, {$eq: ['$a', 'a']}]},\"\n \"$or: [{b: 'b'}, {b: 'c'}]}\"));\n assertNumSolutions(3);\n // When we have path-level multikey info, we ensure that predicates are assigned in order of\n // index position.\n assertSolutionExists(\n \"{fetch: {node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1}, filter: null, bounds: {a: [['a', 'a', true, true]], b: \"\n \"[['b', 'b', true, true]]}}},\"\n \"{ixscan: {pattern: {a: 1, b: 1}, filter: null, bounds: {a: [['a', 'a', true, true]], b: \"\n \"[['c', 'c', true, true]]}}}]}}}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1}, filter: null,\"\n \"bounds: {a: [['a', 'a', true, true]], b: [['MinKey', 'MaxKey', true, true]]}}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19745. "project": "mongo",
  19746. "hash": 149743931258119654374504120786715859700,
  19747. "size": 20,
  19748. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19749. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19750. "target": 0,
  19751. "dataset": "other",
  19752. "idx": 393275
  19753. },
  19754. {
  19755. "func": "TEST_F(QueryPlannerTest, OrOfAnd3) {\n addIndex(BSON(\"a\" << 1));\n runQuery(fromjson(\"{$or: [{a:{$gt:1,$lt:5},b:6}, {a:3,b:{$gt:0,$lt:10}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b:6}, node: {ixscan: {pattern: {a:1}, \"\n \"bounds: {a: [[1,5,false,false]]}}}}}, \"\n \"{fetch: {filter: {$and:[{b:{$lt:10}},{b:{$gt:0}}]}, node: \"\n \"{ixscan: {pattern: {a:1}, bounds: {a:[[3,3,true,true]]}}}}}]}}\");\n}",
  19756. "project": "mongo",
  19757. "hash": 151604592393962253782661805812009278522,
  19758. "size": 13,
  19759. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19760. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19761. "target": 0,
  19762. "dataset": "other",
  19763. "idx": 393276
  19764. },
  19765. {
  19766. "func": "TEST_F(QueryPlannerTest, NegationRegexWithIndexablePred) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{$and: [{i: {$not: /o/}}, {i: 2}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {i:1}, \"\n \"bounds: {i: [[2,2,true,true]]}}}}}\");\n}",
  19767. "project": "mongo",
  19768. "hash": 86867644659377621293169401998836685194,
  19769. "size": 10,
  19770. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19771. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19772. "target": 0,
  19773. "dataset": "other",
  19774. "idx": 393277
  19775. },
  19776. {
  19777. "func": "TEST_F(QueryPlannerTest, RootedOrOfAndCollapseScansExistingOrFilter) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuery(fromjson(\"{$or: [{a:1, b:2, $or: [{c:3}, {d:4}]}, {a:1, b:2, e:5}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{e:5},{c:3},{d:4}]}, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1, b: 1}, \"\n \"bounds: {a: [[1,1,true,true]], b: [[2,2,true,true]]}}}}}\");\n}",
  19778. "project": "mongo",
  19779. "hash": 183025019723817036462755753860747723810,
  19780. "size": 11,
  19781. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19782. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19783. "target": 0,
  19784. "dataset": "other",
  19785. "idx": 393278
  19786. },
  19787. {
  19788. "func": "TEST_F(QueryPlannerTest, ExistsBoundsCompound) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n runQuery(fromjson(\"{a: 1, b: {$exists: true}}\"));\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b: {$exists: true}}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [['MinKey','MaxKey',true,true]]}}}}}\");\n\n // This ends up being a double negation, which we currently don't index.\n runQuery(fromjson(\"{a: 1, b: {$not: {$exists: false}}}\"));\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1, b: 1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [['MinKey','MaxKey',true,true]]}}}}}\");\n\n runQuery(fromjson(\"{a: 1, b: {$exists: false}}\"));\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b: {$exists: false}}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [[null,null,true,true]]}}}}}\");\n\n runQuery(fromjson(\"{a: 1, b: {$not: {$exists: true}}}\"));\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {b: {$exists: false}}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1}, bounds: \"\n \"{a: [[1,1,true,true]], b: [[null,null,true,true]]}}}}}\");\n}",
  19789. "project": "mongo",
  19790. "hash": 125158764882493274109982582992109673579,
  19791. "size": 35,
  19792. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19793. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19794. "target": 0,
  19795. "dataset": "other",
  19796. "idx": 393279
  19797. },
  19798. {
  19799. "func": "TEST_F(QueryPlannerTest, IntersectElemMatch) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::INDEX_INTERSECTION;\n addIndex(BSON(\"a.b\" << 1));\n addIndex(BSON(\"a.c\" << 1));\n runQuery(fromjson(\"{a : {$elemMatch: {b:1, c:1}}}\"));\n assertSolutionExists(\n \"{fetch: {filter: {a:{$elemMatch:{b:1, c:1}}},\"\n \"node: {andSorted: {nodes: [\"\n \"{ixscan: {filter: null, pattern: {'a.b':1}}},\"\n \"{ixscan: {filter: null, pattern: {'a.c':1}}}]}}}}\");\n}",
  19800. "project": "mongo",
  19801. "hash": 320964980053163143904843670034929075538,
  19802. "size": 11,
  19803. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19804. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19805. "target": 0,
  19806. "dataset": "other",
  19807. "idx": 393280
  19808. },
  19809. {
  19810. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfIndexIsText) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a\"\n << \"text\"));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  19811. "project": "mongo",
  19812. "hash": 117629946431208117782871010324019852525,
  19813. "size": 10,
  19814. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19815. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19816. "target": 0,
  19817. "dataset": "other",
  19818. "idx": 393281
  19819. },
  19820. {
  19821. "func": "TEST_F(QueryPlannerTest, InvalidUtf8CodePointDoesNotLeadToInvalidIndexBoundsInvariantFailure) {\n params.options &= ~QueryPlannerParams::INCLUDE_COLLSCAN;\n addIndex(BSON(\"a\" << 1));\n\n // This UTF-8 is encoded correctly in the sense that it maps to a sequence of code points. The\n // code point 0x110000 is considered invalid. This does not result in an error because it does\n // not trigger a bounds building invariant.\n auto invalidCodePoint = std::string{\"\\xf4\\x90\\x80\\x80\"};\n auto findCommandWithInvalidCodepoint = BSON(\"find\"\n << \"testns\"\n << \"filter\"\n << BSON(\"a\" << BSON(\"$regex\" << invalidCodePoint)));\n runQueryAsCommand(findCommandWithInvalidCodepoint);\n}",
  19822. "project": "mongo",
  19823. "hash": 2842056339844703032411095636280103734,
  19824. "size": 14,
  19825. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19826. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19827. "target": 0,
  19828. "dataset": "other",
  19829. "idx": 393282
  19830. },
  19831. {
  19832. "func": "TEST_F(QueryPlannerTest, SparseIndexHintForSort) {\n addIndex(fromjson(\"{a: 1}\"), false, true);\n runQuerySortHint(BSONObj(), fromjson(\"{a: 1}\"), fromjson(\"{a: 1}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {a: 1}}}}}\");\n}",
  19833. "project": "mongo",
  19834. "hash": 271294755955914177493512984844352591951,
  19835. "size": 9,
  19836. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19837. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19838. "target": 0,
  19839. "dataset": "other",
  19840. "idx": 393283
  19841. },
  19842. {
  19843. "func": "TEST_F(QueryPlannerTest, OrTwoInexactFetch) {\n // true means multikey\n addIndex(BSON(\"names\" << 1), true);\n runQuery(\n fromjson(\"{$or: [{names: {$elemMatch: {$eq: 'alexandra'}}},\"\n \"{names: {$elemMatch: {$eq: 'thomas'}}}]}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: \"\n \"{$or: [{names: {$elemMatch: {$eq: 'alexandra'}}},\"\n \"{names: {$elemMatch: {$eq: 'thomas'}}}]}, \"\n \"node: {ixscan: {filter: null, pattern: {names: 1}}}}}\");\n}",
  19844. "project": "mongo",
  19845. "hash": 201166907590471533337364087775876821525,
  19846. "size": 15,
  19847. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19848. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19849. "target": 0,
  19850. "dataset": "other",
  19851. "idx": 393284
  19852. },
  19853. {
  19854. "func": "TEST_F(QueryPlannerTest, SkipEvaluatesBeforeFetchForIndexedOr) {\n addIndex(fromjson(\"{a: 1}\"));\n\n runQuerySkipNToReturn(fromjson(\"{$or: [{a: 5}, {a: 7}]}\"), 8, 0);\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{skip: {n: 8, node: \"\n \"{cscan: {dir: 1, filter: {$or: [{a: 5}, {a: 7}]}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: null, node: {skip: {n: 8, node: \"\n \"{ixscan: {filter: null, pattern: {a: 1}}}}}}}\");\n}",
  19855. "project": "mongo",
  19856. "hash": 77768869984828107986831215769734579067,
  19857. "size": 13,
  19858. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19859. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19860. "target": 0,
  19861. "dataset": "other",
  19862. "idx": 393285
  19863. },
  19864. {
  19865. "func": "TEST_F(QueryPlannerTest, PlannerUsesCoveredIxscanForCountWhenIndexSatisfiesQuery) {\n params.options = QueryPlannerParams::IS_COUNT;\n addIndex(BSON(\"x\" << 1));\n runQuery(BSON(\"x\" << 5));\n ASSERT_EQUALS(getNumSolutions(), 1U);\n assertSolutionExists(\"{ixscan: {pattern: {x: 1}, bounds: {x: [[5,5,true,true]]}}}\");\n}",
  19866. "project": "mongo",
  19867. "hash": 175842747209697880545730983573002847492,
  19868. "size": 7,
  19869. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19870. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19871. "target": 0,
  19872. "dataset": "other",
  19873. "idx": 393286
  19874. },
  19875. {
  19876. "func": "TEST_F(QueryPlannerTest, NegationRegexPrefix) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: /^a/}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  19877. "project": "mongo",
  19878. "hash": 69077011353031366389395586070589039072,
  19879. "size": 7,
  19880. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19881. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19882. "target": 0,
  19883. "dataset": "other",
  19884. "idx": 393287
  19885. },
  19886. {
  19887. "func": "TEST_F(QueryPlannerTest, BasicCovering) {\n addIndex(BSON(\"x\" << 1));\n // query, sort, proj\n runQuerySortProj(fromjson(\"{ x : {$gt: 1}}\"), BSONObj(), fromjson(\"{_id: 0, x: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, x: 1}, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, x: 1}, node: \"\n \"{cscan: {dir: 1, filter: {x:{$gt:1}}}}}}\");\n}",
  19888. "project": "mongo",
  19889. "hash": 54294114790576939730099398654716730000,
  19890. "size": 13,
  19891. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19892. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19893. "target": 0,
  19894. "dataset": "other",
  19895. "idx": 393288
  19896. },
  19897. {
  19898. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCombineLeadingFields) {\n MultikeyPaths multikeyPaths{{}, {0U}};\n addIndex(BSON(\"a\" << 1 << \"c\" << 1), multikeyPaths);\n addIndex(BSON(\"b\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: {$gte: 0}}, {$or: [{a: {$lte: 10}}, {b: 6}]}]}\"));\n assertNumSolutions(3);\n assertSolutionExists(\n \"{fetch: {filter: {a: {$gte: 0}}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[0, 10, true, true]]}}},\"\n \"{ixscan: {pattern: {b: 1}, bounds: {b: [[6, 6, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{a: {$lte: 10}}, {b: 6}]}, node: \"\n \"{ixscan: {pattern: {a: 1, c: 1}, bounds: {a: [[0, Infinity, true, true]], c: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19899. "project": "mongo",
  19900. "hash": 155281092184074099208446772794504907544,
  19901. "size": 19,
  19902. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19903. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19904. "target": 0,
  19905. "dataset": "other",
  19906. "idx": 393289
  19907. },
  19908. {
  19909. "func": "TEST_F(QueryPlannerTest, ContainedOrMoveToNot) {\n addIndex(BSON(\"b\" << 1 << \"a\" << 1));\n addIndex(BSON(\"c\" << 1 << \"a\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{$nor: [{b: 6}]}, {c: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {b: 1, a: 1}, bounds: {b: [['MinKey', 6, true, false], [6, 'MaxKey', \"\n \"false, true]], a: [[5, 5, true, true]]}}},\"\n \"{ixscan: {pattern: {c: 1, a: 1}, bounds: {c: [[7, 7, true, true]], a: [[5, 5, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19910. "project": "mongo",
  19911. "hash": 213729539101166010940035631948644649879,
  19912. "size": 15,
  19913. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19914. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19915. "target": 0,
  19916. "dataset": "other",
  19917. "idx": 393290
  19918. },
  19919. {
  19920. "func": "TEST_F(QueryPlannerTest, DottedFieldCovering) {\n addIndex(BSON(\"a.b\" << 1));\n runQuerySortProj(fromjson(\"{'a.b': 5}\"), BSONObj(), fromjson(\"{_id: 0, 'a.b': 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, 'a.b': 1}, node: \"\n \"{cscan: {dir: 1, filter: {'a.b': 5}}}}}\");\n // SERVER-2104\n // assertSolutionExists(\"{proj: {spec: {_id: 0, 'a.b': 1}, node: {'a.b': 1}}}\");\n}",
  19921. "project": "mongo",
  19922. "hash": 252303085438880243877553443544280490680,
  19923. "size": 11,
  19924. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19925. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19926. "target": 0,
  19927. "dataset": "other",
  19928. "idx": 393291
  19929. },
  19930. {
  19931. "func": "TEST_F(QueryPlannerTest, NoSplitLimitedSortAsCommand) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n params.options |= QueryPlannerParams::SPLIT_LIMITED_SORT;\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"b\" << 1));\n\n runQueryAsCommand(fromjson(\"{find: 'testns', filter: {a: 1}, sort: {b: 1}, limit: 3}\"));\n\n assertNumSolutions(2U);\n assertSolutionExists(\n \"{limit: {n: 3, node: {fetch: {filter: {a:1}, node: \"\n \"{ixscan: {filter: null, pattern: {b: 1}}}}}}}\");\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 3, node: {sortKeyGen: {node: {fetch: {filter: null,\"\n \"node: {ixscan: {pattern: {a: 1}}}}}}}}}\");\n}",
  19932. "project": "mongo",
  19933. "hash": 208303354247039405446907084050815185041,
  19934. "size": 16,
  19935. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19936. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19937. "target": 0,
  19938. "dataset": "other",
  19939. "idx": 393292
  19940. },
  19941. {
  19942. "func": "TEST_F(QueryPlannerTest, NonPrefixRegexAndCovering) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n runQuerySortProj(fromjson(\"{a: /foo/, b: 2}\"), BSONObj(), fromjson(\"{_id: 0, a: 1, b: 1}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \"\n \"{cscan: {dir: 1, filter: {$and: [{b: 2}, {a: /foo/}]}}}}}\");\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1, b: 1}, node: \"\n \"{ixscan: {filter: {a: /foo/}, pattern: {a: 1, b: 1}}}}}\");\n}",
  19943. "project": "mongo",
  19944. "hash": 50345321256951567932018564632635588385,
  19945. "size": 12,
  19946. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19947. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19948. "target": 0,
  19949. "dataset": "other",
  19950. "idx": 393293
  19951. },
  19952. {
  19953. "func": "TEST_F(QueryPlannerTest, MinMaxSameValue) {\n addIndex(BSON(\"a\" << 1));\n runInvalidQueryHintMinMax(BSONObj(), BSONObj(), fromjson(\"{a: 1}\"), fromjson(\"{a: 1}\"));\n}",
  19954. "project": "mongo",
  19955. "hash": 270178985969896263715797926918091708170,
  19956. "size": 4,
  19957. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19958. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19959. "target": 0,
  19960. "dataset": "other",
  19961. "idx": 393294
  19962. },
  19963. {
  19964. "func": "TEST_F(QueryPlannerTest, ExistsFalseSparseIndex) {\n addIndex(BSON(\"x\" << 1), false, true);\n\n runQuery(fromjson(\"{x: {$exists: false}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  19965. "project": "mongo",
  19966. "hash": 192831850574511324727515642837668113665,
  19967. "size": 8,
  19968. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19969. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19970. "target": 0,
  19971. "dataset": "other",
  19972. "idx": 393295
  19973. },
  19974. {
  19975. "func": "TEST_F(QueryPlannerTest, NonPrefixRegexMultikey) {\n // true means multikey\n addIndex(BSON(\"a\" << 1), true);\n runQuery(fromjson(\"{a: /foo/}\"));\n\n ASSERT_EQUALS(getNumSolutions(), 2U);\n assertSolutionExists(\"{cscan: {filter: {a: /foo/}, dir: 1}}\");\n assertSolutionExists(\n \"{fetch: {filter: {a: /foo/}, node: {ixscan: \"\n \"{pattern: {a: 1}, filter: null}}}}\");\n}",
  19976. "project": "mongo",
  19977. "hash": 69943051380359601589589594005310129476,
  19978. "size": 11,
  19979. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19980. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19981. "target": 0,
  19982. "dataset": "other",
  19983. "idx": 393296
  19984. },
  19985. {
  19986. "func": "TEST_F(QueryPlannerTest, NegationMod) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$mod: [2, 1]}}}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  19987. "project": "mongo",
  19988. "hash": 81887573140276528337016371224942700995,
  19989. "size": 7,
  19990. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  19991. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  19992. "target": 0,
  19993. "dataset": "other",
  19994. "idx": 393297
  19995. },
  19996. {
  19997. "func": "TEST_F(QueryPlannerTest, ContainedOrPredicateIsLeadingFieldMoveToAnd) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{a: 5}, {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}]}\"));\n assertNumSolutions(4);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[5, 5, true, true]], b: [[6, 6, true, \"\n \"true]], c: [[7, 7, true, true]]}}},\"\n \"{ixscan: {pattern: {a: 1, d: 1}, bounds: {a: [[5, 5, true, true]], d: [[8, 8, true, \"\n \"true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, b: 1, c: 1}, bounds: {a: [[5, 5, true, true]], b: [['MinKey', \"\n \"'MaxKey', true, true]], c: [['MinKey', 'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [{$and: [{b: 6}, {c: 7}]}, {d: 8}]}, node: \"\n \"{ixscan: {pattern: {a: 1, d: 1}, bounds: {a: [[5, 5, true, true]], d: [['MinKey', \"\n \"'MaxKey', true, true]]}}}\"\n \"}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  19998. "project": "mongo",
  19999. "hash": 329185874310788888285730414331445617593,
  20000. "size": 25,
  20001. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20002. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20003. "target": 0,
  20004. "dataset": "other",
  20005. "idx": 393298
  20006. },
  20007. {
  20008. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCannotCompoundFields) {\n MultikeyPaths multikeyPaths{{0U}, {0U}};\n addIndex(BSON(\"a.c\" << 1 << \"a.b\" << 1), multikeyPaths);\n addIndex(BSON(\"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{'a.b': 5}, {$or: [{'a.c': 6}, {d: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {'a.b': 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {'a.c': 1, 'a.b': 1}, bounds: {'a.c': [[6, 6, true, true]], 'a.b': \"\n \"[['MinKey', 'MaxKey', true, true]]}}},\"\n \"{ixscan: {pattern: {d: 1}, bounds: {d: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  20009. "project": "mongo",
  20010. "hash": 128192171279796328968104090575707264706,
  20011. "size": 15,
  20012. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20013. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20014. "target": 0,
  20015. "dataset": "other",
  20016. "idx": 393299
  20017. },
  20018. {
  20019. "func": "TEST_F(QueryPlannerTest, ContainedOrPathLevelMultikeyCompoundDottedFields) {\n MultikeyPaths multikeyPaths{{1U}, {1U}};\n addIndex(BSON(\"a.c\" << 1 << \"a.b\" << 1), multikeyPaths);\n addIndex(BSON(\"d\" << 1));\n\n runQuery(fromjson(\"{$and: [{'a.b': 5}, {$or: [{'a.c': 6}, {d: 7}]}]}\"));\n assertNumSolutions(2);\n assertSolutionExists(\n \"{fetch: {filter: {'a.b': 5}, node: {or: {nodes: [\"\n \"{ixscan: {pattern: {'a.c': 1, 'a.b': 1}, bounds: {'a.c': [[6, 6, true, true]], 'a.b': \"\n \"[[5, 5, true, true]]}}},\"\n \"{ixscan: {pattern: {d: 1}, bounds: {d: [[7, 7, true, true]]}}}\"\n \"]}}}}\");\n assertSolutionExists(\"{cscan: {dir: 1}}}}\");\n}",
  20020. "project": "mongo",
  20021. "hash": 114385200911064273267741817409224876858,
  20022. "size": 15,
  20023. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20024. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20025. "target": 0,
  20026. "dataset": "other",
  20027. "idx": 393300
  20028. },
  20029. {
  20030. "func": "TEST_F(QueryPlannerTest,\n EmptyQueryWithProjectionUsesCoveredIxscanOnDotttedNonMultikeyIndexIfEnabled) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n addIndex(BSON(\"a.b\" << 1));\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, 'a.b': 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, 'a.b': 1}, node: \"\n \"{ixscan: {filter: null, pattern: {'a.b': 1},\"\n \"bounds: {'a.b': [['MinKey', 'MaxKey', true, true]]}}}}}\");\n}",
  20031. "project": "mongo",
  20032. "hash": 219074790107576118062412206525868185878,
  20033. "size": 11,
  20034. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20035. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20036. "target": 0,
  20037. "dataset": "other",
  20038. "idx": 393301
  20039. },
  20040. {
  20041. "func": "TEST_F(QueryPlannerTest, BoundsTypeMinKeyMaxKey) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n addIndex(BSON(\"a\" << 1));\n\n runQuery(fromjson(\"{a: {$type: -1}}\"));\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1}, bounds:\"\n \"{a: [['MinKey','MinKey',true,true]]}}}}}\");\n\n runQuery(fromjson(\"{a: {$type: 127}}\"));\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {pattern: {a: 1}, bounds:\"\n \"{a: [['MaxKey','MaxKey',true,true]]}}}}}\");\n}",
  20042. "project": "mongo",
  20043. "hash": 243178631725294320876220545840102311377,
  20044. "size": 16,
  20045. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20046. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20047. "target": 0,
  20048. "dataset": "other",
  20049. "idx": 393302
  20050. },
  20051. {
  20052. "func": "TEST_F(QueryPlannerTest, NonTopLevelIndexedNegationMinQuery) {\n addIndex(BSON(\"state\" << 1));\n addIndex(BSON(\"is_draft\" << 1));\n addIndex(BSON(\"published_date\" << 1));\n\n // This is the min query to reproduce SERVER-13714\n BSONObj queryObj = fromjson(\"{$or:[{state:1, is_draft:1}, {published_date:{$ne: 1}}]}\");\n runQuery(queryObj);\n}",
  20053. "project": "mongo",
  20054. "hash": 59434301988047124918282199792627962780,
  20055. "size": 9,
  20056. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20057. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20058. "target": 0,
  20059. "dataset": "other",
  20060. "idx": 393303
  20061. },
  20062. {
  20063. "func": "TEST_F(QueryPlannerTest, ElemMatchObjectNegationInArray) {\n addIndex(BSON(\"i.j\" << 1));\n runQuery(fromjson(\"{i: {$elemMatch: {j: {$not: {$in: [[1]]}}}}}\"));\n assertHasOnlyCollscan();\n}",
  20064. "project": "mongo",
  20065. "hash": 301725357979501597480213941733140904552,
  20066. "size": 5,
  20067. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20068. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20069. "target": 0,
  20070. "dataset": "other",
  20071. "idx": 422530
  20072. },
  20073. {
  20074. "func": "TEST_F(QueryPlannerTest, MaxMinReverseIndexDirSort) {\n addIndex(BSON(\"a\" << -1));\n\n // Min/max specifies a forward scan with bounds [{a: 8}, {a: 2}]. Asking for\n // an ascending sort reverses the direction of the scan to [{a: 2}, {a: 8}].\n runQueryFull(BSONObj(),\n fromjson(\"{a: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 8}\"),\n fromjson(\"{a: 2}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\n \"{fetch: {node: {ixscan: {filter: null, dir: -1,\"\n \"pattern: {a: -1}}}}}\");\n}",
  20075. "project": "mongo",
  20076. "hash": 52759261307879691642349311864530017080,
  20077. "size": 19,
  20078. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20079. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20080. "target": 0,
  20081. "dataset": "other",
  20082. "idx": 422531
  20083. },
  20084. {
  20085. "func": "TEST_F(QueryPlannerTest, MaxMinSort) {\n addIndex(BSON(\"a\" << 1));\n\n // Run an empty query, sort {a: 1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{a: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 2}\"),\n fromjson(\"{a: 8}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, pattern: {a: 1}}}}}\");\n}",
  20086. "project": "mongo",
  20087. "hash": 171731007345135026512018999321537926630,
  20088. "size": 16,
  20089. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20090. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20091. "target": 0,
  20092. "dataset": "other",
  20093. "idx": 422548
  20094. },
  20095. {
  20096. "func": "TEST_F(QueryPlannerTest, NegatedElemMatchObjectEqArray) {\n addIndex(BSON(\"i.j\" << 1));\n runQuery(fromjson(\"{i: {$not: {$elemMatch: {j: [1]}}}}\"));\n assertHasOnlyCollscan();\n}",
  20097. "project": "mongo",
  20098. "hash": 106807169162194675404291430126893313680,
  20099. "size": 5,
  20100. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20101. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20102. "target": 0,
  20103. "dataset": "other",
  20104. "idx": 422553
  20105. },
  20106. {
  20107. "func": "TEST_F(QueryPlannerTest, NegationEqArray) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$eq: [1, 2]}}}\"));\n\n assertHasOnlyCollscan();\n}",
  20108. "project": "mongo",
  20109. "hash": 176044595574816834483662292120521115972,
  20110. "size": 6,
  20111. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20112. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20113. "target": 0,
  20114. "dataset": "other",
  20115. "idx": 422577
  20116. },
  20117. {
  20118. "func": "TEST_F(QueryPlannerTest, MaxMinReverseSort) {\n addIndex(BSON(\"a\" << 1));\n\n // Run an empty query, sort {a: -1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{a: -1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 2}\"),\n fromjson(\"{a: 8}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: -1, pattern: {a: 1}}}}}\");\n}",
  20119. "project": "mongo",
  20120. "hash": 144775994354736890012054191785138395635,
  20121. "size": 16,
  20122. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20123. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20124. "target": 0,
  20125. "dataset": "other",
  20126. "idx": 422598
  20127. },
  20128. {
  20129. "func": "TEST_F(QueryPlannerTest, MaxMinSelectCorrectlyOrderedIndex) {\n // There are both ascending and descending indices on 'a'.\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << -1));\n\n // The ordering of min and max means that we *must* use the descending index.\n runQueryFull(\n BSONObj(), BSONObj(), BSONObj(), 0, 0, BSONObj(), fromjson(\"{a: 8}\"), fromjson(\"{a: 2}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: 1, pattern: {a: -1}}}}}\");\n\n // If we switch the ordering, then we use the ascending index.\n // The ordering of min and max means that we *must* use the descending index.\n runQueryFull(\n BSONObj(), BSONObj(), BSONObj(), 0, 0, BSONObj(), fromjson(\"{a: 2}\"), fromjson(\"{a: 8}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: 1, pattern: {a: 1}}}}}\");\n}",
  20130. "project": "mongo",
  20131. "hash": 87050822718152877832565251751125122477,
  20132. "size": 20,
  20133. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20134. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20135. "target": 0,
  20136. "dataset": "other",
  20137. "idx": 422614
  20138. },
  20139. {
  20140. "func": "TEST_F(QueryPlannerTest, ElemMatchValueNegationEqArray) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$elemMatch: {$not: {$eq: [1]}}}}\"));\n assertHasOnlyCollscan();\n}",
  20141. "project": "mongo",
  20142. "hash": 83775658184517174026849386902532558819,
  20143. "size": 5,
  20144. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20145. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20146. "target": 0,
  20147. "dataset": "other",
  20148. "idx": 422616
  20149. },
  20150. {
  20151. "func": "TEST_F(QueryPlannerTest, NegationInArray) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$in: [1, [1, 2]]}}}\"));\n\n assertHasOnlyCollscan();\n}",
  20152. "project": "mongo",
  20153. "hash": 279648609605579823707071567700419614936,
  20154. "size": 6,
  20155. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20156. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20157. "target": 0,
  20158. "dataset": "other",
  20159. "idx": 422622
  20160. },
  20161. {
  20162. "func": "TEST_F(QueryPlannerTest, ElemMatchObjectNegationEqArray) {\n addIndex(BSON(\"i.j\" << 1));\n runQuery(fromjson(\"{i: {$elemMatch: {j: {$ne: [1]}}}}\"));\n assertHasOnlyCollscan();\n}",
  20163. "project": "mongo",
  20164. "hash": 300827346379378327848576982402894704019,
  20165. "size": 5,
  20166. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20167. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20168. "target": 0,
  20169. "dataset": "other",
  20170. "idx": 422640
  20171. },
  20172. {
  20173. "func": "TEST_F(QueryPlannerTest, MaxMinReverseIndexDir) {\n addIndex(BSON(\"a\" << -1));\n\n // Because the index is descending, the min is numerically larger than the max.\n runQueryFull(BSONObj(),\n fromjson(\"{a: -1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 8}\"),\n fromjson(\"{a: 2}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, dir: 1, pattern: {a: -1}}}}}\");\n}",
  20174. "project": "mongo",
  20175. "hash": 263682038692500832574526899130310056639,
  20176. "size": 16,
  20177. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20178. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20179. "target": 0,
  20180. "dataset": "other",
  20181. "idx": 422641
  20182. },
  20183. {
  20184. "func": "TEST_F(QueryPlannerTest, NegatedElemMatchValueEqArray) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$elemMatch: {$eq: [1]}}}}\"));\n assertHasOnlyCollscan();\n}",
  20185. "project": "mongo",
  20186. "hash": 263620425667224883259005898122669314763,
  20187. "size": 5,
  20188. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20189. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20190. "target": 0,
  20191. "dataset": "other",
  20192. "idx": 422655
  20193. },
  20194. {
  20195. "func": "TEST_F(QueryPlannerTest, ElemMatchValueNegationInArray) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$elemMatch: {$not: {$in: [[1]]}}}}\"));\n assertHasOnlyCollscan();\n}",
  20196. "project": "mongo",
  20197. "hash": 68475187401535216593166835815033951959,
  20198. "size": 5,
  20199. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20200. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20201. "target": 0,
  20202. "dataset": "other",
  20203. "idx": 422665
  20204. },
  20205. {
  20206. "func": "TEST_F(QueryPlannerTest, NegatedElemMatchObjectInArray) {\n addIndex(BSON(\"i.j\" << 1));\n runQuery(fromjson(\"{i: {$not: {$elemMatch: {j: {$in: [[1]]}}}}}\"));\n assertHasOnlyCollscan();\n}",
  20207. "project": "mongo",
  20208. "hash": 254419850265064827291049506299864389320,
  20209. "size": 5,
  20210. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20211. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20212. "target": 0,
  20213. "dataset": "other",
  20214. "idx": 422669
  20215. },
  20216. {
  20217. "func": "TEST_F(QueryPlannerTest, MaxMinBadHintSelectsReverseIndex) {\n // There are both ascending and descending indices on 'a'.\n addIndex(BSON(\"a\" << 1));\n addIndex(BSON(\"a\" << -1));\n\n // A query hinting on {a: 1} is bad if min is {a: 8} and {a: 2} because this\n // min/max pairing requires a descending index.\n runInvalidQueryFull(BSONObj(),\n BSONObj(),\n BSONObj(),\n 0,\n 0,\n fromjson(\"{a: 1}\"),\n fromjson(\"{a: 8}\"),\n fromjson(\"{a: 2}\"));\n}",
  20218. "project": "mongo",
  20219. "hash": 28157185506823626119452032742196254038,
  20220. "size": 16,
  20221. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20222. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20223. "target": 0,
  20224. "dataset": "other",
  20225. "idx": 422675
  20226. },
  20227. {
  20228. "func": "TEST_F(QueryPlannerTest, MaxMinSortInequalityFirstSortSecond) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n // Run an empty query, sort {b: 1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{b: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 1, b: 1}\"),\n fromjson(\"{a: 2, b: 2}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\n \"{sort: {pattern: {b: 1}, limit: 0, node: {sortKeyGen: {node: \"\n \"{fetch: {node: \"\n \"{ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}}}}}\");\n}",
  20229. "project": "mongo",
  20230. "hash": 323642933439668116381512192073258559765,
  20231. "size": 19,
  20232. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20233. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20234. "target": 0,
  20235. "dataset": "other",
  20236. "idx": 422676
  20237. },
  20238. {
  20239. "func": "TEST_F(QueryPlannerTest, MaxMinSortEqualityFirstSortSecond) {\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n\n // Run an empty query, sort {b: 1}, max/min arguments.\n runQueryFull(BSONObj(),\n fromjson(\"{b: 1}\"),\n BSONObj(),\n 0,\n 0,\n BSONObj(),\n fromjson(\"{a: 1, b: 1}\"),\n fromjson(\"{a: 1, b: 2}\"));\n\n assertNumSolutions(1);\n assertSolutionExists(\"{fetch: {node: {ixscan: {filter: null, pattern: {a: 1, b: 1}}}}}\");\n}",
  20240. "project": "mongo",
  20241. "hash": 158008272772826678805230892209160078817,
  20242. "size": 16,
  20243. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20244. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20245. "target": 0,
  20246. "dataset": "other",
  20247. "idx": 422687
  20248. },
  20249. {
  20250. "func": "TEST_F(QueryPlannerTest, NegatedElemMatchValueInArray) {\n addIndex(BSON(\"i\" << 1));\n runQuery(fromjson(\"{i: {$not: {$elemMatch: {$in: [[1]]}}}}\"));\n assertHasOnlyCollscan();\n}",
  20251. "project": "mongo",
  20252. "hash": 154877265717508584451250076485643803793,
  20253. "size": 5,
  20254. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  20255. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20256. "target": 0,
  20257. "dataset": "other",
  20258. "idx": 422688
  20259. },
  20260. {
  20261. "func": "TEST_F(QueryPlannerTest, NToReturnHackWithFindCommand) {\n params.options |= QueryPlannerParams::SPLIT_LIMITED_SORT;\n\n runQueryAsCommand(fromjson(\"{find: 'testns', sort: {a:1}, ntoreturn:3}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{ensureSorted: {pattern: {a: 1}, node: \"\n \"{or: {nodes: [\"\n \"{sort: {limit:3, pattern: {a:1}, node: {sortKeyGen: {node: {cscan: {dir:1}}}}}}, \"\n \"{sort: {limit:0, pattern: {a:1}, node: {sortKeyGen: {node: {cscan: {dir:1}}}}}}\"\n \"]}}}}\");\n}",
  20262. "project": "mongo",
  20263. "hash": 253569964028454982379754381623470841138,
  20264. "size": 13,
  20265. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20266. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20267. "target": 0,
  20268. "dataset": "other",
  20269. "idx": 392947
  20270. },
  20271. {
  20272. "func": "TEST_F(QueryPlannerTest, NToReturnHackWithSingleBatch) {\n params.options |= QueryPlannerParams::SPLIT_LIMITED_SORT;\n\n runQueryAsCommand(fromjson(\"{find: 'testns', sort: {a:1}, ntoreturn:3, singleBatch:true}\"));\n\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{sort: {pattern: {a:1}, limit:3, node: {sortKeyGen: {node: \"\n \"{cscan: {dir:1, filter: {}}}}}}}\");\n}",
  20273. "project": "mongo",
  20274. "hash": 193009886617362016199398427674325904470,
  20275. "size": 10,
  20276. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20277. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20278. "target": 0,
  20279. "dataset": "other",
  20280. "idx": 393064
  20281. },
  20282. {
  20283. "func": "TEST_IMPL(utf8_decode1_overrun) {\n const char* p;\n char b[1];\n\n /* Single byte. */\n p = b;\n b[0] = 0x7F;\n ASSERT_EQ(0x7F, uv__utf8_decode1(&p, b + 1));\n ASSERT_EQ(p, b + 1);\n\n /* Multi-byte. */\n p = b;\n b[0] = 0xC0;\n ASSERT_EQ((unsigned) -1, uv__utf8_decode1(&p, b + 1));\n ASSERT_EQ(p, b + 1);\n\n return 0;\n}",
  20284. "project": "libuv",
  20285. "hash": 191201424006364742227765802834063248060,
  20286. "size": 18,
  20287. "commit_id": "b7466e31e4bee160d82a68fca11b1f61d46debae",
  20288. "message": "idna: fix OOB read in punycode decoder\n\nlibuv was vulnerable to out-of-bounds reads in the uv__idna_toascii()\nfunction which is used to convert strings to ASCII. This is called by\nthe DNS resolution function and can lead to information disclosures or\ncrashes.\n\nReported by Eric Sesterhenn in collaboration with Cure53 and ExpressVPN.\n\nReported-By: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>\nFixes: https://github.com/libuv/libuv/issues/3147\nPR-URL: https://github.com/libuv/libuv-private/pull/1\nRefs: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22918\nReviewed-By: Colin Ihrig <cjihrig@gmail.com>\nReviewed-By: Richard Lau <riclau@uk.ibm.com>",
  20289. "target": 0,
  20290. "dataset": "other",
  20291. "idx": 326146
  20292. },
  20293. {
  20294. "func": "TEST_F(QueryPlannerTest, LockstepOrEnumerationDoesPrioritizeLockstepIteration) {\n params.options =\n QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::ENUMERATE_OR_CHILDREN_LOCKSTEP;\n ASSERT_EQ(internalQueryEnumerationMaxOrSolutions.load(), 10);\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"d\" << 1));\n\n // For this query and the above indexes, each clause of the $or has three options to choose\n // from, for a total of 3 * 3 * 3 = 27 possible enumerations for just that $or sub-branch.\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {a: 1, $or: [{b: 1, c: 1, d: 1}, {b: 2, c: 2, d: 2}, \"\n \"{b: 3, c: 3, d: 3}]}}\"));\n\n // The $or enumeration is limited to 10, and then we have three plans where just the {a: 1}\n // predicate is indexed.\n assertNumSolutions(13U);\n\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c: {$eq: 1}, d: {$eq: 1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2}, d: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}} \"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 1}, d: {$eq: 1}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2}, d: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}} \"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 1}, c: {$eq: 1}}, node: {ixscan: {pattern: {a: 1, d: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2}, c: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, d: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, c: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, d: 1}}}}} \"\n \"]}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [\"\n \"{b: {$eq: 1}, c: {$eq: 1}, d: {$eq: 1}}, \"\n \"{b: {$eq: 2}, c: {$eq: 2}, d: {$eq: 2}}, \"\n \"{b: {$eq: 3}, c: {$eq: 3}, d: {$eq: 3}} \"\n \"]}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}}\");\n}",
  20295. "project": "mongo",
  20296. "hash": 138190832869173379176856823647358948538,
  20297. "size": 43,
  20298. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20299. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20300. "target": 0,
  20301. "dataset": "other",
  20302. "idx": 392972
  20303. },
  20304. {
  20305. "func": "TEST_F(QueryPlannerTest, NormalOrEnumerationDoesNotPrioritizeLockstepIteration) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n ASSERT_EQ(internalQueryEnumerationMaxOrSolutions.load(), 10);\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"d\" << 1));\n\n // For this query and the above indexes, each clause of the $or has three options to choose\n // from, for a total of 3 * 3 * 3 = 27 possible enumerations for just that $or sub-branch.\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {a: 1, $or: [{b: 1, c: 1, d: 1}, {b: 2, c: 2, d: 2}, \"\n \"{b: 3, c: 3, d: 3}]}}\"));\n\n // The $or enumeration is limited to 10, and then we have three plans where just the {a: 1}\n // predicate is indexed.\n assertNumSolutions(13U);\n\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c: {$eq: 1}, d: {$eq: 1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2}, d: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}} \"\n \"]}}\");\n // Because we did not set the 'ENUMERATE_OR_CHILDREN_LOCKSTEP' flag, we don't expect this\n // solution to be generated. This is in contrast to the next test case.\n ASSERT_THROWS(\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 1}, c: {$eq: 1}}, node: {ixscan: {pattern: {a: 1, d: \"\n \"1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2}, c: {$eq: 2}}, node: {ixscan: {pattern: {a: 1, d: \"\n \"1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, c: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, d: \"\n \"1}}}}} \"\n \"]}}\"),\n unittest::TestAssertionFailureException);\n\n // We still expect to generate the solutions which don't index the $or.\n assertSolutionExists(\n \"{fetch: {filter: {$or: [\"\n \"{b: {$eq: 1}, c: {$eq: 1}, d: {$eq: 1}}, \"\n \"{b: {$eq: 2}, c: {$eq: 2}, d: {$eq: 2}}, \"\n \"{b: {$eq: 3}, c: {$eq: 3}, d: {$eq: 3}} \"\n \"]}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}}\");\n}",
  20306. "project": "mongo",
  20307. "hash": 127599942447419113041252219928399911091,
  20308. "size": 45,
  20309. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20310. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20311. "target": 0,
  20312. "dataset": "other",
  20313. "idx": 393058
  20314. },
  20315. {
  20316. "func": "TEST_F(QueryPlannerTest, LockstepOrEnumerationDoesPrioritizeLockstepIterationMixedChildren) {\n params.options =\n QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::ENUMERATE_OR_CHILDREN_LOCKSTEP;\n ASSERT_EQ(internalQueryEnumerationMaxOrSolutions.load(), 10);\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"d\" << 1));\n addIndex(BSON(\"a\" << 1 << \"e\" << 1));\n\n // For this query and the above indexes, each clause of the $or has a varying number options to\n // choose from, for a total of 2 * 3 * 4 * 2 = 48 possible enumerations for just that $or\n // sub-branch.\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {\"\n \" a: 1,\"\n \" $or: [\"\n \" {b: 2.1, c: 2.1},\"\n \" {b: 3, c: 3, d: 3},\"\n \" {b: 4, c: 4, d: 4, e: 4},\"\n \" {b: 2.2, c: 2.2}\"\n \"]}}\"));\n\n // The $or enumeration is limited to 10, and then we have four plans where just the {a: 1}\n // predicate is indexed.\n assertNumSolutions(14U);\n\n // Lockstep enumerations. Definitely expected.\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 4}, d: {$eq: 4}, e: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, d: {$eq: 4}, e: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}\"\n \"]}}\");\n // Everyone advances one more time, no longer lock step.\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, c: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, d: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, e: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, d: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}\"\n \"]}}\");\n // Normal enumeration. Here we observe an interesting phenomena. Before we get into plan\n // enumeration, the query is parsed and \"normalized\". This process involves putting the query in\n // a canonical order, in part so that similar queries can be recognized as such for caching. In\n // this case, it orders the $or children by their respective number of children. So our original\n // query will be enumerated as if it were typed in this order:\n // {a: 1,\n // $or: [\n // {b: 2.1, c: 2.1},\n // {b: 2.2, c: 2.2},\n // {b: 3, c: 3, d: 3},\n // {b: 4, c: 4, d: 4, e: 4}\n // ]\n // }\n // Here are the exact plans:\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, c: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, d: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, e: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, d: 1}}}}}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, c: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, d: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, e: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, d: 1}}}}}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 3}, c: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, d: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, e: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, d: 1}}}}}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, e: 1}}}}}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, e: 1}}}}}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {c: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, e: 1}}}}}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \"{fetch: {filter: {b: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \"{fetch: {filter: {c: {$eq: 3}, d: {$eq: 3}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \"{fetch: {filter: {b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}},\"\n \" node: {ixscan: {pattern: {a: 1, e: 1}}}}}\"\n \"]}}\");\n\n // Now to the solutions which don't index the $or.\n assertSolutionExists(\n \"{fetch: {filter: {$or: [\"\n \"{b: {$eq: 2.1}, c: {$eq: 2.1}}, \"\n \"{b: {$eq: 2.2}, c: {$eq: 2.2}}, \"\n \"{b: {$eq: 3}, c: {$eq: 3}, d: {$eq: 3}}, \"\n \"{b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}, e: {$eq: 4}} \"\n \"]}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [\"\n \"{b: {$eq: 2.1}, c: {$eq: 2.1}}, \"\n \"{b: {$eq: 2.2}, c: {$eq: 2.2}}, \"\n \"{b: {$eq: 3}, c: {$eq: 3}, d: {$eq: 3}}, \"\n \"{b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}, e: {$eq: 4}} \"\n \"]}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [\"\n \"{b: {$eq: 2.1}, c: {$eq: 2.1}}, \"\n \"{b: {$eq: 2.2}, c: {$eq: 2.2}}, \"\n \"{b: {$eq: 3}, c: {$eq: 3}, d: {$eq: 3}}, \"\n \"{b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}, e: {$eq: 4}} \"\n \"]}, node: {ixscan: {pattern: {a: 1, d: 1}}}}}}\");\n assertSolutionExists(\n \"{fetch: {filter: {$or: [\"\n \"{b: {$eq: 2.1}, c: {$eq: 2.1}}, \"\n \"{b: {$eq: 2.2}, c: {$eq: 2.2}}, \"\n \"{b: {$eq: 3}, c: {$eq: 3}, d: {$eq: 3}}, \"\n \"{b: {$eq: 4}, c: {$eq: 4}, d: {$eq: 4}, e: {$eq: 4}} \"\n \"]}, node: {ixscan: {pattern: {a: 1, e: 1}}}}}}\");\n}",
  20317. "project": "mongo",
  20318. "hash": 71606015114333085332408170473625445736,
  20319. "size": 153,
  20320. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20321. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20322. "target": 0,
  20323. "dataset": "other",
  20324. "idx": 393198
  20325. },
  20326. {
  20327. "func": "TEST_F(QueryPlannerTest, LockstepOrEnumerationApplysToEachOrInTree) {\n params.options =\n QueryPlannerParams::NO_TABLE_SCAN | QueryPlannerParams::ENUMERATE_OR_CHILDREN_LOCKSTEP;\n ASSERT_EQ(internalQueryEnumerationMaxOrSolutions.load(), 10);\n addIndex(BSON(\"a\" << 1 << \"b\" << 1));\n addIndex(BSON(\"a\" << 1 << \"c\" << 1));\n addIndex(BSON(\"a\" << 1 << \"x\" << 1));\n addIndex(BSON(\"a\" << 1 << \"y\" << 1));\n\n // For this query and the above indexes, each clause of the $or has 2 indexes to choose from,\n // for a total of 2 * 2 * 2 * 2 = 16 possible enumerations for just that $or sub-branch.\n runQueryAsCommand(\n fromjson(\"{find: 'testns', filter: {\"\n \" a: 1,\"\n \" $or: [\"\n \" {b: 2.1, c: 2.1},\"\n \" {b: 2.2, c: 2.2},\"\n \" {$and: [\"\n \" {unindexed: 'thisPredicateToEnsureNestedOrsAreNotCombined'},\"\n \" {$or: [\"\n \" {x: 3.0, y: 3.0},\"\n \" {x: 3.1, y: 3.1}\"\n \" ]}\"\n \" ]}\"\n \"]}}\"));\n\n // The $or enumeration is limited to 10, and then we have 4 plans where just the {a: 1}\n // predicate is indexed.\n assertNumSolutions(14U);\n\n // Both lockstep enumerations should be present.\n assertSolutionExists(\n \"{or: {nodes: [\"\n \" {fetch: {filter: {c: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \" {fetch: {filter: {c: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, b: 1}}}}}, \"\n \" {fetch: {\"\n \" filter: {unindexed: {$eq: 'thisPredicateToEnsureNestedOrsAreNotCombined'}},\"\n \" node: {\"\n \" or: {nodes: [\"\n \" {fetch: {filter: {y: {$eq: 3.0}}, node: {ixscan: {pattern: {a: 1, x: 1}}}}},\"\n \" {fetch: {filter: {y: {$eq: 3.1}}, node: {ixscan: {pattern: {a: 1, x: 1}}}}}\"\n \" ]}}\"\n \" }}\"\n \"]}}\");\n assertSolutionExists(\n \"{or: {nodes: [\"\n \" {fetch: {filter: {b: {$eq: 2.1}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \" {fetch: {filter: {b: {$eq: 2.2}}, node: {ixscan: {pattern: {a: 1, c: 1}}}}}, \"\n \" {fetch: {\"\n \" filter: {unindexed: {$eq: 'thisPredicateToEnsureNestedOrsAreNotCombined'}},\"\n \" node: {\"\n \" or: {nodes: [\"\n \" {fetch: {filter: {x: {$eq: 3.0}}, node: {ixscan: {pattern: {a: 1, y: 1}}}}},\"\n \" {fetch: {filter: {x: {$eq: 3.1}}, node: {ixscan: {pattern: {a: 1, y: 1}}}}}\"\n \" ]}}\"\n \" }}\"\n \"]}}\");\n}",
  20328. "project": "mongo",
  20329. "hash": 305320307847511139289598197006264807849,
  20330. "size": 58,
  20331. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20332. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20333. "target": 0,
  20334. "dataset": "other",
  20335. "idx": 393199
  20336. },
  20337. {
  20338. "func": "TEST_F(QueryPlannerTest, NoTableScanBasic) {\n params.options = QueryPlannerParams::NO_TABLE_SCAN;\n runQuery(BSONObj());\n assertNumSolutions(0U);\n\n addIndex(BSON(\"x\" << 1));\n\n runQuery(BSONObj());\n assertNumSolutions(0U);\n\n runQuery(fromjson(\"{x: {$gte: 0}}\"));\n assertNumSolutions(1U);\n assertSolutionExists(\n \"{fetch: {filter: null, node: {ixscan: \"\n \"{filter: null, pattern: {x: 1}}}}}\");\n}",
  20339. "project": "mongo",
  20340. "hash": 156953879945149079560798668435408448677,
  20341. "size": 16,
  20342. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20343. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20344. "target": 0,
  20345. "dataset": "other",
  20346. "idx": 393010
  20347. },
  20348. {
  20349. "func": "TEST_F(QueryPlannerTest, NoMutationsForCollscan) {\n params.options = QueryPlannerParams::KEEP_MUTATIONS;\n runQuery(fromjson(\"\"));\n assertSolutionExists(\"{cscan: {dir: 1}}\");\n}",
  20350. "project": "mongo",
  20351. "hash": 119749621657519559928418224758871722815,
  20352. "size": 5,
  20353. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  20354. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  20355. "target": 0,
  20356. "dataset": "other",
  20357. "idx": 393248
  20358. }
  20359. ]
  20360. },
  20361. {
  20362. "call_depth": 3,
  20363. "longest_call_chain": [
  20364. "rawsock_tx_work",
  20365. "rawsock_report_error",
  20366. "rawsock_write_queue_purge"
  20367. ],
  20368. "group_size": 5,
  20369. "functions": [
  20370. {
  20371. "func": "static void rawsock_report_error(struct sock *sk, int err)\n{\n\tpr_debug(\"sk=%p err=%d\\n\", sk, err);\n\n\tsk->sk_shutdown = SHUTDOWN_MASK;\n\tsk->sk_err = -err;\n\tsk->sk_error_report(sk);\n\n\trawsock_write_queue_purge(sk);\n}",
  20372. "project": "linux",
  20373. "hash": 245998130896381748651117715245493241490,
  20374. "size": 10,
  20375. "commit_id": "26896f01467a28651f7a536143fe5ac8449d4041",
  20376. "message": "net/nfc/rawsock.c: add CAP_NET_RAW check.\n\nWhen creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first.\n\nSigned-off-by: Qingyu Li <ieatmuttonchuan@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  20377. "target": 0,
  20378. "dataset": "other",
  20379. "idx": 319219
  20380. },
  20381. {
  20382. "func": "static void rawsock_data_exchange_complete(void *context, struct sk_buff *skb,\n\t\t\t\t\t int err)\n{\n\tstruct sock *sk = (struct sock *) context;\n\n\tBUG_ON(in_irq());\n\n\tpr_debug(\"sk=%p err=%d\\n\", sk, err);\n\n\tif (err)\n\t\tgoto error;\n\n\terr = rawsock_add_header(skb);\n\tif (err)\n\t\tgoto error_skb;\n\n\terr = sock_queue_rcv_skb(sk, skb);\n\tif (err)\n\t\tgoto error_skb;\n\n\tspin_lock_bh(&sk->sk_write_queue.lock);\n\tif (!skb_queue_empty(&sk->sk_write_queue))\n\t\tschedule_work(&nfc_rawsock(sk)->tx_work);\n\telse\n\t\tnfc_rawsock(sk)->tx_work_scheduled = false;\n\tspin_unlock_bh(&sk->sk_write_queue.lock);\n\n\tsock_put(sk);\n\treturn;\n\nerror_skb:\n\tkfree_skb(skb);\n\nerror:\n\trawsock_report_error(sk, err);\n\tsock_put(sk);\n}",
  20383. "project": "linux",
  20384. "hash": 110051069936394327206475216324016531000,
  20385. "size": 37,
  20386. "commit_id": "26896f01467a28651f7a536143fe5ac8449d4041",
  20387. "message": "net/nfc/rawsock.c: add CAP_NET_RAW check.\n\nWhen creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first.\n\nSigned-off-by: Qingyu Li <ieatmuttonchuan@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  20388. "target": 0,
  20389. "dataset": "other",
  20390. "idx": 319222
  20391. },
  20392. {
  20393. "func": "static void rawsock_tx_work(struct work_struct *work)\n{\n\tstruct sock *sk = to_rawsock_sk(work);\n\tstruct nfc_dev *dev = nfc_rawsock(sk)->dev;\n\tu32 target_idx = nfc_rawsock(sk)->target_idx;\n\tstruct sk_buff *skb;\n\tint rc;\n\n\tpr_debug(\"sk=%p target_idx=%u\\n\", sk, target_idx);\n\n\tif (sk->sk_shutdown & SEND_SHUTDOWN) {\n\t\trawsock_write_queue_purge(sk);\n\t\treturn;\n\t}\n\n\tskb = skb_dequeue(&sk->sk_write_queue);\n\n\tsock_hold(sk);\n\trc = nfc_data_exchange(dev, target_idx, skb,\n\t\t\t rawsock_data_exchange_complete, sk);\n\tif (rc) {\n\t\trawsock_report_error(sk, rc);\n\t\tsock_put(sk);\n\t}\n}",
  20394. "project": "linux",
  20395. "hash": 223599683806282363453270540410922770133,
  20396. "size": 25,
  20397. "commit_id": "26896f01467a28651f7a536143fe5ac8449d4041",
  20398. "message": "net/nfc/rawsock.c: add CAP_NET_RAW check.\n\nWhen creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first.\n\nSigned-off-by: Qingyu Li <ieatmuttonchuan@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  20399. "target": 0,
  20400. "dataset": "other",
  20401. "idx": 319211
  20402. },
  20403. {
  20404. "func": "static int rawsock_add_header(struct sk_buff *skb)\n{\n\t*(u8 *)skb_push(skb, NFC_HEADER_SIZE) = 0;\n\n\treturn 0;\n}",
  20405. "project": "linux",
  20406. "hash": 219181297283455318634560520674922386341,
  20407. "size": 6,
  20408. "commit_id": "26896f01467a28651f7a536143fe5ac8449d4041",
  20409. "message": "net/nfc/rawsock.c: add CAP_NET_RAW check.\n\nWhen creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first.\n\nSigned-off-by: Qingyu Li <ieatmuttonchuan@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  20410. "target": 0,
  20411. "dataset": "other",
  20412. "idx": 319210
  20413. },
  20414. {
  20415. "func": "static void rawsock_write_queue_purge(struct sock *sk)\n{\n\tpr_debug(\"sk=%p\\n\", sk);\n\n\tspin_lock_bh(&sk->sk_write_queue.lock);\n\t__skb_queue_purge(&sk->sk_write_queue);\n\tnfc_rawsock(sk)->tx_work_scheduled = false;\n\tspin_unlock_bh(&sk->sk_write_queue.lock);\n}",
  20416. "project": "linux",
  20417. "hash": 113994571361944169038639830521104877975,
  20418. "size": 9,
  20419. "commit_id": "26896f01467a28651f7a536143fe5ac8449d4041",
  20420. "message": "net/nfc/rawsock.c: add CAP_NET_RAW check.\n\nWhen creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first.\n\nSigned-off-by: Qingyu Li <ieatmuttonchuan@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  20421. "target": 0,
  20422. "dataset": "other",
  20423. "idx": 319216
  20424. }
  20425. ]
  20426. },
  20427. {
  20428. "call_depth": 4,
  20429. "longest_call_chain": [
  20430. "_ff_layout_free_lseg",
  20431. "ff_layout_free_mirror_array",
  20432. "ff_layout_put_mirror",
  20433. "ff_layout_free_mirror"
  20434. ],
  20435. "group_size": 5,
  20436. "functions": [
  20437. {
  20438. "func": "static void ff_layout_free_mirror_array(struct nfs4_ff_layout_segment *fls)\n{\n\tu32 i;\n\n\tfor (i = 0; i < fls->mirror_array_cnt; i++)\n\t\tff_layout_put_mirror(fls->mirror_array[i]);\n}",
  20439. "project": "linux",
  20440. "hash": 202853652078142817100138280602868936903,
  20441. "size": 7,
  20442. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  20443. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  20444. "target": 0,
  20445. "dataset": "other",
  20446. "idx": 234393
  20447. },
  20448. {
  20449. "func": "ff_layout_free_layoutstats(struct nfs4_xdr_opaque_data *opaque)\n{\n\tstruct nfs4_ff_layout_mirror *mirror = opaque->data;\n\n\tff_layout_put_mirror(mirror);\n}",
  20450. "project": "linux",
  20451. "hash": 41022782296286178043257841028601189437,
  20452. "size": 6,
  20453. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  20454. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  20455. "target": 0,
  20456. "dataset": "other",
  20457. "idx": 234438
  20458. },
  20459. {
  20460. "func": "static void ff_layout_put_mirror(struct nfs4_ff_layout_mirror *mirror)\n{\n\tif (mirror != NULL && refcount_dec_and_test(&mirror->ref))\n\t\tff_layout_free_mirror(mirror);\n}",
  20461. "project": "linux",
  20462. "hash": 331231389817443296763726719989660248577,
  20463. "size": 5,
  20464. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  20465. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  20466. "target": 0,
  20467. "dataset": "other",
  20468. "idx": 234467
  20469. },
  20470. {
  20471. "func": "static void _ff_layout_free_lseg(struct nfs4_ff_layout_segment *fls)\n{\n\tif (fls) {\n\t\tff_layout_free_mirror_array(fls);\n\t\tkfree(fls);\n\t}\n}",
  20472. "project": "linux",
  20473. "hash": 286331158025702105393697719811112058889,
  20474. "size": 7,
  20475. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  20476. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  20477. "target": 0,
  20478. "dataset": "other",
  20479. "idx": 234454
  20480. },
  20481. {
  20482. "func": "static void ff_layout_free_mirror(struct nfs4_ff_layout_mirror *mirror)\n{\n\tconst struct cred\t*cred;\n\n\tff_layout_remove_mirror(mirror);\n\tkfree(mirror->fh_versions);\n\tcred = rcu_access_pointer(mirror->ro_cred);\n\tput_cred(cred);\n\tcred = rcu_access_pointer(mirror->rw_cred);\n\tput_cred(cred);\n\tnfs4_ff_layout_put_deviceid(mirror->mirror_ds);\n\tkfree(mirror);\n}",
  20483. "project": "linux",
  20484. "hash": 320275016961296103626526590820150554159,
  20485. "size": 13,
  20486. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  20487. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  20488. "target": 0,
  20489. "dataset": "other",
  20490. "idx": 234444
  20491. }
  20492. ]
  20493. },
  20494. {
  20495. "call_depth": 3,
  20496. "longest_call_chain": [
  20497. "huge_node",
  20498. "interleave_nid",
  20499. "interleave_nodes"
  20500. ],
  20501. "group_size": 9,
  20502. "functions": [
  20503. {
  20504. "func": "int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long addr)\n{\n\tstruct mempolicy *pol;\n\tstruct zoneref *z;\n\tint curnid = page_to_nid(page);\n\tunsigned long pgoff;\n\tint thiscpu = raw_smp_processor_id();\n\tint thisnid = cpu_to_node(thiscpu);\n\tint polnid = NUMA_NO_NODE;\n\tint ret = -1;\n\n\tpol = get_vma_policy(vma, addr);\n\tif (!(pol->flags & MPOL_F_MOF))\n\t\tgoto out;\n\n\tswitch (pol->mode) {\n\tcase MPOL_INTERLEAVE:\n\t\tpgoff = vma->vm_pgoff;\n\t\tpgoff += (addr - vma->vm_start) >> PAGE_SHIFT;\n\t\tpolnid = offset_il_node(pol, pgoff);\n\t\tbreak;\n\n\tcase MPOL_PREFERRED:\n\t\tif (pol->flags & MPOL_F_LOCAL)\n\t\t\tpolnid = numa_node_id();\n\t\telse\n\t\t\tpolnid = pol->v.preferred_node;\n\t\tbreak;\n\n\tcase MPOL_BIND:\n\n\t\t/*\n\t\t * allows binding to multiple nodes.\n\t\t * use current page if in policy nodemask,\n\t\t * else select nearest allowed node, if any.\n\t\t * If no allowed nodes, use current [!misplaced].\n\t\t */\n\t\tif (node_isset(curnid, pol->v.nodes))\n\t\t\tgoto out;\n\t\tz = first_zones_zonelist(\n\t\t\t\tnode_zonelist(numa_node_id(), GFP_HIGHUSER),\n\t\t\t\tgfp_zone(GFP_HIGHUSER),\n\t\t\t\t&pol->v.nodes);\n\t\tpolnid = zone_to_nid(z->zone);\n\t\tbreak;\n\n\tdefault:\n\t\tBUG();\n\t}\n\n\t/* Migrate the page towards the node whose CPU is referencing it */\n\tif (pol->flags & MPOL_F_MORON) {\n\t\tpolnid = thisnid;\n\n\t\tif (!should_numa_migrate_memory(current, page, curnid, thiscpu))\n\t\t\tgoto out;\n\t}\n\n\tif (curnid != polnid)\n\t\tret = polnid;\nout:\n\tmpol_cond_put(pol);\n\n\treturn ret;\n}",
  20505. "project": "linux",
  20506. "hash": 12619917744861324322722649927099847632,
  20507. "size": 65,
  20508. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  20509. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20510. "target": 0,
  20511. "dataset": "other",
  20512. "idx": 366722
  20513. },
  20514. {
  20515. "func": "vm_fault_t do_huge_pmd_numa_page(struct vm_fault *vmf, pmd_t pmd)\n{\n\tstruct vm_area_struct *vma = vmf->vma;\n\tstruct anon_vma *anon_vma = NULL;\n\tstruct page *page;\n\tunsigned long haddr = vmf->address & HPAGE_PMD_MASK;\n\tint page_nid = NUMA_NO_NODE, this_nid = numa_node_id();\n\tint target_nid, last_cpupid = -1;\n\tbool page_locked;\n\tbool migrated = false;\n\tbool was_writable;\n\tint flags = 0;\n\n\tvmf->ptl = pmd_lock(vma->vm_mm, vmf->pmd);\n\tif (unlikely(!pmd_same(pmd, *vmf->pmd)))\n\t\tgoto out_unlock;\n\n\t/*\n\t * If there are potential migrations, wait for completion and retry\n\t * without disrupting NUMA hinting information. Do not relock and\n\t * check_same as the page may no longer be mapped.\n\t */\n\tif (unlikely(pmd_trans_migrating(*vmf->pmd))) {\n\t\tpage = pmd_page(*vmf->pmd);\n\t\tif (!get_page_unless_zero(page))\n\t\t\tgoto out_unlock;\n\t\tspin_unlock(vmf->ptl);\n\t\tput_and_wait_on_page_locked(page);\n\t\tgoto out;\n\t}\n\n\tpage = pmd_page(pmd);\n\tBUG_ON(is_huge_zero_page(page));\n\tpage_nid = page_to_nid(page);\n\tlast_cpupid = page_cpupid_last(page);\n\tcount_vm_numa_event(NUMA_HINT_FAULTS);\n\tif (page_nid == this_nid) {\n\t\tcount_vm_numa_event(NUMA_HINT_FAULTS_LOCAL);\n\t\tflags |= TNF_FAULT_LOCAL;\n\t}\n\n\t/* See similar comment in do_numa_page for explanation */\n\tif (!pmd_savedwrite(pmd))\n\t\tflags |= TNF_NO_GROUP;\n\n\t/*\n\t * Acquire the page lock to serialise THP migrations but avoid dropping\n\t * page_table_lock if at all possible\n\t */\n\tpage_locked = trylock_page(page);\n\ttarget_nid = mpol_misplaced(page, vma, haddr);\n\tif (target_nid == NUMA_NO_NODE) {\n\t\t/* If the page was locked, there are no parallel migrations */\n\t\tif (page_locked)\n\t\t\tgoto clear_pmdnuma;\n\t}\n\n\t/* Migration could have started since the pmd_trans_migrating check */\n\tif (!page_locked) {\n\t\tpage_nid = NUMA_NO_NODE;\n\t\tif (!get_page_unless_zero(page))\n\t\t\tgoto out_unlock;\n\t\tspin_unlock(vmf->ptl);\n\t\tput_and_wait_on_page_locked(page);\n\t\tgoto out;\n\t}\n\n\t/*\n\t * Page is misplaced. Page lock serialises migrations. Acquire anon_vma\n\t * to serialises splits\n\t */\n\tget_page(page);\n\tspin_unlock(vmf->ptl);\n\tanon_vma = page_lock_anon_vma_read(page);\n\n\t/* Confirm the PMD did not change while page_table_lock was released */\n\tspin_lock(vmf->ptl);\n\tif (unlikely(!pmd_same(pmd, *vmf->pmd))) {\n\t\tunlock_page(page);\n\t\tput_page(page);\n\t\tpage_nid = NUMA_NO_NODE;\n\t\tgoto out_unlock;\n\t}\n\n\t/* Bail if we fail to protect against THP splits for any reason */\n\tif (unlikely(!anon_vma)) {\n\t\tput_page(page);\n\t\tpage_nid = NUMA_NO_NODE;\n\t\tgoto clear_pmdnuma;\n\t}\n\n\t/*\n\t * Since we took the NUMA fault, we must have observed the !accessible\n\t * bit. Make sure all other CPUs agree with that, to avoid them\n\t * modifying the page we're about to migrate.\n\t *\n\t * Must be done under PTL such that we'll observe the relevant\n\t * inc_tlb_flush_pending().\n\t *\n\t * We are not sure a pending tlb flush here is for a huge page\n\t * mapping or not. Hence use the tlb range variant\n\t */\n\tif (mm_tlb_flush_pending(vma->vm_mm)) {\n\t\tflush_tlb_range(vma, haddr, haddr + HPAGE_PMD_SIZE);\n\t\t/*\n\t\t * change_huge_pmd() released the pmd lock before\n\t\t * invalidating the secondary MMUs sharing the primary\n\t\t * MMU pagetables (with ->invalidate_range()). The\n\t\t * mmu_notifier_invalidate_range_end() (which\n\t\t * internally calls ->invalidate_range()) in\n\t\t * change_pmd_range() will run after us, so we can't\n\t\t * rely on it here and we need an explicit invalidate.\n\t\t */\n\t\tmmu_notifier_invalidate_range(vma->vm_mm, haddr,\n\t\t\t\t\t haddr + HPAGE_PMD_SIZE);\n\t}\n\n\t/*\n\t * Migrate the THP to the requested node, returns with page unlocked\n\t * and access rights restored.\n\t */\n\tspin_unlock(vmf->ptl);\n\n\tmigrated = migrate_misplaced_transhuge_page(vma->vm_mm, vma,\n\t\t\t\tvmf->pmd, pmd, vmf->address, page, target_nid);\n\tif (migrated) {\n\t\tflags |= TNF_MIGRATED;\n\t\tpage_nid = target_nid;\n\t} else\n\t\tflags |= TNF_MIGRATE_FAIL;\n\n\tgoto out;\nclear_pmdnuma:\n\tBUG_ON(!PageLocked(page));\n\twas_writable = pmd_savedwrite(pmd);\n\tpmd = pmd_modify(pmd, vma->vm_page_prot);\n\tpmd = pmd_mkyoung(pmd);\n\tif (was_writable)\n\t\tpmd = pmd_mkwrite(pmd);\n\tset_pmd_at(vma->vm_mm, haddr, vmf->pmd, pmd);\n\tupdate_mmu_cache_pmd(vma, vmf->address, vmf->pmd);\n\tunlock_page(page);\nout_unlock:\n\tspin_unlock(vmf->ptl);\n\nout:\n\tif (anon_vma)\n\t\tpage_unlock_anon_vma_read(anon_vma);\n\n\tif (page_nid != NUMA_NO_NODE)\n\t\ttask_numa_fault(last_cpupid, page_nid, HPAGE_PMD_NR,\n\t\t\t\tflags);\n\n\treturn 0;\n}",
  20516. "project": "linux",
  20517. "hash": 132203028383069923274811645271219124372,
  20518. "size": 155,
  20519. "commit_id": "c444eb564fb16645c172d550359cb3d75fe8a040",
  20520. "message": "mm: thp: make the THP mapcount atomic against __split_huge_pmd_locked()\n\nWrite protect anon page faults require an accurate mapcount to decide\nif to break the COW or not. This is implemented in the THP path with\nreuse_swap_page() ->\npage_trans_huge_map_swapcount()/page_trans_huge_mapcount().\n\nIf the COW triggers while the other processes sharing the page are\nunder a huge pmd split, to do an accurate reading, we must ensure the\nmapcount isn't computed while it's being transferred from the head\npage to the tail pages.\n\nreuse_swap_cache() already runs serialized by the page lock, so it's\nenough to add the page lock around __split_huge_pmd_locked too, in\norder to add the missing serialization.\n\nNote: the commit in \"Fixes\" is just to facilitate the backporting,\nbecause the code before such commit didn't try to do an accurate THP\nmapcount calculation and it instead used the page_count() to decide if\nto COW or not. Both the page_count and the pin_count are THP-wide\nrefcounts, so they're inaccurate if used in\nreuse_swap_page(). Reverting such commit (besides the unrelated fix to\nthe local anon_vma assignment) would have also opened the window for\nmemory corruption side effects to certain workloads as documented in\nsuch commit header.\n\nSigned-off-by: Andrea Arcangeli <aarcange@redhat.com>\nSuggested-by: Jann Horn <jannh@google.com>\nReported-by: Jann Horn <jannh@google.com>\nAcked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>\nFixes: 6d0a07edd17c (\"mm: thp: calculate the mapcount correctly for THP pages during WP faults\")\nCc: stable@vger.kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20521. "target": 0,
  20522. "dataset": "other",
  20523. "idx": 364133
  20524. },
  20525. {
  20526. "func": "static unsigned interleave_nodes(struct mempolicy *policy)\n{\n\tunsigned next;\n\tstruct task_struct *me = current;\n\n\tnext = next_node_in(me->il_prev, policy->v.nodes);\n\tif (next < MAX_NUMNODES)\n\t\tme->il_prev = next;\n\treturn next;\n}",
  20527. "project": "linux",
  20528. "hash": 149195202327445055361198298232043071262,
  20529. "size": 10,
  20530. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  20531. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20532. "target": 0,
  20533. "dataset": "other",
  20534. "idx": 366777
  20535. },
  20536. {
  20537. "func": "static int policy_node(gfp_t gfp, struct mempolicy *policy,\n\t\t\t\t\t\t\t\tint nd)\n{\n\tif (policy->mode == MPOL_PREFERRED && !(policy->flags & MPOL_F_LOCAL))\n\t\tnd = policy->v.preferred_node;\n\telse {\n\t\t/*\n\t\t * __GFP_THISNODE shouldn't even be used with the bind policy\n\t\t * because we might easily break the expectation to stay on the\n\t\t * requested node and not break the policy.\n\t\t */\n\t\tWARN_ON_ONCE(policy->mode == MPOL_BIND && (gfp & __GFP_THISNODE));\n\t}\n\n\treturn nd;\n}",
  20538. "project": "linux",
  20539. "hash": 108580191718506093481218838044673339684,
  20540. "size": 16,
  20541. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  20542. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20543. "target": 0,
  20544. "dataset": "other",
  20545. "idx": 366719
  20546. },
  20547. {
  20548. "func": "int huge_node(struct vm_area_struct *vma, unsigned long addr, gfp_t gfp_flags,\n\t\t\t\tstruct mempolicy **mpol, nodemask_t **nodemask)\n{\n\tint nid;\n\n\t*mpol = get_vma_policy(vma, addr);\n\t*nodemask = NULL;\t/* assume !MPOL_BIND */\n\n\tif (unlikely((*mpol)->mode == MPOL_INTERLEAVE)) {\n\t\tnid = interleave_nid(*mpol, vma, addr,\n\t\t\t\t\thuge_page_shift(hstate_vma(vma)));\n\t} else {\n\t\tnid = policy_node(gfp_flags, *mpol, numa_node_id());\n\t\tif ((*mpol)->mode == MPOL_BIND)\n\t\t\t*nodemask = &(*mpol)->v.nodes;\n\t}\n\treturn nid;\n}",
  20549. "project": "linux",
  20550. "hash": 312498223746569468978896545015823998416,
  20551. "size": 18,
  20552. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  20553. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20554. "target": 0,
  20555. "dataset": "other",
  20556. "idx": 366727
  20557. },
  20558. {
  20559. "func": "unsigned int mempolicy_slab_node(void)\n{\n\tstruct mempolicy *policy;\n\tint node = numa_mem_id();\n\n\tif (in_interrupt())\n\t\treturn node;\n\n\tpolicy = current->mempolicy;\n\tif (!policy || policy->flags & MPOL_F_LOCAL)\n\t\treturn node;\n\n\tswitch (policy->mode) {\n\tcase MPOL_PREFERRED:\n\t\t/*\n\t\t * handled MPOL_F_LOCAL above\n\t\t */\n\t\treturn policy->v.preferred_node;\n\n\tcase MPOL_INTERLEAVE:\n\t\treturn interleave_nodes(policy);\n\n\tcase MPOL_BIND: {\n\t\tstruct zoneref *z;\n\n\t\t/*\n\t\t * Follow bind policy behavior and start allocation at the\n\t\t * first node.\n\t\t */\n\t\tstruct zonelist *zonelist;\n\t\tenum zone_type highest_zoneidx = gfp_zone(GFP_KERNEL);\n\t\tzonelist = &NODE_DATA(node)->node_zonelists[ZONELIST_FALLBACK];\n\t\tz = first_zones_zonelist(zonelist, highest_zoneidx,\n\t\t\t\t\t\t\t&policy->v.nodes);\n\t\treturn z->zone ? zone_to_nid(z->zone) : node;\n\t}\n\n\tdefault:\n\t\tBUG();\n\t}\n}",
  20560. "project": "linux",
  20561. "hash": 80893426873703429771882183743761649303,
  20562. "size": 41,
  20563. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  20564. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20565. "target": 0,
  20566. "dataset": "other",
  20567. "idx": 366766
  20568. },
  20569. {
  20570. "func": "static unsigned offset_il_node(struct mempolicy *pol, unsigned long n)\n{\n\tunsigned nnodes = nodes_weight(pol->v.nodes);\n\tunsigned target;\n\tint i;\n\tint nid;\n\n\tif (!nnodes)\n\t\treturn numa_node_id();\n\ttarget = (unsigned int)n % nnodes;\n\tnid = first_node(pol->v.nodes);\n\tfor (i = 0; i < target; i++)\n\t\tnid = next_node(nid, pol->v.nodes);\n\treturn nid;\n}",
  20571. "project": "linux",
  20572. "hash": 100221722718028293196433189331722134041,
  20573. "size": 15,
  20574. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  20575. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20576. "target": 0,
  20577. "dataset": "other",
  20578. "idx": 366757
  20579. },
  20580. {
  20581. "func": "static inline unsigned interleave_nid(struct mempolicy *pol,\n\t\t struct vm_area_struct *vma, unsigned long addr, int shift)\n{\n\tif (vma) {\n\t\tunsigned long off;\n\n\t\t/*\n\t\t * for small pages, there is no difference between\n\t\t * shift and PAGE_SHIFT, so the bit-shift is safe.\n\t\t * for huge pages, since vm_pgoff is in units of small\n\t\t * pages, we need to shift off the always 0 bits to get\n\t\t * a useful offset.\n\t\t */\n\t\tBUG_ON(shift < PAGE_SHIFT);\n\t\toff = vma->vm_pgoff >> (shift - PAGE_SHIFT);\n\t\toff += (addr - vma->vm_start) >> shift;\n\t\treturn offset_il_node(pol, off);\n\t} else\n\t\treturn interleave_nodes(pol);\n}",
  20582. "project": "linux",
  20583. "hash": 170979787322273916187442747184986020715,
  20584. "size": 20,
  20585. "commit_id": "aa9f7d5172fac9bf1f09e678c35e287a40a7b7dd",
  20586. "message": "mm: mempolicy: require at least one nodeid for MPOL_PREFERRED\n\nUsing an empty (malformed) nodelist that is not caught during mount option\nparsing leads to a stack-out-of-bounds access.\n\nThe option string that was used was: \"mpol=prefer:,\". However,\nMPOL_PREFERRED requires a single node number, which is not being provided\nhere.\n\nAdd a check that 'nodes' is not empty after parsing for MPOL_PREFERRED's\nnodeid.\n\nFixes: 095f1fc4ebf3 (\"mempolicy: rework shmem mpol parsing and display\")\nReported-by: Entropy Moe <3ntr0py1337@gmail.com>\nReported-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nSigned-off-by: Randy Dunlap <rdunlap@infradead.org>\nSigned-off-by: Andrew Morton <akpm@linux-foundation.org>\nTested-by: syzbot+b055b1a6b2b958707a21@syzkaller.appspotmail.com\nCc: Lee Schermerhorn <lee.schermerhorn@hp.com>\nLink: http://lkml.kernel.org/r/89526377-7eb6-b662-e1d8-4430928abde9@infradead.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20587. "target": 0,
  20588. "dataset": "other",
  20589. "idx": 366795
  20590. },
  20591. {
  20592. "func": "static void *get_any_partial(struct kmem_cache *s, gfp_t flags,\n\t\tstruct kmem_cache_cpu *c)\n{\n#ifdef CONFIG_NUMA\n\tstruct zonelist *zonelist;\n\tstruct zoneref *z;\n\tstruct zone *zone;\n\tenum zone_type high_zoneidx = gfp_zone(flags);\n\tvoid *object;\n\tunsigned int cpuset_mems_cookie;\n\n\t/*\n\t * The defrag ratio allows a configuration of the tradeoffs between\n\t * inter node defragmentation and node local allocations. A lower\n\t * defrag_ratio increases the tendency to do local allocations\n\t * instead of attempting to obtain partial slabs from other nodes.\n\t *\n\t * If the defrag_ratio is set to 0 then kmalloc() always\n\t * returns node local objects. If the ratio is higher then kmalloc()\n\t * may return off node objects because partial slabs are obtained\n\t * from other nodes and filled up.\n\t *\n\t * If /sys/kernel/slab/xx/remote_node_defrag_ratio is set to 100\n\t * (which makes defrag_ratio = 1000) then every (well almost)\n\t * allocation will first attempt to defrag slab caches on other nodes.\n\t * This means scanning over all nodes to look for partial slabs which\n\t * may be expensive if we do it every time we are trying to find a slab\n\t * with available objects.\n\t */\n\tif (!s->remote_node_defrag_ratio ||\n\t\t\tget_cycles() % 1024 > s->remote_node_defrag_ratio)\n\t\treturn NULL;\n\n\tdo {\n\t\tcpuset_mems_cookie = read_mems_allowed_begin();\n\t\tzonelist = node_zonelist(mempolicy_slab_node(), flags);\n\t\tfor_each_zone_zonelist(zone, z, zonelist, high_zoneidx) {\n\t\t\tstruct kmem_cache_node *n;\n\n\t\t\tn = get_node(s, zone_to_nid(zone));\n\n\t\t\tif (n && cpuset_zone_allowed(zone, flags) &&\n\t\t\t\t\tn->nr_partial > s->min_partial) {\n\t\t\t\tobject = get_partial_node(s, n, c, flags);\n\t\t\t\tif (object) {\n\t\t\t\t\t/*\n\t\t\t\t\t * Don't check read_mems_allowed_retry()\n\t\t\t\t\t * here - if mems_allowed was updated in\n\t\t\t\t\t * parallel, that was a harmless race\n\t\t\t\t\t * between allocation and the cpuset\n\t\t\t\t\t * update\n\t\t\t\t\t */\n\t\t\t\t\treturn object;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t} while (read_mems_allowed_retry(cpuset_mems_cookie));\n#endif\t/* CONFIG_NUMA */\n\treturn NULL;\n}",
  20593. "project": "linux",
  20594. "hash": 179076462256864204335457287863320755598,
  20595. "size": 60,
  20596. "commit_id": "fd4d9c7d0c71866ec0c2825189ebd2ce35bd95b8",
  20597. "message": "mm: slub: add missing TID bump in kmem_cache_alloc_bulk()\n\nWhen kmem_cache_alloc_bulk() attempts to allocate N objects from a percpu\nfreelist of length M, and N > M > 0, it will first remove the M elements\nfrom the percpu freelist, then call ___slab_alloc() to allocate the next\nelement and repopulate the percpu freelist. ___slab_alloc() can re-enable\nIRQs via allocate_slab(), so the TID must be bumped before ___slab_alloc()\nto properly commit the freelist head change.\n\nFix it by unconditionally bumping c->tid when entering the slowpath.\n\nCc: stable@vger.kernel.org\nFixes: ebe909e0fdb3 (\"slub: improve bulk alloc strategy\")\nSigned-off-by: Jann Horn <jannh@google.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  20598. "target": 0,
  20599. "dataset": "other",
  20600. "idx": 280155
  20601. }
  20602. ]
  20603. },
  20604. {
  20605. "call_depth": 3,
  20606. "longest_call_chain": [
  20607. "str_ireplace",
  20608. "str_replace",
  20609. "str_duplicate"
  20610. ],
  20611. "group_size": 7,
  20612. "functions": [
  20613. {
  20614. "func": "Variant str_replace(const Variant& search, const Variant& replace,\n const String& subject, int64_t& count, bool caseSensitive) {\n count = 0;\n if (search.isArray()) {\n String ret = subject;\n int c = 0;\n\n Array searchArr = search.toArray();\n if (replace.isArray()) {\n Array replArr = replace.toArray();\n ArrayIter replIter(replArr);\n for (ArrayIter iter(searchArr); iter; ++iter) {\n if (replIter) {\n ret = string_replace(ret, iter.second().toString(),\n replIter.second().toString(),\n c, caseSensitive);\n ++replIter;\n } else {\n ret = string_replace(ret, iter.second().toString(),\n \"\", c, caseSensitive);\n }\n count +=c;\n }\n return ret;\n }\n\n String repl = replace.toString();\n for (ArrayIter iter(searchArr); iter; ++iter) {\n ret = string_replace(ret, iter.second().toString(), repl, c,\n caseSensitive);\n count += c;\n }\n return ret;\n }\n\n int icount;\n auto ret = string_replace(subject, search.toString(), replace.toString(),\n icount, caseSensitive);\n count = icount;\n return ret;\n}",
  20615. "project": "hhvm",
  20616. "hash": 216059312763947109888822410058019371036,
  20617. "size": 41,
  20618. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  20619. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  20620. "target": 0,
  20621. "dataset": "other",
  20622. "idx": 219077
  20623. },
  20624. {
  20625. "func": "Variant str_replace(const Variant& search, const Variant& replace,\n const Variant& subject, int64_t& count) {\n Variant ret;\n count = 0;\n if (LIKELY(search.isString() && replace.isString() && subject.isString())) {\n int icount;\n // Short-cut for the most common (and simplest) case\n ret = string_replace(subject.asCStrRef(), search.asCStrRef(),\n replace.asCStrRef(), icount, true);\n count = icount;\n } else {\n // search, replace, and subject can all be arrays. str_replace() reduces all\n // the valid combinations to multiple string_replace() calls.\n ret = str_replace(search, replace, subject, count, true);\n }\n return ret;\n}",
  20626. "project": "hhvm",
  20627. "hash": 285712075938378105538132047442290051685,
  20628. "size": 17,
  20629. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  20630. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  20631. "target": 0,
  20632. "dataset": "other",
  20633. "idx": 219311
  20634. },
  20635. {
  20636. "func": "Variant str_replace(const Variant& search, const Variant& replace,\n const Variant& subject, int64_t& count, bool caseSensitive) {\n count = 0;\n if (subject.isArray()) {\n Array arr = subject.toArray();\n Array ret = Array::CreateDArray();\n int64_t c;\n for (ArrayIter iter(arr); iter; ++iter) {\n if (iter.second().isArray() || iter.second().is(KindOfObject)) {\n ret.set(iter.first(), iter.second());\n continue;\n }\n\n auto const replaced = str_replace(\n search, replace, iter.second().toString(), c, caseSensitive\n ).toString();\n ret.set(iter.first(), replaced);\n count += c;\n }\n return ret;\n }\n return str_replace(search, replace, subject.toString(), count,\n caseSensitive);\n}",
  20637. "project": "hhvm",
  20638. "hash": 265315493050731396315299461931811480777,
  20639. "size": 24,
  20640. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  20641. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  20642. "target": 0,
  20643. "dataset": "other",
  20644. "idx": 219723
  20645. },
  20646. {
  20647. "func": "rb_str_resurrect(VALUE str)\n{\n return str_replace(str_alloc(rb_cString), str);\n}",
  20648. "project": "ruby",
  20649. "hash": 104299486604202026756054780286449281008,
  20650. "size": 4,
  20651. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20652. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20653. "target": 0,
  20654. "dataset": "other",
  20655. "idx": 336844
  20656. },
  20657. {
  20658. "func": "str_duplicate(VALUE klass, VALUE str)\n{\n VALUE dup = str_alloc(klass);\n str_replace(dup, str);\n return dup;\n}",
  20659. "project": "ruby",
  20660. "hash": 128535815632492018737622795984903275099,
  20661. "size": 6,
  20662. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20663. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20664. "target": 0,
  20665. "dataset": "other",
  20666. "idx": 336850
  20667. },
  20668. {
  20669. "func": "rb_str_dup(VALUE str)\n{\n return str_duplicate(rb_obj_class(str), str);\n}",
  20670. "project": "ruby",
  20671. "hash": 299235992125038409717920340519102088403,
  20672. "size": 4,
  20673. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20674. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20675. "target": 0,
  20676. "dataset": "other",
  20677. "idx": 336983
  20678. },
  20679. {
  20680. "func": "Variant str_ireplace(const Variant& search, const Variant& replace,\n const Variant& subject, int64_t& count) {\n Variant ret = str_replace(search, replace, subject, count, false);\n return ret;\n}",
  20681. "project": "hhvm",
  20682. "hash": 265287117474309509757073617779422346375,
  20683. "size": 5,
  20684. "commit_id": "08193b7f0cd3910256e00d599f0f3eb2519c44ca",
  20685. "message": "security fixes\n\nhttps://hhvm.com/blog/2021/02/25/security-update.html",
  20686. "target": 0,
  20687. "dataset": "other",
  20688. "idx": 219442
  20689. }
  20690. ]
  20691. },
  20692. {
  20693. "call_depth": 5,
  20694. "longest_call_chain": [
  20695. "rb_enc_set_index",
  20696. "str_enc_copy",
  20697. "rb_enc_cr_str_copy_for_substr",
  20698. "OBJ_INFECT",
  20699. "str_new3"
  20700. ],
  20701. "group_size": 21,
  20702. "functions": [
  20703. {
  20704. "func": "rb_sym_to_s(VALUE sym)\n{\n ID id = SYM2ID(sym);\n\n return str_new3(rb_cString, rb_id2str(id));\n}",
  20705. "project": "ruby",
  20706. "hash": 272569114656758638817880869778183999898,
  20707. "size": 6,
  20708. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20709. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20710. "target": 0,
  20711. "dataset": "other",
  20712. "idx": 337044
  20713. },
  20714. {
  20715. "func": "str_new_shared(VALUE klass, VALUE str)\n{\n return str_replace_shared(str_alloc(klass), str);\n}",
  20716. "project": "ruby",
  20717. "hash": 198276397197341217487306503827028187965,
  20718. "size": 4,
  20719. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20720. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20721. "target": 0,
  20722. "dataset": "other",
  20723. "idx": 336888
  20724. },
  20725. {
  20726. "func": "rb_enc_cr_str_exact_copy(VALUE dest, VALUE src)\n{\n str_enc_copy(dest, src);\n ENC_CODERANGE_SET(dest, ENC_CODERANGE(src));\n}",
  20727. "project": "ruby",
  20728. "hash": 230756521039512649974889463459358786946,
  20729. "size": 5,
  20730. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20731. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20732. "target": 0,
  20733. "dataset": "other",
  20734. "idx": 336927
  20735. },
  20736. {
  20737. "func": "rb_enc_cr_str_copy_for_substr(VALUE dest, VALUE src)\n{\n /* this function is designed for copying encoding and coderange\n * from src to new string \"dest\" which is made from the part of src.\n */\n str_enc_copy(dest, src);\n switch (ENC_CODERANGE(src)) {\n case ENC_CODERANGE_7BIT:\n\tENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);\n\tbreak;\n case ENC_CODERANGE_VALID:\n\tif (!rb_enc_asciicompat(STR_ENC_GET(src)) ||\n\t search_nonascii(RSTRING_PTR(dest), RSTRING_END(dest)))\n\t ENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID);\n\telse\n\t ENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);\n\tbreak;\n default:\n\tif (RSTRING_LEN(dest) == 0) {\n\t if (!rb_enc_asciicompat(STR_ENC_GET(src)))\n\t\tENC_CODERANGE_SET(dest, ENC_CODERANGE_VALID);\n\t else\n\t\tENC_CODERANGE_SET(dest, ENC_CODERANGE_7BIT);\n\t}\n\tbreak;\n }\n}",
  20738. "project": "ruby",
  20739. "hash": 104488782374456473641454431178270051154,
  20740. "size": 27,
  20741. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20742. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20743. "target": 0,
  20744. "dataset": "other",
  20745. "idx": 336984
  20746. },
  20747. {
  20748. "func": "rb_str_each_byte(VALUE str)\n{\n long i;\n\n RETURN_ENUMERATOR(str, 0, 0);\n for (i=0; i<RSTRING_LEN(str); i++) {\n\trb_yield(INT2FIX(RSTRING_PTR(str)[i] & 0xff));\n }\n return str;\n}",
  20749. "project": "ruby",
  20750. "hash": 335617782185342356793078754179787447866,
  20751. "size": 10,
  20752. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20753. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20754. "target": 0,
  20755. "dataset": "other",
  20756. "idx": 337028
  20757. },
  20758. {
  20759. "func": "rb_str_setbyte(VALUE str, VALUE index, VALUE value)\n{\n long pos = NUM2LONG(index);\n int byte = NUM2INT(value);\n\n rb_str_modify(str);\n\n if (pos < -RSTRING_LEN(str) || RSTRING_LEN(str) <= pos)\n rb_raise(rb_eIndexError, \"index %ld out of string\", pos);\n if (pos < 0)\n pos += RSTRING_LEN(str);\n\n RSTRING_PTR(str)[pos] = byte;\n\n return value;\n}",
  20760. "project": "ruby",
  20761. "hash": 136418538749039439714202829770272273633,
  20762. "size": 16,
  20763. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20764. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20765. "target": 0,
  20766. "dataset": "other",
  20767. "idx": 336892
  20768. },
  20769. {
  20770. "func": "rb_str_clear(VALUE str)\n{\n str_discard(str);\n STR_SET_EMBED(str);\n STR_SET_EMBED_LEN(str, 0);\n RSTRING_PTR(str)[0] = 0;\n if (rb_enc_asciicompat(STR_ENC_GET(str)))\n\tENC_CODERANGE_SET(str, ENC_CODERANGE_7BIT);\n else\n\tENC_CODERANGE_SET(str, ENC_CODERANGE_VALID);\n return str;\n}",
  20771. "project": "ruby",
  20772. "hash": 8057027112330741719885751841677109397,
  20773. "size": 12,
  20774. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20775. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20776. "target": 0,
  20777. "dataset": "other",
  20778. "idx": 336842
  20779. },
  20780. {
  20781. "func": "str_new4(VALUE klass, VALUE str)\n{\n VALUE str2;\n\n str2 = str_alloc(klass);\n STR_SET_NOEMBED(str2);\n RSTRING(str2)->as.heap.len = RSTRING_LEN(str);\n RSTRING(str2)->as.heap.ptr = RSTRING_PTR(str);\n if (STR_SHARED_P(str)) {\n\tVALUE shared = RSTRING(str)->as.heap.aux.shared;\n\tassert(OBJ_FROZEN(shared));\n\tFL_SET(str2, ELTS_SHARED);\n\tRSTRING(str2)->as.heap.aux.shared = shared;\n }\n else {\n\tFL_SET(str, ELTS_SHARED);\n\tRSTRING(str)->as.heap.aux.shared = str2;\n }\n rb_enc_cr_str_exact_copy(str2, str);\n OBJ_INFECT(str2, str);\n return str2;\n}",
  20782. "project": "ruby",
  20783. "hash": 96590205618352977329725748548250293392,
  20784. "size": 22,
  20785. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20786. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20787. "target": 0,
  20788. "dataset": "other",
  20789. "idx": 336965
  20790. },
  20791. {
  20792. "func": "rb_str_hash_m(VALUE str)\n{\n st_index_t hval = rb_str_hash(str);\n return INT2FIX(hval);\n}",
  20793. "project": "ruby",
  20794. "hash": 118425606038890645694626491439994384962,
  20795. "size": 5,
  20796. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20797. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20798. "target": 0,
  20799. "dataset": "other",
  20800. "idx": 336894
  20801. },
  20802. {
  20803. "func": "rb_str_ord(VALUE s)\n{\n unsigned int c;\n\n c = rb_enc_codepoint(RSTRING_PTR(s), RSTRING_END(s), STR_ENC_GET(s));\n return UINT2NUM(c);\n}",
  20804. "project": "ruby",
  20805. "hash": 41992758220581853168365485380010420868,
  20806. "size": 7,
  20807. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20808. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20809. "target": 0,
  20810. "dataset": "other",
  20811. "idx": 336963
  20812. },
  20813. {
  20814. "func": "rb_str_chop(VALUE str)\n{\n VALUE str2 = rb_str_new5(str, RSTRING_PTR(str), chopped_length(str));\n rb_enc_cr_str_copy_for_substr(str2, str);\n OBJ_INFECT(str2, str);\n return str2;\n}",
  20815. "project": "ruby",
  20816. "hash": 172373213666350823047478669813328230389,
  20817. "size": 7,
  20818. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20819. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20820. "target": 0,
  20821. "dataset": "other",
  20822. "idx": 337015
  20823. },
  20824. {
  20825. "func": "rb_enc_str_buf_cat(VALUE str, const char *ptr, long len, rb_encoding *ptr_enc)\n{\n return rb_enc_cr_str_buf_cat(str, ptr, len,\n rb_enc_to_index(ptr_enc), ENC_CODERANGE_UNKNOWN, NULL);\n}",
  20826. "project": "ruby",
  20827. "hash": 228357360117987925827936335936897605418,
  20828. "size": 5,
  20829. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20830. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20831. "target": 0,
  20832. "dataset": "other",
  20833. "idx": 336899
  20834. },
  20835. {
  20836. "func": "rb_str_buf_append(VALUE str, VALUE str2)\n{\n int str2_cr;\n\n str2_cr = ENC_CODERANGE(str2);\n\n rb_enc_cr_str_buf_cat(str, RSTRING_PTR(str2), RSTRING_LEN(str2),\n ENCODING_GET(str2), str2_cr, &str2_cr);\n\n OBJ_INFECT(str, str2);\n ENC_CODERANGE_SET(str2, str2_cr);\n\n return str;\n}",
  20837. "project": "ruby",
  20838. "hash": 239756740825869741701573697747997918934,
  20839. "size": 14,
  20840. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20841. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20842. "target": 0,
  20843. "dataset": "other",
  20844. "idx": 337033
  20845. },
  20846. {
  20847. "func": "str_new3(VALUE klass, VALUE str)\n{\n return str_new_shared(klass, str);\n}",
  20848. "project": "ruby",
  20849. "hash": 108105753539293234869995329039502318927,
  20850. "size": 4,
  20851. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20852. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20853. "target": 0,
  20854. "dataset": "other",
  20855. "idx": 336814
  20856. },
  20857. {
  20858. "func": "ip_cancel_eval_core(interp, msg, flag)\n Tcl_Interp *interp;\n VALUE msg;\n int flag;\n{\n#if TCL_MAJOR_VERSION < 8 || (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION < 6)\n rb_raise(rb_eNotImpError,\n\t \"cancel_eval is supported Tcl/Tk8.6 or later.\");\n\n UNREACHABLE;\n#else\n Tcl_Obj *msg_obj;\n\n if (NIL_P(msg)) {\n msg_obj = NULL;\n } else {\n msg_obj = Tcl_NewStringObj(RSTRING_PTR(msg), RSTRING_LEN(msg));\n Tcl_IncrRefCount(msg_obj);\n }\n\n return Tcl_CancelEval(interp, msg_obj, 0, flag);\n#endif\n}",
  20859. "project": "tk",
  20860. "hash": 36662980673448013518338214311261061157,
  20861. "size": 23,
  20862. "commit_id": "ebd0fc80d62eeb7b8556522256f8d035e013eb65",
  20863. "message": "tcltklib.c: check argument\n\n* ext/tk/tcltklib.c (ip_cancel_eval_core): check argument type and\n length.\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20864. "target": 1,
  20865. "dataset": "other",
  20866. "idx": 210324
  20867. },
  20868. {
  20869. "func": "rb_str_offset(VALUE str, long pos)\n{\n return str_offset(RSTRING_PTR(str), RSTRING_END(str), pos,\n\t\t STR_ENC_GET(str), single_byte_optimizable(str));\n}",
  20870. "project": "ruby",
  20871. "hash": 139178502107311951114891623827156237780,
  20872. "size": 5,
  20873. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20874. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20875. "target": 0,
  20876. "dataset": "other",
  20877. "idx": 336975
  20878. },
  20879. {
  20880. "func": "sym_inspect(VALUE sym)\n{\n VALUE str;\n ID id = SYM2ID(sym);\n rb_encoding *enc;\n\n sym = rb_id2str(id);\n enc = STR_ENC_GET(sym);\n str = rb_enc_str_new(0, RSTRING_LEN(sym)+1, enc);\n RSTRING_PTR(str)[0] = ':';\n memcpy(RSTRING_PTR(str)+1, RSTRING_PTR(sym), RSTRING_LEN(sym));\n if (RSTRING_LEN(sym) != (long)strlen(RSTRING_PTR(sym)) ||\n\t!rb_enc_symname_p(RSTRING_PTR(sym), enc) ||\n\t!sym_printable(RSTRING_PTR(sym), RSTRING_END(sym), enc)) {\n\tstr = rb_str_inspect(str);\n\tmemcpy(RSTRING_PTR(str), \":\\\"\", 2);\n }\n return str;\n}",
  20881. "project": "ruby",
  20882. "hash": 7499315132594944353728829066526401524,
  20883. "size": 19,
  20884. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20885. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20886. "target": 0,
  20887. "dataset": "other",
  20888. "idx": 336930
  20889. },
  20890. {
  20891. "func": "rb_string_value_ptr(volatile VALUE *ptr)\n{\n VALUE str = rb_string_value(ptr);\n return RSTRING_PTR(str);\n}",
  20892. "project": "ruby",
  20893. "hash": 129180089407572609699082295864646941554,
  20894. "size": 5,
  20895. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20896. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20897. "target": 0,
  20898. "dataset": "other",
  20899. "idx": 336982
  20900. },
  20901. {
  20902. "func": "str_enc_copy(VALUE str1, VALUE str2)\n{\n rb_enc_set_index(str1, ENCODING_GET(str2));\n}",
  20903. "project": "ruby",
  20904. "hash": 298677506776313331735413304751391592880,
  20905. "size": 4,
  20906. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20907. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20908. "target": 0,
  20909. "dataset": "other",
  20910. "idx": 336860
  20911. },
  20912. {
  20913. "func": "rb_str_set_len(VALUE str, long len)\n{\n STR_SET_LEN(str, len);\n RSTRING_PTR(str)[len] = '\\0';\n}",
  20914. "project": "ruby",
  20915. "hash": 304101420755704748714654969904389321414,
  20916. "size": 5,
  20917. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20918. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20919. "target": 0,
  20920. "dataset": "other",
  20921. "idx": 336956
  20922. },
  20923. {
  20924. "func": "rb_str_new_shared(VALUE str)\n{\n VALUE str2 = str_new3(rb_obj_class(str), str);\n\n OBJ_INFECT(str2, str);\n return str2;\n}",
  20925. "project": "ruby",
  20926. "hash": 229537409377826449241143952346016160796,
  20927. "size": 7,
  20928. "commit_id": "1c2ef610358af33f9ded3086aa2d70aac03dcac5",
  20929. "message": "* string.c (rb_str_justify): CVE-2009-4124.\n Fixes a bug reported by \n Emmanouel Kellinis <Emmanouel.Kellinis AT kpmg.co.uk>, KPMG London;\n Patch by nobu.\n\n\ngit-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26038 b2dd03c8-39d4-4d8f-98ff-823fe69b080e",
  20930. "target": 0,
  20931. "dataset": "other",
  20932. "idx": 336971
  20933. }
  20934. ]
  20935. },
  20936. {
  20937. "call_depth": 3,
  20938. "longest_call_chain": [
  20939. "printer_func_set_alt",
  20940. "set_interface",
  20941. "printer_reset_interface"
  20942. ],
  20943. "group_size": 4,
  20944. "functions": [
  20945. {
  20946. "func": "static void printer_func_disable(struct usb_function *f)\n{\n\tstruct printer_dev *dev = func_to_printer(f);\n\n\tDBG(dev, \"%s\\n\", __func__);\n\n\tprinter_reset_interface(dev);\n}",
  20947. "project": "linux",
  20948. "hash": 119911552292150677763724637834125068633,
  20949. "size": 8,
  20950. "commit_id": "e8d5f92b8d30bb4ade76494490c3c065e12411b1",
  20951. "message": "usb: gadget: function: printer: fix use-after-free in __lock_acquire\n\nFix this by increase object reference count.\n\nBUG: KASAN: use-after-free in __lock_acquire+0x3fd4/0x4180\nkernel/locking/lockdep.c:3831\nRead of size 8 at addr ffff8880683b0018 by task syz-executor.0/3377\n\nCPU: 1 PID: 3377 Comm: syz-executor.0 Not tainted 5.6.11 #1\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:77 [inline]\n dump_stack+0xce/0x128 lib/dump_stack.c:118\n print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374\n __kasan_report+0x131/0x1b0 mm/kasan/report.c:506\n kasan_report+0x12/0x20 mm/kasan/common.c:641\n __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135\n __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831\n lock_acquire+0x127/0x350 kernel/locking/lockdep.c:4488\n __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]\n _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159\n printer_ioctl+0x4a/0x110 drivers/usb/gadget/function/f_printer.c:723\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0xfb/0x130 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x4531a9\nCode: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48\n89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d\n01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007fd14ad72c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 00000000004531a9\nRDX: fffffffffffffff9 RSI: 000000000000009e RDI: 0000000000000003\nRBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000004bbd61\nR13: 00000000004d0a98 R14: 00007fd14ad736d4 R15: 00000000ffffffff\n\nAllocated by task 2393:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n __kasan_kmalloc.constprop.3+0xa7/0xd0 mm/kasan/common.c:515\n kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529\n kmem_cache_alloc_trace+0xfa/0x2d0 mm/slub.c:2813\n kmalloc include/linux/slab.h:555 [inline]\n kzalloc include/linux/slab.h:669 [inline]\n gprinter_alloc+0xa1/0x870 drivers/usb/gadget/function/f_printer.c:1416\n usb_get_function+0x58/0xc0 drivers/usb/gadget/functions.c:61\n config_usb_cfg_link+0x1ed/0x3e0 drivers/usb/gadget/configfs.c:444\n configfs_symlink+0x527/0x11d0 fs/configfs/symlink.c:202\n vfs_symlink+0x33d/0x5b0 fs/namei.c:4201\n do_symlinkat+0x11b/0x1d0 fs/namei.c:4228\n __do_sys_symlinkat fs/namei.c:4242 [inline]\n __se_sys_symlinkat fs/namei.c:4239 [inline]\n __x64_sys_symlinkat+0x73/0xb0 fs/namei.c:4239\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nFreed by task 3368:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n kasan_set_free_info mm/kasan/common.c:337 [inline]\n __kasan_slab_free+0x135/0x190 mm/kasan/common.c:476\n kasan_slab_free+0xe/0x10 mm/kasan/common.c:485\n slab_free_hook mm/slub.c:1444 [inline]\n slab_free_freelist_hook mm/slub.c:1477 [inline]\n slab_free mm/slub.c:3034 [inline]\n kfree+0xf7/0x410 mm/slub.c:3995\n gprinter_free+0x49/0xd0 drivers/usb/gadget/function/f_printer.c:1353\n usb_put_function+0x38/0x50 drivers/usb/gadget/functions.c:87\n config_usb_cfg_unlink+0x2db/0x3b0 drivers/usb/gadget/configfs.c:485\n configfs_unlink+0x3b9/0x7f0 fs/configfs/symlink.c:250\n vfs_unlink+0x287/0x570 fs/namei.c:4073\n do_unlinkat+0x4f9/0x620 fs/namei.c:4137\n __do_sys_unlink fs/namei.c:4184 [inline]\n __se_sys_unlink fs/namei.c:4182 [inline]\n __x64_sys_unlink+0x42/0x50 fs/namei.c:4182\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nThe buggy address belongs to the object at ffff8880683b0000\n which belongs to the cache kmalloc-1k of size 1024\nThe buggy address is located 24 bytes inside of\n 1024-byte region [ffff8880683b0000, ffff8880683b0400)\nThe buggy address belongs to the page:\npage:ffffea0001a0ec00 refcount:1 mapcount:0 mapping:ffff88806c00e300\nindex:0xffff8880683b1800 compound_mapcount: 0\nflags: 0x100000000010200(slab|head)\nraw: 0100000000010200 0000000000000000 0000000600000001 ffff88806c00e300\nraw: ffff8880683b1800 000000008010000a 00000001ffffffff 0000000000000000\npage dumped because: kasan: bad access detected\n\nReported-by: Kyungtae Kim <kt0755@gmail.com>\nSigned-off-by: Zqiang <qiang.zhang@windriver.com>\nSigned-off-by: Felipe Balbi <balbi@kernel.org>",
  20952. "target": 0,
  20953. "dataset": "other",
  20954. "idx": 389330
  20955. },
  20956. {
  20957. "func": "static int printer_func_set_alt(struct usb_function *f,\n\t\tunsigned intf, unsigned alt)\n{\n\tstruct printer_dev *dev = func_to_printer(f);\n\tint ret = -ENOTSUPP;\n\n\tif (!alt)\n\t\tret = set_interface(dev, intf);\n\n\treturn ret;\n}",
  20958. "project": "linux",
  20959. "hash": 272503163987710925329285689219930374758,
  20960. "size": 11,
  20961. "commit_id": "e8d5f92b8d30bb4ade76494490c3c065e12411b1",
  20962. "message": "usb: gadget: function: printer: fix use-after-free in __lock_acquire\n\nFix this by increase object reference count.\n\nBUG: KASAN: use-after-free in __lock_acquire+0x3fd4/0x4180\nkernel/locking/lockdep.c:3831\nRead of size 8 at addr ffff8880683b0018 by task syz-executor.0/3377\n\nCPU: 1 PID: 3377 Comm: syz-executor.0 Not tainted 5.6.11 #1\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:77 [inline]\n dump_stack+0xce/0x128 lib/dump_stack.c:118\n print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374\n __kasan_report+0x131/0x1b0 mm/kasan/report.c:506\n kasan_report+0x12/0x20 mm/kasan/common.c:641\n __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135\n __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831\n lock_acquire+0x127/0x350 kernel/locking/lockdep.c:4488\n __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]\n _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159\n printer_ioctl+0x4a/0x110 drivers/usb/gadget/function/f_printer.c:723\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0xfb/0x130 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x4531a9\nCode: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48\n89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d\n01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007fd14ad72c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 00000000004531a9\nRDX: fffffffffffffff9 RSI: 000000000000009e RDI: 0000000000000003\nRBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000004bbd61\nR13: 00000000004d0a98 R14: 00007fd14ad736d4 R15: 00000000ffffffff\n\nAllocated by task 2393:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n __kasan_kmalloc.constprop.3+0xa7/0xd0 mm/kasan/common.c:515\n kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529\n kmem_cache_alloc_trace+0xfa/0x2d0 mm/slub.c:2813\n kmalloc include/linux/slab.h:555 [inline]\n kzalloc include/linux/slab.h:669 [inline]\n gprinter_alloc+0xa1/0x870 drivers/usb/gadget/function/f_printer.c:1416\n usb_get_function+0x58/0xc0 drivers/usb/gadget/functions.c:61\n config_usb_cfg_link+0x1ed/0x3e0 drivers/usb/gadget/configfs.c:444\n configfs_symlink+0x527/0x11d0 fs/configfs/symlink.c:202\n vfs_symlink+0x33d/0x5b0 fs/namei.c:4201\n do_symlinkat+0x11b/0x1d0 fs/namei.c:4228\n __do_sys_symlinkat fs/namei.c:4242 [inline]\n __se_sys_symlinkat fs/namei.c:4239 [inline]\n __x64_sys_symlinkat+0x73/0xb0 fs/namei.c:4239\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nFreed by task 3368:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n kasan_set_free_info mm/kasan/common.c:337 [inline]\n __kasan_slab_free+0x135/0x190 mm/kasan/common.c:476\n kasan_slab_free+0xe/0x10 mm/kasan/common.c:485\n slab_free_hook mm/slub.c:1444 [inline]\n slab_free_freelist_hook mm/slub.c:1477 [inline]\n slab_free mm/slub.c:3034 [inline]\n kfree+0xf7/0x410 mm/slub.c:3995\n gprinter_free+0x49/0xd0 drivers/usb/gadget/function/f_printer.c:1353\n usb_put_function+0x38/0x50 drivers/usb/gadget/functions.c:87\n config_usb_cfg_unlink+0x2db/0x3b0 drivers/usb/gadget/configfs.c:485\n configfs_unlink+0x3b9/0x7f0 fs/configfs/symlink.c:250\n vfs_unlink+0x287/0x570 fs/namei.c:4073\n do_unlinkat+0x4f9/0x620 fs/namei.c:4137\n __do_sys_unlink fs/namei.c:4184 [inline]\n __se_sys_unlink fs/namei.c:4182 [inline]\n __x64_sys_unlink+0x42/0x50 fs/namei.c:4182\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nThe buggy address belongs to the object at ffff8880683b0000\n which belongs to the cache kmalloc-1k of size 1024\nThe buggy address is located 24 bytes inside of\n 1024-byte region [ffff8880683b0000, ffff8880683b0400)\nThe buggy address belongs to the page:\npage:ffffea0001a0ec00 refcount:1 mapcount:0 mapping:ffff88806c00e300\nindex:0xffff8880683b1800 compound_mapcount: 0\nflags: 0x100000000010200(slab|head)\nraw: 0100000000010200 0000000000000000 0000000600000001 ffff88806c00e300\nraw: ffff8880683b1800 000000008010000a 00000001ffffffff 0000000000000000\npage dumped because: kasan: bad access detected\n\nReported-by: Kyungtae Kim <kt0755@gmail.com>\nSigned-off-by: Zqiang <qiang.zhang@windriver.com>\nSigned-off-by: Felipe Balbi <balbi@kernel.org>",
  20963. "target": 0,
  20964. "dataset": "other",
  20965. "idx": 389359
  20966. },
  20967. {
  20968. "func": "static void printer_reset_interface(struct printer_dev *dev)\n{\n\tunsigned long\tflags;\n\n\tif (dev->interface < 0)\n\t\treturn;\n\n\tDBG(dev, \"%s\\n\", __func__);\n\n\tif (dev->in_ep->desc)\n\t\tusb_ep_disable(dev->in_ep);\n\n\tif (dev->out_ep->desc)\n\t\tusb_ep_disable(dev->out_ep);\n\n\tspin_lock_irqsave(&dev->lock, flags);\n\tdev->in_ep->desc = NULL;\n\tdev->out_ep->desc = NULL;\n\tdev->interface = -1;\n\tspin_unlock_irqrestore(&dev->lock, flags);\n}",
  20969. "project": "linux",
  20970. "hash": 161249777138159104099192353156344389747,
  20971. "size": 21,
  20972. "commit_id": "e8d5f92b8d30bb4ade76494490c3c065e12411b1",
  20973. "message": "usb: gadget: function: printer: fix use-after-free in __lock_acquire\n\nFix this by increase object reference count.\n\nBUG: KASAN: use-after-free in __lock_acquire+0x3fd4/0x4180\nkernel/locking/lockdep.c:3831\nRead of size 8 at addr ffff8880683b0018 by task syz-executor.0/3377\n\nCPU: 1 PID: 3377 Comm: syz-executor.0 Not tainted 5.6.11 #1\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:77 [inline]\n dump_stack+0xce/0x128 lib/dump_stack.c:118\n print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374\n __kasan_report+0x131/0x1b0 mm/kasan/report.c:506\n kasan_report+0x12/0x20 mm/kasan/common.c:641\n __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135\n __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831\n lock_acquire+0x127/0x350 kernel/locking/lockdep.c:4488\n __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]\n _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159\n printer_ioctl+0x4a/0x110 drivers/usb/gadget/function/f_printer.c:723\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0xfb/0x130 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x4531a9\nCode: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48\n89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d\n01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007fd14ad72c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 00000000004531a9\nRDX: fffffffffffffff9 RSI: 000000000000009e RDI: 0000000000000003\nRBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000004bbd61\nR13: 00000000004d0a98 R14: 00007fd14ad736d4 R15: 00000000ffffffff\n\nAllocated by task 2393:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n __kasan_kmalloc.constprop.3+0xa7/0xd0 mm/kasan/common.c:515\n kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529\n kmem_cache_alloc_trace+0xfa/0x2d0 mm/slub.c:2813\n kmalloc include/linux/slab.h:555 [inline]\n kzalloc include/linux/slab.h:669 [inline]\n gprinter_alloc+0xa1/0x870 drivers/usb/gadget/function/f_printer.c:1416\n usb_get_function+0x58/0xc0 drivers/usb/gadget/functions.c:61\n config_usb_cfg_link+0x1ed/0x3e0 drivers/usb/gadget/configfs.c:444\n configfs_symlink+0x527/0x11d0 fs/configfs/symlink.c:202\n vfs_symlink+0x33d/0x5b0 fs/namei.c:4201\n do_symlinkat+0x11b/0x1d0 fs/namei.c:4228\n __do_sys_symlinkat fs/namei.c:4242 [inline]\n __se_sys_symlinkat fs/namei.c:4239 [inline]\n __x64_sys_symlinkat+0x73/0xb0 fs/namei.c:4239\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nFreed by task 3368:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n kasan_set_free_info mm/kasan/common.c:337 [inline]\n __kasan_slab_free+0x135/0x190 mm/kasan/common.c:476\n kasan_slab_free+0xe/0x10 mm/kasan/common.c:485\n slab_free_hook mm/slub.c:1444 [inline]\n slab_free_freelist_hook mm/slub.c:1477 [inline]\n slab_free mm/slub.c:3034 [inline]\n kfree+0xf7/0x410 mm/slub.c:3995\n gprinter_free+0x49/0xd0 drivers/usb/gadget/function/f_printer.c:1353\n usb_put_function+0x38/0x50 drivers/usb/gadget/functions.c:87\n config_usb_cfg_unlink+0x2db/0x3b0 drivers/usb/gadget/configfs.c:485\n configfs_unlink+0x3b9/0x7f0 fs/configfs/symlink.c:250\n vfs_unlink+0x287/0x570 fs/namei.c:4073\n do_unlinkat+0x4f9/0x620 fs/namei.c:4137\n __do_sys_unlink fs/namei.c:4184 [inline]\n __se_sys_unlink fs/namei.c:4182 [inline]\n __x64_sys_unlink+0x42/0x50 fs/namei.c:4182\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nThe buggy address belongs to the object at ffff8880683b0000\n which belongs to the cache kmalloc-1k of size 1024\nThe buggy address is located 24 bytes inside of\n 1024-byte region [ffff8880683b0000, ffff8880683b0400)\nThe buggy address belongs to the page:\npage:ffffea0001a0ec00 refcount:1 mapcount:0 mapping:ffff88806c00e300\nindex:0xffff8880683b1800 compound_mapcount: 0\nflags: 0x100000000010200(slab|head)\nraw: 0100000000010200 0000000000000000 0000000600000001 ffff88806c00e300\nraw: ffff8880683b1800 000000008010000a 00000001ffffffff 0000000000000000\npage dumped because: kasan: bad access detected\n\nReported-by: Kyungtae Kim <kt0755@gmail.com>\nSigned-off-by: Zqiang <qiang.zhang@windriver.com>\nSigned-off-by: Felipe Balbi <balbi@kernel.org>",
  20974. "target": 0,
  20975. "dataset": "other",
  20976. "idx": 389335
  20977. },
  20978. {
  20979. "func": "static int set_interface(struct printer_dev *dev, unsigned number)\n{\n\tint\t\t\tresult = 0;\n\n\t/* Free the current interface */\n\tprinter_reset_interface(dev);\n\n\tresult = set_printer_interface(dev);\n\tif (result)\n\t\tprinter_reset_interface(dev);\n\telse\n\t\tdev->interface = number;\n\n\tif (!result)\n\t\tINFO(dev, \"Using interface %x\\n\", number);\n\n\treturn result;\n}",
  20980. "project": "linux",
  20981. "hash": 288191072707913825275035251745840966467,
  20982. "size": 18,
  20983. "commit_id": "e8d5f92b8d30bb4ade76494490c3c065e12411b1",
  20984. "message": "usb: gadget: function: printer: fix use-after-free in __lock_acquire\n\nFix this by increase object reference count.\n\nBUG: KASAN: use-after-free in __lock_acquire+0x3fd4/0x4180\nkernel/locking/lockdep.c:3831\nRead of size 8 at addr ffff8880683b0018 by task syz-executor.0/3377\n\nCPU: 1 PID: 3377 Comm: syz-executor.0 Not tainted 5.6.11 #1\nHardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:77 [inline]\n dump_stack+0xce/0x128 lib/dump_stack.c:118\n print_address_description.constprop.4+0x21/0x3c0 mm/kasan/report.c:374\n __kasan_report+0x131/0x1b0 mm/kasan/report.c:506\n kasan_report+0x12/0x20 mm/kasan/common.c:641\n __asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:135\n __lock_acquire+0x3fd4/0x4180 kernel/locking/lockdep.c:3831\n lock_acquire+0x127/0x350 kernel/locking/lockdep.c:4488\n __raw_spin_lock_irqsave include/linux/spinlock_api_smp.h:110 [inline]\n _raw_spin_lock_irqsave+0x35/0x50 kernel/locking/spinlock.c:159\n printer_ioctl+0x4a/0x110 drivers/usb/gadget/function/f_printer.c:723\n vfs_ioctl fs/ioctl.c:47 [inline]\n ksys_ioctl+0xfb/0x130 fs/ioctl.c:763\n __do_sys_ioctl fs/ioctl.c:772 [inline]\n __se_sys_ioctl fs/ioctl.c:770 [inline]\n __x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\nRIP: 0033:0x4531a9\nCode: ed 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48\n89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d\n01 f0 ff ff 0f 83 bb 60 fc ff c3 66 2e 0f 1f 84 00 00 00 00\nRSP: 002b:00007fd14ad72c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010\nRAX: ffffffffffffffda RBX: 000000000073bfa8 RCX: 00000000004531a9\nRDX: fffffffffffffff9 RSI: 000000000000009e RDI: 0000000000000003\nRBP: 0000000000000003 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000246 R12: 00000000004bbd61\nR13: 00000000004d0a98 R14: 00007fd14ad736d4 R15: 00000000ffffffff\n\nAllocated by task 2393:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n __kasan_kmalloc.constprop.3+0xa7/0xd0 mm/kasan/common.c:515\n kasan_kmalloc+0x9/0x10 mm/kasan/common.c:529\n kmem_cache_alloc_trace+0xfa/0x2d0 mm/slub.c:2813\n kmalloc include/linux/slab.h:555 [inline]\n kzalloc include/linux/slab.h:669 [inline]\n gprinter_alloc+0xa1/0x870 drivers/usb/gadget/function/f_printer.c:1416\n usb_get_function+0x58/0xc0 drivers/usb/gadget/functions.c:61\n config_usb_cfg_link+0x1ed/0x3e0 drivers/usb/gadget/configfs.c:444\n configfs_symlink+0x527/0x11d0 fs/configfs/symlink.c:202\n vfs_symlink+0x33d/0x5b0 fs/namei.c:4201\n do_symlinkat+0x11b/0x1d0 fs/namei.c:4228\n __do_sys_symlinkat fs/namei.c:4242 [inline]\n __se_sys_symlinkat fs/namei.c:4239 [inline]\n __x64_sys_symlinkat+0x73/0xb0 fs/namei.c:4239\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nFreed by task 3368:\n save_stack+0x21/0x90 mm/kasan/common.c:72\n set_track mm/kasan/common.c:80 [inline]\n kasan_set_free_info mm/kasan/common.c:337 [inline]\n __kasan_slab_free+0x135/0x190 mm/kasan/common.c:476\n kasan_slab_free+0xe/0x10 mm/kasan/common.c:485\n slab_free_hook mm/slub.c:1444 [inline]\n slab_free_freelist_hook mm/slub.c:1477 [inline]\n slab_free mm/slub.c:3034 [inline]\n kfree+0xf7/0x410 mm/slub.c:3995\n gprinter_free+0x49/0xd0 drivers/usb/gadget/function/f_printer.c:1353\n usb_put_function+0x38/0x50 drivers/usb/gadget/functions.c:87\n config_usb_cfg_unlink+0x2db/0x3b0 drivers/usb/gadget/configfs.c:485\n configfs_unlink+0x3b9/0x7f0 fs/configfs/symlink.c:250\n vfs_unlink+0x287/0x570 fs/namei.c:4073\n do_unlinkat+0x4f9/0x620 fs/namei.c:4137\n __do_sys_unlink fs/namei.c:4184 [inline]\n __se_sys_unlink fs/namei.c:4182 [inline]\n __x64_sys_unlink+0x42/0x50 fs/namei.c:4182\n do_syscall_64+0x9e/0x510 arch/x86/entry/common.c:294\n entry_SYSCALL_64_after_hwframe+0x49/0xbe\n\nThe buggy address belongs to the object at ffff8880683b0000\n which belongs to the cache kmalloc-1k of size 1024\nThe buggy address is located 24 bytes inside of\n 1024-byte region [ffff8880683b0000, ffff8880683b0400)\nThe buggy address belongs to the page:\npage:ffffea0001a0ec00 refcount:1 mapcount:0 mapping:ffff88806c00e300\nindex:0xffff8880683b1800 compound_mapcount: 0\nflags: 0x100000000010200(slab|head)\nraw: 0100000000010200 0000000000000000 0000000600000001 ffff88806c00e300\nraw: ffff8880683b1800 000000008010000a 00000001ffffffff 0000000000000000\npage dumped because: kasan: bad access detected\n\nReported-by: Kyungtae Kim <kt0755@gmail.com>\nSigned-off-by: Zqiang <qiang.zhang@windriver.com>\nSigned-off-by: Felipe Balbi <balbi@kernel.org>",
  20985. "target": 0,
  20986. "dataset": "other",
  20987. "idx": 389355
  20988. }
  20989. ]
  20990. },
  20991. {
  20992. "call_depth": 3,
  20993. "longest_call_chain": [
  20994. "REGISTER_INI_ENTRIES",
  20995. "PHP_MINIT_FUNCTION",
  20996. "php_libxml_initialize"
  20997. ],
  20998. "group_size": 4,
  20999. "functions": [
  21000. {
  21001. "func": "static php_iconv_err_t php_iconv_stream_filter_register_factory(void)\n{\n\tstatic php_stream_filter_factory filter_factory = {\n\t\tphp_iconv_stream_filter_factory_create\n\t};\n\n\tif (FAILURE == php_stream_filter_register_factory(\n\t\t\t\tphp_iconv_stream_filter_ops.label,\n\t\t\t\t&filter_factory)) {\n\t\treturn PHP_ICONV_ERR_UNKNOWN;\n\t}\n\treturn PHP_ICONV_ERR_SUCCESS;\n}",
  21002. "project": "php-src",
  21003. "hash": 62326953807896979841263466370935259391,
  21004. "size": 13,
  21005. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  21006. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  21007. "target": 0,
  21008. "dataset": "other",
  21009. "idx": 382782
  21010. },
  21011. {
  21012. "func": "PHP_LIBXML_API void php_libxml_initialize(void)\n{\n\tif (!_php_libxml_initialized) {\n\t\t/* we should be the only one's to ever init!! */\n\t\txmlInitParser();\n\n\t\tzend_hash_init(&php_libxml_exports, 0, NULL, NULL, 1);\n\n\t\t_php_libxml_initialized = 1;\n\t}\n}",
  21013. "project": "php-src",
  21014. "hash": 307088112107635459923645685382830785694,
  21015. "size": 11,
  21016. "commit_id": "8e76d0404b7f664ee6719fd98f0483f0ac4669d6",
  21017. "message": "Fixed external entity loading",
  21018. "target": 0,
  21019. "dataset": "other",
  21020. "idx": 484434
  21021. },
  21022. {
  21023. "func": "static PHP_MINIT_FUNCTION(libxml)\n{\n\tzend_class_entry ce;\n\n\tphp_libxml_initialize();\n\n\tREGISTER_LONG_CONSTANT(\"LIBXML_VERSION\",\t\t\tLIBXML_VERSION,\t\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_STRING_CONSTANT(\"LIBXML_DOTTED_VERSION\",\tLIBXML_DOTTED_VERSION,\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_STRING_CONSTANT(\"LIBXML_LOADED_VERSION\",\t(char *)xmlParserVersion,\t\tCONST_CS | CONST_PERSISTENT);\n\n\t/* For use with loading xml */\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NOENT\",\t\tXML_PARSE_NOENT,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_DTDLOAD\",\tXML_PARSE_DTDLOAD,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_DTDATTR\",\tXML_PARSE_DTDATTR,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_DTDVALID\",\tXML_PARSE_DTDVALID,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NOERROR\",\tXML_PARSE_NOERROR,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NOWARNING\",\tXML_PARSE_NOWARNING,\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NOBLANKS\",\tXML_PARSE_NOBLANKS,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_XINCLUDE\",\tXML_PARSE_XINCLUDE,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NSCLEAN\",\tXML_PARSE_NSCLEAN,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NOCDATA\",\tXML_PARSE_NOCDATA,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NONET\",\t\tXML_PARSE_NONET,\t\tCONST_CS | CONST_PERSISTENT);\n#if LIBXML_VERSION >= 20621\n\tREGISTER_LONG_CONSTANT(\"LIBXML_COMPACT\",\tXML_PARSE_COMPACT,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NOXMLDECL\",\tXML_SAVE_NO_DECL,\t\tCONST_CS | CONST_PERSISTENT);\n#endif\n#if LIBXML_VERSION >= 20703\n\tREGISTER_LONG_CONSTANT(\"LIBXML_PARSEHUGE\",\tXML_PARSE_HUGE,\t\t\tCONST_CS | CONST_PERSISTENT);\n#endif\n\tREGISTER_LONG_CONSTANT(\"LIBXML_NOEMPTYTAG\",\tLIBXML_SAVE_NOEMPTYTAG,\tCONST_CS | CONST_PERSISTENT);\n\n\t/* Error levels */\n\tREGISTER_LONG_CONSTANT(\"LIBXML_ERR_NONE\",\t\tXML_ERR_NONE,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_ERR_WARNING\",\tXML_ERR_WARNING,\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_ERR_ERROR\",\t\tXML_ERR_ERROR,\t\tCONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"LIBXML_ERR_FATAL\",\t\tXML_ERR_FATAL,\t\tCONST_CS | CONST_PERSISTENT);\n\n\tINIT_CLASS_ENTRY(ce, \"LibXMLError\", NULL);\n\tlibxmlerror_class_entry = zend_register_internal_class(&ce TSRMLS_CC);\n\n\treturn SUCCESS;\n}",
  21024. "project": "php-src",
  21025. "hash": 138852125139179414337567947426772980036,
  21026. "size": 42,
  21027. "commit_id": "8e76d0404b7f664ee6719fd98f0483f0ac4669d6",
  21028. "message": "Fixed external entity loading",
  21029. "target": 0,
  21030. "dataset": "other",
  21031. "idx": 484438
  21032. },
  21033. {
  21034. "func": "PHP_MINIT_FUNCTION(miconv)\n{\n\tchar *version = \"unknown\";\n\n\tREGISTER_INI_ENTRIES();\n\n#if HAVE_LIBICONV\n\t{\n\t\tstatic char buf[16];\n\t\tsnprintf(buf, sizeof(buf), \"%d.%d\",\n\t\t ((_libiconv_version >> 8) & 0x0f), (_libiconv_version & 0x0f));\n\t\tversion = buf;\n\t}\n#elif HAVE_GLIBC_ICONV\n\tversion = (char *)gnu_get_libc_version();\n#elif defined(NETWARE)\n\tversion = \"OS built-in\";\n#endif\n\n#ifdef PHP_ICONV_IMPL\n\tREGISTER_STRING_CONSTANT(\"ICONV_IMPL\", PHP_ICONV_IMPL, CONST_CS | CONST_PERSISTENT);\n#elif HAVE_LIBICONV\n\tREGISTER_STRING_CONSTANT(\"ICONV_IMPL\", \"libiconv\", CONST_CS | CONST_PERSISTENT);\n#elif defined(NETWARE)\n\tREGISTER_STRING_CONSTANT(\"ICONV_IMPL\", \"Novell\", CONST_CS | CONST_PERSISTENT);\n#else\n\tREGISTER_STRING_CONSTANT(\"ICONV_IMPL\", \"unknown\", CONST_CS | CONST_PERSISTENT);\n#endif\n\tREGISTER_STRING_CONSTANT(\"ICONV_VERSION\", version, CONST_CS | CONST_PERSISTENT);\n\n\tREGISTER_LONG_CONSTANT(\"ICONV_MIME_DECODE_STRICT\", PHP_ICONV_MIME_DECODE_STRICT, CONST_CS | CONST_PERSISTENT);\n\tREGISTER_LONG_CONSTANT(\"ICONV_MIME_DECODE_CONTINUE_ON_ERROR\", PHP_ICONV_MIME_DECODE_CONTINUE_ON_ERROR, CONST_CS | CONST_PERSISTENT);\n\n\tif (php_iconv_stream_filter_register_factory() != PHP_ICONV_ERR_SUCCESS) {\n\t\treturn FAILURE;\n\t}\n\n\tphp_output_handler_alias_register(ZEND_STRL(\"ob_iconv_handler\"), php_iconv_output_handler_init);\n\tphp_output_handler_conflict_register(ZEND_STRL(\"ob_iconv_handler\"), php_iconv_output_conflict);\n\n\treturn SUCCESS;\n}",
  21035. "project": "php-src",
  21036. "hash": 265543697699041513104677273644141235762,
  21037. "size": 42,
  21038. "commit_id": "7cf7148a8f8f4f55fb04de2a517d740bb6253eac",
  21039. "message": "Fix bug #78069 - Out-of-bounds read in iconv.c:_php_iconv_mime_decode() due to integer overflow",
  21040. "target": 0,
  21041. "dataset": "other",
  21042. "idx": 382779
  21043. }
  21044. ]
  21045. },
  21046. {
  21047. "call_depth": 3,
  21048. "longest_call_chain": [
  21049. "bcf_idx_init",
  21050. "vcf_idx_init",
  21051. "idx_calc_n_lvls_ids"
  21052. ],
  21053. "group_size": 3,
  21054. "functions": [
  21055. {
  21056. "func": "static int idx_calc_n_lvls_ids(const bcf_hdr_t *h, int min_shift,\n int starting_n_lvls, int *nids_out)\n{\n int n_lvls, i, nids = 0;\n int64_t max_len = 0, s;\n\n for (i = 0; i < h->n[BCF_DT_CTG]; ++i)\n {\n if ( !h->id[BCF_DT_CTG][i].val ) continue;\n if ( max_len < h->id[BCF_DT_CTG][i].val->info[0] )\n max_len = h->id[BCF_DT_CTG][i].val->info[0];\n nids++;\n }\n if ( !max_len ) max_len = (1LL<<31) - 1; // In case contig line is broken.\n max_len += 256;\n s = 1LL << (min_shift + starting_n_lvls * 3);\n for (n_lvls = starting_n_lvls; max_len > s; ++n_lvls, s <<= 3);\n\n if (nids_out) *nids_out = nids;\n return n_lvls;\n}",
  21057. "project": "htslib",
  21058. "hash": 36560992857013423294685734316720400965,
  21059. "size": 21,
  21060. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  21061. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  21062. "target": 0,
  21063. "dataset": "other",
  21064. "idx": 402175
  21065. },
  21066. {
  21067. "func": "int bcf_idx_init(htsFile *fp, bcf_hdr_t *h, int min_shift, const char *fnidx) {\n int n_lvls, nids = 0;\n\n if (fp->format.format == vcf)\n return vcf_idx_init(fp, h, min_shift, fnidx);\n\n if (!min_shift)\n min_shift = 14;\n\n n_lvls = idx_calc_n_lvls_ids(h, min_shift, 0, &nids);\n\n fp->idx = hts_idx_init(nids, HTS_FMT_CSI, bgzf_tell(fp->fp.bgzf), min_shift, n_lvls);\n if (!fp->idx) return -1;\n fp->fnidx = fnidx;\n\n return 0;\n}",
  21068. "project": "htslib",
  21069. "hash": 31862953913394906965846469849788848261,
  21070. "size": 17,
  21071. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  21072. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  21073. "target": 0,
  21074. "dataset": "other",
  21075. "idx": 402214
  21076. },
  21077. {
  21078. "func": "static int vcf_idx_init(htsFile *fp, bcf_hdr_t *h, int min_shift, const char *fnidx) {\n int n_lvls, fmt;\n\n if (min_shift == 0) {\n min_shift = 14;\n n_lvls = 5;\n fmt = HTS_FMT_TBI;\n } else {\n // Set initial n_lvls to match tbx_index()\n int starting_n_lvls = (TBX_MAX_SHIFT - min_shift + 2) / 3;\n // Increase if necessary\n n_lvls = idx_calc_n_lvls_ids(h, min_shift, starting_n_lvls, NULL);\n fmt = HTS_FMT_CSI;\n }\n\n fp->idx = hts_idx_init(0, fmt, bgzf_tell(fp->fp.bgzf), min_shift, n_lvls);\n if (!fp->idx) return -1;\n\n // Tabix meta data, added even in CSI for VCF\n uint8_t conf[4*7];\n u32_to_le(TBX_VCF, conf+0); // fmt\n u32_to_le(1, conf+4); // name col\n u32_to_le(2, conf+8); // beg col\n u32_to_le(0, conf+12); // end col\n u32_to_le('#', conf+16); // comment\n u32_to_le(0, conf+20); // n.skip\n u32_to_le(0, conf+24); // ref name len\n if (hts_idx_set_meta(fp->idx, sizeof(conf)*sizeof(*conf), (uint8_t *)conf, 1) < 0) {\n hts_idx_destroy(fp->idx);\n fp->idx = NULL;\n return -1;\n }\n fp->fnidx = fnidx;\n\n return 0;\n}",
  21079. "project": "htslib",
  21080. "hash": 267069432208098790908159743900202672245,
  21081. "size": 36,
  21082. "commit_id": "dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c",
  21083. "message": "Fix check for VCF record size\n\nThe check for excessive record size in vcf_parse_format() only\nlooked at individual fields. It was therefore possible to\nexceed the limit and overflow fmt_aux_t::offset by having\nmultiple fields with a combined size that went over INT_MAX.\nFix by including the amount of memory used so far in the check.\n\nCredit to OSS-Fuzz\nFixes oss-fuzz 24097",
  21084. "target": 0,
  21085. "dataset": "other",
  21086. "idx": 402217
  21087. }
  21088. ]
  21089. },
  21090. {
  21091. "call_depth": 3,
  21092. "longest_call_chain": [
  21093. "get_cmdln_options",
  21094. "read_config",
  21095. "getToken"
  21096. ],
  21097. "group_size": 8,
  21098. "functions": [
  21099. {
  21100. "func": "int read_config(const char *config_file) {\nFILE *fp;\nchar *buffer;\nchar *token, *value;\n\n if (config_file==NULL) return -1;\n\n if( (fp = fopen( config_file, \"r\" ) ) == NULL ) {\n return -1;\n }\n\n buffer = (char*)malloc( sizeof(char) * 4096 );\n\n while( fgets( buffer, 4096, fp ) ) {\n value = trim_whitespace( buffer );\n token = getToken( &value, \"=\" );\n if( token == NULL ) /* ignore this line if there isn't a token/value pair */\n continue;\n token = trim_whitespace( token );\n\n if( strcasecmp( token, \"TIMEOUT\" ) == 0 ) {\n if (value && atol(value)>0) { delay=atol(value); }\n#ifdef PROC_NET_DEV\n } else if( strcasecmp( token, \"PROCFILE\" ) == 0 ) {\n if (value && (strlen(value)<PATH_MAX)) strcpy(PROC_FILE,value);\n#endif\n#ifdef PROC_DISKSTATS\n } else if( strcasecmp( token, \"DISKSTATSFILE\" ) == 0 ) {\n if (value && (strlen(value)<PATH_MAX)) strcpy(PROC_DISKSTATS_FILE,value);\t\t \n } else if( strcasecmp( token, \"PARTITIONSFILE\" ) == 0 ) {\n if (value && (strlen(value)<PATH_MAX)) strcpy(PROC_PARTITIONS_FILE,value);\t\t \n#endif\n#if ALLOW_NETSTATPATH\n#ifdef NETSTAT\n } else if( strcasecmp( token, \"NETSTAT\" ) == 0 ) {\n if (value && (strlen(value)<PATH_MAX)) strcpy(NETSTAT_FILE,value);\n#endif\n#endif\n } else if( strcasecmp( token, \"INPUT\" ) == 0 ) {\n if (value) input_method=str2in_method(value);\n\t } else if( strcasecmp( token, \"ANSIOUT\" ) == 0 ) {\n\t\t if (value) ansi_output=value[0]=='0' ? 0 : 1;\n } else if( strcasecmp( token, \"DYNAMIC\" ) == 0 ) {\n if (value) dynamic=value[0]=='0' ? 0 : 1;\n } else if( strcasecmp( token, \"UNIT\" ) == 0 ) {\n if (value) output_unit=str2output_unit(value);\n#if EXTENDED_STATS\n } else if( strcasecmp( token, \"TYPE\" ) == 0 ) {\n if (value) output_type=str2output_type(value);\n } else if( strcasecmp( token, \"AVGLENGTH\" ) == 0 ) {\n if (value) avg_length=atoi(value)*1000;\n#endif \n } else if( strcasecmp( token, \"ALLIF\" ) == 0 ) {\n if (value) show_all_if=value[0];\n } else if( strcasecmp( token, \"INTERFACES\" ) == 0 ) {\n if (value) iface_list=(char *)strdup(value);\n } else if( strcasecmp( token, \"OUTPUT\" ) == 0 ) {\n if (value) output_method=str2out_method(value);\n#ifdef CSV\n } else if( strcasecmp( token, \"CSVCHAR\" ) == 0 ) {\n if (value) csv_char=value[0];\n#endif\n#if CSV || HTML\n } else if( strcasecmp( token, \"OUTFILE\" ) == 0 ) {\n if (value) { \n if (out_file) fclose(out_file);\n out_file=fopen(value,\"a\"); \n if (!out_file) deinit(1, \"failed to open outfile\\n\");\n if (out_file_path) free(out_file_path);\n out_file_path=(char *)strdup(value);\n }\n#endif\n } else if( strcasecmp( token, \"COUNT\" ) == 0 ) {\n if (value) output_count=atol(value);\n } else if( strcasecmp( token, \"DAEMON\" ) == 0 ) {\n if (value) daemonize=value[0]=='0' ? 0 : 1;\n } else if( strcasecmp( token, \"SUMHIDDEN\" ) == 0 ) {\n if (value) sumhidden=value[0]=='0' ? 0 : 1;\n#if IOSERVICE_IN\n\t } else if( strcasecmp( token, \"LONGDISKNAMES\" ) == 0) {\n\t\t if (value) long_darwin_disk_names=value[0]=='0' ? 0 : 1;\n#endif\n#ifdef HTML\n } else if( strcasecmp( token, \"HTMLREFRESH\" ) == 0 ) {\n if (value && atol(value)>0) { html_refresh=atol(value); }\n } else if( strcasecmp( token, \"HTMLHEADER\" ) == 0 ) {\n if (value) html_header=value[0]=='0' ? 0 : 1;\n#endif\n }\n }\n free(buffer);\n fclose(fp);\n\n return 0;\n}",
  21101. "project": "bwm-ng",
  21102. "hash": 74766385231026271907474676220686881086,
  21103. "size": 95,
  21104. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21105. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21106. "target": 0,
  21107. "dataset": "other",
  21108. "idx": 387904
  21109. },
  21110. {
  21111. "func": "static inline int str2out_method(char *optarg) {\n if (optarg) {\n if (!strcasecmp(optarg,\"plain\")) return PLAIN_OUT;\n#ifdef HAVE_CURSES\n else\n if (!strcasecmp(optarg,\"curses\")) return CURSES_OUT;\n\t else\n if (!strcasecmp(optarg,\"curses2\")) return CURSES2_OUT;\n#endif\n#ifdef CSV\n else\n if (!strcasecmp(optarg,\"csv\")) return CSV_OUT;\n#endif\n#ifdef HTML\n else\n if (!strcasecmp(optarg,\"html\")) return HTML_OUT;\n#endif\n }\n return -1;\n}",
  21112. "project": "bwm-ng",
  21113. "hash": 56326898216332850616138386200504373482,
  21114. "size": 20,
  21115. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21116. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21117. "target": 0,
  21118. "dataset": "other",
  21119. "idx": 387901
  21120. },
  21121. {
  21122. "func": "void get_cmdln_options(int argc, char *argv[]) {\n\tint o;\n#if CONFIG_FILE && HAVE_GETPWUID\n static struct passwd *pwd_entry;\n char *str;\n#endif\n#ifdef LONG_OPTIONS\n int option_index = 0;\n static struct option long_options[] = {\n {\"timeout\", 1, 0, 't'},\n#ifdef PROC_NET_DEV\n {\"procfile\",1,0,'f'},\n#endif\n#ifdef PROC_DISKSTATS\n\t\t\t{\"diskstatsfile\",1,0,1000},\n\t\t\t{\"partitionsfile\",1,0,1001},\n#endif\t\t \n#if NETSTAT && ALLOW_NETSTATPATH\n {\"netstat\",1,0,'n'},\n#endif\n#if IOSERVICE_IN\n\t\t {\"longdisknames\",0,0,1002},\n#endif\n {\"input\",1,0,'i'},\n {\"dynamic\",1,0,'d'},\n {\"help\", 0, 0, 'h'},\n {\"version\",0,0,'V'},\n {\"allif\",1,0,'a'},\n {\"unit\",1,0,'u'},\n\t\t {\"ansiout\",0,0,'N'},\n#if EXTENDED_STATS \n {\"type\",1,0,'T'},\n {\"avglength\",1,0,'A'},\n#endif \n {\"interfaces\",1,0,'I'},\n {\"sumhidden\",1,0,'S'},\n {\"output\",1,0,'o'},\n#ifdef CSV\n {\"csvchar\",1,0,'C'},\n {\"csvfile\",1,0,'F'},\n#endif\n {\"count\",1,0,'c'},\n {\"daemon\",1,0,'D'},\n#ifdef HTML\n {\"htmlrefresh\",1,0,'R'},\n {\"htmlheader\",1,0,'H'},\n#endif\n {0,0,0,0}\n };\n#endif\n#ifdef CONFIG_FILE\n /* loop till first non option argument */\n opterr=0;\n while (1) {\n#ifdef LONG_OPTIONS\n o=getopt_long (argc,argv,SHORT_OPTIONS,long_options, &option_index);\n#else\n o=getopt (argc,argv,SHORT_OPTIONS);\n#endif\n if (o==-1) break;\n }\n opterr=1;\n if (optind < argc) {\n read_config(argv[optind]);\n } else {\n read_config(\"/etc/bwm-ng.conf\");\n#ifdef HAVE_GETPWUID \n pwd_entry=getpwuid(getuid());\n if (pwd_entry!=NULL) {\n str=(char*)malloc(strlen(pwd_entry->pw_dir)+14);\n snprintf(str,strlen(pwd_entry->pw_dir)+14,\"%s/.bwm-ng.conf\",pwd_entry->pw_dir);\n read_config(str);\n free(str);\n }\n#endif \n }\n /* reset getopt again */\n optind=1;\n#endif\n /* get command line arguments, kinda ugly, wanna rewrite it? */\n while (1) {\n#ifdef LONG_OPTIONS\n\t\to=getopt_long (argc,argv,SHORT_OPTIONS,long_options, &option_index);\n#else\n\t\to=getopt (argc,argv,SHORT_OPTIONS);\n#endif\t\t\n if (o==-1) break;\n switch (o) {\n case '?': printf(\"unknown option: %s\\n\",argv[optind-1]);\n exit(EXIT_FAILURE);\n break;\n /* ugly workaround to handle optional arguments for all platforms */ \n case ':': if (!strcmp(argv[optind-1],\"-a\") || !strcasecmp(argv[optind-1],\"--allif\")) \n show_all_if=1;\n else if (!strcmp(argv[optind-1],\"-d\") || !strcasecmp(argv[optind-1],\"--dynamic\"))\n dynamic=1;\n else if (!strcmp(argv[optind-1],\"-D\") || !strcasecmp(argv[optind-1],\"--daemon\"))\n daemonize=1;\n#ifdef HTML \n else if (!strcmp(argv[optind-1],\"-H\") || !strcasecmp(argv[optind-1],\"--htmlheader\"))\n html_header=1;\n#endif \n else if (!strcmp(argv[optind-1],\"-S\") || !strcasecmp(argv[optind-1],\"--sumhidden\"))\n sumhidden=1; \n else {\n printf(\"%s requires an argument!\\n\",argv[optind-1]);\n exit(EXIT_FAILURE);\n }\n break;\n#ifdef PROC_DISKSTATS\n\t\t\tcase 1000:\n\t\t\t\tif (strlen(optarg)<PATH_MAX) \n\t\t\t\t\tstrcpy(PROC_DISKSTATS_FILE,optarg);\n\t\t\t\tbreak;\n case 1001:\n if (strlen(optarg)<PATH_MAX)\n strcpy(PROC_PARTITIONS_FILE,optarg);\n\t\t\t\tbreak;\n#endif\t\t\t\t\n#if IOSERVICE_IN\n\t\t\tcase 1002:\n\t\t\t\tlong_darwin_disk_names=!long_darwin_disk_names;\n\t\t\t\tbreak;\n#endif\n\t\t\tcase 'D':\n\t\t\t\tif (optarg) daemonize=atoi(optarg);\n\t\t\t\tbreak;\n#ifdef HTML\n\t\t\tcase 'R':\n\t\t\t\tif ((optarg) && atol(optarg)>0) { html_refresh=atol(optarg); }\n\t\t\t\tbreak;\n\t\t\tcase 'H':\n\t\t\t\tif (optarg) html_header=atoi(optarg);\n\t\t\t\tbreak;\n#endif\n\t\t\tcase 'c':\n\t\t\t\tif (optarg) output_count=atol(optarg);\n\t\t\t\tbreak;\n#if CSV || HTML\n case 'F':\n if (optarg) { \n if (out_file) fclose(out_file);\n out_file=fopen(optarg,\"a\"); \n if (!out_file) deinit(1, \"failed to open outfile\\n\");\n if (out_file_path) free(out_file_path);\n out_file_path=(char *)strdup(optarg);\n }\n break;\n#endif\n#ifdef CSV\n\t\t\tcase 'C':\n\t\t\t\tif (optarg) csv_char=optarg[0];\n\t\t\t\tbreak;\n#endif\n case 'h':\n cmdln_printhelp();\n break;\n#ifdef PROC_NET_DEV\n\t\t\tcase 'f':\n if (optarg && (strlen(optarg)<PATH_MAX)) strcpy(PROC_FILE,optarg);\n break;\n#endif\t\t\t\n\t\t\tcase 'i':\n if (optarg) {\n input_method=str2in_method(optarg);\n }\n\t\t\t\tbreak;\t\t\t\t\n case 'I':\n if (optarg) iface_list=(char *)strdup(optarg);\n break;\n case 'S':\n if (optarg) sumhidden=atoi(optarg);\n break;\n case 'o':\n if (optarg) {\n output_method=str2out_method(optarg);\n }\n break;\n\t\t\t\tcase 'N':\n\t\t\t\t\t ansi_output=!ansi_output;\n case 'a':\n if (optarg) show_all_if=atoi(optarg);\n break;\n case 't':\n if ((optarg) && atol(optarg)>0) { delay=atol(optarg); }\n break;\n#if EXTENDED_STATS \n case 'T':\n output_type=str2output_type(optarg);\n break;\n case 'A':\n if (optarg) avg_length=atoi(optarg)*1000;\n break;\n#endif \n case 'd':\n if (optarg) dynamic=atoi(optarg);\n break;\n case 'u':\n output_unit=str2output_unit(optarg);\n break;\n#if NETSTAT && ALLOW_NETSTATPATH\n case 'n':\n if (optarg && (strlen(optarg)<PATH_MAX)) strcpy(NETSTAT_FILE,optarg);\n break;\n#endif \n case 'V':\n print_version;\n exit(EXIT_SUCCESS);\n break;\n }\n }\n if (iface_list==NULL && show_all_if==1) show_all_if=2;\n#if EXTENDED_STATS \n /* default init of avg_length */\n if (avg_length==0) {\n if (delay<AVG_LENGTH/2) \n avg_length=AVG_LENGTH; \n else \n avg_length=(delay*2)+1;\n } else /* avg_length was set via cmdline or config file, better check it */\n if (delay*2>=avg_length) deinit(1, \"avglength needs to be a least twice the value of timeout\\n\");\n#endif \n\t if ((output_unit==ERRORS_OUT && !net_input_method(input_method)) || \n\t\t\t (output_unit==PACKETS_OUT && input_method==LIBSTATDISK_IN)) \n\t\toutput_unit=BYTES_OUT;\n return;\n}",
  21123. "project": "bwm-ng",
  21124. "hash": 190610676223568420413623069094924895723,
  21125. "size": 227,
  21126. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21127. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21128. "target": 1,
  21129. "dataset": "other",
  21130. "idx": 206867
  21131. },
  21132. {
  21133. "func": "void get_cmdln_options(int argc, char *argv[]) {\n\tint o;\n#if CONFIG_FILE && HAVE_GETPWUID\n static struct passwd *pwd_entry;\n char *str;\n#endif\n#ifdef LONG_OPTIONS\n int option_index = 0;\n static struct option long_options[] = {\n {\"timeout\", 1, 0, 't'},\n#ifdef PROC_NET_DEV\n {\"procfile\",1,0,'f'},\n#endif\n#ifdef PROC_DISKSTATS\n\t\t\t{\"diskstatsfile\",1,0,1000},\n\t\t\t{\"partitionsfile\",1,0,1001},\n#endif\t\t \n#if NETSTAT && ALLOW_NETSTATPATH\n {\"netstat\",1,0,'n'},\n#endif\n#if IOSERVICE_IN\n\t\t {\"longdisknames\",0,0,1002},\n#endif\n {\"input\",1,0,'i'},\n {\"dynamic\",1,0,'d'},\n {\"help\", 0, 0, 'h'},\n {\"version\",0,0,'V'},\n {\"allif\",1,0,'a'},\n {\"unit\",1,0,'u'},\n\t\t {\"ansiout\",0,0,'N'},\n#if EXTENDED_STATS \n {\"type\",1,0,'T'},\n {\"avglength\",1,0,'A'},\n#endif \n {\"interfaces\",1,0,'I'},\n {\"sumhidden\",1,0,'S'},\n {\"output\",1,0,'o'},\n#ifdef CSV\n {\"csvchar\",1,0,'C'},\n {\"csvfile\",1,0,'F'},\n#endif\n {\"count\",1,0,'c'},\n {\"daemon\",1,0,'D'},\n#ifdef HTML\n {\"htmlrefresh\",1,0,'R'},\n {\"htmlheader\",1,0,'H'},\n#endif\n {0,0,0,0}\n };\n#endif\n#ifdef CONFIG_FILE\n /* loop till first non option argument */\n opterr=0;\n while (1) {\n#ifdef LONG_OPTIONS\n o=getopt_long (argc,argv,SHORT_OPTIONS,long_options, &option_index);\n#else\n o=getopt (argc,argv,SHORT_OPTIONS);\n#endif\n if (o==-1) break;\n }\n opterr=1;\n if (optind < argc) {\n read_config(argv[optind]);\n } else {\n read_config(\"/etc/bwm-ng.conf\");\n#ifdef HAVE_GETPWUID \n pwd_entry=getpwuid(getuid());\n if (pwd_entry!=NULL) {\n str=(char*)malloc(strlen(pwd_entry->pw_dir)+14);\n if(!str) {\n printf(\"Fatal: failed to allocate %zu bytes.\\n\", strlen(pwd_entry->pw_dir)+14);\n exit(EXIT_FAILURE);\n }\n snprintf(str,strlen(pwd_entry->pw_dir)+14,\"%s/.bwm-ng.conf\",pwd_entry->pw_dir);\n read_config(str);\n free(str);\n }\n#endif \n }\n /* reset getopt again */\n optind=1;\n#endif\n /* get command line arguments, kinda ugly, wanna rewrite it? */\n while (1) {\n#ifdef LONG_OPTIONS\n\t\to=getopt_long (argc,argv,SHORT_OPTIONS,long_options, &option_index);\n#else\n\t\to=getopt (argc,argv,SHORT_OPTIONS);\n#endif\t\t\n if (o==-1) break;\n switch (o) {\n case '?': printf(\"unknown option: %s\\n\",argv[optind-1]);\n exit(EXIT_FAILURE);\n break;\n /* ugly workaround to handle optional arguments for all platforms */ \n case ':': if (!strcmp(argv[optind-1],\"-a\") || !strcasecmp(argv[optind-1],\"--allif\")) \n show_all_if=1;\n else if (!strcmp(argv[optind-1],\"-d\") || !strcasecmp(argv[optind-1],\"--dynamic\"))\n dynamic=1;\n else if (!strcmp(argv[optind-1],\"-D\") || !strcasecmp(argv[optind-1],\"--daemon\"))\n daemonize=1;\n#ifdef HTML \n else if (!strcmp(argv[optind-1],\"-H\") || !strcasecmp(argv[optind-1],\"--htmlheader\"))\n html_header=1;\n#endif \n else if (!strcmp(argv[optind-1],\"-S\") || !strcasecmp(argv[optind-1],\"--sumhidden\"))\n sumhidden=1; \n else {\n printf(\"%s requires an argument!\\n\",argv[optind-1]);\n exit(EXIT_FAILURE);\n }\n break;\n#ifdef PROC_DISKSTATS\n\t\t\tcase 1000:\n\t\t\t\tif (strlen(optarg)<PATH_MAX) \n\t\t\t\t\tstrcpy(PROC_DISKSTATS_FILE,optarg);\n\t\t\t\tbreak;\n case 1001:\n if (strlen(optarg)<PATH_MAX)\n strcpy(PROC_PARTITIONS_FILE,optarg);\n\t\t\t\tbreak;\n#endif\t\t\t\t\n#if IOSERVICE_IN\n\t\t\tcase 1002:\n\t\t\t\tlong_darwin_disk_names=!long_darwin_disk_names;\n\t\t\t\tbreak;\n#endif\n\t\t\tcase 'D':\n\t\t\t\tif (optarg) daemonize=atoi(optarg);\n\t\t\t\tbreak;\n#ifdef HTML\n\t\t\tcase 'R':\n\t\t\t\tif ((optarg) && atol(optarg)>0) { html_refresh=atol(optarg); }\n\t\t\t\tbreak;\n\t\t\tcase 'H':\n\t\t\t\tif (optarg) html_header=atoi(optarg);\n\t\t\t\tbreak;\n#endif\n\t\t\tcase 'c':\n\t\t\t\tif (optarg) output_count=atol(optarg);\n\t\t\t\tbreak;\n#if CSV || HTML\n case 'F':\n if (optarg) { \n if (out_file) fclose(out_file);\n out_file=fopen(optarg,\"a\"); \n if (!out_file) deinit(1, \"failed to open outfile\\n\");\n if (out_file_path) free(out_file_path);\n out_file_path=(char *)strdup(optarg);\n }\n break;\n#endif\n#ifdef CSV\n\t\t\tcase 'C':\n\t\t\t\tif (optarg) csv_char=optarg[0];\n\t\t\t\tbreak;\n#endif\n case 'h':\n cmdln_printhelp();\n break;\n#ifdef PROC_NET_DEV\n\t\t\tcase 'f':\n if (optarg && (strlen(optarg)<PATH_MAX)) strcpy(PROC_FILE,optarg);\n break;\n#endif\t\t\t\n\t\t\tcase 'i':\n if (optarg) {\n input_method=str2in_method(optarg);\n }\n\t\t\t\tbreak;\t\t\t\t\n case 'I':\n if (optarg) iface_list=(char *)strdup(optarg);\n break;\n case 'S':\n if (optarg) sumhidden=atoi(optarg);\n break;\n case 'o':\n if (optarg) {\n output_method=str2out_method(optarg);\n }\n break;\n\t\t\t\tcase 'N':\n\t\t\t\t\t ansi_output=!ansi_output;\n case 'a':\n if (optarg) show_all_if=atoi(optarg);\n break;\n case 't':\n if ((optarg) && atol(optarg)>0) { delay=atol(optarg); }\n break;\n#if EXTENDED_STATS \n case 'T':\n output_type=str2output_type(optarg);\n break;\n case 'A':\n if (optarg) avg_length=atoi(optarg)*1000;\n break;\n#endif \n case 'd':\n if (optarg) dynamic=atoi(optarg);\n break;\n case 'u':\n output_unit=str2output_unit(optarg);\n break;\n#if NETSTAT && ALLOW_NETSTATPATH\n case 'n':\n if (optarg && (strlen(optarg)<PATH_MAX)) strcpy(NETSTAT_FILE,optarg);\n break;\n#endif \n case 'V':\n print_version;\n exit(EXIT_SUCCESS);\n break;\n }\n }\n if (iface_list==NULL && show_all_if==1) show_all_if=2;\n#if EXTENDED_STATS \n /* default init of avg_length */\n if (avg_length==0) {\n if (delay<AVG_LENGTH/2) \n avg_length=AVG_LENGTH; \n else \n avg_length=(delay*2)+1;\n } else /* avg_length was set via cmdline or config file, better check it */\n if (delay*2>=avg_length) deinit(1, \"avglength needs to be a least twice the value of timeout\\n\");\n#endif \n\t if ((output_unit==ERRORS_OUT && !net_input_method(input_method)) || \n\t\t\t (output_unit==PACKETS_OUT && input_method==LIBSTATDISK_IN)) \n\t\toutput_unit=BYTES_OUT;\n return;\n}",
  21134. "project": "bwm-ng",
  21135. "hash": 193898408646396083666542746077666107845,
  21136. "size": 231,
  21137. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21138. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21139. "target": 0,
  21140. "dataset": "other",
  21141. "idx": 387905
  21142. },
  21143. {
  21144. "func": "static inline int str2in_method(char *optarg) {\n if (optarg) {\n#ifdef PROC_NET_DEV\n if (!strcasecmp(optarg,\"proc\")) return PROC_IN;\n#endif\n#ifdef NETSTAT\n if (!strcasecmp(optarg,\"netstat\")) return NETSTAT_IN;\n#endif\n#ifdef LIBSTATGRAB\n if (!strcasecmp(optarg,\"libstat\") || !strcasecmp(optarg,\"statgrab\") || !strcasecmp(optarg,\"libstatgrab\")) return LIBSTAT_IN;\n\t\t if (!strcasecmp(optarg,\"libstatdisk\")) return LIBSTATDISK_IN;\n#endif\n#ifdef GETIFADDRS\n if (!strcasecmp(optarg,\"getifaddrs\")) return GETIFADDRS_IN;\n#endif\n#if DEVSTAT_IN\n\t\t if (!strcasecmp(optarg,\"devstat\")) return DEVSTAT_IN;\n#endif\n#ifdef SYSCTL\n if (!strcasecmp(optarg,\"sysctl\")) return SYSCTL_IN;\n#endif\n#if SYSCTLDISK_IN\n\t\t if (!strcasecmp(optarg,\"sysctldisk\")) return SYSCTLDISK_IN;\n#endif\n#ifdef PROC_DISKSTATS\n\t\t if (!strcasecmp(optarg,\"disk\")) return DISKLINUX_IN;\n#endif\t\t \n#ifdef WIN32\n\t\t if (!strcasecmp(optarg,\"win32\")) return WIN32_IN;\n#endif\t\t\t \n#ifdef HAVE_LIBKSTAT\n\t\t\tif (!strcasecmp(optarg,\"kstat\")) return KSTAT_IN;\n\t\t\tif (!strcasecmp(optarg,\"kstatdisk\")) return KSTATDISK_IN;\n#endif \n#if IOSERVICE_IN\n\t\t\tif (!strcasecmp(optarg,\"ioservice\")) return IOSERVICE_IN;\n#endif\n }\n return -1;\n}",
  21145. "project": "bwm-ng",
  21146. "hash": 108344679584290367903224420452870508339,
  21147. "size": 40,
  21148. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21149. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21150. "target": 0,
  21151. "dataset": "other",
  21152. "idx": 387900
  21153. },
  21154. {
  21155. "func": "static inline int str2output_unit(char *optarg) {\n if (optarg) {\n if (!strcasecmp(optarg,\"bytes\")) return BYTES_OUT;\n if (!strcasecmp(optarg,\"bits\")) return BITS_OUT;\n if (!strcasecmp(optarg,\"packets\")) return PACKETS_OUT;\n if (!strcasecmp(optarg,\"errors\")) return ERRORS_OUT;\n }\n return BYTES_OUT;\n}",
  21156. "project": "bwm-ng",
  21157. "hash": 222258036977557934891315184404921850071,
  21158. "size": 9,
  21159. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21160. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21161. "target": 0,
  21162. "dataset": "other",
  21163. "idx": 387903
  21164. },
  21165. {
  21166. "func": "static inline int str2output_type(char *optarg) {\n if (optarg) {\n if (!strcasecmp(optarg,\"rate\")) return RATE_OUT;\n if (!strcasecmp(optarg,\"max\")) return MAX_OUT;\n if (!strcasecmp(optarg,\"sum\")) return SUM_OUT;\n if (!strcasecmp(optarg,\"avg\")) return AVG_OUT;\n }\n return RATE_OUT;\n}",
  21167. "project": "bwm-ng",
  21168. "hash": 254948465393666657548553401422609827674,
  21169. "size": 9,
  21170. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21171. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21172. "target": 0,
  21173. "dataset": "other",
  21174. "idx": 387902
  21175. },
  21176. {
  21177. "func": "static char* getToken(char** str, const char* delims) {\n char* token;\n\n if (*str==NULL) {\n /* No more tokens */\n return NULL;\n }\n\n token=*str;\n while (**str!='\\0') {\n if (strchr(delims,**str)!=NULL) {\n **str='\\0';\n (*str)++;\n return token;\n }\n (*str)++;\n }\n /* There is no other token */\n *str=NULL;\n return token;\n}",
  21178. "project": "bwm-ng",
  21179. "hash": 210939990752000446678069495160319633942,
  21180. "size": 21,
  21181. "commit_id": "9774f23bf78a6e6d3ae4cfe3d73bad34f2fdcd17",
  21182. "message": "Fix https://github.com/vgropp/bwm-ng/issues/26",
  21183. "target": 0,
  21184. "dataset": "other",
  21185. "idx": 387906
  21186. }
  21187. ]
  21188. },
  21189. {
  21190. "call_depth": 3,
  21191. "longest_call_chain": [
  21192. "update_recv_pointer",
  21193. "update_read_pointer_color",
  21194. "_update_read_pointer_color"
  21195. ],
  21196. "group_size": 13,
  21197. "functions": [
  21198. {
  21199. "func": "POINTER_COLOR_UPDATE* update_read_pointer_color(rdpUpdate* update, wStream* s, BYTE xorBpp)\n{\n\tPOINTER_COLOR_UPDATE* pointer_color = calloc(1, sizeof(POINTER_COLOR_UPDATE));\n\n\tif (!pointer_color)\n\t\tgoto fail;\n\n\tif (!_update_read_pointer_color(s, pointer_color, xorBpp,\n\t update->context->settings->LargePointerFlag))\n\t\tgoto fail;\n\n\treturn pointer_color;\nfail:\n\tfree_pointer_color_update(update->context, pointer_color);\n\treturn NULL;\n}",
  21200. "project": "FreeRDP",
  21201. "hash": 218463943941599749252924360326530834583,
  21202. "size": 16,
  21203. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21204. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21205. "target": 0,
  21206. "dataset": "other",
  21207. "idx": 295059
  21208. },
  21209. {
  21210. "func": "POINTER_COLOR_UPDATE* update_read_pointer_color(rdpUpdate* update, wStream* s, BYTE xorBpp)\n{\n\tPOINTER_COLOR_UPDATE* pointer_color = calloc(1, sizeof(POINTER_COLOR_UPDATE));\n\n\tif (!pointer_color)\n\t\tgoto fail;\n\n\tif (!_update_read_pointer_color(s, pointer_color, xorBpp))\n\t\tgoto fail;\n\n\treturn pointer_color;\nfail:\n\tfree_pointer_color_update(update->context, pointer_color);\n\treturn NULL;\n}",
  21211. "project": "FreeRDP",
  21212. "hash": 237438429491696301660107096822381566914,
  21213. "size": 15,
  21214. "commit_id": "f8890a645c221823ac133dbf991f8a65ae50d637",
  21215. "message": "Fixed #6005: Bounds checks in update_read_bitmap_data",
  21216. "target": 0,
  21217. "dataset": "other",
  21218. "idx": 340401
  21219. },
  21220. {
  21221. "func": "POINTER_CACHED_UPDATE* update_read_pointer_cached(rdpUpdate* update, wStream* s)\n{\n\tPOINTER_CACHED_UPDATE* pointer = calloc(1, sizeof(POINTER_CACHED_UPDATE));\n\n\tif (!pointer)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer->cacheIndex); /* cacheIndex (2 bytes) */\n\treturn pointer;\nfail:\n\tfree_pointer_cached_update(update->context, pointer);\n\treturn NULL;\n}",
  21222. "project": "FreeRDP",
  21223. "hash": 268618224038895794431261032985787850171,
  21224. "size": 16,
  21225. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21226. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21227. "target": 0,
  21228. "dataset": "other",
  21229. "idx": 295020
  21230. },
  21231. {
  21232. "func": "POINTER_LARGE_UPDATE* update_read_pointer_large(rdpUpdate* update, wStream* s)\n{\n\tPOINTER_LARGE_UPDATE* pointer = calloc(1, sizeof(POINTER_LARGE_UPDATE));\n\n\tif (!pointer)\n\t\tgoto fail;\n\n\tif (!_update_read_pointer_large(s, pointer))\n\t\tgoto fail;\n\n\treturn pointer;\nfail:\n\tfree_pointer_large_update(update->context, pointer);\n\treturn NULL;\n}",
  21233. "project": "FreeRDP",
  21234. "hash": 217792033951710575623581635891913485789,
  21235. "size": 15,
  21236. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21237. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21238. "target": 0,
  21239. "dataset": "other",
  21240. "idx": 295110
  21241. },
  21242. {
  21243. "func": "POINTER_SYSTEM_UPDATE* update_read_pointer_system(rdpUpdate* update, wStream* s)\n{\n\tPOINTER_SYSTEM_UPDATE* pointer_system = calloc(1, sizeof(POINTER_SYSTEM_UPDATE));\n\n\tif (!pointer_system)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t\tgoto fail;\n\n\tStream_Read_UINT32(s, pointer_system->type); /* systemPointerType (4 bytes) */\n\treturn pointer_system;\nfail:\n\tfree_pointer_system_update(update->context, pointer_system);\n\treturn NULL;\n}",
  21244. "project": "FreeRDP",
  21245. "hash": 339444357779789492624078198525968752662,
  21246. "size": 16,
  21247. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21248. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21249. "target": 0,
  21250. "dataset": "other",
  21251. "idx": 295086
  21252. },
  21253. {
  21254. "func": "BOOL update_recv_pointer(rdpUpdate* update, wStream* s)\n{\n\tBOOL rc = FALSE;\n\tUINT16 messageType;\n\trdpContext* context = update->context;\n\trdpPointerUpdate* pointer = update->pointer;\n\n\tif (Stream_GetRemainingLength(s) < 2 + 2)\n\t\treturn FALSE;\n\n\tStream_Read_UINT16(s, messageType); /* messageType (2 bytes) */\n\tStream_Seek_UINT16(s); /* pad2Octets (2 bytes) */\n\n\tswitch (messageType)\n\t{\n\t\tcase PTR_MSG_TYPE_POSITION:\n\t\t{\n\t\t\tPOINTER_POSITION_UPDATE* pointer_position = update_read_pointer_position(update, s);\n\n\t\t\tif (pointer_position)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, pointer->PointerPosition, context, pointer_position);\n\t\t\t\tfree_pointer_position_update(context, pointer_position);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase PTR_MSG_TYPE_SYSTEM:\n\t\t{\n\t\t\tPOINTER_SYSTEM_UPDATE* pointer_system = update_read_pointer_system(update, s);\n\n\t\t\tif (pointer_system)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, pointer->PointerSystem, context, pointer_system);\n\t\t\t\tfree_pointer_system_update(context, pointer_system);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase PTR_MSG_TYPE_COLOR:\n\t\t{\n\t\t\tPOINTER_COLOR_UPDATE* pointer_color = update_read_pointer_color(update, s, 24);\n\n\t\t\tif (pointer_color)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, pointer->PointerColor, context, pointer_color);\n\t\t\t\tfree_pointer_color_update(context, pointer_color);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase PTR_MSG_TYPE_POINTER_LARGE:\n\t\t{\n\t\t\tPOINTER_LARGE_UPDATE* pointer_large = update_read_pointer_large(update, s);\n\n\t\t\tif (pointer_large)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, pointer->PointerLarge, context, pointer_large);\n\t\t\t\tfree_pointer_large_update(context, pointer_large);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase PTR_MSG_TYPE_POINTER:\n\t\t{\n\t\t\tPOINTER_NEW_UPDATE* pointer_new = update_read_pointer_new(update, s);\n\n\t\t\tif (pointer_new)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, pointer->PointerNew, context, pointer_new);\n\t\t\t\tfree_pointer_new_update(context, pointer_new);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tcase PTR_MSG_TYPE_CACHED:\n\t\t{\n\t\t\tPOINTER_CACHED_UPDATE* pointer_cached = update_read_pointer_cached(update, s);\n\n\t\t\tif (pointer_cached)\n\t\t\t{\n\t\t\t\trc = IFCALLRESULT(FALSE, pointer->PointerCached, context, pointer_cached);\n\t\t\t\tfree_pointer_cached_update(context, pointer_cached);\n\t\t\t}\n\t\t}\n\t\tbreak;\n\n\t\tdefault:\n\t\t\tbreak;\n\t}\n\n\treturn rc;\n}",
  21255. "project": "FreeRDP",
  21256. "hash": 277819367770707859702659868515717310164,
  21257. "size": 93,
  21258. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21259. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21260. "target": 0,
  21261. "dataset": "other",
  21262. "idx": 295111
  21263. },
  21264. {
  21265. "func": "static BOOL _update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color, BYTE xorBpp,\n UINT32 flags)\n{\n\tBYTE* newMask;\n\tUINT32 scanlineSize;\n\tUINT32 max = 32;\n\n\tif (flags & LARGE_POINTER_FLAG_96x96)\n\t\tmax = 96;\n\n\tif (!pointer_color)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 14)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->xPos); /* xPos (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->yPos); /* yPos (2 bytes) */\n\t/**\n\t * As stated in 2.2.9.1.1.4.4 Color Pointer Update:\n\t * The maximum allowed pointer width/height is 96 pixels if the client indicated support\n\t * for large pointers by setting the LARGE_POINTER_FLAG (0x00000001) in the Large\n\t * Pointer Capability Set (section 2.2.7.2.7). If the LARGE_POINTER_FLAG was not\n\t * set, the maximum allowed pointer width/height is 32 pixels.\n\t *\n\t * So we check for a maximum for CVE-2014-0250.\n\t */\n\tStream_Read_UINT16(s, pointer_color->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->height); /* height (2 bytes) */\n\n\tif ((pointer_color->width > max) || (pointer_color->height > max))\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */\n\n\t/**\n\t * There does not seem to be any documentation on why\n\t * xPos / yPos can be larger than width / height\n\t * so it is missing in documentation or a bug in implementation\n\t * 2.2.9.1.1.4.4 Color Pointer Update (TS_COLORPOINTERATTRIBUTE)\n\t */\n\tif (pointer_color->xPos >= pointer_color->width)\n\t\tpointer_color->xPos = 0;\n\n\tif (pointer_color->yPos >= pointer_color->height)\n\t\tpointer_color->yPos = 0;\n\n\tif (pointer_color->lengthXorMask > 0)\n\t{\n\t\t/**\n\t\t * Spec states that:\n\t\t *\n\t\t * xorMaskData (variable): A variable-length array of bytes. Contains the 24-bpp, bottom-up\n\t\t * XOR mask scan-line data. The XOR mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 3x3 pixel cursor is being sent, then each scan-line will\n\t\t * consume 10 bytes (3 pixels per scan-line multiplied by 3 bytes per pixel, rounded up to\n\t\t * the next even number of bytes).\n\t\t *\n\t\t * In fact instead of 24-bpp, the bpp parameter is given by the containing packet.\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer_color->lengthXorMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = (7 + xorBpp * pointer_color->width) / 8;\n\t\tscanlineSize = ((scanlineSize + 1) / 2) * 2;\n\n\t\tif (scanlineSize * pointer_color->height != pointer_color->lengthXorMask)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"invalid lengthXorMask: width=%\" PRIu32 \" height=%\" PRIu32 \", %\" PRIu32\n\t\t\t \" instead of %\" PRIu32 \"\",\n\t\t\t pointer_color->width, pointer_color->height, pointer_color->lengthXorMask,\n\t\t\t scanlineSize * pointer_color->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer_color->xorMaskData, pointer_color->lengthXorMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer_color->xorMaskData = newMask;\n\t\tStream_Read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);\n\t}\n\n\tif (pointer_color->lengthAndMask > 0)\n\t{\n\t\t/**\n\t\t * andMaskData (variable): A variable-length array of bytes. Contains the 1-bpp, bottom-up\n\t\t * AND mask scan-line data. The AND mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 7x7 pixel cursor is being sent, then each scan-line will\n\t\t * consume 2 bytes (7 pixels per scan-line multiplied by 1 bpp, rounded up to the next even\n\t\t * number of bytes).\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer_color->lengthAndMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = ((7 + pointer_color->width) / 8);\n\t\tscanlineSize = ((1 + scanlineSize) / 2) * 2;\n\n\t\tif (scanlineSize * pointer_color->height != pointer_color->lengthAndMask)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"invalid lengthAndMask: %\" PRIu32 \" instead of %\" PRIu32 \"\",\n\t\t\t pointer_color->lengthAndMask, scanlineSize * pointer_color->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer_color->andMaskData, pointer_color->lengthAndMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer_color->andMaskData = newMask;\n\t\tStream_Read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);\n\t}\n\n\tif (Stream_GetRemainingLength(s) > 0)\n\t\tStream_Seek_UINT8(s); /* pad (1 byte) */\n\n\treturn TRUE;\nfail:\n\treturn FALSE;\n}",
  21266. "project": "FreeRDP",
  21267. "hash": 321398955940832530193747212857729928085,
  21268. "size": 125,
  21269. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21270. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21271. "target": 0,
  21272. "dataset": "other",
  21273. "idx": 295116
  21274. },
  21275. {
  21276. "func": "static BOOL _update_read_pointer_color(wStream* s, POINTER_COLOR_UPDATE* pointer_color, BYTE xorBpp)\n{\n\tBYTE* newMask;\n\tUINT32 scanlineSize;\n\n\tif (!pointer_color)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 14)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer_color->cacheIndex); /* cacheIndex (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->xPos); /* xPos (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->yPos); /* yPos (2 bytes) */\n\t/**\n\t * As stated in 2.2.9.1.1.4.4 Color Pointer Update:\n\t * The maximum allowed pointer width/height is 96 pixels if the client indicated support\n\t * for large pointers by setting the LARGE_POINTER_FLAG (0x00000001) in the Large\n\t * Pointer Capability Set (section 2.2.7.2.7). If the LARGE_POINTER_FLAG was not\n\t * set, the maximum allowed pointer width/height is 32 pixels.\n\t *\n\t * So we check for a maximum of 96 for CVE-2014-0250.\n\t */\n\tStream_Read_UINT16(s, pointer_color->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->height); /* height (2 bytes) */\n\n\tif ((pointer_color->width > 96) || (pointer_color->height > 96))\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer_color->lengthAndMask); /* lengthAndMask (2 bytes) */\n\tStream_Read_UINT16(s, pointer_color->lengthXorMask); /* lengthXorMask (2 bytes) */\n\n\t/**\n\t * There does not seem to be any documentation on why\n\t * xPos / yPos can be larger than width / height\n\t * so it is missing in documentation or a bug in implementation\n\t * 2.2.9.1.1.4.4 Color Pointer Update (TS_COLORPOINTERATTRIBUTE)\n\t */\n\tif (pointer_color->xPos >= pointer_color->width)\n\t\tpointer_color->xPos = 0;\n\n\tif (pointer_color->yPos >= pointer_color->height)\n\t\tpointer_color->yPos = 0;\n\n\tif (pointer_color->lengthXorMask > 0)\n\t{\n\t\t/**\n\t\t * Spec states that:\n\t\t *\n\t\t * xorMaskData (variable): A variable-length array of bytes. Contains the 24-bpp, bottom-up\n\t\t * XOR mask scan-line data. The XOR mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 3x3 pixel cursor is being sent, then each scan-line will\n\t\t * consume 10 bytes (3 pixels per scan-line multiplied by 3 bytes per pixel, rounded up to\n\t\t * the next even number of bytes).\n\t\t *\n\t\t * In fact instead of 24-bpp, the bpp parameter is given by the containing packet.\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer_color->lengthXorMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = (7 + xorBpp * pointer_color->width) / 8;\n\t\tscanlineSize = ((scanlineSize + 1) / 2) * 2;\n\n\t\tif (scanlineSize * pointer_color->height != pointer_color->lengthXorMask)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"invalid lengthXorMask: width=%\" PRIu32 \" height=%\" PRIu32 \", %\" PRIu32\n\t\t\t \" instead of %\" PRIu32 \"\",\n\t\t\t pointer_color->width, pointer_color->height, pointer_color->lengthXorMask,\n\t\t\t scanlineSize * pointer_color->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer_color->xorMaskData, pointer_color->lengthXorMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer_color->xorMaskData = newMask;\n\t\tStream_Read(s, pointer_color->xorMaskData, pointer_color->lengthXorMask);\n\t}\n\n\tif (pointer_color->lengthAndMask > 0)\n\t{\n\t\t/**\n\t\t * andMaskData (variable): A variable-length array of bytes. Contains the 1-bpp, bottom-up\n\t\t * AND mask scan-line data. The AND mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 7x7 pixel cursor is being sent, then each scan-line will\n\t\t * consume 2 bytes (7 pixels per scan-line multiplied by 1 bpp, rounded up to the next even\n\t\t * number of bytes).\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer_color->lengthAndMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = ((7 + pointer_color->width) / 8);\n\t\tscanlineSize = ((1 + scanlineSize) / 2) * 2;\n\n\t\tif (scanlineSize * pointer_color->height != pointer_color->lengthAndMask)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"invalid lengthAndMask: %\" PRIu32 \" instead of %\" PRIu32 \"\",\n\t\t\t pointer_color->lengthAndMask, scanlineSize * pointer_color->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer_color->andMaskData, pointer_color->lengthAndMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer_color->andMaskData = newMask;\n\t\tStream_Read(s, pointer_color->andMaskData, pointer_color->lengthAndMask);\n\t}\n\n\tif (Stream_GetRemainingLength(s) > 0)\n\t\tStream_Seek_UINT8(s); /* pad (1 byte) */\n\n\treturn TRUE;\nfail:\n\treturn FALSE;\n}",
  21277. "project": "FreeRDP",
  21278. "hash": 308964776568817409802620424098239944020,
  21279. "size": 120,
  21280. "commit_id": "f8890a645c221823ac133dbf991f8a65ae50d637",
  21281. "message": "Fixed #6005: Bounds checks in update_read_bitmap_data",
  21282. "target": 0,
  21283. "dataset": "other",
  21284. "idx": 340400
  21285. },
  21286. {
  21287. "func": "static BOOL _update_read_pointer_large(wStream* s, POINTER_LARGE_UPDATE* pointer)\n{\n\tBYTE* newMask;\n\tUINT32 scanlineSize;\n\n\tif (!pointer)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 20)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer->xorBpp);\n\tStream_Read_UINT16(s, pointer->cacheIndex); /* cacheIndex (2 bytes) */\n\tStream_Read_UINT16(s, pointer->hotSpotX); /* xPos (2 bytes) */\n\tStream_Read_UINT16(s, pointer->hotSpotY); /* yPos (2 bytes) */\n\n\tStream_Read_UINT16(s, pointer->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, pointer->height); /* height (2 bytes) */\n\n\tif ((pointer->width > 384) || (pointer->height > 384))\n\t\tgoto fail;\n\n\tStream_Read_UINT32(s, pointer->lengthAndMask); /* lengthAndMask (4 bytes) */\n\tStream_Read_UINT32(s, pointer->lengthXorMask); /* lengthXorMask (4 bytes) */\n\n\tif (pointer->hotSpotX >= pointer->width)\n\t\tpointer->hotSpotX = 0;\n\n\tif (pointer->hotSpotY >= pointer->height)\n\t\tpointer->hotSpotY = 0;\n\n\tif (pointer->lengthXorMask > 0)\n\t{\n\t\t/**\n\t\t * Spec states that:\n\t\t *\n\t\t * xorMaskData (variable): A variable-length array of bytes. Contains the 24-bpp, bottom-up\n\t\t * XOR mask scan-line data. The XOR mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 3x3 pixel cursor is being sent, then each scan-line will\n\t\t * consume 10 bytes (3 pixels per scan-line multiplied by 3 bytes per pixel, rounded up to\n\t\t * the next even number of bytes).\n\t\t *\n\t\t * In fact instead of 24-bpp, the bpp parameter is given by the containing packet.\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer->lengthXorMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = (7 + pointer->xorBpp * pointer->width) / 8;\n\t\tscanlineSize = ((scanlineSize + 1) / 2) * 2;\n\n\t\tif (scanlineSize * pointer->height != pointer->lengthXorMask)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"invalid lengthXorMask: width=%\" PRIu32 \" height=%\" PRIu32 \", %\" PRIu32\n\t\t\t \" instead of %\" PRIu32 \"\",\n\t\t\t pointer->width, pointer->height, pointer->lengthXorMask,\n\t\t\t scanlineSize * pointer->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer->xorMaskData, pointer->lengthXorMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer->xorMaskData = newMask;\n\t\tStream_Read(s, pointer->xorMaskData, pointer->lengthXorMask);\n\t}\n\n\tif (pointer->lengthAndMask > 0)\n\t{\n\t\t/**\n\t\t * andMaskData (variable): A variable-length array of bytes. Contains the 1-bpp, bottom-up\n\t\t * AND mask scan-line data. The AND mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 7x7 pixel cursor is being sent, then each scan-line will\n\t\t * consume 2 bytes (7 pixels per scan-line multiplied by 1 bpp, rounded up to the next even\n\t\t * number of bytes).\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer->lengthAndMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = ((7 + pointer->width) / 8);\n\t\tscanlineSize = ((1 + scanlineSize) / 2) * 2;\n\n\t\tif (scanlineSize * pointer->height != pointer->lengthAndMask)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"invalid lengthAndMask: %\" PRIu32 \" instead of %\" PRIu32 \"\",\n\t\t\t pointer->lengthAndMask, scanlineSize * pointer->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer->andMaskData, pointer->lengthAndMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer->andMaskData = newMask;\n\t\tStream_Read(s, pointer->andMaskData, pointer->lengthAndMask);\n\t}\n\n\tif (Stream_GetRemainingLength(s) > 0)\n\t\tStream_Seek_UINT8(s); /* pad (1 byte) */\n\n\treturn TRUE;\nfail:\n\treturn FALSE;\n}",
  21288. "project": "FreeRDP",
  21289. "hash": 319535406616462223397121840258268559891,
  21290. "size": 107,
  21291. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21292. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21293. "target": 0,
  21294. "dataset": "other",
  21295. "idx": 295049
  21296. },
  21297. {
  21298. "func": "static BOOL _update_read_pointer_large(wStream* s, POINTER_LARGE_UPDATE* pointer)\n{\n\tBYTE* newMask;\n\tUINT32 scanlineSize;\n\n\tif (!pointer)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 14)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer->xorBpp);\n\tStream_Read_UINT16(s, pointer->cacheIndex); /* cacheIndex (2 bytes) */\n\tStream_Read_UINT16(s, pointer->hotSpotX); /* xPos (2 bytes) */\n\tStream_Read_UINT16(s, pointer->hotSpotY); /* yPos (2 bytes) */\n\n\tStream_Read_UINT16(s, pointer->width); /* width (2 bytes) */\n\tStream_Read_UINT16(s, pointer->height); /* height (2 bytes) */\n\n\tif ((pointer->width > 384) || (pointer->height > 384))\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer->lengthAndMask); /* lengthAndMask (2 bytes) */\n\tStream_Read_UINT16(s, pointer->lengthXorMask); /* lengthXorMask (2 bytes) */\n\n\tif (pointer->hotSpotX >= pointer->width)\n\t\tpointer->hotSpotX = 0;\n\n\tif (pointer->hotSpotY >= pointer->height)\n\t\tpointer->hotSpotY = 0;\n\n\tif (pointer->lengthXorMask > 0)\n\t{\n\t\t/**\n\t\t * Spec states that:\n\t\t *\n\t\t * xorMaskData (variable): A variable-length array of bytes. Contains the 24-bpp, bottom-up\n\t\t * XOR mask scan-line data. The XOR mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 3x3 pixel cursor is being sent, then each scan-line will\n\t\t * consume 10 bytes (3 pixels per scan-line multiplied by 3 bytes per pixel, rounded up to\n\t\t * the next even number of bytes).\n\t\t *\n\t\t * In fact instead of 24-bpp, the bpp parameter is given by the containing packet.\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer->lengthXorMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = (7 + pointer->xorBpp * pointer->width) / 8;\n\t\tscanlineSize = ((scanlineSize + 1) / 2) * 2;\n\n\t\tif (scanlineSize * pointer->height != pointer->lengthXorMask)\n\t\t{\n\t\t\tWLog_ERR(TAG,\n\t\t\t \"invalid lengthXorMask: width=%\" PRIu32 \" height=%\" PRIu32 \", %\" PRIu32\n\t\t\t \" instead of %\" PRIu32 \"\",\n\t\t\t pointer->width, pointer->height, pointer->lengthXorMask,\n\t\t\t scanlineSize * pointer->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer->xorMaskData, pointer->lengthXorMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer->xorMaskData = newMask;\n\t\tStream_Read(s, pointer->xorMaskData, pointer->lengthXorMask);\n\t}\n\n\tif (pointer->lengthAndMask > 0)\n\t{\n\t\t/**\n\t\t * andMaskData (variable): A variable-length array of bytes. Contains the 1-bpp, bottom-up\n\t\t * AND mask scan-line data. The AND mask is padded to a 2-byte boundary for each encoded\n\t\t * scan-line. For example, if a 7x7 pixel cursor is being sent, then each scan-line will\n\t\t * consume 2 bytes (7 pixels per scan-line multiplied by 1 bpp, rounded up to the next even\n\t\t * number of bytes).\n\t\t */\n\t\tif (Stream_GetRemainingLength(s) < pointer->lengthAndMask)\n\t\t\tgoto fail;\n\n\t\tscanlineSize = ((7 + pointer->width) / 8);\n\t\tscanlineSize = ((1 + scanlineSize) / 2) * 2;\n\n\t\tif (scanlineSize * pointer->height != pointer->lengthAndMask)\n\t\t{\n\t\t\tWLog_ERR(TAG, \"invalid lengthAndMask: %\" PRIu32 \" instead of %\" PRIu32 \"\",\n\t\t\t pointer->lengthAndMask, scanlineSize * pointer->height);\n\t\t\tgoto fail;\n\t\t}\n\n\t\tnewMask = realloc(pointer->andMaskData, pointer->lengthAndMask);\n\n\t\tif (!newMask)\n\t\t\tgoto fail;\n\n\t\tpointer->andMaskData = newMask;\n\t\tStream_Read(s, pointer->andMaskData, pointer->lengthAndMask);\n\t}\n\n\tif (Stream_GetRemainingLength(s) > 0)\n\t\tStream_Seek_UINT8(s); /* pad (1 byte) */\n\n\treturn TRUE;\nfail:\n\treturn FALSE;\n}",
  21299. "project": "FreeRDP",
  21300. "hash": 221124485378056389358821967616984676233,
  21301. "size": 107,
  21302. "commit_id": "f8890a645c221823ac133dbf991f8a65ae50d637",
  21303. "message": "Fixed #6005: Bounds checks in update_read_bitmap_data",
  21304. "target": 0,
  21305. "dataset": "other",
  21306. "idx": 340398
  21307. },
  21308. {
  21309. "func": "POINTER_POSITION_UPDATE* update_read_pointer_position(rdpUpdate* update, wStream* s)\n{\n\tPOINTER_POSITION_UPDATE* pointer_position = calloc(1, sizeof(POINTER_POSITION_UPDATE));\n\n\tif (!pointer_position)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 4)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer_position->xPos); /* xPos (2 bytes) */\n\tStream_Read_UINT16(s, pointer_position->yPos); /* yPos (2 bytes) */\n\treturn pointer_position;\nfail:\n\tfree_pointer_position_update(update->context, pointer_position);\n\treturn NULL;\n}",
  21310. "project": "FreeRDP",
  21311. "hash": 339533881186737758202422083886699244369,
  21312. "size": 17,
  21313. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21314. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21315. "target": 0,
  21316. "dataset": "other",
  21317. "idx": 295035
  21318. },
  21319. {
  21320. "func": "POINTER_NEW_UPDATE* update_read_pointer_new(rdpUpdate* update, wStream* s)\n{\n\tPOINTER_NEW_UPDATE* pointer_new = calloc(1, sizeof(POINTER_NEW_UPDATE));\n\n\tif (!pointer_new)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */\n\n\tif ((pointer_new->xorBpp < 1) || (pointer_new->xorBpp > 32))\n\t{\n\t\tWLog_ERR(TAG, \"invalid xorBpp %\" PRIu32 \"\", pointer_new->xorBpp);\n\t\tgoto fail;\n\t}\n\n\tif (!_update_read_pointer_color(s, &pointer_new->colorPtrAttr, pointer_new->xorBpp,\n\t update->context->settings->LargePointerFlag)) /* colorPtrAttr */\n\t\tgoto fail;\n\n\treturn pointer_new;\nfail:\n\tfree_pointer_new_update(update->context, pointer_new);\n\treturn NULL;\n}",
  21321. "project": "FreeRDP",
  21322. "hash": 214889354523854541641994285740418737374,
  21323. "size": 27,
  21324. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  21325. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  21326. "target": 0,
  21327. "dataset": "other",
  21328. "idx": 295069
  21329. },
  21330. {
  21331. "func": "POINTER_NEW_UPDATE* update_read_pointer_new(rdpUpdate* update, wStream* s)\n{\n\tPOINTER_NEW_UPDATE* pointer_new = calloc(1, sizeof(POINTER_NEW_UPDATE));\n\n\tif (!pointer_new)\n\t\tgoto fail;\n\n\tif (Stream_GetRemainingLength(s) < 2)\n\t\tgoto fail;\n\n\tStream_Read_UINT16(s, pointer_new->xorBpp); /* xorBpp (2 bytes) */\n\n\tif ((pointer_new->xorBpp < 1) || (pointer_new->xorBpp > 32))\n\t{\n\t\tWLog_ERR(TAG, \"invalid xorBpp %\" PRIu32 \"\", pointer_new->xorBpp);\n\t\tgoto fail;\n\t}\n\n\tif (!_update_read_pointer_color(s, &pointer_new->colorPtrAttr,\n\t pointer_new->xorBpp)) /* colorPtrAttr */\n\t\tgoto fail;\n\n\treturn pointer_new;\nfail:\n\tfree_pointer_new_update(update->context, pointer_new);\n\treturn NULL;\n}",
  21332. "project": "FreeRDP",
  21333. "hash": 277013815797761157077891468632580336753,
  21334. "size": 27,
  21335. "commit_id": "f8890a645c221823ac133dbf991f8a65ae50d637",
  21336. "message": "Fixed #6005: Bounds checks in update_read_bitmap_data",
  21337. "target": 0,
  21338. "dataset": "other",
  21339. "idx": 340399
  21340. }
  21341. ]
  21342. },
  21343. {
  21344. "call_depth": 3,
  21345. "longest_call_chain": [
  21346. "opj_j2k_setup_encoder",
  21347. "opj_j2k_set_imf_parameters",
  21348. "opj_j2k_get_imf_max_NL"
  21349. ],
  21350. "group_size": 9,
  21351. "functions": [
  21352. {
  21353. "func": "static int opj_j2k_initialise_4K_poc(opj_poc_t *POC, int numres)\n{\n POC[0].tile = 1;\n POC[0].resno0 = 0;\n POC[0].compno0 = 0;\n POC[0].layno1 = 1;\n POC[0].resno1 = (OPJ_UINT32)(numres - 1);\n POC[0].compno1 = 3;\n POC[0].prg1 = OPJ_CPRL;\n POC[1].tile = 1;\n POC[1].resno0 = (OPJ_UINT32)(numres - 1);\n POC[1].compno0 = 0;\n POC[1].layno1 = 1;\n POC[1].resno1 = (OPJ_UINT32)numres;\n POC[1].compno1 = 3;\n POC[1].prg1 = OPJ_CPRL;\n return 2;\n}",
  21354. "project": "openjpeg",
  21355. "hash": 328152533937005882107425666048707342819,
  21356. "size": 18,
  21357. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21358. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21359. "target": 0,
  21360. "dataset": "other",
  21361. "idx": 357282
  21362. },
  21363. {
  21364. "func": "static OPJ_BOOL opj_j2k_is_imf_compliant(opj_cparameters_t *parameters,\n opj_image_t *image,\n opj_event_mgr_t *p_manager)\n{\n OPJ_UINT32 i;\n const OPJ_UINT16 rsiz = parameters->rsiz;\n const OPJ_UINT16 profile = OPJ_GET_IMF_PROFILE(rsiz);\n const OPJ_UINT16 mainlevel = OPJ_GET_IMF_MAINLEVEL(rsiz);\n const OPJ_UINT16 sublevel = OPJ_GET_IMF_SUBLEVEL(rsiz);\n const int NL = parameters->numresolution - 1;\n const OPJ_UINT32 XTsiz = parameters->tile_size_on ? (OPJ_UINT32)\n parameters->cp_tdx : image->x1;\n OPJ_BOOL ret = OPJ_TRUE;\n\n /* Validate mainlevel */\n if (mainlevel > OPJ_IMF_MAINLEVEL_MAX) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profile require mainlevel <= 11.\\n\"\n \"-> %d is thus not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n mainlevel);\n ret = OPJ_FALSE;\n }\n\n /* Validate sublevel */\n assert(sizeof(tabMaxSubLevelFromMainLevel) ==\n (OPJ_IMF_MAINLEVEL_MAX + 1) * sizeof(tabMaxSubLevelFromMainLevel[0]));\n if (sublevel > tabMaxSubLevelFromMainLevel[mainlevel]) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profile require sublevel <= %d for mainlevel = %d.\\n\"\n \"-> %d is thus not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n tabMaxSubLevelFromMainLevel[mainlevel],\n mainlevel,\n sublevel);\n ret = OPJ_FALSE;\n }\n\n /* Number of components */\n if (image->numcomps > 3) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require at most 3 components.\\n\"\n \"-> Number of components of input image (%d) is not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->numcomps);\n ret = OPJ_FALSE;\n }\n\n if (image->x0 != 0 || image->y0 != 0) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require image origin to be at 0,0.\\n\"\n \"-> %d,%d is not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->x0, image->y0 != 0);\n ret = OPJ_FALSE;\n }\n\n if (parameters->cp_tx0 != 0 || parameters->cp_ty0 != 0) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require tile origin to be at 0,0.\\n\"\n \"-> %d,%d is not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->cp_tx0, parameters->cp_ty0);\n ret = OPJ_FALSE;\n }\n\n if (parameters->tile_size_on) {\n if (profile == OPJ_PROFILE_IMF_2K ||\n profile == OPJ_PROFILE_IMF_4K ||\n profile == OPJ_PROFILE_IMF_8K) {\n if ((OPJ_UINT32)parameters->cp_tdx < image->x1 ||\n (OPJ_UINT32)parameters->cp_tdy < image->y1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K/4K/8K single tile profiles require tile to be greater or equal to image size.\\n\"\n \"-> %d,%d is lesser than %d,%d\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->cp_tdx,\n parameters->cp_tdy,\n image->x1,\n image->y1);\n ret = OPJ_FALSE;\n }\n } else {\n if ((OPJ_UINT32)parameters->cp_tdx >= image->x1 &&\n (OPJ_UINT32)parameters->cp_tdy >= image->y1) {\n /* ok */\n } else if (parameters->cp_tdx == 1024 &&\n parameters->cp_tdy == 1024) {\n /* ok */\n } else if (parameters->cp_tdx == 2048 &&\n parameters->cp_tdy == 2048 &&\n (profile == OPJ_PROFILE_IMF_4K ||\n profile == OPJ_PROFILE_IMF_8K)) {\n /* ok */\n } else if (parameters->cp_tdx == 4096 &&\n parameters->cp_tdy == 4096 &&\n profile == OPJ_PROFILE_IMF_8K) {\n /* ok */\n } else {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K_R/4K_R/8K_R single/multiple tile profiles \"\n \"require tile to be greater or equal to image size,\\n\"\n \"or to be (1024,1024), or (2048,2048) for 4K_R/8K_R \"\n \"or (4096,4096) for 8K_R.\\n\"\n \"-> %d,%d is non conformant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->cp_tdx,\n parameters->cp_tdy);\n ret = OPJ_FALSE;\n }\n }\n }\n\n /* Bitdepth */\n for (i = 0; i < image->numcomps; i++) {\n if (!(image->comps[i].bpp >= 8 && image->comps[i].bpp <= 16) ||\n (image->comps[i].sgnd)) {\n char signed_str[] = \"signed\";\n char unsigned_str[] = \"unsigned\";\n char *tmp_str = image->comps[i].sgnd ? signed_str : unsigned_str;\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require precision of each component to b in [8-16] bits unsigned\"\n \"-> At least component %d of input image (%d bits, %s) is not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n i, image->comps[i].bpp, tmp_str);\n ret = OPJ_FALSE;\n }\n }\n\n /* Sub-sampling */\n for (i = 0; i < image->numcomps; i++) {\n if (i == 0 && image->comps[i].dx != 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require XRSiz1 == 1. Here it is set to %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->comps[i].dx);\n ret = OPJ_FALSE;\n }\n if (i == 1 && image->comps[i].dx != 1 && image->comps[i].dx != 2) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require XRSiz2 == 1 or 2. Here it is set to %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->comps[i].dx);\n ret = OPJ_FALSE;\n }\n if (i > 1 && image->comps[i].dx != image->comps[i - 1].dx) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require XRSiz%d to be the same as XRSiz2. \"\n \"Here it is set to %d instead of %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n i + 1, image->comps[i].dx, image->comps[i - 1].dx);\n ret = OPJ_FALSE;\n }\n if (image->comps[i].dy != 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require YRsiz == 1. \"\n \"Here it is set to %d for component i.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->comps[i].dy, i);\n ret = OPJ_FALSE;\n }\n }\n\n /* Image size */\n switch (profile) {\n case OPJ_PROFILE_IMF_2K:\n case OPJ_PROFILE_IMF_2K_R:\n if (((image->comps[0].w > 2048) | (image->comps[0].h > 1556))) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K/2K_R profile require:\\n\"\n \"width <= 2048 and height <= 1556\\n\"\n \"-> Input image size %d x %d is not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->comps[0].w, image->comps[0].h);\n ret = OPJ_FALSE;\n }\n break;\n case OPJ_PROFILE_IMF_4K:\n case OPJ_PROFILE_IMF_4K_R:\n if (((image->comps[0].w > 4096) | (image->comps[0].h > 3112))) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K/4K_R profile require:\\n\"\n \"width <= 4096 and height <= 3112\\n\"\n \"-> Input image size %d x %d is not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->comps[0].w, image->comps[0].h);\n ret = OPJ_FALSE;\n }\n break;\n case OPJ_PROFILE_IMF_8K:\n case OPJ_PROFILE_IMF_8K_R:\n if (((image->comps[0].w > 8192) | (image->comps[0].h > 6224))) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 8K/8K_R profile require:\\n\"\n \"width <= 8192 and height <= 6224\\n\"\n \"-> Input image size %d x %d is not compliant\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n image->comps[0].w, image->comps[0].h);\n ret = OPJ_FALSE;\n }\n break;\n default :\n assert(0);\n return OPJ_FALSE;\n }\n\n if (parameters->roi_compno != -1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profile forbid RGN / region of interest marker.\\n\"\n \"-> Compression parameters specify a ROI\\n\"\n \"-> Non-IMF codestream will be generated\\n\");\n ret = OPJ_FALSE;\n }\n\n if (parameters->cblockw_init != 32 || parameters->cblockh_init != 32) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profile require code block size to be 32x32.\\n\"\n \"-> Compression parameters set it to %dx%d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->cblockw_init,\n parameters->cblockh_init);\n ret = OPJ_FALSE;\n }\n\n if (parameters->prog_order != OPJ_CPRL) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profile require progression order to be CPRL.\\n\"\n \"-> Compression parameters set it to %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->prog_order);\n ret = OPJ_FALSE;\n }\n\n if (parameters->numpocs != 0) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profile forbid POC markers.\\n\"\n \"-> Compression parameters set %d POC.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->numpocs);\n ret = OPJ_FALSE;\n }\n\n /* Codeblock style: no mode switch enabled */\n if (parameters->mode != 0) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profile forbid mode switch in code block style.\\n\"\n \"-> Compression parameters set code block style to %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->mode);\n ret = OPJ_FALSE;\n }\n\n if (profile == OPJ_PROFILE_IMF_2K ||\n profile == OPJ_PROFILE_IMF_4K ||\n profile == OPJ_PROFILE_IMF_8K) {\n /* Expect 9-7 transform */\n if (parameters->irreversible != 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K/4K/8K profiles require 9-7 Irreversible Transform.\\n\"\n \"-> Compression parameters set it to reversible.\\n\"\n \"-> Non-IMF codestream will be generated\\n\");\n ret = OPJ_FALSE;\n }\n } else {\n /* Expect 5-3 transform */\n if (parameters->irreversible != 0) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K/4K/8K profiles require 5-3 reversible Transform.\\n\"\n \"-> Compression parameters set it to irreversible.\\n\"\n \"-> Non-IMF codestream will be generated\\n\");\n ret = OPJ_FALSE;\n }\n }\n\n /* Number of layers */\n if (parameters->tcp_numlayers != 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K/4K/8K profiles require 1 single quality layer.\\n\"\n \"-> Number of layers is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n parameters->tcp_numlayers);\n ret = OPJ_FALSE;\n }\n\n /* Decomposition levels */\n switch (profile) {\n case OPJ_PROFILE_IMF_2K:\n if (!(NL >= 1 && NL <= 5)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K profile requires 1 <= NL <= 5:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n break;\n case OPJ_PROFILE_IMF_4K:\n if (!(NL >= 1 && NL <= 6)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K profile requires 1 <= NL <= 6:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n break;\n case OPJ_PROFILE_IMF_8K:\n if (!(NL >= 1 && NL <= 7)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 8K profile requires 1 <= NL <= 7:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n break;\n case OPJ_PROFILE_IMF_2K_R: {\n if (XTsiz >= 2048) {\n if (!(NL >= 1 && NL <= 5)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K_R profile requires 1 <= NL <= 5 for XTsiz >= 2048:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n } else if (XTsiz >= 1024) {\n if (!(NL >= 1 && NL <= 4)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 2K_R profile requires 1 <= NL <= 4 for XTsiz in [1024,2048[:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n }\n break;\n }\n case OPJ_PROFILE_IMF_4K_R: {\n if (XTsiz >= 4096) {\n if (!(NL >= 1 && NL <= 6)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K_R profile requires 1 <= NL <= 6 for XTsiz >= 4096:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n } else if (XTsiz >= 2048) {\n if (!(NL >= 1 && NL <= 5)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K_R profile requires 1 <= NL <= 5 for XTsiz in [2048,4096[:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n } else if (XTsiz >= 1024) {\n if (!(NL >= 1 && NL <= 4)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K_R profile requires 1 <= NL <= 4 for XTsiz in [1024,2048[:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n }\n break;\n }\n case OPJ_PROFILE_IMF_8K_R: {\n if (XTsiz >= 8192) {\n if (!(NL >= 1 && NL <= 7)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K_R profile requires 1 <= NL <= 7 for XTsiz >= 8192:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n } else if (XTsiz >= 4096) {\n if (!(NL >= 1 && NL <= 6)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K_R profile requires 1 <= NL <= 6 for XTsiz in [4096,8192[:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n } else if (XTsiz >= 2048) {\n if (!(NL >= 1 && NL <= 5)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K_R profile requires 1 <= NL <= 5 for XTsiz in [2048,4096[:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n } else if (XTsiz >= 1024) {\n if (!(NL >= 1 && NL <= 4)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF 4K_R profile requires 1 <= NL <= 4 for XTsiz in [1024,2048[:\\n\"\n \"-> Number of decomposition levels is %d.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n }\n break;\n }\n default:\n break;\n }\n\n if (parameters->numresolution == 1) {\n if (parameters->res_spec != 1 ||\n parameters->prcw_init[0] != 128 ||\n parameters->prch_init[0] != 128) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require PPx = PPy = 7 for NLLL band, else 8.\\n\"\n \"-> Supplied values are different from that.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n } else {\n int i;\n for (i = 0; i < parameters->res_spec; i++) {\n if (parameters->prcw_init[i] != 256 ||\n parameters->prch_init[i] != 256) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"IMF profiles require PPx = PPy = 7 for NLLL band, else 8.\\n\"\n \"-> Supplied values are different from that.\\n\"\n \"-> Non-IMF codestream will be generated\\n\",\n NL);\n ret = OPJ_FALSE;\n }\n }\n }\n\n return ret;\n}",
  21365. "project": "openjpeg",
  21366. "hash": 247621853903973910621601863312658855615,
  21367. "size": 441,
  21368. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21369. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21370. "target": 0,
  21371. "dataset": "other",
  21372. "idx": 357296
  21373. },
  21374. {
  21375. "func": "OPJ_BOOL opj_j2k_setup_encoder(opj_j2k_t *p_j2k,\n opj_cparameters_t *parameters,\n opj_image_t *image,\n opj_event_mgr_t * p_manager)\n{\n OPJ_UINT32 i, j, tileno, numpocs_tile;\n opj_cp_t *cp = 00;\n OPJ_UINT32 cblkw, cblkh;\n\n if (!p_j2k || !parameters || ! image) {\n return OPJ_FALSE;\n }\n\n if ((parameters->numresolution <= 0) ||\n (parameters->numresolution > OPJ_J2K_MAXRLVLS)) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Invalid number of resolutions : %d not in range [1,%d]\\n\",\n parameters->numresolution, OPJ_J2K_MAXRLVLS);\n return OPJ_FALSE;\n }\n\n if (parameters->cblockw_init < 4 || parameters->cblockw_init > 1024) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Invalid value for cblockw_init: %d not a power of 2 in range [4,1024]\\n\",\n parameters->cblockw_init);\n return OPJ_FALSE;\n }\n if (parameters->cblockh_init < 4 || parameters->cblockh_init > 1024) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Invalid value for cblockh_init: %d not a power of 2 not in range [4,1024]\\n\",\n parameters->cblockh_init);\n return OPJ_FALSE;\n }\n if (parameters->cblockw_init * parameters->cblockh_init > 4096) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Invalid value for cblockw_init * cblockh_init: should be <= 4096\\n\");\n return OPJ_FALSE;\n }\n cblkw = (OPJ_UINT32)opj_int_floorlog2(parameters->cblockw_init);\n cblkh = (OPJ_UINT32)opj_int_floorlog2(parameters->cblockh_init);\n if (parameters->cblockw_init != (1 << cblkw)) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Invalid value for cblockw_init: %d not a power of 2 in range [4,1024]\\n\",\n parameters->cblockw_init);\n return OPJ_FALSE;\n }\n if (parameters->cblockh_init != (1 << cblkh)) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Invalid value for cblockw_init: %d not a power of 2 in range [4,1024]\\n\",\n parameters->cblockh_init);\n return OPJ_FALSE;\n }\n\n /* keep a link to cp so that we can destroy it later in j2k_destroy_compress */\n cp = &(p_j2k->m_cp);\n\n /* set default values for cp */\n cp->tw = 1;\n cp->th = 1;\n\n /* FIXME ADE: to be removed once deprecated cp_cinema and cp_rsiz have been removed */\n if (parameters->rsiz ==\n OPJ_PROFILE_NONE) { /* consider deprecated fields only if RSIZ has not been set */\n OPJ_BOOL deprecated_used = OPJ_FALSE;\n switch (parameters->cp_cinema) {\n case OPJ_CINEMA2K_24:\n parameters->rsiz = OPJ_PROFILE_CINEMA_2K;\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n deprecated_used = OPJ_TRUE;\n break;\n case OPJ_CINEMA2K_48:\n parameters->rsiz = OPJ_PROFILE_CINEMA_2K;\n parameters->max_cs_size = OPJ_CINEMA_48_CS;\n parameters->max_comp_size = OPJ_CINEMA_48_COMP;\n deprecated_used = OPJ_TRUE;\n break;\n case OPJ_CINEMA4K_24:\n parameters->rsiz = OPJ_PROFILE_CINEMA_4K;\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n deprecated_used = OPJ_TRUE;\n break;\n case OPJ_OFF:\n default:\n break;\n }\n switch (parameters->cp_rsiz) {\n case OPJ_CINEMA2K:\n parameters->rsiz = OPJ_PROFILE_CINEMA_2K;\n deprecated_used = OPJ_TRUE;\n break;\n case OPJ_CINEMA4K:\n parameters->rsiz = OPJ_PROFILE_CINEMA_4K;\n deprecated_used = OPJ_TRUE;\n break;\n case OPJ_MCT:\n parameters->rsiz = OPJ_PROFILE_PART2 | OPJ_EXTENSION_MCT;\n deprecated_used = OPJ_TRUE;\n case OPJ_STD_RSIZ:\n default:\n break;\n }\n if (deprecated_used) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"Deprecated fields cp_cinema or cp_rsiz are used\\n\"\n \"Please consider using only the rsiz field\\n\"\n \"See openjpeg.h documentation for more details\\n\");\n }\n }\n\n /* If no explicit layers are provided, use lossless settings */\n if (parameters->tcp_numlayers == 0) {\n parameters->tcp_numlayers = 1;\n parameters->cp_disto_alloc = 1;\n parameters->tcp_rates[0] = 0;\n }\n\n if (parameters->cp_disto_alloc) {\n /* Emit warnings if tcp_rates are not decreasing */\n for (i = 1; i < (OPJ_UINT32) parameters->tcp_numlayers; i++) {\n OPJ_FLOAT32 rate_i_corr = parameters->tcp_rates[i];\n OPJ_FLOAT32 rate_i_m_1_corr = parameters->tcp_rates[i - 1];\n if (rate_i_corr <= 1.0) {\n rate_i_corr = 1.0;\n }\n if (rate_i_m_1_corr <= 1.0) {\n rate_i_m_1_corr = 1.0;\n }\n if (rate_i_corr >= rate_i_m_1_corr) {\n if (rate_i_corr != parameters->tcp_rates[i] &&\n rate_i_m_1_corr != parameters->tcp_rates[i - 1]) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"tcp_rates[%d]=%f (corrected as %f) should be strictly lesser \"\n \"than tcp_rates[%d]=%f (corrected as %f)\\n\",\n i, parameters->tcp_rates[i], rate_i_corr,\n i - 1, parameters->tcp_rates[i - 1], rate_i_m_1_corr);\n } else if (rate_i_corr != parameters->tcp_rates[i]) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"tcp_rates[%d]=%f (corrected as %f) should be strictly lesser \"\n \"than tcp_rates[%d]=%f\\n\",\n i, parameters->tcp_rates[i], rate_i_corr,\n i - 1, parameters->tcp_rates[i - 1]);\n } else if (rate_i_m_1_corr != parameters->tcp_rates[i - 1]) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"tcp_rates[%d]=%f should be strictly lesser \"\n \"than tcp_rates[%d]=%f (corrected as %f)\\n\",\n i, parameters->tcp_rates[i],\n i - 1, parameters->tcp_rates[i - 1], rate_i_m_1_corr);\n } else {\n opj_event_msg(p_manager, EVT_WARNING,\n \"tcp_rates[%d]=%f should be strictly lesser \"\n \"than tcp_rates[%d]=%f\\n\",\n i, parameters->tcp_rates[i],\n i - 1, parameters->tcp_rates[i - 1]);\n }\n }\n }\n } else if (parameters->cp_fixed_quality) {\n /* Emit warnings if tcp_distoratio are not increasing */\n for (i = 1; i < (OPJ_UINT32) parameters->tcp_numlayers; i++) {\n if (parameters->tcp_distoratio[i] < parameters->tcp_distoratio[i - 1] &&\n !(i == (OPJ_UINT32)parameters->tcp_numlayers - 1 &&\n parameters->tcp_distoratio[i] == 0)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"tcp_distoratio[%d]=%f should be strictly greater \"\n \"than tcp_distoratio[%d]=%f\\n\",\n i, parameters->tcp_distoratio[i], i - 1,\n parameters->tcp_distoratio[i - 1]);\n }\n }\n }\n\n /* see if max_codestream_size does limit input rate */\n if (parameters->max_cs_size <= 0) {\n if (parameters->tcp_rates[parameters->tcp_numlayers - 1] > 0) {\n OPJ_FLOAT32 temp_size;\n temp_size = (OPJ_FLOAT32)(((double)image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n ((double)parameters->tcp_rates[parameters->tcp_numlayers - 1] * 8 *\n image->comps[0].dx * image->comps[0].dy));\n if (temp_size > INT_MAX) {\n parameters->max_cs_size = INT_MAX;\n } else {\n parameters->max_cs_size = (int) floor(temp_size);\n }\n } else {\n parameters->max_cs_size = 0;\n }\n } else {\n OPJ_FLOAT32 temp_rate;\n OPJ_BOOL cap = OPJ_FALSE;\n\n if (OPJ_IS_IMF(parameters->rsiz) && parameters->max_cs_size > 0 &&\n parameters->tcp_numlayers == 1 && parameters->tcp_rates[0] == 0) {\n parameters->tcp_rates[0] = (OPJ_FLOAT32)(image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n (OPJ_FLOAT32)(((OPJ_UINT32)parameters->max_cs_size) * 8 * image->comps[0].dx *\n image->comps[0].dy);\n }\n\n temp_rate = (OPJ_FLOAT32)(((double)image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n (((double)parameters->max_cs_size) * 8 * image->comps[0].dx *\n image->comps[0].dy));\n for (i = 0; i < (OPJ_UINT32) parameters->tcp_numlayers; i++) {\n if (parameters->tcp_rates[i] < temp_rate) {\n parameters->tcp_rates[i] = temp_rate;\n cap = OPJ_TRUE;\n }\n }\n if (cap) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"The desired maximum codestream size has limited\\n\"\n \"at least one of the desired quality layers\\n\");\n }\n }\n\n /* Manage profiles and applications and set RSIZ */\n /* set cinema parameters if required */\n if (OPJ_IS_CINEMA(parameters->rsiz)) {\n if ((parameters->rsiz == OPJ_PROFILE_CINEMA_S2K)\n || (parameters->rsiz == OPJ_PROFILE_CINEMA_S4K)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Scalable Digital Cinema profiles not yet supported\\n\");\n parameters->rsiz = OPJ_PROFILE_NONE;\n } else {\n opj_j2k_set_cinema_parameters(parameters, image, p_manager);\n if (!opj_j2k_is_cinema_compliant(image, parameters->rsiz, p_manager)) {\n parameters->rsiz = OPJ_PROFILE_NONE;\n }\n }\n } else if (OPJ_IS_STORAGE(parameters->rsiz)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Long Term Storage profile not yet supported\\n\");\n parameters->rsiz = OPJ_PROFILE_NONE;\n } else if (OPJ_IS_BROADCAST(parameters->rsiz)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Broadcast profiles not yet supported\\n\");\n parameters->rsiz = OPJ_PROFILE_NONE;\n } else if (OPJ_IS_IMF(parameters->rsiz)) {\n opj_j2k_set_imf_parameters(parameters, image, p_manager);\n if (!opj_j2k_is_imf_compliant(parameters, image, p_manager)) {\n parameters->rsiz = OPJ_PROFILE_NONE;\n }\n } else if (OPJ_IS_PART2(parameters->rsiz)) {\n if (parameters->rsiz == ((OPJ_PROFILE_PART2) | (OPJ_EXTENSION_NONE))) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Part-2 profile defined\\n\"\n \"but no Part-2 extension enabled.\\n\"\n \"Profile set to NONE.\\n\");\n parameters->rsiz = OPJ_PROFILE_NONE;\n } else if (parameters->rsiz != ((OPJ_PROFILE_PART2) | (OPJ_EXTENSION_MCT))) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"Unsupported Part-2 extension enabled\\n\"\n \"Profile set to NONE.\\n\");\n parameters->rsiz = OPJ_PROFILE_NONE;\n }\n }\n\n /*\n copy user encoding parameters\n */\n cp->m_specific_param.m_enc.m_max_comp_size = (OPJ_UINT32)\n parameters->max_comp_size;\n cp->rsiz = parameters->rsiz;\n cp->m_specific_param.m_enc.m_disto_alloc = (OPJ_UINT32)\n parameters->cp_disto_alloc & 1u;\n cp->m_specific_param.m_enc.m_fixed_alloc = (OPJ_UINT32)\n parameters->cp_fixed_alloc & 1u;\n cp->m_specific_param.m_enc.m_fixed_quality = (OPJ_UINT32)\n parameters->cp_fixed_quality & 1u;\n\n /* mod fixed_quality */\n if (parameters->cp_fixed_alloc && parameters->cp_matrice) {\n size_t array_size = (size_t)parameters->tcp_numlayers *\n (size_t)parameters->numresolution * 3 * sizeof(OPJ_INT32);\n cp->m_specific_param.m_enc.m_matrice = (OPJ_INT32 *) opj_malloc(array_size);\n if (!cp->m_specific_param.m_enc.m_matrice) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate copy of user encoding parameters matrix \\n\");\n return OPJ_FALSE;\n }\n memcpy(cp->m_specific_param.m_enc.m_matrice, parameters->cp_matrice,\n array_size);\n }\n\n /* tiles */\n cp->tdx = (OPJ_UINT32)parameters->cp_tdx;\n cp->tdy = (OPJ_UINT32)parameters->cp_tdy;\n\n /* tile offset */\n cp->tx0 = (OPJ_UINT32)parameters->cp_tx0;\n cp->ty0 = (OPJ_UINT32)parameters->cp_ty0;\n\n /* comment string */\n if (parameters->cp_comment) {\n cp->comment = (char*)opj_malloc(strlen(parameters->cp_comment) + 1U);\n if (!cp->comment) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate copy of comment string\\n\");\n return OPJ_FALSE;\n }\n strcpy(cp->comment, parameters->cp_comment);\n } else {\n /* Create default comment for codestream */\n const char comment[] = \"Created by OpenJPEG version \";\n const size_t clen = strlen(comment);\n const char *version = opj_version();\n\n /* UniPG>> */\n#ifdef USE_JPWL\n cp->comment = (char*)opj_malloc(clen + strlen(version) + 11);\n if (!cp->comment) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate comment string\\n\");\n return OPJ_FALSE;\n }\n sprintf(cp->comment, \"%s%s with JPWL\", comment, version);\n#else\n cp->comment = (char*)opj_malloc(clen + strlen(version) + 1);\n if (!cp->comment) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate comment string\\n\");\n return OPJ_FALSE;\n }\n sprintf(cp->comment, \"%s%s\", comment, version);\n#endif\n /* <<UniPG */\n }\n\n /*\n calculate other encoding parameters\n */\n\n if (parameters->tile_size_on) {\n if (cp->tdx == 0) {\n opj_event_msg(p_manager, EVT_ERROR, \"Invalid tile width\\n\");\n return OPJ_FALSE;\n }\n if (cp->tdy == 0) {\n opj_event_msg(p_manager, EVT_ERROR, \"Invalid tile height\\n\");\n return OPJ_FALSE;\n }\n cp->tw = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->x1 - cp->tx0),\n (OPJ_INT32)cp->tdx);\n cp->th = (OPJ_UINT32)opj_int_ceildiv((OPJ_INT32)(image->y1 - cp->ty0),\n (OPJ_INT32)cp->tdy);\n } else {\n cp->tdx = image->x1 - cp->tx0;\n cp->tdy = image->y1 - cp->ty0;\n }\n\n if (parameters->tp_on) {\n cp->m_specific_param.m_enc.m_tp_flag = (OPJ_BYTE)parameters->tp_flag;\n cp->m_specific_param.m_enc.m_tp_on = 1;\n }\n\n#ifdef USE_JPWL\n /*\n calculate JPWL encoding parameters\n */\n\n if (parameters->jpwl_epc_on) {\n OPJ_INT32 i;\n\n /* set JPWL on */\n cp->epc_on = OPJ_TRUE;\n cp->info_on = OPJ_FALSE; /* no informative technique */\n\n /* set EPB on */\n if ((parameters->jpwl_hprot_MH > 0) || (parameters->jpwl_hprot_TPH[0] > 0)) {\n cp->epb_on = OPJ_TRUE;\n\n cp->hprot_MH = parameters->jpwl_hprot_MH;\n for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {\n cp->hprot_TPH_tileno[i] = parameters->jpwl_hprot_TPH_tileno[i];\n cp->hprot_TPH[i] = parameters->jpwl_hprot_TPH[i];\n }\n /* if tile specs are not specified, copy MH specs */\n if (cp->hprot_TPH[0] == -1) {\n cp->hprot_TPH_tileno[0] = 0;\n cp->hprot_TPH[0] = parameters->jpwl_hprot_MH;\n }\n for (i = 0; i < JPWL_MAX_NO_PACKSPECS; i++) {\n cp->pprot_tileno[i] = parameters->jpwl_pprot_tileno[i];\n cp->pprot_packno[i] = parameters->jpwl_pprot_packno[i];\n cp->pprot[i] = parameters->jpwl_pprot[i];\n }\n }\n\n /* set ESD writing */\n if ((parameters->jpwl_sens_size == 1) || (parameters->jpwl_sens_size == 2)) {\n cp->esd_on = OPJ_TRUE;\n\n cp->sens_size = parameters->jpwl_sens_size;\n cp->sens_addr = parameters->jpwl_sens_addr;\n cp->sens_range = parameters->jpwl_sens_range;\n\n cp->sens_MH = parameters->jpwl_sens_MH;\n for (i = 0; i < JPWL_MAX_NO_TILESPECS; i++) {\n cp->sens_TPH_tileno[i] = parameters->jpwl_sens_TPH_tileno[i];\n cp->sens_TPH[i] = parameters->jpwl_sens_TPH[i];\n }\n }\n\n /* always set RED writing to false: we are at the encoder */\n cp->red_on = OPJ_FALSE;\n\n } else {\n cp->epc_on = OPJ_FALSE;\n }\n#endif /* USE_JPWL */\n\n /* initialize the mutiple tiles */\n /* ---------------------------- */\n cp->tcps = (opj_tcp_t*) opj_calloc(cp->tw * cp->th, sizeof(opj_tcp_t));\n if (!cp->tcps) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate tile coding parameters\\n\");\n return OPJ_FALSE;\n }\n\n for (tileno = 0; tileno < cp->tw * cp->th; tileno++) {\n opj_tcp_t *tcp = &cp->tcps[tileno];\n tcp->numlayers = (OPJ_UINT32)parameters->tcp_numlayers;\n\n for (j = 0; j < tcp->numlayers; j++) {\n if (OPJ_IS_CINEMA(cp->rsiz) || OPJ_IS_IMF(cp->rsiz)) {\n if (cp->m_specific_param.m_enc.m_fixed_quality) {\n tcp->distoratio[j] = parameters->tcp_distoratio[j];\n }\n tcp->rates[j] = parameters->tcp_rates[j];\n } else {\n if (cp->m_specific_param.m_enc.m_fixed_quality) { /* add fixed_quality */\n tcp->distoratio[j] = parameters->tcp_distoratio[j];\n } else {\n tcp->rates[j] = parameters->tcp_rates[j];\n }\n }\n if (!cp->m_specific_param.m_enc.m_fixed_quality &&\n tcp->rates[j] <= 1.0) {\n tcp->rates[j] = 0.0; /* force lossless */\n }\n }\n\n tcp->csty = (OPJ_UINT32)parameters->csty;\n tcp->prg = parameters->prog_order;\n tcp->mct = (OPJ_UINT32)parameters->tcp_mct;\n\n numpocs_tile = 0;\n tcp->POC = 0;\n\n if (parameters->numpocs) {\n /* initialisation of POC */\n for (i = 0; i < parameters->numpocs; i++) {\n if (tileno + 1 == parameters->POC[i].tile) {\n opj_poc_t *tcp_poc = &tcp->pocs[numpocs_tile];\n\n if (parameters->POC[numpocs_tile].compno0 >= image->numcomps) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Invalid compno0 for POC %d\\n\", i);\n return OPJ_FALSE;\n }\n\n tcp_poc->resno0 = parameters->POC[numpocs_tile].resno0;\n tcp_poc->compno0 = parameters->POC[numpocs_tile].compno0;\n tcp_poc->layno1 = parameters->POC[numpocs_tile].layno1;\n tcp_poc->resno1 = parameters->POC[numpocs_tile].resno1;\n tcp_poc->compno1 = opj_uint_min(parameters->POC[numpocs_tile].compno1,\n image->numcomps);\n tcp_poc->prg1 = parameters->POC[numpocs_tile].prg1;\n tcp_poc->tile = parameters->POC[numpocs_tile].tile;\n\n numpocs_tile++;\n }\n }\n\n if (numpocs_tile) {\n\n /* TODO MSD use the return value*/\n opj_j2k_check_poc_val(parameters->POC, tileno, parameters->numpocs,\n (OPJ_UINT32)parameters->numresolution, image->numcomps,\n (OPJ_UINT32)parameters->tcp_numlayers, p_manager);\n\n tcp->POC = 1;\n tcp->numpocs = numpocs_tile - 1 ;\n }\n } else {\n tcp->numpocs = 0;\n }\n\n tcp->tccps = (opj_tccp_t*) opj_calloc(image->numcomps, sizeof(opj_tccp_t));\n if (!tcp->tccps) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate tile component coding parameters\\n\");\n return OPJ_FALSE;\n }\n if (parameters->mct_data) {\n\n OPJ_UINT32 lMctSize = image->numcomps * image->numcomps * (OPJ_UINT32)sizeof(\n OPJ_FLOAT32);\n OPJ_FLOAT32 * lTmpBuf = (OPJ_FLOAT32*)opj_malloc(lMctSize);\n OPJ_INT32 * l_dc_shift = (OPJ_INT32 *)((OPJ_BYTE *) parameters->mct_data +\n lMctSize);\n\n if (!lTmpBuf) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate temp buffer\\n\");\n return OPJ_FALSE;\n }\n\n tcp->mct = 2;\n tcp->m_mct_coding_matrix = (OPJ_FLOAT32*)opj_malloc(lMctSize);\n if (! tcp->m_mct_coding_matrix) {\n opj_free(lTmpBuf);\n lTmpBuf = NULL;\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate encoder MCT coding matrix \\n\");\n return OPJ_FALSE;\n }\n memcpy(tcp->m_mct_coding_matrix, parameters->mct_data, lMctSize);\n memcpy(lTmpBuf, parameters->mct_data, lMctSize);\n\n tcp->m_mct_decoding_matrix = (OPJ_FLOAT32*)opj_malloc(lMctSize);\n if (! tcp->m_mct_decoding_matrix) {\n opj_free(lTmpBuf);\n lTmpBuf = NULL;\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate encoder MCT decoding matrix \\n\");\n return OPJ_FALSE;\n }\n if (opj_matrix_inversion_f(lTmpBuf, (tcp->m_mct_decoding_matrix),\n image->numcomps) == OPJ_FALSE) {\n opj_free(lTmpBuf);\n lTmpBuf = NULL;\n opj_event_msg(p_manager, EVT_ERROR,\n \"Failed to inverse encoder MCT decoding matrix \\n\");\n return OPJ_FALSE;\n }\n\n tcp->mct_norms = (OPJ_FLOAT64*)\n opj_malloc(image->numcomps * sizeof(OPJ_FLOAT64));\n if (! tcp->mct_norms) {\n opj_free(lTmpBuf);\n lTmpBuf = NULL;\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory to allocate encoder MCT norms \\n\");\n return OPJ_FALSE;\n }\n opj_calculate_norms(tcp->mct_norms, image->numcomps,\n tcp->m_mct_decoding_matrix);\n opj_free(lTmpBuf);\n\n for (i = 0; i < image->numcomps; i++) {\n opj_tccp_t *tccp = &tcp->tccps[i];\n tccp->m_dc_level_shift = l_dc_shift[i];\n }\n\n if (opj_j2k_setup_mct_encoding(tcp, image) == OPJ_FALSE) {\n /* free will be handled by opj_j2k_destroy */\n opj_event_msg(p_manager, EVT_ERROR, \"Failed to setup j2k mct encoding\\n\");\n return OPJ_FALSE;\n }\n } else {\n if (tcp->mct == 1 && image->numcomps >= 3) { /* RGB->YCC MCT is enabled */\n if ((image->comps[0].dx != image->comps[1].dx) ||\n (image->comps[0].dx != image->comps[2].dx) ||\n (image->comps[0].dy != image->comps[1].dy) ||\n (image->comps[0].dy != image->comps[2].dy)) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"Cannot perform MCT on components with different sizes. Disabling MCT.\\n\");\n tcp->mct = 0;\n }\n }\n for (i = 0; i < image->numcomps; i++) {\n opj_tccp_t *tccp = &tcp->tccps[i];\n opj_image_comp_t * l_comp = &(image->comps[i]);\n\n if (! l_comp->sgnd) {\n tccp->m_dc_level_shift = 1 << (l_comp->prec - 1);\n }\n }\n }\n\n for (i = 0; i < image->numcomps; i++) {\n opj_tccp_t *tccp = &tcp->tccps[i];\n\n tccp->csty = parameters->csty &\n 0x01; /* 0 => one precinct || 1 => custom precinct */\n tccp->numresolutions = (OPJ_UINT32)parameters->numresolution;\n tccp->cblkw = (OPJ_UINT32)opj_int_floorlog2(parameters->cblockw_init);\n tccp->cblkh = (OPJ_UINT32)opj_int_floorlog2(parameters->cblockh_init);\n tccp->cblksty = (OPJ_UINT32)parameters->mode;\n tccp->qmfbid = parameters->irreversible ? 0 : 1;\n tccp->qntsty = parameters->irreversible ? J2K_CCP_QNTSTY_SEQNT :\n J2K_CCP_QNTSTY_NOQNT;\n tccp->numgbits = 2;\n\n if ((OPJ_INT32)i == parameters->roi_compno) {\n tccp->roishift = parameters->roi_shift;\n } else {\n tccp->roishift = 0;\n }\n\n if (parameters->csty & J2K_CCP_CSTY_PRT) {\n OPJ_INT32 p = 0, it_res;\n assert(tccp->numresolutions > 0);\n for (it_res = (OPJ_INT32)tccp->numresolutions - 1; it_res >= 0; it_res--) {\n if (p < parameters->res_spec) {\n\n if (parameters->prcw_init[p] < 1) {\n tccp->prcw[it_res] = 1;\n } else {\n tccp->prcw[it_res] = (OPJ_UINT32)opj_int_floorlog2(parameters->prcw_init[p]);\n }\n\n if (parameters->prch_init[p] < 1) {\n tccp->prch[it_res] = 1;\n } else {\n tccp->prch[it_res] = (OPJ_UINT32)opj_int_floorlog2(parameters->prch_init[p]);\n }\n\n } else {\n OPJ_INT32 res_spec = parameters->res_spec;\n OPJ_INT32 size_prcw = 0;\n OPJ_INT32 size_prch = 0;\n\n assert(res_spec > 0); /* issue 189 */\n size_prcw = parameters->prcw_init[res_spec - 1] >> (p - (res_spec - 1));\n size_prch = parameters->prch_init[res_spec - 1] >> (p - (res_spec - 1));\n\n\n if (size_prcw < 1) {\n tccp->prcw[it_res] = 1;\n } else {\n tccp->prcw[it_res] = (OPJ_UINT32)opj_int_floorlog2(size_prcw);\n }\n\n if (size_prch < 1) {\n tccp->prch[it_res] = 1;\n } else {\n tccp->prch[it_res] = (OPJ_UINT32)opj_int_floorlog2(size_prch);\n }\n }\n p++;\n /*printf(\"\\nsize precinct for level %d : %d,%d\\n\", it_res,tccp->prcw[it_res], tccp->prch[it_res]); */\n } /*end for*/\n } else {\n for (j = 0; j < tccp->numresolutions; j++) {\n tccp->prcw[j] = 15;\n tccp->prch[j] = 15;\n }\n }\n\n opj_dwt_calc_explicit_stepsizes(tccp, image->comps[i].prec);\n }\n }\n\n if (parameters->mct_data) {\n opj_free(parameters->mct_data);\n parameters->mct_data = 00;\n }\n return OPJ_TRUE;\n}",
  21376. "project": "openjpeg",
  21377. "hash": 186800795896273863273003403215619007706,
  21378. "size": 665,
  21379. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21380. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21381. "target": 0,
  21382. "dataset": "other",
  21383. "idx": 357290
  21384. },
  21385. {
  21386. "func": "static void opj_j2k_set_cinema_parameters(opj_cparameters_t *parameters,\n opj_image_t *image, opj_event_mgr_t *p_manager)\n{\n /* Configure cinema parameters */\n int i;\n\n /* No tiling */\n parameters->tile_size_on = OPJ_FALSE;\n parameters->cp_tdx = 1;\n parameters->cp_tdy = 1;\n\n /* One tile part for each component */\n parameters->tp_flag = 'C';\n parameters->tp_on = 1;\n\n /* Tile and Image shall be at (0,0) */\n parameters->cp_tx0 = 0;\n parameters->cp_ty0 = 0;\n parameters->image_offset_x0 = 0;\n parameters->image_offset_y0 = 0;\n\n /* Codeblock size= 32*32 */\n parameters->cblockw_init = 32;\n parameters->cblockh_init = 32;\n\n /* Codeblock style: no mode switch enabled */\n parameters->mode = 0;\n\n /* No ROI */\n parameters->roi_compno = -1;\n\n /* No subsampling */\n parameters->subsampling_dx = 1;\n parameters->subsampling_dy = 1;\n\n /* 9-7 transform */\n parameters->irreversible = 1;\n\n /* Number of layers */\n if (parameters->tcp_numlayers > 1) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"1 single quality layer\"\n \"-> Number of layers forced to 1 (rather than %d)\\n\"\n \"-> Rate of the last layer (%3.1f) will be used\",\n parameters->tcp_numlayers,\n parameters->tcp_rates[parameters->tcp_numlayers - 1]);\n parameters->tcp_rates[0] = parameters->tcp_rates[parameters->tcp_numlayers - 1];\n parameters->tcp_numlayers = 1;\n }\n\n /* Resolution levels */\n switch (parameters->rsiz) {\n case OPJ_PROFILE_CINEMA_2K:\n if (parameters->numresolution > 6) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"Number of decomposition levels <= 5\\n\"\n \"-> Number of decomposition levels forced to 5 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 6;\n }\n break;\n case OPJ_PROFILE_CINEMA_4K:\n if (parameters->numresolution < 2) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 1 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 1;\n } else if (parameters->numresolution > 7) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"Number of decomposition levels >= 1 && <= 6\\n\"\n \"-> Number of decomposition levels forced to 6 (rather than %d)\\n\",\n parameters->numresolution + 1);\n parameters->numresolution = 7;\n }\n break;\n default :\n break;\n }\n\n /* Precincts */\n parameters->csty |= J2K_CP_CSTY_PRT;\n if (parameters->numresolution == 1) {\n parameters->res_spec = 1;\n parameters->prcw_init[0] = 128;\n parameters->prch_init[0] = 128;\n } else {\n parameters->res_spec = parameters->numresolution - 1;\n for (i = 0; i < parameters->res_spec; i++) {\n parameters->prcw_init[i] = 256;\n parameters->prch_init[i] = 256;\n }\n }\n\n /* The progression order shall be CPRL */\n parameters->prog_order = OPJ_CPRL;\n\n /* Progression order changes for 4K, disallowed for 2K */\n if (parameters->rsiz == OPJ_PROFILE_CINEMA_4K) {\n parameters->numpocs = (OPJ_UINT32)opj_j2k_initialise_4K_poc(parameters->POC,\n parameters->numresolution);\n } else {\n parameters->numpocs = 0;\n }\n\n /* Limited bit-rate */\n parameters->cp_disto_alloc = 1;\n if (parameters->max_cs_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_cs_size > OPJ_CINEMA_24_CS) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1302083 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1302083 bytes.\\n\");\n parameters->max_cs_size = OPJ_CINEMA_24_CS;\n }\n\n if (parameters->max_comp_size <= 0) {\n /* No rate has been introduced, 24 fps is assumed */\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"As no rate has been given, this limit will be used.\\n\");\n } else if (parameters->max_comp_size > OPJ_CINEMA_24_COMP) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 and 4 (2k/4k dc profile) requires:\\n\"\n \"Maximum 1041666 compressed bytes @ 24fps\\n\"\n \"-> Specified rate exceeds this limit. Rate will be forced to 1041666 bytes.\\n\");\n parameters->max_comp_size = OPJ_CINEMA_24_COMP;\n }\n\n parameters->tcp_rates[0] = (OPJ_FLOAT32)(image->numcomps * image->comps[0].w *\n image->comps[0].h * image->comps[0].prec) /\n (OPJ_FLOAT32)(((OPJ_UINT32)parameters->max_cs_size) * 8 * image->comps[0].dx *\n image->comps[0].dy);\n\n}",
  21387. "project": "openjpeg",
  21388. "hash": 297746079961944802370676389918711288583,
  21389. "size": 147,
  21390. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21391. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21392. "target": 0,
  21393. "dataset": "other",
  21394. "idx": 357407
  21395. },
  21396. {
  21397. "func": "static int opj_j2k_get_imf_max_NL(opj_cparameters_t *parameters,\n opj_image_t *image)\n{\n /* Decomposition levels */\n const OPJ_UINT16 rsiz = parameters->rsiz;\n const OPJ_UINT16 profile = OPJ_GET_IMF_PROFILE(rsiz);\n const OPJ_UINT32 XTsiz = parameters->tile_size_on ? (OPJ_UINT32)\n parameters->cp_tdx : image->x1;\n switch (profile) {\n case OPJ_PROFILE_IMF_2K:\n return 5;\n case OPJ_PROFILE_IMF_4K:\n return 6;\n case OPJ_PROFILE_IMF_8K:\n return 7;\n case OPJ_PROFILE_IMF_2K_R: {\n if (XTsiz >= 2048) {\n return 5;\n } else if (XTsiz >= 1024) {\n return 4;\n }\n break;\n }\n case OPJ_PROFILE_IMF_4K_R: {\n if (XTsiz >= 4096) {\n return 6;\n } else if (XTsiz >= 2048) {\n return 5;\n } else if (XTsiz >= 1024) {\n return 4;\n }\n break;\n }\n case OPJ_PROFILE_IMF_8K_R: {\n if (XTsiz >= 8192) {\n return 7;\n } else if (XTsiz >= 4096) {\n return 6;\n } else if (XTsiz >= 2048) {\n return 5;\n } else if (XTsiz >= 1024) {\n return 4;\n }\n break;\n }\n default:\n break;\n }\n return -1;\n}",
  21398. "project": "openjpeg",
  21399. "hash": 229824589926677487589073697633540713236,
  21400. "size": 50,
  21401. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21402. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21403. "target": 0,
  21404. "dataset": "other",
  21405. "idx": 357368
  21406. },
  21407. {
  21408. "func": "OPJ_BOOL opj_j2k_setup_mct_encoding(opj_tcp_t * p_tcp, opj_image_t * p_image)\n{\n OPJ_UINT32 i;\n OPJ_UINT32 l_indix = 1;\n opj_mct_data_t * l_mct_deco_data = 00, * l_mct_offset_data = 00;\n opj_simple_mcc_decorrelation_data_t * l_mcc_data;\n OPJ_UINT32 l_mct_size, l_nb_elem;\n OPJ_FLOAT32 * l_data, * l_current_data;\n opj_tccp_t * l_tccp;\n\n /* preconditions */\n assert(p_tcp != 00);\n\n if (p_tcp->mct != 2) {\n return OPJ_TRUE;\n }\n\n if (p_tcp->m_mct_decoding_matrix) {\n if (p_tcp->m_nb_mct_records == p_tcp->m_nb_max_mct_records) {\n opj_mct_data_t *new_mct_records;\n p_tcp->m_nb_max_mct_records += OPJ_J2K_MCT_DEFAULT_NB_RECORDS;\n\n new_mct_records = (opj_mct_data_t *) opj_realloc(p_tcp->m_mct_records,\n p_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));\n if (! new_mct_records) {\n opj_free(p_tcp->m_mct_records);\n p_tcp->m_mct_records = NULL;\n p_tcp->m_nb_max_mct_records = 0;\n p_tcp->m_nb_mct_records = 0;\n /* opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to setup mct encoding\\n\"); */\n return OPJ_FALSE;\n }\n p_tcp->m_mct_records = new_mct_records;\n l_mct_deco_data = p_tcp->m_mct_records + p_tcp->m_nb_mct_records;\n\n memset(l_mct_deco_data, 0,\n (p_tcp->m_nb_max_mct_records - p_tcp->m_nb_mct_records) * sizeof(\n opj_mct_data_t));\n }\n l_mct_deco_data = p_tcp->m_mct_records + p_tcp->m_nb_mct_records;\n\n if (l_mct_deco_data->m_data) {\n opj_free(l_mct_deco_data->m_data);\n l_mct_deco_data->m_data = 00;\n }\n\n l_mct_deco_data->m_index = l_indix++;\n l_mct_deco_data->m_array_type = MCT_TYPE_DECORRELATION;\n l_mct_deco_data->m_element_type = MCT_TYPE_FLOAT;\n l_nb_elem = p_image->numcomps * p_image->numcomps;\n l_mct_size = l_nb_elem * MCT_ELEMENT_SIZE[l_mct_deco_data->m_element_type];\n l_mct_deco_data->m_data = (OPJ_BYTE*)opj_malloc(l_mct_size);\n\n if (! l_mct_deco_data->m_data) {\n return OPJ_FALSE;\n }\n\n j2k_mct_write_functions_from_float[l_mct_deco_data->m_element_type](\n p_tcp->m_mct_decoding_matrix, l_mct_deco_data->m_data, l_nb_elem);\n\n l_mct_deco_data->m_data_size = l_mct_size;\n ++p_tcp->m_nb_mct_records;\n }\n\n if (p_tcp->m_nb_mct_records == p_tcp->m_nb_max_mct_records) {\n opj_mct_data_t *new_mct_records;\n p_tcp->m_nb_max_mct_records += OPJ_J2K_MCT_DEFAULT_NB_RECORDS;\n new_mct_records = (opj_mct_data_t *) opj_realloc(p_tcp->m_mct_records,\n p_tcp->m_nb_max_mct_records * sizeof(opj_mct_data_t));\n if (! new_mct_records) {\n opj_free(p_tcp->m_mct_records);\n p_tcp->m_mct_records = NULL;\n p_tcp->m_nb_max_mct_records = 0;\n p_tcp->m_nb_mct_records = 0;\n /* opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to setup mct encoding\\n\"); */\n return OPJ_FALSE;\n }\n p_tcp->m_mct_records = new_mct_records;\n l_mct_offset_data = p_tcp->m_mct_records + p_tcp->m_nb_mct_records;\n\n memset(l_mct_offset_data, 0,\n (p_tcp->m_nb_max_mct_records - p_tcp->m_nb_mct_records) * sizeof(\n opj_mct_data_t));\n\n if (l_mct_deco_data) {\n l_mct_deco_data = l_mct_offset_data - 1;\n }\n }\n\n l_mct_offset_data = p_tcp->m_mct_records + p_tcp->m_nb_mct_records;\n\n if (l_mct_offset_data->m_data) {\n opj_free(l_mct_offset_data->m_data);\n l_mct_offset_data->m_data = 00;\n }\n\n l_mct_offset_data->m_index = l_indix++;\n l_mct_offset_data->m_array_type = MCT_TYPE_OFFSET;\n l_mct_offset_data->m_element_type = MCT_TYPE_FLOAT;\n l_nb_elem = p_image->numcomps;\n l_mct_size = l_nb_elem * MCT_ELEMENT_SIZE[l_mct_offset_data->m_element_type];\n l_mct_offset_data->m_data = (OPJ_BYTE*)opj_malloc(l_mct_size);\n\n if (! l_mct_offset_data->m_data) {\n return OPJ_FALSE;\n }\n\n l_data = (OPJ_FLOAT32*)opj_malloc(l_nb_elem * sizeof(OPJ_FLOAT32));\n if (! l_data) {\n opj_free(l_mct_offset_data->m_data);\n l_mct_offset_data->m_data = 00;\n return OPJ_FALSE;\n }\n\n l_tccp = p_tcp->tccps;\n l_current_data = l_data;\n\n for (i = 0; i < l_nb_elem; ++i) {\n *(l_current_data++) = (OPJ_FLOAT32)(l_tccp->m_dc_level_shift);\n ++l_tccp;\n }\n\n j2k_mct_write_functions_from_float[l_mct_offset_data->m_element_type](l_data,\n l_mct_offset_data->m_data, l_nb_elem);\n\n opj_free(l_data);\n\n l_mct_offset_data->m_data_size = l_mct_size;\n\n ++p_tcp->m_nb_mct_records;\n\n if (p_tcp->m_nb_mcc_records == p_tcp->m_nb_max_mcc_records) {\n opj_simple_mcc_decorrelation_data_t *new_mcc_records;\n p_tcp->m_nb_max_mcc_records += OPJ_J2K_MCT_DEFAULT_NB_RECORDS;\n new_mcc_records = (opj_simple_mcc_decorrelation_data_t *) opj_realloc(\n p_tcp->m_mcc_records, p_tcp->m_nb_max_mcc_records * sizeof(\n opj_simple_mcc_decorrelation_data_t));\n if (! new_mcc_records) {\n opj_free(p_tcp->m_mcc_records);\n p_tcp->m_mcc_records = NULL;\n p_tcp->m_nb_max_mcc_records = 0;\n p_tcp->m_nb_mcc_records = 0;\n /* opj_event_msg(p_manager, EVT_ERROR, \"Not enough memory to setup mct encoding\\n\"); */\n return OPJ_FALSE;\n }\n p_tcp->m_mcc_records = new_mcc_records;\n l_mcc_data = p_tcp->m_mcc_records + p_tcp->m_nb_mcc_records;\n memset(l_mcc_data, 0, (p_tcp->m_nb_max_mcc_records - p_tcp->m_nb_mcc_records) *\n sizeof(opj_simple_mcc_decorrelation_data_t));\n\n }\n\n l_mcc_data = p_tcp->m_mcc_records + p_tcp->m_nb_mcc_records;\n l_mcc_data->m_decorrelation_array = l_mct_deco_data;\n l_mcc_data->m_is_irreversible = 1;\n l_mcc_data->m_nb_comps = p_image->numcomps;\n l_mcc_data->m_index = l_indix++;\n l_mcc_data->m_offset_array = l_mct_offset_data;\n ++p_tcp->m_nb_mcc_records;\n\n return OPJ_TRUE;\n}",
  21409. "project": "openjpeg",
  21410. "hash": 282277109756410081868284151207452566699,
  21411. "size": 162,
  21412. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21413. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21414. "target": 0,
  21415. "dataset": "other",
  21416. "idx": 357370
  21417. },
  21418. {
  21419. "func": "static void opj_j2k_set_imf_parameters(opj_cparameters_t *parameters,\n opj_image_t *image, opj_event_mgr_t *p_manager)\n{\n const OPJ_UINT16 rsiz = parameters->rsiz;\n const OPJ_UINT16 profile = OPJ_GET_IMF_PROFILE(rsiz);\n\n OPJ_UNUSED(p_manager);\n\n /* Override defaults set by opj_set_default_encoder_parameters */\n if (parameters->cblockw_init == OPJ_COMP_PARAM_DEFAULT_CBLOCKW &&\n parameters->cblockh_init == OPJ_COMP_PARAM_DEFAULT_CBLOCKH) {\n parameters->cblockw_init = 32;\n parameters->cblockh_init = 32;\n }\n\n /* One tile part for each component */\n parameters->tp_flag = 'C';\n parameters->tp_on = 1;\n\n if (parameters->prog_order == OPJ_COMP_PARAM_DEFAULT_PROG_ORDER) {\n parameters->prog_order = OPJ_CPRL;\n }\n\n if (profile == OPJ_PROFILE_IMF_2K ||\n profile == OPJ_PROFILE_IMF_4K ||\n profile == OPJ_PROFILE_IMF_8K) {\n /* 9-7 transform */\n parameters->irreversible = 1;\n }\n\n /* Adjust the number of resolutions if set to its defaults */\n if (parameters->numresolution == OPJ_COMP_PARAM_DEFAULT_NUMRESOLUTION &&\n image->x0 == 0 &&\n image->y0 == 0) {\n const int max_NL = opj_j2k_get_imf_max_NL(parameters, image);\n if (max_NL >= 0 && parameters->numresolution > max_NL) {\n parameters->numresolution = max_NL + 1;\n }\n\n /* Note: below is generic logic */\n if (!parameters->tile_size_on) {\n while (parameters->numresolution > 0) {\n if (image->x1 < (1U << ((OPJ_UINT32)parameters->numresolution - 1U))) {\n parameters->numresolution --;\n continue;\n }\n if (image->y1 < (1U << ((OPJ_UINT32)parameters->numresolution - 1U))) {\n parameters->numresolution --;\n continue;\n }\n break;\n }\n }\n }\n\n /* Set defaults precincts */\n if (parameters->csty == 0) {\n parameters->csty |= J2K_CP_CSTY_PRT;\n if (parameters->numresolution == 1) {\n parameters->res_spec = 1;\n parameters->prcw_init[0] = 128;\n parameters->prch_init[0] = 128;\n } else {\n int i;\n parameters->res_spec = parameters->numresolution - 1;\n for (i = 0; i < parameters->res_spec; i++) {\n parameters->prcw_init[i] = 256;\n parameters->prch_init[i] = 256;\n }\n }\n }\n}",
  21420. "project": "openjpeg",
  21421. "hash": 8349866500140506143717077527305324941,
  21422. "size": 72,
  21423. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21424. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21425. "target": 0,
  21426. "dataset": "other",
  21427. "idx": 357311
  21428. },
  21429. {
  21430. "func": "static OPJ_BOOL opj_j2k_check_poc_val(const opj_poc_t *p_pocs,\n OPJ_UINT32 tileno,\n OPJ_UINT32 p_nb_pocs,\n OPJ_UINT32 p_nb_resolutions,\n OPJ_UINT32 p_num_comps,\n OPJ_UINT32 p_num_layers,\n opj_event_mgr_t * p_manager)\n{\n OPJ_UINT32* packet_array;\n OPJ_UINT32 index, resno, compno, layno;\n OPJ_UINT32 i;\n OPJ_UINT32 step_c = 1;\n OPJ_UINT32 step_r = p_num_comps * step_c;\n OPJ_UINT32 step_l = p_nb_resolutions * step_r;\n OPJ_BOOL loss = OPJ_FALSE;\n\n assert(p_nb_pocs > 0);\n\n packet_array = (OPJ_UINT32*) opj_calloc(step_l * p_num_layers,\n sizeof(OPJ_UINT32));\n if (packet_array == 00) {\n opj_event_msg(p_manager, EVT_ERROR,\n \"Not enough memory for checking the poc values.\\n\");\n return OPJ_FALSE;\n }\n\n /* iterate through all the pocs that match our tile of interest. */\n for (i = 0; i < p_nb_pocs; ++i) {\n const opj_poc_t *poc = &p_pocs[i];\n if (tileno + 1 == poc->tile) {\n index = step_r * poc->resno0;\n\n /* take each resolution for each poc */\n for (resno = poc->resno0 ;\n resno < opj_uint_min(poc->resno1, p_nb_resolutions); ++resno) {\n OPJ_UINT32 res_index = index + poc->compno0 * step_c;\n\n /* take each comp of each resolution for each poc */\n for (compno = poc->compno0 ;\n compno < opj_uint_min(poc->compno1, p_num_comps); ++compno) {\n /* The layer index always starts at zero for every progression. */\n const OPJ_UINT32 layno0 = 0;\n OPJ_UINT32 comp_index = res_index + layno0 * step_l;\n\n /* and finally take each layer of each res of ... */\n for (layno = layno0; layno < opj_uint_min(poc->layno1, p_num_layers);\n ++layno) {\n packet_array[comp_index] = 1;\n comp_index += step_l;\n }\n\n res_index += step_c;\n }\n\n index += step_r;\n }\n }\n }\n\n index = 0;\n for (layno = 0; layno < p_num_layers ; ++layno) {\n for (resno = 0; resno < p_nb_resolutions; ++resno) {\n for (compno = 0; compno < p_num_comps; ++compno) {\n loss |= (packet_array[index] != 1);\n#ifdef DEBUG_VERBOSE\n if (packet_array[index] != 1) {\n fprintf(stderr,\n \"Missing packet in POC: layno=%d resno=%d compno=%d\\n\",\n layno, resno, compno);\n }\n#endif\n index += step_c;\n }\n }\n }\n\n if (loss) {\n opj_event_msg(p_manager, EVT_ERROR, \"Missing packets possible loss of data\\n\");\n }\n\n opj_free(packet_array);\n\n return !loss;\n}",
  21431. "project": "openjpeg",
  21432. "hash": 120238727439045726067896449479920376024,
  21433. "size": 84,
  21434. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21435. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21436. "target": 0,
  21437. "dataset": "other",
  21438. "idx": 357293
  21439. },
  21440. {
  21441. "func": "static OPJ_BOOL opj_j2k_is_cinema_compliant(opj_image_t *image, OPJ_UINT16 rsiz,\n opj_event_mgr_t *p_manager)\n{\n OPJ_UINT32 i;\n\n /* Number of components */\n if (image->numcomps != 3) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"3 components\"\n \"-> Number of components of input image (%d) is not compliant\\n\"\n \"-> Non-profile-3 codestream will be generated\\n\",\n image->numcomps);\n return OPJ_FALSE;\n }\n\n /* Bitdepth */\n for (i = 0; i < image->numcomps; i++) {\n if ((image->comps[i].bpp != 12) | (image->comps[i].sgnd)) {\n char signed_str[] = \"signed\";\n char unsigned_str[] = \"unsigned\";\n char *tmp_str = image->comps[i].sgnd ? signed_str : unsigned_str;\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"Precision of each component shall be 12 bits unsigned\"\n \"-> At least component %d of input image (%d bits, %s) is not compliant\\n\"\n \"-> Non-profile-3 codestream will be generated\\n\",\n i, image->comps[i].bpp, tmp_str);\n return OPJ_FALSE;\n }\n }\n\n /* Image size */\n switch (rsiz) {\n case OPJ_PROFILE_CINEMA_2K:\n if (((image->comps[0].w > 2048) | (image->comps[0].h > 1080))) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-3 (2k dc profile) requires:\\n\"\n \"width <= 2048 and height <= 1080\\n\"\n \"-> Input image size %d x %d is not compliant\\n\"\n \"-> Non-profile-3 codestream will be generated\\n\",\n image->comps[0].w, image->comps[0].h);\n return OPJ_FALSE;\n }\n break;\n case OPJ_PROFILE_CINEMA_4K:\n if (((image->comps[0].w > 4096) | (image->comps[0].h > 2160))) {\n opj_event_msg(p_manager, EVT_WARNING,\n \"JPEG 2000 Profile-4 (4k dc profile) requires:\\n\"\n \"width <= 4096 and height <= 2160\\n\"\n \"-> Image size %d x %d is not compliant\\n\"\n \"-> Non-profile-4 codestream will be generated\\n\",\n image->comps[0].w, image->comps[0].h);\n return OPJ_FALSE;\n }\n break;\n default :\n break;\n }\n\n return OPJ_TRUE;\n}",
  21442. "project": "openjpeg",
  21443. "hash": 7680939836931048431024455846237404720,
  21444. "size": 62,
  21445. "commit_id": "73fdf28342e4594019af26eb6a347a34eceb6296",
  21446. "message": "opj_j2k_write_sod(): avoid potential heap buffer overflow (fixes #1299) (probably master only)",
  21447. "target": 0,
  21448. "dataset": "other",
  21449. "idx": 357343
  21450. }
  21451. ]
  21452. },
  21453. {
  21454. "call_depth": 3,
  21455. "longest_call_chain": [
  21456. "zend_shared_alloc_startup",
  21457. "zend_shared_alloc_create_lock",
  21458. "zend_accel_error"
  21459. ],
  21460. "group_size": 10,
  21461. "functions": [
  21462. {
  21463. "func": "int zend_shared_alloc_startup(size_t requested_size)\n{\n\tzend_shared_segment **tmp_shared_segments;\n\tsize_t shared_segments_array_size;\n\tzend_smm_shared_globals tmp_shared_globals, *p_tmp_shared_globals;\n\tchar *error_in = NULL;\n\tconst zend_shared_memory_handler_entry *he;\n\tint res = ALLOC_FAILURE;\n\n\tTSRMLS_FETCH();\n\n\t/* shared_free must be valid before we call zend_shared_alloc()\n\t * - make it temporarily point to a local variable\n\t */\n\tsmm_shared_globals = &tmp_shared_globals;\n\tZSMMG(shared_free) = requested_size; /* goes to tmp_shared_globals.shared_free */\n\n\tzend_shared_alloc_create_lock();\n\n\tif (ZCG(accel_directives).memory_model && ZCG(accel_directives).memory_model[0]) {\n\t\tchar *model = ZCG(accel_directives).memory_model;\n\t\t/* \"cgi\" is really \"shm\"... */\n\t\tif (strncmp(ZCG(accel_directives).memory_model, \"cgi\", sizeof(\"cgi\")) == 0) {\n\t\t\tmodel = \"shm\";\n\t\t}\n\n\t\tfor (he = handler_table; he->name; he++) {\n\t\t\tif (strcmp(model, he->name) == 0) {\n\t\t\t\tres = zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in);\n\t\t\t\tif (res) {\n\t\t\t\t\t/* this model works! */\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (res == FAILED_REATTACHED) {\n\t\tsmm_shared_globals = NULL;\n\t\treturn res;\n\t}\n\n\tif (!g_shared_alloc_handler) {\n\t\t/* try memory handlers in order */\n\t\tfor (he = handler_table; he->name; he++) {\n\t\t\tres = zend_shared_alloc_try(he, requested_size, &ZSMMG(shared_segments), &ZSMMG(shared_segments_count), &error_in);\n\t\t\tif (res) {\n\t\t\t\t/* this model works! */\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tif (!g_shared_alloc_handler) {\n\t\tno_memory_bailout(requested_size, error_in);\n\t\treturn ALLOC_FAILURE;\n\t}\n\n\tif (res == SUCCESSFULLY_REATTACHED) {\n\t\treturn res;\n\t}\n\n\tshared_segments_array_size = ZSMMG(shared_segments_count) * S_H(segment_type_size)();\n\n\t/* move shared_segments and shared_free to shared memory */\n\tZCG(locked) = 1; /* no need to perform a real lock at this point */\n\tp_tmp_shared_globals = (zend_smm_shared_globals *) zend_shared_alloc(sizeof(zend_smm_shared_globals));\n\tif (!p_tmp_shared_globals) {\n\t\tzend_accel_error(ACCEL_LOG_FATAL, \"Insufficient shared memory!\");\n\t\treturn ALLOC_FAILURE;;\n\t}\n\n\ttmp_shared_segments = zend_shared_alloc(shared_segments_array_size + ZSMMG(shared_segments_count) * sizeof(void *));\n\tif (!tmp_shared_segments) {\n\t\tzend_accel_error(ACCEL_LOG_FATAL, \"Insufficient shared memory!\");\n\t\treturn ALLOC_FAILURE;;\n\t}\n\n\tcopy_shared_segments(tmp_shared_segments, ZSMMG(shared_segments)[0], ZSMMG(shared_segments_count), S_H(segment_type_size)());\n\n\t*p_tmp_shared_globals = tmp_shared_globals;\n\tsmm_shared_globals = p_tmp_shared_globals;\n\n\tfree(ZSMMG(shared_segments));\n\tZSMMG(shared_segments) = tmp_shared_segments;\n\n\tZSMMG(shared_memory_state).positions = (int *)zend_shared_alloc(sizeof(int) * ZSMMG(shared_segments_count));\n\tif (!ZSMMG(shared_memory_state).positions) {\n\t\tzend_accel_error(ACCEL_LOG_FATAL, \"Insufficient shared memory!\");\n\t\treturn ALLOC_FAILURE;;\n\t}\n\n\tZCG(locked) = 0;\n\n\treturn res;\n}",
  21464. "project": "php-src",
  21465. "hash": 43164796773174333003687575161107203616,
  21466. "size": 96,
  21467. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21468. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21469. "target": 0,
  21470. "dataset": "other",
  21471. "idx": 301515
  21472. },
  21473. {
  21474. "func": "void zend_shared_alloc_create_lock(void)\n{\n\tint val;\n\n#ifdef ZTS\n zts_lock = tsrm_mutex_alloc();\n#endif\n\n\tsprintf(lockfile_name, \"%s/%sXXXXXX\", TMP_DIR, SEM_FILENAME_PREFIX);\n\tlock_file = mkstemp(lockfile_name);\n\tfchmod(lock_file, 0666);\n\n\tif (lock_file == -1) {\n\t\tzend_accel_error(ACCEL_LOG_FATAL, \"Unable to create lock file: %s (%d)\", strerror(errno), errno);\n\t}\n\tval = fcntl(lock_file, F_GETFD, 0);\n\tval |= FD_CLOEXEC;\n\tfcntl(lock_file, F_SETFD, val);\n\n\tunlink(lockfile_name);\n}",
  21475. "project": "php-src",
  21476. "hash": 37315271396221786570113492262216584254,
  21477. "size": 21,
  21478. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21479. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21480. "target": 0,
  21481. "dataset": "other",
  21482. "idx": 301526
  21483. },
  21484. {
  21485. "func": "void *zend_shared_alloc(size_t size)\n{\n\tint i;\n\tunsigned int block_size = ZEND_ALIGNED_SIZE(size);\n\tTSRMLS_FETCH();\n\n#if 1\n\tif (!ZCG(locked)) {\n\t\tzend_accel_error(ACCEL_LOG_ERROR, \"Shared memory lock not obtained\");\n\t}\n#endif\n\tif (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */\n\t\tSHARED_ALLOC_FAILED();\n\t\treturn NULL;\n\t}\n\tfor (i = 0; i < ZSMMG(shared_segments_count); i++) {\n\t\tif (ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */\n\t\t\tvoid *retval = (void *) (((char *) ZSMMG(shared_segments)[i]->p) + ZSMMG(shared_segments)[i]->pos);\n\n\t\t\tZSMMG(shared_segments)[i]->pos += block_size;\n\t\t\tZSMMG(shared_free) -= block_size;\n\t\t\tmemset(retval, 0, block_size);\n\t\t\treturn retval;\n\t\t}\n\t}\n\tSHARED_ALLOC_FAILED();\n\treturn NULL;\n}",
  21486. "project": "php-src",
  21487. "hash": 104763542045729052738258008527633004885,
  21488. "size": 28,
  21489. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21490. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21491. "target": 0,
  21492. "dataset": "other",
  21493. "idx": 301535
  21494. },
  21495. {
  21496. "func": "void zend_shared_alloc_safe_unlock(TSRMLS_D)\n{\n\tif (ZCG(locked)) {\n\t\tzend_shared_alloc_unlock(TSRMLS_C);\n\t}\n}",
  21497. "project": "php-src",
  21498. "hash": 265411608072664417321639017602496491638,
  21499. "size": 6,
  21500. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21501. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21502. "target": 0,
  21503. "dataset": "other",
  21504. "idx": 301516
  21505. },
  21506. {
  21507. "func": "void zend_shared_alloc_lock(TSRMLS_D)\n{\n#ifndef ZEND_WIN32\n\n#ifdef ZTS\n\ttsrm_mutex_lock(zts_lock);\n#endif\n\n#if 0\n\t/* this will happen once per process, and will un-globalize mem_write_lock */\n\tif (mem_write_lock.l_pid == -1) {\n\t\tmem_write_lock.l_pid = getpid();\n\t}\n#endif\n\n\twhile (1) {\n\t\tif (fcntl(lock_file, F_SETLKW, &mem_write_lock) == -1) {\n\t\t\tif (errno == EINTR) {\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tzend_accel_error(ACCEL_LOG_ERROR, \"Cannot create lock - %s (%d)\", strerror(errno), errno);\n\t\t}\n\t\tbreak;\n\t}\n#else\n\tzend_shared_alloc_lock_win32();\n#endif\n\n\tZCG(locked) = 1;\n\n\t/* Prepare translation table\n\t *\n\t * Make it persistent so that it uses malloc() and allocated blocks\n\t * won't be taken from space which is freed by efree in memdup.\n\t * Otherwise it leads to false matches in memdup check.\n\t */\n\tzend_hash_init(&xlat_table, 100, NULL, NULL, 1);\n}",
  21508. "project": "php-src",
  21509. "hash": 12456624217880618862355917091150053091,
  21510. "size": 38,
  21511. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21512. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21513. "target": 0,
  21514. "dataset": "other",
  21515. "idx": 301532
  21516. },
  21517. {
  21518. "func": "static void copy_shared_segments(void *to, void *from, int count, int size)\n{\n\tzend_shared_segment **shared_segments_v = (zend_shared_segment **)to;\n\tvoid *shared_segments_to_p = ((char *)to + count*(sizeof(void *)));\n\tvoid *shared_segments_from_p = from;\n\tint i;\n\n\tfor (i = 0; i < count; i++) {\n\t\tshared_segments_v[i] = \tshared_segments_to_p;\n\t\tmemcpy(shared_segments_to_p, shared_segments_from_p, size);\n\t\tshared_segments_to_p = ((char *)shared_segments_to_p + size);\n\t\tshared_segments_from_p = ((char *)shared_segments_from_p + size);\n\t}\n}",
  21519. "project": "php-src",
  21520. "hash": 28593976064315556136734400134300434460,
  21521. "size": 14,
  21522. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21523. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21524. "target": 0,
  21525. "dataset": "other",
  21526. "idx": 301528
  21527. },
  21528. {
  21529. "func": "static int zend_shared_alloc_try(const zend_shared_memory_handler_entry *he, size_t requested_size, zend_shared_segment ***shared_segments_p, int *shared_segments_count, char **error_in)\n{\n\tint res;\n\tg_shared_alloc_handler = he->handler;\n\tg_shared_model = he->name;\n\tZSMMG(shared_segments) = NULL;\n\tZSMMG(shared_segments_count) = 0;\n\n\tres = S_H(create_segments)(requested_size, shared_segments_p, shared_segments_count, error_in);\n\n\tif (res) {\n\t\t/* this model works! */\n\t\treturn res;\n\t}\n\tif (*shared_segments_p) {\n\t\tint i;\n\t\t/* cleanup */\n\t\tfor (i = 0; i < *shared_segments_count; i++) {\n\t\t\tif ((*shared_segments_p)[i]->p && (*shared_segments_p)[i]->p != (void *)-1) {\n\t\t\t\tS_H(detach_segment)((*shared_segments_p)[i]);\n\t\t\t}\n\t\t}\n\t\tfree(*shared_segments_p);\n\t\t*shared_segments_p = NULL;\n\t}\n\tg_shared_alloc_handler = NULL;\n\treturn ALLOC_FAILURE;\n}",
  21530. "project": "php-src",
  21531. "hash": 335952215195202099083183453622920490720,
  21532. "size": 28,
  21533. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21534. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21535. "target": 0,
  21536. "dataset": "other",
  21537. "idx": 301522
  21538. },
  21539. {
  21540. "func": "void zend_shared_alloc_unlock(TSRMLS_D)\n{\n\t/* Destroy translation table */\n\tzend_hash_destroy(&xlat_table);\n\n\tZCG(locked) = 0;\n\n#ifndef ZEND_WIN32\n\tif (fcntl(lock_file, F_SETLK, &mem_write_unlock) == -1) {\n\t\tzend_accel_error(ACCEL_LOG_ERROR, \"Cannot remove lock - %s (%d)\", strerror(errno), errno);\n\t}\n#ifdef ZTS\n\ttsrm_mutex_unlock(zts_lock);\n#endif\n#else\n\tzend_shared_alloc_unlock_win32();\n#endif\n}",
  21541. "project": "php-src",
  21542. "hash": 337641547962770676212742288284736128445,
  21543. "size": 18,
  21544. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21545. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21546. "target": 0,
  21547. "dataset": "other",
  21548. "idx": 301525
  21549. },
  21550. {
  21551. "func": "static void no_memory_bailout(size_t allocate_size, char *error)\n{\n\tzend_accel_error(ACCEL_LOG_FATAL, \"Unable to allocate shared memory segment of %ld bytes: %s: %s (%d)\", allocate_size, error?error:\"unknown\", strerror(errno), errno );\n}",
  21552. "project": "php-src",
  21553. "hash": 168721820608208516982358022973227244998,
  21554. "size": 4,
  21555. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21556. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21557. "target": 0,
  21558. "dataset": "other",
  21559. "idx": 301531
  21560. },
  21561. {
  21562. "func": "void zend_shared_alloc_shutdown(void)\n{\n\tzend_shared_segment **tmp_shared_segments;\n\tsize_t shared_segments_array_size;\n\tzend_smm_shared_globals tmp_shared_globals;\n\tint i;\n\n\ttmp_shared_globals = *smm_shared_globals;\n\tsmm_shared_globals = &tmp_shared_globals;\n\tshared_segments_array_size = ZSMMG(shared_segments_count) * (S_H(segment_type_size)() + sizeof(void *));\n\ttmp_shared_segments = emalloc(shared_segments_array_size);\n\tcopy_shared_segments(tmp_shared_segments, ZSMMG(shared_segments)[0], ZSMMG(shared_segments_count), S_H(segment_type_size)());\n\tZSMMG(shared_segments) = tmp_shared_segments;\n\n\tfor (i = 0; i < ZSMMG(shared_segments_count); i++) {\n\t\tS_H(detach_segment)(ZSMMG(shared_segments)[i]);\n\t}\n\tefree(ZSMMG(shared_segments));\n\tZSMMG(shared_segments) = NULL;\n\tg_shared_alloc_handler = NULL;\n#ifndef ZEND_WIN32\n\tclose(lock_file);\n#endif\n}",
  21563. "project": "php-src",
  21564. "hash": 92973661424923663154559348364010141591,
  21565. "size": 24,
  21566. "commit_id": "0a8f28b43212cc2ddbc1f2df710e37b1bec0addd",
  21567. "message": "Fixed bug #68677 (Use After Free in OPcache)\n\n(cherry picked from commit 777c39f4042327eac4b63c7ee87dc1c7a09a3115)",
  21568. "target": 0,
  21569. "dataset": "other",
  21570. "idx": 301524
  21571. }
  21572. ]
  21573. },
  21574. {
  21575. "call_depth": 3,
  21576. "longest_call_chain": [
  21577. "xStreamBufferReceive",
  21578. "prvReadMessageFromBuffer",
  21579. "prvReadBytesFromBuffer"
  21580. ],
  21581. "group_size": 13,
  21582. "functions": [
  21583. {
  21584. "func": "static size_t prvReadBytesFromBuffer( StreamBuffer_t * pxStreamBuffer,\r\n uint8_t * pucData,\r\n size_t xMaxCount,\r\n size_t xBytesAvailable )\r\n{\r\n size_t xCount, xFirstLength, xNextTail;\r\n\r\n /* Use the minimum of the wanted bytes and the available bytes. */\r\n xCount = configMIN( xBytesAvailable, xMaxCount );\r\n\r\n if( xCount > ( size_t ) 0 )\r\n {\r\n xNextTail = pxStreamBuffer->xTail;\r\n\r\n /* Calculate the number of bytes that can be read - which may be\r\n * less than the number wanted if the data wraps around to the start of\r\n * the buffer. */\r\n xFirstLength = configMIN( pxStreamBuffer->xLength - xNextTail, xCount );\r\n\r\n /* Obtain the number of bytes it is possible to obtain in the first\r\n * read. Asserts check bounds of read and write. */\r\n configASSERT( xFirstLength <= xMaxCount );\r\n configASSERT( ( xNextTail + xFirstLength ) <= pxStreamBuffer->xLength );\r\n ( void ) memcpy( ( void * ) pucData, ( const void * ) &( pxStreamBuffer->pucBuffer[ xNextTail ] ), xFirstLength ); /*lint !e9087 memcpy() requires void *. */\r\n\r\n /* If the total number of wanted bytes is greater than the number\r\n * that could be read in the first read... */\r\n if( xCount > xFirstLength )\r\n {\r\n /*...then read the remaining bytes from the start of the buffer. */\r\n configASSERT( xCount <= xMaxCount );\r\n ( void ) memcpy( ( void * ) &( pucData[ xFirstLength ] ), ( void * ) ( pxStreamBuffer->pucBuffer ), xCount - xFirstLength ); /*lint !e9087 memcpy() requires void *. */\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n /* Move the tail pointer to effectively remove the data read from\r\n * the buffer. */\r\n xNextTail += xCount;\r\n\r\n if( xNextTail >= pxStreamBuffer->xLength )\r\n {\r\n xNextTail -= pxStreamBuffer->xLength;\r\n }\r\n\r\n pxStreamBuffer->xTail = xNextTail;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n return xCount;\r\n}\r",
  21585. "project": "FreeRTOS-Kernel",
  21586. "hash": 183800658054191255213388093548715804795,
  21587. "size": 56,
  21588. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21589. "message": "Add addition overflow check for stream buffer (#226)",
  21590. "target": 0,
  21591. "dataset": "other",
  21592. "idx": 246418
  21593. },
  21594. {
  21595. "func": "static size_t prvReadMessageFromBuffer( StreamBuffer_t * pxStreamBuffer,\r\n void * pvRxData,\r\n size_t xBufferLengthBytes,\r\n size_t xBytesAvailable,\r\n size_t xBytesToStoreMessageLength )\r\n{\r\n size_t xOriginalTail, xReceivedLength, xNextMessageLength;\r\n configMESSAGE_BUFFER_LENGTH_TYPE xTempNextMessageLength;\r\n\r\n if( xBytesToStoreMessageLength != ( size_t ) 0 )\r\n {\r\n /* A discrete message is being received. First receive the length\r\n * of the message. A copy of the tail is stored so the buffer can be\r\n * returned to its prior state if the length of the message is too\r\n * large for the provided buffer. */\r\n xOriginalTail = pxStreamBuffer->xTail;\r\n ( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempNextMessageLength, xBytesToStoreMessageLength, xBytesAvailable );\r\n xNextMessageLength = ( size_t ) xTempNextMessageLength;\r\n\r\n /* Reduce the number of bytes available by the number of bytes just\r\n * read out. */\r\n xBytesAvailable -= xBytesToStoreMessageLength;\r\n\r\n /* Check there is enough space in the buffer provided by the\r\n * user. */\r\n if( xNextMessageLength > xBufferLengthBytes )\r\n {\r\n /* The user has provided insufficient space to read the message\r\n * so return the buffer to its previous state (so the length of\r\n * the message is in the buffer again). */\r\n pxStreamBuffer->xTail = xOriginalTail;\r\n xNextMessageLength = 0;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n else\r\n {\r\n /* A stream of bytes is being received (as opposed to a discrete\r\n * message), so read as many bytes as possible. */\r\n xNextMessageLength = xBufferLengthBytes;\r\n }\r\n\r\n /* Read the actual data. */\r\n xReceivedLength = prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) pvRxData, xNextMessageLength, xBytesAvailable ); /*lint !e9079 Data storage area is implemented as uint8_t array for ease of sizing, indexing and alignment. */\r\n\r\n return xReceivedLength;\r\n}\r",
  21596. "project": "FreeRTOS-Kernel",
  21597. "hash": 172046576489594346241252494025182269040,
  21598. "size": 50,
  21599. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21600. "message": "Add addition overflow check for stream buffer (#226)",
  21601. "target": 0,
  21602. "dataset": "other",
  21603. "idx": 246415
  21604. },
  21605. {
  21606. "func": "size_t xStreamBufferNextMessageLengthBytes( StreamBufferHandle_t xStreamBuffer )\r\n{\r\n StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n size_t xReturn, xBytesAvailable, xOriginalTail;\r\n configMESSAGE_BUFFER_LENGTH_TYPE xTempReturn;\r\n\r\n configASSERT( pxStreamBuffer );\r\n\r\n /* Ensure the stream buffer is being used as a message buffer. */\r\n if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r\n {\r\n xBytesAvailable = prvBytesInBuffer( pxStreamBuffer );\r\n\r\n if( xBytesAvailable > sbBYTES_TO_STORE_MESSAGE_LENGTH )\r\n {\r\n /* The number of bytes available is greater than the number of bytes\r\n * required to hold the length of the next message, so another message\r\n * is available. Return its length without removing the length bytes\r\n * from the buffer. A copy of the tail is stored so the buffer can be\r\n * returned to its prior state as the message is not actually being\r\n * removed from the buffer. */\r\n xOriginalTail = pxStreamBuffer->xTail;\r\n ( void ) prvReadBytesFromBuffer( pxStreamBuffer, ( uint8_t * ) &xTempReturn, sbBYTES_TO_STORE_MESSAGE_LENGTH, xBytesAvailable );\r\n xReturn = ( size_t ) xTempReturn;\r\n pxStreamBuffer->xTail = xOriginalTail;\r\n }\r\n else\r\n {\r\n /* The minimum amount of bytes in a message buffer is\r\n * ( sbBYTES_TO_STORE_MESSAGE_LENGTH + 1 ), so if xBytesAvailable is\r\n * less than sbBYTES_TO_STORE_MESSAGE_LENGTH the only other valid\r\n * value is 0. */\r\n configASSERT( xBytesAvailable == 0 );\r\n xReturn = 0;\r\n }\r\n }\r\n else\r\n {\r\n xReturn = 0;\r\n }\r\n\r\n return xReturn;\r\n}\r",
  21607. "project": "FreeRTOS-Kernel",
  21608. "hash": 210757158170138131897407075493662777819,
  21609. "size": 43,
  21610. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21611. "message": "Add addition overflow check for stream buffer (#226)",
  21612. "target": 0,
  21613. "dataset": "other",
  21614. "idx": 246423
  21615. },
  21616. {
  21617. "func": "size_t xStreamBufferReceiveFromISR( StreamBufferHandle_t xStreamBuffer,\r\n void * pvRxData,\r\n size_t xBufferLengthBytes,\r\n BaseType_t * const pxHigherPriorityTaskWoken )\r\n{\r\n StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;\r\n\r\n configASSERT( pvRxData );\r\n configASSERT( pxStreamBuffer );\r\n\r\n /* This receive function is used by both message buffers, which store\r\n * discrete messages, and stream buffers, which store a continuous stream of\r\n * bytes. Discrete messages include an additional\r\n * sbBYTES_TO_STORE_MESSAGE_LENGTH bytes that hold the length of the\r\n * message. */\r\n if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r\n {\r\n xBytesToStoreMessageLength = sbBYTES_TO_STORE_MESSAGE_LENGTH;\r\n }\r\n else\r\n {\r\n xBytesToStoreMessageLength = 0;\r\n }\r\n\r\n xBytesAvailable = prvBytesInBuffer( pxStreamBuffer );\r\n\r\n /* Whether receiving a discrete message (where xBytesToStoreMessageLength\r\n * holds the number of bytes used to store the message length) or a stream of\r\n * bytes (where xBytesToStoreMessageLength is zero), the number of bytes\r\n * available must be greater than xBytesToStoreMessageLength to be able to\r\n * read bytes from the buffer. */\r\n if( xBytesAvailable > xBytesToStoreMessageLength )\r\n {\r\n xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable, xBytesToStoreMessageLength );\r\n\r\n /* Was a task waiting for space in the buffer? */\r\n if( xReceivedLength != ( size_t ) 0 )\r\n {\r\n sbRECEIVE_COMPLETED_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken );\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n traceSTREAM_BUFFER_RECEIVE_FROM_ISR( xStreamBuffer, xReceivedLength );\r\n\r\n return xReceivedLength;\r\n}\r",
  21618. "project": "FreeRTOS-Kernel",
  21619. "hash": 327831401079690943715300817667256533237,
  21620. "size": 55,
  21621. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21622. "message": "Add addition overflow check for stream buffer (#226)",
  21623. "target": 0,
  21624. "dataset": "other",
  21625. "idx": 246408
  21626. },
  21627. {
  21628. "func": "size_t xStreamBufferSendFromISR( StreamBufferHandle_t xStreamBuffer,\r\n const void * pvTxData,\r\n size_t xDataLengthBytes,\r\n BaseType_t * const pxHigherPriorityTaskWoken )\r\n{\r\n StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n size_t xReturn, xSpace;\r\n size_t xRequiredSpace = xDataLengthBytes;\r\n\r\n configASSERT( pvTxData );\r\n configASSERT( pxStreamBuffer );\r\n\r\n /* This send function is used to write to both message buffers and stream\r\n * buffers. If this is a message buffer then the space needed must be\r\n * increased by the amount of bytes needed to store the length of the\r\n * message. */\r\n if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r\n {\r\n xRequiredSpace += sbBYTES_TO_STORE_MESSAGE_LENGTH;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n xSpace = xStreamBufferSpacesAvailable( pxStreamBuffer );\r\n xReturn = prvWriteMessageToBuffer( pxStreamBuffer, pvTxData, xDataLengthBytes, xSpace, xRequiredSpace );\r\n\r\n if( xReturn > ( size_t ) 0 )\r\n {\r\n /* Was a task waiting for the data? */\r\n if( prvBytesInBuffer( pxStreamBuffer ) >= pxStreamBuffer->xTriggerLevelBytes )\r\n {\r\n sbSEND_COMPLETE_FROM_ISR( pxStreamBuffer, pxHigherPriorityTaskWoken );\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n traceSTREAM_BUFFER_SEND_FROM_ISR( xStreamBuffer, xReturn );\r\n\r\n return xReturn;\r\n}\r",
  21629. "project": "FreeRTOS-Kernel",
  21630. "hash": 19376530492639417633388832485690470453,
  21631. "size": 49,
  21632. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21633. "message": "Add addition overflow check for stream buffer (#226)",
  21634. "target": 0,
  21635. "dataset": "other",
  21636. "idx": 246416
  21637. },
  21638. {
  21639. "func": "static size_t prvBytesInBuffer( const StreamBuffer_t * const pxStreamBuffer )\r\n{\r\n/* Returns the distance between xTail and xHead. */\r\n size_t xCount;\r\n\r\n xCount = pxStreamBuffer->xLength + pxStreamBuffer->xHead;\r\n xCount -= pxStreamBuffer->xTail;\r\n\r\n if( xCount >= pxStreamBuffer->xLength )\r\n {\r\n xCount -= pxStreamBuffer->xLength;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n return xCount;\r\n}\r",
  21640. "project": "FreeRTOS-Kernel",
  21641. "hash": 127287939020592442817296727112821582750,
  21642. "size": 19,
  21643. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21644. "message": "Add addition overflow check for stream buffer (#226)",
  21645. "target": 0,
  21646. "dataset": "other",
  21647. "idx": 246420
  21648. },
  21649. {
  21650. "func": "static size_t prvWriteMessageToBuffer( StreamBuffer_t * const pxStreamBuffer,\r\n const void * pvTxData,\r\n size_t xDataLengthBytes,\r\n size_t xSpace,\r\n size_t xRequiredSpace )\r\n{\r\n BaseType_t xShouldWrite;\r\n size_t xReturn;\r\n\r\n if( xSpace == ( size_t ) 0 )\r\n {\r\n /* Doesn't matter if this is a stream buffer or a message buffer, there\r\n * is no space to write. */\r\n xShouldWrite = pdFALSE;\r\n }\r\n else if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) == ( uint8_t ) 0 )\r\n {\r\n /* This is a stream buffer, as opposed to a message buffer, so writing a\r\n * stream of bytes rather than discrete messages. Write as many bytes as\r\n * possible. */\r\n xShouldWrite = pdTRUE;\r\n xDataLengthBytes = configMIN( xDataLengthBytes, xSpace );\r\n }\r\n else if( xSpace >= xRequiredSpace )\r\n {\r\n /* This is a message buffer, as opposed to a stream buffer, and there\r\n * is enough space to write both the message length and the message itself\r\n * into the buffer. Start by writing the length of the data, the data\r\n * itself will be written later in this function. */\r\n xShouldWrite = pdTRUE;\r\n ( void ) prvWriteBytesToBuffer( pxStreamBuffer, ( const uint8_t * ) &( xDataLengthBytes ), sbBYTES_TO_STORE_MESSAGE_LENGTH );\r\n }\r\n else\r\n {\r\n /* There is space available, but not enough space. */\r\n xShouldWrite = pdFALSE;\r\n }\r\n\r\n if( xShouldWrite != pdFALSE )\r\n {\r\n /* Writes the data itself. */\r\n xReturn = prvWriteBytesToBuffer( pxStreamBuffer, ( const uint8_t * ) pvTxData, xDataLengthBytes ); /*lint !e9079 Storage buffer is implemented as uint8_t for ease of sizing, alignment and access. */\r\n }\r\n else\r\n {\r\n xReturn = 0;\r\n }\r\n\r\n return xReturn;\r\n}\r",
  21651. "project": "FreeRTOS-Kernel",
  21652. "hash": 332078903378954341817170334238480949542,
  21653. "size": 50,
  21654. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21655. "message": "Add addition overflow check for stream buffer (#226)",
  21656. "target": 0,
  21657. "dataset": "other",
  21658. "idx": 246428
  21659. },
  21660. {
  21661. "func": "size_t xStreamBufferReceive( StreamBufferHandle_t xStreamBuffer,\r\n void * pvRxData,\r\n size_t xBufferLengthBytes,\r\n TickType_t xTicksToWait )\r\n{\r\n StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n size_t xReceivedLength = 0, xBytesAvailable, xBytesToStoreMessageLength;\r\n\r\n configASSERT( pvRxData );\r\n configASSERT( pxStreamBuffer );\r\n\r\n /* This receive function is used by both message buffers, which store\r\n * discrete messages, and stream buffers, which store a continuous stream of\r\n * bytes. Discrete messages include an additional\r\n * sbBYTES_TO_STORE_MESSAGE_LENGTH bytes that hold the length of the\r\n * message. */\r\n if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r\n {\r\n xBytesToStoreMessageLength = sbBYTES_TO_STORE_MESSAGE_LENGTH;\r\n }\r\n else\r\n {\r\n xBytesToStoreMessageLength = 0;\r\n }\r\n\r\n if( xTicksToWait != ( TickType_t ) 0 )\r\n {\r\n /* Checking if there is data and clearing the notification state must be\r\n * performed atomically. */\r\n taskENTER_CRITICAL();\r\n {\r\n xBytesAvailable = prvBytesInBuffer( pxStreamBuffer );\r\n\r\n /* If this function was invoked by a message buffer read then\r\n * xBytesToStoreMessageLength holds the number of bytes used to hold\r\n * the length of the next discrete message. If this function was\r\n * invoked by a stream buffer read then xBytesToStoreMessageLength will\r\n * be 0. */\r\n if( xBytesAvailable <= xBytesToStoreMessageLength )\r\n {\r\n /* Clear notification state as going to wait for data. */\r\n ( void ) xTaskNotifyStateClear( NULL );\r\n\r\n /* Should only be one reader. */\r\n configASSERT( pxStreamBuffer->xTaskWaitingToReceive == NULL );\r\n pxStreamBuffer->xTaskWaitingToReceive = xTaskGetCurrentTaskHandle();\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n taskEXIT_CRITICAL();\r\n\r\n if( xBytesAvailable <= xBytesToStoreMessageLength )\r\n {\r\n /* Wait for data to be available. */\r\n traceBLOCKING_ON_STREAM_BUFFER_RECEIVE( xStreamBuffer );\r\n ( void ) xTaskNotifyWait( ( uint32_t ) 0, ( uint32_t ) 0, NULL, xTicksToWait );\r\n pxStreamBuffer->xTaskWaitingToReceive = NULL;\r\n\r\n /* Recheck the data available after blocking. */\r\n xBytesAvailable = prvBytesInBuffer( pxStreamBuffer );\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n else\r\n {\r\n xBytesAvailable = prvBytesInBuffer( pxStreamBuffer );\r\n }\r\n\r\n /* Whether receiving a discrete message (where xBytesToStoreMessageLength\r\n * holds the number of bytes used to store the message length) or a stream of\r\n * bytes (where xBytesToStoreMessageLength is zero), the number of bytes\r\n * available must be greater than xBytesToStoreMessageLength to be able to\r\n * read bytes from the buffer. */\r\n if( xBytesAvailable > xBytesToStoreMessageLength )\r\n {\r\n xReceivedLength = prvReadMessageFromBuffer( pxStreamBuffer, pvRxData, xBufferLengthBytes, xBytesAvailable, xBytesToStoreMessageLength );\r\n\r\n /* Was a task waiting for space in the buffer? */\r\n if( xReceivedLength != ( size_t ) 0 )\r\n {\r\n traceSTREAM_BUFFER_RECEIVE( xStreamBuffer, xReceivedLength );\r\n sbRECEIVE_COMPLETED( pxStreamBuffer );\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n else\r\n {\r\n traceSTREAM_BUFFER_RECEIVE_FAILED( xStreamBuffer );\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n return xReceivedLength;\r\n}\r",
  21662. "project": "FreeRTOS-Kernel",
  21663. "hash": 65705230510541843211735401564650538598,
  21664. "size": 102,
  21665. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21666. "message": "Add addition overflow check for stream buffer (#226)",
  21667. "target": 0,
  21668. "dataset": "other",
  21669. "idx": 246431
  21670. },
  21671. {
  21672. "func": "static size_t prvWriteBytesToBuffer( StreamBuffer_t * const pxStreamBuffer,\r\n const uint8_t * pucData,\r\n size_t xCount )\r\n{\r\n size_t xNextHead, xFirstLength;\r\n\r\n configASSERT( xCount > ( size_t ) 0 );\r\n\r\n xNextHead = pxStreamBuffer->xHead;\r\n\r\n /* Calculate the number of bytes that can be added in the first write -\r\n * which may be less than the total number of bytes that need to be added if\r\n * the buffer will wrap back to the beginning. */\r\n xFirstLength = configMIN( pxStreamBuffer->xLength - xNextHead, xCount );\r\n\r\n /* Write as many bytes as can be written in the first write. */\r\n configASSERT( ( xNextHead + xFirstLength ) <= pxStreamBuffer->xLength );\r\n ( void ) memcpy( ( void * ) ( &( pxStreamBuffer->pucBuffer[ xNextHead ] ) ), ( const void * ) pucData, xFirstLength ); /*lint !e9087 memcpy() requires void *. */\r\n\r\n /* If the number of bytes written was less than the number that could be\r\n * written in the first write... */\r\n if( xCount > xFirstLength )\r\n {\r\n /* ...then write the remaining bytes to the start of the buffer. */\r\n configASSERT( ( xCount - xFirstLength ) <= pxStreamBuffer->xLength );\r\n ( void ) memcpy( ( void * ) pxStreamBuffer->pucBuffer, ( const void * ) &( pucData[ xFirstLength ] ), xCount - xFirstLength ); /*lint !e9087 memcpy() requires void *. */\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n xNextHead += xCount;\r\n\r\n if( xNextHead >= pxStreamBuffer->xLength )\r\n {\r\n xNextHead -= pxStreamBuffer->xLength;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n pxStreamBuffer->xHead = xNextHead;\r\n\r\n return xCount;\r\n}\r",
  21673. "project": "FreeRTOS-Kernel",
  21674. "hash": 93412800138889592456373561498288041464,
  21675. "size": 47,
  21676. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21677. "message": "Add addition overflow check for stream buffer (#226)",
  21678. "target": 0,
  21679. "dataset": "other",
  21680. "idx": 246430
  21681. },
  21682. {
  21683. "func": "BaseType_t xStreamBufferIsFull( StreamBufferHandle_t xStreamBuffer )\r\n{\r\n BaseType_t xReturn;\r\n size_t xBytesToStoreMessageLength;\r\n const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n\r\n configASSERT( pxStreamBuffer );\r\n\r\n /* This generic version of the receive function is used by both message\r\n * buffers, which store discrete messages, and stream buffers, which store a\r\n * continuous stream of bytes. Discrete messages include an additional\r\n * sbBYTES_TO_STORE_MESSAGE_LENGTH bytes that hold the length of the message. */\r\n if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r\n {\r\n xBytesToStoreMessageLength = sbBYTES_TO_STORE_MESSAGE_LENGTH;\r\n }\r\n else\r\n {\r\n xBytesToStoreMessageLength = 0;\r\n }\r\n\r\n /* True if the available space equals zero. */\r\n if( xStreamBufferSpacesAvailable( xStreamBuffer ) <= xBytesToStoreMessageLength )\r\n {\r\n xReturn = pdTRUE;\r\n }\r\n else\r\n {\r\n xReturn = pdFALSE;\r\n }\r\n\r\n return xReturn;\r\n}\r",
  21684. "project": "FreeRTOS-Kernel",
  21685. "hash": 217613630795139077472170719255581332998,
  21686. "size": 33,
  21687. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21688. "message": "Add addition overflow check for stream buffer (#226)",
  21689. "target": 0,
  21690. "dataset": "other",
  21691. "idx": 246417
  21692. },
  21693. {
  21694. "func": "size_t xStreamBufferBytesAvailable( StreamBufferHandle_t xStreamBuffer )\r\n{\r\n const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n size_t xReturn;\r\n\r\n configASSERT( pxStreamBuffer );\r\n\r\n xReturn = prvBytesInBuffer( pxStreamBuffer );\r\n return xReturn;\r\n}\r",
  21695. "project": "FreeRTOS-Kernel",
  21696. "hash": 85709709045146751385815964735640082570,
  21697. "size": 10,
  21698. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21699. "message": "Add addition overflow check for stream buffer (#226)",
  21700. "target": 0,
  21701. "dataset": "other",
  21702. "idx": 246407
  21703. },
  21704. {
  21705. "func": "size_t xStreamBufferSend( StreamBufferHandle_t xStreamBuffer,\r\n const void * pvTxData,\r\n size_t xDataLengthBytes,\r\n TickType_t xTicksToWait )\r\n{\r\n StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n size_t xReturn, xSpace = 0;\r\n size_t xRequiredSpace = xDataLengthBytes;\r\n TimeOut_t xTimeOut;\r\n\r\n /* The maximum amount of space a stream buffer will ever report is its length\r\n * minus 1. */\r\n const size_t xMaxReportedSpace = pxStreamBuffer->xLength - ( size_t ) 1;\r\n\r\n configASSERT( pvTxData );\r\n configASSERT( pxStreamBuffer );\r\n\r\n /* This send function is used to write to both message buffers and stream\r\n * buffers. If this is a message buffer then the space needed must be\r\n * increased by the amount of bytes needed to store the length of the\r\n * message. */\r\n if( ( pxStreamBuffer->ucFlags & sbFLAGS_IS_MESSAGE_BUFFER ) != ( uint8_t ) 0 )\r\n {\r\n xRequiredSpace += sbBYTES_TO_STORE_MESSAGE_LENGTH;\r\n\r\n /* Overflow? */\r\n configASSERT( xRequiredSpace > xDataLengthBytes );\r\n\r\n /* If this is a message buffer then it must be possible to write the\r\n * whole message. */\r\n if( xRequiredSpace > xMaxReportedSpace )\r\n {\r\n /* The message would not fit even if the entire buffer was empty,\r\n * so don't wait for space. */\r\n xTicksToWait = ( TickType_t ) 0;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n else\r\n {\r\n /* If this is a stream buffer then it is acceptable to write only part\r\n * of the message to the buffer. Cap the length to the total length of\r\n * the buffer. */\r\n if( xRequiredSpace > xMaxReportedSpace )\r\n {\r\n xRequiredSpace = xMaxReportedSpace;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n\r\n if( xTicksToWait != ( TickType_t ) 0 )\r\n {\r\n vTaskSetTimeOutState( &xTimeOut );\r\n\r\n do\r\n {\r\n /* Wait until the required number of bytes are free in the message\r\n * buffer. */\r\n taskENTER_CRITICAL();\r\n {\r\n xSpace = xStreamBufferSpacesAvailable( pxStreamBuffer );\r\n\r\n if( xSpace < xRequiredSpace )\r\n {\r\n /* Clear notification state as going to wait for space. */\r\n ( void ) xTaskNotifyStateClear( NULL );\r\n\r\n /* Should only be one writer. */\r\n configASSERT( pxStreamBuffer->xTaskWaitingToSend == NULL );\r\n pxStreamBuffer->xTaskWaitingToSend = xTaskGetCurrentTaskHandle();\r\n }\r\n else\r\n {\r\n taskEXIT_CRITICAL();\r\n break;\r\n }\r\n }\r\n taskEXIT_CRITICAL();\r\n\r\n traceBLOCKING_ON_STREAM_BUFFER_SEND( xStreamBuffer );\r\n ( void ) xTaskNotifyWait( ( uint32_t ) 0, ( uint32_t ) 0, NULL, xTicksToWait );\r\n pxStreamBuffer->xTaskWaitingToSend = NULL;\r\n } while( xTaskCheckForTimeOut( &xTimeOut, &xTicksToWait ) == pdFALSE );\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n if( xSpace == ( size_t ) 0 )\r\n {\r\n xSpace = xStreamBufferSpacesAvailable( pxStreamBuffer );\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n xReturn = prvWriteMessageToBuffer( pxStreamBuffer, pvTxData, xDataLengthBytes, xSpace, xRequiredSpace );\r\n\r\n if( xReturn > ( size_t ) 0 )\r\n {\r\n traceSTREAM_BUFFER_SEND( xStreamBuffer, xReturn );\r\n\r\n /* Was a task waiting for the data? */\r\n if( prvBytesInBuffer( pxStreamBuffer ) >= pxStreamBuffer->xTriggerLevelBytes )\r\n {\r\n sbSEND_COMPLETED( pxStreamBuffer );\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n traceSTREAM_BUFFER_SEND_FAILED( xStreamBuffer );\r\n }\r\n\r\n return xReturn;\r\n}\r",
  21706. "project": "FreeRTOS-Kernel",
  21707. "hash": 210315931787382971401056014280888601116,
  21708. "size": 128,
  21709. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21710. "message": "Add addition overflow check for stream buffer (#226)",
  21711. "target": 0,
  21712. "dataset": "other",
  21713. "idx": 246424
  21714. },
  21715. {
  21716. "func": "size_t xStreamBufferSpacesAvailable( StreamBufferHandle_t xStreamBuffer )\r\n{\r\n const StreamBuffer_t * const pxStreamBuffer = xStreamBuffer;\r\n size_t xSpace;\r\n\r\n configASSERT( pxStreamBuffer );\r\n\r\n xSpace = pxStreamBuffer->xLength + pxStreamBuffer->xTail;\r\n xSpace -= pxStreamBuffer->xHead;\r\n xSpace -= ( size_t ) 1;\r\n\r\n if( xSpace >= pxStreamBuffer->xLength )\r\n {\r\n xSpace -= pxStreamBuffer->xLength;\r\n }\r\n else\r\n {\r\n mtCOVERAGE_TEST_MARKER();\r\n }\r\n\r\n return xSpace;\r\n}\r",
  21717. "project": "FreeRTOS-Kernel",
  21718. "hash": 119463301534942049801750027733044521570,
  21719. "size": 22,
  21720. "commit_id": "d05b9c123f2bf9090bce386a244fc934ae44db5b",
  21721. "message": "Add addition overflow check for stream buffer (#226)",
  21722. "target": 0,
  21723. "dataset": "other",
  21724. "idx": 246421
  21725. }
  21726. ]
  21727. },
  21728. {
  21729. "call_depth": 3,
  21730. "longest_call_chain": [
  21731. "send_response_end",
  21732. "send_response_data_reversed",
  21733. "dump_bucket_entry"
  21734. ],
  21735. "group_size": 7,
  21736. "functions": [
  21737. {
  21738. "func": "void RGWListBuckets_ObjStore_S3::send_response_begin(bool has_buckets)\n{\n if (op_ret)\n set_req_state_err(s, op_ret);\n dump_errno(s);\n dump_start(s);\n // Explicitly use chunked transfer encoding so that we can stream the result\n // to the user without having to wait for the full length of it.\n end_header(s, NULL, \"application/xml\", CHUNKED_TRANSFER_ENCODING);\n\n if (! op_ret) {\n list_all_buckets_start(s);\n dump_owner(s, s->user->user_id, s->user->display_name);\n s->formatter->open_array_section(\"Buckets\");\n sent_data = true;\n }\n}",
  21739. "project": "ceph",
  21740. "hash": 151504910633335479365418853557459877928,
  21741. "size": 17,
  21742. "commit_id": "ba0790a01ba5252db1ebc299db6e12cd758d0ff9",
  21743. "message": "rgw: reject unauthenticated response-header actions\n\nSigned-off-by: Matt Benjamin <mbenjamin@redhat.com>\nReviewed-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)",
  21744. "target": 0,
  21745. "dataset": "other",
  21746. "idx": 281331
  21747. },
  21748. {
  21749. "func": "void RGWListBuckets_ObjStore_SWIFT::send_response_begin(bool has_buckets)\n{\n if (op_ret) {\n set_req_state_err(s, op_ret);\n } else if (!has_buckets && s->format == RGW_FORMAT_PLAIN) {\n op_ret = STATUS_NO_CONTENT;\n set_req_state_err(s, op_ret);\n }\n\n if (! s->cct->_conf->rgw_swift_enforce_content_length) {\n /* Adding account stats in the header to keep align with Swift API */\n dump_account_metadata(s,\n global_stats,\n policies_stats,\n attrs,\n user_quota,\n static_cast<RGWAccessControlPolicy_SWIFTAcct&>(*s->user_acl));\n dump_errno(s);\n dump_header(s, \"Accept-Ranges\", \"bytes\");\n end_header(s, NULL, NULL, NO_CONTENT_LENGTH, true);\n }\n\n if (! op_ret) {\n dump_start(s);\n s->formatter->open_array_section_with_attrs(\"account\",\n FormatterAttrs(\"name\", s->user->display_name.c_str(), NULL));\n\n sent_data = true;\n }\n}",
  21750. "project": "ceph",
  21751. "hash": 4712945470508070102828199098323172380,
  21752. "size": 30,
  21753. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  21754. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  21755. "target": 0,
  21756. "dataset": "other",
  21757. "idx": 448788
  21758. },
  21759. {
  21760. "func": "void RGWListBuckets_ObjStore_SWIFT::send_response_data_reversed(RGWUserBuckets& buckets)\n{\n if (! sent_data) {\n return;\n }\n\n /* Take care of the prefix parameter of Swift API. There is no business\n * in applying the filter earlier as we really need to go through all\n * entries regardless of it (the headers like X-Account-Container-Count\n * aren't affected by specifying prefix). */\n std::map<std::string, RGWBucketEnt>& m = buckets.get_buckets();\n\n auto iter = m.rbegin();\n for (/* initialized above */;\n iter != m.rend() && !boost::algorithm::starts_with(iter->first, prefix);\n ++iter) {\n /* NOP */;\n }\n\n for (/* iter carried */;\n iter != m.rend() && boost::algorithm::starts_with(iter->first, prefix);\n ++iter) {\n dump_bucket_entry(iter->second);\n }\n}",
  21761. "project": "ceph",
  21762. "hash": 186625326925143980943779390568763616787,
  21763. "size": 25,
  21764. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  21765. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  21766. "target": 0,
  21767. "dataset": "other",
  21768. "idx": 448849
  21769. },
  21770. {
  21771. "func": "static void dump_account_metadata(struct req_state * const s,\n const RGWUsageStats& global_stats,\n const std::map<std::string, RGWUsageStats> &policies_stats,\n /* const */map<string, bufferlist>& attrs,\n const RGWQuotaInfo& quota,\n const RGWAccessControlPolicy_SWIFTAcct &policy)\n{\n /* Adding X-Timestamp to keep align with Swift API */\n dump_header(s, \"X-Timestamp\", ceph_clock_now());\n\n dump_header(s, \"X-Account-Container-Count\", global_stats.buckets_count);\n dump_header(s, \"X-Account-Object-Count\", global_stats.objects_count);\n dump_header(s, \"X-Account-Bytes-Used\", global_stats.bytes_used);\n dump_header(s, \"X-Account-Bytes-Used-Actual\", global_stats.bytes_used_rounded);\n\n for (const auto& kv : policies_stats) {\n const auto& policy_name = camelcase_dash_http_attr(kv.first);\n const auto& policy_stats = kv.second;\n\n dump_header_infixed(s, \"X-Account-Storage-Policy-\", policy_name,\n \"-Container-Count\", policy_stats.buckets_count);\n dump_header_infixed(s, \"X-Account-Storage-Policy-\", policy_name,\n \"-Object-Count\", policy_stats.objects_count);\n dump_header_infixed(s, \"X-Account-Storage-Policy-\", policy_name,\n \"-Bytes-Used\", policy_stats.bytes_used);\n dump_header_infixed(s, \"X-Account-Storage-Policy-\", policy_name,\n \"-Bytes-Used-Actual\", policy_stats.bytes_used_rounded);\n }\n\n /* Dump TempURL-related stuff */\n if (s->perm_mask == RGW_PERM_FULL_CONTROL) {\n auto iter = s->user->temp_url_keys.find(0);\n if (iter != std::end(s->user->temp_url_keys) && ! iter->second.empty()) {\n dump_header(s, \"X-Account-Meta-Temp-Url-Key\", iter->second);\n }\n\n iter = s->user->temp_url_keys.find(1);\n if (iter != std::end(s->user->temp_url_keys) && ! iter->second.empty()) {\n dump_header(s, \"X-Account-Meta-Temp-Url-Key-2\", iter->second);\n }\n }\n\n /* Dump quota headers. */\n if (quota.enabled) {\n if (quota.max_size >= 0) {\n dump_header(s, \"X-Account-Meta-Quota-Bytes\", quota.max_size);\n }\n\n /* Limit on the number of objects in a given account is a RadosGW's\n * extension. Swift's account quota WSGI filter doesn't support it. */\n if (quota.max_objects >= 0) {\n dump_header(s, \"X-Account-Meta-Quota-Count\", quota.max_objects);\n }\n }\n\n /* Dump user-defined metadata items and generic attrs. */\n const size_t PREFIX_LEN = sizeof(RGW_ATTR_META_PREFIX) - 1;\n map<string, bufferlist>::iterator iter;\n for (iter = attrs.lower_bound(RGW_ATTR_PREFIX); iter != attrs.end(); ++iter) {\n const char *name = iter->first.c_str();\n map<string, string>::const_iterator geniter = rgw_to_http_attrs.find(name);\n\n if (geniter != rgw_to_http_attrs.end()) {\n dump_header(s, geniter->second, iter->second);\n } else if (strncmp(name, RGW_ATTR_META_PREFIX, PREFIX_LEN) == 0) {\n dump_header_prefixed(s, \"X-Account-Meta-\",\n camelcase_dash_http_attr(name + PREFIX_LEN),\n iter->second);\n }\n }\n\n /* Dump account ACLs */\n auto account_acls = policy.to_str();\n if (account_acls) {\n dump_header(s, \"X-Account-Access-Control\", std::move(*account_acls));\n }\n}",
  21772. "project": "ceph",
  21773. "hash": 309704467928808382222914418458925402127,
  21774. "size": 77,
  21775. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  21776. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  21777. "target": 0,
  21778. "dataset": "other",
  21779. "idx": 448773
  21780. },
  21781. {
  21782. "func": "void RGWListBuckets_ObjStore_S3::send_response_end()\n{\n if (sent_data) {\n s->formatter->close_section();\n list_all_buckets_end(s);\n rgw_flush_formatter_and_reset(s, s->formatter);\n }\n}",
  21783. "project": "ceph",
  21784. "hash": 202263034526108553551723577532350274702,
  21785. "size": 8,
  21786. "commit_id": "ba0790a01ba5252db1ebc299db6e12cd758d0ff9",
  21787. "message": "rgw: reject unauthenticated response-header actions\n\nSigned-off-by: Matt Benjamin <mbenjamin@redhat.com>\nReviewed-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)",
  21788. "target": 0,
  21789. "dataset": "other",
  21790. "idx": 281297
  21791. },
  21792. {
  21793. "func": "void RGWListBuckets_ObjStore_SWIFT::send_response_end()\n{\n if (wants_reversed) {\n for (auto& buckets : reverse_buffer) {\n send_response_data_reversed(buckets);\n }\n }\n\n if (sent_data) {\n s->formatter->close_section();\n }\n\n if (s->cct->_conf->rgw_swift_enforce_content_length) {\n /* Adding account stats in the header to keep align with Swift API */\n dump_account_metadata(s,\n global_stats,\n policies_stats,\n attrs,\n user_quota,\n static_cast<RGWAccessControlPolicy_SWIFTAcct&>(*s->user_acl));\n dump_errno(s);\n end_header(s, nullptr, nullptr, s->formatter->get_len(), true);\n }\n\n if (sent_data || s->cct->_conf->rgw_swift_enforce_content_length) {\n rgw_flush_formatter_and_reset(s, s->formatter);\n }\n}",
  21794. "project": "ceph",
  21795. "hash": 201644979517479951703947394414346814779,
  21796. "size": 28,
  21797. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  21798. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  21799. "target": 0,
  21800. "dataset": "other",
  21801. "idx": 448772
  21802. },
  21803. {
  21804. "func": "void RGWListBuckets_ObjStore_SWIFT::dump_bucket_entry(const RGWBucketEnt& obj)\n{\n s->formatter->open_object_section(\"container\");\n s->formatter->dump_string(\"name\", obj.bucket.name);\n\n if (need_stats) {\n s->formatter->dump_int(\"count\", obj.count);\n s->formatter->dump_int(\"bytes\", obj.size);\n }\n\n s->formatter->close_section();\n\n if (! s->cct->_conf->rgw_swift_enforce_content_length) {\n rgw_flush_formatter(s, s->formatter);\n }\n}",
  21805. "project": "ceph",
  21806. "hash": 106532962756803195588990747286454623137,
  21807. "size": 16,
  21808. "commit_id": "f44a8ae8aa27ecef69528db9aec220f12492810e",
  21809. "message": "rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name\n\nchecking for empty name avoids later assertion in RGWObjectCtx::set_atomic\n\nFixes: CVE-2021-3531\n\nReviewed-by: Casey Bodley <cbodley@redhat.com>\nSigned-off-by: Casey Bodley <cbodley@redhat.com>\n(cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)",
  21810. "target": 0,
  21811. "dataset": "other",
  21812. "idx": 448855
  21813. }
  21814. ]
  21815. },
  21816. {
  21817. "call_depth": 5,
  21818. "longest_call_chain": [
  21819. "__udp4_lib_mcast_deliver",
  21820. "udp_queue_rcv_skb",
  21821. "__udp_queue_rcv_skb",
  21822. "__udp_enqueue_schedule_skb",
  21823. "busylock_release"
  21824. ],
  21825. "group_size": 6,
  21826. "functions": [
  21827. {
  21828. "func": "int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)\n{\n\tstruct sk_buff_head *list = &sk->sk_receive_queue;\n\tint rmem, delta, amt, err = -ENOMEM;\n\tspinlock_t *busy = NULL;\n\tint size;\n\n\t/* try to avoid the costly atomic add/sub pair when the receive\n\t * queue is full; always allow at least a packet\n\t */\n\trmem = atomic_read(&sk->sk_rmem_alloc);\n\tif (rmem > sk->sk_rcvbuf)\n\t\tgoto drop;\n\n\t/* Under mem pressure, it might be helpful to help udp_recvmsg()\n\t * having linear skbs :\n\t * - Reduce memory overhead and thus increase receive queue capacity\n\t * - Less cache line misses at copyout() time\n\t * - Less work at consume_skb() (less alien page frag freeing)\n\t */\n\tif (rmem > (sk->sk_rcvbuf >> 1)) {\n\t\tskb_condense(skb);\n\n\t\tbusy = busylock_acquire(sk);\n\t}\n\tsize = skb->truesize;\n\tudp_set_dev_scratch(skb);\n\n\t/* we drop only if the receive buf is full and the receive\n\t * queue contains some other skb\n\t */\n\trmem = atomic_add_return(size, &sk->sk_rmem_alloc);\n\tif (rmem > (size + sk->sk_rcvbuf))\n\t\tgoto uncharge_drop;\n\n\tspin_lock(&list->lock);\n\tif (size >= sk->sk_forward_alloc) {\n\t\tamt = sk_mem_pages(size);\n\t\tdelta = amt << SK_MEM_QUANTUM_SHIFT;\n\t\tif (!__sk_mem_raise_allocated(sk, delta, amt, SK_MEM_RECV)) {\n\t\t\terr = -ENOBUFS;\n\t\t\tspin_unlock(&list->lock);\n\t\t\tgoto uncharge_drop;\n\t\t}\n\n\t\tsk->sk_forward_alloc += delta;\n\t}\n\n\tsk->sk_forward_alloc -= size;\n\n\t/* no need to setup a destructor, we will explicitly release the\n\t * forward allocated memory on dequeue\n\t */\n\tsock_skb_set_dropcount(sk, skb);\n\n\t__skb_queue_tail(list, skb);\n\tspin_unlock(&list->lock);\n\n\tif (!sock_flag(sk, SOCK_DEAD))\n\t\tsk->sk_data_ready(sk);\n\n\tbusylock_release(busy);\n\treturn 0;\n\nuncharge_drop:\n\tatomic_sub(skb->truesize, &sk->sk_rmem_alloc);\n\ndrop:\n\tatomic_inc(&sk->sk_drops);\n\tbusylock_release(busy);\n\treturn err;\n}",
  21829. "project": "net",
  21830. "hash": 207730457495565135688945977999082885638,
  21831. "size": 72,
  21832. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  21833. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21834. "target": 0,
  21835. "dataset": "other",
  21836. "idx": 469011
  21837. },
  21838. {
  21839. "func": "static void udp_set_dev_scratch(struct sk_buff *skb)\n{\n\tstruct udp_dev_scratch *scratch = udp_skb_scratch(skb);\n\n\tBUILD_BUG_ON(sizeof(struct udp_dev_scratch) > sizeof(long));\n\tscratch->_tsize_state = skb->truesize;\n#if BITS_PER_LONG == 64\n\tscratch->len = skb->len;\n\tscratch->csum_unnecessary = !!skb_csum_unnecessary(skb);\n\tscratch->is_linear = !skb_is_nonlinear(skb);\n#endif\n\tif (likely(!skb->_skb_refdst))\n\t\tscratch->_tsize_state |= UDP_SKB_IS_STATELESS;\n}",
  21840. "project": "net",
  21841. "hash": 186548478787266436106538045524561063522,
  21842. "size": 14,
  21843. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  21844. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21845. "target": 0,
  21846. "dataset": "other",
  21847. "idx": 468993
  21848. },
  21849. {
  21850. "func": "static int __udp4_lib_mcast_deliver(struct net *net, struct sk_buff *skb,\n\t\t\t\t struct udphdr *uh,\n\t\t\t\t __be32 saddr, __be32 daddr,\n\t\t\t\t struct udp_table *udptable,\n\t\t\t\t int proto)\n{\n\tstruct sock *sk, *first = NULL;\n\tunsigned short hnum = ntohs(uh->dest);\n\tstruct udp_hslot *hslot = udp_hashslot(udptable, net, hnum);\n\tunsigned int hash2 = 0, hash2_any = 0, use_hash2 = (hslot->count > 10);\n\tunsigned int offset = offsetof(typeof(*sk), sk_node);\n\tint dif = skb->dev->ifindex;\n\tstruct hlist_node *node;\n\tstruct sk_buff *nskb;\n\n\tif (use_hash2) {\n\t\thash2_any = udp4_portaddr_hash(net, htonl(INADDR_ANY), hnum) &\n\t\t\t udptable->mask;\n\t\thash2 = udp4_portaddr_hash(net, daddr, hnum) & udptable->mask;\nstart_lookup:\n\t\thslot = &udptable->hash2[hash2];\n\t\toffset = offsetof(typeof(*sk), __sk_common.skc_portaddr_node);\n\t}\n\n\tsk_for_each_entry_offset_rcu(sk, node, &hslot->head, offset) {\n\t\tif (!__udp_is_mcast_sock(net, sk, uh->dest, daddr,\n\t\t\t\t\t uh->source, saddr, dif, hnum))\n\t\t\tcontinue;\n\n\t\tif (!first) {\n\t\t\tfirst = sk;\n\t\t\tcontinue;\n\t\t}\n\t\tnskb = skb_clone(skb, GFP_ATOMIC);\n\n\t\tif (unlikely(!nskb)) {\n\t\t\tatomic_inc(&sk->sk_drops);\n\t\t\t__UDP_INC_STATS(net, UDP_MIB_RCVBUFERRORS,\n\t\t\t\t\tIS_UDPLITE(sk));\n\t\t\t__UDP_INC_STATS(net, UDP_MIB_INERRORS,\n\t\t\t\t\tIS_UDPLITE(sk));\n\t\t\tcontinue;\n\t\t}\n\t\tif (udp_queue_rcv_skb(sk, nskb) > 0)\n\t\t\tconsume_skb(nskb);\n\t}\n\n\t/* Also lookup *:port if we are using hash2 and haven't done so yet. */\n\tif (use_hash2 && hash2 != hash2_any) {\n\t\thash2 = hash2_any;\n\t\tgoto start_lookup;\n\t}\n\n\tif (first) {\n\t\tif (udp_queue_rcv_skb(first, skb) > 0)\n\t\t\tconsume_skb(skb);\n\t} else {\n\t\tkfree_skb(skb);\n\t\t__UDP_INC_STATS(net, UDP_MIB_IGNOREDMULTI,\n\t\t\t\tproto == IPPROTO_UDPLITE);\n\t}\n\treturn 0;\n}",
  21851. "project": "net",
  21852. "hash": 152912852201407550967922989540603572688,
  21853. "size": 63,
  21854. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  21855. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21856. "target": 0,
  21857. "dataset": "other",
  21858. "idx": 468953
  21859. },
  21860. {
  21861. "func": "static void busylock_release(spinlock_t *busy)\n{\n\tif (busy)\n\t\tspin_unlock(busy);\n}",
  21862. "project": "net",
  21863. "hash": 131774410419539032478676489223282513263,
  21864. "size": 5,
  21865. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  21866. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21867. "target": 0,
  21868. "dataset": "other",
  21869. "idx": 468935
  21870. },
  21871. {
  21872. "func": "static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)\n{\n\tint rc;\n\n\tif (inet_sk(sk)->inet_daddr) {\n\t\tsock_rps_save_rxhash(sk, skb);\n\t\tsk_mark_napi_id(sk, skb);\n\t\tsk_incoming_cpu_update(sk);\n\t} else {\n\t\tsk_mark_napi_id_once(sk, skb);\n\t}\n\n\t/* At recvmsg() time we may access skb->dst or skb->sp depending on\n\t * the IP options and the cmsg flags, elsewhere can we clear all\n\t * pending head states while they are hot in the cache\n\t */\n\tif (likely(IPCB(skb)->opt.optlen == 0 && !skb_sec_path(skb)))\n\t\tskb_release_head_state(skb);\n\n\trc = __udp_enqueue_schedule_skb(sk, skb);\n\tif (rc < 0) {\n\t\tint is_udplite = IS_UDPLITE(sk);\n\n\t\t/* Note that an ENOMEM error is charged twice */\n\t\tif (rc == -ENOMEM)\n\t\t\tUDP_INC_STATS(sock_net(sk), UDP_MIB_RCVBUFERRORS,\n\t\t\t\t\tis_udplite);\n\t\tUDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);\n\t\tkfree_skb(skb);\n\t\ttrace_udp_fail_queue_rcv_skb(rc, sk);\n\t\treturn -1;\n\t}\n\n\treturn 0;\n}",
  21873. "project": "net",
  21874. "hash": 226682662751611739157088192734707207748,
  21875. "size": 35,
  21876. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  21877. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21878. "target": 0,
  21879. "dataset": "other",
  21880. "idx": 468915
  21881. },
  21882. {
  21883. "func": "static int udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb)\n{\n\tstruct udp_sock *up = udp_sk(sk);\n\tint is_udplite = IS_UDPLITE(sk);\n\n\t/*\n\t *\tCharge it to the socket, dropping if the queue is full.\n\t */\n\tif (!xfrm4_policy_check(sk, XFRM_POLICY_IN, skb))\n\t\tgoto drop;\n\tnf_reset(skb);\n\n\tif (static_key_false(&udp_encap_needed) && up->encap_type) {\n\t\tint (*encap_rcv)(struct sock *sk, struct sk_buff *skb);\n\n\t\t/*\n\t\t * This is an encapsulation socket so pass the skb to\n\t\t * the socket's udp_encap_rcv() hook. Otherwise, just\n\t\t * fall through and pass this up the UDP socket.\n\t\t * up->encap_rcv() returns the following value:\n\t\t * =0 if skb was successfully passed to the encap\n\t\t * handler or was discarded by it.\n\t\t * >0 if skb should be passed on to UDP.\n\t\t * <0 if skb should be resubmitted as proto -N\n\t\t */\n\n\t\t/* if we're overly short, let UDP handle it */\n\t\tencap_rcv = ACCESS_ONCE(up->encap_rcv);\n\t\tif (encap_rcv) {\n\t\t\tint ret;\n\n\t\t\t/* Verify checksum before giving to encap */\n\t\t\tif (udp_lib_checksum_complete(skb))\n\t\t\t\tgoto csum_error;\n\n\t\t\tret = encap_rcv(sk, skb);\n\t\t\tif (ret <= 0) {\n\t\t\t\t__UDP_INC_STATS(sock_net(sk),\n\t\t\t\t\t\tUDP_MIB_INDATAGRAMS,\n\t\t\t\t\t\tis_udplite);\n\t\t\t\treturn -ret;\n\t\t\t}\n\t\t}\n\n\t\t/* FALLTHROUGH -- it's a UDP Packet */\n\t}\n\n\t/*\n\t * \tUDP-Lite specific tests, ignored on UDP sockets\n\t */\n\tif ((is_udplite & UDPLITE_RECV_CC) && UDP_SKB_CB(skb)->partial_cov) {\n\n\t\t/*\n\t\t * MIB statistics other than incrementing the error count are\n\t\t * disabled for the following two types of errors: these depend\n\t\t * on the application settings, not on the functioning of the\n\t\t * protocol stack as such.\n\t\t *\n\t\t * RFC 3828 here recommends (sec 3.3): \"There should also be a\n\t\t * way ... to ... at least let the receiving application block\n\t\t * delivery of packets with coverage values less than a value\n\t\t * provided by the application.\"\n\t\t */\n\t\tif (up->pcrlen == 0) { /* full coverage was set */\n\t\t\tnet_dbg_ratelimited(\"UDPLite: partial coverage %d while full coverage %d requested\\n\",\n\t\t\t\t\t UDP_SKB_CB(skb)->cscov, skb->len);\n\t\t\tgoto drop;\n\t\t}\n\t\t/* The next case involves violating the min. coverage requested\n\t\t * by the receiver. This is subtle: if receiver wants x and x is\n\t\t * greater than the buffersize/MTU then receiver will complain\n\t\t * that it wants x while sender emits packets of smaller size y.\n\t\t * Therefore the above ...()->partial_cov statement is essential.\n\t\t */\n\t\tif (UDP_SKB_CB(skb)->cscov < up->pcrlen) {\n\t\t\tnet_dbg_ratelimited(\"UDPLite: coverage %d too small, need min %d\\n\",\n\t\t\t\t\t UDP_SKB_CB(skb)->cscov, up->pcrlen);\n\t\t\tgoto drop;\n\t\t}\n\t}\n\n\tprefetch(&sk->sk_rmem_alloc);\n\tif (rcu_access_pointer(sk->sk_filter) &&\n\t udp_lib_checksum_complete(skb))\n\t\t\tgoto csum_error;\n\n\tif (sk_filter_trim_cap(sk, skb, sizeof(struct udphdr)))\n\t\tgoto drop;\n\n\tudp_csum_pull_header(skb);\n\n\tipv4_pktinfo_prepare(sk, skb);\n\treturn __udp_queue_rcv_skb(sk, skb);\n\ncsum_error:\n\t__UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite);\ndrop:\n\t__UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);\n\tatomic_inc(&sk->sk_drops);\n\tkfree_skb(skb);\n\treturn -1;\n}",
  21884. "project": "net",
  21885. "hash": 177996409018370749187970055497880054743,
  21886. "size": 102,
  21887. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  21888. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21889. "target": 0,
  21890. "dataset": "other",
  21891. "idx": 468917
  21892. }
  21893. ]
  21894. },
  21895. {
  21896. "call_depth": 3,
  21897. "longest_call_chain": [
  21898. "tipc_nl_node_set_key",
  21899. "__tipc_nl_node_set_key",
  21900. "tipc_nl_retrieve_nodeid"
  21901. ],
  21902. "group_size": 6,
  21903. "functions": [
  21904. {
  21905. "func": "static int __tipc_nl_node_set_key(struct sk_buff *skb, struct genl_info *info)\n{\n\tstruct nlattr *attrs[TIPC_NLA_NODE_MAX + 1];\n\tstruct net *net = sock_net(skb->sk);\n\tstruct tipc_crypto *tx = tipc_net(net)->crypto_tx, *c = tx;\n\tstruct tipc_node *n = NULL;\n\tstruct tipc_aead_key *ukey;\n\tbool rekeying = true, master_key = false;\n\tu8 *id, *own_id, mode;\n\tu32 intv = 0;\n\tint rc = 0;\n\n\tif (!info->attrs[TIPC_NLA_NODE])\n\t\treturn -EINVAL;\n\n\trc = nla_parse_nested(attrs, TIPC_NLA_NODE_MAX,\n\t\t\t info->attrs[TIPC_NLA_NODE],\n\t\t\t tipc_nl_node_policy, info->extack);\n\tif (rc)\n\t\treturn rc;\n\n\town_id = tipc_own_id(net);\n\tif (!own_id) {\n\t\tGENL_SET_ERR_MSG(info, \"not found own node identity (set id?)\");\n\t\treturn -EPERM;\n\t}\n\n\trc = tipc_nl_retrieve_rekeying(attrs, &intv);\n\tif (rc == -ENODATA)\n\t\trekeying = false;\n\n\trc = tipc_nl_retrieve_key(attrs, &ukey);\n\tif (rc == -ENODATA && rekeying)\n\t\tgoto rekeying;\n\telse if (rc)\n\t\treturn rc;\n\n\trc = tipc_aead_key_validate(ukey, info);\n\tif (rc)\n\t\treturn rc;\n\n\trc = tipc_nl_retrieve_nodeid(attrs, &id);\n\tswitch (rc) {\n\tcase -ENODATA:\n\t\tmode = CLUSTER_KEY;\n\t\tmaster_key = !!(attrs[TIPC_NLA_NODE_KEY_MASTER]);\n\t\tbreak;\n\tcase 0:\n\t\tmode = PER_NODE_KEY;\n\t\tif (memcmp(id, own_id, NODE_ID_LEN)) {\n\t\t\tn = tipc_node_find_by_id(net, id) ?:\n\t\t\t\ttipc_node_create(net, 0, id, 0xffffu, 0, true);\n\t\t\tif (unlikely(!n))\n\t\t\t\treturn -ENOMEM;\n\t\t\tc = n->crypto_rx;\n\t\t}\n\t\tbreak;\n\tdefault:\n\t\treturn rc;\n\t}\n\n\t/* Initiate the TX/RX key */\n\trc = tipc_crypto_key_init(c, ukey, mode, master_key);\n\tif (n)\n\t\ttipc_node_put(n);\n\n\tif (unlikely(rc < 0)) {\n\t\tGENL_SET_ERR_MSG(info, \"unable to initiate or attach new key\");\n\t\treturn rc;\n\t} else if (c == tx) {\n\t\t/* Distribute TX key but not master one */\n\t\tif (!master_key && tipc_crypto_key_distr(tx, rc, NULL))\n\t\t\tGENL_SET_ERR_MSG(info, \"failed to replicate new key\");\nrekeying:\n\t\t/* Schedule TX rekeying if needed */\n\t\ttipc_crypto_rekeying_sched(tx, rekeying, intv);\n\t}\n\n\treturn 0;\n}",
  21906. "project": "linux",
  21907. "hash": 194979634484378285779372233553662865543,
  21908. "size": 80,
  21909. "commit_id": "0217ed2848e8538bcf9172d97ed2eeb4a26041bb",
  21910. "message": "tipc: better validate user input in tipc_nl_retrieve_key()\n\nBefore calling tipc_aead_key_size(ptr), we need to ensure\nwe have enough data to dereference ptr->keylen.\n\nWe probably also want to make sure tipc_aead_key_size()\nwont overflow with malicious ptr->keylen values.\n\nSyzbot reported:\n\nBUG: KMSAN: uninit-value in __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\nBUG: KMSAN: uninit-value in tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\nCPU: 0 PID: 21060 Comm: syz-executor.5 Not tainted 5.11.0-rc7-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:79 [inline]\n dump_stack+0x21c/0x280 lib/dump_stack.c:120\n kmsan_report+0xfb/0x1e0 mm/kmsan/kmsan_report.c:118\n __msan_warning+0x5f/0xa0 mm/kmsan/kmsan_instr.c:197\n __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\n tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\n genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline]\n genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]\n genl_rcv_msg+0x1319/0x1610 net/netlink/genetlink.c:800\n netlink_rcv_skb+0x6fa/0x810 net/netlink/af_netlink.c:2494\n genl_rcv+0x63/0x80 net/netlink/genetlink.c:811\n netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]\n netlink_unicast+0x11d6/0x14a0 net/netlink/af_netlink.c:1330\n netlink_sendmsg+0x1740/0x1840 net/netlink/af_netlink.c:1919\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\nRIP: 0023:0xf7f60549\nCode: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00\nRSP: 002b:00000000f555a5fc EFLAGS: 00000296 ORIG_RAX: 0000000000000172\nRAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000200\nRDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000\nRBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000\nR13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000\n\nUninit was created at:\n kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]\n kmsan_internal_poison_shadow+0x5c/0xf0 mm/kmsan/kmsan.c:104\n kmsan_slab_alloc+0x8d/0xe0 mm/kmsan/kmsan_hooks.c:76\n slab_alloc_node mm/slub.c:2907 [inline]\n __kmalloc_node_track_caller+0xa37/0x1430 mm/slub.c:4527\n __kmalloc_reserve net/core/skbuff.c:142 [inline]\n __alloc_skb+0x2f8/0xb30 net/core/skbuff.c:210\n alloc_skb include/linux/skbuff.h:1099 [inline]\n netlink_alloc_large_skb net/netlink/af_netlink.c:1176 [inline]\n netlink_sendmsg+0xdbc/0x1840 net/netlink/af_netlink.c:1894\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\n\nFixes: e1f32190cf7d (\"tipc: add support for AEAD key setting via netlink\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: Tuong Lien <tuong.t.lien@dektech.com.au>\nCc: Jon Maloy <jmaloy@redhat.com>\nCc: Ying Xue <ying.xue@windriver.com>\nReported-by: syzbot <syzkaller@googlegroups.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21911. "target": 0,
  21912. "dataset": "other",
  21913. "idx": 364911
  21914. },
  21915. {
  21916. "func": "static int tipc_nl_retrieve_rekeying(struct nlattr **attrs, u32 *intv)\n{\n\tstruct nlattr *attr = attrs[TIPC_NLA_NODE_REKEYING];\n\n\tif (!attr)\n\t\treturn -ENODATA;\n\n\t*intv = nla_get_u32(attr);\n\treturn 0;\n}",
  21917. "project": "linux",
  21918. "hash": 193816255445229179305180535936392676020,
  21919. "size": 10,
  21920. "commit_id": "0217ed2848e8538bcf9172d97ed2eeb4a26041bb",
  21921. "message": "tipc: better validate user input in tipc_nl_retrieve_key()\n\nBefore calling tipc_aead_key_size(ptr), we need to ensure\nwe have enough data to dereference ptr->keylen.\n\nWe probably also want to make sure tipc_aead_key_size()\nwont overflow with malicious ptr->keylen values.\n\nSyzbot reported:\n\nBUG: KMSAN: uninit-value in __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\nBUG: KMSAN: uninit-value in tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\nCPU: 0 PID: 21060 Comm: syz-executor.5 Not tainted 5.11.0-rc7-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:79 [inline]\n dump_stack+0x21c/0x280 lib/dump_stack.c:120\n kmsan_report+0xfb/0x1e0 mm/kmsan/kmsan_report.c:118\n __msan_warning+0x5f/0xa0 mm/kmsan/kmsan_instr.c:197\n __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\n tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\n genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline]\n genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]\n genl_rcv_msg+0x1319/0x1610 net/netlink/genetlink.c:800\n netlink_rcv_skb+0x6fa/0x810 net/netlink/af_netlink.c:2494\n genl_rcv+0x63/0x80 net/netlink/genetlink.c:811\n netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]\n netlink_unicast+0x11d6/0x14a0 net/netlink/af_netlink.c:1330\n netlink_sendmsg+0x1740/0x1840 net/netlink/af_netlink.c:1919\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\nRIP: 0023:0xf7f60549\nCode: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00\nRSP: 002b:00000000f555a5fc EFLAGS: 00000296 ORIG_RAX: 0000000000000172\nRAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000200\nRDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000\nRBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000\nR13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000\n\nUninit was created at:\n kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]\n kmsan_internal_poison_shadow+0x5c/0xf0 mm/kmsan/kmsan.c:104\n kmsan_slab_alloc+0x8d/0xe0 mm/kmsan/kmsan_hooks.c:76\n slab_alloc_node mm/slub.c:2907 [inline]\n __kmalloc_node_track_caller+0xa37/0x1430 mm/slub.c:4527\n __kmalloc_reserve net/core/skbuff.c:142 [inline]\n __alloc_skb+0x2f8/0xb30 net/core/skbuff.c:210\n alloc_skb include/linux/skbuff.h:1099 [inline]\n netlink_alloc_large_skb net/netlink/af_netlink.c:1176 [inline]\n netlink_sendmsg+0xdbc/0x1840 net/netlink/af_netlink.c:1894\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\n\nFixes: e1f32190cf7d (\"tipc: add support for AEAD key setting via netlink\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: Tuong Lien <tuong.t.lien@dektech.com.au>\nCc: Jon Maloy <jmaloy@redhat.com>\nCc: Ying Xue <ying.xue@windriver.com>\nReported-by: syzbot <syzkaller@googlegroups.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21922. "target": 0,
  21923. "dataset": "other",
  21924. "idx": 364948
  21925. },
  21926. {
  21927. "func": "static int tipc_nl_retrieve_nodeid(struct nlattr **attrs, u8 **node_id)\n{\n\tstruct nlattr *attr = attrs[TIPC_NLA_NODE_ID];\n\n\tif (!attr)\n\t\treturn -ENODATA;\n\n\tif (nla_len(attr) < TIPC_NODEID_LEN)\n\t\treturn -EINVAL;\n\n\t*node_id = (u8 *)nla_data(attr);\n\treturn 0;\n}",
  21928. "project": "linux",
  21929. "hash": 153862900688780788735562620022692417252,
  21930. "size": 13,
  21931. "commit_id": "0217ed2848e8538bcf9172d97ed2eeb4a26041bb",
  21932. "message": "tipc: better validate user input in tipc_nl_retrieve_key()\n\nBefore calling tipc_aead_key_size(ptr), we need to ensure\nwe have enough data to dereference ptr->keylen.\n\nWe probably also want to make sure tipc_aead_key_size()\nwont overflow with malicious ptr->keylen values.\n\nSyzbot reported:\n\nBUG: KMSAN: uninit-value in __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\nBUG: KMSAN: uninit-value in tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\nCPU: 0 PID: 21060 Comm: syz-executor.5 Not tainted 5.11.0-rc7-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:79 [inline]\n dump_stack+0x21c/0x280 lib/dump_stack.c:120\n kmsan_report+0xfb/0x1e0 mm/kmsan/kmsan_report.c:118\n __msan_warning+0x5f/0xa0 mm/kmsan/kmsan_instr.c:197\n __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\n tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\n genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline]\n genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]\n genl_rcv_msg+0x1319/0x1610 net/netlink/genetlink.c:800\n netlink_rcv_skb+0x6fa/0x810 net/netlink/af_netlink.c:2494\n genl_rcv+0x63/0x80 net/netlink/genetlink.c:811\n netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]\n netlink_unicast+0x11d6/0x14a0 net/netlink/af_netlink.c:1330\n netlink_sendmsg+0x1740/0x1840 net/netlink/af_netlink.c:1919\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\nRIP: 0023:0xf7f60549\nCode: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00\nRSP: 002b:00000000f555a5fc EFLAGS: 00000296 ORIG_RAX: 0000000000000172\nRAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000200\nRDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000\nRBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000\nR13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000\n\nUninit was created at:\n kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]\n kmsan_internal_poison_shadow+0x5c/0xf0 mm/kmsan/kmsan.c:104\n kmsan_slab_alloc+0x8d/0xe0 mm/kmsan/kmsan_hooks.c:76\n slab_alloc_node mm/slub.c:2907 [inline]\n __kmalloc_node_track_caller+0xa37/0x1430 mm/slub.c:4527\n __kmalloc_reserve net/core/skbuff.c:142 [inline]\n __alloc_skb+0x2f8/0xb30 net/core/skbuff.c:210\n alloc_skb include/linux/skbuff.h:1099 [inline]\n netlink_alloc_large_skb net/netlink/af_netlink.c:1176 [inline]\n netlink_sendmsg+0xdbc/0x1840 net/netlink/af_netlink.c:1894\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\n\nFixes: e1f32190cf7d (\"tipc: add support for AEAD key setting via netlink\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: Tuong Lien <tuong.t.lien@dektech.com.au>\nCc: Jon Maloy <jmaloy@redhat.com>\nCc: Ying Xue <ying.xue@windriver.com>\nReported-by: syzbot <syzkaller@googlegroups.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21933. "target": 0,
  21934. "dataset": "other",
  21935. "idx": 364974
  21936. },
  21937. {
  21938. "func": "static int tipc_nl_retrieve_key(struct nlattr **attrs,\n\t\t\t\tstruct tipc_aead_key **key)\n{\n\tstruct nlattr *attr = attrs[TIPC_NLA_NODE_KEY];\n\n\tif (!attr)\n\t\treturn -ENODATA;\n\n\t*key = (struct tipc_aead_key *)nla_data(attr);\n\tif (nla_len(attr) < tipc_aead_key_size(*key))\n\t\treturn -EINVAL;\n\n\treturn 0;\n}",
  21939. "project": "linux",
  21940. "hash": 284003867985169166932353704253458867619,
  21941. "size": 14,
  21942. "commit_id": "0217ed2848e8538bcf9172d97ed2eeb4a26041bb",
  21943. "message": "tipc: better validate user input in tipc_nl_retrieve_key()\n\nBefore calling tipc_aead_key_size(ptr), we need to ensure\nwe have enough data to dereference ptr->keylen.\n\nWe probably also want to make sure tipc_aead_key_size()\nwont overflow with malicious ptr->keylen values.\n\nSyzbot reported:\n\nBUG: KMSAN: uninit-value in __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\nBUG: KMSAN: uninit-value in tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\nCPU: 0 PID: 21060 Comm: syz-executor.5 Not tainted 5.11.0-rc7-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:79 [inline]\n dump_stack+0x21c/0x280 lib/dump_stack.c:120\n kmsan_report+0xfb/0x1e0 mm/kmsan/kmsan_report.c:118\n __msan_warning+0x5f/0xa0 mm/kmsan/kmsan_instr.c:197\n __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\n tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\n genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline]\n genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]\n genl_rcv_msg+0x1319/0x1610 net/netlink/genetlink.c:800\n netlink_rcv_skb+0x6fa/0x810 net/netlink/af_netlink.c:2494\n genl_rcv+0x63/0x80 net/netlink/genetlink.c:811\n netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]\n netlink_unicast+0x11d6/0x14a0 net/netlink/af_netlink.c:1330\n netlink_sendmsg+0x1740/0x1840 net/netlink/af_netlink.c:1919\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\nRIP: 0023:0xf7f60549\nCode: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00\nRSP: 002b:00000000f555a5fc EFLAGS: 00000296 ORIG_RAX: 0000000000000172\nRAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000200\nRDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000\nRBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000\nR13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000\n\nUninit was created at:\n kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]\n kmsan_internal_poison_shadow+0x5c/0xf0 mm/kmsan/kmsan.c:104\n kmsan_slab_alloc+0x8d/0xe0 mm/kmsan/kmsan_hooks.c:76\n slab_alloc_node mm/slub.c:2907 [inline]\n __kmalloc_node_track_caller+0xa37/0x1430 mm/slub.c:4527\n __kmalloc_reserve net/core/skbuff.c:142 [inline]\n __alloc_skb+0x2f8/0xb30 net/core/skbuff.c:210\n alloc_skb include/linux/skbuff.h:1099 [inline]\n netlink_alloc_large_skb net/netlink/af_netlink.c:1176 [inline]\n netlink_sendmsg+0xdbc/0x1840 net/netlink/af_netlink.c:1894\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\n\nFixes: e1f32190cf7d (\"tipc: add support for AEAD key setting via netlink\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: Tuong Lien <tuong.t.lien@dektech.com.au>\nCc: Jon Maloy <jmaloy@redhat.com>\nCc: Ying Xue <ying.xue@windriver.com>\nReported-by: syzbot <syzkaller@googlegroups.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21944. "target": 1,
  21945. "dataset": "other",
  21946. "idx": 204764
  21947. },
  21948. {
  21949. "func": "static int tipc_nl_retrieve_key(struct nlattr **attrs,\n\t\t\t\tstruct tipc_aead_key **pkey)\n{\n\tstruct nlattr *attr = attrs[TIPC_NLA_NODE_KEY];\n\tstruct tipc_aead_key *key;\n\n\tif (!attr)\n\t\treturn -ENODATA;\n\n\tif (nla_len(attr) < sizeof(*key))\n\t\treturn -EINVAL;\n\tkey = (struct tipc_aead_key *)nla_data(attr);\n\tif (key->keylen > TIPC_AEAD_KEYLEN_MAX ||\n\t nla_len(attr) < tipc_aead_key_size(key))\n\t\treturn -EINVAL;\n\n\t*pkey = key;\n\treturn 0;\n}",
  21950. "project": "linux",
  21951. "hash": 184504004987990882955216536013391680124,
  21952. "size": 19,
  21953. "commit_id": "0217ed2848e8538bcf9172d97ed2eeb4a26041bb",
  21954. "message": "tipc: better validate user input in tipc_nl_retrieve_key()\n\nBefore calling tipc_aead_key_size(ptr), we need to ensure\nwe have enough data to dereference ptr->keylen.\n\nWe probably also want to make sure tipc_aead_key_size()\nwont overflow with malicious ptr->keylen values.\n\nSyzbot reported:\n\nBUG: KMSAN: uninit-value in __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\nBUG: KMSAN: uninit-value in tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\nCPU: 0 PID: 21060 Comm: syz-executor.5 Not tainted 5.11.0-rc7-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:79 [inline]\n dump_stack+0x21c/0x280 lib/dump_stack.c:120\n kmsan_report+0xfb/0x1e0 mm/kmsan/kmsan_report.c:118\n __msan_warning+0x5f/0xa0 mm/kmsan/kmsan_instr.c:197\n __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\n tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\n genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline]\n genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]\n genl_rcv_msg+0x1319/0x1610 net/netlink/genetlink.c:800\n netlink_rcv_skb+0x6fa/0x810 net/netlink/af_netlink.c:2494\n genl_rcv+0x63/0x80 net/netlink/genetlink.c:811\n netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]\n netlink_unicast+0x11d6/0x14a0 net/netlink/af_netlink.c:1330\n netlink_sendmsg+0x1740/0x1840 net/netlink/af_netlink.c:1919\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\nRIP: 0023:0xf7f60549\nCode: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00\nRSP: 002b:00000000f555a5fc EFLAGS: 00000296 ORIG_RAX: 0000000000000172\nRAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000200\nRDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000\nRBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000\nR13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000\n\nUninit was created at:\n kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]\n kmsan_internal_poison_shadow+0x5c/0xf0 mm/kmsan/kmsan.c:104\n kmsan_slab_alloc+0x8d/0xe0 mm/kmsan/kmsan_hooks.c:76\n slab_alloc_node mm/slub.c:2907 [inline]\n __kmalloc_node_track_caller+0xa37/0x1430 mm/slub.c:4527\n __kmalloc_reserve net/core/skbuff.c:142 [inline]\n __alloc_skb+0x2f8/0xb30 net/core/skbuff.c:210\n alloc_skb include/linux/skbuff.h:1099 [inline]\n netlink_alloc_large_skb net/netlink/af_netlink.c:1176 [inline]\n netlink_sendmsg+0xdbc/0x1840 net/netlink/af_netlink.c:1894\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\n\nFixes: e1f32190cf7d (\"tipc: add support for AEAD key setting via netlink\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: Tuong Lien <tuong.t.lien@dektech.com.au>\nCc: Jon Maloy <jmaloy@redhat.com>\nCc: Ying Xue <ying.xue@windriver.com>\nReported-by: syzbot <syzkaller@googlegroups.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21955. "target": 0,
  21956. "dataset": "other",
  21957. "idx": 364977
  21958. },
  21959. {
  21960. "func": "int tipc_nl_node_set_key(struct sk_buff *skb, struct genl_info *info)\n{\n\tint err;\n\n\trtnl_lock();\n\terr = __tipc_nl_node_set_key(skb, info);\n\trtnl_unlock();\n\n\treturn err;\n}",
  21961. "project": "linux",
  21962. "hash": 152830576302131176881413034673229092509,
  21963. "size": 10,
  21964. "commit_id": "0217ed2848e8538bcf9172d97ed2eeb4a26041bb",
  21965. "message": "tipc: better validate user input in tipc_nl_retrieve_key()\n\nBefore calling tipc_aead_key_size(ptr), we need to ensure\nwe have enough data to dereference ptr->keylen.\n\nWe probably also want to make sure tipc_aead_key_size()\nwont overflow with malicious ptr->keylen values.\n\nSyzbot reported:\n\nBUG: KMSAN: uninit-value in __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\nBUG: KMSAN: uninit-value in tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\nCPU: 0 PID: 21060 Comm: syz-executor.5 Not tainted 5.11.0-rc7-syzkaller #0\nHardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011\nCall Trace:\n __dump_stack lib/dump_stack.c:79 [inline]\n dump_stack+0x21c/0x280 lib/dump_stack.c:120\n kmsan_report+0xfb/0x1e0 mm/kmsan/kmsan_report.c:118\n __msan_warning+0x5f/0xa0 mm/kmsan/kmsan_instr.c:197\n __tipc_nl_node_set_key net/tipc/node.c:2971 [inline]\n tipc_nl_node_set_key+0x9bf/0x13b0 net/tipc/node.c:3023\n genl_family_rcv_msg_doit net/netlink/genetlink.c:739 [inline]\n genl_family_rcv_msg net/netlink/genetlink.c:783 [inline]\n genl_rcv_msg+0x1319/0x1610 net/netlink/genetlink.c:800\n netlink_rcv_skb+0x6fa/0x810 net/netlink/af_netlink.c:2494\n genl_rcv+0x63/0x80 net/netlink/genetlink.c:811\n netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]\n netlink_unicast+0x11d6/0x14a0 net/netlink/af_netlink.c:1330\n netlink_sendmsg+0x1740/0x1840 net/netlink/af_netlink.c:1919\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\nRIP: 0023:0xf7f60549\nCode: 03 74 c0 01 10 05 03 74 b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 8d b4 26 00 00 00 00 8d b4 26 00 00 00 00\nRSP: 002b:00000000f555a5fc EFLAGS: 00000296 ORIG_RAX: 0000000000000172\nRAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000200\nRDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000\nRBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000\nR10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000\nR13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000\n\nUninit was created at:\n kmsan_save_stack_with_flags mm/kmsan/kmsan.c:121 [inline]\n kmsan_internal_poison_shadow+0x5c/0xf0 mm/kmsan/kmsan.c:104\n kmsan_slab_alloc+0x8d/0xe0 mm/kmsan/kmsan_hooks.c:76\n slab_alloc_node mm/slub.c:2907 [inline]\n __kmalloc_node_track_caller+0xa37/0x1430 mm/slub.c:4527\n __kmalloc_reserve net/core/skbuff.c:142 [inline]\n __alloc_skb+0x2f8/0xb30 net/core/skbuff.c:210\n alloc_skb include/linux/skbuff.h:1099 [inline]\n netlink_alloc_large_skb net/netlink/af_netlink.c:1176 [inline]\n netlink_sendmsg+0xdbc/0x1840 net/netlink/af_netlink.c:1894\n sock_sendmsg_nosec net/socket.c:652 [inline]\n sock_sendmsg net/socket.c:672 [inline]\n ____sys_sendmsg+0xcfc/0x12f0 net/socket.c:2345\n ___sys_sendmsg net/socket.c:2399 [inline]\n __sys_sendmsg+0x714/0x830 net/socket.c:2432\n __compat_sys_sendmsg net/compat.c:347 [inline]\n __do_compat_sys_sendmsg net/compat.c:354 [inline]\n __se_compat_sys_sendmsg+0xa7/0xc0 net/compat.c:351\n __ia32_compat_sys_sendmsg+0x4a/0x70 net/compat.c:351\n do_syscall_32_irqs_on arch/x86/entry/common.c:79 [inline]\n __do_fast_syscall_32+0x102/0x160 arch/x86/entry/common.c:141\n do_fast_syscall_32+0x6a/0xc0 arch/x86/entry/common.c:166\n do_SYSENTER_32+0x73/0x90 arch/x86/entry/common.c:209\n entry_SYSENTER_compat_after_hwframe+0x4d/0x5c\n\nFixes: e1f32190cf7d (\"tipc: add support for AEAD key setting via netlink\")\nSigned-off-by: Eric Dumazet <edumazet@google.com>\nCc: Tuong Lien <tuong.t.lien@dektech.com.au>\nCc: Jon Maloy <jmaloy@redhat.com>\nCc: Ying Xue <ying.xue@windriver.com>\nReported-by: syzbot <syzkaller@googlegroups.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  21966. "target": 0,
  21967. "dataset": "other",
  21968. "idx": 364962
  21969. }
  21970. ]
  21971. },
  21972. {
  21973. "call_depth": 3,
  21974. "longest_call_chain": [
  21975. "t2p_write_pdf",
  21976. "t2p_readwrite_pdf_image",
  21977. "t2p_sample_realize_palette"
  21978. ],
  21979. "group_size": 9,
  21980. "functions": [
  21981. {
  21982. "func": "tsize_t t2p_readwrite_pdf_image(T2P* t2p, TIFF* input, TIFF* output){\n\n\ttsize_t written=0;\n\tunsigned char* buffer=NULL;\n\tunsigned char* samplebuffer=NULL;\n\ttsize_t bufferoffset=0;\n\ttsize_t samplebufferoffset=0;\n\ttsize_t read=0;\n\ttstrip_t i=0;\n\ttstrip_t j=0;\n\ttstrip_t stripcount=0;\n\ttsize_t stripsize=0;\n\ttsize_t sepstripcount=0;\n\ttsize_t sepstripsize=0;\n#ifdef OJPEG_SUPPORT\n\ttoff_t inputoffset=0;\n\tuint16 h_samp=1;\n\tuint16 v_samp=1;\n\tuint16 ri=1;\n\tuint32 rows=0;\n#endif /* ifdef OJPEG_SUPPORT */\n#ifdef JPEG_SUPPORT\n\tunsigned char* jpt;\n\tfloat* xfloatp;\n\tuint64* sbc;\n\tunsigned char* stripbuffer;\n\ttsize_t striplength=0;\n\tuint32 max_striplength=0;\n#endif /* ifdef JPEG_SUPPORT */\n\n\t/* Fail if prior error (in particular, can't trust tiff_datasize) */\n\tif (t2p->t2p_error != T2P_ERR_OK)\n\t\treturn(0);\n\n\tif(t2p->pdf_transcode == T2P_TRANSCODE_RAW){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_G4){\n\t\t\tbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif (buffer == NULL) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory for \"\n\t\t\t\t\t\"t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif (TIFFReadRawStrip(input, 0, (tdata_t) buffer,\n\t\t\t\t\t t2p->tiff_datasize) < 0) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"TIFFReadRawStrip() failed\");\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB){\n\t\t\t\t\t/*\n\t\t\t\t\t * make sure is lsb-to-msb\n\t\t\t\t\t * bit-endianness fill order\n\t\t\t\t\t */\n\t\t\t\t\tTIFFReverseBits(buffer,\n\t\t\t\t\t\t\tt2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer,\n\t\t\t\t t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif /* ifdef CCITT_SUPPORT */\n#ifdef ZIP_SUPPORT\n\t\tif (t2p->pdf_compression == T2P_COMPRESS_ZIP) {\n\t\t\tbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer == NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif (TIFFReadRawStrip(input, 0, (tdata_t) buffer,\n\t\t\t\t\t t2p->tiff_datasize) < 0) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"TIFFReadRawStrip() failed\");\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB) {\n\t\t\t\t\tTIFFReverseBits(buffer,\n\t\t\t\t\t\t\tt2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer,\n\t\t\t\t t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif /* ifdef ZIP_SUPPORT */\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_OJPEG) {\n\n\t\t\tif(t2p->tiff_dataoffset != 0) {\n\t\t\t\tbuffer = (unsigned char*)\n\t\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n\t\t\t\tif(buffer == NULL) {\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\t\tif(t2p->pdf_ojpegiflength==0){\n\t\t\t\t\tinputoffset=t2pSeekFile(input, 0,\n\t\t\t\t\t\t\t\t SEEK_CUR);\n\t\t\t\t\tt2pSeekFile(input,\n\t\t\t\t\t\t t2p->tiff_dataoffset,\n\t\t\t\t\t\t SEEK_SET);\n\t\t\t\t\tt2pReadFile(input, (tdata_t) buffer,\n\t\t\t\t\t\t t2p->tiff_datasize);\n\t\t\t\t\tt2pSeekFile(input, inputoffset,\n\t\t\t\t\t\t SEEK_SET);\n\t\t\t\t\tt2pWriteFile(output, (tdata_t) buffer,\n\t\t\t\t\t\t t2p->tiff_datasize);\n\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\treturn(t2p->tiff_datasize);\n\t\t\t\t} else {\n\t\t\t\t\tinputoffset=t2pSeekFile(input, 0,\n\t\t\t\t\t\t\t\t SEEK_CUR);\n\t\t\t\t\tt2pSeekFile(input,\n\t\t\t\t\t\t t2p->tiff_dataoffset,\n\t\t\t\t\t\t SEEK_SET);\n\t\t\t\t\tbufferoffset = t2pReadFile(input,\n\t\t\t\t\t\t(tdata_t) buffer,\n\t\t\t\t\t\tt2p->pdf_ojpegiflength);\n\t\t\t\t\tt2p->pdf_ojpegiflength = 0;\n\t\t\t\t\tt2pSeekFile(input, inputoffset,\n\t\t\t\t\t\t SEEK_SET);\n\t\t\t\t\tTIFFGetField(input,\n\t\t\t\t\t\t TIFFTAG_YCBCRSUBSAMPLING,\n\t\t\t\t\t\t &h_samp, &v_samp);\n\t\t\t\t\tbuffer[bufferoffset++]= 0xff;\n\t\t\t\t\tbuffer[bufferoffset++]= 0xdd;\n\t\t\t\t\tbuffer[bufferoffset++]= 0x00;\n\t\t\t\t\tbuffer[bufferoffset++]= 0x04;\n\t\t\t\t\th_samp*=8;\n\t\t\t\t\tv_samp*=8;\n\t\t\t\t\tri=(t2p->tiff_width+h_samp-1) / h_samp;\n\t\t\t\t\tTIFFGetField(input,\n\t\t\t\t\t\t TIFFTAG_ROWSPERSTRIP,\n\t\t\t\t\t\t &rows);\n\t\t\t\t\tri*=(rows+v_samp-1)/v_samp;\n\t\t\t\t\tbuffer[bufferoffset++]= (ri>>8) & 0xff;\n\t\t\t\t\tbuffer[bufferoffset++]= ri & 0xff;\n\t\t\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\t\t\tif(i != 0 ){ \n\t\t\t\t\t\t\tbuffer[bufferoffset++]=0xff;\n\t\t\t\t\t\t\tbuffer[bufferoffset++]=(0xd0 | ((i-1)%8));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbufferoffset+=TIFFReadRawStrip(input, \n\t\t\t\t\t\t\ti, \n\t\t\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t\t\t-1);\n\t\t\t\t\t}\n\t\t\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\treturn(bufferoffset);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif(! t2p->pdf_ojpegdata){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\t\"No support for OJPEG image %s with bad tables\",\n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tbuffer = (unsigned char*)\n\t\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n\t\t\t\tif(buffer==NULL){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\t\t_TIFFmemcpy(buffer, t2p->pdf_ojpegdata, t2p->pdf_ojpegdatalength);\n\t\t\t\tbufferoffset=t2p->pdf_ojpegdatalength;\n\t\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\t\ttsize_t retTIFFReadRawStrip;\n\t\t\t\t\tif(i != 0){\n\t\t\t\t\t\tbuffer[bufferoffset++]=0xff;\n\t\t\t\t\t\tbuffer[bufferoffset++]=(0xd0 | ((i-1)%8));\n\t\t\t\t\t}\n\t\t\t\t\tretTIFFReadRawStrip = TIFFReadRawStrip(input,\n\t\t\t\t\t\ti, \n\t\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t\t-1);\n\t\t\t\t\tif (retTIFFReadRawStrip < 0) {\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \"TIFFReadRawStrip()\");\n\t\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\treturn(0);\n\t\t\t\t\t}\n\t\t\t\t\tbufferoffset += retTIFFReadRawStrip;\n\t\t\t\t}\n\t\t\t\tif( ! ( (buffer[bufferoffset-1]==0xd9) && (buffer[bufferoffset-2]==0xff) ) ){\n\t\t\t\t\t\tbuffer[bufferoffset++]=0xff;\n\t\t\t\t\t\tbuffer[bufferoffset++]=0xd9;\n\t\t\t\t}\n\t\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\treturn(bufferoffset);\n#if 0\n /*\n This hunk of code removed code is clearly\n mis-placed and we are not sure where it\n should be (if anywhere)\n */\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"No support for OJPEG image %s with no JPEG File Interchange offset\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n#endif\n\t\t\t}\n\t\t}\n#endif /* ifdef OJPEG_SUPPORT */\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_JPEG) {\n\t\t\tuint32 count = 0;\n\t\t\tbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif (TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0) {\n\t\t\t\tif(count > 4) {\n\t\t\t\t\t_TIFFmemcpy(buffer, jpt, count);\n\t\t\t\t\tbufferoffset += count - 2;\n\t\t\t\t}\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tif(sbc[i]>max_striplength) max_striplength=sbc[i];\n\t\t\t}\n\t\t\tstripbuffer = (unsigned char*)\n\t\t\t\t_TIFFmalloc(max_striplength);\n\t\t\tif(stripbuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %u bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\tmax_striplength,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(stripbuffer, 0, max_striplength);\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tstriplength=TIFFReadRawStrip(input, i, (tdata_t) stripbuffer, -1);\n\t\t\t\tif (striplength < 0) {\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \"TIFFReadRawStrip() failed\");\n\t\t\t\t\t_TIFFfree(samplebuffer);\n\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tif(!t2p_process_jpeg_strip(\n\t\t\t\t\tstripbuffer, \n\t\t\t\t\t&striplength, \n\t\t\t\t\tbuffer,\n t2p->tiff_datasize,\n\t\t\t\t\t&bufferoffset, \n\t\t\t\t\ti, \n\t\t\t\t\tt2p->tiff_length)){\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Can't process JPEG data in input file %s\", \n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t_TIFFfree(samplebuffer);\n\t\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t}\n\t\t\tbuffer[bufferoffset++]=0xff; \n\t\t\tbuffer[bufferoffset++]=0xd9;\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t_TIFFfree(stripbuffer);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(bufferoffset);\n\t\t}\n#endif /* ifdef JPEG_SUPPORT */\n\t\t(void)0;\n\t}\n\n\tif(t2p->pdf_sample==T2P_SAMPLE_NOTHING){\n\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\tif(buffer==NULL){\n\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\tstripsize=TIFFStripSize(input);\n\t\tstripcount=TIFFNumberOfStrips(input);\n\t\tfor(i=0;i<stripcount;i++){\n\t\t\tread = \n\t\t\t\tTIFFReadEncodedStrip(input, \n\t\t\t\ti, \n\t\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\t\tTIFFmin(stripsize, t2p->tiff_datasize - bufferoffset));\n\t\t\tif(read==-1){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Error on decoding strip %u of %s\", \n\t\t\t\t\ti, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tbufferoffset+=read;\n\t\t}\n\t} else {\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG){\n\t\t\n\t\t\tsepstripsize=TIFFStripSize(input);\n\t\t\tsepstripcount=TIFFNumberOfStrips(input);\n\t\t\n\t\t\tstripsize=sepstripsize*t2p->tiff_samplesperpixel;\n\t\t\tstripcount=sepstripcount/t2p->tiff_samplesperpixel;\n\t\t\t\n\t\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tsamplebuffer = (unsigned char*) _TIFFmalloc(stripsize);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n _TIFFfree(buffer);\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tsamplebufferoffset=0;\n\t\t\t\tfor(j=0;j<t2p->tiff_samplesperpixel;j++){\n\t\t\t\t\tread = \n\t\t\t\t\t\tTIFFReadEncodedStrip(input, \n\t\t\t\t\t\t\ti + j*stripcount, \n\t\t\t\t\t\t\t(tdata_t) &(samplebuffer[samplebufferoffset]), \n\t\t\t\t\t\t\tTIFFmin(sepstripsize, stripsize - samplebufferoffset));\n\t\t\t\t\tif(read==-1){\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\t\t\"Error on decoding strip %u of %s\",\n\t\t\t\t\t\t\ti + j*stripcount,\n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\t\t\treturn(0);\n\t\t\t\t\t}\n\t\t\t\t\tsamplebufferoffset+=read;\n\t\t\t\t}\n\t\t\t\tt2p_sample_planar_separate_to_contig(\n\t\t\t\t\tt2p,\n\t\t\t\t\t&(buffer[bufferoffset]),\n\t\t\t\t\tsamplebuffer, \n\t\t\t\t\tsamplebufferoffset); \n\t\t\t\tbufferoffset+=samplebufferoffset;\n\t\t\t}\n\t\t\t_TIFFfree(samplebuffer);\n\t\t\tgoto dataready;\n\t\t}\n\n\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\tif(buffer==NULL){\n\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\",\n\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\tstripsize=TIFFStripSize(input);\n\t\tstripcount=TIFFNumberOfStrips(input);\n\t\tfor(i=0;i<stripcount;i++){\n\t\t\tread = \n\t\t\t\tTIFFReadEncodedStrip(input, \n\t\t\t\ti, \n\t\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\t\tTIFFmin(stripsize, t2p->tiff_datasize - bufferoffset));\n\t\t\tif(read==-1){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Error on decoding strip %u of %s\", \n\t\t\t\t\ti, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(samplebuffer);\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tbufferoffset+=read;\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_REALIZE_PALETTE){\n\t\t\t// FIXME: overflow?\n\t\t\tsamplebuffer=(unsigned char*)_TIFFrealloc( \n\t\t\t\t(tdata_t) buffer, \n\t\t\t\tt2p->tiff_datasize * t2p->tiff_samplesperpixel);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\t(unsigned long) t2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\treturn(0);\n\t\t\t} else {\n\t\t\t\tbuffer=samplebuffer;\n\t\t\t\tt2p->tiff_datasize *= t2p->tiff_samplesperpixel;\n\t\t\t}\n\t\t\tt2p_sample_realize_palette(t2p, buffer);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgba_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBAA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgbaa_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_YCBCR_TO_RGB){\n\t\t\tsamplebuffer=(unsigned char*)_TIFFrealloc(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length*4);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't allocate %lu bytes of memory for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\t(unsigned long) t2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\treturn(0);\n\t\t\t} else {\n\t\t\t\tbuffer=samplebuffer;\n\t\t\t}\n\t\t\tif(!TIFFReadRGBAImageOriented(\n\t\t\t\tinput, \n\t\t\t\tt2p->tiff_width, \n\t\t\t\tt2p->tiff_length, \n\t\t\t\t(uint32*)buffer, \n\t\t\t\tORIENTATION_TOPLEFT,\n\t\t\t\t0)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\"Can't use TIFFReadRGBAImageOriented to extract RGB image from %s\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tt2p->tiff_datasize=t2p_sample_abgr_to_rgb(\n\t\t\t\t(tdata_t) buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED){\n\t\t\tt2p->tiff_datasize=t2p_sample_lab_signed_to_unsigned(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_width*t2p->tiff_length);\n\t\t}\n\t}\n\ndataready:\n\n\tt2p_disable(output);\n\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, t2p->tiff_photometric);\n\tTIFFSetField(output, TIFFTAG_BITSPERSAMPLE, t2p->tiff_bitspersample);\n\tTIFFSetField(output, TIFFTAG_SAMPLESPERPIXEL, t2p->tiff_samplesperpixel);\n\tTIFFSetField(output, TIFFTAG_IMAGEWIDTH, t2p->tiff_width);\n\tTIFFSetField(output, TIFFTAG_IMAGELENGTH, t2p->tiff_length);\n\tTIFFSetField(output, TIFFTAG_ROWSPERSTRIP, t2p->tiff_length);\n\tTIFFSetField(output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tTIFFSetField(output, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n\n\tswitch(t2p->pdf_compression){\n\tcase T2P_COMPRESS_NONE:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n\t\tbreak;\n#ifdef CCITT_SUPPORT\n\tcase T2P_COMPRESS_G4:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);\n\t\tbreak;\n#endif /* ifdef CCITT_SUPPORT */\n#ifdef JPEG_SUPPORT\n\tcase T2P_COMPRESS_JPEG:\n\t\tif(t2p->tiff_photometric==PHOTOMETRIC_YCBCR) {\n\t\t\tuint16 hor = 0, ver = 0;\n\t\t\tif (TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &hor, &ver) !=0 ) {\n\t\t\t\tif(hor != 0 && ver != 0){\n\t\t\t\t\tTIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, hor, ver);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_REFERENCEBLACKWHITE, &xfloatp)!=0){\n\t\t\t\tTIFFSetField(output, TIFFTAG_REFERENCEBLACKWHITE, xfloatp);\n\t\t\t}\n\t\t}\n\t\tif(TIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_JPEG)==0){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\"Unable to use JPEG compression for input %s and output %s\", \n\t\t\t\tTIFFFileName(input),\n\t\t\t\tTIFFFileName(output));\n\t\t\t_TIFFfree(buffer);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t\tTIFFSetField(output, TIFFTAG_JPEGTABLESMODE, 0);\n\n\t\tif(t2p->pdf_colorspace & (T2P_CS_RGB | T2P_CS_LAB)){\n\t\t\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);\n\t\t\tif(t2p->tiff_photometric != PHOTOMETRIC_YCBCR){\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n\t\t\t} else {\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);\n\t\t\t}\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_GRAY){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_CMYK){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_JPEGQUALITY, \n\t\t\t\tt2p->pdf_defaultcompressionquality);\n\t\t}\n\t\n\t\tbreak;\n#endif /* ifdef JPEG_SUPPORT */\n#ifdef ZIP_SUPPORT\n\tcase T2P_COMPRESS_ZIP:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);\n\t\tif(t2p->pdf_defaultcompressionquality%100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_PREDICTOR, \n\t\t\t\tt2p->pdf_defaultcompressionquality % 100);\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality/100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_ZIPQUALITY, \n\t\t\t\t(t2p->pdf_defaultcompressionquality / 100));\n\t\t}\n\t\tbreak;\n#endif /* ifdef ZIP_SUPPORT */\n\tdefault:\n\t\tbreak;\n\t}\n\n\tt2p_enable(output);\n\tt2p->outputwritten = 0;\n#ifdef JPEG_SUPPORT\n\tif(t2p->pdf_compression == T2P_COMPRESS_JPEG\n\t && t2p->tiff_photometric == PHOTOMETRIC_YCBCR){\n\t\tbufferoffset = TIFFWriteEncodedStrip(output, (tstrip_t)0,\n\t\t\t\t\t\t buffer,\n\t\t\t\t\t\t stripsize * stripcount); \n\t} else\n#endif /* ifdef JPEG_SUPPORT */\n {\n\t\tbufferoffset = TIFFWriteEncodedStrip(output, (tstrip_t)0,\n\t\t\t\t\t\t buffer,\n\t\t\t\t\t\t t2p->tiff_datasize); \n\t}\n\tif (buffer != NULL) {\n\t\t_TIFFfree(buffer);\n\t\tbuffer=NULL;\n\t}\n\n\tif (bufferoffset == (tsize_t)-1) {\n\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t \"Error writing encoded strip to output PDF %s\", \n\t\t\t TIFFFileName(output));\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\t\n\twritten = t2p->outputwritten;\n\treturn(written);\n}",
  21983. "project": "libtiff",
  21984. "hash": 84052621455541957078395456270362682892,
  21985. "size": 618,
  21986. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  21987. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  21988. "target": 0,
  21989. "dataset": "other",
  21990. "idx": 458978
  21991. },
  21992. {
  21993. "func": "void t2p_read_tiff_size(T2P* t2p, TIFF* input){\n\n\tuint64* sbc=NULL;\n#if defined(JPEG_SUPPORT) || defined (OJPEG_SUPPORT)\n\tunsigned char* jpt=NULL;\n\ttstrip_t i=0;\n\ttstrip_t stripcount=0;\n#endif\n uint64 k = 0;\n\n\tif(t2p->pdf_transcode == T2P_TRANSCODE_RAW){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_G4 ){\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n if (sbc[0] != (uint64)(tmsize_t)sbc[0]) {\n TIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n t2p->t2p_error = T2P_ERR_ERROR;\n }\n\t\t\tt2p->tiff_datasize=(tmsize_t)sbc[0];\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_ZIP){\n\t\t\tTIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc);\n if (sbc[0] != (uint64)(tmsize_t)sbc[0]) {\n TIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n t2p->t2p_error = T2P_ERR_ERROR;\n }\n\t\t\tt2p->tiff_datasize=(tmsize_t)sbc[0];\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_OJPEG){\n\t\t\tif(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tk = checkAdd64(k, sbc[i], t2p);\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGIFOFFSET, &(t2p->tiff_dataoffset))){\n\t\t\t\tif(t2p->tiff_dataoffset != 0){\n\t\t\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGIFBYTECOUNT, &(t2p->tiff_datasize))!=0){\n\t\t\t\t\t\tif((uint64)t2p->tiff_datasize < k) {\n\t\t\t\t\t\t\tTIFFWarning(TIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\t\"Input file %s has short JPEG interchange file byte count\", \n\t\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\tt2p->pdf_ojpegiflength=t2p->tiff_datasize;\n\t\t\t\t\t\t\tk = checkAdd64(k, t2p->tiff_datasize, t2p);\n\t\t\t\t\t\t\tk = checkAdd64(k, 6, t2p);\n\t\t\t\t\t\t\tk = checkAdd64(k, stripcount, t2p);\n\t\t\t\t\t\t\tk = checkAdd64(k, stripcount, t2p);\n\t\t\t\t\t\t\tt2p->tiff_datasize = (tsize_t) k;\n\t\t\t\t\t\t\tif ((uint64) t2p->tiff_datasize != k) {\n\t\t\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n\t\t\t\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}else {\n\t\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\"Input file %s missing field: TIFFTAG_JPEGIFBYTECOUNT\",\n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tk = checkAdd64(k, stripcount, t2p);\n\t\t\tk = checkAdd64(k, stripcount, t2p);\n\t\t\tk = checkAdd64(k, 2048, t2p);\n\t\t\tt2p->tiff_datasize = (tsize_t) k;\n\t\t\tif ((uint64) t2p->tiff_datasize != k) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_JPEG) {\n\t\t\tuint32 count = 0;\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0 ){\n\t\t\t\tif(count > 4){\n\t\t\t\t\tk += count;\n\t\t\t\t\tk -= 2; /* don't use EOI of header */\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tk = 2; /* SOI for first strip */\n\t\t\t}\n\t\t\tstripcount=TIFFNumberOfStrips(input);\n\t\t\tif(!TIFFGetField(input, TIFFTAG_STRIPBYTECOUNTS, &sbc)){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Input file %s missing field: TIFFTAG_STRIPBYTECOUNTS\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor(i=0;i<stripcount;i++){\n\t\t\t\tk = checkAdd64(k, sbc[i], t2p);\n\t\t\t\tk -=2; /* don't use EOI of strip */\n\t\t\t\tk +=2; /* add space for restart marker */\n\t\t\t}\n\t\t\tk = checkAdd64(k, 2, t2p); /* use EOI of last strip */\n\t\t\tk = checkAdd64(k, 6, t2p); /* for DRI marker of first strip */\n\t\t\tt2p->tiff_datasize = (tsize_t) k;\n\t\t\tif ((uint64) t2p->tiff_datasize != k) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n#endif\n\t\t(void) 0;\n\t}\n#ifdef JPEG_SUPPORT\n\tif(t2p->pdf_compression == T2P_COMPRESS_JPEG\n\t && t2p->tiff_photometric == PHOTOMETRIC_YCBCR) {\n\t\tk = checkMultiply64(TIFFNumberOfStrips(input), TIFFStripSize(input), t2p);\n\t} else\n#endif\n\t{\n\t\tk = checkMultiply64(TIFFScanlineSize(input), t2p->tiff_length, t2p);\n\t\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\t\tk = checkMultiply64(k, t2p->tiff_samplesperpixel, t2p);\n\t\t}\n\t}\n\tif (k == 0) {\n\t\t/* Assume we had overflow inside TIFFScanlineSize */\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t}\n\n\tt2p->tiff_datasize = (tsize_t) k;\n\tif ((uint64) t2p->tiff_datasize != k) {\n\t\tTIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t}\n\n\treturn;\n}",
  21994. "project": "libtiff",
  21995. "hash": 290623600493300717102076515548479341238,
  21996. "size": 147,
  21997. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  21998. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  21999. "target": 0,
  22000. "dataset": "other",
  22001. "idx": 458964
  22002. },
  22003. {
  22004. "func": "void t2p_read_tiff_size_tile(T2P* t2p, TIFF* input, ttile_t tile){\n\n\tuint64* tbc = NULL;\n\tuint16 edge=0;\n#ifdef JPEG_SUPPORT\n\tunsigned char* jpt;\n#endif\n uint64 k;\n\n\tedge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\tedge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\t\n\tif(t2p->pdf_transcode==T2P_TRANSCODE_RAW){\n\t\tif(edge\n#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)\n\t\t&& !(t2p->pdf_compression==T2P_COMPRESS_JPEG)\n#endif\n\t\t){\n\t\t\tt2p->tiff_datasize=TIFFTileSize(input);\n\t\t\tif (t2p->tiff_datasize == 0) {\n\t\t\t\t/* Assume we had overflow inside TIFFTileSize */\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t}\n\t\t\treturn;\n\t\t} else {\n\t\t\tTIFFGetField(input, TIFFTAG_TILEBYTECOUNTS, &tbc);\n\t\t\tk=tbc[tile];\n#ifdef OJPEG_SUPPORT\n\t\t\tif(t2p->tiff_compression==COMPRESSION_OJPEG){\n\t\t\t\tk = checkAdd64(k, 2048, t2p);\n\t\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\t\tif(t2p->tiff_compression==COMPRESSION_JPEG) {\n\t\t\t\tuint32 count = 0;\n\t\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt)!=0){\n\t\t\t\t\tif(count > 4){\n\t\t\t\t\t\tk = checkAdd64(k, count, t2p);\n\t\t\t\t\t\tk -= 2; /* don't use EOI of header or SOI of tile */\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n#endif\n\t\t\tt2p->tiff_datasize = (tsize_t) k;\n\t\t\tif ((uint64) t2p->tiff_datasize != k) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t}\n\tk = TIFFTileSize(input);\n\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\tk = checkMultiply64(k, t2p->tiff_samplesperpixel, t2p);\n\t}\n\tif (k == 0) {\n\t\t/* Assume we had overflow inside TIFFTileSize */\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t}\n\n\tt2p->tiff_datasize = (tsize_t) k;\n\tif ((uint64) t2p->tiff_datasize != k) {\n\t\tTIFFError(TIFF2PDF_MODULE, \"Integer overflow\");\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t}\n\n\treturn;\n}",
  22005. "project": "libtiff",
  22006. "hash": 174919938547401728560893363822829287963,
  22007. "size": 68,
  22008. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  22009. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  22010. "target": 0,
  22011. "dataset": "other",
  22012. "idx": 458975
  22013. },
  22014. {
  22015. "func": "void t2p_read_tiff_data(T2P* t2p, TIFF* input){\n\n\tint i=0;\n\tuint16* r = NULL;\n\tuint16* g = NULL;\n\tuint16* b = NULL;\n\tuint16* a = NULL;\n\tuint16 xuint16;\n\tuint16* xuint16p;\n\tfloat* xfloatp;\n\n\tt2p->pdf_transcode = T2P_TRANSCODE_ENCODE;\n\tt2p->pdf_sample = T2P_SAMPLE_NOTHING;\n t2p->pdf_switchdecode = t2p->pdf_colorspace_invert;\n \n\t\n\tTIFFSetDirectory(input, t2p->tiff_pages[t2p->pdf_page].page_directory);\n\n\tTIFFGetField(input, TIFFTAG_IMAGEWIDTH, &(t2p->tiff_width));\n\tif(t2p->tiff_width == 0){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with zero width\", \n\t\t\tTIFFFileName(input)\t);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\n\tTIFFGetField(input, TIFFTAG_IMAGELENGTH, &(t2p->tiff_length));\n\tif(t2p->tiff_length == 0){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with zero length\", \n\t\t\tTIFFFileName(input)\t);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\n if(TIFFGetField(input, TIFFTAG_COMPRESSION, &(t2p->tiff_compression)) == 0){\n TIFFError(\n TIFF2PDF_MODULE, \n \"No support for %s with no compression tag\", \n TIFFFileName(input) );\n t2p->t2p_error = T2P_ERR_ERROR;\n return;\n\n }\n if( TIFFIsCODECConfigured(t2p->tiff_compression) == 0){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with compression type %u: not configured\", \n\t\t\tTIFFFileName(input), \n\t\t\tt2p->tiff_compression\t\n\t\t\t);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t\n\t}\n\n\tTIFFGetFieldDefaulted(input, TIFFTAG_BITSPERSAMPLE, &(t2p->tiff_bitspersample));\n\tswitch(t2p->tiff_bitspersample){\n\t\tcase 1:\n\t\tcase 2:\n\t\tcase 4:\n\t\tcase 8:\n\t\t\tbreak;\n\t\tcase 0:\n\t\t\tTIFFWarning(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"Image %s has 0 bits per sample, assuming 1\",\n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->tiff_bitspersample=1;\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with %u bits per sample\",\n\t\t\t\tTIFFFileName(input),\n\t\t\t\tt2p->tiff_bitspersample);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn;\n\t}\n\n\tTIFFGetFieldDefaulted(input, TIFFTAG_SAMPLESPERPIXEL, &(t2p->tiff_samplesperpixel));\n\tif(t2p->tiff_samplesperpixel>4){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"No support for %s with %u samples per pixel\",\n\t\t\tTIFFFileName(input),\n\t\t\tt2p->tiff_samplesperpixel);\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn;\n\t}\n\tif(t2p->tiff_samplesperpixel==0){\n\t\tTIFFWarning(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"Image %s has 0 samples per pixel, assuming 1\",\n\t\t\tTIFFFileName(input));\n\t\tt2p->tiff_samplesperpixel=1;\n\t}\n\t\n\tif(TIFFGetField(input, TIFFTAG_SAMPLEFORMAT, &xuint16) != 0 ){\n\t\tswitch(xuint16){\n\t\t\tcase 0:\n\t\t\tcase 1:\n\t\t\tcase 4:\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for %s with sample format %u\",\n\t\t\t\t\tTIFFFileName(input),\n\t\t\t\t\txuint16);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tTIFFGetFieldDefaulted(input, TIFFTAG_FILLORDER, &(t2p->tiff_fillorder));\n\t\n if(TIFFGetField(input, TIFFTAG_PHOTOMETRIC, &(t2p->tiff_photometric)) == 0){\n TIFFError(\n TIFF2PDF_MODULE, \n \"No support for %s with no photometric interpretation tag\", \n TIFFFileName(input) );\n t2p->t2p_error = T2P_ERR_ERROR;\n return;\n\n }\n \n\tswitch(t2p->tiff_photometric){\n\t\tcase PHOTOMETRIC_MINISWHITE:\n\t\tcase PHOTOMETRIC_MINISBLACK: \n\t\t\tif (t2p->tiff_bitspersample==1){\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_BILEVEL;\n\t\t\t\tif(t2p->tiff_photometric==PHOTOMETRIC_MINISWHITE){\n\t\t\t\t\tt2p->pdf_switchdecode ^= 1;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_GRAY;\n\t\t\t\tif(t2p->tiff_photometric==PHOTOMETRIC_MINISWHITE){\n\t\t\t\t\tt2p->pdf_switchdecode ^= 1;\n\t\t\t\t} \n\t\t\t}\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_RGB: \n\t\t\tt2p->pdf_colorspace=T2P_CS_RGB;\n\t\t\tif(t2p->tiff_samplesperpixel == 3){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)){\n\t\t\t\tif(xuint16==1)\n\t\t\t\t\tgoto photometric_palette;\n\t\t\t}\n\t\t\tif(t2p->tiff_samplesperpixel > 3) {\n\t\t\t\tif(t2p->tiff_samplesperpixel == 4) {\n\t\t\t\t\tt2p->pdf_colorspace = T2P_CS_RGB;\n\t\t\t\t\tif(TIFFGetField(input,\n\t\t\t\t\t\t\tTIFFTAG_EXTRASAMPLES,\n\t\t\t\t\t\t\t&xuint16, &xuint16p)\n\t\t\t\t\t && xuint16 == 1) {\n\t\t\t\t\t\tif(xuint16p[0] == EXTRASAMPLE_ASSOCALPHA){\n\t\t\t\t\t\t\tif( t2p->tiff_bitspersample != 8 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t TIFFError(\n\t\t\t\t\t\t\t\t TIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\t \"No support for BitsPerSample=%d for RGBA\",\n\t\t\t\t\t\t\t\t t2p->tiff_bitspersample);\n\t\t\t\t\t\t\t t2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\t\t return;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_RGBAA_TO_RGB;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(xuint16p[0] == EXTRASAMPLE_UNASSALPHA){\n\t\t\t\t\t\t\tif( t2p->tiff_bitspersample != 8 )\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t TIFFError(\n\t\t\t\t\t\t\t\t TIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\t \"No support for BitsPerSample=%d for RGBA\",\n\t\t\t\t\t\t\t\t t2p->tiff_bitspersample);\n\t\t\t\t\t\t\t t2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\t\t\t return;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_RGBA_TO_RGB;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tTIFFWarning(\n\t\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\t\"RGB image %s has 4 samples per pixel, assuming RGBA\",\n\t\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tt2p->pdf_colorspace=T2P_CS_CMYK;\n\t\t\t\t\tt2p->pdf_switchdecode ^= 1;\n\t\t\t\t\tTIFFWarning(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"RGB image %s has 4 samples per pixel, assuming inverse CMYK\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\tbreak;\n\t\t\t\t} else {\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"No support for RGB image %s with %u samples per pixel\", \n\t\t\t\t\t\tTIFFFileName(input), \n\t\t\t\t\t\tt2p->tiff_samplesperpixel);\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for RGB image %s with %u samples per pixel\", \n\t\t\t\t\tTIFFFileName(input), \n\t\t\t\t\tt2p->tiff_samplesperpixel);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\tbreak;\n\t\t\t}\n\t\tcase PHOTOMETRIC_PALETTE: \n\t\t\tphotometric_palette:\n\t\t\tif(t2p->tiff_samplesperpixel!=1){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for palettized image %s with not one sample per pixel\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tt2p->pdf_colorspace=T2P_CS_RGB | T2P_CS_PALETTE;\n\t\t\tt2p->pdf_palettesize=0x0001<<t2p->tiff_bitspersample;\n\t\t\tif(!TIFFGetField(input, TIFFTAG_COLORMAP, &r, &g, &b)){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE,\n\t\t\t\t\t\"Palettized image %s has no color map\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(r == NULL || g == NULL || b == NULL){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE,\n\t\t\t\t\t\"Error getting 3 components from color map\");\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(t2p->pdf_palette != NULL){\n\t\t\t\t_TIFFfree(t2p->pdf_palette);\n\t\t\t\tt2p->pdf_palette=NULL;\n\t\t\t}\n\t\t\tt2p->pdf_palette = (unsigned char*)\n\t\t\t\t_TIFFmalloc(TIFFSafeMultiply(tmsize_t,t2p->pdf_palettesize,3));\n\t\t\tif(t2p->pdf_palette==NULL){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory for t2p_read_tiff_image, %s\", \n\t\t\t\t\tt2p->pdf_palettesize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor(i=0;i<t2p->pdf_palettesize;i++){\n\t\t\t\tt2p->pdf_palette[(i*3)] = (unsigned char) (r[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*3)+1]= (unsigned char) (g[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*3)+2]= (unsigned char) (b[i]>>8);\n\t\t\t}\n\t\t\tt2p->pdf_palettesize *= 3;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_SEPARATED:\n\t\t\tif(TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)){\n\t\t\t\tif(xuint16==1){\n\t\t\t\t\t\tgoto photometric_palette_cmyk;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif( TIFFGetField(input, TIFFTAG_INKSET, &xuint16) ){\n\t\t\t\tif(xuint16 != INKSET_CMYK){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"No support for %s because its inkset is not CMYK\",\n\t\t\t\t\t\tTIFFFileName(input) );\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(t2p->tiff_samplesperpixel==4){\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_CMYK;\n\t\t\t} else {\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for %s because it has %u samples per pixel\",\n\t\t\t\t\tTIFFFileName(input), \n\t\t\t\t\tt2p->tiff_samplesperpixel);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tbreak;\n\t\t\tphotometric_palette_cmyk:\n\t\t\tif(t2p->tiff_samplesperpixel!=1){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for palettized CMYK image %s with not one sample per pixel\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tt2p->pdf_colorspace=T2P_CS_CMYK | T2P_CS_PALETTE;\n\t\t\tt2p->pdf_palettesize=0x0001<<t2p->tiff_bitspersample;\n\t\t\tif(!TIFFGetField(input, TIFFTAG_COLORMAP, &r, &g, &b, &a)){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE,\n\t\t\t\t\t\"Palettized image %s has no color map\",\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(r == NULL || g == NULL || b == NULL || a == NULL){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE,\n\t\t\t\t\t\"Error getting 4 components from color map\");\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tif(t2p->pdf_palette != NULL){\n\t\t\t\t_TIFFfree(t2p->pdf_palette);\n\t\t\t\tt2p->pdf_palette=NULL;\n\t\t\t}\n\t\t\tt2p->pdf_palette = (unsigned char*) \n\t\t\t\t_TIFFmalloc(TIFFSafeMultiply(tmsize_t,t2p->pdf_palettesize,4));\n\t\t\tif(t2p->pdf_palette==NULL){\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %u bytes of memory for t2p_read_tiff_image, %s\", \n\t\t\t\t\tt2p->pdf_palettesize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfor(i=0;i<t2p->pdf_palettesize;i++){\n\t\t\t\tt2p->pdf_palette[(i*4)] = (unsigned char) (r[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*4)+1]= (unsigned char) (g[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*4)+2]= (unsigned char) (b[i]>>8);\n\t\t\t\tt2p->pdf_palette[(i*4)+3]= (unsigned char) (a[i]>>8);\n\t\t\t}\n\t\t\tt2p->pdf_palettesize *= 4;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_YCBCR:\n\t\t\tt2p->pdf_colorspace=T2P_CS_RGB;\n\t\t\tif(t2p->tiff_samplesperpixel==1){\n\t\t\t\tt2p->pdf_colorspace=T2P_CS_GRAY;\n\t\t\t\tt2p->tiff_photometric=PHOTOMETRIC_MINISBLACK;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tt2p->pdf_sample=T2P_SAMPLE_YCBCR_TO_RGB;\n#ifdef JPEG_SUPPORT\n\t\t\tif(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){\n\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_NOTHING;\n\t\t\t}\n#endif\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_CIELAB:\n if( t2p->tiff_samplesperpixel != 3){\n TIFFError(\n TIFF2PDF_MODULE, \n \"Unsupported samplesperpixel = %d for CIELAB\", \n t2p->tiff_samplesperpixel);\n t2p->t2p_error = T2P_ERR_ERROR;\n return;\n }\n if( t2p->tiff_bitspersample != 8){\n TIFFError(\n TIFF2PDF_MODULE, \n \"Invalid bitspersample = %d for CIELAB\", \n t2p->tiff_bitspersample);\n t2p->t2p_error = T2P_ERR_ERROR;\n return;\n }\n\t\t\tt2p->pdf_labrange[0]= -127;\n\t\t\tt2p->pdf_labrange[1]= 127;\n\t\t\tt2p->pdf_labrange[2]= -127;\n\t\t\tt2p->pdf_labrange[3]= 127;\n\t\t\tt2p->pdf_sample=T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED;\n\t\t\tt2p->pdf_colorspace=T2P_CS_LAB;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_ICCLAB:\n\t\t\tt2p->pdf_labrange[0]= 0;\n\t\t\tt2p->pdf_labrange[1]= 255;\n\t\t\tt2p->pdf_labrange[2]= 0;\n\t\t\tt2p->pdf_labrange[3]= 255;\n\t\t\tt2p->pdf_colorspace=T2P_CS_LAB;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_ITULAB:\n if( t2p->tiff_samplesperpixel != 3){\n TIFFError(\n TIFF2PDF_MODULE, \n \"Unsupported samplesperpixel = %d for ITULAB\", \n t2p->tiff_samplesperpixel);\n t2p->t2p_error = T2P_ERR_ERROR;\n return;\n }\n if( t2p->tiff_bitspersample != 8){\n TIFFError(\n TIFF2PDF_MODULE, \n \"Invalid bitspersample = %d for ITULAB\", \n t2p->tiff_bitspersample);\n t2p->t2p_error = T2P_ERR_ERROR;\n return;\n }\n\t\t\tt2p->pdf_labrange[0]=-85;\n\t\t\tt2p->pdf_labrange[1]=85;\n\t\t\tt2p->pdf_labrange[2]=-75;\n\t\t\tt2p->pdf_labrange[3]=124;\n\t\t\tt2p->pdf_sample=T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED;\n\t\t\tt2p->pdf_colorspace=T2P_CS_LAB;\n\t\t\tbreak;\n\t\tcase PHOTOMETRIC_LOGL:\n\t\tcase PHOTOMETRIC_LOGLUV:\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with photometric interpretation LogL/LogLuv\", \n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn;\n\t\tdefault:\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with photometric interpretation %u\", \n\t\t\t\tTIFFFileName(input),\n\t\t\t\tt2p->tiff_photometric);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn;\n\t}\n\n\tif(TIFFGetField(input, TIFFTAG_PLANARCONFIG, &(t2p->tiff_planar))){\n\t\tswitch(t2p->tiff_planar){\n\t\t\tcase 0:\n\t\t\t\tTIFFWarning(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"Image %s has planar configuration 0, assuming 1\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->tiff_planar=PLANARCONFIG_CONTIG;\n\t\t\tcase PLANARCONFIG_CONTIG:\n\t\t\t\tbreak;\n\t\t\tcase PLANARCONFIG_SEPARATE:\n\t\t\t\tt2p->pdf_sample=T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG;\n\t\t\t\tif(t2p->tiff_bitspersample!=8){\n\t\t\t\t\tTIFFError(\n\t\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\t\"No support for %s with separated planar configuration and %u bits per sample\", \n\t\t\t\t\t\tTIFFFileName(input),\n\t\t\t\t\t\tt2p->tiff_bitspersample);\n\t\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tTIFFError(\n\t\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for %s with planar configuration %u\", \n\t\t\t\t\tTIFFFileName(input),\n\t\t\t\t\tt2p->tiff_planar);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn;\n\t\t}\n\t}\n\n TIFFGetFieldDefaulted(input, TIFFTAG_ORIENTATION,\n &(t2p->tiff_orientation));\n if(t2p->tiff_orientation>8){\n TIFFWarning(TIFF2PDF_MODULE,\n \"Image %s has orientation %u, assuming 0\",\n TIFFFileName(input), t2p->tiff_orientation);\n t2p->tiff_orientation=0;\n }\n\n if(TIFFGetField(input, TIFFTAG_XRESOLUTION, &(t2p->tiff_xres) ) == 0){\n t2p->tiff_xres=0.0;\n }\n if(TIFFGetField(input, TIFFTAG_YRESOLUTION, &(t2p->tiff_yres) ) == 0){\n t2p->tiff_yres=0.0;\n }\n\tTIFFGetFieldDefaulted(input, TIFFTAG_RESOLUTIONUNIT,\n\t\t\t &(t2p->tiff_resunit));\n\tif(t2p->tiff_resunit == RESUNIT_CENTIMETER) {\n\t\tt2p->tiff_xres *= 2.54F;\n\t\tt2p->tiff_yres *= 2.54F;\n\t} else if (t2p->tiff_resunit != RESUNIT_INCH\n\t\t && t2p->pdf_centimeters != 0) {\n\t\tt2p->tiff_xres *= 2.54F;\n\t\tt2p->tiff_yres *= 2.54F;\n\t}\n\n\tt2p_compose_pdf_page(t2p);\n if( t2p->t2p_error == T2P_ERR_ERROR )\n\t return;\n\n\tt2p->pdf_transcode = T2P_TRANSCODE_ENCODE;\n /* It seems that T2P_TRANSCODE_RAW mode doesn't support separate->contig */\n /* conversion. At least t2p_read_tiff_size and t2p_read_tiff_size_tile */\n /* do not take into account the number of samples, and thus */\n /* that can cause heap buffer overflows such as in */\n /* http://bugzilla.maptools.org/show_bug.cgi?id=2715 */\n\tif(t2p->pdf_nopassthrough==0 && t2p->tiff_planar!=PLANARCONFIG_SEPARATE){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->tiff_compression==COMPRESSION_CCITTFAX4 \n\t\t\t){\n\t\t\tif(TIFFIsTiled(input) || (TIFFNumberOfStrips(input)==1) ){\n\t\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\t\tt2p->pdf_compression=T2P_COMPRESS_G4;\n\t\t\t}\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif(t2p->tiff_compression== COMPRESSION_ADOBE_DEFLATE \n\t\t\t|| t2p->tiff_compression==COMPRESSION_DEFLATE){\n\t\t\tif(TIFFIsTiled(input) || (TIFFNumberOfStrips(input)==1) ){\n\t\t\t\tuint16 predictor;\n\t\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\t\tt2p->pdf_compression=T2P_COMPRESS_ZIP;\n\t\t\t\tTIFFGetField(input, TIFFTAG_PREDICTOR, &predictor);\n\t\t\t\tt2p->pdf_compressionquality = predictor;\n\t\t\t\t/* TIFFTAG_ZIPQUALITY is always Z_DEFAULT_COMPRESSION on reading */\n\t\t\t}\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression==COMPRESSION_OJPEG){\n\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\tt2p->pdf_compression=T2P_COMPRESS_JPEG;\n\t\t\tt2p_process_ojpeg_tables(t2p, input);\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression==COMPRESSION_JPEG){\n\t\t\tt2p->pdf_transcode = T2P_TRANSCODE_RAW;\n\t\t\tt2p->pdf_compression=T2P_COMPRESS_JPEG;\n\t\t}\n#endif\n\t\t(void)0;\n\t}\n\n\tif(t2p->pdf_transcode!=T2P_TRANSCODE_RAW){\n\t\tt2p->pdf_compression = t2p->pdf_defaultcompression;\n\t}\n\n#ifdef JPEG_SUPPORT\n\tif(t2p->pdf_defaultcompression==T2P_COMPRESS_JPEG){\n\t\tif(t2p->pdf_colorspace & T2P_CS_PALETTE){\n\t\t\tt2p->pdf_sample|=T2P_SAMPLE_REALIZE_PALETTE;\n\t\t\tt2p->pdf_colorspace ^= T2P_CS_PALETTE;\n\t\t\tt2p->tiff_pages[t2p->pdf_page].page_extra--;\n\t\t}\n\t}\n\tif(t2p->tiff_compression==COMPRESSION_JPEG){\n\t\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with JPEG compression and separated planar configuration\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\treturn;\n\t\t}\n\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\tif(t2p->tiff_compression==COMPRESSION_OJPEG){\n\t\tif(t2p->tiff_planar==PLANARCONFIG_SEPARATE){\n\t\t\tTIFFError(\n\t\t\t\tTIFF2PDF_MODULE, \n\t\t\t\t\"No support for %s with OJPEG compression and separated planar configuration\", \n\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\treturn;\n\t\t}\n\t}\n#endif\n\n\tif(t2p->pdf_sample & T2P_SAMPLE_REALIZE_PALETTE){\n\t\tif(t2p->pdf_colorspace & T2P_CS_CMYK){\n\t\t\tt2p->tiff_samplesperpixel=4;\n\t\t\tt2p->tiff_photometric=PHOTOMETRIC_SEPARATED;\n\t\t} else {\n\t\t\tt2p->tiff_samplesperpixel=3;\n\t\t\tt2p->tiff_photometric=PHOTOMETRIC_RGB;\n\t\t}\n\t}\n\n\tif (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION,\n\t\t\t &(t2p->tiff_transferfunction[0]),\n\t\t\t &(t2p->tiff_transferfunction[1]),\n\t\t\t &(t2p->tiff_transferfunction[2]))) {\n\t\tif((t2p->tiff_transferfunction[1] != (uint16*) NULL) &&\n (t2p->tiff_transferfunction[2] != (uint16*) NULL)\n ) {\n\t\t\tt2p->tiff_transferfunctioncount=3;\n\t\t} else {\n\t\t\tt2p->tiff_transferfunctioncount=1;\n\t\t}\n\t} else {\n\t\tt2p->tiff_transferfunctioncount=0;\n\t}\n\tif(TIFFGetField(input, TIFFTAG_WHITEPOINT, &xfloatp)!=0){\n\t\tt2p->tiff_whitechromaticities[0]=xfloatp[0];\n\t\tt2p->tiff_whitechromaticities[1]=xfloatp[1];\n\t\tif(t2p->pdf_colorspace & T2P_CS_GRAY){\n\t\t\tt2p->pdf_colorspace |= T2P_CS_CALGRAY;\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_RGB){\n\t\t\tt2p->pdf_colorspace |= T2P_CS_CALRGB;\n\t\t}\n\t}\n\tif(TIFFGetField(input, TIFFTAG_PRIMARYCHROMATICITIES, &xfloatp)!=0){\n\t\tt2p->tiff_primarychromaticities[0]=xfloatp[0];\n\t\tt2p->tiff_primarychromaticities[1]=xfloatp[1];\n\t\tt2p->tiff_primarychromaticities[2]=xfloatp[2];\n\t\tt2p->tiff_primarychromaticities[3]=xfloatp[3];\n\t\tt2p->tiff_primarychromaticities[4]=xfloatp[4];\n\t\tt2p->tiff_primarychromaticities[5]=xfloatp[5];\n\t\tif(t2p->pdf_colorspace & T2P_CS_RGB){\n\t\t\tt2p->pdf_colorspace |= T2P_CS_CALRGB;\n\t\t}\n\t}\n\tif(t2p->pdf_colorspace & T2P_CS_LAB){\n\t\tif(TIFFGetField(input, TIFFTAG_WHITEPOINT, &xfloatp) != 0){\n\t\t\tt2p->tiff_whitechromaticities[0]=xfloatp[0];\n\t\t\tt2p->tiff_whitechromaticities[1]=xfloatp[1];\n\t\t} else {\n\t\t\tt2p->tiff_whitechromaticities[0]=0.3457F; /* 0.3127F; */\n\t\t\tt2p->tiff_whitechromaticities[1]=0.3585F; /* 0.3290F; */\n\t\t}\n\t}\n\tif(TIFFGetField(input, \n\t\tTIFFTAG_ICCPROFILE, \n\t\t&(t2p->tiff_iccprofilelength), \n\t\t&(t2p->tiff_iccprofile))!=0){\n\t\tt2p->pdf_colorspace |= T2P_CS_ICCBASED;\n\t} else {\n\t\tt2p->tiff_iccprofilelength=0;\n\t\tt2p->tiff_iccprofile=NULL;\n\t}\n\t\n#ifdef CCITT_SUPPORT\n\tif( t2p->tiff_bitspersample==1 &&\n\t\tt2p->tiff_samplesperpixel==1){\n\t\tt2p->pdf_compression = T2P_COMPRESS_G4;\n\t}\n#endif\n\n\n\treturn;\n}",
  22016. "project": "libtiff",
  22017. "hash": 249546762647681018805219825626624313897,
  22018. "size": 650,
  22019. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  22020. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  22021. "target": 0,
  22022. "dataset": "other",
  22023. "idx": 458973
  22024. },
  22025. {
  22026. "func": "tsize_t t2p_write_pdf_info(T2P* t2p, TIFF* input, TIFF* output)\n{\n\ttsize_t written = 0;\n\tconst char* info;\n\tchar buffer[512];\n\n\tif(t2p->pdf_datetime[0] == '\\0')\n\t\tt2p_pdf_tifftime(t2p, input);\n\tif (strlen(t2p->pdf_datetime) > 0) {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"<< \\n/CreationDate \", 18);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_datetime, output);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n/ModDate \", 10);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_datetime, output);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n/Producer \", 11);\n\tsnprintf(buffer, sizeof(buffer), \"libtiff / tiff2pdf - %d\", TIFFLIB_VERSION);\n\twritten += t2p_write_pdf_string(buffer, output);\n\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\tif (!t2p->pdf_creator_set) {\n\t\tif (TIFFGetField(input, TIFFTAG_SOFTWARE, &info) != 0 && info) {\n\t\t\tstrncpy(t2p->pdf_creator, info, sizeof(t2p->pdf_creator) - 1);\n\t\t\tt2p->pdf_creator[sizeof(t2p->pdf_creator) - 1] = '\\0';\n\t\t}\n\t}\n\tif (t2p->pdf_creator[0] != '\\0') {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Creator \", 9);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_creator, output);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t}\n\tif (!t2p->pdf_author_set) {\n\t\tif ((TIFFGetField(input, TIFFTAG_ARTIST, &info) != 0\n\t\t || TIFFGetField(input, TIFFTAG_COPYRIGHT, &info) != 0)\n\t\t && info) {\n\t\t\tstrncpy(t2p->pdf_author, info, sizeof(t2p->pdf_author) - 1);\n\t\t\tt2p->pdf_author[sizeof(t2p->pdf_author) - 1] = '\\0';\n\t\t}\n\t}\n\tif (t2p->pdf_author[0] != '\\0') {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Author \", 8);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_author, output);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t}\n\tif (!t2p->pdf_title_set) {\n\t\tif (TIFFGetField(input, TIFFTAG_DOCUMENTNAME, &info) != 0 && info) {\n\t\t\tstrncpy(t2p->pdf_title, info, sizeof(t2p->pdf_title) - 1);\n\t\t\tt2p->pdf_title[sizeof(t2p->pdf_title) - 1] = '\\0';\n\t\t}\n\t}\n\tif (t2p->pdf_title[0] != '\\0') {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Title \", 7);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_title, output);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t}\n\tif (!t2p->pdf_subject_set) {\n\t\tif (TIFFGetField(input, TIFFTAG_IMAGEDESCRIPTION, &info) != 0 && info) {\n\t\t\tstrncpy(t2p->pdf_subject, info, sizeof(t2p->pdf_subject) - 1);\n\t\t\tt2p->pdf_subject[sizeof(t2p->pdf_subject) - 1] = '\\0';\n\t\t}\n\t}\n\tif (t2p->pdf_subject[0] != '\\0') {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Subject \", 9);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_subject, output);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t}\n\tif (t2p->pdf_keywords[0] != '\\0') {\n\t\twritten += t2pWriteFile(output, (tdata_t) \"/Keywords \", 10);\n\t\twritten += t2p_write_pdf_string(t2p->pdf_keywords, output);\n\t\twritten += t2pWriteFile(output, (tdata_t) \"\\n\", 1);\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \">> \\n\", 4);\n\n\treturn(written);\n}",
  22027. "project": "libtiff",
  22028. "hash": 15529802383915487239436101793385069277,
  22029. "size": 73,
  22030. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  22031. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  22032. "target": 0,
  22033. "dataset": "other",
  22034. "idx": 458974
  22035. },
  22036. {
  22037. "func": "tsize_t t2p_write_pdf_string(const char* pdfstr, TIFF* output)\n{\n\ttsize_t written = 0;\n\tuint32 i = 0;\n\tchar buffer[64];\n\tsize_t len = 0;\n\t\n\tlen = strlen(pdfstr);\n\twritten += t2pWriteFile(output, (tdata_t) \"(\", 1);\n\tfor (i=0; i<len; i++) {\n\t\tif((pdfstr[i]&0x80) || (pdfstr[i]==127) || (pdfstr[i]<32)){\n\t\t\tsnprintf(buffer, sizeof(buffer), \"\\\\%.3o\", ((unsigned char)pdfstr[i]));\n\t\t\twritten += t2pWriteFile(output, (tdata_t)buffer, 4);\n\t\t} else {\n\t\t\tswitch (pdfstr[i]){\n\t\t\t\tcase 0x08:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\b\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x09:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\t\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x0A:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\n\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x0C:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\f\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x0D:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\r\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x28:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\(\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x29:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\)\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tcase 0x5C:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) \"\\\\\\\\\", 2);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\twritten += t2pWriteFile(output, (tdata_t) &pdfstr[i], 1);\n\t\t\t}\n\t\t}\n\t}\n\twritten += t2pWriteFile(output, (tdata_t) \") \", 1);\n\n\treturn(written);\n}",
  22038. "project": "libtiff",
  22039. "hash": 86151881559785071816298781752930765945,
  22040. "size": 48,
  22041. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  22042. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  22043. "target": 0,
  22044. "dataset": "other",
  22045. "idx": 458970
  22046. },
  22047. {
  22048. "func": "tsize_t t2p_write_pdf(T2P* t2p, TIFF* input, TIFF* output){\n\n\ttsize_t written=0;\n\tttile_t i2=0;\n\ttsize_t streamlen=0;\n\tuint16 i=0;\n\n\tt2p_read_tiff_init(t2p, input);\n\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\tt2p->pdf_xrefoffsets= (uint32*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,t2p->pdf_xrefcount,sizeof(uint32)) );\n\tif(t2p->pdf_xrefoffsets==NULL){\n\t\tTIFFError(\n\t\t\tTIFF2PDF_MODULE, \n\t\t\t\"Can't allocate %u bytes of memory for t2p_write_pdf\", \n\t\t\t(unsigned int) (t2p->pdf_xrefcount * sizeof(uint32)) );\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(written);\n\t}\n\tt2p->pdf_xrefcount=0;\n\tt2p->pdf_catalog=1;\n\tt2p->pdf_info=2;\n\tt2p->pdf_pages=3;\n\twritten += t2p_write_pdf_header(t2p, output);\n\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\tt2p->pdf_catalog=t2p->pdf_xrefcount;\n\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\twritten += t2p_write_pdf_catalog(t2p, output);\n\twritten += t2p_write_pdf_obj_end(output);\n\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\tt2p->pdf_info=t2p->pdf_xrefcount;\n\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\twritten += t2p_write_pdf_info(t2p, input, output);\n\twritten += t2p_write_pdf_obj_end(output);\n\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\tt2p->pdf_pages=t2p->pdf_xrefcount;\n\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\twritten += t2p_write_pdf_pages(t2p, output);\n\twritten += t2p_write_pdf_obj_end(output);\n\tfor(t2p->pdf_page=0;t2p->pdf_page<t2p->tiff_pagecount;t2p->pdf_page++){\n\t\tt2p_read_tiff_data(t2p, input);\n\t\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\twritten += t2p_write_pdf_page(t2p->pdf_xrefcount, t2p, output);\n\t\twritten += t2p_write_pdf_obj_end(output);\n\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\twritten += t2p_write_pdf_stream_dict(0, t2p->pdf_xrefcount+1, output);\n\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\twritten += t2p_write_pdf_stream_start(output);\n\t\tstreamlen=written;\n\t\twritten += t2p_write_pdf_page_content_stream(t2p, output);\n\t\tstreamlen=written-streamlen;\n\t\twritten += t2p_write_pdf_stream_end(output);\n\t\twritten += t2p_write_pdf_obj_end(output);\n\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\twritten += t2p_write_pdf_stream_length(streamlen, output);\n\t\twritten += t2p_write_pdf_obj_end(output);\n\t\tif(t2p->tiff_transferfunctioncount != 0){\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_transfer(t2p, output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\tfor(i=0; i < t2p->tiff_transferfunctioncount; i++){\n\t\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\t\twritten += t2p_write_pdf_transfer_dict(t2p, output, i);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\t\t/* streamlen=written; */ /* value not used */\n\t\t\t\twritten += t2p_write_pdf_transfer_stream(t2p, output, i);\n\t\t\t\t/* streamlen=written-streamlen; */ /* value not used */\n\t\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\t}\n\t\t}\n\t\tif( (t2p->pdf_colorspace & T2P_CS_PALETTE) != 0){\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\tt2p->pdf_palettecs=t2p->pdf_xrefcount;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\twritten += t2p_write_pdf_stream_dict(t2p->pdf_palettesize, 0, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\t/* streamlen=written; */ /* value not used */\n\t\t\twritten += t2p_write_pdf_xobject_palettecs_stream(t2p, output);\n\t\t\t/* streamlen=written-streamlen; */ /* value not used */\n\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t}\n\t\tif( (t2p->pdf_colorspace & T2P_CS_ICCBASED) != 0){\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\tt2p->pdf_icccs=t2p->pdf_xrefcount;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\twritten += t2p_write_pdf_xobject_icccs_dict(t2p, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\t/* streamlen=written; */ /* value not used */\n\t\t\twritten += t2p_write_pdf_xobject_icccs_stream(t2p, output);\n\t\t\t/* streamlen=written-streamlen; */ /* value not used */\n\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t}\n\t\tif(t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount !=0){\n\t\t\tfor(i2=0;i2<t2p->tiff_tiles[t2p->pdf_page].tiles_tilecount;i2++){\n\t\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\t\twritten += t2p_write_pdf_xobject_stream_dict(\n\t\t\t\t\ti2+1, \n\t\t\t\t\tt2p, \n\t\t\t\t\toutput);\n\t\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\t\tstreamlen=written;\n\t\t\t\tt2p_read_tiff_size_tile(t2p, input, i2);\n\t\t\t\twritten += t2p_readwrite_pdf_image_tile(t2p, input, output, i2);\n\t\t\t\tt2p_write_advance_directory(t2p, output);\n\t\t\t\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\t\t\t\tstreamlen=written-streamlen;\n\t\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\t\twritten += t2p_write_pdf_stream_length(streamlen, output);\n\t\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\t}\n\t\t} else {\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_dict_start(output);\n\t\t\twritten += t2p_write_pdf_xobject_stream_dict(\n\t\t\t\t0, \n\t\t\t\tt2p, \n\t\t\t\toutput);\n\t\t\twritten += t2p_write_pdf_stream_dict_end(output);\n\t\t\twritten += t2p_write_pdf_stream_start(output);\n\t\t\tstreamlen=written;\n\t\t\tt2p_read_tiff_size(t2p, input);\n\t\t\tif (t2p->tiff_maxdatasize && (t2p->tiff_datasize > t2p->tiff_maxdatasize)) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Allocation of \" TIFF_UINT64_FORMAT \" bytes is forbidden. Limit is \" TIFF_UINT64_FORMAT \". Use -m option to change limit\",\n\t\t\t\t\t(uint64)t2p->tiff_datasize, (uint64)t2p->tiff_maxdatasize);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn (0);\n\t\t\t}\n\t\t\twritten += t2p_readwrite_pdf_image(t2p, input, output);\n\t\t\tt2p_write_advance_directory(t2p, output);\n\t\t\tif(t2p->t2p_error!=T2P_ERR_OK){return(0);}\n\t\t\tstreamlen=written-streamlen;\n\t\t\twritten += t2p_write_pdf_stream_end(output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t\tt2p->pdf_xrefoffsets[t2p->pdf_xrefcount++]=written;\n\t\t\twritten += t2p_write_pdf_obj_start(t2p->pdf_xrefcount, output);\n\t\t\twritten += t2p_write_pdf_stream_length(streamlen, output);\n\t\t\twritten += t2p_write_pdf_obj_end(output);\n\t\t}\n\t}\n\tt2p->pdf_startxref = written;\n\twritten += t2p_write_pdf_xreftable(t2p, output);\n\twritten += t2p_write_pdf_trailer(t2p, output);\n\tt2p_disable(output);\n\n\treturn(written);\n}",
  22049. "project": "libtiff",
  22050. "hash": 121739583097653850761874652218865650196,
  22051. "size": 169,
  22052. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  22053. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  22054. "target": 0,
  22055. "dataset": "other",
  22056. "idx": 458967
  22057. },
  22058. {
  22059. "func": "tsize_t t2p_sample_realize_palette(T2P* t2p, unsigned char* buffer){\n\n\tuint32 sample_count=0;\n\tuint16 component_count=0;\n\tuint32 palette_offset=0;\n\tuint32 sample_offset=0;\n\tuint32 i=0;\n\tuint32 j=0;\n size_t data_size;\n\tsample_count=t2p->tiff_width*t2p->tiff_length;\n\tcomponent_count=t2p->tiff_samplesperpixel;\n data_size=TIFFSafeMultiply(size_t,sample_count,component_count);\n if( (data_size == 0U) || (t2p->tiff_datasize < 0) ||\n (data_size > (size_t) t2p->tiff_datasize) )\n {\n TIFFError(TIFF2PDF_MODULE,\n \"Error: sample_count * component_count > t2p->tiff_datasize\");\n t2p->t2p_error = T2P_ERR_ERROR;\n return 1;\n }\n\t\n\tfor(i=sample_count;i>0;i--){\n\t\tpalette_offset=buffer[i-1] * component_count;\n\t\tsample_offset= (i-1) * component_count;\n\t\tif(palette_offset + component_count > t2p->pdf_palettesize){\n\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\"Error: palette_offset + component_count > t2p->pdf_palettesize\");\n\t\t\treturn 1;\n\t\t}\n\t\tfor(j=0;j<component_count;j++){\n\t\t\tbuffer[sample_offset+j]=t2p->pdf_palette[palette_offset+j];\n\t\t}\n\t}\n\n\treturn(0);\n}",
  22060. "project": "libtiff",
  22061. "hash": 11898587447193504535260703162915026572,
  22062. "size": 36,
  22063. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  22064. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  22065. "target": 0,
  22066. "dataset": "other",
  22067. "idx": 458980
  22068. },
  22069. {
  22070. "func": "tsize_t t2p_readwrite_pdf_image_tile(T2P* t2p, TIFF* input, TIFF* output, ttile_t tile){\n\n\tuint16 edge=0;\n\ttsize_t written=0;\n\tunsigned char* buffer=NULL;\n\ttsize_t bufferoffset=0;\n\tunsigned char* samplebuffer=NULL;\n\ttsize_t samplebufferoffset=0;\n\ttsize_t read=0;\n\tuint16 i=0;\n\tttile_t tilecount=0;\n\t/* tsize_t tilesize=0; */\n\tttile_t septilecount=0;\n\ttsize_t septilesize=0;\n#ifdef JPEG_SUPPORT\n\tunsigned char* jpt;\n\tfloat* xfloatp;\n\tuint32 xuint32=0;\n#endif\n\n\t/* Fail if prior error (in particular, can't trust tiff_datasize) */\n\tif (t2p->t2p_error != T2P_ERR_OK)\n\t\treturn(0);\n\n\tedge |= t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\tedge |= t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile);\n\n\tif( (t2p->pdf_transcode == T2P_TRANSCODE_RAW) && ((edge == 0)\n#if defined(JPEG_SUPPORT) || defined(OJPEG_SUPPORT)\n\t\t|| (t2p->pdf_compression == T2P_COMPRESS_JPEG)\n#endif\n\t)\n\t){\n#ifdef CCITT_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_G4){\n\t\t\tbuffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %lu bytes of memory \"\n \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\t(unsigned long) t2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif (TIFFReadRawTile(input, tile, (tdata_t) buffer, t2p->tiff_datasize) < 0) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"TIFFReadRawTile() failed\");\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB){\n\t\t\t\t\tTIFFReverseBits(buffer, t2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif\n#ifdef ZIP_SUPPORT\n\t\tif(t2p->pdf_compression == T2P_COMPRESS_ZIP){\n\t\t\tbuffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %lu bytes of memory \"\n \"for t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t\t(unsigned long) t2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif (TIFFReadRawTile(input, tile, (tdata_t) buffer, t2p->tiff_datasize) < 0) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"TIFFReadRawTile() failed\");\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tif (t2p->tiff_fillorder==FILLORDER_LSB2MSB){\n\t\t\t\t\tTIFFReverseBits(buffer, t2p->tiff_datasize);\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, t2p->tiff_datasize);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(t2p->tiff_datasize);\n\t\t}\n#endif\n#ifdef OJPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_OJPEG){\n\t\t\ttsize_t retTIFFReadRawTile;\n\t\t\tif(! t2p->pdf_ojpegdata){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"No support for OJPEG image %s with \"\n \"bad tables\", \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tbuffer=(unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate %lu bytes of memory \"\n \"for t2p_readwrite_pdf_image, %s\", \n\t\t\t\t\t(unsigned long) t2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\t_TIFFmemcpy(buffer, t2p->pdf_ojpegdata, t2p->pdf_ojpegdatalength);\n\t\t\tif(edge!=0){\n\t\t\t\tif(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile)){\n\t\t\t\t\tbuffer[7]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength >> 8) & 0xff;\n\t\t\t\t\tbuffer[8]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength ) & 0xff;\n\t\t\t\t}\n\t\t\t\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile)){\n\t\t\t\t\tbuffer[9]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth >> 8) & 0xff;\n\t\t\t\t\tbuffer[10]=\n\t\t\t\t\t\t(t2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth ) & 0xff;\n\t\t\t\t}\n\t\t\t}\n\t\t\tbufferoffset = t2p->pdf_ojpegdatalength;\n\t\t\tretTIFFReadRawTile = TIFFReadRawTile(input,\n\t\t\t\t\ttile, \n\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t-1);\n\t\t\tif (retTIFFReadRawTile < 0) {\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \"TIFFReadRawTile() failed\");\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tbufferoffset += retTIFFReadRawTile;\n\t\t\t((unsigned char*)buffer)[bufferoffset++]=0xff;\n\t\t\t((unsigned char*)buffer)[bufferoffset++]=0xd9;\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(bufferoffset);\n\t\t}\n#endif\n#ifdef JPEG_SUPPORT\n\t\tif(t2p->tiff_compression == COMPRESSION_JPEG){\n\t\t\tunsigned char table_end[2];\n\t\t\tuint32 count = 0;\n\t\t\tbuffer= (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\"Can't allocate \" TIFF_SIZE_FORMAT \" bytes of memory \"\n \"for t2p_readwrite_pdf_image_tile, %s\", \n (TIFF_SIZE_T) t2p->tiff_datasize, \n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tif(TIFFGetField(input, TIFFTAG_JPEGTABLES, &count, &jpt) != 0) {\n\t\t\t\tif (count > 4) {\n tsize_t retTIFFReadRawTile;\n /* Ignore EOI marker of JpegTables */\n\t\t\t\t\t_TIFFmemcpy(buffer, jpt, count - 2);\n\t\t\t\t\tbufferoffset += count - 2;\n /* Store last 2 bytes of the JpegTables */\n\t\t\t\t\ttable_end[0] = buffer[bufferoffset-2];\n\t\t\t\t\ttable_end[1] = buffer[bufferoffset-1];\n\t\t\t\t\txuint32 = bufferoffset;\n bufferoffset -= 2;\n retTIFFReadRawTile = TIFFReadRawTile(\n\t\t\t\t\t\tinput, \n\t\t\t\t\t\ttile, \n\t\t\t\t\t\t(tdata_t) &(((unsigned char*)buffer)[bufferoffset]), \n\t\t\t\t\t\t-1);\n if( retTIFFReadRawTile < 0 )\n {\n _TIFFfree(buffer);\n t2p->t2p_error = T2P_ERR_ERROR;\n return(0);\n }\n\t\t\t\t\tbufferoffset += retTIFFReadRawTile;\n /* Overwrite SOI marker of image scan with previously */\n /* saved end of JpegTables */\n\t\t\t\t\tbuffer[xuint32-2]=table_end[0];\n\t\t\t\t\tbuffer[xuint32-1]=table_end[1];\n\t\t\t\t}\n\t\t\t}\n\t\t\tt2pWriteFile(output, (tdata_t) buffer, bufferoffset);\n\t\t\t_TIFFfree(buffer);\n\t\t\treturn(bufferoffset);\n\t\t}\n#endif\n\t\t(void)0;\n\t}\n\n\tif(t2p->pdf_sample==T2P_SAMPLE_NOTHING){\n\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\tif(buffer==NULL){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Can't allocate %lu bytes of memory for \"\n \"t2p_readwrite_pdf_image_tile, %s\", \n\t\t\t\t(unsigned long) t2p->tiff_datasize, \n\t\t\t\tTIFFFileName(input));\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\n\t\tread = TIFFReadEncodedTile(\n\t\t\tinput, \n\t\t\ttile, \n\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\tt2p->tiff_datasize);\n\t\tif(read==-1){\n\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\"Error on decoding tile %u of %s\", \n\t\t\t\ttile, \n\t\t\t\tTIFFFileName(input));\n\t\t\t_TIFFfree(buffer);\n\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\n\t} else {\n\n\t\tif(t2p->pdf_sample == T2P_SAMPLE_PLANAR_SEPARATE_TO_CONTIG){\n\t\t\tseptilesize=TIFFTileSize(input);\n\t\t\tseptilecount=TIFFNumberOfTiles(input);\n\t\t\t/* tilesize=septilesize*t2p->tiff_samplesperpixel; */\n\t\t\ttilecount=septilecount/t2p->tiff_samplesperpixel;\n\t\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory \"\n\t\t\t\t\t\"for t2p_readwrite_pdf_image_tile, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tsamplebuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(samplebuffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory \"\n\t\t\t\t\t\"for t2p_readwrite_pdf_image_tile, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(samplebuffer, 0, t2p->tiff_datasize);\n\t\t\tsamplebufferoffset=0;\n\t\t\tfor(i=0;i<t2p->tiff_samplesperpixel;i++){\n\t\t\t\tread = \n\t\t\t\t\tTIFFReadEncodedTile(input, \n\t\t\t\t\t\ttile + i*tilecount, \n\t\t\t\t\t\t(tdata_t) &(samplebuffer[samplebufferoffset]), \n\t\t\t\t\t\tseptilesize);\n\t\t\t\tif(read==-1){\n\t\t\t\t\tTIFFError(TIFF2PDF_MODULE, \n\t\t\t\t\t\t\"Error on decoding tile %u of %s\", \n\t\t\t\t\t\ttile + i*tilecount, \n\t\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t\t\t_TIFFfree(samplebuffer);\n\t\t\t\t\t\t_TIFFfree(buffer);\n\t\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\t\treturn(0);\n\t\t\t\t}\n\t\t\t\tsamplebufferoffset+=read;\n\t\t\t}\n\t\t\tt2p_sample_planar_separate_to_contig(\n\t\t\t\tt2p,\n\t\t\t\t&(buffer[bufferoffset]),\n\t\t\t\tsamplebuffer, \n\t\t\t\tsamplebufferoffset); \n\t\t\tbufferoffset+=samplebufferoffset;\n\t\t\t_TIFFfree(samplebuffer);\n\t\t}\n\n\t\tif(buffer==NULL){\n\t\t\tbuffer = (unsigned char*) _TIFFmalloc(t2p->tiff_datasize);\n\t\t\tif(buffer==NULL){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Can't allocate %lu bytes of memory \"\n\t\t\t\t\t\"for t2p_readwrite_pdf_image_tile, %s\",\n\t\t\t\t\t(unsigned long) t2p->tiff_datasize,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t\tmemset(buffer, 0, t2p->tiff_datasize);\n\t\t\tread = TIFFReadEncodedTile(\n\t\t\t\tinput, \n\t\t\t\ttile, \n\t\t\t\t(tdata_t) &buffer[bufferoffset], \n\t\t\t\tt2p->tiff_datasize);\n\t\t\tif(read==-1){\n\t\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\t\"Error on decoding tile %u of %s\",\n\t\t\t\t\ttile,\n\t\t\t\t\tTIFFFileName(input));\n\t\t\t\t_TIFFfree(buffer);\n\t\t\t\tt2p->t2p_error=T2P_ERR_ERROR;\n\t\t\t\treturn(0);\n\t\t\t}\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgba_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth\n\t\t\t\t*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_RGBAA_TO_RGB){\n\t\t\tt2p->tiff_datasize=t2p_sample_rgbaa_to_rgb(\n\t\t\t\t(tdata_t)buffer, \n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth\n\t\t\t\t*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_YCBCR_TO_RGB){\n\t\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t\t\t\"No support for YCbCr to RGB in tile for %s\",\n\t\t\t\tTIFFFileName(input));\n\t\t\t_TIFFfree(buffer);\n\t\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\t\treturn(0);\n\t\t}\n\n\t\tif(t2p->pdf_sample & T2P_SAMPLE_LAB_SIGNED_TO_UNSIGNED){\n\t\t\tt2p->tiff_datasize=t2p_sample_lab_signed_to_unsigned(\n\t\t\t\t(tdata_t)buffer,\n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth\n\t\t\t\t*t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\t}\n\n\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) != 0){\n\t\tif ((uint64)t2p->tiff_datasize < (uint64)TIFFTileRowSize(input) * (uint64)t2p->tiff_tiles[t2p->pdf_page].tiles_tilelength) {\n\t\t\t/* we don't know how to handle PLANARCONFIG_CONTIG, PHOTOMETRIC_YCBCR with 3 samples per pixel */\n\t\t\tTIFFWarning(\n\t\t\t\tTIFF2PDF_MODULE,\n\t\t\t\t\"Don't know how to collapse tile to the left\");\n\t\t} else {\n\t\t\tt2p_tile_collapse_left(\n\t\t\t\tbuffer,\n\t\t\t\tTIFFTileRowSize(input),\n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth,\n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth,\n\t\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\t}\n\t}\n\n\n\tt2p_disable(output);\n\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, t2p->tiff_photometric);\n\tTIFFSetField(output, TIFFTAG_BITSPERSAMPLE, t2p->tiff_bitspersample);\n\tTIFFSetField(output, TIFFTAG_SAMPLESPERPIXEL, t2p->tiff_samplesperpixel);\n\tif(t2p_tile_is_right_edge(t2p->tiff_tiles[t2p->pdf_page], tile) == 0){\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGEWIDTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilewidth);\n\t} else {\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGEWIDTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilewidth);\n\t}\n\tif(t2p_tile_is_bottom_edge(t2p->tiff_tiles[t2p->pdf_page], tile) == 0){\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGELENGTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_ROWSPERSTRIP, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_tilelength);\n\t} else {\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_IMAGELENGTH, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);\n\t\tTIFFSetField(\n\t\t\toutput, \n\t\t\tTIFFTAG_ROWSPERSTRIP, \n\t\t\tt2p->tiff_tiles[t2p->pdf_page].tiles_edgetilelength);\n\t}\n\tTIFFSetField(output, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);\n\tTIFFSetField(output, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);\n\n\tswitch(t2p->pdf_compression){\n\tcase T2P_COMPRESS_NONE:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_NONE);\n\t\tbreak;\n#ifdef CCITT_SUPPORT\n\tcase T2P_COMPRESS_G4:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);\n\t\tbreak;\n#endif\n#ifdef JPEG_SUPPORT\n\tcase T2P_COMPRESS_JPEG:\n\t\tif (t2p->tiff_photometric==PHOTOMETRIC_YCBCR) {\n\t\t\tuint16 hor = 0, ver = 0;\n\t\t\tif (TIFFGetField(input, TIFFTAG_YCBCRSUBSAMPLING, &hor, &ver)!=0) {\n\t\t\t\tif (hor != 0 && ver != 0) {\n\t\t\t\t\tTIFFSetField(output, TIFFTAG_YCBCRSUBSAMPLING, hor, ver);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(TIFFGetField(input, TIFFTAG_REFERENCEBLACKWHITE, &xfloatp)!=0){\n\t\t\t\tTIFFSetField(output, TIFFTAG_REFERENCEBLACKWHITE, xfloatp);\n\t\t\t}\n\t\t}\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_JPEG);\n\t\tTIFFSetField(output, TIFFTAG_JPEGTABLESMODE, 0); /* JPEGTABLESMODE_NONE */\n\t\tif(t2p->pdf_colorspace & (T2P_CS_RGB | T2P_CS_LAB)){\n\t\t\tTIFFSetField(output, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_YCBCR);\n\t\t\tif(t2p->tiff_photometric != PHOTOMETRIC_YCBCR){\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RGB);\n\t\t\t} else {\n\t\t\t\tTIFFSetField(output, TIFFTAG_JPEGCOLORMODE, JPEGCOLORMODE_RAW);\n\t\t\t}\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_GRAY){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_colorspace & T2P_CS_CMYK){\n\t\t\t(void)0;\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_JPEGQUALITY, \n\t\t\t\tt2p->pdf_defaultcompressionquality);\n\t\t}\n\t\tbreak;\n#endif\n#ifdef ZIP_SUPPORT\n\tcase T2P_COMPRESS_ZIP:\n\t\tTIFFSetField(output, TIFFTAG_COMPRESSION, COMPRESSION_DEFLATE);\n\t\tif(t2p->pdf_defaultcompressionquality%100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_PREDICTOR, \n\t\t\t\tt2p->pdf_defaultcompressionquality % 100);\n\t\t}\n\t\tif(t2p->pdf_defaultcompressionquality/100 != 0){\n\t\t\tTIFFSetField(output, \n\t\t\t\tTIFFTAG_ZIPQUALITY, \n\t\t\t\t(t2p->pdf_defaultcompressionquality / 100));\n\t\t}\n\t\tbreak;\n#endif\n\tdefault:\n\t\tbreak;\n\t}\n\n\tt2p_enable(output);\n\tt2p->outputwritten = 0;\n\tbufferoffset = TIFFWriteEncodedStrip(output, (tstrip_t) 0, buffer,\n\t TIFFStripSize(output));\n\tif (buffer != NULL) {\n\t\t_TIFFfree(buffer);\n\t\tbuffer = NULL;\n\t}\n\tif (bufferoffset == -1) {\n\t\tTIFFError(TIFF2PDF_MODULE,\n\t\t \"Error writing encoded tile to output PDF %s\",\n\t\t TIFFFileName(output));\n\t\tt2p->t2p_error = T2P_ERR_ERROR;\n\t\treturn(0);\n\t}\n\t\n\twritten = t2p->outputwritten;\n\t\n\treturn(written);\n}",
  22071. "project": "libtiff",
  22072. "hash": 6062510438439762854881860806786490226,
  22073. "size": 480,
  22074. "commit_id": "7be2e452ddcf6d7abca88f41d3761e6edab72b22",
  22075. "message": "tiff2pdf.c: properly calculate datasize when saving to JPEG YCbCr\n\nfixes #220",
  22076. "target": 0,
  22077. "dataset": "other",
  22078. "idx": 458976
  22079. }
  22080. ]
  22081. },
  22082. {
  22083. "call_depth": 3,
  22084. "longest_call_chain": [
  22085. "update_send_window_create",
  22086. "update_send_new_or_existing_window",
  22087. "update_calculate_new_or_existing_window"
  22088. ],
  22089. "group_size": 4,
  22090. "functions": [
  22091. {
  22092. "func": "static BOOL update_send_new_or_existing_window(rdpContext* context,\n const WINDOW_ORDER_INFO* orderInfo,\n const WINDOW_STATE_ORDER* stateOrder)\n{\n\twStream* s;\n\trdpUpdate* update = context->update;\n\tBYTE controlFlags = ORDER_SECONDARY | (ORDER_TYPE_WINDOW << 2);\n\tUINT16 orderSize = update_calculate_new_or_existing_window(orderInfo, stateOrder);\n\n\tupdate_check_flush(context, orderSize);\n\n\ts = update->us;\n\n\tif (!s)\n\t\treturn FALSE;\n\n\tif (!Stream_EnsureRemainingCapacity(s, orderSize))\n\t\treturn FALSE;\n\n\tStream_Write_UINT8(s, controlFlags); /* Header (1 byte) */\n\tStream_Write_UINT16(s, orderSize); /* OrderSize (2 bytes) */\n\tStream_Write_UINT32(s, orderInfo->fieldFlags); /* FieldsPresentFlags (4 bytes) */\n\tStream_Write_UINT32(s, orderInfo->windowId); /* WindowID (4 bytes) */\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER) != 0)\n\t\tStream_Write_UINT32(s, stateOrder->ownerWindowId);\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE) != 0)\n\t{\n\t\tStream_Write_UINT32(s, stateOrder->style);\n\t\tStream_Write_UINT32(s, stateOrder->extendedStyle);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW) != 0)\n\t{\n\t\tStream_Write_UINT8(s, stateOrder->showState);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) != 0)\n\t{\n\t\tStream_Write_UINT16(s, stateOrder->titleInfo.length);\n\t\tStream_Write(s, stateOrder->titleInfo.string, stateOrder->titleInfo.length);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET) != 0)\n\t{\n\t\tStream_Write_INT32(s, stateOrder->clientOffsetX);\n\t\tStream_Write_INT32(s, stateOrder->clientOffsetY);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE) != 0)\n\t{\n\t\tStream_Write_UINT32(s, stateOrder->clientAreaWidth);\n\t\tStream_Write_UINT32(s, stateOrder->clientAreaHeight);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_X) != 0)\n\t{\n\t\tStream_Write_UINT32(s, stateOrder->resizeMarginLeft);\n\t\tStream_Write_UINT32(s, stateOrder->resizeMarginRight);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_Y) != 0)\n\t{\n\t\tStream_Write_UINT32(s, stateOrder->resizeMarginTop);\n\t\tStream_Write_UINT32(s, stateOrder->resizeMarginBottom);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT) != 0)\n\t{\n\t\tStream_Write_UINT8(s, stateOrder->RPContent);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT) != 0)\n\t{\n\t\tStream_Write_UINT32(s, stateOrder->rootParentHandle);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) != 0)\n\t{\n\t\tStream_Write_INT32(s, stateOrder->windowOffsetX);\n\t\tStream_Write_INT32(s, stateOrder->windowOffsetY);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA) != 0)\n\t{\n\t\tStream_Write_INT32(s, stateOrder->windowClientDeltaX);\n\t\tStream_Write_INT32(s, stateOrder->windowClientDeltaY);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE) != 0)\n\t{\n\t\tStream_Write_UINT32(s, stateOrder->windowWidth);\n\t\tStream_Write_UINT32(s, stateOrder->windowHeight);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS) != 0)\n\t{\n\t\tStream_Write_UINT16(s, stateOrder->numWindowRects);\n\t\tStream_Write(s, stateOrder->windowRects, stateOrder->numWindowRects * sizeof(RECTANGLE_16));\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET) != 0)\n\t{\n\t\tStream_Write_UINT32(s, stateOrder->visibleOffsetX);\n\t\tStream_Write_UINT32(s, stateOrder->visibleOffsetY);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY) != 0)\n\t{\n\t\tStream_Write_UINT16(s, stateOrder->numVisibilityRects);\n\t\tStream_Write(s, stateOrder->visibilityRects,\n\t\t stateOrder->numVisibilityRects * sizeof(RECTANGLE_16));\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OVERLAY_DESCRIPTION) != 0)\n\t{\n\t\tStream_Write_UINT16(s, stateOrder->OverlayDescription.length);\n\t\tStream_Write(s, stateOrder->OverlayDescription.string,\n\t\t stateOrder->OverlayDescription.length);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TASKBAR_BUTTON) != 0)\n\t{\n\t\tStream_Write_UINT8(s, stateOrder->TaskbarButton);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ENFORCE_SERVER_ZORDER) != 0)\n\t{\n\t\tStream_Write_UINT8(s, stateOrder->EnforceServerZOrder);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_STATE) != 0)\n\t{\n\t\tStream_Write_UINT8(s, stateOrder->AppBarState);\n\t}\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_EDGE) != 0)\n\t{\n\t\tStream_Write_UINT8(s, stateOrder->AppBarEdge);\n\t}\n\n\tupdate->numberOrders++;\n\treturn TRUE;\n}",
  22093. "project": "FreeRDP",
  22094. "hash": 124760451968936173510223398271208979727,
  22095. "size": 145,
  22096. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  22097. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  22098. "target": 0,
  22099. "dataset": "other",
  22100. "idx": 295068
  22101. },
  22102. {
  22103. "func": "static UINT16 update_calculate_new_or_existing_window(const WINDOW_ORDER_INFO* orderInfo,\n const WINDOW_STATE_ORDER* stateOrder)\n{\n\tUINT16 orderSize = 11;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OWNER) != 0)\n\t\torderSize += 4;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_STYLE) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_SHOW) != 0)\n\t\torderSize += 1;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TITLE) != 0)\n\t\torderSize += 2 + stateOrder->titleInfo.length;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_OFFSET) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_CLIENT_AREA_SIZE) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_X) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RESIZE_MARGIN_Y) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_RP_CONTENT) != 0)\n\t\torderSize += 1;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ROOT_PARENT) != 0)\n\t\torderSize += 4;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_OFFSET) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_CLIENT_DELTA) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_SIZE) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_WND_RECTS) != 0)\n\t\torderSize += 2 + stateOrder->numWindowRects * sizeof(RECTANGLE_16);\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VIS_OFFSET) != 0)\n\t\torderSize += 8;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_VISIBILITY) != 0)\n\t\torderSize += 2 + stateOrder->numVisibilityRects * sizeof(RECTANGLE_16);\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_OVERLAY_DESCRIPTION) != 0)\n\t\torderSize += 2 + stateOrder->OverlayDescription.length;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_TASKBAR_BUTTON) != 0)\n\t\torderSize += 1;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_ENFORCE_SERVER_ZORDER) != 0)\n\t\torderSize += 1;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_STATE) != 0)\n\t\torderSize += 1;\n\n\tif ((orderInfo->fieldFlags & WINDOW_ORDER_FIELD_APPBAR_EDGE) != 0)\n\t\torderSize += 1;\n\n\treturn orderSize;\n}",
  22104. "project": "FreeRDP",
  22105. "hash": 31939646501544311464704313942093584006,
  22106. "size": 70,
  22107. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  22108. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  22109. "target": 0,
  22110. "dataset": "other",
  22111. "idx": 295040
  22112. },
  22113. {
  22114. "func": "static BOOL update_send_window_create(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,\n const WINDOW_STATE_ORDER* stateOrder)\n{\n\treturn update_send_new_or_existing_window(context, orderInfo, stateOrder);\n}",
  22115. "project": "FreeRDP",
  22116. "hash": 70810042977149728754304204225912821312,
  22117. "size": 5,
  22118. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  22119. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  22120. "target": 0,
  22121. "dataset": "other",
  22122. "idx": 295102
  22123. },
  22124. {
  22125. "func": "static BOOL update_send_window_update(rdpContext* context, const WINDOW_ORDER_INFO* orderInfo,\n const WINDOW_STATE_ORDER* stateOrder)\n{\n\treturn update_send_new_or_existing_window(context, orderInfo, stateOrder);\n}",
  22126. "project": "FreeRDP",
  22127. "hash": 292010346822393637013189358006251972620,
  22128. "size": 5,
  22129. "commit_id": "0332cad015fdf7fac7e5c6863484f18a554e0fcf",
  22130. "message": "Fixed oob read in update_recv\n\nproperly use update_type_to_string to print update type.\nThanks to hac425 CVE-2020-11019",
  22131. "target": 0,
  22132. "dataset": "other",
  22133. "idx": 295026
  22134. }
  22135. ]
  22136. },
  22137. {
  22138. "call_depth": 4,
  22139. "longest_call_chain": [
  22140. "rtsx_usb_ms_handle_req",
  22141. "rtsx_usb_ms_issue_cmd",
  22142. "ms_write_bytes",
  22143. "ms_clear_error"
  22144. ],
  22145. "group_size": 8,
  22146. "functions": [
  22147. {
  22148. "func": "static void ms_print_debug_regs(struct rtsx_usb_ms *host)\n{\n}",
  22149. "project": "linux",
  22150. "hash": 176400605400045756040048099491150353938,
  22151. "size": 3,
  22152. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22153. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22154. "target": 0,
  22155. "dataset": "other",
  22156. "idx": 386056
  22157. },
  22158. {
  22159. "func": "static void ms_print_debug_regs(struct rtsx_usb_ms *host)\n{\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tu16 i;\n\tu8 *ptr;\n\n\t/* Print MS host internal registers */\n\trtsx_usb_init_cmd(ucr);\n\n\t/* MS_CFG to MS_INT_REG */\n\tfor (i = 0xFD40; i <= 0xFD44; i++)\n\t\trtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0);\n\n\t/* CARD_SHARE_MODE to CARD_GPIO */\n\tfor (i = 0xFD51; i <= 0xFD56; i++)\n\t\trtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0);\n\n\t/* CARD_PULL_CTLx */\n\tfor (i = 0xFD60; i <= 0xFD65; i++)\n\t\trtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0);\n\n\t/* CARD_DATA_SOURCE, CARD_SELECT, CARD_CLK_EN, CARD_PWR_CTL */\n\trtsx_usb_add_cmd(ucr, READ_REG_CMD, CARD_DATA_SOURCE, 0, 0);\n\trtsx_usb_add_cmd(ucr, READ_REG_CMD, CARD_SELECT, 0, 0);\n\trtsx_usb_add_cmd(ucr, READ_REG_CMD, CARD_CLK_EN, 0, 0);\n\trtsx_usb_add_cmd(ucr, READ_REG_CMD, CARD_PWR_CTL, 0, 0);\n\n\trtsx_usb_send_cmd(ucr, MODE_CR, 100);\n\trtsx_usb_get_rsp(ucr, 21, 100);\n\n\tptr = ucr->rsp_buf;\n\tfor (i = 0xFD40; i <= 0xFD44; i++)\n\t\tdev_dbg(ms_dev(host), \"0x%04X: 0x%02x\\n\", i, *(ptr++));\n\tfor (i = 0xFD51; i <= 0xFD56; i++)\n\t\tdev_dbg(ms_dev(host), \"0x%04X: 0x%02x\\n\", i, *(ptr++));\n\tfor (i = 0xFD60; i <= 0xFD65; i++)\n\t\tdev_dbg(ms_dev(host), \"0x%04X: 0x%02x\\n\", i, *(ptr++));\n\n\tdev_dbg(ms_dev(host), \"0x%04X: 0x%02x\\n\", CARD_DATA_SOURCE, *(ptr++));\n\tdev_dbg(ms_dev(host), \"0x%04X: 0x%02x\\n\", CARD_SELECT, *(ptr++));\n\tdev_dbg(ms_dev(host), \"0x%04X: 0x%02x\\n\", CARD_CLK_EN, *(ptr++));\n\tdev_dbg(ms_dev(host), \"0x%04X: 0x%02x\\n\", CARD_PWR_CTL, *(ptr++));\n}",
  22160. "project": "linux",
  22161. "hash": 326803931574304168358292052953432330419,
  22162. "size": 43,
  22163. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22164. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22165. "target": 0,
  22166. "dataset": "other",
  22167. "idx": 386058
  22168. },
  22169. {
  22170. "func": "static int rtsx_usb_ms_issue_cmd(struct rtsx_usb_ms *host)\n{\n\tstruct memstick_request *req = host->req;\n\tint err = 0;\n\tu8 cfg = 0, int_reg;\n\n\tdev_dbg(ms_dev(host), \"%s\\n\", __func__);\n\n\tif (req->need_card_int) {\n\t\tif (host->ifmode != MEMSTICK_SERIAL)\n\t\t\tcfg = WAIT_INT;\n\t}\n\n\tif (req->long_data) {\n\t\terr = ms_transfer_data(host, req->data_dir,\n\t\t\t\treq->tpc, cfg, &(req->sg));\n\t} else {\n\t\tif (req->data_dir == READ)\n\t\t\terr = ms_read_bytes(host, req->tpc, cfg,\n\t\t\t\t\treq->data_len, req->data, &int_reg);\n\t\telse\n\t\t\terr = ms_write_bytes(host, req->tpc, cfg,\n\t\t\t\t\treq->data_len, req->data, &int_reg);\n\t}\n\tif (err < 0)\n\t\treturn err;\n\n\tif (req->need_card_int) {\n\t\tif (host->ifmode == MEMSTICK_SERIAL) {\n\t\t\terr = ms_read_bytes(host, MS_TPC_GET_INT,\n\t\t\t\t\tNO_WAIT_INT, 1, &req->int_reg, NULL);\n\t\t\tif (err < 0)\n\t\t\t\treturn err;\n\t\t} else {\n\n\t\t\tif (int_reg & MS_INT_CMDNK)\n\t\t\t\treq->int_reg |= MEMSTICK_INT_CMDNAK;\n\t\t\tif (int_reg & MS_INT_BREQ)\n\t\t\t\treq->int_reg |= MEMSTICK_INT_BREQ;\n\t\t\tif (int_reg & MS_INT_ERR)\n\t\t\t\treq->int_reg |= MEMSTICK_INT_ERR;\n\t\t\tif (int_reg & MS_INT_CED)\n\t\t\t\treq->int_reg |= MEMSTICK_INT_CED;\n\t\t}\n\t\tdev_dbg(ms_dev(host), \"int_reg: 0x%02x\\n\", req->int_reg);\n\t}\n\n\treturn 0;\n}",
  22171. "project": "linux",
  22172. "hash": 169539839505914735375447515182540820783,
  22173. "size": 49,
  22174. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22175. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22176. "target": 0,
  22177. "dataset": "other",
  22178. "idx": 386061
  22179. },
  22180. {
  22181. "func": "static int ms_write_bytes(struct rtsx_usb_ms *host, u8 tpc,\n\t\tu8 cfg, u8 cnt, u8 *data, u8 *int_reg)\n{\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tint err, i;\n\n\tdev_dbg(ms_dev(host), \"%s: tpc = 0x%02x\\n\", __func__, tpc);\n\n\trtsx_usb_init_cmd(ucr);\n\n\tfor (i = 0; i < cnt; i++)\n\t\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD,\n\t\t\t\tPPBUF_BASE2 + i, 0xFF, data[i]);\n\n\tif (cnt % 2)\n\t\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD,\n\t\t\t\tPPBUF_BASE2 + i, 0xFF, 0xFF);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TPC, 0xFF, tpc);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_DATA_SOURCE,\n\t\t\t0x01, PINGPONG_BUFFER);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANSFER,\n\t\t\t0xFF, MS_TRANSFER_START | MS_TM_WRITE_BYTES);\n\trtsx_usb_add_cmd(ucr, CHECK_REG_CMD, MS_TRANSFER,\n\t\t\tMS_TRANSFER_END, MS_TRANSFER_END);\n\trtsx_usb_add_cmd(ucr, READ_REG_CMD, MS_TRANS_CFG, 0, 0);\n\n\terr = rtsx_usb_send_cmd(ucr, MODE_CR, 100);\n\tif (err)\n\t\treturn err;\n\n\terr = rtsx_usb_get_rsp(ucr, 2, 5000);\n\tif (err || (ucr->rsp_buf[0] & MS_TRANSFER_ERR)) {\n\t\tu8 val;\n\n\t\trtsx_usb_ep0_read_register(ucr, MS_TRANS_CFG, &val);\n\t\tdev_dbg(ms_dev(host), \"MS_TRANS_CFG: 0x%02x\\n\", val);\n\n\t\tif (int_reg)\n\t\t\t*int_reg = val & 0x0F;\n\n\t\tms_print_debug_regs(host);\n\n\t\tms_clear_error(host);\n\n\t\tif (!(tpc & 0x08)) {\n\t\t\tif (val & MS_CRC16_ERR)\n\t\t\t\treturn -EIO;\n\t\t} else {\n\t\t\tif (!(val & 0x80)) {\n\t\t\t\tif (val & (MS_INT_ERR | MS_INT_CMDNK))\n\t\t\t\t\treturn -EIO;\n\t\t\t}\n\t\t}\n\n\t\treturn -ETIMEDOUT;\n\t}\n\n\tif (int_reg)\n\t\t*int_reg = ucr->rsp_buf[1] & 0x0F;\n\n\treturn 0;\n}",
  22182. "project": "linux",
  22183. "hash": 43064859218006336972034644189664040268,
  22184. "size": 66,
  22185. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22186. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22187. "target": 0,
  22188. "dataset": "other",
  22189. "idx": 386059
  22190. },
  22191. {
  22192. "func": "static inline void ms_clear_error(struct rtsx_usb_ms *host)\n{\n\tstruct rtsx_ucr *ucr = host->ucr;\n\trtsx_usb_ep0_write_register(ucr, CARD_STOP,\n\t\t\t\t MS_STOP | MS_CLR_ERR,\n\t\t\t\t MS_STOP | MS_CLR_ERR);\n\n\trtsx_usb_clear_dma_err(ucr);\n\trtsx_usb_clear_fsm_err(ucr);\n}",
  22193. "project": "linux",
  22194. "hash": 184168621941908989210848212393875143513,
  22195. "size": 10,
  22196. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22197. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22198. "target": 0,
  22199. "dataset": "other",
  22200. "idx": 386067
  22201. },
  22202. {
  22203. "func": "static int ms_transfer_data(struct rtsx_usb_ms *host, unsigned char data_dir,\n\t\tu8 tpc, u8 cfg, struct scatterlist *sg)\n{\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tint err;\n\tunsigned int length = sg->length;\n\tu16 sec_cnt = (u16)(length / 512);\n\tu8 trans_mode, dma_dir, flag;\n\tunsigned int pipe;\n\tstruct memstick_dev *card = host->msh->card;\n\n\tdev_dbg(ms_dev(host), \"%s: tpc = 0x%02x, data_dir = %s, length = %d\\n\",\n\t\t\t__func__, tpc, (data_dir == READ) ? \"READ\" : \"WRITE\",\n\t\t\tlength);\n\n\tif (data_dir == READ) {\n\t\tflag = MODE_CDIR;\n\t\tdma_dir = DMA_DIR_FROM_CARD;\n\t\tif (card->id.type != MEMSTICK_TYPE_PRO)\n\t\t\ttrans_mode = MS_TM_NORMAL_READ;\n\t\telse\n\t\t\ttrans_mode = MS_TM_AUTO_READ;\n\t\tpipe = usb_rcvbulkpipe(ucr->pusb_dev, EP_BULK_IN);\n\t} else {\n\t\tflag = MODE_CDOR;\n\t\tdma_dir = DMA_DIR_TO_CARD;\n\t\tif (card->id.type != MEMSTICK_TYPE_PRO)\n\t\t\ttrans_mode = MS_TM_NORMAL_WRITE;\n\t\telse\n\t\t\ttrans_mode = MS_TM_AUTO_WRITE;\n\t\tpipe = usb_sndbulkpipe(ucr->pusb_dev, EP_BULK_OUT);\n\t}\n\n\trtsx_usb_init_cmd(ucr);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TPC, 0xFF, tpc);\n\tif (card->id.type == MEMSTICK_TYPE_PRO) {\n\t\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_SECTOR_CNT_H,\n\t\t\t\t0xFF, (u8)(sec_cnt >> 8));\n\t\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_SECTOR_CNT_L,\n\t\t\t\t0xFF, (u8)sec_cnt);\n\t}\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC3,\n\t\t\t0xFF, (u8)(length >> 24));\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC2,\n\t\t\t0xFF, (u8)(length >> 16));\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC1,\n\t\t\t0xFF, (u8)(length >> 8));\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_TC0, 0xFF,\n\t\t\t(u8)length);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MC_DMA_CTL,\n\t\t\t0x03 | DMA_PACK_SIZE_MASK, dma_dir | DMA_EN | DMA_512);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_DATA_SOURCE,\n\t\t\t0x01, RING_BUFFER);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANSFER,\n\t\t\t0xFF, MS_TRANSFER_START | trans_mode);\n\trtsx_usb_add_cmd(ucr, CHECK_REG_CMD, MS_TRANSFER,\n\t\t\tMS_TRANSFER_END, MS_TRANSFER_END);\n\n\terr = rtsx_usb_send_cmd(ucr, flag | STAGE_MS_STATUS, 100);\n\tif (err)\n\t\treturn err;\n\n\terr = rtsx_usb_transfer_data(ucr, pipe, sg, length,\n\t\t\t1, NULL, 10000);\n\tif (err)\n\t\tgoto err_out;\n\n\terr = rtsx_usb_get_rsp(ucr, 3, 15000);\n\tif (err)\n\t\tgoto err_out;\n\n\tif (ucr->rsp_buf[0] & MS_TRANSFER_ERR ||\n\t ucr->rsp_buf[1] & (MS_CRC16_ERR | MS_RDY_TIMEOUT)) {\n\t\terr = -EIO;\n\t\tgoto err_out;\n\t}\n\treturn 0;\nerr_out:\n\tms_clear_error(host);\n\treturn err;\n}",
  22204. "project": "linux",
  22205. "hash": 230127094400080261160329003204111452297,
  22206. "size": 85,
  22207. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22208. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22209. "target": 0,
  22210. "dataset": "other",
  22211. "idx": 386055
  22212. },
  22213. {
  22214. "func": "static int ms_read_bytes(struct rtsx_usb_ms *host, u8 tpc,\n\t\tu8 cfg, u8 cnt, u8 *data, u8 *int_reg)\n{\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tint err, i;\n\tu8 *ptr;\n\n\tdev_dbg(ms_dev(host), \"%s: tpc = 0x%02x\\n\", __func__, tpc);\n\n\trtsx_usb_init_cmd(ucr);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TPC, 0xFF, tpc);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_BYTE_CNT, 0xFF, cnt);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANS_CFG, 0xFF, cfg);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_DATA_SOURCE,\n\t\t\t0x01, PINGPONG_BUFFER);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, MS_TRANSFER,\n\t\t\t0xFF, MS_TRANSFER_START | MS_TM_READ_BYTES);\n\trtsx_usb_add_cmd(ucr, CHECK_REG_CMD, MS_TRANSFER,\n\t\t\tMS_TRANSFER_END, MS_TRANSFER_END);\n\tfor (i = 0; i < cnt - 1; i++)\n\t\trtsx_usb_add_cmd(ucr, READ_REG_CMD, PPBUF_BASE2 + i, 0, 0);\n\tif (cnt % 2)\n\t\trtsx_usb_add_cmd(ucr, READ_REG_CMD, PPBUF_BASE2 + cnt, 0, 0);\n\telse\n\t\trtsx_usb_add_cmd(ucr, READ_REG_CMD,\n\t\t\t\tPPBUF_BASE2 + cnt - 1, 0, 0);\n\n\trtsx_usb_add_cmd(ucr, READ_REG_CMD, MS_TRANS_CFG, 0, 0);\n\n\terr = rtsx_usb_send_cmd(ucr, MODE_CR, 100);\n\tif (err)\n\t\treturn err;\n\n\terr = rtsx_usb_get_rsp(ucr, cnt + 2, 5000);\n\tif (err || (ucr->rsp_buf[0] & MS_TRANSFER_ERR)) {\n\t\tu8 val;\n\n\t\trtsx_usb_ep0_read_register(ucr, MS_TRANS_CFG, &val);\n\t\tdev_dbg(ms_dev(host), \"MS_TRANS_CFG: 0x%02x\\n\", val);\n\n\t\tif (int_reg && (host->ifmode != MEMSTICK_SERIAL))\n\t\t\t*int_reg = val & 0x0F;\n\n\t\tms_print_debug_regs(host);\n\n\t\tms_clear_error(host);\n\n\t\tif (!(tpc & 0x08)) {\n\t\t\tif (val & MS_CRC16_ERR)\n\t\t\t\treturn -EIO;\n\t\t} else {\n\t\t\tif (!(val & 0x80)) {\n\t\t\t\tif (val & (MS_INT_ERR | MS_INT_CMDNK))\n\t\t\t\t\treturn -EIO;\n\t\t\t}\n\t\t}\n\n\t\treturn -ETIMEDOUT;\n\t}\n\n\tptr = ucr->rsp_buf + 1;\n\tfor (i = 0; i < cnt; i++)\n\t\tdata[i] = *ptr++;\n\n\n\tif (int_reg && (host->ifmode != MEMSTICK_SERIAL))\n\t\t*int_reg = *ptr & 0x0F;\n\n\treturn 0;\n}",
  22215. "project": "linux",
  22216. "hash": 258735760856662779335532937746038298034,
  22217. "size": 72,
  22218. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22219. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22220. "target": 0,
  22221. "dataset": "other",
  22222. "idx": 386073
  22223. },
  22224. {
  22225. "func": "static void rtsx_usb_ms_handle_req(struct work_struct *work)\n{\n\tstruct rtsx_usb_ms *host = container_of(work,\n\t\t\tstruct rtsx_usb_ms, handle_req);\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tstruct memstick_host *msh = host->msh;\n\tint rc;\n\n\tif (!host->req) {\n\t\tpm_runtime_get_sync(ms_dev(host));\n\t\tdo {\n\t\t\trc = memstick_next_req(msh, &host->req);\n\t\t\tdev_dbg(ms_dev(host), \"next req %d\\n\", rc);\n\n\t\t\tif (!rc) {\n\t\t\t\tmutex_lock(&ucr->dev_mutex);\n\n\t\t\t\tif (rtsx_usb_card_exclusive_check(ucr,\n\t\t\t\t\t\t\tRTSX_USB_MS_CARD))\n\t\t\t\t\thost->req->error = -EIO;\n\t\t\t\telse\n\t\t\t\t\thost->req->error =\n\t\t\t\t\t\trtsx_usb_ms_issue_cmd(host);\n\n\t\t\t\tmutex_unlock(&ucr->dev_mutex);\n\n\t\t\t\tdev_dbg(ms_dev(host), \"req result %d\\n\",\n\t\t\t\t\t\thost->req->error);\n\t\t\t}\n\t\t} while (!rc);\n\t\tpm_runtime_put_sync(ms_dev(host));\n\t}\n\n}",
  22226. "project": "linux",
  22227. "hash": 175247277736640744572955526817545119083,
  22228. "size": 34,
  22229. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  22230. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  22231. "target": 0,
  22232. "dataset": "other",
  22233. "idx": 386066
  22234. }
  22235. ]
  22236. },
  22237. {
  22238. "call_depth": 4,
  22239. "longest_call_chain": [
  22240. "_gnutls_x509_get_time",
  22241. "_gnutls_x509_generalTime2gtime",
  22242. "time2gtime",
  22243. "mktime_utc"
  22244. ],
  22245. "group_size": 5,
  22246. "functions": [
  22247. {
  22248. "func": "static time_t mktime_utc(const struct fake_tm *tm)\n{\n\ttime_t result = 0;\n\tint i;\n\n/* We do allow some ill-formed dates, but we don't do anything special\n * with them and our callers really shouldn't pass them to us. Do\n * explicitly disallow the ones that would cause invalid array accesses\n * or other algorithm problems. \n */\n\tif (tm->tm_mon < 0 || tm->tm_mon > 11 || tm->tm_year < 1970)\n\t\treturn (time_t) - 1;\n\n/* Convert to a time_t. \n */\n\tfor (i = 1970; i < tm->tm_year; i++)\n\t\tresult += 365 + ISLEAP(i);\n\tfor (i = 0; i < tm->tm_mon; i++)\n\t\tresult += MONTHDAYS[i];\n\tif (tm->tm_mon > 1 && ISLEAP(tm->tm_year))\n\t\tresult++;\n\tresult = 24 * (result + tm->tm_mday - 1) + tm->tm_hour;\n\tresult = 60 * result + tm->tm_min;\n\tresult = 60 * result + tm->tm_sec;\n\treturn result;\n}",
  22249. "project": "gnutls",
  22250. "hash": 255583354875587551064427115420146067224,
  22251. "size": 26,
  22252. "commit_id": "272854367efc130fbd4f1a51840d80c630214e12",
  22253. "message": "Reset the output value on error in _gnutls_x509_dn_to_string()\n\nReported by Kurt Roeckx.",
  22254. "target": 0,
  22255. "dataset": "other",
  22256. "idx": 462692
  22257. },
  22258. {
  22259. "func": "static time_t utcTime2gtime(const char *ttime)\n{\n\tchar xx[3];\n\tint year;\n\n\tif (strlen(ttime) < 10) {\n\t\tgnutls_assert();\n\t\treturn (time_t) - 1;\n\t}\n\txx[2] = 0;\n/* get the year\n */\n\tmemcpy(xx, ttime, 2);\t/* year */\n\tyear = atoi(xx);\n\tttime += 2;\n\n\tif (year > 49)\n\t\tyear += 1900;\n\telse\n\t\tyear += 2000;\n\n\treturn time2gtime(ttime, year);\n}",
  22260. "project": "gnutls",
  22261. "hash": 305444558622662156229039864608137356411,
  22262. "size": 23,
  22263. "commit_id": "272854367efc130fbd4f1a51840d80c630214e12",
  22264. "message": "Reset the output value on error in _gnutls_x509_dn_to_string()\n\nReported by Kurt Roeckx.",
  22265. "target": 0,
  22266. "dataset": "other",
  22267. "idx": 462700
  22268. },
  22269. {
  22270. "func": "time_t _gnutls_x509_get_time(ASN1_TYPE c2, const char *when, int nochoice)\n{\n\tchar ttime[MAX_TIME];\n\tchar name[128];\n\ttime_t c_time = (time_t) - 1;\n\tint len, result;\n\n\tlen = sizeof(ttime) - 1;\n\tresult = asn1_read_value(c2, when, ttime, &len);\n\tif (result != ASN1_SUCCESS) {\n\t\tgnutls_assert();\n\t\treturn (time_t) (-1);\n\t}\n\n\tif (nochoice != 0) {\n\t\tc_time = _gnutls_x509_generalTime2gtime(ttime);\n\t} else {\n\t\t_gnutls_str_cpy(name, sizeof(name), when);\n\n\t\t/* choice */\n\t\tif (strcmp(ttime, \"generalTime\") == 0) {\n\t\t\t_gnutls_str_cat(name, sizeof(name),\n\t\t\t\t\t\".generalTime\");\n\t\t\tlen = sizeof(ttime) - 1;\n\t\t\tresult = asn1_read_value(c2, name, ttime, &len);\n\t\t\tif (result == ASN1_SUCCESS)\n\t\t\t\tc_time =\n\t\t\t\t _gnutls_x509_generalTime2gtime(ttime);\n\t\t} else {\t/* UTCTIME */\n\t\t\t_gnutls_str_cat(name, sizeof(name), \".utcTime\");\n\t\t\tlen = sizeof(ttime) - 1;\n\t\t\tresult = asn1_read_value(c2, name, ttime, &len);\n\t\t\tif (result == ASN1_SUCCESS)\n\t\t\t\tc_time = utcTime2gtime(ttime);\n\t\t}\n\n\t\t/* We cannot handle dates after 2031 in 32 bit machines.\n\t\t * a time_t of 64bits has to be used.\n\t\t */\n\t\tif (result != ASN1_SUCCESS) {\n\t\t\tgnutls_assert();\n\t\t\treturn (time_t) (-1);\n\t\t}\n\t}\n\n\treturn c_time;\n}",
  22271. "project": "gnutls",
  22272. "hash": 222057145187227737041406586357311452460,
  22273. "size": 47,
  22274. "commit_id": "272854367efc130fbd4f1a51840d80c630214e12",
  22275. "message": "Reset the output value on error in _gnutls_x509_dn_to_string()\n\nReported by Kurt Roeckx.",
  22276. "target": 0,
  22277. "dataset": "other",
  22278. "idx": 462694
  22279. },
  22280. {
  22281. "func": "time_t _gnutls_x509_generalTime2gtime(const char *ttime)\n{\n\tchar xx[5];\n\tint year;\n\n\tif (strlen(ttime) < 12) {\n\t\tgnutls_assert();\n\t\treturn (time_t) - 1;\n\t}\n\n\tif (strchr(ttime, 'Z') == 0) {\n\t\tgnutls_assert();\n\t\t/* sorry we don't support it yet\n\t\t */\n\t\treturn (time_t) - 1;\n\t}\n\txx[4] = 0;\n\n/* get the year\n */\n\tmemcpy(xx, ttime, 4);\t/* year */\n\tyear = atoi(xx);\n\tttime += 4;\n\n\treturn time2gtime(ttime, year);\n}",
  22282. "project": "gnutls",
  22283. "hash": 259945156522401648247067488269809219355,
  22284. "size": 26,
  22285. "commit_id": "272854367efc130fbd4f1a51840d80c630214e12",
  22286. "message": "Reset the output value on error in _gnutls_x509_dn_to_string()\n\nReported by Kurt Roeckx.",
  22287. "target": 0,
  22288. "dataset": "other",
  22289. "idx": 462711
  22290. },
  22291. {
  22292. "func": "static time_t time2gtime(const char *ttime, int year)\n{\n\tchar xx[4];\n\tstruct fake_tm etime;\n\n\tif (strlen(ttime) < 8) {\n\t\tgnutls_assert();\n\t\treturn (time_t) - 1;\n\t}\n\n\tetime.tm_year = year;\n\n\t/* In order to work with 32 bit\n\t * time_t.\n\t */\n\tif (sizeof(time_t) <= 4 && etime.tm_year >= 2038)\n\t\treturn (time_t) 2145914603;\t/* 2037-12-31 23:23:23 */\n\n\tif (etime.tm_year < 1970)\n\t\treturn (time_t) 0;\n\n\txx[2] = 0;\n\n/* get the month\n */\n\tmemcpy(xx, ttime, 2);\t/* month */\n\tetime.tm_mon = atoi(xx) - 1;\n\tttime += 2;\n\n/* get the day\n */\n\tmemcpy(xx, ttime, 2);\t/* day */\n\tetime.tm_mday = atoi(xx);\n\tttime += 2;\n\n/* get the hour\n */\n\tmemcpy(xx, ttime, 2);\t/* hour */\n\tetime.tm_hour = atoi(xx);\n\tttime += 2;\n\n/* get the minutes\n */\n\tmemcpy(xx, ttime, 2);\t/* minutes */\n\tetime.tm_min = atoi(xx);\n\tttime += 2;\n\n\tif (strlen(ttime) >= 2) {\n\t\tmemcpy(xx, ttime, 2);\n\t\tetime.tm_sec = atoi(xx);\n\t} else\n\t\tetime.tm_sec = 0;\n\n\treturn mktime_utc(&etime);\n}",
  22293. "project": "gnutls",
  22294. "hash": 193396090484000543539033958433909418524,
  22295. "size": 55,
  22296. "commit_id": "272854367efc130fbd4f1a51840d80c630214e12",
  22297. "message": "Reset the output value on error in _gnutls_x509_dn_to_string()\n\nReported by Kurt Roeckx.",
  22298. "target": 0,
  22299. "dataset": "other",
  22300. "idx": 462733
  22301. }
  22302. ]
  22303. },
  22304. {
  22305. "call_depth": 3,
  22306. "longest_call_chain": [
  22307. "borrowPinnedConnection",
  22308. "validatePinnedConnection",
  22309. "cbdataReferenceValid"
  22310. ],
  22311. "group_size": 6,
  22312. "functions": [
  22313. {
  22314. "func": "ConnStateData::unpinConnection(const bool andClose)\n{\n debugs(33, 3, HERE << pinning.serverConnection);\n\n if (pinning.peer)\n cbdataReferenceDone(pinning.peer);\n\n if (Comm::IsConnOpen(pinning.serverConnection)) {\n if (pinning.closeHandler != NULL) {\n comm_remove_close_handler(pinning.serverConnection->fd, pinning.closeHandler);\n pinning.closeHandler = NULL;\n }\n\n stopPinnedConnectionMonitoring();\n\n // close the server side socket if requested\n if (andClose)\n pinning.serverConnection->close();\n pinning.serverConnection = NULL;\n }\n\n safe_free(pinning.host);\n\n pinning.zeroReply = false;\n\n /* NOTE: pinning.pinned should be kept. This combined with fd == -1 at the end of a request indicates that the host\n * connection has gone away */\n}",
  22315. "project": "squid",
  22316. "hash": 8126723958400450209621663530532865131,
  22317. "size": 28,
  22318. "commit_id": "fd68382860633aca92065e6c343cfd1b12b126e7",
  22319. "message": "Improve Transfer-Encoding handling (#702)\n\nReject messages containing Transfer-Encoding header with coding other\nthan chunked or identity. Squid does not support other codings.\n\nFor simplicity and security sake, also reject messages where\nTransfer-Encoding contains unnecessary complex values that are\ntechnically equivalent to \"chunked\" or \"identity\" (e.g., \",,chunked\" or\n\"identity, chunked\").\n\nRFC 7230 formally deprecated and removed identity coding, but it is\nstill used by some agents.",
  22320. "target": 0,
  22321. "dataset": "other",
  22322. "idx": 402363
  22323. },
  22324. {
  22325. "func": "ConnStateData::borrowPinnedConnection(HttpRequest *request, const CachePeer *aPeer)\n{\n debugs(33, 7, pinning.serverConnection);\n if (validatePinnedConnection(request, aPeer) != NULL)\n stopPinnedConnectionMonitoring();\n\n return pinning.serverConnection; // closed if validation failed\n}",
  22326. "project": "squid",
  22327. "hash": 197943209884432641940624481743052313463,
  22328. "size": 8,
  22329. "commit_id": "fd68382860633aca92065e6c343cfd1b12b126e7",
  22330. "message": "Improve Transfer-Encoding handling (#702)\n\nReject messages containing Transfer-Encoding header with coding other\nthan chunked or identity. Squid does not support other codings.\n\nFor simplicity and security sake, also reject messages where\nTransfer-Encoding contains unnecessary complex values that are\ntechnically equivalent to \"chunked\" or \"identity\" (e.g., \",,chunked\" or\n\"identity, chunked\").\n\nRFC 7230 formally deprecated and removed identity coding, but it is\nstill used by some agents.",
  22331. "target": 0,
  22332. "dataset": "other",
  22333. "idx": 402319
  22334. },
  22335. {
  22336. "func": "ConnStateData::swanSong()\n{\n debugs(33, 2, HERE << clientConnection);\n checkLogging();\n\n flags.readMore = false;\n clientdbEstablished(clientConnection->remote, -1); /* decrement */\n pipeline.terminateAll(0);\n\n // XXX: Closing pinned conn is too harsh: The Client may want to continue!\n unpinConnection(true);\n\n Server::swanSong(); // closes the client connection\n\n#if USE_AUTH\n // NP: do this bit after closing the connections to avoid side effects from unwanted TCP RST\n setAuth(NULL, \"ConnStateData::SwanSong cleanup\");\n#endif\n\n flags.swanSang = true;\n}",
  22337. "project": "squid",
  22338. "hash": 250147708476536924722896317883820047435,
  22339. "size": 21,
  22340. "commit_id": "fd68382860633aca92065e6c343cfd1b12b126e7",
  22341. "message": "Improve Transfer-Encoding handling (#702)\n\nReject messages containing Transfer-Encoding header with coding other\nthan chunked or identity. Squid does not support other codings.\n\nFor simplicity and security sake, also reject messages where\nTransfer-Encoding contains unnecessary complex values that are\ntechnically equivalent to \"chunked\" or \"identity\" (e.g., \",,chunked\" or\n\"identity, chunked\").\n\nRFC 7230 formally deprecated and removed identity coding, but it is\nstill used by some agents.",
  22342. "target": 0,
  22343. "dataset": "other",
  22344. "idx": 402351
  22345. },
  22346. {
  22347. "func": "clientAclChecklistCreate(const acl_access * acl, ClientHttpRequest * http)\n{\n ConnStateData * conn = http->getConn();\n ACLFilledChecklist *ch = new ACLFilledChecklist(acl, http->request,\n cbdataReferenceValid(conn) && conn != NULL && conn->clientConnection != NULL ? conn->clientConnection->rfc931 : dash_str);\n ch->al = http->al;\n ch->syncAle(http->request, http->log_uri);\n /*\n * hack for ident ACL. It needs to get full addresses, and a place to store\n * the ident result on persistent connections...\n */\n /* connection oriented auth also needs these two lines for it's operation. */\n return ch;\n}",
  22348. "project": "squid",
  22349. "hash": 301345786289336883799756852985363914809,
  22350. "size": 14,
  22351. "commit_id": "fd68382860633aca92065e6c343cfd1b12b126e7",
  22352. "message": "Improve Transfer-Encoding handling (#702)\n\nReject messages containing Transfer-Encoding header with coding other\nthan chunked or identity. Squid does not support other codings.\n\nFor simplicity and security sake, also reject messages where\nTransfer-Encoding contains unnecessary complex values that are\ntechnically equivalent to \"chunked\" or \"identity\" (e.g., \",,chunked\" or\n\"identity, chunked\").\n\nRFC 7230 formally deprecated and removed identity coding, but it is\nstill used by some agents.",
  22353. "target": 0,
  22354. "dataset": "other",
  22355. "idx": 402375
  22356. },
  22357. {
  22358. "func": "ConnStateData::validatePinnedConnection(HttpRequest *request, const CachePeer *aPeer)\n{\n debugs(33, 7, HERE << pinning.serverConnection);\n\n bool valid = true;\n if (!Comm::IsConnOpen(pinning.serverConnection))\n valid = false;\n else if (pinning.auth && pinning.host && request && strcasecmp(pinning.host, request->url.host()) != 0)\n valid = false;\n else if (request && pinning.port != request->url.port())\n valid = false;\n else if (pinning.peer && !cbdataReferenceValid(pinning.peer))\n valid = false;\n else if (aPeer != pinning.peer)\n valid = false;\n\n if (!valid) {\n /* The pinning info is not safe, remove any pinning info */\n unpinConnection(true);\n }\n\n return pinning.serverConnection;\n}",
  22359. "project": "squid",
  22360. "hash": 181324117080263363221674208200496791621,
  22361. "size": 23,
  22362. "commit_id": "fd68382860633aca92065e6c343cfd1b12b126e7",
  22363. "message": "Improve Transfer-Encoding handling (#702)\n\nReject messages containing Transfer-Encoding header with coding other\nthan chunked or identity. Squid does not support other codings.\n\nFor simplicity and security sake, also reject messages where\nTransfer-Encoding contains unnecessary complex values that are\ntechnically equivalent to \"chunked\" or \"identity\" (e.g., \",,chunked\" or\n\"identity, chunked\").\n\nRFC 7230 formally deprecated and removed identity coding, but it is\nstill used by some agents.",
  22364. "target": 0,
  22365. "dataset": "other",
  22366. "idx": 402332
  22367. },
  22368. {
  22369. "func": "ConnStateData::checkLogging()\n{\n // if we are parsing request body, its request is responsible for logging\n if (bodyPipe)\n return;\n\n // a request currently using this connection is responsible for logging\n if (!pipeline.empty() && pipeline.back()->mayUseConnection())\n return;\n\n /* Either we are waiting for the very first transaction, or\n * we are done with the Nth transaction and are waiting for N+1st.\n * XXX: We assume that if anything was added to inBuf, then it could\n * only be consumed by actions already covered by the above checks.\n */\n\n // do not log connections that closed after a transaction (it is normal)\n // TODO: access_log needs ACLs to match received-no-bytes connections\n if (pipeline.nrequests && inBuf.isEmpty())\n return;\n\n /* Create a temporary ClientHttpRequest object. Its destructor will log. */\n ClientHttpRequest http(this);\n http.req_sz = inBuf.length();\n // XXX: Or we died while waiting for the pinned connection to become idle.\n http.setErrorUri(\"error:transaction-end-before-headers\");\n}",
  22370. "project": "squid",
  22371. "hash": 226736814919375169237608393216734947054,
  22372. "size": 27,
  22373. "commit_id": "fd68382860633aca92065e6c343cfd1b12b126e7",
  22374. "message": "Improve Transfer-Encoding handling (#702)\n\nReject messages containing Transfer-Encoding header with coding other\nthan chunked or identity. Squid does not support other codings.\n\nFor simplicity and security sake, also reject messages where\nTransfer-Encoding contains unnecessary complex values that are\ntechnically equivalent to \"chunked\" or \"identity\" (e.g., \",,chunked\" or\n\"identity, chunked\").\n\nRFC 7230 formally deprecated and removed identity coding, but it is\nstill used by some agents.",
  22375. "target": 0,
  22376. "dataset": "other",
  22377. "idx": 402382
  22378. }
  22379. ]
  22380. },
  22381. {
  22382. "call_depth": 3,
  22383. "longest_call_chain": [
  22384. "Register_DEPTHWISE_CONV_2D_UINT8",
  22385. "Register_DEPTHWISE_CONV_2D",
  22386. "Register_DEPTHWISE_CONVOLUTION_GENERIC_OPT"
  22387. ],
  22388. "group_size": 5,
  22389. "functions": [
  22390. {
  22391. "func": "TfLiteRegistration* Register_DEPTHWISE_CONVOLUTION_GENERIC_OPT() {\n static TfLiteRegistration r = {\n depthwise_conv::Init, depthwise_conv::Free, depthwise_conv::Prepare,\n depthwise_conv::Eval<depthwise_conv::kGenericOptimized>};\n return &r;\n}",
  22392. "project": "tensorflow",
  22393. "hash": 90381963354818109026421148639698872422,
  22394. "size": 6,
  22395. "commit_id": "e5b0eec199c2d03de54fd6a7fd9275692218e2bc",
  22396. "message": "[lite] Add validation check for dilation height/width to be positive integers.\n\nPiperOrigin-RevId: 416429178\nChange-Id: If7cdcddca54486434d9b2f06e7e2b401d7c3ee25",
  22397. "target": 0,
  22398. "dataset": "other",
  22399. "idx": 223173
  22400. },
  22401. {
  22402. "func": "TfLiteRegistration* Register_DEPTHWISE_CONVOLUTION_NEON_OPT_UINT8() {\n static TfLiteRegistration r = {\n depthwise_conv::Init, depthwise_conv::Free, depthwise_conv::Prepare,\n depthwise_conv::EvalImpl<depthwise_conv::kNeonOptimized, kTfLiteUInt8>};\n return &r;\n}",
  22403. "project": "tensorflow",
  22404. "hash": 259511075250531727873395827625969357451,
  22405. "size": 6,
  22406. "commit_id": "e5b0eec199c2d03de54fd6a7fd9275692218e2bc",
  22407. "message": "[lite] Add validation check for dilation height/width to be positive integers.\n\nPiperOrigin-RevId: 416429178\nChange-Id: If7cdcddca54486434d9b2f06e7e2b401d7c3ee25",
  22408. "target": 0,
  22409. "dataset": "other",
  22410. "idx": 223186
  22411. },
  22412. {
  22413. "func": "TfLiteRegistration* Register_DEPTHWISE_CONV_2D() {\n#ifdef USE_NEON\n return Register_DEPTHWISE_CONVOLUTION_NEON_OPT();\n#else\n return Register_DEPTHWISE_CONVOLUTION_GENERIC_OPT();\n#endif\n}",
  22414. "project": "tensorflow",
  22415. "hash": 93675220586672160062558623139332772786,
  22416. "size": 7,
  22417. "commit_id": "e5b0eec199c2d03de54fd6a7fd9275692218e2bc",
  22418. "message": "[lite] Add validation check for dilation height/width to be positive integers.\n\nPiperOrigin-RevId: 416429178\nChange-Id: If7cdcddca54486434d9b2f06e7e2b401d7c3ee25",
  22419. "target": 0,
  22420. "dataset": "other",
  22421. "idx": 223177
  22422. },
  22423. {
  22424. "func": "TfLiteRegistration* Register_DEPTHWISE_CONVOLUTION_NEON_OPT() {\n static TfLiteRegistration r = {\n depthwise_conv::Init, depthwise_conv::Free, depthwise_conv::Prepare,\n depthwise_conv::Eval<depthwise_conv::kNeonOptimized>};\n return &r;\n}",
  22425. "project": "tensorflow",
  22426. "hash": 8789946826749525151422178724820235421,
  22427. "size": 6,
  22428. "commit_id": "e5b0eec199c2d03de54fd6a7fd9275692218e2bc",
  22429. "message": "[lite] Add validation check for dilation height/width to be positive integers.\n\nPiperOrigin-RevId: 416429178\nChange-Id: If7cdcddca54486434d9b2f06e7e2b401d7c3ee25",
  22430. "target": 0,
  22431. "dataset": "other",
  22432. "idx": 223185
  22433. },
  22434. {
  22435. "func": "TfLiteRegistration* Register_DEPTHWISE_CONV_2D_UINT8() {\n#ifdef USE_NEON\n return Register_DEPTHWISE_CONVOLUTION_NEON_OPT_UINT8();\n#else\n return Register_DEPTHWISE_CONV_2D();\n#endif\n}",
  22436. "project": "tensorflow",
  22437. "hash": 241262428454337070765876511174245130660,
  22438. "size": 7,
  22439. "commit_id": "e5b0eec199c2d03de54fd6a7fd9275692218e2bc",
  22440. "message": "[lite] Add validation check for dilation height/width to be positive integers.\n\nPiperOrigin-RevId: 416429178\nChange-Id: If7cdcddca54486434d9b2f06e7e2b401d7c3ee25",
  22441. "target": 0,
  22442. "dataset": "other",
  22443. "idx": 223180
  22444. }
  22445. ]
  22446. },
  22447. {
  22448. "call_depth": 3,
  22449. "longest_call_chain": [
  22450. "git_tcp_connect",
  22451. "git_tcp_connect_sock",
  22452. "enable_keepalive"
  22453. ],
  22454. "group_size": 6,
  22455. "functions": [
  22456. {
  22457. "func": "static int git_tcp_connect_sock(char *host, int flags)\n{\n\tstruct strbuf error_message = STRBUF_INIT;\n\tint sockfd = -1;\n\tconst char *port = STR(DEFAULT_GIT_PORT);\n\tstruct addrinfo hints, *ai0, *ai;\n\tint gai;\n\tint cnt = 0;\n\n\tget_host_and_port(&host, &port);\n\tif (!*port)\n\t\tport = \"<none>\";\n\n\tmemset(&hints, 0, sizeof(hints));\n\tif (flags & CONNECT_IPV4)\n\t\thints.ai_family = AF_INET;\n\telse if (flags & CONNECT_IPV6)\n\t\thints.ai_family = AF_INET6;\n\thints.ai_socktype = SOCK_STREAM;\n\thints.ai_protocol = IPPROTO_TCP;\n\n\tif (flags & CONNECT_VERBOSE)\n\t\tfprintf(stderr, \"Looking up %s ... \", host);\n\n\tgai = getaddrinfo(host, port, &hints, &ai);\n\tif (gai)\n\t\tdie(\"Unable to look up %s (port %s) (%s)\", host, port, gai_strerror(gai));\n\n\tif (flags & CONNECT_VERBOSE)\n\t\tfprintf(stderr, \"done.\\nConnecting to %s (port %s) ... \", host, port);\n\n\tfor (ai0 = ai; ai; ai = ai->ai_next, cnt++) {\n\t\tsockfd = socket(ai->ai_family,\n\t\t\t\tai->ai_socktype, ai->ai_protocol);\n\t\tif ((sockfd < 0) ||\n\t\t (connect(sockfd, ai->ai_addr, ai->ai_addrlen) < 0)) {\n\t\t\tstrbuf_addf(&error_message, \"%s[%d: %s]: errno=%s\\n\",\n\t\t\t\t host, cnt, ai_name(ai), strerror(errno));\n\t\t\tif (0 <= sockfd)\n\t\t\t\tclose(sockfd);\n\t\t\tsockfd = -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flags & CONNECT_VERBOSE)\n\t\t\tfprintf(stderr, \"%s \", ai_name(ai));\n\t\tbreak;\n\t}\n\n\tfreeaddrinfo(ai0);\n\n\tif (sockfd < 0)\n\t\tdie(\"unable to connect to %s:\\n%s\", host, error_message.buf);\n\n\tenable_keepalive(sockfd);\n\n\tif (flags & CONNECT_VERBOSE)\n\t\tfprintf(stderr, \"done.\\n\");\n\n\tstrbuf_release(&error_message);\n\n\treturn sockfd;\n}",
  22458. "project": "git",
  22459. "hash": 75484244048397178670674431595415622496,
  22460. "size": 62,
  22461. "commit_id": "f82a97eb9197c1e3768e72648f37ce0ca3233734",
  22462. "message": "mingw: handle `subst`-ed \"DOS drives\"\n\nOver a decade ago, in 25fe217b86c (Windows: Treat Windows style path\nnames., 2008-03-05), Git was taught to handle absolute Windows paths,\ni.e. paths that start with a drive letter and a colon.\n\nUnbeknownst to us, while drive letters of physical drives are limited to\nletters of the English alphabet, there is a way to assign virtual drive\nletters to arbitrary directories, via the `subst` command, which is\n_not_ limited to English letters.\n\nIt is therefore possible to have absolute Windows paths of the form\n`1:\\what\\the\\hex.txt`. Even \"better\": pretty much arbitrary Unicode\nletters can also be used, e.g. `ä:\\tschibät.sch`.\n\nWhile it can be sensibly argued that users who set up such funny drive\nletters really seek adverse consequences, the Windows Operating System\nis known to be a platform where many users are at the mercy of\nadministrators who have their very own idea of what constitutes a\nreasonable setup.\n\nTherefore, let's just make sure that such funny paths are still\nconsidered absolute paths by Git, on Windows.\n\nIn addition to Unicode characters, pretty much any character is a valid\ndrive letter, as far as `subst` is concerned, even `:` and `\"` or even a\nspace character. While it is probably the opposite of smart to use them,\nlet's safeguard `is_dos_drive_prefix()` against all of them.\n\nNote: `[::1]:repo` is a valid URL, but not a valid path on Windows.\nAs `[` is now considered a valid drive letter, we need to be very\ncareful to avoid misinterpreting such a string as valid local path in\n`url_is_local_not_ssh()`. To do that, we use the just-introduced\nfunction `is_valid_path()` (which will label the string as invalid file\nname because of the colon characters).\n\nThis fixes CVE-2019-1351.\n\nReported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>",
  22463. "target": 0,
  22464. "dataset": "other",
  22465. "idx": 376259
  22466. },
  22467. {
  22468. "func": "static int git_tcp_connect_sock(char *host, int flags)\n{\n\tstruct strbuf error_message = STRBUF_INIT;\n\tint sockfd = -1;\n\tconst char *port = STR(DEFAULT_GIT_PORT);\n\tchar *ep;\n\tstruct hostent *he;\n\tstruct sockaddr_in sa;\n\tchar **ap;\n\tunsigned int nport;\n\tint cnt;\n\n\tget_host_and_port(&host, &port);\n\n\tif (flags & CONNECT_VERBOSE)\n\t\tfprintf(stderr, \"Looking up %s ... \", host);\n\n\the = gethostbyname(host);\n\tif (!he)\n\t\tdie(\"Unable to look up %s (%s)\", host, hstrerror(h_errno));\n\tnport = strtoul(port, &ep, 10);\n\tif ( ep == port || *ep ) {\n\t\t/* Not numeric */\n\t\tstruct servent *se = getservbyname(port,\"tcp\");\n\t\tif ( !se )\n\t\t\tdie(\"Unknown port %s\", port);\n\t\tnport = se->s_port;\n\t}\n\n\tif (flags & CONNECT_VERBOSE)\n\t\tfprintf(stderr, \"done.\\nConnecting to %s (port %s) ... \", host, port);\n\n\tfor (cnt = 0, ap = he->h_addr_list; *ap; ap++, cnt++) {\n\t\tmemset(&sa, 0, sizeof sa);\n\t\tsa.sin_family = he->h_addrtype;\n\t\tsa.sin_port = htons(nport);\n\t\tmemcpy(&sa.sin_addr, *ap, he->h_length);\n\n\t\tsockfd = socket(he->h_addrtype, SOCK_STREAM, 0);\n\t\tif ((sockfd < 0) ||\n\t\t connect(sockfd, (struct sockaddr *)&sa, sizeof sa) < 0) {\n\t\t\tstrbuf_addf(&error_message, \"%s[%d: %s]: errno=%s\\n\",\n\t\t\t\thost,\n\t\t\t\tcnt,\n\t\t\t\tinet_ntoa(*(struct in_addr *)&sa.sin_addr),\n\t\t\t\tstrerror(errno));\n\t\t\tif (0 <= sockfd)\n\t\t\t\tclose(sockfd);\n\t\t\tsockfd = -1;\n\t\t\tcontinue;\n\t\t}\n\t\tif (flags & CONNECT_VERBOSE)\n\t\t\tfprintf(stderr, \"%s \",\n\t\t\t\tinet_ntoa(*(struct in_addr *)&sa.sin_addr));\n\t\tbreak;\n\t}\n\n\tif (sockfd < 0)\n\t\tdie(\"unable to connect to %s:\\n%s\", host, error_message.buf);\n\n\tenable_keepalive(sockfd);\n\n\tif (flags & CONNECT_VERBOSE)\n\t\tfprintf(stderr, \"done.\\n\");\n\n\treturn sockfd;\n}",
  22469. "project": "git",
  22470. "hash": 282116232110985789070273945485104328668,
  22471. "size": 67,
  22472. "commit_id": "f82a97eb9197c1e3768e72648f37ce0ca3233734",
  22473. "message": "mingw: handle `subst`-ed \"DOS drives\"\n\nOver a decade ago, in 25fe217b86c (Windows: Treat Windows style path\nnames., 2008-03-05), Git was taught to handle absolute Windows paths,\ni.e. paths that start with a drive letter and a colon.\n\nUnbeknownst to us, while drive letters of physical drives are limited to\nletters of the English alphabet, there is a way to assign virtual drive\nletters to arbitrary directories, via the `subst` command, which is\n_not_ limited to English letters.\n\nIt is therefore possible to have absolute Windows paths of the form\n`1:\\what\\the\\hex.txt`. Even \"better\": pretty much arbitrary Unicode\nletters can also be used, e.g. `ä:\\tschibät.sch`.\n\nWhile it can be sensibly argued that users who set up such funny drive\nletters really seek adverse consequences, the Windows Operating System\nis known to be a platform where many users are at the mercy of\nadministrators who have their very own idea of what constitutes a\nreasonable setup.\n\nTherefore, let's just make sure that such funny paths are still\nconsidered absolute paths by Git, on Windows.\n\nIn addition to Unicode characters, pretty much any character is a valid\ndrive letter, as far as `subst` is concerned, even `:` and `\"` or even a\nspace character. While it is probably the opposite of smart to use them,\nlet's safeguard `is_dos_drive_prefix()` against all of them.\n\nNote: `[::1]:repo` is a valid URL, but not a valid path on Windows.\nAs `[` is now considered a valid drive letter, we need to be very\ncareful to avoid misinterpreting such a string as valid local path in\n`url_is_local_not_ssh()`. To do that, we use the just-introduced\nfunction `is_valid_path()` (which will label the string as invalid file\nname because of the colon characters).\n\nThis fixes CVE-2019-1351.\n\nReported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>",
  22474. "target": 0,
  22475. "dataset": "other",
  22476. "idx": 376267
  22477. },
  22478. {
  22479. "func": "static void git_tcp_connect(int fd[2], char *host, int flags)\n{\n\tint sockfd = git_tcp_connect_sock(host, flags);\n\n\tfd[0] = sockfd;\n\tfd[1] = dup(sockfd);\n}",
  22480. "project": "git",
  22481. "hash": 140963176966914680770945237058378544289,
  22482. "size": 7,
  22483. "commit_id": "f82a97eb9197c1e3768e72648f37ce0ca3233734",
  22484. "message": "mingw: handle `subst`-ed \"DOS drives\"\n\nOver a decade ago, in 25fe217b86c (Windows: Treat Windows style path\nnames., 2008-03-05), Git was taught to handle absolute Windows paths,\ni.e. paths that start with a drive letter and a colon.\n\nUnbeknownst to us, while drive letters of physical drives are limited to\nletters of the English alphabet, there is a way to assign virtual drive\nletters to arbitrary directories, via the `subst` command, which is\n_not_ limited to English letters.\n\nIt is therefore possible to have absolute Windows paths of the form\n`1:\\what\\the\\hex.txt`. Even \"better\": pretty much arbitrary Unicode\nletters can also be used, e.g. `ä:\\tschibät.sch`.\n\nWhile it can be sensibly argued that users who set up such funny drive\nletters really seek adverse consequences, the Windows Operating System\nis known to be a platform where many users are at the mercy of\nadministrators who have their very own idea of what constitutes a\nreasonable setup.\n\nTherefore, let's just make sure that such funny paths are still\nconsidered absolute paths by Git, on Windows.\n\nIn addition to Unicode characters, pretty much any character is a valid\ndrive letter, as far as `subst` is concerned, even `:` and `\"` or even a\nspace character. While it is probably the opposite of smart to use them,\nlet's safeguard `is_dos_drive_prefix()` against all of them.\n\nNote: `[::1]:repo` is a valid URL, but not a valid path on Windows.\nAs `[` is now considered a valid drive letter, we need to be very\ncareful to avoid misinterpreting such a string as valid local path in\n`url_is_local_not_ssh()`. To do that, we use the just-introduced\nfunction `is_valid_path()` (which will label the string as invalid file\nname because of the colon characters).\n\nThis fixes CVE-2019-1351.\n\nReported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>",
  22485. "target": 0,
  22486. "dataset": "other",
  22487. "idx": 376274
  22488. },
  22489. {
  22490. "func": "static void enable_keepalive(int sockfd)\n{\n\tint ka = 1;\n\n\tif (setsockopt(sockfd, SOL_SOCKET, SO_KEEPALIVE, &ka, sizeof(ka)) < 0)\n\t\tfprintf(stderr, \"unable to set SO_KEEPALIVE on socket: %s\\n\",\n\t\t\tstrerror(errno));\n}",
  22491. "project": "git",
  22492. "hash": 72578412397206043297479591802762819137,
  22493. "size": 8,
  22494. "commit_id": "f82a97eb9197c1e3768e72648f37ce0ca3233734",
  22495. "message": "mingw: handle `subst`-ed \"DOS drives\"\n\nOver a decade ago, in 25fe217b86c (Windows: Treat Windows style path\nnames., 2008-03-05), Git was taught to handle absolute Windows paths,\ni.e. paths that start with a drive letter and a colon.\n\nUnbeknownst to us, while drive letters of physical drives are limited to\nletters of the English alphabet, there is a way to assign virtual drive\nletters to arbitrary directories, via the `subst` command, which is\n_not_ limited to English letters.\n\nIt is therefore possible to have absolute Windows paths of the form\n`1:\\what\\the\\hex.txt`. Even \"better\": pretty much arbitrary Unicode\nletters can also be used, e.g. `ä:\\tschibät.sch`.\n\nWhile it can be sensibly argued that users who set up such funny drive\nletters really seek adverse consequences, the Windows Operating System\nis known to be a platform where many users are at the mercy of\nadministrators who have their very own idea of what constitutes a\nreasonable setup.\n\nTherefore, let's just make sure that such funny paths are still\nconsidered absolute paths by Git, on Windows.\n\nIn addition to Unicode characters, pretty much any character is a valid\ndrive letter, as far as `subst` is concerned, even `:` and `\"` or even a\nspace character. While it is probably the opposite of smart to use them,\nlet's safeguard `is_dos_drive_prefix()` against all of them.\n\nNote: `[::1]:repo` is a valid URL, but not a valid path on Windows.\nAs `[` is now considered a valid drive letter, we need to be very\ncareful to avoid misinterpreting such a string as valid local path in\n`url_is_local_not_ssh()`. To do that, we use the just-introduced\nfunction `is_valid_path()` (which will label the string as invalid file\nname because of the colon characters).\n\nThis fixes CVE-2019-1351.\n\nReported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>",
  22496. "target": 0,
  22497. "dataset": "other",
  22498. "idx": 376278
  22499. },
  22500. {
  22501. "func": "static struct child_process *git_proxy_connect(int fd[2], char *host)\n{\n\tconst char *port = STR(DEFAULT_GIT_PORT);\n\tstruct child_process *proxy;\n\n\tget_host_and_port(&host, &port);\n\n\tif (looks_like_command_line_option(host))\n\t\tdie(\"strange hostname '%s' blocked\", host);\n\tif (looks_like_command_line_option(port))\n\t\tdie(\"strange port '%s' blocked\", port);\n\n\tproxy = xmalloc(sizeof(*proxy));\n\tchild_process_init(proxy);\n\targv_array_push(&proxy->args, git_proxy_command);\n\targv_array_push(&proxy->args, host);\n\targv_array_push(&proxy->args, port);\n\tproxy->in = -1;\n\tproxy->out = -1;\n\tif (start_command(proxy))\n\t\tdie(\"cannot start proxy %s\", git_proxy_command);\n\tfd[0] = proxy->out; /* read from proxy stdout */\n\tfd[1] = proxy->in; /* write to proxy stdin */\n\treturn proxy;\n}",
  22502. "project": "git",
  22503. "hash": 103002577782197029879738855125256635945,
  22504. "size": 25,
  22505. "commit_id": "f82a97eb9197c1e3768e72648f37ce0ca3233734",
  22506. "message": "mingw: handle `subst`-ed \"DOS drives\"\n\nOver a decade ago, in 25fe217b86c (Windows: Treat Windows style path\nnames., 2008-03-05), Git was taught to handle absolute Windows paths,\ni.e. paths that start with a drive letter and a colon.\n\nUnbeknownst to us, while drive letters of physical drives are limited to\nletters of the English alphabet, there is a way to assign virtual drive\nletters to arbitrary directories, via the `subst` command, which is\n_not_ limited to English letters.\n\nIt is therefore possible to have absolute Windows paths of the form\n`1:\\what\\the\\hex.txt`. Even \"better\": pretty much arbitrary Unicode\nletters can also be used, e.g. `ä:\\tschibät.sch`.\n\nWhile it can be sensibly argued that users who set up such funny drive\nletters really seek adverse consequences, the Windows Operating System\nis known to be a platform where many users are at the mercy of\nadministrators who have their very own idea of what constitutes a\nreasonable setup.\n\nTherefore, let's just make sure that such funny paths are still\nconsidered absolute paths by Git, on Windows.\n\nIn addition to Unicode characters, pretty much any character is a valid\ndrive letter, as far as `subst` is concerned, even `:` and `\"` or even a\nspace character. While it is probably the opposite of smart to use them,\nlet's safeguard `is_dos_drive_prefix()` against all of them.\n\nNote: `[::1]:repo` is a valid URL, but not a valid path on Windows.\nAs `[` is now considered a valid drive letter, we need to be very\ncareful to avoid misinterpreting such a string as valid local path in\n`url_is_local_not_ssh()`. To do that, we use the just-introduced\nfunction `is_valid_path()` (which will label the string as invalid file\nname because of the colon characters).\n\nThis fixes CVE-2019-1351.\n\nReported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>",
  22507. "target": 0,
  22508. "dataset": "other",
  22509. "idx": 376248
  22510. },
  22511. {
  22512. "func": "static void get_host_and_port(char **host, const char **port)\n{\n\tchar *colon, *end;\n\tend = host_end(host, 1);\n\tcolon = strchr(end, ':');\n\tif (colon) {\n\t\tlong portnr = strtol(colon + 1, &end, 10);\n\t\tif (end != colon + 1 && *end == '\\0' && 0 <= portnr && portnr < 65536) {\n\t\t\t*colon = 0;\n\t\t\t*port = colon + 1;\n\t\t} else if (!colon[1]) {\n\t\t\t*colon = 0;\n\t\t}\n\t}\n}",
  22513. "project": "git",
  22514. "hash": 109057949494438843808210370667213198552,
  22515. "size": 15,
  22516. "commit_id": "f82a97eb9197c1e3768e72648f37ce0ca3233734",
  22517. "message": "mingw: handle `subst`-ed \"DOS drives\"\n\nOver a decade ago, in 25fe217b86c (Windows: Treat Windows style path\nnames., 2008-03-05), Git was taught to handle absolute Windows paths,\ni.e. paths that start with a drive letter and a colon.\n\nUnbeknownst to us, while drive letters of physical drives are limited to\nletters of the English alphabet, there is a way to assign virtual drive\nletters to arbitrary directories, via the `subst` command, which is\n_not_ limited to English letters.\n\nIt is therefore possible to have absolute Windows paths of the form\n`1:\\what\\the\\hex.txt`. Even \"better\": pretty much arbitrary Unicode\nletters can also be used, e.g. `ä:\\tschibät.sch`.\n\nWhile it can be sensibly argued that users who set up such funny drive\nletters really seek adverse consequences, the Windows Operating System\nis known to be a platform where many users are at the mercy of\nadministrators who have their very own idea of what constitutes a\nreasonable setup.\n\nTherefore, let's just make sure that such funny paths are still\nconsidered absolute paths by Git, on Windows.\n\nIn addition to Unicode characters, pretty much any character is a valid\ndrive letter, as far as `subst` is concerned, even `:` and `\"` or even a\nspace character. While it is probably the opposite of smart to use them,\nlet's safeguard `is_dos_drive_prefix()` against all of them.\n\nNote: `[::1]:repo` is a valid URL, but not a valid path on Windows.\nAs `[` is now considered a valid drive letter, we need to be very\ncareful to avoid misinterpreting such a string as valid local path in\n`url_is_local_not_ssh()`. To do that, we use the just-introduced\nfunction `is_valid_path()` (which will label the string as invalid file\nname because of the colon characters).\n\nThis fixes CVE-2019-1351.\n\nReported-by: Nicolas Joly <Nicolas.Joly@microsoft.com>\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>",
  22518. "target": 0,
  22519. "dataset": "other",
  22520. "idx": 376276
  22521. }
  22522. ]
  22523. },
  22524. {
  22525. "call_depth": 3,
  22526. "longest_call_chain": [
  22527. "input_add_uevent_bm_var",
  22528. "input_print_bitmap",
  22529. "input_bits_to_string"
  22530. ],
  22531. "group_size": 7,
  22532. "functions": [
  22533. {
  22534. "func": "static ssize_t input_dev_show_properties(struct device *dev,\n\t\t\t\t\t struct device_attribute *attr,\n\t\t\t\t\t char *buf)\n{\n\tstruct input_dev *input_dev = to_input_dev(dev);\n\tint len = input_print_bitmap(buf, PAGE_SIZE, input_dev->propbit,\n\t\t\t\t INPUT_PROP_MAX, true);\n\treturn min_t(int, len, PAGE_SIZE);\n}",
  22535. "project": "linux",
  22536. "hash": 73643454758577544594548642985618883815,
  22537. "size": 9,
  22538. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  22539. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  22540. "target": 0,
  22541. "dataset": "other",
  22542. "idx": 353344
  22543. },
  22544. {
  22545. "func": "static int input_bits_to_string(char *buf, int buf_size,\n\t\t\t\tunsigned long bits, bool skip_empty)\n{\n\treturn bits || !skip_empty ?\n\t\tsnprintf(buf, buf_size, \"%lx\", bits) : 0;\n}",
  22546. "project": "linux",
  22547. "hash": 200981411527474337248998264431809788484,
  22548. "size": 6,
  22549. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  22550. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  22551. "target": 0,
  22552. "dataset": "other",
  22553. "idx": 353325
  22554. },
  22555. {
  22556. "func": "static int input_bits_to_string(char *buf, int buf_size,\n\t\t\t\tunsigned long bits, bool skip_empty)\n{\n\tint len = 0;\n\n\tif (in_compat_syscall()) {\n\t\tu32 dword = bits >> 32;\n\t\tif (dword || !skip_empty)\n\t\t\tlen += snprintf(buf, buf_size, \"%x \", dword);\n\n\t\tdword = bits & 0xffffffffUL;\n\t\tif (dword || !skip_empty || len)\n\t\t\tlen += snprintf(buf + len, max(buf_size - len, 0),\n\t\t\t\t\t\"%x\", dword);\n\t} else {\n\t\tif (bits || !skip_empty)\n\t\t\tlen += snprintf(buf, buf_size, \"%lx\", bits);\n\t}\n\n\treturn len;\n}",
  22557. "project": "linux",
  22558. "hash": 68551690508502806898970228950092002401,
  22559. "size": 21,
  22560. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  22561. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  22562. "target": 0,
  22563. "dataset": "other",
  22564. "idx": 353366
  22565. },
  22566. {
  22567. "func": "static void input_seq_print_bitmap(struct seq_file *seq, const char *name,\n\t\t\t\t unsigned long *bitmap, int max)\n{\n\tint i;\n\tbool skip_empty = true;\n\tchar buf[18];\n\n\tseq_printf(seq, \"B: %s=\", name);\n\n\tfor (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {\n\t\tif (input_bits_to_string(buf, sizeof(buf),\n\t\t\t\t\t bitmap[i], skip_empty)) {\n\t\t\tskip_empty = false;\n\t\t\tseq_printf(seq, \"%s%s\", buf, i > 0 ? \" \" : \"\");\n\t\t}\n\t}\n\n\t/*\n\t * If no output was produced print a single 0.\n\t */\n\tif (skip_empty)\n\t\tseq_putc(seq, '0');\n\n\tseq_putc(seq, '\\n');\n}",
  22568. "project": "linux",
  22569. "hash": 252139204397985976048643955849396121086,
  22570. "size": 25,
  22571. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  22572. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  22573. "target": 0,
  22574. "dataset": "other",
  22575. "idx": 353330
  22576. },
  22577. {
  22578. "func": "static int input_add_uevent_bm_var(struct kobj_uevent_env *env,\n\t\t\t\t const char *name, unsigned long *bitmap, int max)\n{\n\tint len;\n\n\tif (add_uevent_var(env, \"%s\", name))\n\t\treturn -ENOMEM;\n\n\tlen = input_print_bitmap(&env->buf[env->buflen - 1],\n\t\t\t\t sizeof(env->buf) - env->buflen,\n\t\t\t\t bitmap, max, false);\n\tif (len >= (sizeof(env->buf) - env->buflen))\n\t\treturn -ENOMEM;\n\n\tenv->buflen += len;\n\treturn 0;\n}",
  22579. "project": "linux",
  22580. "hash": 215914705303760305720610312608600380589,
  22581. "size": 17,
  22582. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  22583. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  22584. "target": 0,
  22585. "dataset": "other",
  22586. "idx": 353378
  22587. },
  22588. {
  22589. "func": "static int input_devices_seq_show(struct seq_file *seq, void *v)\n{\n\tstruct input_dev *dev = container_of(v, struct input_dev, node);\n\tconst char *path = kobject_get_path(&dev->dev.kobj, GFP_KERNEL);\n\tstruct input_handle *handle;\n\n\tseq_printf(seq, \"I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\\n\",\n\t\t dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version);\n\n\tseq_printf(seq, \"N: Name=\\\"%s\\\"\\n\", dev->name ? dev->name : \"\");\n\tseq_printf(seq, \"P: Phys=%s\\n\", dev->phys ? dev->phys : \"\");\n\tseq_printf(seq, \"S: Sysfs=%s\\n\", path ? path : \"\");\n\tseq_printf(seq, \"U: Uniq=%s\\n\", dev->uniq ? dev->uniq : \"\");\n\tseq_puts(seq, \"H: Handlers=\");\n\n\tlist_for_each_entry(handle, &dev->h_list, d_node)\n\t\tseq_printf(seq, \"%s \", handle->name);\n\tseq_putc(seq, '\\n');\n\n\tinput_seq_print_bitmap(seq, \"PROP\", dev->propbit, INPUT_PROP_MAX);\n\n\tinput_seq_print_bitmap(seq, \"EV\", dev->evbit, EV_MAX);\n\tif (test_bit(EV_KEY, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"KEY\", dev->keybit, KEY_MAX);\n\tif (test_bit(EV_REL, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"REL\", dev->relbit, REL_MAX);\n\tif (test_bit(EV_ABS, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"ABS\", dev->absbit, ABS_MAX);\n\tif (test_bit(EV_MSC, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"MSC\", dev->mscbit, MSC_MAX);\n\tif (test_bit(EV_LED, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"LED\", dev->ledbit, LED_MAX);\n\tif (test_bit(EV_SND, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"SND\", dev->sndbit, SND_MAX);\n\tif (test_bit(EV_FF, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"FF\", dev->ffbit, FF_MAX);\n\tif (test_bit(EV_SW, dev->evbit))\n\t\tinput_seq_print_bitmap(seq, \"SW\", dev->swbit, SW_MAX);\n\n\tseq_putc(seq, '\\n');\n\n\tkfree(path);\n\treturn 0;\n}",
  22590. "project": "linux",
  22591. "hash": 206835860867474540625387286507968429091,
  22592. "size": 44,
  22593. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  22594. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  22595. "target": 0,
  22596. "dataset": "other",
  22597. "idx": 353331
  22598. },
  22599. {
  22600. "func": "static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap,\n\t\t\t int max, int add_cr)\n{\n\tint i;\n\tint len = 0;\n\tbool skip_empty = true;\n\n\tfor (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {\n\t\tlen += input_bits_to_string(buf + len, max(buf_size - len, 0),\n\t\t\t\t\t bitmap[i], skip_empty);\n\t\tif (len) {\n\t\t\tskip_empty = false;\n\t\t\tif (i > 0)\n\t\t\t\tlen += snprintf(buf + len, max(buf_size - len, 0), \" \");\n\t\t}\n\t}\n\n\t/*\n\t * If no output was produced print a single 0.\n\t */\n\tif (len == 0)\n\t\tlen = snprintf(buf, buf_size, \"%d\", 0);\n\n\tif (add_cr)\n\t\tlen += snprintf(buf + len, max(buf_size - len, 0), \"\\n\");\n\n\treturn len;\n}",
  22601. "project": "linux",
  22602. "hash": 135811896709280841763883857580312902338,
  22603. "size": 28,
  22604. "commit_id": "cb222aed03d798fc074be55e59d9a112338ee784",
  22605. "message": "Input: add safety guards to input_set_keycode()\n\nIf we happen to have a garbage in input device's keycode table with values\ntoo big we'll end up doing clear_bit() with offset way outside of our\nbitmaps, damaging other objects within an input device or even outside of\nit. Let's add sanity checks to the returned old keycodes.\n\nReported-by: syzbot+c769968809f9359b07aa@syzkaller.appspotmail.com\nReported-by: syzbot+76f3a30e88d256644c78@syzkaller.appspotmail.com\nLink: https://lore.kernel.org/r/20191207212757.GA245964@dtor-ws\nSigned-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>",
  22606. "target": 0,
  22607. "dataset": "other",
  22608. "idx": 353394
  22609. }
  22610. ]
  22611. },
  22612. {
  22613. "call_depth": 4,
  22614. "longest_call_chain": [
  22615. "dw_spi_transfer_one",
  22616. "poll_transfer",
  22617. "dw_writer",
  22618. "tx_max"
  22619. ],
  22620. "group_size": 9,
  22621. "functions": [
  22622. {
  22623. "func": "static inline u32 rx_max(struct dw_spi *dws)\n{\n\tu32 rx_left = (dws->rx_end - dws->rx) / dws->n_bytes;\n\n\treturn min_t(u32, rx_left, dw_readl(dws, DW_SPI_RXFLR));\n}",
  22624. "project": "linux",
  22625. "hash": 28861315435500243985574094629287346337,
  22626. "size": 6,
  22627. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22628. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22629. "target": 0,
  22630. "dataset": "other",
  22631. "idx": 462460
  22632. },
  22633. {
  22634. "func": "static inline u32 tx_max(struct dw_spi *dws)\n{\n\tu32 tx_left, tx_room, rxtx_gap;\n\n\ttx_left = (dws->tx_end - dws->tx) / dws->n_bytes;\n\ttx_room = dws->fifo_len - dw_readl(dws, DW_SPI_TXFLR);\n\n\t/*\n\t * Another concern is about the tx/rx mismatch, we\n\t * though to use (dws->fifo_len - rxflr - txflr) as\n\t * one maximum value for tx, but it doesn't cover the\n\t * data which is out of tx/rx fifo and inside the\n\t * shift registers. So a control from sw point of\n\t * view is taken.\n\t */\n\trxtx_gap = ((dws->rx_end - dws->rx) - (dws->tx_end - dws->tx))\n\t\t\t/ dws->n_bytes;\n\n\treturn min3(tx_left, tx_room, (u32) (dws->fifo_len - rxtx_gap));\n}",
  22635. "project": "linux",
  22636. "hash": 213183701304300001146036022339693894975,
  22637. "size": 20,
  22638. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22639. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22640. "target": 0,
  22641. "dataset": "other",
  22642. "idx": 462444
  22643. },
  22644. {
  22645. "func": "static void dw_reader(struct dw_spi *dws)\n{\n\tu32 max;\n\tu16 rxw;\n\n\tspin_lock(&dws->buf_lock);\n\tmax = rx_max(dws);\n\twhile (max--) {\n\t\trxw = dw_read_io_reg(dws, DW_SPI_DR);\n\t\t/* Care rx only if the transfer's original \"rx\" is not null */\n\t\tif (dws->rx_end - dws->len) {\n\t\t\tif (dws->n_bytes == 1)\n\t\t\t\t*(u8 *)(dws->rx) = rxw;\n\t\t\telse\n\t\t\t\t*(u16 *)(dws->rx) = rxw;\n\t\t}\n\t\tdws->rx += dws->n_bytes;\n\t}\n\tspin_unlock(&dws->buf_lock);\n}",
  22646. "project": "linux",
  22647. "hash": 43175951923458851445352561349773373287,
  22648. "size": 20,
  22649. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22650. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22651. "target": 0,
  22652. "dataset": "other",
  22653. "idx": 462449
  22654. },
  22655. {
  22656. "func": "static irqreturn_t interrupt_transfer(struct dw_spi *dws)\n{\n\tu16 irq_status = dw_readl(dws, DW_SPI_ISR);\n\n\t/* Error handling */\n\tif (irq_status & (SPI_INT_TXOI | SPI_INT_RXOI | SPI_INT_RXUI)) {\n\t\tdw_readl(dws, DW_SPI_ICR);\n\t\tint_error_stop(dws, \"interrupt_transfer: fifo overrun/underrun\");\n\t\treturn IRQ_HANDLED;\n\t}\n\n\tdw_reader(dws);\n\tif (dws->rx_end == dws->rx) {\n\t\tspi_mask_intr(dws, SPI_INT_TXEI);\n\t\tspi_finalize_current_transfer(dws->master);\n\t\treturn IRQ_HANDLED;\n\t}\n\tif (irq_status & SPI_INT_TXEI) {\n\t\tspi_mask_intr(dws, SPI_INT_TXEI);\n\t\tdw_writer(dws);\n\t\t/* Enable TX irq always, it will be disabled when RX finished */\n\t\tspi_umask_intr(dws, SPI_INT_TXEI);\n\t}\n\n\treturn IRQ_HANDLED;\n}",
  22657. "project": "linux",
  22658. "hash": 329394486355196072499215754377682953976,
  22659. "size": 26,
  22660. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22661. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22662. "target": 0,
  22663. "dataset": "other",
  22664. "idx": 462455
  22665. },
  22666. {
  22667. "func": "static void int_error_stop(struct dw_spi *dws, const char *msg)\n{\n\tspi_reset_chip(dws);\n\n\tdev_err(&dws->master->dev, \"%s\\n\", msg);\n\tdws->master->cur_msg->status = -EIO;\n\tspi_finalize_current_transfer(dws->master);\n}",
  22668. "project": "linux",
  22669. "hash": 51366913899485688758339908551603046061,
  22670. "size": 8,
  22671. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22672. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22673. "target": 0,
  22674. "dataset": "other",
  22675. "idx": 462445
  22676. },
  22677. {
  22678. "func": "static int poll_transfer(struct dw_spi *dws)\n{\n\tdo {\n\t\tdw_writer(dws);\n\t\tdw_reader(dws);\n\t\tcpu_relax();\n\t} while (dws->rx_end > dws->rx);\n\n\treturn 0;\n}",
  22679. "project": "linux",
  22680. "hash": 223794499753899155092530499212227087021,
  22681. "size": 10,
  22682. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22683. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22684. "target": 0,
  22685. "dataset": "other",
  22686. "idx": 462447
  22687. },
  22688. {
  22689. "func": "static void dw_writer(struct dw_spi *dws)\n{\n\tu32 max;\n\tu16 txw = 0;\n\n\tspin_lock(&dws->buf_lock);\n\tmax = tx_max(dws);\n\twhile (max--) {\n\t\t/* Set the tx word if the transfer's original \"tx\" is not null */\n\t\tif (dws->tx_end - dws->len) {\n\t\t\tif (dws->n_bytes == 1)\n\t\t\t\ttxw = *(u8 *)(dws->tx);\n\t\t\telse\n\t\t\t\ttxw = *(u16 *)(dws->tx);\n\t\t}\n\t\tdw_write_io_reg(dws, DW_SPI_DR, txw);\n\t\tdws->tx += dws->n_bytes;\n\t}\n\tspin_unlock(&dws->buf_lock);\n}",
  22690. "project": "linux",
  22691. "hash": 175439461371127859720464846166133329580,
  22692. "size": 20,
  22693. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22694. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22695. "target": 0,
  22696. "dataset": "other",
  22697. "idx": 462463
  22698. },
  22699. {
  22700. "func": "static int dw_spi_transfer_one(struct spi_controller *master,\n\t\tstruct spi_device *spi, struct spi_transfer *transfer)\n{\n\tstruct dw_spi *dws = spi_controller_get_devdata(master);\n\tstruct chip_data *chip = spi_get_ctldata(spi);\n\tu8 imask = 0;\n\tu16 txlevel = 0;\n\tu32 cr0;\n\tint ret;\n\n\tdws->dma_mapped = 0;\n\n\tdws->tx = (void *)transfer->tx_buf;\n\tdws->tx_end = dws->tx + transfer->len;\n\tdws->rx = transfer->rx_buf;\n\tdws->rx_end = dws->rx + transfer->len;\n\tdws->len = transfer->len;\n\n\tspi_enable_chip(dws, 0);\n\n\t/* Handle per transfer options for bpw and speed */\n\tif (transfer->speed_hz != dws->current_freq) {\n\t\tif (transfer->speed_hz != chip->speed_hz) {\n\t\t\t/* clk_div doesn't support odd number */\n\t\t\tchip->clk_div = (DIV_ROUND_UP(dws->max_freq, transfer->speed_hz) + 1) & 0xfffe;\n\t\t\tchip->speed_hz = transfer->speed_hz;\n\t\t}\n\t\tdws->current_freq = transfer->speed_hz;\n\t\tspi_set_clk(dws, chip->clk_div);\n\t}\n\n\tdws->n_bytes = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE);\n\tdws->dma_width = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE);\n\n\t/* Default SPI mode is SCPOL = 0, SCPH = 0 */\n\tcr0 = (transfer->bits_per_word - 1)\n\t\t| (chip->type << SPI_FRF_OFFSET)\n\t\t| ((((spi->mode & SPI_CPOL) ? 1 : 0) << SPI_SCOL_OFFSET) |\n\t\t\t(((spi->mode & SPI_CPHA) ? 1 : 0) << SPI_SCPH_OFFSET))\n\t\t| (chip->tmode << SPI_TMOD_OFFSET);\n\n\t/*\n\t * Adjust transfer mode if necessary. Requires platform dependent\n\t * chipselect mechanism.\n\t */\n\tif (chip->cs_control) {\n\t\tif (dws->rx && dws->tx)\n\t\t\tchip->tmode = SPI_TMOD_TR;\n\t\telse if (dws->rx)\n\t\t\tchip->tmode = SPI_TMOD_RO;\n\t\telse\n\t\t\tchip->tmode = SPI_TMOD_TO;\n\n\t\tcr0 &= ~SPI_TMOD_MASK;\n\t\tcr0 |= (chip->tmode << SPI_TMOD_OFFSET);\n\t}\n\n\tdw_writel(dws, DW_SPI_CTRL0, cr0);\n\n\t/* Check if current transfer is a DMA transaction */\n\tif (master->can_dma && master->can_dma(master, spi, transfer))\n\t\tdws->dma_mapped = master->cur_msg_mapped;\n\n\t/* For poll mode just disable all interrupts */\n\tspi_mask_intr(dws, 0xff);\n\n\t/*\n\t * Interrupt mode\n\t * we only need set the TXEI IRQ, as TX/RX always happen syncronizely\n\t */\n\tif (dws->dma_mapped) {\n\t\tret = dws->dma_ops->dma_setup(dws, transfer);\n\t\tif (ret < 0) {\n\t\t\tspi_enable_chip(dws, 1);\n\t\t\treturn ret;\n\t\t}\n\t} else if (!chip->poll_mode) {\n\t\ttxlevel = min_t(u16, dws->fifo_len / 2, dws->len / dws->n_bytes);\n\t\tdw_writel(dws, DW_SPI_TXFLTR, txlevel);\n\n\t\t/* Set the interrupt mask */\n\t\timask |= SPI_INT_TXEI | SPI_INT_TXOI |\n\t\t\t SPI_INT_RXUI | SPI_INT_RXOI;\n\t\tspi_umask_intr(dws, imask);\n\n\t\tdws->transfer_handler = interrupt_transfer;\n\t}\n\n\tspi_enable_chip(dws, 1);\n\n\tif (dws->dma_mapped) {\n\t\tret = dws->dma_ops->dma_transfer(dws, transfer);\n\t\tif (ret < 0)\n\t\t\treturn ret;\n\t}\n\n\tif (chip->poll_mode)\n\t\treturn poll_transfer(dws);\n\n\treturn 1;\n}",
  22701. "project": "linux",
  22702. "hash": 191752239953234250352277066792734233491,
  22703. "size": 101,
  22704. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22705. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22706. "target": 1,
  22707. "dataset": "other",
  22708. "idx": 212837
  22709. },
  22710. {
  22711. "func": "static int dw_spi_transfer_one(struct spi_controller *master,\n\t\tstruct spi_device *spi, struct spi_transfer *transfer)\n{\n\tstruct dw_spi *dws = spi_controller_get_devdata(master);\n\tstruct chip_data *chip = spi_get_ctldata(spi);\n\tunsigned long flags;\n\tu8 imask = 0;\n\tu16 txlevel = 0;\n\tu32 cr0;\n\tint ret;\n\n\tdws->dma_mapped = 0;\n\tspin_lock_irqsave(&dws->buf_lock, flags);\n\tdws->tx = (void *)transfer->tx_buf;\n\tdws->tx_end = dws->tx + transfer->len;\n\tdws->rx = transfer->rx_buf;\n\tdws->rx_end = dws->rx + transfer->len;\n\tdws->len = transfer->len;\n\tspin_unlock_irqrestore(&dws->buf_lock, flags);\n\n\tspi_enable_chip(dws, 0);\n\n\t/* Handle per transfer options for bpw and speed */\n\tif (transfer->speed_hz != dws->current_freq) {\n\t\tif (transfer->speed_hz != chip->speed_hz) {\n\t\t\t/* clk_div doesn't support odd number */\n\t\t\tchip->clk_div = (DIV_ROUND_UP(dws->max_freq, transfer->speed_hz) + 1) & 0xfffe;\n\t\t\tchip->speed_hz = transfer->speed_hz;\n\t\t}\n\t\tdws->current_freq = transfer->speed_hz;\n\t\tspi_set_clk(dws, chip->clk_div);\n\t}\n\n\tdws->n_bytes = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE);\n\tdws->dma_width = DIV_ROUND_UP(transfer->bits_per_word, BITS_PER_BYTE);\n\n\t/* Default SPI mode is SCPOL = 0, SCPH = 0 */\n\tcr0 = (transfer->bits_per_word - 1)\n\t\t| (chip->type << SPI_FRF_OFFSET)\n\t\t| ((((spi->mode & SPI_CPOL) ? 1 : 0) << SPI_SCOL_OFFSET) |\n\t\t\t(((spi->mode & SPI_CPHA) ? 1 : 0) << SPI_SCPH_OFFSET))\n\t\t| (chip->tmode << SPI_TMOD_OFFSET);\n\n\t/*\n\t * Adjust transfer mode if necessary. Requires platform dependent\n\t * chipselect mechanism.\n\t */\n\tif (chip->cs_control) {\n\t\tif (dws->rx && dws->tx)\n\t\t\tchip->tmode = SPI_TMOD_TR;\n\t\telse if (dws->rx)\n\t\t\tchip->tmode = SPI_TMOD_RO;\n\t\telse\n\t\t\tchip->tmode = SPI_TMOD_TO;\n\n\t\tcr0 &= ~SPI_TMOD_MASK;\n\t\tcr0 |= (chip->tmode << SPI_TMOD_OFFSET);\n\t}\n\n\tdw_writel(dws, DW_SPI_CTRL0, cr0);\n\n\t/* Check if current transfer is a DMA transaction */\n\tif (master->can_dma && master->can_dma(master, spi, transfer))\n\t\tdws->dma_mapped = master->cur_msg_mapped;\n\n\t/* For poll mode just disable all interrupts */\n\tspi_mask_intr(dws, 0xff);\n\n\t/*\n\t * Interrupt mode\n\t * we only need set the TXEI IRQ, as TX/RX always happen syncronizely\n\t */\n\tif (dws->dma_mapped) {\n\t\tret = dws->dma_ops->dma_setup(dws, transfer);\n\t\tif (ret < 0) {\n\t\t\tspi_enable_chip(dws, 1);\n\t\t\treturn ret;\n\t\t}\n\t} else if (!chip->poll_mode) {\n\t\ttxlevel = min_t(u16, dws->fifo_len / 2, dws->len / dws->n_bytes);\n\t\tdw_writel(dws, DW_SPI_TXFLTR, txlevel);\n\n\t\t/* Set the interrupt mask */\n\t\timask |= SPI_INT_TXEI | SPI_INT_TXOI |\n\t\t\t SPI_INT_RXUI | SPI_INT_RXOI;\n\t\tspi_umask_intr(dws, imask);\n\n\t\tdws->transfer_handler = interrupt_transfer;\n\t}\n\n\tspi_enable_chip(dws, 1);\n\n\tif (dws->dma_mapped) {\n\t\tret = dws->dma_ops->dma_transfer(dws, transfer);\n\t\tif (ret < 0)\n\t\t\treturn ret;\n\t}\n\n\tif (chip->poll_mode)\n\t\treturn poll_transfer(dws);\n\n\treturn 1;\n}",
  22712. "project": "linux",
  22713. "hash": 323360310926930360690361021045187060996,
  22714. "size": 103,
  22715. "commit_id": "19b61392c5a852b4e8a0bf35aecb969983c5932d",
  22716. "message": "spi: spi-dw: Add lock protect dw_spi rx/tx to prevent concurrent calls\n\ndw_spi_irq() and dw_spi_transfer_one concurrent calls.\n\nI find a panic in dw_writer(): txw = *(u8 *)(dws->tx), when dw->tx==null,\ndw->len==4, and dw->tx_end==1.\n\nWhen tpm driver's message overtime dw_spi_irq() and dw_spi_transfer_one\nmay concurrent visit dw_spi, so I think dw_spi structure lack of protection.\n\nOtherwise dw_spi_transfer_one set dw rx/tx buffer and then open irq,\nstore dw rx/tx instructions and other cores handle irq load dw rx/tx\ninstructions may out of order.\n\n\t[ 1025.321302] Call trace:\n\t...\n\t[ 1025.321319] __crash_kexec+0x98/0x148\n\t[ 1025.321323] panic+0x17c/0x314\n\t[ 1025.321329] die+0x29c/0x2e8\n\t[ 1025.321334] die_kernel_fault+0x68/0x78\n\t[ 1025.321337] __do_kernel_fault+0x90/0xb0\n\t[ 1025.321346] do_page_fault+0x88/0x500\n\t[ 1025.321347] do_translation_fault+0xa8/0xb8\n\t[ 1025.321349] do_mem_abort+0x68/0x118\n\t[ 1025.321351] el1_da+0x20/0x8c\n\t[ 1025.321362] dw_writer+0xc8/0xd0\n\t[ 1025.321364] interrupt_transfer+0x60/0x110\n\t[ 1025.321365] dw_spi_irq+0x48/0x70\n\t...\n\nSigned-off-by: wuxu.wu <wuxu.wu@huawei.com>\nLink: https://lore.kernel.org/r/1577849981-31489-1-git-send-email-wuxu.wu@huawei.com\nSigned-off-by: Mark Brown <broonie@kernel.org>",
  22717. "target": 0,
  22718. "dataset": "other",
  22719. "idx": 462461
  22720. }
  22721. ]
  22722. },
  22723. {
  22724. "call_depth": 3,
  22725. "longest_call_chain": [
  22726. "nhmldump_process",
  22727. "nhmldump_send_frame",
  22728. "nhmldump_pck_property"
  22729. ],
  22730. "group_size": 7,
  22731. "functions": [
  22732. {
  22733. "func": "static void nhmldump_send_header(GF_NHMLDumpCtx *ctx)\n{\n\tGF_FilterPacket *dst_pck;\n\tchar nhml[1024];\n\tu32 size;\n\tu8 *output;\n\tconst GF_PropertyValue *p;\n\n\tctx->szRootName = \"NHNTStream\";\n\tif (ctx->dims) {\n\t\tctx->szRootName = \"DIMSStream\";\n\t}\n\n\tif (!ctx->filep) {\n\t\tsprintf(nhml, \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" ?>\\n\");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\n\t/*write header*/\n\tsprintf(nhml, \"<%s version=\\\"1.0\\\" \", ctx->szRootName);\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\n\tNHML_PRINT_UINT(GF_PROP_PID_ID, NULL, \"trackID\")\n\tNHML_PRINT_UINT(GF_PROP_PID_TIMESCALE, NULL, \"timeScale\")\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_IN_IOD);\n\tif (p && p->value.boolean) {\n\t\tsprintf(nhml, \"inRootOD=\\\"yes\\\" \");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\n\tif (ctx->oti && (ctx->oti<GF_CODECID_LAST_MPEG4_MAPPING)) {\n\t\tsprintf(nhml, \"streamType=\\\"%d\\\" objectTypeIndication=\\\"%d\\\" \", ctx->streamtype, ctx->oti);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32)strlen(nhml));\n\t} else {\n\t\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_SUBTYPE);\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"%s=\\\"%s\\\" \", \"mediaType\", gf_4cc_to_str(p->value.uint));\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\t\tNHML_PRINT_4CC(GF_PROP_PID_ISOM_SUBTYPE, \"mediaSubType\", \"mediaSubType\")\n\t\t} else {\n\t\t\tNHML_PRINT_4CC(GF_PROP_PID_CODECID, NULL, \"codecID\")\n\t\t}\n\t}\n\n\tif (ctx->w && ctx->h) {\n\t\t//compatibility with old arch, we might want to remove this\n\t\tswitch (ctx->streamtype) {\n\t\tcase GF_STREAM_VISUAL:\n\t\tcase GF_STREAM_SCENE:\n\t\t\tsprintf(nhml, \"width=\\\"%d\\\" height=\\\"%d\\\" \", ctx->w, ctx->h);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (ctx->sr && ctx->chan) {\n\t\tsprintf(nhml, \"sampleRate=\\\"%d\\\" numChannels=\\\"%d\\\" \", ctx->sr, ctx->chan);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tsprintf(nhml, \"sampleRate=\\\"%d\\\" numChannels=\\\"%d\\\" \", ctx->sr, ctx->chan);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_AUDIO_FORMAT);\n\t\tsprintf(nhml, \"bitsPerSample=\\\"%d\\\" \", gf_audio_fmt_bit_depth(p->value.uint));\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\n\tNHML_PRINT_4CC(0, \"codec_vendor\", \"codecVendor\")\n\tNHML_PRINT_UINT(0, \"codec_version\", \"codecVersion\")\n\tNHML_PRINT_UINT(0, \"codec_revision\", \"codecRevision\")\n\tNHML_PRINT_STRING(0, \"compressor_name\", \"compressorName\")\n\tNHML_PRINT_UINT(0, \"temporal_quality\", \"temporalQuality\")\n\tNHML_PRINT_UINT(0, \"spatial_quality\", \"spatialQuality\")\n\tNHML_PRINT_UINT(0, \"hres\", \"horizontalResolution\")\n\tNHML_PRINT_UINT(0, \"vres\", \"verticalResolution\")\n\tNHML_PRINT_UINT(GF_PROP_PID_BIT_DEPTH_Y, NULL, \"bitDepth\")\n\n\tNHML_PRINT_STRING(0, \"meta:xmlns\", \"xml_namespace\")\n\tNHML_PRINT_STRING(0, \"meta:schemaloc\", \"xml_schema_location\")\n\tNHML_PRINT_STRING(0, \"meta:mime\", \"mime_type\")\n\n\tNHML_PRINT_STRING(0, \"meta:config\", \"config\")\n\tNHML_PRINT_STRING(0, \"meta:aux_mimes\", \"aux_mime_type\")\n\n\tif (ctx->codecid == GF_CODECID_DIMS) {\n\t\tif (gf_filter_pid_get_property_str(ctx->ipid, \"meta:xmlns\")==NULL) {\n\t\t\tsprintf(nhml, \"xmlns=\\\"http://www.3gpp.org/richmedia\\\" \");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\n\t\tNHML_PRINT_UINT(0, \"dims:profile\", \"profile\")\n\t\tNHML_PRINT_UINT(0, \"dims:level\", \"level\")\n\t\tNHML_PRINT_UINT(0, \"dims:pathComponents\", \"pathComponents\")\n\n\t\tp = gf_filter_pid_get_property_str(ctx->ipid, \"dims:fullRequestHost\");\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"useFullRequestHost=\\\"%s\\\" \", p->value.boolean ? \"yes\" : \"no\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tp = gf_filter_pid_get_property_str(ctx->ipid, \"dims:streamType\");\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"stream_type=\\\"%s\\\" \", p->value.boolean ? \"primary\" : \"secondary\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tp = gf_filter_pid_get_property_str(ctx->ipid, \"dims:redundant\");\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"contains_redundant=\\\"%s\\\" \", (p->value.uint==1) ? \"main\" : ((p->value.uint==1) ? \"redundant\" : \"main+redundant\") );\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tNHML_PRINT_UINT(0, \"dims:scriptTypes\", \"scriptTypes\")\n\t}\n\n\t//send DCD\n\tif (ctx->opid_info) {\n\t\tsprintf(nhml, \"specificInfoFile=\\\"%s\\\" \", gf_file_basename(ctx->info_file) );\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\tdst_pck = gf_filter_pck_new_shared(ctx->opid_info, ctx->dcfg, ctx->dcfg_size, NULL);\n\t\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_TRUE);\n\t\tgf_filter_pck_set_readonly(dst_pck);\n\t\tgf_filter_pck_send(dst_pck);\n\t}\n\n\tNHML_PRINT_STRING(0, \"meta:encoding\", \"encoding\")\n\tNHML_PRINT_STRING(0, \"meta:contentEncoding\", \"content_encoding\")\n\tctx->uncompress = GF_FALSE;\n\tif (p) {\n\t\tif (!strcmp(p->value.string, \"deflate\")) ctx->uncompress = GF_TRUE;\n\t\telse {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, (\"[NHMLMx] content_encoding %s not supported\\n\", p->value.string ));\n\t\t}\n\t}\n\n\tif (ctx->opid_mdia) {\n\t\tsprintf(nhml, \"baseMediaFile=\\\"%s\\\" \", gf_file_basename(ctx->media_file) );\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\tsprintf(nhml, \">\\n\");\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\tgf_bs_get_content_no_truncate(ctx->bs_w, &ctx->nhml_buffer, &size, &ctx->nhml_buffer_size);\n\n\tif (ctx->filep) {\n\t\tgf_fwrite(ctx->nhml_buffer, size, ctx->filep);\n\t\treturn;\n\t}\n\n\tdst_pck = gf_filter_pck_new_alloc(ctx->opid_nhml, size, &output);\n\tmemcpy(output, ctx->nhml_buffer, size);\n\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_FALSE);\n\tgf_filter_pck_send(dst_pck);\n}",
  22734. "project": "gpac",
  22735. "hash": 171851966591827362626279278095562125748,
  22736. "size": 154,
  22737. "commit_id": "9eeac00b38348c664dfeae2525bba0cf1bc32349",
  22738. "message": "fixed #1565",
  22739. "target": 1,
  22740. "dataset": "other",
  22741. "idx": 196766
  22742. },
  22743. {
  22744. "func": "static void nhmldump_send_header(GF_NHMLDumpCtx *ctx)\n{\n\tGF_FilterPacket *dst_pck;\n\tchar nhml[1024];\n\tu32 size;\n\tu8 *output;\n\tconst GF_PropertyValue *p;\n\n\tctx->szRootName = \"NHNTStream\";\n\tif (ctx->dims) {\n\t\tctx->szRootName = \"DIMSStream\";\n\t}\n\n\tif (!ctx->filep) {\n\t\tsprintf(nhml, \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" ?>\\n\");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\n\t/*write header*/\n\tsprintf(nhml, \"<%s version=\\\"1.0\\\" \", ctx->szRootName);\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\n\tNHML_PRINT_UINT(GF_PROP_PID_ID, NULL, \"trackID\")\n\tNHML_PRINT_UINT(GF_PROP_PID_TIMESCALE, NULL, \"timeScale\")\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_IN_IOD);\n\tif (p && p->value.boolean) {\n\t\tsprintf(nhml, \"inRootOD=\\\"yes\\\" \");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\n\tif (ctx->oti && (ctx->oti<GF_CODECID_LAST_MPEG4_MAPPING)) {\n\t\tsprintf(nhml, \"streamType=\\\"%d\\\" objectTypeIndication=\\\"%d\\\" \", ctx->streamtype, ctx->oti);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32)strlen(nhml));\n\t} else {\n\t\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_SUBTYPE);\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"%s=\\\"%s\\\" \", \"mediaType\", gf_4cc_to_str(p->value.uint));\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\t\tNHML_PRINT_4CC(GF_PROP_PID_ISOM_SUBTYPE, \"mediaSubType\", \"mediaSubType\")\n\t\t} else {\n\t\t\tNHML_PRINT_4CC(GF_PROP_PID_CODECID, NULL, \"codecID\")\n\t\t}\n\t}\n\n\tif (ctx->w && ctx->h) {\n\t\t//compatibility with old arch, we might want to remove this\n\t\tswitch (ctx->streamtype) {\n\t\tcase GF_STREAM_VISUAL:\n\t\tcase GF_STREAM_SCENE:\n\t\t\tsprintf(nhml, \"width=\\\"%d\\\" height=\\\"%d\\\" \", ctx->w, ctx->h);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tbreak;\n\t\t}\n\t}\n\telse if (ctx->sr && ctx->chan) {\n\t\tsprintf(nhml, \"sampleRate=\\\"%d\\\" numChannels=\\\"%d\\\" \", ctx->sr, ctx->chan);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tsprintf(nhml, \"sampleRate=\\\"%d\\\" numChannels=\\\"%d\\\" \", ctx->sr, ctx->chan);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_AUDIO_FORMAT);\n\t\tif (p)\n\t\t\tsprintf(nhml, \"bitsPerSample=\\\"%d\\\" \", gf_audio_fmt_bit_depth(p->value.uint));\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\n\tNHML_PRINT_4CC(0, \"codec_vendor\", \"codecVendor\")\n\tNHML_PRINT_UINT(0, \"codec_version\", \"codecVersion\")\n\tNHML_PRINT_UINT(0, \"codec_revision\", \"codecRevision\")\n\tNHML_PRINT_STRING(0, \"compressor_name\", \"compressorName\")\n\tNHML_PRINT_UINT(0, \"temporal_quality\", \"temporalQuality\")\n\tNHML_PRINT_UINT(0, \"spatial_quality\", \"spatialQuality\")\n\tNHML_PRINT_UINT(0, \"hres\", \"horizontalResolution\")\n\tNHML_PRINT_UINT(0, \"vres\", \"verticalResolution\")\n\tNHML_PRINT_UINT(GF_PROP_PID_BIT_DEPTH_Y, NULL, \"bitDepth\")\n\n\tNHML_PRINT_STRING(0, \"meta:xmlns\", \"xml_namespace\")\n\tNHML_PRINT_STRING(0, \"meta:schemaloc\", \"xml_schema_location\")\n\tNHML_PRINT_STRING(0, \"meta:mime\", \"mime_type\")\n\n\tNHML_PRINT_STRING(0, \"meta:config\", \"config\")\n\tNHML_PRINT_STRING(0, \"meta:aux_mimes\", \"aux_mime_type\")\n\n\tif (ctx->codecid == GF_CODECID_DIMS) {\n\t\tif (gf_filter_pid_get_property_str(ctx->ipid, \"meta:xmlns\")==NULL) {\n\t\t\tsprintf(nhml, \"xmlns=\\\"http://www.3gpp.org/richmedia\\\" \");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\n\t\tNHML_PRINT_UINT(0, \"dims:profile\", \"profile\")\n\t\tNHML_PRINT_UINT(0, \"dims:level\", \"level\")\n\t\tNHML_PRINT_UINT(0, \"dims:pathComponents\", \"pathComponents\")\n\n\t\tp = gf_filter_pid_get_property_str(ctx->ipid, \"dims:fullRequestHost\");\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"useFullRequestHost=\\\"%s\\\" \", p->value.boolean ? \"yes\" : \"no\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tp = gf_filter_pid_get_property_str(ctx->ipid, \"dims:streamType\");\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"stream_type=\\\"%s\\\" \", p->value.boolean ? \"primary\" : \"secondary\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tp = gf_filter_pid_get_property_str(ctx->ipid, \"dims:redundant\");\n\t\tif (p) {\n\t\t\tsprintf(nhml, \"contains_redundant=\\\"%s\\\" \", (p->value.uint==1) ? \"main\" : ((p->value.uint==1) ? \"redundant\" : \"main+redundant\") );\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tNHML_PRINT_UINT(0, \"dims:scriptTypes\", \"scriptTypes\")\n\t}\n\n\t//send DCD\n\tif (ctx->opid_info) {\n\t\tsprintf(nhml, \"specificInfoFile=\\\"%s\\\" \", gf_file_basename(ctx->info_file) );\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\tdst_pck = gf_filter_pck_new_shared(ctx->opid_info, ctx->dcfg, ctx->dcfg_size, NULL);\n\t\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_TRUE);\n\t\tgf_filter_pck_set_readonly(dst_pck);\n\t\tgf_filter_pck_send(dst_pck);\n\t}\n\n\tNHML_PRINT_STRING(0, \"meta:encoding\", \"encoding\")\n\tNHML_PRINT_STRING(0, \"meta:contentEncoding\", \"content_encoding\")\n\tctx->uncompress = GF_FALSE;\n\tif (p) {\n\t\tif (!strcmp(p->value.string, \"deflate\")) ctx->uncompress = GF_TRUE;\n\t\telse {\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, (\"[NHMLMx] content_encoding %s not supported\\n\", p->value.string ));\n\t\t}\n\t}\n\n\tif (ctx->opid_mdia) {\n\t\tsprintf(nhml, \"baseMediaFile=\\\"%s\\\" \", gf_file_basename(ctx->media_file) );\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\tsprintf(nhml, \">\\n\");\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\tgf_bs_get_content_no_truncate(ctx->bs_w, &ctx->nhml_buffer, &size, &ctx->nhml_buffer_size);\n\n\tif (ctx->filep) {\n\t\tgf_fwrite(ctx->nhml_buffer, size, ctx->filep);\n\t\treturn;\n\t}\n\n\tdst_pck = gf_filter_pck_new_alloc(ctx->opid_nhml, size, &output);\n\tmemcpy(output, ctx->nhml_buffer, size);\n\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_FALSE);\n\tgf_filter_pck_send(dst_pck);\n}",
  22745. "project": "gpac",
  22746. "hash": 192488898754254972476380860269472215022,
  22747. "size": 155,
  22748. "commit_id": "9eeac00b38348c664dfeae2525bba0cf1bc32349",
  22749. "message": "fixed #1565",
  22750. "target": 0,
  22751. "dataset": "other",
  22752. "idx": 244385
  22753. },
  22754. {
  22755. "func": "static void nhmldump_send_frame(GF_NHMLDumpCtx *ctx, char *data, u32 data_size, GF_FilterPacket *pck)\n{\n\tGF_FilterPacket *dst_pck;\n\tchar nhml[1024];\n\tconst GF_PropertyValue *p;\n\tu32 size;\n\tu8 *output;\n\tGF_FilterSAPType sap = gf_filter_pck_get_sap(pck);\n\tu64 dts = gf_filter_pck_get_dts(pck);\n\tu64 cts = gf_filter_pck_get_cts(pck);\n\n\tif (dts==GF_FILTER_NO_TS) dts = cts;\n\tif (cts==GF_FILTER_NO_TS) cts = dts;\n\n\tctx->pck_num++;\n\tsprintf(nhml, \"<NHNTSample number=\\\"%d\\\" DTS=\\\"\"LLU\"\\\" dataLength=\\\"%d\\\" \", ctx->pck_num, dts, data_size);\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\tif (ctx->pckp || (cts != dts) ) {\n\t\tsprintf(nhml, \"CTSOffset=\\\"%d\\\" \", (s32) ((s64)cts - (s64)dts));\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\tif (sap==GF_FILTER_SAP_1) {\n\t\tsprintf(nhml, \"isRAP=\\\"yes\\\" \");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t} else if (sap) {\n\t\tsprintf(nhml, \"SAPType=\\\"%d\\\" \", sap);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t} else if (ctx->pckp) {\n\t\tsprintf(nhml, \"isRAP=\\\"no\\\" \");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tif ((sap==GF_FILTER_SAP_4) || (sap==GF_FILTER_SAP_4_PROL)) {\n\t\t\ts32 roll = gf_filter_pck_get_roll_info(pck);\n\t\t\tsprintf(nhml, \"SAPType=\\\"4\\\" %s=\\\"%d\\\" \", (sap==GF_FILTER_SAP_4_PROL) ? \"prol\" : \"roll\", roll);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t}\n\n\tif (ctx->pckp) {\n\t\tu64 bo;\n\t\tu32 duration, idx;\n\t\tsprintf(nhml, \"mediaOffset=\\\"\"LLU\"\\\" \", ctx->mdia_pos);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\tbo = gf_filter_pck_get_byte_offset(pck);\n\t\tif (bo!=GF_FILTER_NO_BO) {\n\t\t\tsprintf(nhml, \"sourceByteOffset=\\\"\"LLU\"\\\" \", bo);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tduration = gf_filter_pck_get_duration(pck);\n\t\tif (duration) {\n\t\t\tsprintf(nhml, \"duration=\\\"%d\\\" \", duration);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tidx = gf_filter_pck_get_carousel_version(pck);\n\t\tif (idx) {\n\t\t\tsprintf(nhml, \"carouselVersion=\\\"%d\\\" \", idx);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tidx = 0;\n\t\twhile (1) {\n\t\t\tu32 prop_4cc;\n\t\t\tconst char *prop_name;\n\t\t\tp = gf_filter_pck_enum_properties(pck, &idx, &prop_4cc, &prop_name);\n\t\t\tif (!p) break;\n\t\t\tif (prop_4cc == GF_PROP_PCK_SUBS) continue;\n\t\t\tnhmldump_pck_property(ctx, prop_4cc, prop_name, p);\n\t\t}\n\t}\n\n\tif (ctx->chksum) {\n\t\tif (ctx->chksum==1) {\n\t\t\tu32 crc = gf_crc_32(data, data_size);\n\t\t\tsprintf(nhml, \"crc=\\\"%08X\\\" \", crc);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t} else {\n\t\t\tu32 j;\n\t\t\tu8 hash[GF_SHA1_DIGEST_SIZE];\n\t\t\tgf_sha1_csum(data, data_size, hash);\n\t\t\tsprintf(nhml, \"sha1=\\\"\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\tfor (j=0; j<20; j++) {\n\t\t\t\tsprintf(nhml, \"%02X\", hash[j]);\n\t\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\t}\n\t\t\tsprintf(nhml, \"\\\" \");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t}\n\n\tsprintf(nhml, \">\\n\");\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\tp = gf_filter_pck_get_property(pck, GF_PROP_PCK_SUBS);\n\tif (p) {\n\t\tu32 offset_in_sample = 0;\n\t\tBool first_subs = GF_TRUE;\n\t\tif (!ctx->bs_r) ctx->bs_r = gf_bs_new(p->value.data.ptr, p->value.data.size, GF_BITSTREAM_READ);\n\t\telse gf_bs_reassign_buffer(ctx->bs_r, p->value.data.ptr, p->value.data.size);\n\n\t\t//(data) binary blob containing N [(u32)flags(u32)size(u32)reserved(u8)priority(u8) discardable]\n\t\twhile (gf_bs_available(ctx->bs_r)) {\n\t\t\tu32 s_flags = gf_bs_read_u32(ctx->bs_r);\n\t\t\tu32 s_size = gf_bs_read_u32(ctx->bs_r);\n\t\t\tu32 s_res = gf_bs_read_u32(ctx->bs_r);\n\t\t\tu8 s_prio = gf_bs_read_u8(ctx->bs_r);\n\t\t\tu8 s_discard = gf_bs_read_u8(ctx->bs_r);\n\n\n\t\t\tif (offset_in_sample + s_size > data_size) {\n\t\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, (\"Wrong subsample info: sample size %d vs subsample offset+size %dn\", data_size, offset_in_sample + s_size));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tif (ctx->is_stpp && ctx->nhmlonly) {\n\t\t\t\tif (first_subs) {\n\t\t\t\t\tsprintf(nhml, \"<NHNTSubSample>\\n\");\n\t\t\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\t\t\t\tgf_bs_write_data(ctx->bs_w, data, s_size);\n\n\t\t\t\t\tsprintf(nhml, \"</NHNTSubSample>\\n\");\n\t\t\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\t\t} else {\n\t\t\t\t\tu32 d_size;\n\t\t\t\t\tif (ctx->b64_buffer_size<2*s_size) {\n\t\t\t\t\t\tctx->b64_buffer_size = 2 * s_size;\n\t\t\t\t\t\tctx->b64_buffer = gf_realloc(ctx->b64_buffer, ctx->b64_buffer_size);\n\t\t\t\t\t}\n\t\t\t\t\td_size = gf_base64_encode(data + offset_in_sample, s_size, ctx->b64_buffer, ctx->b64_buffer_size);\n\t\t\t\t\tctx->b64_buffer[d_size] = 0;\n\t\t\t\t\tsprintf(nhml, \"<NHNTSubSample data=\\\"data:application/octet-string;base64,\");\n\t\t\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\t\t\tgf_bs_write_data(ctx->bs_w, ctx->b64_buffer, d_size);\n\t\t\t\t\tsprintf(nhml, \"\\\">\\n\");\n\t\t\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tsprintf(nhml, \"<NHNTSubSample size=\\\"%d\\\" flags=\\\"%d\\\" reserved=\\\"%d\\\" priority=\\\"%d\\\" discard=\\\"%d\\\" />\\n\", s_size, s_flags, s_res, s_prio, s_discard);\n\t\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t\t}\n\t\t\tfirst_subs = GF_FALSE;\n\t\t}\n\t} else if (ctx->is_stpp && ctx->nhmlonly) {\n\t\tsprintf(nhml, \"<NHNTSubSample><![CDATA[\\n\");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tgf_bs_write_data(ctx->bs_w, data, data_size);\n\t\tsprintf(nhml, \"]]></NHNTSubSample>\\n\");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t}\n\tsprintf(nhml, \"</NHNTSample>\\n\");\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\tgf_bs_get_content_no_truncate(ctx->bs_w, &ctx->nhml_buffer, &size, &ctx->nhml_buffer_size);\n\n\tif (ctx->filep) {\n\t\tgf_fwrite(ctx->nhml_buffer, size, ctx->filep);\n\t\treturn;\n\t}\n\n\tdst_pck = gf_filter_pck_new_alloc(ctx->opid_nhml, size, &output);\n\tmemcpy(output, ctx->nhml_buffer, size);\n\tgf_filter_pck_set_framing(dst_pck, GF_FALSE, GF_FALSE);\n\tgf_filter_pck_send(dst_pck);\n\n\tctx->mdia_pos += data_size;\n\n\tif (ctx->opid_mdia) {\n\t\t//send data packet\n\t\tdst_pck = gf_filter_pck_new_ref(ctx->opid_mdia, data, data_size, pck);\n\t\tgf_filter_pck_merge_properties(pck, dst_pck);\n\t\t//keep byte offset ?\n//\t\tgf_filter_pck_set_byte_offset(dst_pck, GF_FILTER_NO_BO);\n\n\t\tgf_filter_pck_set_framing(dst_pck, ctx->first, GF_FALSE);\n\t\tgf_filter_pck_send(dst_pck);\n\t}\n}",
  22756. "project": "gpac",
  22757. "hash": 336286441310705311743487855153835615035,
  22758. "size": 177,
  22759. "commit_id": "9eeac00b38348c664dfeae2525bba0cf1bc32349",
  22760. "message": "fixed #1565",
  22761. "target": 0,
  22762. "dataset": "other",
  22763. "idx": 244417
  22764. },
  22765. {
  22766. "func": "static void nhmldump_pck_property(GF_NHMLDumpCtx *ctx, u32 p4cc, const char *pname, const GF_PropertyValue *att)\n{\n\tu32 i;\n\tchar nhml[1024];\n\tchar pval[GF_PROP_DUMP_ARG_SIZE];\n\tif (!pname) pname = gf_props_4cc_get_name(p4cc);\n\n\tsprintf(nhml, \"%s=\\\"\", pname ? pname : gf_4cc_to_str(p4cc));\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\tswitch (att->type) {\n\tcase GF_PROP_DATA:\n\tcase GF_PROP_CONST_DATA:\n\tcase GF_PROP_DATA_NO_COPY:\n\t\tsprintf(nhml, \"0x\");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tfor (i=0; i<att->value.data.size; i++) {\n\t\t\tsprintf(nhml, \"%02X\", (unsigned char) att->value.data.ptr[i]);\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tnhml[0] = 0;\n\t\tbreak;\n\tdefault:\n\t\tsprintf(nhml, \"%s\", gf_props_dump_val(att, pval, GF_FALSE, NULL) );\n\t\tbreak;\n\t}\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\tsprintf(nhml, \"\\\"\");\n\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n}",
  22767. "project": "gpac",
  22768. "hash": 74197779920155075863098662992761658867,
  22769. "size": 30,
  22770. "commit_id": "9eeac00b38348c664dfeae2525bba0cf1bc32349",
  22771. "message": "fixed #1565",
  22772. "target": 0,
  22773. "dataset": "other",
  22774. "idx": 244383
  22775. },
  22776. {
  22777. "func": "GF_Err nhmldump_process(GF_Filter *filter)\n{\n\tGF_NHMLDumpCtx *ctx = gf_filter_get_udta(filter);\n\tGF_FilterPacket *pck;\n\tchar *data;\n\tu32 pck_size;\n\n\tif (!ctx->side_streams_config) {\n\t\treturn nhmldump_config_side_stream(filter, ctx);\n\t}\n\n\tpck = gf_filter_pid_get_packet(ctx->ipid);\n\tif (!pck) {\n\t\tif (gf_filter_pid_is_eos(ctx->ipid)) {\n\t\t\tif (ctx->bs_w && ctx->szRootName) {\n\t\t\t\tchar nhml[1024];\n\t\t\t\tu32 size;\n\t\t\t\tgf_bs_reassign_buffer(ctx->bs_w, ctx->nhml_buffer, ctx->nhml_buffer_size);\n\t\t\t\tsprintf(nhml, \"</%s>\\n\", ctx->szRootName);\n\t\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\t\t\tgf_bs_get_content_no_truncate(ctx->bs_w, &ctx->nhml_buffer, &size, &ctx->nhml_buffer_size);\n\n\t\t\t\tif (ctx->filep) {\n\t\t\t\t\tgf_fwrite(ctx->nhml_buffer, size, ctx->filep);\n\t\t\t\t} else {\n\t\t\t\t\tGF_FilterPacket *dst_pck;\n\t\t\t\t\tu8 *output;\n\t\t\t\t\tdst_pck = gf_filter_pck_new_alloc(ctx->opid_nhml, size, &output);\n\t\t\t\t\tmemcpy(output, ctx->nhml_buffer, size);\n\t\t\t\t\tgf_filter_pck_set_framing(dst_pck, GF_FALSE, GF_TRUE);\n\t\t\t\t\tgf_filter_pck_send(dst_pck);\n\t\t\t\t}\n\t\t\t\tctx->szRootName = NULL;\n\t\t\t}\n\t\t\tif (ctx->opid_nhml) gf_filter_pid_set_eos(ctx->opid_nhml);\n\t\t\tif (ctx->opid_mdia) gf_filter_pid_set_eos(ctx->opid_mdia);\n\t\t\tif (ctx->opid_info) gf_filter_pid_set_eos(ctx->opid_info);\n\t\t\treturn GF_EOS;\n\t\t}\n\t\treturn GF_OK;\n\t}\n\n\tif (!ctx->bs_w) ctx->bs_w = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE);\n\telse gf_bs_reassign_buffer(ctx->bs_w, ctx->nhml_buffer, ctx->nhml_buffer_size);\n\n\tif (ctx->first) {\n\t\tnhmldump_send_header(ctx);\n\t\tgf_bs_reassign_buffer(ctx->bs_w, ctx->nhml_buffer, ctx->nhml_buffer_size);\n\t}\n\n\t//get media data\n\tdata = (char *) gf_filter_pck_get_data(pck, &pck_size);\n\n\t//send data\n\tif (ctx->is_dims) {\n\t\tnhmldump_send_dims(ctx, data, pck_size, pck);\n\t} else {\n\t\tnhmldump_send_frame(ctx, data, pck_size, pck);\n\t}\n\tctx->first = GF_FALSE;\n\n\n\tif (ctx->exporter) {\n\t\tu32 timescale = gf_filter_pck_get_timescale(pck);\n\t\tu64 ts = gf_filter_pck_get_cts(pck);\n\t\tgf_set_progress(\"Exporting\", ts*ctx->duration.den, ctx->duration.num*timescale);\n\t}\n\n\tgf_filter_pid_drop_packet(ctx->ipid);\n\n\treturn GF_OK;\n}",
  22778. "project": "gpac",
  22779. "hash": 176148044180457207435418572123664792253,
  22780. "size": 73,
  22781. "commit_id": "9eeac00b38348c664dfeae2525bba0cf1bc32349",
  22782. "message": "fixed #1565",
  22783. "target": 0,
  22784. "dataset": "other",
  22785. "idx": 244420
  22786. },
  22787. {
  22788. "func": "GF_Err nhmldump_config_side_stream(GF_Filter *filter, GF_NHMLDumpCtx *ctx)\n{\n\tchar *mime=NULL, *name;\n\tchar fileName[GF_MAX_PATH+1];\n\tconst GF_PropertyValue *p;\n\tGF_FileIO *gfio = NULL;\n\n\tif (ctx->name) {\n\t\tstrncpy(fileName, ctx->name, GF_MAX_PATH);\n\t\tfileName[GF_MAX_PATH] = 0;\n\t} else {\n\t\tchar *url = gf_filter_pid_get_destination(ctx->opid_nhml);\n\t\tif (url) {\n\t\t\tif (!strncmp(url, \"gfio://\", 7)) {\n\t\t\t\tgfio = gf_fileio_from_url(url);\n\t\t\t\tstrncpy(fileName, gf_fileio_translate_url(url), GF_MAX_PATH);\n\t\t\t} else {\n\t\t\t\tstrncpy(fileName, url, GF_MAX_PATH);\n\t\t\t}\n\t\t\tfileName[GF_MAX_PATH] = 0;\n\t\t\tgf_free(url);\n \t\t} else {\n\t\t\tstrcpy(fileName, \"dump\");\n\t\t}\n\t}\n\tname = gf_file_ext_start(fileName);\n\tif (name) {\n\t\tname[0] = 0;\n\t}\n\n\tif (!ctx->opid_mdia && !ctx->nhmlonly)\n\t\tctx->opid_mdia = gf_filter_pid_new(filter);\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_DECODER_CONFIG);\n\tif (p) {\n\t\tctx->dcfg = p->value.data.ptr;\n\t\tctx->dcfg_size = p->value.data.size;\n\n\t\tif (!ctx->opid_info && !ctx->nhmlonly) {\n\t\t\tctx->opid_info = gf_filter_pid_new(filter);\n\t\t}\n\n\t} else if (ctx->opid_info) {\n\t\tgf_filter_pid_remove(ctx->opid_info);\n\t}\n\tif (ctx->info_file) gf_free(ctx->info_file);\n\tctx->info_file = NULL;\n\n\tif (ctx->opid_mdia) {\n\t\tGF_Err e;\n\t\tchar *res_name;\n\t\tgf_filter_pid_set_property(ctx->opid_mdia, GF_PROP_PID_STREAM_TYPE, &PROP_UINT(GF_STREAM_FILE) );\n\t\tgf_filter_pid_set_property(ctx->opid_mdia, GF_PROP_PID_MIME, &PROP_STRING(mime) );\n\n\t\tname = gf_file_ext_start(fileName);\n\t\tif (name) name[0] = 0;\n\t\tstrcat(fileName, \".media\");\n\t\tif (gfio) {\n\t\t\tres_name = (char *) gf_fileio_factory(gfio, gf_file_basename(fileName) );\n\t\t} else {\n\t\t\tres_name = fileName;\n\t\t}\n\t\tif (!ctx->exporter) {\n\t\t\tgf_filter_pid_set_property(ctx->opid_mdia, GF_PROP_PID_OUTPATH, &PROP_STRING(res_name) );\n\t\t}\n\n\t\tif (ctx->media_file) gf_free(ctx->media_file);\n\t\tctx->media_file = gf_strdup(fileName);\n\t\tgf_filter_pid_set_property(ctx->opid_mdia, GF_PROP_PID_FILE_EXT, &PROP_STRING(\"media\") );\n\n\t\tif (!ctx->exporter) {\n\t\t\tGF_Filter *o_media = gf_filter_connect_destination(filter, res_name, &e);\n\t\t\tif (o_media) gf_filter_set_source(o_media, filter, NULL);\n\t\t}\n\t}\n\n\tif (ctx->opid_info) {\n\t\tchar *res_name;\n\t\tGF_Err e;\n\t\tgf_filter_pid_set_property(ctx->opid_info, GF_PROP_PID_STREAM_TYPE, &PROP_UINT(GF_STREAM_FILE) );\n\t\tgf_filter_pid_set_property(ctx->opid_info, GF_PROP_PID_MIME, &PROP_STRING(mime) );\n\n\t\tname = gf_file_ext_start(fileName);\n\t\tif (name) name[0] = 0;\n\t\tstrcat(fileName, \".info\");\n\t\tif (gfio) {\n\t\t\tres_name = (char *) gf_fileio_factory(gfio, gf_file_basename(fileName) );\n\t\t} else {\n\t\t\tres_name = fileName;\n\t\t}\n\t\tif (!ctx->exporter) {\n\t\t\tgf_filter_pid_set_property(ctx->opid_info, GF_PROP_PID_OUTPATH, &PROP_STRING(res_name) );\n\t\t}\n\n\t\tif (ctx->info_file) gf_free(ctx->info_file);\n\t\tctx->info_file = gf_strdup(fileName);\n\t\tgf_filter_pid_set_property(ctx->opid_info, GF_PROP_PID_FILE_EXT, &PROP_STRING(\"info\") );\n\n\t\tif (!ctx->exporter) {\n\t\t\tGF_Filter *o_info = gf_filter_connect_destination(filter, res_name, &e);\n\t\t\tif (o_info) gf_filter_set_source(o_info, filter, NULL);\n\t\t}\n\t}\n\n\tif (ctx->opid_mdia)\n\t\tgf_filter_pid_set_name(ctx->opid_mdia, \"media\");\n\tif (ctx->opid_info)\n\t\tgf_filter_pid_set_name(ctx->opid_info, \"info\");\n\n\tctx->side_streams_config = GF_TRUE;\n\treturn GF_OK;\n}",
  22789. "project": "gpac",
  22790. "hash": 301536470294733846288601020965786265815,
  22791. "size": 112,
  22792. "commit_id": "9eeac00b38348c664dfeae2525bba0cf1bc32349",
  22793. "message": "fixed #1565",
  22794. "target": 0,
  22795. "dataset": "other",
  22796. "idx": 244407
  22797. },
  22798. {
  22799. "func": "static void nhmldump_send_dims(GF_NHMLDumpCtx *ctx, char *data, u32 data_size, GF_FilterPacket *pck)\n{\n\tchar nhml[1024];\n\tu32 size;\n\tu8 *output;\n\tGF_FilterPacket *dst_pck;\n\tu64 dts = gf_filter_pck_get_dts(pck);\n\tu64 cts = gf_filter_pck_get_cts(pck);\n\n\tif (dts==GF_FILTER_NO_TS) dts = cts;\n\tif (cts==GF_FILTER_NO_TS) cts = dts;\n\n\tif (!ctx->bs_r) ctx->bs_r = gf_bs_new(data, data_size, GF_BITSTREAM_READ);\n\telse gf_bs_reassign_buffer(ctx->bs_r, data, data_size);\n\n\twhile (gf_bs_available(ctx->bs_r)) {\n\t\tu64 pos = gf_bs_get_position(ctx->bs_r);\n\t\tsize = gf_bs_read_u16(ctx->bs_r);\n\t\tu8 flags = gf_bs_read_u8(ctx->bs_r);\n\t\tu8 prev;\n\n\t\tif (pos+size+2 > data_size)\n\t\t\tbreak;\n\n\t\tprev = data[pos+2+size];\n\t\tdata[pos+2+size] = 0;\n\n\n\t\tsprintf(nhml, \"<DIMSUnit time=\\\"\"LLU\"\\\"\", cts);\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\t/*DIMS flags*/\n\t\tif (flags & GF_DIMS_UNIT_S) {\n\t\t\tsprintf(nhml, \" is-Scene=\\\"yes\\\"\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tif (flags & GF_DIMS_UNIT_M) {\n\t\t\tsprintf(nhml, \" is-RAP=\\\"yes\\\"\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tif (flags & GF_DIMS_UNIT_I) {\n\t\t\tsprintf(nhml, \" is-redundant=\\\"yes\\\"\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tif (flags & GF_DIMS_UNIT_D) {\n\t\t\tsprintf(nhml, \" redundant-exit=\\\"yes\\\"\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tif (flags & GF_DIMS_UNIT_P) {\n\t\t\tsprintf(nhml, \" priority=\\\"high\\\"\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tif (flags & GF_DIMS_UNIT_C) {\n\t\t\tsprintf(nhml, \" compressed=\\\"yes\\\"\");\n\t\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\t}\n\t\tsprintf(nhml, \">\");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\t\tif (ctx->uncompress && (flags & GF_DIMS_UNIT_C)) {\n#ifndef GPAC_DISABLE_ZLIB\n\t\t\tchar svg_data[2049];\n\t\t\tint err;\n\t\t\tu32 done = 0;\n\t\t\tz_stream d_stream;\n\t\t\td_stream.zalloc = (alloc_func)0;\n\t\t\td_stream.zfree = (free_func)0;\n\t\t\td_stream.opaque = (voidpf)0;\n\t\t\td_stream.next_in = (Bytef*) data+pos+3;\n\t\t\td_stream.avail_in = size-1;\n\t\t\td_stream.next_out = (Bytef*)svg_data;\n\t\t\td_stream.avail_out = 2048;\n\n\t\t\terr = inflateInit(&d_stream);\n\t\t\tif (err == Z_OK) {\n\t\t\t\twhile ((s32) d_stream.total_in < size-1) {\n\t\t\t\t\terr = inflate(&d_stream, Z_NO_FLUSH);\n\t\t\t\t\tif (err < Z_OK) break;\n\t\t\t\t\tsvg_data[d_stream.total_out - done] = 0;\n\t\t\t\t\tgf_bs_write_data(ctx->bs_w, svg_data, (u32) strlen(svg_data));\n\n\t\t\t\t\tif (err== Z_STREAM_END) break;\n\t\t\t\t\tdone = (u32) d_stream.total_out;\n\t\t\t\t\td_stream.avail_out = 2048;\n\t\t\t\t\td_stream.next_out = (Bytef*)svg_data;\n\t\t\t\t}\n\t\t\t\tinflateEnd(&d_stream);\n\t\t\t}\n#else\n\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_AUTHOR, (\"Error: your version of GPAC was compiled with no libz support.\"));\n\t\t\tgf_bs_del(ctx->bs_r);\n\t\t\treturn;\n#endif\n\t\t} else {\n\t\t\tgf_bs_write_data(ctx->bs_w, data+pos+3, size-1);\n\t\t}\n\t\tsprintf(nhml, \"</DIMSUnit>\\n\");\n\t\tgf_bs_write_data(ctx->bs_w, nhml, (u32) strlen(nhml));\n\n\t\tdata[pos+2+size] = prev;\n\t\tgf_bs_skip_bytes(ctx->bs_r, size-1);\n\t}\n\n\tgf_bs_get_content_no_truncate(ctx->bs_w, &ctx->nhml_buffer, &size, &ctx->nhml_buffer_size);\n\n\tif (ctx->filep) {\n\t\tgf_fwrite(ctx->nhml_buffer, size, ctx->filep);\n\t\treturn;\n\t}\n\n\tdst_pck = gf_filter_pck_new_alloc(ctx->opid_nhml, size, &output);\n\tmemcpy(output, ctx->nhml_buffer, size);\n\tgf_filter_pck_set_framing(dst_pck, GF_FALSE, GF_FALSE);\n\tgf_filter_pck_send(dst_pck);\n}",
  22800. "project": "gpac",
  22801. "hash": 133699289416255090549671730901096396334,
  22802. "size": 114,
  22803. "commit_id": "9eeac00b38348c664dfeae2525bba0cf1bc32349",
  22804. "message": "fixed #1565",
  22805. "target": 0,
  22806. "dataset": "other",
  22807. "idx": 244406
  22808. }
  22809. ]
  22810. },
  22811. {
  22812. "call_depth": 4,
  22813. "longest_call_chain": [
  22814. "x25_destroy_timer",
  22815. "x25_destroy_socket_from_timer",
  22816. "__x25_destroy_socket",
  22817. "x25_remove_socket"
  22818. ],
  22819. "group_size": 5,
  22820. "functions": [
  22821. {
  22822. "func": "static void x25_remove_socket(struct sock *sk)\n{\n\twrite_lock_bh(&x25_list_lock);\n\tsk_del_node_init(sk);\n\twrite_unlock_bh(&x25_list_lock);\n}",
  22823. "project": "net",
  22824. "hash": 211674392058988057045161520587012124519,
  22825. "size": 6,
  22826. "commit_id": "7781607938c8371d4c2b243527430241c62e39c2",
  22827. "message": "net/x25: Fix null-ptr-deref caused by x25_disconnect\n\nWhen the link layer is terminating, x25->neighbour will be set to NULL\nin x25_disconnect(). As a result, it could cause null-ptr-deref bugs in\nx25_sendmsg(),x25_recvmsg() and x25_connect(). One of the bugs is\nshown below.\n\n (Thread 1) | (Thread 2)\nx25_link_terminated() | x25_recvmsg()\n x25_kill_by_neigh() | ...\n x25_disconnect() | lock_sock(sk)\n ... | ...\n x25->neighbour = NULL //(1) |\n ... | x25->neighbour->extended //(2)\n\nThe code sets NULL to x25->neighbour in position (1) and dereferences\nx25->neighbour in position (2), which could cause null-ptr-deref bug.\n\nThis patch adds lock_sock() in x25_kill_by_neigh() in order to synchronize\nwith x25_sendmsg(), x25_recvmsg() and x25_connect(). What`s more, the\nsock held by lock_sock() is not NULL, because it is extracted from x25_list\nand uses x25_list_lock to synchronize.\n\nFixes: 4becb7ee5b3d (\"net/x25: Fix x25_neigh refcnt leak when x25 disconnect\")\nSigned-off-by: Duoming Zhou <duoming@zju.edu.cn>\nReviewed-by: Lin Ma <linma@zju.edu.cn>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  22828. "target": 0,
  22829. "dataset": "other",
  22830. "idx": 449185
  22831. },
  22832. {
  22833. "func": "static int x25_release(struct socket *sock)\n{\n\tstruct sock *sk = sock->sk;\n\tstruct x25_sock *x25;\n\n\tif (!sk)\n\t\treturn 0;\n\n\tx25 = x25_sk(sk);\n\n\tsock_hold(sk);\n\tlock_sock(sk);\n\tswitch (x25->state) {\n\n\t\tcase X25_STATE_0:\n\t\tcase X25_STATE_2:\n\t\t\tx25_disconnect(sk, 0, 0, 0);\n\t\t\t__x25_destroy_socket(sk);\n\t\t\tgoto out;\n\n\t\tcase X25_STATE_1:\n\t\tcase X25_STATE_3:\n\t\tcase X25_STATE_4:\n\t\t\tx25_clear_queues(sk);\n\t\t\tx25_write_internal(sk, X25_CLEAR_REQUEST);\n\t\t\tx25_start_t23timer(sk);\n\t\t\tx25->state = X25_STATE_2;\n\t\t\tsk->sk_state\t= TCP_CLOSE;\n\t\t\tsk->sk_shutdown\t|= SEND_SHUTDOWN;\n\t\t\tsk->sk_state_change(sk);\n\t\t\tsock_set_flag(sk, SOCK_DEAD);\n\t\t\tsock_set_flag(sk, SOCK_DESTROY);\n\t\t\tbreak;\n\n\t\tcase X25_STATE_5:\n\t\t\tx25_write_internal(sk, X25_CLEAR_REQUEST);\n\t\t\tx25_disconnect(sk, 0, 0, 0);\n\t\t\t__x25_destroy_socket(sk);\n\t\t\tgoto out;\n\t}\n\n\tsock_orphan(sk);\nout:\n\trelease_sock(sk);\n\tsock_put(sk);\n\treturn 0;\n}",
  22834. "project": "net",
  22835. "hash": 68953831480784744166510465628527507952,
  22836. "size": 47,
  22837. "commit_id": "7781607938c8371d4c2b243527430241c62e39c2",
  22838. "message": "net/x25: Fix null-ptr-deref caused by x25_disconnect\n\nWhen the link layer is terminating, x25->neighbour will be set to NULL\nin x25_disconnect(). As a result, it could cause null-ptr-deref bugs in\nx25_sendmsg(),x25_recvmsg() and x25_connect(). One of the bugs is\nshown below.\n\n (Thread 1) | (Thread 2)\nx25_link_terminated() | x25_recvmsg()\n x25_kill_by_neigh() | ...\n x25_disconnect() | lock_sock(sk)\n ... | ...\n x25->neighbour = NULL //(1) |\n ... | x25->neighbour->extended //(2)\n\nThe code sets NULL to x25->neighbour in position (1) and dereferences\nx25->neighbour in position (2), which could cause null-ptr-deref bug.\n\nThis patch adds lock_sock() in x25_kill_by_neigh() in order to synchronize\nwith x25_sendmsg(), x25_recvmsg() and x25_connect(). What`s more, the\nsock held by lock_sock() is not NULL, because it is extracted from x25_list\nand uses x25_list_lock to synchronize.\n\nFixes: 4becb7ee5b3d (\"net/x25: Fix x25_neigh refcnt leak when x25 disconnect\")\nSigned-off-by: Duoming Zhou <duoming@zju.edu.cn>\nReviewed-by: Lin Ma <linma@zju.edu.cn>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  22839. "target": 0,
  22840. "dataset": "other",
  22841. "idx": 449167
  22842. },
  22843. {
  22844. "func": "void x25_destroy_socket_from_timer(struct sock *sk)\n{\n\tsock_hold(sk);\n\tbh_lock_sock(sk);\n\t__x25_destroy_socket(sk);\n\tbh_unlock_sock(sk);\n\tsock_put(sk);\n}",
  22845. "project": "net",
  22846. "hash": 107285315962177851069016575084912150380,
  22847. "size": 8,
  22848. "commit_id": "7781607938c8371d4c2b243527430241c62e39c2",
  22849. "message": "net/x25: Fix null-ptr-deref caused by x25_disconnect\n\nWhen the link layer is terminating, x25->neighbour will be set to NULL\nin x25_disconnect(). As a result, it could cause null-ptr-deref bugs in\nx25_sendmsg(),x25_recvmsg() and x25_connect(). One of the bugs is\nshown below.\n\n (Thread 1) | (Thread 2)\nx25_link_terminated() | x25_recvmsg()\n x25_kill_by_neigh() | ...\n x25_disconnect() | lock_sock(sk)\n ... | ...\n x25->neighbour = NULL //(1) |\n ... | x25->neighbour->extended //(2)\n\nThe code sets NULL to x25->neighbour in position (1) and dereferences\nx25->neighbour in position (2), which could cause null-ptr-deref bug.\n\nThis patch adds lock_sock() in x25_kill_by_neigh() in order to synchronize\nwith x25_sendmsg(), x25_recvmsg() and x25_connect(). What`s more, the\nsock held by lock_sock() is not NULL, because it is extracted from x25_list\nand uses x25_list_lock to synchronize.\n\nFixes: 4becb7ee5b3d (\"net/x25: Fix x25_neigh refcnt leak when x25 disconnect\")\nSigned-off-by: Duoming Zhou <duoming@zju.edu.cn>\nReviewed-by: Lin Ma <linma@zju.edu.cn>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  22850. "target": 0,
  22851. "dataset": "other",
  22852. "idx": 449174
  22853. },
  22854. {
  22855. "func": "static void x25_destroy_timer(struct timer_list *t)\n{\n\tstruct sock *sk = from_timer(sk, t, sk_timer);\n\n\tx25_destroy_socket_from_timer(sk);\n}",
  22856. "project": "net",
  22857. "hash": 9533324264508029075556357866838344897,
  22858. "size": 6,
  22859. "commit_id": "7781607938c8371d4c2b243527430241c62e39c2",
  22860. "message": "net/x25: Fix null-ptr-deref caused by x25_disconnect\n\nWhen the link layer is terminating, x25->neighbour will be set to NULL\nin x25_disconnect(). As a result, it could cause null-ptr-deref bugs in\nx25_sendmsg(),x25_recvmsg() and x25_connect(). One of the bugs is\nshown below.\n\n (Thread 1) | (Thread 2)\nx25_link_terminated() | x25_recvmsg()\n x25_kill_by_neigh() | ...\n x25_disconnect() | lock_sock(sk)\n ... | ...\n x25->neighbour = NULL //(1) |\n ... | x25->neighbour->extended //(2)\n\nThe code sets NULL to x25->neighbour in position (1) and dereferences\nx25->neighbour in position (2), which could cause null-ptr-deref bug.\n\nThis patch adds lock_sock() in x25_kill_by_neigh() in order to synchronize\nwith x25_sendmsg(), x25_recvmsg() and x25_connect(). What`s more, the\nsock held by lock_sock() is not NULL, because it is extracted from x25_list\nand uses x25_list_lock to synchronize.\n\nFixes: 4becb7ee5b3d (\"net/x25: Fix x25_neigh refcnt leak when x25 disconnect\")\nSigned-off-by: Duoming Zhou <duoming@zju.edu.cn>\nReviewed-by: Lin Ma <linma@zju.edu.cn>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  22861. "target": 0,
  22862. "dataset": "other",
  22863. "idx": 449172
  22864. },
  22865. {
  22866. "func": "static void __x25_destroy_socket(struct sock *sk)\n{\n\tstruct sk_buff *skb;\n\n\tx25_stop_heartbeat(sk);\n\tx25_stop_timer(sk);\n\n\tx25_remove_socket(sk);\n\tx25_clear_queues(sk);\t\t/* Flush the queues */\n\n\twhile ((skb = skb_dequeue(&sk->sk_receive_queue)) != NULL) {\n\t\tif (skb->sk != sk) {\t\t/* A pending connection */\n\t\t\t/*\n\t\t\t * Queue the unaccepted socket for death\n\t\t\t */\n\t\t\tskb->sk->sk_state = TCP_LISTEN;\n\t\t\tsock_set_flag(skb->sk, SOCK_DEAD);\n\t\t\tx25_start_heartbeat(skb->sk);\n\t\t\tx25_sk(skb->sk)->state = X25_STATE_0;\n\t\t}\n\n\t\tkfree_skb(skb);\n\t}\n\n\tif (sk_has_allocations(sk)) {\n\t\t/* Defer: outstanding buffers */\n\t\tsk->sk_timer.expires = jiffies + 10 * HZ;\n\t\tsk->sk_timer.function = x25_destroy_timer;\n\t\tadd_timer(&sk->sk_timer);\n\t} else {\n\t\t/* drop last reference so sock_put will free */\n\t\t__sock_put(sk);\n\t}\n}",
  22867. "project": "net",
  22868. "hash": 37876805302312188033380640487351936531,
  22869. "size": 34,
  22870. "commit_id": "7781607938c8371d4c2b243527430241c62e39c2",
  22871. "message": "net/x25: Fix null-ptr-deref caused by x25_disconnect\n\nWhen the link layer is terminating, x25->neighbour will be set to NULL\nin x25_disconnect(). As a result, it could cause null-ptr-deref bugs in\nx25_sendmsg(),x25_recvmsg() and x25_connect(). One of the bugs is\nshown below.\n\n (Thread 1) | (Thread 2)\nx25_link_terminated() | x25_recvmsg()\n x25_kill_by_neigh() | ...\n x25_disconnect() | lock_sock(sk)\n ... | ...\n x25->neighbour = NULL //(1) |\n ... | x25->neighbour->extended //(2)\n\nThe code sets NULL to x25->neighbour in position (1) and dereferences\nx25->neighbour in position (2), which could cause null-ptr-deref bug.\n\nThis patch adds lock_sock() in x25_kill_by_neigh() in order to synchronize\nwith x25_sendmsg(), x25_recvmsg() and x25_connect(). What`s more, the\nsock held by lock_sock() is not NULL, because it is extracted from x25_list\nand uses x25_list_lock to synchronize.\n\nFixes: 4becb7ee5b3d (\"net/x25: Fix x25_neigh refcnt leak when x25 disconnect\")\nSigned-off-by: Duoming Zhou <duoming@zju.edu.cn>\nReviewed-by: Lin Ma <linma@zju.edu.cn>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  22872. "target": 0,
  22873. "dataset": "other",
  22874. "idx": 449165
  22875. }
  22876. ]
  22877. },
  22878. {
  22879. "call_depth": 3,
  22880. "longest_call_chain": [
  22881. "WriteCombination",
  22882. "ReadValue",
  22883. "CopyToString"
  22884. ],
  22885. "group_size": 10,
  22886. "functions": [
  22887. {
  22888. "func": " void ReadValue(int64 batch, int64 n, tstring* out) const override {\n CopyToString(values_(row_splits_(batch) + n), out);\n }",
  22889. "project": "tensorflow",
  22890. "hash": 55788464238448605724962746924070324035,
  22891. "size": 3,
  22892. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22893. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22894. "target": 0,
  22895. "dataset": "other",
  22896. "idx": 230068
  22897. },
  22898. {
  22899. "func": " void ReadValue(int64 batch, int64 n, uint64* out) const override {\n CopyToFingerprint(values_(row_splits_[batch] + n), out);\n }",
  22900. "project": "tensorflow",
  22901. "hash": 254387731714568414422331348354777529512,
  22902. "size": 3,
  22903. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22904. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22905. "target": 0,
  22906. "dataset": "other",
  22907. "idx": 230072
  22908. },
  22909. {
  22910. "func": " void ReadValue(int64 batch, int64 n, uint64* out) const override {\n CopyToFingerprint(values_(row_splits_(batch) + n), out);\n }",
  22911. "project": "tensorflow",
  22912. "hash": 125238923028743371870118703373360803456,
  22913. "size": 3,
  22914. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22915. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22916. "target": 0,
  22917. "dataset": "other",
  22918. "idx": 230073
  22919. },
  22920. {
  22921. "func": " void ReadValue(int64 batch, int64 n, uint64* out) const override {\n CopyToFingerprint(values_(batch, n), out);\n }",
  22922. "project": "tensorflow",
  22923. "hash": 306003480010293006259926602076123830066,
  22924. "size": 3,
  22925. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22926. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22927. "target": 0,
  22928. "dataset": "other",
  22929. "idx": 230088
  22930. },
  22931. {
  22932. "func": " void ReadValue(int64 batch, int64 n, tstring* out) const override {\n CopyToString(values_(row_splits_[batch] + n), out);\n }",
  22933. "project": "tensorflow",
  22934. "hash": 216827240015663779340171285742749249548,
  22935. "size": 3,
  22936. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22937. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22938. "target": 0,
  22939. "dataset": "other",
  22940. "idx": 230094
  22941. },
  22942. {
  22943. "func": " void ReadValue(int64 batch, int64 n, tstring* out) const override {\n CopyToString(values_(batch, n), out);\n }",
  22944. "project": "tensorflow",
  22945. "hash": 26852071011468745647036129361935258399,
  22946. "size": 3,
  22947. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22948. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22949. "target": 0,
  22950. "dataset": "other",
  22951. "idx": 230096
  22952. },
  22953. {
  22954. "func": " void WriteCombination(int64 batch_index, const std::vector<int>& combination,\n tstring* out) {\n static const auto k_feature_separator = \"_X_\";\n gtl::InlinedVector<tstring, 6> cross_vec(features_.size());\n for (int i = 0; i < combination.size(); ++i) {\n features_[i]->ReadValue(batch_index, combination[i], &cross_vec[i]);\n }\n *out = absl::StrJoin(cross_vec, k_feature_separator);\n }",
  22955. "project": "tensorflow",
  22956. "hash": 331863358337901230049519626400641216503,
  22957. "size": 9,
  22958. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22959. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22960. "target": 0,
  22961. "dataset": "other",
  22962. "idx": 230076
  22963. },
  22964. {
  22965. "func": " void WriteCombination(int64 batch_index, const std::vector<int>& combination,\n int64* out) {\n // Do the fingerprint concatenation on uint64.\n uint64 hashed_output = hash_key_;\n for (size_t i = 0; i < combination.size(); ++i) {\n uint64 hash_i;\n features_[i]->ReadValue(batch_index, combination[i], &hash_i);\n hashed_output = FingerprintCat64(hashed_output, hash_i);\n }\n // The return value is int64 based on the number of buckets.\n if (num_buckets_ > 0) {\n *out = hashed_output % num_buckets_;\n } else {\n // To prevent negative output we take modulo to max int64.\n *out = hashed_output % std::numeric_limits<int64>::max();\n }\n }",
  22966. "project": "tensorflow",
  22967. "hash": 168480145799742065585525814434351380206,
  22968. "size": 17,
  22969. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22970. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22971. "target": 0,
  22972. "dataset": "other",
  22973. "idx": 230090
  22974. },
  22975. {
  22976. "func": "void CopyToString(const tstring& src, tstring* dst) {\n if (src.type() == tstring::SMALL) {\n *dst = src; // string buffer fits in the tstring object (under ~24 bytes)\n } else {\n dst->assign_as_view(src);\n }\n}",
  22977. "project": "tensorflow",
  22978. "hash": 215870454551312112108584656546875435517,
  22979. "size": 7,
  22980. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22981. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22982. "target": 0,
  22983. "dataset": "other",
  22984. "idx": 230066
  22985. },
  22986. {
  22987. "func": "void CopyToString(int64 src, tstring* dst) { *dst = std::to_string(src); }",
  22988. "project": "tensorflow",
  22989. "hash": 319244472554003583561190800163313431385,
  22990. "size": 1,
  22991. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  22992. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  22993. "target": 0,
  22994. "dataset": "other",
  22995. "idx": 230079
  22996. }
  22997. ]
  22998. },
  22999. {
  23000. "call_depth": 3,
  23001. "longest_call_chain": [
  23002. "GC_array_mark_proc",
  23003. "GC_push_complex_descriptor",
  23004. "GC_descr_obj_size"
  23005. ],
  23006. "group_size": 3,
  23007. "functions": [
  23008. {
  23009. "func": "STATIC mse * GC_array_mark_proc(word * addr, mse * mark_stack_ptr,\n mse * mark_stack_limit,\n word env GC_ATTR_UNUSED)\n{\n hdr * hhdr = HDR(addr);\n size_t sz = hhdr -> hb_sz;\n size_t nwords = BYTES_TO_WORDS(sz);\n complex_descriptor * descr = (complex_descriptor *)(addr[nwords-1]);\n mse * orig_mark_stack_ptr = mark_stack_ptr;\n mse * new_mark_stack_ptr;\n\n if (descr == 0) {\n /* Found a reference to a free list entry. Ignore it. */\n return(orig_mark_stack_ptr);\n }\n /* In use counts were already updated when array descriptor was */\n /* pushed. Here we only replace it by subobject descriptors, so */\n /* no update is necessary. */\n new_mark_stack_ptr = GC_push_complex_descriptor(addr, descr,\n mark_stack_ptr,\n mark_stack_limit-1);\n if (new_mark_stack_ptr == 0) {\n /* Doesn't fit. Conservatively push the whole array as a unit */\n /* and request a mark stack expansion. */\n /* This cannot cause a mark stack overflow, since it replaces */\n /* the original array entry. */\n GC_ASSERT(mark_stack_ptr != NULL);\n GC_mark_stack_too_small = TRUE;\n new_mark_stack_ptr = orig_mark_stack_ptr + 1;\n new_mark_stack_ptr -> mse_start = (ptr_t)addr;\n new_mark_stack_ptr -> mse_descr.w = sz | GC_DS_LENGTH;\n } else {\n /* Push descriptor itself */\n new_mark_stack_ptr++;\n new_mark_stack_ptr -> mse_start = (ptr_t)(addr + nwords - 1);\n new_mark_stack_ptr -> mse_descr.w = sizeof(word) | GC_DS_LENGTH;\n }\n return new_mark_stack_ptr;\n}",
  23010. "project": "bdwgc",
  23011. "hash": 269104642646459754473365694976646349605,
  23012. "size": 39,
  23013. "commit_id": "4e1a6f9d8f2a49403bbd00b8c8e5324048fb84d4",
  23014. "message": "Fix calloc_explicitly_typed in case of lb*n overflow\n\n* typd_mlc.c: Include limits.h (for SIZE_MAX).\n* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in\nmalloc.c).\n* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n\noverflows (same algorithm as in calloc defined in malloc.c); eliminate\nlb *= n code duplication.",
  23015. "target": 0,
  23016. "dataset": "other",
  23017. "idx": 374068
  23018. },
  23019. {
  23020. "func": "STATIC word GC_descr_obj_size(complex_descriptor *d)\n{\n switch(d -> TAG) {\n case LEAF_TAG:\n return(d -> ld.ld_nelements * d -> ld.ld_size);\n case ARRAY_TAG:\n return(d -> ad.ad_nelements\n * GC_descr_obj_size(d -> ad.ad_element_descr));\n case SEQUENCE_TAG:\n return(GC_descr_obj_size(d -> sd.sd_first)\n + GC_descr_obj_size(d -> sd.sd_second));\n default:\n ABORT_RET(\"Bad complex descriptor\");\n return 0;\n }\n}",
  23021. "project": "bdwgc",
  23022. "hash": 196235824853855162524469342916051222244,
  23023. "size": 16,
  23024. "commit_id": "4e1a6f9d8f2a49403bbd00b8c8e5324048fb84d4",
  23025. "message": "Fix calloc_explicitly_typed in case of lb*n overflow\n\n* typd_mlc.c: Include limits.h (for SIZE_MAX).\n* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in\nmalloc.c).\n* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n\noverflows (same algorithm as in calloc defined in malloc.c); eliminate\nlb *= n code duplication.",
  23026. "target": 0,
  23027. "dataset": "other",
  23028. "idx": 374063
  23029. },
  23030. {
  23031. "func": "STATIC mse * GC_push_complex_descriptor(word *addr, complex_descriptor *d,\n mse *msp, mse *msl)\n{\n register ptr_t current = (ptr_t) addr;\n register word nelements;\n register word sz;\n register word i;\n\n switch(d -> TAG) {\n case LEAF_TAG:\n {\n register GC_descr descr = d -> ld.ld_descriptor;\n\n nelements = d -> ld.ld_nelements;\n if (msl - msp <= (ptrdiff_t)nelements) return(0);\n sz = d -> ld.ld_size;\n for (i = 0; i < nelements; i++) {\n msp++;\n msp -> mse_start = current;\n msp -> mse_descr.w = descr;\n current += sz;\n }\n return(msp);\n }\n case ARRAY_TAG:\n {\n register complex_descriptor *descr = d -> ad.ad_element_descr;\n\n nelements = d -> ad.ad_nelements;\n sz = GC_descr_obj_size(descr);\n for (i = 0; i < nelements; i++) {\n msp = GC_push_complex_descriptor((word *)current, descr,\n msp, msl);\n if (msp == 0) return(0);\n current += sz;\n }\n return(msp);\n }\n case SEQUENCE_TAG:\n {\n sz = GC_descr_obj_size(d -> sd.sd_first);\n msp = GC_push_complex_descriptor((word *)current, d -> sd.sd_first,\n msp, msl);\n if (msp == 0) return(0);\n current += sz;\n msp = GC_push_complex_descriptor((word *)current, d -> sd.sd_second,\n msp, msl);\n return(msp);\n }\n default:\n ABORT_RET(\"Bad complex descriptor\");\n return 0;\n }\n}",
  23032. "project": "bdwgc",
  23033. "hash": 100233720168210460635991273310518220064,
  23034. "size": 54,
  23035. "commit_id": "4e1a6f9d8f2a49403bbd00b8c8e5324048fb84d4",
  23036. "message": "Fix calloc_explicitly_typed in case of lb*n overflow\n\n* typd_mlc.c: Include limits.h (for SIZE_MAX).\n* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in\nmalloc.c).\n* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n\noverflows (same algorithm as in calloc defined in malloc.c); eliminate\nlb *= n code duplication.",
  23037. "target": 0,
  23038. "dataset": "other",
  23039. "idx": 374065
  23040. }
  23041. ]
  23042. },
  23043. {
  23044. "call_depth": 4,
  23045. "longest_call_chain": [
  23046. "ip6_push_pending_frames",
  23047. "ip6_send_skb",
  23048. "ip6_local_out",
  23049. "__ip6_local_out"
  23050. ],
  23051. "group_size": 4,
  23052. "functions": [
  23053. {
  23054. "func": "int ip6_push_pending_frames(struct sock *sk)\n{\n\tstruct sk_buff *skb;\n\n\tskb = ip6_finish_skb(sk);\n\tif (!skb)\n\t\treturn 0;\n\n\treturn ip6_send_skb(skb);\n}",
  23055. "project": "net",
  23056. "hash": 98437086620911532825825118994734352049,
  23057. "size": 10,
  23058. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  23059. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  23060. "target": 0,
  23061. "dataset": "other",
  23062. "idx": 468936
  23063. },
  23064. {
  23065. "func": "int ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)\n{\n\tint err;\n\n\terr = __ip6_local_out(net, sk, skb);\n\tif (likely(err == 1))\n\t\terr = dst_output(net, sk, skb);\n\n\treturn err;\n}",
  23066. "project": "linux",
  23067. "hash": 52771529644351032790260622560929239956,
  23068. "size": 10,
  23069. "commit_id": "62f20e068ccc50d6ab66fdb72ba90da2b9418c99",
  23070. "message": "ipv6: use prandom_u32() for ID generation\n\nThis is a complement to commit aa6dd211e4b1 (\"inet: use bigger hash\ntable for IP ID generation\"), but focusing on some specific aspects\nof IPv6.\n\nContary to IPv4, IPv6 only uses packet IDs with fragments, and with a\nminimum MTU of 1280, it's much less easy to force a remote peer to\nproduce many fragments to explore its ID sequence. In addition packet\nIDs are 32-bit in IPv6, which further complicates their analysis. On\nthe other hand, it is often easier to choose among plenty of possible\nsource addresses and partially work around the bigger hash table the\ncommit above permits, which leaves IPv6 partially exposed to some\npossibilities of remote analysis at the risk of weakening some\nprotocols like DNS if some IDs can be predicted with a good enough\nprobability.\n\nGiven the wide range of permitted IDs, the risk of collision is extremely\nlow so there's no need to rely on the positive increment algorithm that\nis shared with the IPv4 code via ip_idents_reserve(). We have a fast\nPRNG, so let's simply call prandom_u32() and be done with it.\n\nPerformance measurements at 10 Gbps couldn't show any difference with\nthe previous code, even when using a single core, because due to the\nlarge fragments, we're limited to only ~930 kpps at 10 Gbps and the cost\nof the random generation is completely offset by other operations and by\nthe network transfer time. In addition, this change removes the need to\nupdate a shared entry in the idents table so it may even end up being\nslightly faster on large scale systems where this matters.\n\nThe risk of at least one collision here is about 1/80 million among\n10 IDs, 1/850k among 100 IDs, and still only 1/8.5k among 1000 IDs,\nwhich remains very low compared to IPv4 where all IDs are reused\nevery 4 to 80ms on a 10 Gbps flow depending on packet sizes.\n\nReported-by: Amit Klein <aksecurity@gmail.com>\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Eric Dumazet <edumazet@google.com>\nLink: https://lore.kernel.org/r/20210529110746.6796-1-w@1wt.eu\nSigned-off-by: Jakub Kicinski <kuba@kernel.org>",
  23071. "target": 0,
  23072. "dataset": "other",
  23073. "idx": 318497
  23074. },
  23075. {
  23076. "func": "int __ip6_local_out(struct net *net, struct sock *sk, struct sk_buff *skb)\n{\n\tint len;\n\n\tlen = skb->len - sizeof(struct ipv6hdr);\n\tif (len > IPV6_MAXPLEN)\n\t\tlen = 0;\n\tipv6_hdr(skb)->payload_len = htons(len);\n\tIP6CB(skb)->nhoff = offsetof(struct ipv6hdr, nexthdr);\n\n\t/* if egress device is enslaved to an L3 master device pass the\n\t * skb to its handler for processing\n\t */\n\tskb = l3mdev_ip6_out(sk, skb);\n\tif (unlikely(!skb))\n\t\treturn 0;\n\n\tskb->protocol = htons(ETH_P_IPV6);\n\n\treturn nf_hook(NFPROTO_IPV6, NF_INET_LOCAL_OUT,\n\t\t net, sk, skb, NULL, skb_dst(skb)->dev,\n\t\t dst_output);\n}",
  23077. "project": "linux",
  23078. "hash": 65323340548815789678720155397800993393,
  23079. "size": 23,
  23080. "commit_id": "62f20e068ccc50d6ab66fdb72ba90da2b9418c99",
  23081. "message": "ipv6: use prandom_u32() for ID generation\n\nThis is a complement to commit aa6dd211e4b1 (\"inet: use bigger hash\ntable for IP ID generation\"), but focusing on some specific aspects\nof IPv6.\n\nContary to IPv4, IPv6 only uses packet IDs with fragments, and with a\nminimum MTU of 1280, it's much less easy to force a remote peer to\nproduce many fragments to explore its ID sequence. In addition packet\nIDs are 32-bit in IPv6, which further complicates their analysis. On\nthe other hand, it is often easier to choose among plenty of possible\nsource addresses and partially work around the bigger hash table the\ncommit above permits, which leaves IPv6 partially exposed to some\npossibilities of remote analysis at the risk of weakening some\nprotocols like DNS if some IDs can be predicted with a good enough\nprobability.\n\nGiven the wide range of permitted IDs, the risk of collision is extremely\nlow so there's no need to rely on the positive increment algorithm that\nis shared with the IPv4 code via ip_idents_reserve(). We have a fast\nPRNG, so let's simply call prandom_u32() and be done with it.\n\nPerformance measurements at 10 Gbps couldn't show any difference with\nthe previous code, even when using a single core, because due to the\nlarge fragments, we're limited to only ~930 kpps at 10 Gbps and the cost\nof the random generation is completely offset by other operations and by\nthe network transfer time. In addition, this change removes the need to\nupdate a shared entry in the idents table so it may even end up being\nslightly faster on large scale systems where this matters.\n\nThe risk of at least one collision here is about 1/80 million among\n10 IDs, 1/850k among 100 IDs, and still only 1/8.5k among 1000 IDs,\nwhich remains very low compared to IPv4 where all IDs are reused\nevery 4 to 80ms on a 10 Gbps flow depending on packet sizes.\n\nReported-by: Amit Klein <aksecurity@gmail.com>\nSigned-off-by: Willy Tarreau <w@1wt.eu>\nReviewed-by: Eric Dumazet <edumazet@google.com>\nLink: https://lore.kernel.org/r/20210529110746.6796-1-w@1wt.eu\nSigned-off-by: Jakub Kicinski <kuba@kernel.org>",
  23082. "target": 0,
  23083. "dataset": "other",
  23084. "idx": 318496
  23085. },
  23086. {
  23087. "func": "int ip6_send_skb(struct sk_buff *skb)\n{\n\tstruct net *net = sock_net(skb->sk);\n\tstruct rt6_info *rt = (struct rt6_info *)skb_dst(skb);\n\tint err;\n\n\terr = ip6_local_out(net, skb->sk, skb);\n\tif (err) {\n\t\tif (err > 0)\n\t\t\terr = net_xmit_errno(err);\n\t\tif (err)\n\t\t\tIP6_INC_STATS(net, rt->rt6i_idev,\n\t\t\t\t IPSTATS_MIB_OUTDISCARDS);\n\t}\n\n\treturn err;\n}",
  23088. "project": "net",
  23089. "hash": 168395828033328433995927207072894963468,
  23090. "size": 17,
  23091. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  23092. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  23093. "target": 0,
  23094. "dataset": "other",
  23095. "idx": 469001
  23096. }
  23097. ]
  23098. },
  23099. {
  23100. "call_depth": 3,
  23101. "longest_call_chain": [
  23102. "ndpi_search_openvpn",
  23103. "check_pkid_and_detect_hmac_size",
  23104. "get_packet_id"
  23105. ],
  23106. "group_size": 4,
  23107. "functions": [
  23108. {
  23109. "func": "int8_t check_pkid_and_detect_hmac_size(const u_int8_t * payload) {\n // try to guess\n if(get_packet_id(payload, P_HMAC_160) == 1)\n return P_HMAC_160;\n \n if(get_packet_id(payload, P_HMAC_128) == 1) \n return P_HMAC_128;\n \n return(-1);\n}",
  23110. "project": "nDPI",
  23111. "hash": 24985274642549712556186513782467980511,
  23112. "size": 10,
  23113. "commit_id": "8e7b1ea7a136cc4e4aa9880072ec2d69900a825e",
  23114. "message": "Fix for potential heap-buffer-overflow in ndpi_search_openvpn",
  23115. "target": 0,
  23116. "dataset": "other",
  23117. "idx": 241323
  23118. },
  23119. {
  23120. "func": "u_int32_t get_packet_id(const u_int8_t * payload, u_int8_t hms) {\n return(ntohl(*(u_int32_t*)(payload + P_HARD_RESET_PACKET_ID_OFFSET(hms))));\n}",
  23121. "project": "nDPI",
  23122. "hash": 143539128425072275289746317962721040534,
  23123. "size": 3,
  23124. "commit_id": "8e7b1ea7a136cc4e4aa9880072ec2d69900a825e",
  23125. "message": "Fix for potential heap-buffer-overflow in ndpi_search_openvpn",
  23126. "target": 0,
  23127. "dataset": "other",
  23128. "idx": 241322
  23129. },
  23130. {
  23131. "func": "void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct,\n struct ndpi_flow_struct* flow) {\n struct ndpi_packet_struct* packet = &flow->packet;\n const u_int8_t * ovpn_payload = packet->payload;\n const u_int8_t * session_remote;\n u_int8_t opcode;\n u_int8_t alen;\n int8_t hmac_size;\n int8_t failed = 0;\n\n if(packet->payload_packet_len >= 40) {\n // skip openvpn TCP transport packet size\n if(packet->tcp != NULL)\n ovpn_payload += 2;\n\n opcode = ovpn_payload[0] & P_OPCODE_MASK;\n\n if(packet->udp) {\n#ifdef DEBUG\n printf(\"[packet_id: %u][opcode: %u][Packet ID: %d][%u <-> %u][len: %u]\\n\",\n\t flow->num_processed_pkts,\n\t opcode, check_pkid_and_detect_hmac_size(ovpn_payload),\n\t htons(packet->udp->source), htons(packet->udp->dest), packet->payload_packet_len);\t \n#endif\n \n if(\n\t (flow->num_processed_pkts == 1)\n\t && (\n\t ((packet->payload_packet_len == 112)\n\t && ((opcode == 168) || (opcode == 192))\n\t )\n\t || ((packet->payload_packet_len == 80)\n\t\t && ((opcode == 184) || (opcode == 88) || (opcode == 160) || (opcode == 168) || (opcode == 200)))\n\t )) {\n\tNDPI_LOG_INFO(ndpi_struct,\"found openvpn\\n\");\n\tndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN);\n\treturn;\n }\n }\n \n if(flow->ovpn_counter < P_HARD_RESET_CLIENT_MAX_COUNT && (opcode == P_CONTROL_HARD_RESET_CLIENT_V1 ||\n\t\t\t\t opcode == P_CONTROL_HARD_RESET_CLIENT_V2)) {\n if(check_pkid_and_detect_hmac_size(ovpn_payload) > 0) {\n memcpy(flow->ovpn_session_id, ovpn_payload+1, 8);\n\n NDPI_LOG_DBG2(ndpi_struct,\n\t\t \"session key: %02x%02x%02x%02x%02x%02x%02x%02x\\n\",\n\t\t flow->ovpn_session_id[0], flow->ovpn_session_id[1], flow->ovpn_session_id[2], flow->ovpn_session_id[3],\n\t\t flow->ovpn_session_id[4], flow->ovpn_session_id[5], flow->ovpn_session_id[6], flow->ovpn_session_id[7]);\n }\n } else if(flow->ovpn_counter >= 1 && flow->ovpn_counter <= P_HARD_RESET_CLIENT_MAX_COUNT &&\n (opcode == P_CONTROL_HARD_RESET_SERVER_V1 || opcode == P_CONTROL_HARD_RESET_SERVER_V2)) {\n\n hmac_size = check_pkid_and_detect_hmac_size(ovpn_payload);\n\n if(hmac_size > 0) {\n alen = ovpn_payload[P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size)];\n if (alen > 0) {\n\t session_remote = ovpn_payload + P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size) + 1 + alen * 4;\n\n if(memcmp(flow->ovpn_session_id, session_remote, 8) == 0) {\n\t NDPI_LOG_INFO(ndpi_struct,\"found openvpn\\n\");\n\t ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN);\n\t return;\n\t } else {\n NDPI_LOG_DBG2(ndpi_struct,\n\t\t \"key mismatch: %02x%02x%02x%02x%02x%02x%02x%02x\\n\",\n\t\t session_remote[0], session_remote[1], session_remote[2], session_remote[3],\n\t\t session_remote[4], session_remote[5], session_remote[6], session_remote[7]);\n failed = 1;\n }\n } else\n failed = 1;\n } else\n failed = 1;\n } else\n failed = 1;\n\n flow->ovpn_counter++;\n \n if(failed) {\n NDPI_EXCLUDE_PROTO(ndpi_struct, flow);\n }\n }\n}",
  23132. "project": "nDPI",
  23133. "hash": 263464745339090965084831362920390201622,
  23134. "size": 85,
  23135. "commit_id": "8e7b1ea7a136cc4e4aa9880072ec2d69900a825e",
  23136. "message": "Fix for potential heap-buffer-overflow in ndpi_search_openvpn",
  23137. "target": 1,
  23138. "dataset": "other",
  23139. "idx": 196624
  23140. },
  23141. {
  23142. "func": "void ndpi_search_openvpn(struct ndpi_detection_module_struct* ndpi_struct,\n struct ndpi_flow_struct* flow) {\n struct ndpi_packet_struct* packet = &flow->packet;\n const u_int8_t * ovpn_payload = packet->payload;\n const u_int8_t * session_remote;\n u_int8_t opcode;\n u_int8_t alen;\n int8_t hmac_size;\n int8_t failed = 0;\n /* No u_ */int16_t ovpn_payload_len = packet->payload_packet_len;\n \n if(ovpn_payload_len >= 40) {\n // skip openvpn TCP transport packet size\n if(packet->tcp != NULL)\n ovpn_payload += 2, ovpn_payload_len -= 2;;\n\n opcode = ovpn_payload[0] & P_OPCODE_MASK;\n\n if(packet->udp) {\n#ifdef DEBUG\n printf(\"[packet_id: %u][opcode: %u][Packet ID: %d][%u <-> %u][len: %u]\\n\",\n\t flow->num_processed_pkts,\n\t opcode, check_pkid_and_detect_hmac_size(ovpn_payload),\n\t htons(packet->udp->source), htons(packet->udp->dest), ovpn_payload_len);\t \n#endif\n \n if(\n\t (flow->num_processed_pkts == 1)\n\t && (\n\t ((ovpn_payload_len == 112)\n\t && ((opcode == 168) || (opcode == 192))\n\t )\n\t || ((ovpn_payload_len == 80)\n\t\t && ((opcode == 184) || (opcode == 88) || (opcode == 160) || (opcode == 168) || (opcode == 200)))\n\t )) {\n\tNDPI_LOG_INFO(ndpi_struct,\"found openvpn\\n\");\n\tndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN);\n\treturn;\n }\n }\n \n if(flow->ovpn_counter < P_HARD_RESET_CLIENT_MAX_COUNT && (opcode == P_CONTROL_HARD_RESET_CLIENT_V1 ||\n\t\t\t\t opcode == P_CONTROL_HARD_RESET_CLIENT_V2)) {\n if(check_pkid_and_detect_hmac_size(ovpn_payload) > 0) {\n memcpy(flow->ovpn_session_id, ovpn_payload+1, 8);\n\n NDPI_LOG_DBG2(ndpi_struct,\n\t\t \"session key: %02x%02x%02x%02x%02x%02x%02x%02x\\n\",\n\t\t flow->ovpn_session_id[0], flow->ovpn_session_id[1], flow->ovpn_session_id[2], flow->ovpn_session_id[3],\n\t\t flow->ovpn_session_id[4], flow->ovpn_session_id[5], flow->ovpn_session_id[6], flow->ovpn_session_id[7]);\n }\n } else if(flow->ovpn_counter >= 1 && flow->ovpn_counter <= P_HARD_RESET_CLIENT_MAX_COUNT &&\n (opcode == P_CONTROL_HARD_RESET_SERVER_V1 || opcode == P_CONTROL_HARD_RESET_SERVER_V2)) {\n\n hmac_size = check_pkid_and_detect_hmac_size(ovpn_payload);\n\n if(hmac_size > 0) {\n\tu_int16_t offset = P_PACKET_ID_ARRAY_LEN_OFFSET(hmac_size);\n\t \n alen = ovpn_payload[offset];\n\t\n if (alen > 0) {\n\t offset += 1 + alen * 4;\n\n\t if((offset+8) <= ovpn_payload_len) {\n\t session_remote = &ovpn_payload[offset];\n\t \n\t if(memcmp(flow->ovpn_session_id, session_remote, 8) == 0) {\n\t NDPI_LOG_INFO(ndpi_struct,\"found openvpn\\n\");\n\t ndpi_set_detected_protocol(ndpi_struct, flow, NDPI_PROTOCOL_OPENVPN, NDPI_PROTOCOL_UNKNOWN);\n\t return;\n\t } else {\n\t NDPI_LOG_DBG2(ndpi_struct,\n\t\t\t \"key mismatch: %02x%02x%02x%02x%02x%02x%02x%02x\\n\",\n\t\t\t session_remote[0], session_remote[1], session_remote[2], session_remote[3],\n\t\t\t session_remote[4], session_remote[5], session_remote[6], session_remote[7]);\n\t failed = 1;\n\t }\n\t } else\n\t failed = 1;\n\t} else\n failed = 1;\n } else\n failed = 1;\n } else\n failed = 1;\n\n flow->ovpn_counter++;\n \n if(failed) {\n NDPI_EXCLUDE_PROTO(ndpi_struct, flow);\n }\n }\n}",
  23143. "project": "nDPI",
  23144. "hash": 292660118622334727722308632088083734812,
  23145. "size": 94,
  23146. "commit_id": "8e7b1ea7a136cc4e4aa9880072ec2d69900a825e",
  23147. "message": "Fix for potential heap-buffer-overflow in ndpi_search_openvpn",
  23148. "target": 0,
  23149. "dataset": "other",
  23150. "idx": 241321
  23151. }
  23152. ]
  23153. },
  23154. {
  23155. "call_depth": 4,
  23156. "longest_call_chain": [
  23157. "mcba_usb_read_bulk_callback",
  23158. "mcba_usb_process_rx",
  23159. "mcba_usb_process_ka_can",
  23160. "convert_can2host_bitrate"
  23161. ],
  23162. "group_size": 6,
  23163. "functions": [
  23164. {
  23165. "func": "static void mcba_usb_process_ka_can(struct mcba_priv *priv,\n\t\t\t\t struct mcba_usb_msg_ka_can *msg)\n{\n\tif (unlikely(priv->can_ka_first_pass)) {\n\t\tnetdev_info(priv->netdev, \"PIC CAN version %hhu.%hhu\\n\",\n\t\t\t msg->soft_ver_major, msg->soft_ver_minor);\n\n\t\tpriv->can_ka_first_pass = false;\n\t}\n\n\tif (unlikely(priv->can_speed_check)) {\n\t\tconst u32 bitrate = convert_can2host_bitrate(msg);\n\n\t\tpriv->can_speed_check = false;\n\n\t\tif (bitrate != priv->can.bittiming.bitrate)\n\t\t\tnetdev_err(\n\t\t\t priv->netdev,\n\t\t\t \"Wrong bitrate reported by the device (%u). Expected %u\",\n\t\t\t bitrate, priv->can.bittiming.bitrate);\n\t}\n\n\tpriv->bec.txerr = msg->tx_err_cnt;\n\tpriv->bec.rxerr = msg->rx_err_cnt;\n\n\tif (msg->tx_bus_off)\n\t\tpriv->can.state = CAN_STATE_BUS_OFF;\n\n\telse if ((priv->bec.txerr > MCBA_CAN_STATE_ERR_PSV_TH) ||\n\t\t (priv->bec.rxerr > MCBA_CAN_STATE_ERR_PSV_TH))\n\t\tpriv->can.state = CAN_STATE_ERROR_PASSIVE;\n\n\telse if ((priv->bec.txerr > MCBA_CAN_STATE_WRN_TH) ||\n\t\t (priv->bec.rxerr > MCBA_CAN_STATE_WRN_TH))\n\t\tpriv->can.state = CAN_STATE_ERROR_WARNING;\n}",
  23166. "project": "linux",
  23167. "hash": 140170198980991463076052245356814298617,
  23168. "size": 36,
  23169. "commit_id": "4d6636498c41891d0482a914dd570343a838ad79",
  23170. "message": "can: mcba_usb: fix use-after-free on disconnect\n\nThe driver was accessing its driver data after having freed it.\n\nFixes: 51f3baad7de9 (\"can: mcba_usb: Add support for Microchip CAN BUS Analyzer\")\nCc: stable <stable@vger.kernel.org> # 4.12\nCc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>\nReported-by: syzbot+e29b17e5042bbc56fae9@syzkaller.appspotmail.com\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Marc Kleine-Budde <mkl@pengutronix.de>",
  23171. "target": 0,
  23172. "dataset": "other",
  23173. "idx": 398315
  23174. },
  23175. {
  23176. "func": "static void mcba_usb_process_rx(struct mcba_priv *priv,\n\t\t\t\tstruct mcba_usb_msg *msg)\n{\n\tswitch (msg->cmd_id) {\n\tcase MBCA_CMD_I_AM_ALIVE_FROM_CAN:\n\t\tmcba_usb_process_ka_can(priv,\n\t\t\t\t\t(struct mcba_usb_msg_ka_can *)msg);\n\t\tbreak;\n\n\tcase MBCA_CMD_I_AM_ALIVE_FROM_USB:\n\t\tmcba_usb_process_ka_usb(priv,\n\t\t\t\t\t(struct mcba_usb_msg_ka_usb *)msg);\n\t\tbreak;\n\n\tcase MBCA_CMD_RECEIVE_MESSAGE:\n\t\tmcba_usb_process_can(priv, (struct mcba_usb_msg_can *)msg);\n\t\tbreak;\n\n\tcase MBCA_CMD_NOTHING_TO_SEND:\n\t\t/* Side effect of communication between PIC_USB and PIC_CAN.\n\t\t * PIC_CAN is telling us that it has nothing to send\n\t\t */\n\t\tbreak;\n\n\tcase MBCA_CMD_TRANSMIT_MESSAGE_RSP:\n\t\t/* Transmission response from the device containing timestamp */\n\t\tbreak;\n\n\tdefault:\n\t\tnetdev_warn(priv->netdev, \"Unsupported msg (0x%hhX)\",\n\t\t\t msg->cmd_id);\n\t\tbreak;\n\t}\n}",
  23177. "project": "linux",
  23178. "hash": 189816485004301915432920510029586829831,
  23179. "size": 34,
  23180. "commit_id": "4d6636498c41891d0482a914dd570343a838ad79",
  23181. "message": "can: mcba_usb: fix use-after-free on disconnect\n\nThe driver was accessing its driver data after having freed it.\n\nFixes: 51f3baad7de9 (\"can: mcba_usb: Add support for Microchip CAN BUS Analyzer\")\nCc: stable <stable@vger.kernel.org> # 4.12\nCc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>\nReported-by: syzbot+e29b17e5042bbc56fae9@syzkaller.appspotmail.com\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Marc Kleine-Budde <mkl@pengutronix.de>",
  23182. "target": 0,
  23183. "dataset": "other",
  23184. "idx": 398312
  23185. },
  23186. {
  23187. "func": "static u32 convert_can2host_bitrate(struct mcba_usb_msg_ka_can *msg)\n{\n\tconst u32 bitrate = get_unaligned_be16(&msg->can_bitrate);\n\n\tif ((bitrate == 33) || (bitrate == 83))\n\t\treturn bitrate * 1000 + 333;\n\telse\n\t\treturn bitrate * 1000;\n}",
  23188. "project": "linux",
  23189. "hash": 43142121438217021989434137757153490953,
  23190. "size": 9,
  23191. "commit_id": "4d6636498c41891d0482a914dd570343a838ad79",
  23192. "message": "can: mcba_usb: fix use-after-free on disconnect\n\nThe driver was accessing its driver data after having freed it.\n\nFixes: 51f3baad7de9 (\"can: mcba_usb: Add support for Microchip CAN BUS Analyzer\")\nCc: stable <stable@vger.kernel.org> # 4.12\nCc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>\nReported-by: syzbot+e29b17e5042bbc56fae9@syzkaller.appspotmail.com\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Marc Kleine-Budde <mkl@pengutronix.de>",
  23193. "target": 0,
  23194. "dataset": "other",
  23195. "idx": 398316
  23196. },
  23197. {
  23198. "func": "static void mcba_usb_process_ka_usb(struct mcba_priv *priv,\n\t\t\t\t struct mcba_usb_msg_ka_usb *msg)\n{\n\tif (unlikely(priv->usb_ka_first_pass)) {\n\t\tnetdev_info(priv->netdev, \"PIC USB version %hhu.%hhu\\n\",\n\t\t\t msg->soft_ver_major, msg->soft_ver_minor);\n\n\t\tpriv->usb_ka_first_pass = false;\n\t}\n\n\tif (msg->termination_state)\n\t\tpriv->can.termination = MCBA_TERMINATION_ENABLED;\n\telse\n\t\tpriv->can.termination = MCBA_TERMINATION_DISABLED;\n}",
  23199. "project": "linux",
  23200. "hash": 257496963091891816110649854790532425699,
  23201. "size": 15,
  23202. "commit_id": "4d6636498c41891d0482a914dd570343a838ad79",
  23203. "message": "can: mcba_usb: fix use-after-free on disconnect\n\nThe driver was accessing its driver data after having freed it.\n\nFixes: 51f3baad7de9 (\"can: mcba_usb: Add support for Microchip CAN BUS Analyzer\")\nCc: stable <stable@vger.kernel.org> # 4.12\nCc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>\nReported-by: syzbot+e29b17e5042bbc56fae9@syzkaller.appspotmail.com\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Marc Kleine-Budde <mkl@pengutronix.de>",
  23204. "target": 0,
  23205. "dataset": "other",
  23206. "idx": 398317
  23207. },
  23208. {
  23209. "func": "static void mcba_usb_read_bulk_callback(struct urb *urb)\n{\n\tstruct mcba_priv *priv = urb->context;\n\tstruct net_device *netdev;\n\tint retval;\n\tint pos = 0;\n\n\tnetdev = priv->netdev;\n\n\tif (!netif_device_present(netdev))\n\t\treturn;\n\n\tswitch (urb->status) {\n\tcase 0: /* success */\n\t\tbreak;\n\n\tcase -ENOENT:\n\tcase -EPIPE:\n\tcase -EPROTO:\n\tcase -ESHUTDOWN:\n\t\treturn;\n\n\tdefault:\n\t\tnetdev_info(netdev, \"Rx URB aborted (%d)\\n\", urb->status);\n\n\t\tgoto resubmit_urb;\n\t}\n\n\twhile (pos < urb->actual_length) {\n\t\tstruct mcba_usb_msg *msg;\n\n\t\tif (pos + sizeof(struct mcba_usb_msg) > urb->actual_length) {\n\t\t\tnetdev_err(priv->netdev, \"format error\\n\");\n\t\t\tbreak;\n\t\t}\n\n\t\tmsg = (struct mcba_usb_msg *)(urb->transfer_buffer + pos);\n\t\tmcba_usb_process_rx(priv, msg);\n\n\t\tpos += sizeof(struct mcba_usb_msg);\n\t}\n\nresubmit_urb:\n\n\tusb_fill_bulk_urb(urb, priv->udev,\n\t\t\t usb_rcvbulkpipe(priv->udev, MCBA_USB_EP_OUT),\n\t\t\t urb->transfer_buffer, MCBA_USB_RX_BUFF_SIZE,\n\t\t\t mcba_usb_read_bulk_callback, priv);\n\n\tretval = usb_submit_urb(urb, GFP_ATOMIC);\n\n\tif (retval == -ENODEV)\n\t\tnetif_device_detach(netdev);\n\telse if (retval)\n\t\tnetdev_err(netdev, \"failed resubmitting read bulk urb: %d\\n\",\n\t\t\t retval);\n}",
  23210. "project": "linux",
  23211. "hash": 208190292833943165204243409532616932390,
  23212. "size": 57,
  23213. "commit_id": "4d6636498c41891d0482a914dd570343a838ad79",
  23214. "message": "can: mcba_usb: fix use-after-free on disconnect\n\nThe driver was accessing its driver data after having freed it.\n\nFixes: 51f3baad7de9 (\"can: mcba_usb: Add support for Microchip CAN BUS Analyzer\")\nCc: stable <stable@vger.kernel.org> # 4.12\nCc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>\nReported-by: syzbot+e29b17e5042bbc56fae9@syzkaller.appspotmail.com\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Marc Kleine-Budde <mkl@pengutronix.de>",
  23215. "target": 0,
  23216. "dataset": "other",
  23217. "idx": 398319
  23218. },
  23219. {
  23220. "func": "static void mcba_usb_process_can(struct mcba_priv *priv,\n\t\t\t\t struct mcba_usb_msg_can *msg)\n{\n\tstruct can_frame *cf;\n\tstruct sk_buff *skb;\n\tstruct net_device_stats *stats = &priv->netdev->stats;\n\tu16 sid;\n\n\tskb = alloc_can_skb(priv->netdev, &cf);\n\tif (!skb)\n\t\treturn;\n\n\tsid = get_unaligned_be16(&msg->sid);\n\n\tif (sid & MCBA_SIDL_EXID_MASK) {\n\t\t/* SIDH | SIDL | EIDH | EIDL\n\t\t * 28 - 21 | 20 19 18 x x x 17 16 | 15 - 8 | 7 - 0\n\t\t */\n\t\tcf->can_id = CAN_EFF_FLAG;\n\n\t\t/* store 28-18 bits */\n\t\tcf->can_id |= (sid & 0xffe0) << 13;\n\t\t/* store 17-16 bits */\n\t\tcf->can_id |= (sid & 3) << 16;\n\t\t/* store 15-0 bits */\n\t\tcf->can_id |= get_unaligned_be16(&msg->eid);\n\t} else {\n\t\t/* SIDH | SIDL\n\t\t * 10 - 3 | 2 1 0 x x x x x\n\t\t */\n\t\tcf->can_id = (sid & 0xffe0) >> 5;\n\t}\n\n\tif (msg->dlc & MCBA_DLC_RTR_MASK)\n\t\tcf->can_id |= CAN_RTR_FLAG;\n\n\tcf->can_dlc = get_can_dlc(msg->dlc & MCBA_DLC_MASK);\n\n\tmemcpy(cf->data, msg->data, cf->can_dlc);\n\n\tstats->rx_packets++;\n\tstats->rx_bytes += cf->can_dlc;\n\n\tcan_led_event(priv->netdev, CAN_LED_EVENT_RX);\n\tnetif_rx(skb);\n}",
  23221. "project": "linux",
  23222. "hash": 23500088538058214849151320036811999510,
  23223. "size": 46,
  23224. "commit_id": "4d6636498c41891d0482a914dd570343a838ad79",
  23225. "message": "can: mcba_usb: fix use-after-free on disconnect\n\nThe driver was accessing its driver data after having freed it.\n\nFixes: 51f3baad7de9 (\"can: mcba_usb: Add support for Microchip CAN BUS Analyzer\")\nCc: stable <stable@vger.kernel.org> # 4.12\nCc: Remigiusz Kołłątaj <remigiusz.kollataj@mobica.com>\nReported-by: syzbot+e29b17e5042bbc56fae9@syzkaller.appspotmail.com\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Marc Kleine-Budde <mkl@pengutronix.de>",
  23226. "target": 0,
  23227. "dataset": "other",
  23228. "idx": 398309
  23229. }
  23230. ]
  23231. },
  23232. {
  23233. "call_depth": 3,
  23234. "longest_call_chain": [
  23235. "sm501_realize_pci",
  23236. "sm501_init",
  23237. "get_local_mem_size_index"
  23238. ],
  23239. "group_size": 4,
  23240. "functions": [
  23241. {
  23242. "func": "static void sm501_realize_pci(PCIDevice *dev, Error **errp)\n{\n SM501PCIState *s = PCI_SM501(dev);\n\n sm501_init(&s->state, DEVICE(dev), s->vram_size);\n if (get_local_mem_size(&s->state) != s->vram_size) {\n error_setg(errp, \"Invalid VRAM size, nearest valid size is %\" PRIu32,\n get_local_mem_size(&s->state));\n return;\n }\n pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_MEMORY,\n &s->state.local_mem_region);\n pci_register_bar(dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,\n &s->state.mmio_region);\n}",
  23243. "project": "qemu",
  23244. "hash": 144713306371724119714333384248856472135,
  23245. "size": 15,
  23246. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  23247. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  23248. "target": 0,
  23249. "dataset": "other",
  23250. "idx": 367024
  23251. },
  23252. {
  23253. "func": "static void sm501_init(SM501State *s, DeviceState *dev,\n uint32_t local_mem_bytes)\n{\n s->local_mem_size_index = get_local_mem_size_index(local_mem_bytes);\n SM501_DPRINTF(\"sm501 local mem size=%x. index=%d\\n\", get_local_mem_size(s),\n s->local_mem_size_index);\n\n /* local memory */\n memory_region_init_ram(&s->local_mem_region, OBJECT(dev), \"sm501.local\",\n get_local_mem_size(s), &error_fatal);\n memory_region_set_log(&s->local_mem_region, true, DIRTY_MEMORY_VGA);\n s->local_mem = memory_region_get_ram_ptr(&s->local_mem_region);\n\n /* i2c */\n s->i2c_bus = i2c_init_bus(dev, \"sm501.i2c\");\n /* ddc */\n I2CDDCState *ddc = I2CDDC(qdev_create(BUS(s->i2c_bus), TYPE_I2CDDC));\n i2c_set_slave_address(I2C_SLAVE(ddc), 0x50);\n\n /* mmio */\n memory_region_init(&s->mmio_region, OBJECT(dev), \"sm501.mmio\", MMIO_SIZE);\n memory_region_init_io(&s->system_config_region, OBJECT(dev),\n &sm501_system_config_ops, s,\n \"sm501-system-config\", 0x6c);\n memory_region_add_subregion(&s->mmio_region, SM501_SYS_CONFIG,\n &s->system_config_region);\n memory_region_init_io(&s->i2c_region, OBJECT(dev), &sm501_i2c_ops, s,\n \"sm501-i2c\", 0x14);\n memory_region_add_subregion(&s->mmio_region, SM501_I2C, &s->i2c_region);\n memory_region_init_io(&s->disp_ctrl_region, OBJECT(dev),\n &sm501_disp_ctrl_ops, s,\n \"sm501-disp-ctrl\", 0x1000);\n memory_region_add_subregion(&s->mmio_region, SM501_DC,\n &s->disp_ctrl_region);\n memory_region_init_io(&s->twoD_engine_region, OBJECT(dev),\n &sm501_2d_engine_ops, s,\n \"sm501-2d-engine\", 0x54);\n memory_region_add_subregion(&s->mmio_region, SM501_2D_ENGINE,\n &s->twoD_engine_region);\n\n /* create qemu graphic console */\n s->con = graphic_console_init(dev, 0, &sm501_ops, s);\n}",
  23254. "project": "qemu",
  23255. "hash": 104269598637669238108852798989784235136,
  23256. "size": 43,
  23257. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  23258. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  23259. "target": 0,
  23260. "dataset": "other",
  23261. "idx": 367053
  23262. },
  23263. {
  23264. "func": "static uint32_t get_local_mem_size_index(uint32_t size)\n{\n uint32_t norm_size = 0;\n int i, index = 0;\n\n for (i = 0; i < ARRAY_SIZE(sm501_mem_local_size); i++) {\n uint32_t new_size = sm501_mem_local_size[i];\n if (new_size >= size) {\n if (norm_size == 0 || norm_size > new_size) {\n norm_size = new_size;\n index = i;\n }\n }\n }\n\n return index;\n}",
  23265. "project": "qemu",
  23266. "hash": 33796380822377304247174669801145287606,
  23267. "size": 17,
  23268. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  23269. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  23270. "target": 0,
  23271. "dataset": "other",
  23272. "idx": 367026
  23273. },
  23274. {
  23275. "func": "static void sm501_realize_sysbus(DeviceState *dev, Error **errp)\n{\n SM501SysBusState *s = SYSBUS_SM501(dev);\n SysBusDevice *sbd = SYS_BUS_DEVICE(dev);\n DeviceState *usb_dev;\n MemoryRegion *mr;\n\n sm501_init(&s->state, dev, s->vram_size);\n if (get_local_mem_size(&s->state) != s->vram_size) {\n error_setg(errp, \"Invalid VRAM size, nearest valid size is %\" PRIu32,\n get_local_mem_size(&s->state));\n return;\n }\n sysbus_init_mmio(sbd, &s->state.local_mem_region);\n sysbus_init_mmio(sbd, &s->state.mmio_region);\n\n /* bridge to usb host emulation module */\n usb_dev = qdev_create(NULL, \"sysbus-ohci\");\n qdev_prop_set_uint32(usb_dev, \"num-ports\", 2);\n qdev_prop_set_uint64(usb_dev, \"dma-offset\", s->base);\n qdev_init_nofail(usb_dev);\n memory_region_add_subregion(&s->state.mmio_region, SM501_USB_HOST,\n sysbus_mmio_get_region(SYS_BUS_DEVICE(usb_dev), 0));\n sysbus_pass_irq(sbd, SYS_BUS_DEVICE(usb_dev));\n\n /* bridge to serial emulation module */\n qdev_init_nofail(DEVICE(&s->serial));\n mr = sysbus_mmio_get_region(SYS_BUS_DEVICE(&s->serial), 0);\n memory_region_add_subregion(&s->state.mmio_region, SM501_UART0, mr);\n /* TODO : chain irq to IRL */\n}",
  23276. "project": "qemu",
  23277. "hash": 109921215156051742238684666341467421330,
  23278. "size": 31,
  23279. "commit_id": "b15a22bbcbe6a78dc3d88fe3134985e4cdd87de4",
  23280. "message": "sm501: Replace hand written implementation with pixman where possible\n\nBesides being faster this should also prevent malicious guests to\nabuse 2D engine to overwrite data or cause a crash.\n\nSigned-off-by: BALATON Zoltan <balaton@eik.bme.hu>\nMessage-id: 58666389b6cae256e4e972a32c05cf8aa51bffc0.1590089984.git.balaton@eik.bme.hu\nSigned-off-by: Gerd Hoffmann <kraxel@redhat.com>",
  23281. "target": 0,
  23282. "dataset": "other",
  23283. "idx": 367027
  23284. }
  23285. ]
  23286. },
  23287. {
  23288. "call_depth": 3,
  23289. "longest_call_chain": [
  23290. "setexCommand",
  23291. "setGenericCommand",
  23292. "getGenericCommand"
  23293. ],
  23294. "group_size": 17,
  23295. "functions": [
  23296. {
  23297. "func": "int parseExtendedStringArgumentsOrReply(client *c, int *flags, int *unit, robj **expire, int command_type) {\n\n int j = command_type == COMMAND_GET ? 2 : 3;\n for (; j < c->argc; j++) {\n char *opt = c->argv[j]->ptr;\n robj *next = (j == c->argc-1) ? NULL : c->argv[j+1];\n\n if ((opt[0] == 'n' || opt[0] == 'N') &&\n (opt[1] == 'x' || opt[1] == 'X') && opt[2] == '\\0' &&\n !(*flags & OBJ_SET_XX) && !(*flags & OBJ_SET_GET) && (command_type == COMMAND_SET))\n {\n *flags |= OBJ_SET_NX;\n } else if ((opt[0] == 'x' || opt[0] == 'X') &&\n (opt[1] == 'x' || opt[1] == 'X') && opt[2] == '\\0' &&\n !(*flags & OBJ_SET_NX) && (command_type == COMMAND_SET))\n {\n *flags |= OBJ_SET_XX;\n } else if ((opt[0] == 'g' || opt[0] == 'G') &&\n (opt[1] == 'e' || opt[1] == 'E') &&\n (opt[2] == 't' || opt[2] == 'T') && opt[3] == '\\0' &&\n !(*flags & OBJ_SET_NX) && (command_type == COMMAND_SET))\n {\n *flags |= OBJ_SET_GET;\n } else if (!strcasecmp(opt, \"KEEPTTL\") && !(*flags & OBJ_PERSIST) &&\n !(*flags & OBJ_EX) && !(*flags & OBJ_EXAT) &&\n !(*flags & OBJ_PX) && !(*flags & OBJ_PXAT) && (command_type == COMMAND_SET))\n {\n *flags |= OBJ_KEEPTTL;\n } else if (!strcasecmp(opt,\"PERSIST\") && (command_type == COMMAND_GET) &&\n !(*flags & OBJ_EX) && !(*flags & OBJ_EXAT) &&\n !(*flags & OBJ_PX) && !(*flags & OBJ_PXAT) &&\n !(*flags & OBJ_KEEPTTL))\n {\n *flags |= OBJ_PERSIST;\n } else if ((opt[0] == 'e' || opt[0] == 'E') &&\n (opt[1] == 'x' || opt[1] == 'X') && opt[2] == '\\0' &&\n !(*flags & OBJ_KEEPTTL) && !(*flags & OBJ_PERSIST) &&\n !(*flags & OBJ_EXAT) && !(*flags & OBJ_PX) &&\n !(*flags & OBJ_PXAT) && next)\n {\n *flags |= OBJ_EX;\n *expire = next;\n j++;\n } else if ((opt[0] == 'p' || opt[0] == 'P') &&\n (opt[1] == 'x' || opt[1] == 'X') && opt[2] == '\\0' &&\n !(*flags & OBJ_KEEPTTL) && !(*flags & OBJ_PERSIST) &&\n !(*flags & OBJ_EX) && !(*flags & OBJ_EXAT) &&\n !(*flags & OBJ_PXAT) && next)\n {\n *flags |= OBJ_PX;\n *unit = UNIT_MILLISECONDS;\n *expire = next;\n j++;\n } else if ((opt[0] == 'e' || opt[0] == 'E') &&\n (opt[1] == 'x' || opt[1] == 'X') &&\n (opt[2] == 'a' || opt[2] == 'A') &&\n (opt[3] == 't' || opt[3] == 'T') && opt[4] == '\\0' &&\n !(*flags & OBJ_KEEPTTL) && !(*flags & OBJ_PERSIST) &&\n !(*flags & OBJ_EX) && !(*flags & OBJ_PX) &&\n !(*flags & OBJ_PXAT) && next)\n {\n *flags |= OBJ_EXAT;\n *expire = next;\n j++;\n } else if ((opt[0] == 'p' || opt[0] == 'P') &&\n (opt[1] == 'x' || opt[1] == 'X') &&\n (opt[2] == 'a' || opt[2] == 'A') &&\n (opt[3] == 't' || opt[3] == 'T') && opt[4] == '\\0' &&\n !(*flags & OBJ_KEEPTTL) && !(*flags & OBJ_PERSIST) &&\n !(*flags & OBJ_EX) && !(*flags & OBJ_EXAT) &&\n !(*flags & OBJ_PX) && next)\n {\n *flags |= OBJ_PXAT;\n *unit = UNIT_MILLISECONDS;\n *expire = next;\n j++;\n } else {\n addReplyErrorObject(c,shared.syntaxerr);\n return C_ERR;\n }\n }\n return C_OK;\n}",
  23298. "project": "redis",
  23299. "hash": 9745977651932863314638640421529443271,
  23300. "size": 83,
  23301. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23302. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23303. "target": 0,
  23304. "dataset": "other",
  23305. "idx": 455369
  23306. },
  23307. {
  23308. "func": "void setexCommand(client *c) {\n c->argv[3] = tryObjectEncoding(c->argv[3]);\n setGenericCommand(c,OBJ_SET_NO_FLAGS,c->argv[1],c->argv[3],c->argv[2],UNIT_SECONDS,NULL,NULL);\n}",
  23309. "project": "redis",
  23310. "hash": 320351795325676263281802472065208820045,
  23311. "size": 4,
  23312. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23313. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23314. "target": 0,
  23315. "dataset": "other",
  23316. "idx": 361284
  23317. },
  23318. {
  23319. "func": "void setexCommand(client *c) {\n c->argv[3] = tryObjectEncoding(c->argv[3]);\n setGenericCommand(c,OBJ_EX,c->argv[1],c->argv[3],c->argv[2],UNIT_SECONDS,NULL,NULL);\n}",
  23320. "project": "redis",
  23321. "hash": 203852551280588228060624897470495205364,
  23322. "size": 4,
  23323. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23324. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23325. "target": 0,
  23326. "dataset": "other",
  23327. "idx": 455372
  23328. },
  23329. {
  23330. "func": "void psetexCommand(client *c) {\n c->argv[3] = tryObjectEncoding(c->argv[3]);\n setGenericCommand(c,OBJ_SET_NO_FLAGS,c->argv[1],c->argv[3],c->argv[2],UNIT_MILLISECONDS,NULL,NULL);\n}",
  23331. "project": "redis",
  23332. "hash": 53358964946490230184504727372010691589,
  23333. "size": 4,
  23334. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23335. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23336. "target": 0,
  23337. "dataset": "other",
  23338. "idx": 361280
  23339. },
  23340. {
  23341. "func": "void psetexCommand(client *c) {\n c->argv[3] = tryObjectEncoding(c->argv[3]);\n setGenericCommand(c,OBJ_PX,c->argv[1],c->argv[3],c->argv[2],UNIT_MILLISECONDS,NULL,NULL);\n}",
  23342. "project": "redis",
  23343. "hash": 34220207700011214991153271160461520202,
  23344. "size": 4,
  23345. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23346. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23347. "target": 0,
  23348. "dataset": "other",
  23349. "idx": 455371
  23350. },
  23351. {
  23352. "func": "void getexCommand(client *c) {\n robj *expire = NULL;\n int unit = UNIT_SECONDS;\n int flags = OBJ_NO_FLAGS;\n\n if (parseExtendedStringArgumentsOrReply(c,&flags,&unit,&expire,COMMAND_GET) != C_OK) {\n return;\n }\n\n robj *o;\n\n if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp])) == NULL)\n return;\n\n if (checkType(c,o,OBJ_STRING)) {\n return;\n }\n\n long long milliseconds = 0, when = 0;\n\n /* Validate the expiration time value first */\n if (expire) {\n if (getLongLongFromObjectOrReply(c, expire, &milliseconds, NULL) != C_OK)\n return;\n if (milliseconds <= 0 || (unit == UNIT_SECONDS && milliseconds > LLONG_MAX / 1000)) {\n /* Negative value provided or multiplication is gonna overflow. */\n addReplyErrorFormat(c, \"invalid expire time in %s\", c->cmd->name);\n return;\n }\n if (unit == UNIT_SECONDS) milliseconds *= 1000;\n when = milliseconds;\n if ((flags & OBJ_PX) || (flags & OBJ_EX))\n when += mstime();\n if (when <= 0) {\n /* Overflow detected. */\n addReplyErrorFormat(c, \"invalid expire time in %s\", c->cmd->name);\n return;\n }\n }\n\n /* We need to do this before we expire the key or delete it */\n addReplyBulk(c,o);\n\n /* This command is never propagated as is. It is either propagated as PEXPIRE[AT],DEL,UNLINK or PERSIST.\n * This why it doesn't need special handling in feedAppendOnlyFile to convert relative expire time to absolute one. */\n if (((flags & OBJ_PXAT) || (flags & OBJ_EXAT)) && checkAlreadyExpired(milliseconds)) {\n /* When PXAT/EXAT absolute timestamp is specified, there can be a chance that timestamp\n * has already elapsed so delete the key in that case. */\n int deleted = server.lazyfree_lazy_expire ? dbAsyncDelete(c->db, c->argv[1]) :\n dbSyncDelete(c->db, c->argv[1]);\n serverAssert(deleted);\n robj *aux = server.lazyfree_lazy_expire ? shared.unlink : shared.del;\n rewriteClientCommandVector(c,2,aux,c->argv[1]);\n signalModifiedKey(c, c->db, c->argv[1]);\n notifyKeyspaceEvent(NOTIFY_GENERIC, \"del\", c->argv[1], c->db->id);\n server.dirty++;\n } else if (expire) {\n setExpire(c,c->db,c->argv[1],when);\n /* Propagate */\n robj *exp = (flags & OBJ_PXAT) || (flags & OBJ_EXAT) ? shared.pexpireat : shared.pexpire;\n robj* millisecondObj = createStringObjectFromLongLong(milliseconds);\n rewriteClientCommandVector(c,3,exp,c->argv[1],millisecondObj);\n decrRefCount(millisecondObj);\n signalModifiedKey(c, c->db, c->argv[1]);\n notifyKeyspaceEvent(NOTIFY_GENERIC,\"expire\",c->argv[1],c->db->id);\n server.dirty++;\n } else if (flags & OBJ_PERSIST) {\n if (removeExpire(c->db, c->argv[1])) {\n signalModifiedKey(c, c->db, c->argv[1]);\n rewriteClientCommandVector(c, 2, shared.persist, c->argv[1]);\n notifyKeyspaceEvent(NOTIFY_GENERIC,\"persist\",c->argv[1],c->db->id);\n server.dirty++;\n }\n }\n}",
  23353. "project": "redis",
  23354. "hash": 63387699981613464245631282382235374987,
  23355. "size": 75,
  23356. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23357. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23358. "target": 0,
  23359. "dataset": "other",
  23360. "idx": 455367
  23361. },
  23362. {
  23363. "func": "void getsetCommand(client *c) {\n if (getGenericCommand(c) == C_ERR) return;\n c->argv[2] = tryObjectEncoding(c->argv[2]);\n setKey(c,c->db,c->argv[1],c->argv[2]);\n notifyKeyspaceEvent(NOTIFY_STRING,\"set\",c->argv[1],c->db->id);\n server.dirty++;\n}",
  23364. "project": "redis",
  23365. "hash": 94972550429943072831072727661386283901,
  23366. "size": 7,
  23367. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23368. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23369. "target": 0,
  23370. "dataset": "other",
  23371. "idx": 361271
  23372. },
  23373. {
  23374. "func": "void getsetCommand(client *c) {\n if (getGenericCommand(c) == C_ERR) return;\n c->argv[2] = tryObjectEncoding(c->argv[2]);\n setKey(c,c->db,c->argv[1],c->argv[2]);\n notifyKeyspaceEvent(NOTIFY_STRING,\"set\",c->argv[1],c->db->id);\n server.dirty++;\n\n /* Propagate as SET command */\n rewriteClientCommandArgument(c,0,shared.set);\n}",
  23375. "project": "redis",
  23376. "hash": 68134555716241316958005948130915660337,
  23377. "size": 10,
  23378. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23379. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23380. "target": 0,
  23381. "dataset": "other",
  23382. "idx": 455374
  23383. },
  23384. {
  23385. "func": "void setCommand(client *c) {\n int j;\n robj *expire = NULL;\n int unit = UNIT_SECONDS;\n int flags = OBJ_SET_NO_FLAGS;\n\n for (j = 3; j < c->argc; j++) {\n char *a = c->argv[j]->ptr;\n robj *next = (j == c->argc-1) ? NULL : c->argv[j+1];\n\n if ((a[0] == 'n' || a[0] == 'N') &&\n (a[1] == 'x' || a[1] == 'X') && a[2] == '\\0' &&\n !(flags & OBJ_SET_XX))\n {\n flags |= OBJ_SET_NX;\n } else if ((a[0] == 'x' || a[0] == 'X') &&\n (a[1] == 'x' || a[1] == 'X') && a[2] == '\\0' &&\n !(flags & OBJ_SET_NX))\n {\n flags |= OBJ_SET_XX;\n } else if (!strcasecmp(c->argv[j]->ptr,\"KEEPTTL\") &&\n !(flags & OBJ_SET_EX) && !(flags & OBJ_SET_PX))\n {\n flags |= OBJ_SET_KEEPTTL;\n } else if ((a[0] == 'e' || a[0] == 'E') &&\n (a[1] == 'x' || a[1] == 'X') && a[2] == '\\0' &&\n !(flags & OBJ_SET_KEEPTTL) &&\n !(flags & OBJ_SET_PX) && next)\n {\n flags |= OBJ_SET_EX;\n unit = UNIT_SECONDS;\n expire = next;\n j++;\n } else if ((a[0] == 'p' || a[0] == 'P') &&\n (a[1] == 'x' || a[1] == 'X') && a[2] == '\\0' &&\n !(flags & OBJ_SET_KEEPTTL) &&\n !(flags & OBJ_SET_EX) && next)\n {\n flags |= OBJ_SET_PX;\n unit = UNIT_MILLISECONDS;\n expire = next;\n j++;\n } else {\n addReply(c,shared.syntaxerr);\n return;\n }\n }\n\n c->argv[2] = tryObjectEncoding(c->argv[2]);\n setGenericCommand(c,flags,c->argv[1],c->argv[2],expire,unit,NULL,NULL);\n}",
  23386. "project": "redis",
  23387. "hash": 91886403509668796195338531027146587179,
  23388. "size": 51,
  23389. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23390. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23391. "target": 0,
  23392. "dataset": "other",
  23393. "idx": 361264
  23394. },
  23395. {
  23396. "func": "void setCommand(client *c) {\n robj *expire = NULL;\n int unit = UNIT_SECONDS;\n int flags = OBJ_NO_FLAGS;\n\n if (parseExtendedStringArgumentsOrReply(c,&flags,&unit,&expire,COMMAND_SET) != C_OK) {\n return;\n }\n\n c->argv[2] = tryObjectEncoding(c->argv[2]);\n setGenericCommand(c,flags,c->argv[1],c->argv[2],expire,unit,NULL,NULL);\n}",
  23397. "project": "redis",
  23398. "hash": 64802084236388221862659417799647346961,
  23399. "size": 12,
  23400. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23401. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23402. "target": 0,
  23403. "dataset": "other",
  23404. "idx": 455370
  23405. },
  23406. {
  23407. "func": "void getdelCommand(client *c) {\n if (getGenericCommand(c) == C_ERR) return;\n int deleted = server.lazyfree_lazy_user_del ? dbAsyncDelete(c->db, c->argv[1]) :\n dbSyncDelete(c->db, c->argv[1]);\n if (deleted) {\n /* Propagate as DEL/UNLINK command */\n robj *aux = server.lazyfree_lazy_user_del ? shared.unlink : shared.del;\n rewriteClientCommandVector(c,2,aux,c->argv[1]);\n signalModifiedKey(c, c->db, c->argv[1]);\n notifyKeyspaceEvent(NOTIFY_GENERIC, \"del\", c->argv[1], c->db->id);\n server.dirty++;\n }\n}",
  23408. "project": "redis",
  23409. "hash": 157239275695633546438790196586044971099,
  23410. "size": 13,
  23411. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23412. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23413. "target": 0,
  23414. "dataset": "other",
  23415. "idx": 455375
  23416. },
  23417. {
  23418. "func": "int getGenericCommand(client *c) {\n robj *o;\n\n if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp])) == NULL)\n return C_OK;\n\n if (o->type != OBJ_STRING) {\n addReply(c,shared.wrongtypeerr);\n return C_ERR;\n } else {\n addReplyBulk(c,o);\n return C_OK;\n }\n}",
  23419. "project": "redis",
  23420. "hash": 249750839888082609174076017357600788579,
  23421. "size": 14,
  23422. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23423. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23424. "target": 0,
  23425. "dataset": "other",
  23426. "idx": 361274
  23427. },
  23428. {
  23429. "func": "int getGenericCommand(client *c) {\n robj *o;\n\n if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.null[c->resp])) == NULL)\n return C_OK;\n\n if (checkType(c,o,OBJ_STRING)) {\n return C_ERR;\n }\n\n addReplyBulk(c,o);\n return C_OK;\n}",
  23430. "project": "redis",
  23431. "hash": 156224148856405155848333206438559518113,
  23432. "size": 13,
  23433. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23434. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23435. "target": 0,
  23436. "dataset": "other",
  23437. "idx": 455376
  23438. },
  23439. {
  23440. "func": "void setGenericCommand(client *c, int flags, robj *key, robj *val, robj *expire, int unit, robj *ok_reply, robj *abort_reply) {\n long long milliseconds = 0; /* initialized to avoid any harmness warning */\n\n if (expire) {\n if (getLongLongFromObjectOrReply(c, expire, &milliseconds, NULL) != C_OK)\n return;\n if (milliseconds <= 0) {\n addReplyErrorFormat(c,\"invalid expire time in %s\",c->cmd->name);\n return;\n }\n if (unit == UNIT_SECONDS) milliseconds *= 1000;\n }\n\n if ((flags & OBJ_SET_NX && lookupKeyWrite(c->db,key) != NULL) ||\n (flags & OBJ_SET_XX && lookupKeyWrite(c->db,key) == NULL))\n {\n addReply(c, abort_reply ? abort_reply : shared.null[c->resp]);\n return;\n }\n genericSetKey(c,c->db,key,val,flags & OBJ_SET_KEEPTTL,1);\n server.dirty++;\n if (expire) setExpire(c,c->db,key,mstime()+milliseconds);\n notifyKeyspaceEvent(NOTIFY_STRING,\"set\",key,c->db->id);\n if (expire) notifyKeyspaceEvent(NOTIFY_GENERIC,\n \"expire\",key,c->db->id);\n addReply(c, ok_reply ? ok_reply : shared.ok);\n}",
  23441. "project": "redis",
  23442. "hash": 210837059235347050170677735565531600190,
  23443. "size": 27,
  23444. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23445. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23446. "target": 0,
  23447. "dataset": "other",
  23448. "idx": 361276
  23449. },
  23450. {
  23451. "func": "void setGenericCommand(client *c, int flags, robj *key, robj *val, robj *expire, int unit, robj *ok_reply, robj *abort_reply) {\n long long milliseconds = 0, when = 0; /* initialized to avoid any harmness warning */\n\n if (expire) {\n if (getLongLongFromObjectOrReply(c, expire, &milliseconds, NULL) != C_OK)\n return;\n if (milliseconds <= 0 || (unit == UNIT_SECONDS && milliseconds > LLONG_MAX / 1000)) {\n /* Negative value provided or multiplication is gonna overflow. */\n addReplyErrorFormat(c, \"invalid expire time in %s\", c->cmd->name);\n return;\n }\n if (unit == UNIT_SECONDS) milliseconds *= 1000;\n when = milliseconds;\n if ((flags & OBJ_PX) || (flags & OBJ_EX))\n when += mstime();\n if (when <= 0) {\n /* Overflow detected. */\n addReplyErrorFormat(c, \"invalid expire time in %s\", c->cmd->name);\n return;\n }\n }\n\n if ((flags & OBJ_SET_NX && lookupKeyWrite(c->db,key) != NULL) ||\n (flags & OBJ_SET_XX && lookupKeyWrite(c->db,key) == NULL))\n {\n addReply(c, abort_reply ? abort_reply : shared.null[c->resp]);\n return;\n }\n\n if (flags & OBJ_SET_GET) {\n if (getGenericCommand(c) == C_ERR) return;\n }\n\n genericSetKey(c,c->db,key, val,flags & OBJ_KEEPTTL,1);\n server.dirty++;\n notifyKeyspaceEvent(NOTIFY_STRING,\"set\",key,c->db->id);\n if (expire) {\n setExpire(c,c->db,key,when);\n notifyKeyspaceEvent(NOTIFY_GENERIC,\"expire\",key,c->db->id);\n\n /* Propagate as SET Key Value PXAT millisecond-timestamp if there is EXAT/PXAT or\n * propagate as SET Key Value PX millisecond if there is EX/PX flag.\n *\n * Additionally when we propagate the SET with PX (relative millisecond) we translate\n * it again to SET with PXAT for the AOF.\n *\n * Additional care is required while modifying the argument order. AOF relies on the\n * exp argument being at index 3. (see feedAppendOnlyFile)\n * */\n robj *exp = (flags & OBJ_PXAT) || (flags & OBJ_EXAT) ? shared.pxat : shared.px;\n robj *millisecondObj = createStringObjectFromLongLong(milliseconds);\n rewriteClientCommandVector(c,5,shared.set,key,val,exp,millisecondObj);\n decrRefCount(millisecondObj);\n }\n if (!(flags & OBJ_SET_GET)) {\n addReply(c, ok_reply ? ok_reply : shared.ok);\n }\n\n /* Propagate without the GET argument (Isn't needed if we had expire since in that case we completely re-written the command argv) */\n if ((flags & OBJ_SET_GET) && !expire) {\n int argc = 0;\n int j;\n robj **argv = zmalloc((c->argc-1)*sizeof(robj*));\n for (j=0; j < c->argc; j++) {\n char *a = c->argv[j]->ptr;\n /* Skip GET which may be repeated multiple times. */\n if (j >= 3 &&\n (a[0] == 'g' || a[0] == 'G') &&\n (a[1] == 'e' || a[1] == 'E') &&\n (a[2] == 't' || a[2] == 'T') && a[3] == '\\0')\n continue;\n argv[argc++] = c->argv[j];\n incrRefCount(c->argv[j]);\n }\n replaceClientCommandVector(c, argc, argv);\n }\n}",
  23452. "project": "redis",
  23453. "hash": 303786546363084861292201254389148319471,
  23454. "size": 77,
  23455. "commit_id": "92e3b1802f72ca0c5b0bde97f01d9b57a758d85c",
  23456. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23457. "target": 0,
  23458. "dataset": "other",
  23459. "idx": 455378
  23460. },
  23461. {
  23462. "func": "void getCommand(client *c) {\n getGenericCommand(c);\n}",
  23463. "project": "redis",
  23464. "hash": 66252008273459784549584533383612684503,
  23465. "size": 3,
  23466. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23467. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23468. "target": 0,
  23469. "dataset": "other",
  23470. "idx": 361282
  23471. },
  23472. {
  23473. "func": "void setnxCommand(client *c) {\n c->argv[2] = tryObjectEncoding(c->argv[2]);\n setGenericCommand(c,OBJ_SET_NX,c->argv[1],c->argv[2],NULL,0,shared.cone,shared.czero);\n}",
  23474. "project": "redis",
  23475. "hash": 86025564155259990123287870176854249532,
  23476. "size": 4,
  23477. "commit_id": "394614a5f91d88380f480c4610926a865b5b0f16",
  23478. "message": "Fix integer overflow in STRALGO LCS (CVE-2021-29477)\n\nAn integer overflow bug in Redis version 6.0 or newer could be exploited using\nthe STRALGO LCS command to corrupt the heap and potentially result with remote\ncode execution.\n\n(cherry picked from commit f0c5f920d0f88bd8aa376a2c05af4902789d1ef9)",
  23479. "target": 0,
  23480. "dataset": "other",
  23481. "idx": 361277
  23482. }
  23483. ]
  23484. },
  23485. {
  23486. "call_depth": 4,
  23487. "longest_call_chain": [
  23488. "~XMLTree",
  23489. "XMLTree",
  23490. "read_internal",
  23491. "xmlKeepBlanksDefault"
  23492. ],
  23493. "group_size": 7,
  23494. "functions": [
  23495. {
  23496. "project": "ardour",
  23497. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  23498. "target": 0,
  23499. "func": "XMLTree::read_internal(bool validate)\n{\n\t//shouldnt be used anywhere ATM, remove if so!\n\tassert(!validate);\n\n\tdelete _root;\n\t_root = 0;\n\n\tif (_doc) {\n\t\txmlFreeDoc (_doc);\n\t\t_doc = 0;\n\t}\n\n\t/* Calling this prevents libxml2 from treating whitespace as active\n\t nodes. It needs to be called before we create a parser context.\n\t*/\n\txmlKeepBlanksDefault(0);\n\n\t/* create a parser context */\n\txmlParserCtxtPtr ctxt = xmlNewParserCtxt();\n\tif (ctxt == NULL) {\n\t\treturn false;\n\t}\n\n\t/* parse the file, activating the DTD validation option */\n\tif (validate) {\n\t\t_doc = xmlCtxtReadFile(ctxt, _filename.c_str(), NULL, XML_PARSE_DTDVALID);\n\t} else {\n\t\t_doc = xmlCtxtReadFile(ctxt, _filename.c_str(), NULL, XML_PARSE_HUGE);\n\t}\n\n\t/* check if parsing suceeded */\n\tif (_doc == NULL) {\n\t\txmlFreeParserCtxt(ctxt);\n\t\treturn false;\n\t} else {\n\t\t/* check if validation suceeded */\n\t\tif (validate && ctxt->valid == 0) {\n\t\t\txmlFreeParserCtxt(ctxt);\n\t\t\tthrow XMLException(\"Failed to validate document \" + _filename);\n\t\t}\n\t}\n\n\t_root = readnode(xmlDocGetRootElement(_doc));\n\n\t/* free up the parser context */\n\txmlFreeParserCtxt(ctxt);\n\n\treturn true;\n}",
  23500. "idx": 519661,
  23501. "cwe": "CWE-416",
  23502. "hash": 282602577873513987866733808663469843847,
  23503. "dataset": "other"
  23504. },
  23505. {
  23506. "project": "ardour",
  23507. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  23508. "target": 0,
  23509. "func": "XMLTree::debug(FILE* out) const\n{\n#ifdef LIBXML_DEBUG_ENABLED\n\txmlDocPtr doc;\n\tXMLNodeList children;\n\n\txmlKeepBlanksDefault(0);\n\tdoc = xmlNewDoc(xml_version);\n\txmlSetDocCompressMode(doc, _compression);\n\twritenode(doc, _root, doc->children, 1);\n\txmlDebugDumpDocument (out, doc);\n\txmlFreeDoc(doc);\n#endif\n}",
  23510. "idx": 519654,
  23511. "cwe": "CWE-416",
  23512. "hash": 334502150140909691035425169234400980067,
  23513. "dataset": "other"
  23514. },
  23515. {
  23516. "project": "ardour",
  23517. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  23518. "target": 0,
  23519. "func": "XMLTree::write_buffer() const\n{\n\tstatic string retval;\n\tchar* ptr;\n\tint len;\n\txmlDocPtr doc;\n\tXMLNodeList children;\n\n\txmlKeepBlanksDefault(0);\n\tdoc = xmlNewDoc(xml_version);\n\txmlSetDocCompressMode(doc, _compression);\n\twritenode(doc, _root, doc->children, 1);\n\txmlDocDumpMemory(doc, (xmlChar **) & ptr, &len);\n\txmlFreeDoc(doc);\n\n\tretval = ptr;\n\n\tfree(ptr);\n\n\treturn retval;\n}",
  23520. "idx": 519660,
  23521. "cwe": "CWE-416",
  23522. "hash": 171301428596270439461533586536560582745,
  23523. "dataset": "other"
  23524. },
  23525. {
  23526. "project": "ardour",
  23527. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  23528. "target": 0,
  23529. "func": "XMLTree::XMLTree(const XMLTree* from)\n\t: _filename(from->filename())\n\t, _root(new XMLNode(*from->root()))\n\t, _doc (xmlCopyDoc (from->_doc, 1))\n\t, _compression(from->compression())\n{\n\n}",
  23530. "idx": 519655,
  23531. "cwe": "CWE-416",
  23532. "hash": 53368891784882751795675731221455930302,
  23533. "dataset": "other"
  23534. },
  23535. {
  23536. "project": "ardour",
  23537. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  23538. "target": 0,
  23539. "func": "XMLTree::XMLTree()\n\t: _filename()\n\t, _root(0)\n\t, _doc (0)\n\t, _compression(0)\n{\n}",
  23540. "idx": 519659,
  23541. "cwe": "CWE-416",
  23542. "hash": 224251866575809493380432123093044529933,
  23543. "dataset": "other"
  23544. },
  23545. {
  23546. "project": "ardour",
  23547. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  23548. "target": 0,
  23549. "func": "XMLTree::XMLTree(const string& fn, bool validate)\n\t: _filename(fn)\n\t, _root(0)\n\t, _doc (0)\n\t, _compression(0)\n{\n\tread_internal(validate);\n}",
  23550. "idx": 519685,
  23551. "cwe": "CWE-416",
  23552. "hash": 91833938841644286003486411581296346487,
  23553. "dataset": "other"
  23554. },
  23555. {
  23556. "project": "ardour",
  23557. "commit_id": "96daa4036a425ff3f23a7dfcba57bfb0f942bec6",
  23558. "target": 0,
  23559. "func": "XMLTree::~XMLTree()\n{\n\tdelete _root;\n\n\tif (_doc) {\n\t\txmlFreeDoc (_doc);\n\t}\n}",
  23560. "idx": 519662,
  23561. "cwe": "CWE-416",
  23562. "hash": 148186101253235417727159463539179719047,
  23563. "dataset": "other"
  23564. }
  23565. ]
  23566. },
  23567. {
  23568. "call_depth": 3,
  23569. "longest_call_chain": [
  23570. "test_r_str_utf8_charsize_prev",
  23571. "r_str_utf8_charsize_last",
  23572. "r_str_utf8_charsize_prev"
  23573. ],
  23574. "group_size": 3,
  23575. "functions": [
  23576. {
  23577. "func": "R_API size_t r_str_utf8_charsize_last(const char *str) {\n\tr_return_val_if_fail (str, 0);\n\tsize_t len = strlen (str);\n\treturn r_str_utf8_charsize_prev (str + len, len);\n}",
  23578. "project": "radare2",
  23579. "hash": 136186469842505774585183979313561971608,
  23580. "size": 5,
  23581. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  23582. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  23583. "target": 0,
  23584. "dataset": "other",
  23585. "idx": 269068
  23586. },
  23587. {
  23588. "func": "bool test_r_str_utf8_charsize_prev(void) {\n\tchar s[16] = \"\\x61\\xc3\\xa1\\xe6\\x97\\xa5\\xf0\\x9f\\x91\\x8c\\xf0\\x9f\\x91\\x8c\\x8c\"; // aá日👌\n\tint sz;\n\n\tsz = r_str_utf8_charsize_last (s);\n\tmu_assert_eq (sz, 0, \"Malformed UTF-8\");\n\n\tsz = r_str_utf8_charsize_prev (s + 10, 10);\n\tmu_assert_eq (sz, 4, \"4 byte UTF-8\");\n\n\tsz = r_str_utf8_charsize_prev (s + 6, 6);\n\tmu_assert_eq (sz, 3, \"3 byte UTF-8\");\n\n\tsz = r_str_utf8_charsize_prev (s + 3, 3);\n\tmu_assert_eq (sz, 2, \"2 byte UTF-8\");\n\n\tsz = r_str_utf8_charsize_prev (s + 1, 1);\n\tmu_assert_eq (sz, 1, \"1 byte UTF-8\");\n\n\tmu_end;\n}",
  23589. "project": "radare2",
  23590. "hash": 122725785192562029863980825345765703551,
  23591. "size": 21,
  23592. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  23593. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  23594. "target": 0,
  23595. "dataset": "other",
  23596. "idx": 268840
  23597. },
  23598. {
  23599. "func": "R_API size_t r_str_utf8_charsize_prev(const char *str, int prev_len) {\n\tr_return_val_if_fail (str, 0);\n\tint pos = 0;\n\tsize_t size = 0, minsize = R_MIN (5, prev_len);\n\twhile (size < minsize) {\n\t\tsize++;\n\t\tif ((str[--pos] & 0xc0) != 0x80) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn size < 5 ? size : 0;\n}",
  23600. "project": "radare2",
  23601. "hash": 251969895797919563786906960976175927082,
  23602. "size": 12,
  23603. "commit_id": "04edfa82c1f3fa2bc3621ccdad2f93bdbf00e4f9",
  23604. "message": "Fix command injection on PDB download (#16966)\n\n* Fix r_sys_mkdirp with absolute path on Windows\r\n* Fix build with --with-openssl\r\n* Use RBuffer in r_socket_http_answer()\r\n* r_socket_http_answer: Fix read for big responses\r\n* Implement r_str_escape_sh()\r\n* Cleanup r_socket_connect() on Windows\r\n* Fix socket being created without a protocol\r\n* Fix socket connect with SSL ##socket\r\n* Use select() in r_socket_ready()\r\n* Fix read failing if received only protocol answer\r\n* Fix double-free\r\n* r_socket_http_get: Fail if req. SSL with no support\r\n* Follow redirects in r_socket_http_answer()\r\n* Fix r_socket_http_get result length with R2_CURL=1\r\n* Also follow redirects\r\n* Avoid using curl for downloading PDBs\r\n* Use r_socket_http_get() on UNIXs\r\n* Use WinINet API on Windows for r_socket_http_get()\r\n* Fix command injection\r\n* Fix r_sys_cmd_str_full output for binary data\r\n* Validate GUID on PDB download\r\n* Pass depth to socket_http_get_recursive()\r\n* Remove 'r_' and '__' from static function names\r\n* Fix is_valid_guid\r\n* Fix for comments",
  23605. "target": 0,
  23606. "dataset": "other",
  23607. "idx": 269077
  23608. }
  23609. ]
  23610. },
  23611. {
  23612. "call_depth": 3,
  23613. "longest_call_chain": [
  23614. "rsi_mac80211_config",
  23615. "rsi_channel_change",
  23616. "rsi_get_connected_channel"
  23617. ],
  23618. "group_size": 4,
  23619. "functions": [
  23620. {
  23621. "func": "static int rsi_mac80211_config(struct ieee80211_hw *hw,\n\t\t\t u32 changed)\n{\n\tstruct rsi_hw *adapter = hw->priv;\n\tstruct rsi_common *common = adapter->priv;\n\tstruct ieee80211_conf *conf = &hw->conf;\n\tint status = -EOPNOTSUPP;\n\n\tmutex_lock(&common->mutex);\n\n\tif (changed & IEEE80211_CONF_CHANGE_CHANNEL)\n\t\tstatus = rsi_channel_change(hw);\n\n\t/* tx power */\n\tif (changed & IEEE80211_CONF_CHANGE_POWER) {\n\t\trsi_dbg(INFO_ZONE, \"%s: Configuring Power\\n\", __func__);\n\t\tstatus = rsi_config_power(hw);\n\t}\n\n\t/* Power save parameters */\n\tif (changed & IEEE80211_CONF_CHANGE_PS) {\n\t\tstruct ieee80211_vif *vif, *sta_vif = NULL;\n\t\tunsigned long flags;\n\t\tint i, set_ps = 1;\n\n\t\tfor (i = 0; i < RSI_MAX_VIFS; i++) {\n\t\t\tvif = adapter->vifs[i];\n\t\t\tif (!vif)\n\t\t\t\tcontinue;\n\t\t\t/* Don't go to power save if AP vap exists */\n\t\t\tif ((vif->type == NL80211_IFTYPE_AP) ||\n\t\t\t (vif->type == NL80211_IFTYPE_P2P_GO)) {\n\t\t\t\tset_ps = 0;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif ((vif->type == NL80211_IFTYPE_STATION ||\n\t\t\t vif->type == NL80211_IFTYPE_P2P_CLIENT) &&\n\t\t\t (!sta_vif || vif->bss_conf.assoc))\n\t\t\t\tsta_vif = vif;\n\t\t}\n\t\tif (set_ps && sta_vif) {\n\t\t\tspin_lock_irqsave(&adapter->ps_lock, flags);\n\t\t\tif (conf->flags & IEEE80211_CONF_PS)\n\t\t\t\trsi_enable_ps(adapter, sta_vif);\n\t\t\telse\n\t\t\t\trsi_disable_ps(adapter, sta_vif);\n\t\t\tspin_unlock_irqrestore(&adapter->ps_lock, flags);\n\t\t}\n\t}\n\n\t/* RTS threshold */\n\tif (changed & WIPHY_PARAM_RTS_THRESHOLD) {\n\t\trsi_dbg(INFO_ZONE, \"RTS threshold\\n\");\n\t\tif ((common->rts_threshold) <= IEEE80211_MAX_RTS_THRESHOLD) {\n\t\t\trsi_dbg(INFO_ZONE,\n\t\t\t\t\"%s: Sending vap updates....\\n\", __func__);\n\t\t\tstatus = rsi_send_vap_dynamic_update(common);\n\t\t}\n\t}\n\tmutex_unlock(&common->mutex);\n\n\treturn status;\n}",
  23622. "project": "linux",
  23623. "hash": 98733492063270751071551406092014427833,
  23624. "size": 63,
  23625. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  23626. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  23627. "target": 0,
  23628. "dataset": "other",
  23629. "idx": 461638
  23630. },
  23631. {
  23632. "func": "static int rsi_channel_change(struct ieee80211_hw *hw)\n{\n\tstruct rsi_hw *adapter = hw->priv;\n\tstruct rsi_common *common = adapter->priv;\n\tint status = -EOPNOTSUPP;\n\tstruct ieee80211_channel *curchan = hw->conf.chandef.chan;\n\tu16 channel = curchan->hw_value;\n\tstruct ieee80211_vif *vif;\n\tstruct ieee80211_bss_conf *bss;\n\tbool assoc = false;\n\tint i;\n\n\trsi_dbg(INFO_ZONE,\n\t\t\"%s: Set channel: %d MHz type: %d channel_no %d\\n\",\n\t\t__func__, curchan->center_freq,\n\t\tcurchan->flags, channel);\n\n\tfor (i = 0; i < RSI_MAX_VIFS; i++) {\n\t\tvif = adapter->vifs[i];\n\t\tif (!vif)\n\t\t\tcontinue;\n\t\tif (vif->type == NL80211_IFTYPE_STATION) {\n\t\t\tbss = &vif->bss_conf;\n\t\t\tif (bss->assoc) {\n\t\t\t\tassoc = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tif (assoc) {\n\t\tif (!common->hw_data_qs_blocked &&\n\t\t (rsi_get_connected_channel(vif) != channel)) {\n\t\t\trsi_dbg(INFO_ZONE, \"blk data q %d\\n\", channel);\n\t\t\tif (!rsi_send_block_unblock_frame(common, true))\n\t\t\t\tcommon->hw_data_qs_blocked = true;\n\t\t}\n\t}\n\n\tstatus = rsi_band_check(common, curchan);\n\tif (!status)\n\t\tstatus = rsi_set_channel(adapter->priv, curchan);\n\n\tif (assoc) {\n\t\tif (common->hw_data_qs_blocked &&\n\t\t (rsi_get_connected_channel(vif) == channel)) {\n\t\t\trsi_dbg(INFO_ZONE, \"unblk data q %d\\n\", channel);\n\t\t\tif (!rsi_send_block_unblock_frame(common, false))\n\t\t\t\tcommon->hw_data_qs_blocked = false;\n\t\t}\n\t}\n\n\treturn status;\n}",
  23633. "project": "linux",
  23634. "hash": 65899985042214812543847782767000592942,
  23635. "size": 53,
  23636. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  23637. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  23638. "target": 0,
  23639. "dataset": "other",
  23640. "idx": 461630
  23641. },
  23642. {
  23643. "func": "u16 rsi_get_connected_channel(struct ieee80211_vif *vif)\n{\n\tstruct ieee80211_bss_conf *bss;\n\tstruct ieee80211_channel *channel;\n\n\tif (!vif)\n\t\treturn 0;\n\n\tbss = &vif->bss_conf;\n\tchannel = bss->chandef.chan;\n\n\tif (!channel)\n\t\treturn 0;\n\n\treturn channel->hw_value;\n}",
  23644. "project": "linux",
  23645. "hash": 144872127323013305681508181567547474838,
  23646. "size": 16,
  23647. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  23648. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  23649. "target": 0,
  23650. "dataset": "other",
  23651. "idx": 461635
  23652. },
  23653. {
  23654. "func": "static int rsi_config_power(struct ieee80211_hw *hw)\n{\n\tstruct rsi_hw *adapter = hw->priv;\n\tstruct rsi_common *common = adapter->priv;\n\tstruct ieee80211_conf *conf = &hw->conf;\n\n\tif (adapter->sc_nvifs <= 0) {\n\t\trsi_dbg(ERR_ZONE, \"%s: No virtual interface found\\n\", __func__);\n\t\treturn -EINVAL;\n\t}\n\n\trsi_dbg(INFO_ZONE,\n\t\t\"%s: Set tx power: %d dBM\\n\", __func__, conf->power_level);\n\n\tif (conf->power_level == common->tx_power)\n\t\treturn 0;\n\n\tcommon->tx_power = conf->power_level;\n\n\treturn rsi_send_radio_params_update(common);\n}",
  23655. "project": "linux",
  23656. "hash": 154350699552786105150899900159124955910,
  23657. "size": 21,
  23658. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  23659. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  23660. "target": 0,
  23661. "dataset": "other",
  23662. "idx": 461669
  23663. }
  23664. ]
  23665. },
  23666. {
  23667. "call_depth": 3,
  23668. "longest_call_chain": [
  23669. "GC_calloc_explicitly_typed",
  23670. "GC_make_array_descriptor",
  23671. "GC_double_descr"
  23672. ],
  23673. "group_size": 4,
  23674. "functions": [
  23675. {
  23676. "func": "GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n,\n size_t lb, GC_descr d)\n{\n word *op;\n size_t lg;\n GC_descr simple_descr;\n complex_descriptor *complex_descr;\n int descr_type;\n struct LeafDescriptor leaf;\n\n GC_ASSERT(GC_explicit_typing_initialized);\n descr_type = GC_make_array_descriptor((word)n, (word)lb, d, &simple_descr,\n &complex_descr, &leaf);\n switch(descr_type) {\n case NO_MEM: return(0);\n case SIMPLE: return(GC_malloc_explicitly_typed(n*lb, simple_descr));\n case LEAF:\n lb *= n;\n lb += sizeof(struct LeafDescriptor) + TYPD_EXTRA_BYTES;\n break;\n case COMPLEX:\n lb *= n;\n lb += TYPD_EXTRA_BYTES;\n break;\n }\n op = GC_malloc_kind(lb, GC_array_kind);\n if (EXPECT(NULL == op, FALSE))\n return NULL;\n lg = SMALL_OBJ(lb) ? GC_size_map[lb] : BYTES_TO_GRANULES(GC_size(op));\n if (descr_type == LEAF) {\n /* Set up the descriptor inside the object itself. */\n volatile struct LeafDescriptor * lp =\n (struct LeafDescriptor *)\n (op + GRANULES_TO_WORDS(lg)\n - (BYTES_TO_WORDS(sizeof(struct LeafDescriptor)) + 1));\n\n lp -> ld_tag = LEAF_TAG;\n lp -> ld_size = leaf.ld_size;\n lp -> ld_nelements = leaf.ld_nelements;\n lp -> ld_descriptor = leaf.ld_descriptor;\n ((volatile word *)op)[GRANULES_TO_WORDS(lg) - 1] = (word)lp;\n } else {\n# ifndef GC_NO_FINALIZATION\n size_t lw = GRANULES_TO_WORDS(lg);\n\n op[lw - 1] = (word)complex_descr;\n /* Make sure the descriptor is cleared once there is any danger */\n /* it may have been collected. */\n if (EXPECT(GC_general_register_disappearing_link(\n (void **)(op + lw - 1), op)\n == GC_NO_MEMORY, FALSE))\n# endif\n {\n /* Couldn't register it due to lack of memory. Punt. */\n /* This will probably fail too, but gives the recovery code */\n /* a chance. */\n return GC_malloc(lb);\n }\n }\n return op;\n}",
  23677. "project": "bdwgc",
  23678. "hash": 129186795195986820153089371839787067250,
  23679. "size": 61,
  23680. "commit_id": "4e1a6f9d8f2a49403bbd00b8c8e5324048fb84d4",
  23681. "message": "Fix calloc_explicitly_typed in case of lb*n overflow\n\n* typd_mlc.c: Include limits.h (for SIZE_MAX).\n* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in\nmalloc.c).\n* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n\noverflows (same algorithm as in calloc defined in malloc.c); eliminate\nlb *= n code duplication.",
  23682. "target": 1,
  23683. "dataset": "other",
  23684. "idx": 205872
  23685. },
  23686. {
  23687. "func": "GC_API GC_ATTR_MALLOC void * GC_CALL GC_calloc_explicitly_typed(size_t n,\n size_t lb, GC_descr d)\n{\n word *op;\n size_t lg;\n GC_descr simple_descr;\n complex_descriptor *complex_descr;\n int descr_type;\n struct LeafDescriptor leaf;\n\n GC_ASSERT(GC_explicit_typing_initialized);\n descr_type = GC_make_array_descriptor((word)n, (word)lb, d, &simple_descr,\n &complex_descr, &leaf);\n if ((lb | n) > GC_SQRT_SIZE_MAX /* fast initial check */\n && lb > 0 && n > GC_SIZE_MAX / lb)\n return NULL; /* n*lb overflow */\n lb *= n;\n switch(descr_type) {\n case NO_MEM: return(0);\n case SIMPLE:\n return GC_malloc_explicitly_typed(lb, simple_descr);\n case LEAF:\n lb += sizeof(struct LeafDescriptor) + TYPD_EXTRA_BYTES;\n break;\n case COMPLEX:\n lb += TYPD_EXTRA_BYTES;\n break;\n }\n op = GC_malloc_kind(lb, GC_array_kind);\n if (EXPECT(NULL == op, FALSE))\n return NULL;\n lg = SMALL_OBJ(lb) ? GC_size_map[lb] : BYTES_TO_GRANULES(GC_size(op));\n if (descr_type == LEAF) {\n /* Set up the descriptor inside the object itself. */\n volatile struct LeafDescriptor * lp =\n (struct LeafDescriptor *)\n (op + GRANULES_TO_WORDS(lg)\n - (BYTES_TO_WORDS(sizeof(struct LeafDescriptor)) + 1));\n\n lp -> ld_tag = LEAF_TAG;\n lp -> ld_size = leaf.ld_size;\n lp -> ld_nelements = leaf.ld_nelements;\n lp -> ld_descriptor = leaf.ld_descriptor;\n ((volatile word *)op)[GRANULES_TO_WORDS(lg) - 1] = (word)lp;\n } else {\n# ifndef GC_NO_FINALIZATION\n size_t lw = GRANULES_TO_WORDS(lg);\n\n op[lw - 1] = (word)complex_descr;\n /* Make sure the descriptor is cleared once there is any danger */\n /* it may have been collected. */\n if (EXPECT(GC_general_register_disappearing_link(\n (void **)(op + lw - 1), op)\n == GC_NO_MEMORY, FALSE))\n# endif\n {\n /* Couldn't register it due to lack of memory. Punt. */\n /* This will probably fail too, but gives the recovery code */\n /* a chance. */\n return GC_malloc(lb);\n }\n }\n return op;\n}",
  23688. "project": "bdwgc",
  23689. "hash": 196754813537280026105640227782301143544,
  23690. "size": 64,
  23691. "commit_id": "4e1a6f9d8f2a49403bbd00b8c8e5324048fb84d4",
  23692. "message": "Fix calloc_explicitly_typed in case of lb*n overflow\n\n* typd_mlc.c: Include limits.h (for SIZE_MAX).\n* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in\nmalloc.c).\n* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n\noverflows (same algorithm as in calloc defined in malloc.c); eliminate\nlb *= n code duplication.",
  23693. "target": 0,
  23694. "dataset": "other",
  23695. "idx": 374064
  23696. },
  23697. {
  23698. "func": "STATIC GC_descr GC_double_descr(GC_descr descriptor, word nwords)\n{\n if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) {\n descriptor = GC_bm_table[BYTES_TO_WORDS((word)descriptor)];\n };\n descriptor |= (descriptor & ~GC_DS_TAGS) >> nwords;\n return(descriptor);\n}",
  23699. "project": "bdwgc",
  23700. "hash": 244067845680989831098866291492820252649,
  23701. "size": 8,
  23702. "commit_id": "4e1a6f9d8f2a49403bbd00b8c8e5324048fb84d4",
  23703. "message": "Fix calloc_explicitly_typed in case of lb*n overflow\n\n* typd_mlc.c: Include limits.h (for SIZE_MAX).\n* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in\nmalloc.c).\n* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n\noverflows (same algorithm as in calloc defined in malloc.c); eliminate\nlb *= n code duplication.",
  23704. "target": 0,
  23705. "dataset": "other",
  23706. "idx": 374061
  23707. },
  23708. {
  23709. "func": "STATIC int GC_make_array_descriptor(size_t nelements, size_t size,\n GC_descr descriptor, GC_descr *simple_d,\n complex_descriptor **complex_d,\n struct LeafDescriptor * leaf)\n{\n# define OPT_THRESHOLD 50\n /* For larger arrays, we try to combine descriptors of adjacent */\n /* descriptors to speed up marking, and to reduce the amount */\n /* of space needed on the mark stack. */\n if ((descriptor & GC_DS_TAGS) == GC_DS_LENGTH) {\n if (descriptor == (GC_descr)size) {\n *simple_d = nelements * descriptor;\n return(SIMPLE);\n } else if ((word)descriptor == 0) {\n *simple_d = (GC_descr)0;\n return(SIMPLE);\n }\n }\n if (nelements <= OPT_THRESHOLD) {\n if (nelements <= 1) {\n if (nelements == 1) {\n *simple_d = descriptor;\n return(SIMPLE);\n } else {\n *simple_d = (GC_descr)0;\n return(SIMPLE);\n }\n }\n } else if (size <= BITMAP_BITS/2\n && (descriptor & GC_DS_TAGS) != GC_DS_PROC\n && (size & (sizeof(word)-1)) == 0) {\n int result =\n GC_make_array_descriptor(nelements/2, 2*size,\n GC_double_descr(descriptor,\n BYTES_TO_WORDS(size)),\n simple_d, complex_d, leaf);\n if ((nelements & 1) == 0) {\n return(result);\n } else {\n struct LeafDescriptor * one_element =\n (struct LeafDescriptor *)\n GC_malloc_atomic(sizeof(struct LeafDescriptor));\n\n if (result == NO_MEM || one_element == 0) return(NO_MEM);\n one_element -> ld_tag = LEAF_TAG;\n one_element -> ld_size = size;\n one_element -> ld_nelements = 1;\n one_element -> ld_descriptor = descriptor;\n switch(result) {\n case SIMPLE:\n {\n struct LeafDescriptor * beginning =\n (struct LeafDescriptor *)\n GC_malloc_atomic(sizeof(struct LeafDescriptor));\n if (beginning == 0) return(NO_MEM);\n beginning -> ld_tag = LEAF_TAG;\n beginning -> ld_size = size;\n beginning -> ld_nelements = 1;\n beginning -> ld_descriptor = *simple_d;\n *complex_d = GC_make_sequence_descriptor(\n (complex_descriptor *)beginning,\n (complex_descriptor *)one_element);\n break;\n }\n case LEAF:\n {\n struct LeafDescriptor * beginning =\n (struct LeafDescriptor *)\n GC_malloc_atomic(sizeof(struct LeafDescriptor));\n if (beginning == 0) return(NO_MEM);\n beginning -> ld_tag = LEAF_TAG;\n beginning -> ld_size = leaf -> ld_size;\n beginning -> ld_nelements = leaf -> ld_nelements;\n beginning -> ld_descriptor = leaf -> ld_descriptor;\n *complex_d = GC_make_sequence_descriptor(\n (complex_descriptor *)beginning,\n (complex_descriptor *)one_element);\n break;\n }\n case COMPLEX:\n *complex_d = GC_make_sequence_descriptor(\n *complex_d,\n (complex_descriptor *)one_element);\n break;\n }\n return(COMPLEX);\n }\n }\n\n leaf -> ld_size = size;\n leaf -> ld_nelements = nelements;\n leaf -> ld_descriptor = descriptor;\n return(LEAF);\n}",
  23710. "project": "bdwgc",
  23711. "hash": 46177501544734546095080439612376021485,
  23712. "size": 94,
  23713. "commit_id": "4e1a6f9d8f2a49403bbd00b8c8e5324048fb84d4",
  23714. "message": "Fix calloc_explicitly_typed in case of lb*n overflow\n\n* typd_mlc.c: Include limits.h (for SIZE_MAX).\n* typd_mlc.c (GC_SIZE_MAX, GC_SQRT_SIZE_MAX): New macro (same as in\nmalloc.c).\n* typd_mlc.c (GC_calloc_explicitly_typed): Return NULL if lb * n\noverflows (same algorithm as in calloc defined in malloc.c); eliminate\nlb *= n code duplication.",
  23715. "target": 0,
  23716. "dataset": "other",
  23717. "idx": 374060
  23718. }
  23719. ]
  23720. },
  23721. {
  23722. "call_depth": 3,
  23723. "longest_call_chain": [
  23724. "do_string_and_free",
  23725. "do_string",
  23726. "refresh_request"
  23727. ],
  23728. "group_size": 3,
  23729. "functions": [
  23730. {
  23731. "func": "do_string_replot(const char *s)\n{\n do_string(s);\n\n if (volatile_data && (E_REFRESH_NOT_OK != refresh_ok)) {\n\tif (display_ipc_commands())\n\t fprintf(stderr, \"refresh\\n\");\n\trefresh_request();\n\n } else if (!replot_disabled)\n\treplotrequest();\n\n else\n\tint_warn(NO_CARET, \"refresh not possible and replot is disabled\");\n}",
  23732. "target": 0,
  23733. "cwe": [
  23734. "CWE-415"
  23735. ],
  23736. "project": "gnuplot",
  23737. "commit_id": "052cbd17c3cbbc602ee080b2617d32a8417d7563",
  23738. "hash": 291579279894964375944063221702777252799,
  23739. "size": 15,
  23740. "message": "successive failures of \"set print <foo>\" could cause double-free\nBug #2312",
  23741. "dataset": "other",
  23742. "idx": 506485
  23743. },
  23744. {
  23745. "func": "refresh_command()\n{\n c_token++;\n refresh_request();\n}",
  23746. "target": 0,
  23747. "cwe": [
  23748. "CWE-415"
  23749. ],
  23750. "project": "gnuplot",
  23751. "commit_id": "052cbd17c3cbbc602ee080b2617d32a8417d7563",
  23752. "hash": 97347783036189310092858484712183281402,
  23753. "size": 5,
  23754. "message": "successive failures of \"set print <foo>\" could cause double-free\nBug #2312",
  23755. "dataset": "other",
  23756. "idx": 506513
  23757. },
  23758. {
  23759. "func": "do_string(const char *s)\n{\n char *cmdline = gp_strdup(s);\n do_string_and_free(cmdline);\n}",
  23760. "target": 0,
  23761. "cwe": [
  23762. "CWE-415"
  23763. ],
  23764. "project": "gnuplot",
  23765. "commit_id": "052cbd17c3cbbc602ee080b2617d32a8417d7563",
  23766. "hash": 138266240495855944294073793531180690221,
  23767. "size": 5,
  23768. "message": "successive failures of \"set print <foo>\" could cause double-free\nBug #2312",
  23769. "dataset": "other",
  23770. "idx": 506504
  23771. }
  23772. ]
  23773. },
  23774. {
  23775. "call_depth": 3,
  23776. "longest_call_chain": [
  23777. "bfq_init_hctx",
  23778. "bfq_depth_updated",
  23779. "bfq_update_depths"
  23780. ],
  23781. "group_size": 3,
  23782. "functions": [
  23783. {
  23784. "func": "\nstatic int bfq_init_hctx(struct blk_mq_hw_ctx *hctx, unsigned int index)\n{\n\tbfq_depth_updated(hctx);\n\treturn 0;",
  23785. "project": "linux",
  23786. "hash": 17985867972788131300537994415053636378,
  23787. "size": 5,
  23788. "commit_id": "2f95fa5c955d0a9987ffdc3a095e2f4e62c5f2a9",
  23789. "message": "block, bfq: fix use-after-free in bfq_idle_slice_timer_body\n\nIn bfq_idle_slice_timer func, bfqq = bfqd->in_service_queue is\nnot in bfqd-lock critical section. The bfqq, which is not\nequal to NULL in bfq_idle_slice_timer, may be freed after passing\nto bfq_idle_slice_timer_body. So we will access the freed memory.\n\nIn addition, considering the bfqq may be in race, we should\nfirstly check whether bfqq is in service before doing something\non it in bfq_idle_slice_timer_body func. If the bfqq in race is\nnot in service, it means the bfqq has been expired through\n__bfq_bfqq_expire func, and wait_request flags has been cleared in\n__bfq_bfqd_reset_in_service func. So we do not need to re-clear the\nwait_request of bfqq which is not in service.\n\nKASAN log is given as follows:\n[13058.354613] ==================================================================\n[13058.354640] BUG: KASAN: use-after-free in bfq_idle_slice_timer+0xac/0x290\n[13058.354644] Read of size 8 at addr ffffa02cf3e63f78 by task fork13/19767\n[13058.354646]\n[13058.354655] CPU: 96 PID: 19767 Comm: fork13\n[13058.354661] Call trace:\n[13058.354667] dump_backtrace+0x0/0x310\n[13058.354672] show_stack+0x28/0x38\n[13058.354681] dump_stack+0xd8/0x108\n[13058.354687] print_address_description+0x68/0x2d0\n[13058.354690] kasan_report+0x124/0x2e0\n[13058.354697] __asan_load8+0x88/0xb0\n[13058.354702] bfq_idle_slice_timer+0xac/0x290\n[13058.354707] __hrtimer_run_queues+0x298/0x8b8\n[13058.354710] hrtimer_interrupt+0x1b8/0x678\n[13058.354716] arch_timer_handler_phys+0x4c/0x78\n[13058.354722] handle_percpu_devid_irq+0xf0/0x558\n[13058.354731] generic_handle_irq+0x50/0x70\n[13058.354735] __handle_domain_irq+0x94/0x110\n[13058.354739] gic_handle_irq+0x8c/0x1b0\n[13058.354742] el1_irq+0xb8/0x140\n[13058.354748] do_wp_page+0x260/0xe28\n[13058.354752] __handle_mm_fault+0x8ec/0x9b0\n[13058.354756] handle_mm_fault+0x280/0x460\n[13058.354762] do_page_fault+0x3ec/0x890\n[13058.354765] do_mem_abort+0xc0/0x1b0\n[13058.354768] el0_da+0x24/0x28\n[13058.354770]\n[13058.354773] Allocated by task 19731:\n[13058.354780] kasan_kmalloc+0xe0/0x190\n[13058.354784] kasan_slab_alloc+0x14/0x20\n[13058.354788] kmem_cache_alloc_node+0x130/0x440\n[13058.354793] bfq_get_queue+0x138/0x858\n[13058.354797] bfq_get_bfqq_handle_split+0xd4/0x328\n[13058.354801] bfq_init_rq+0x1f4/0x1180\n[13058.354806] bfq_insert_requests+0x264/0x1c98\n[13058.354811] blk_mq_sched_insert_requests+0x1c4/0x488\n[13058.354818] blk_mq_flush_plug_list+0x2d4/0x6e0\n[13058.354826] blk_flush_plug_list+0x230/0x548\n[13058.354830] blk_finish_plug+0x60/0x80\n[13058.354838] read_pages+0xec/0x2c0\n[13058.354842] __do_page_cache_readahead+0x374/0x438\n[13058.354846] ondemand_readahead+0x24c/0x6b0\n[13058.354851] page_cache_sync_readahead+0x17c/0x2f8\n[13058.354858] generic_file_buffered_read+0x588/0xc58\n[13058.354862] generic_file_read_iter+0x1b4/0x278\n[13058.354965] ext4_file_read_iter+0xa8/0x1d8 [ext4]\n[13058.354972] __vfs_read+0x238/0x320\n[13058.354976] vfs_read+0xbc/0x1c0\n[13058.354980] ksys_read+0xdc/0x1b8\n[13058.354984] __arm64_sys_read+0x50/0x60\n[13058.354990] el0_svc_common+0xb4/0x1d8\n[13058.354994] el0_svc_handler+0x50/0xa8\n[13058.354998] el0_svc+0x8/0xc\n[13058.354999]\n[13058.355001] Freed by task 19731:\n[13058.355007] __kasan_slab_free+0x120/0x228\n[13058.355010] kasan_slab_free+0x10/0x18\n[13058.355014] kmem_cache_free+0x288/0x3f0\n[13058.355018] bfq_put_queue+0x134/0x208\n[13058.355022] bfq_exit_icq_bfqq+0x164/0x348\n[13058.355026] bfq_exit_icq+0x28/0x40\n[13058.355030] ioc_exit_icq+0xa0/0x150\n[13058.355035] put_io_context_active+0x250/0x438\n[13058.355038] exit_io_context+0xd0/0x138\n[13058.355045] do_exit+0x734/0xc58\n[13058.355050] do_group_exit+0x78/0x220\n[13058.355054] __wake_up_parent+0x0/0x50\n[13058.355058] el0_svc_common+0xb4/0x1d8\n[13058.355062] el0_svc_handler+0x50/0xa8\n[13058.355066] el0_svc+0x8/0xc\n[13058.355067]\n[13058.355071] The buggy address belongs to the object at ffffa02cf3e63e70#012 which belongs to the cache bfq_queue of size 464\n[13058.355075] The buggy address is located 264 bytes inside of#012 464-byte region [ffffa02cf3e63e70, ffffa02cf3e64040)\n[13058.355077] The buggy address belongs to the page:\n[13058.355083] page:ffff7e80b3cf9800 count:1 mapcount:0 mapping:ffff802db5c90780 index:0xffffa02cf3e606f0 compound_mapcount: 0\n[13058.366175] flags: 0x2ffffe0000008100(slab|head)\n[13058.370781] raw: 2ffffe0000008100 ffff7e80b53b1408 ffffa02d730c1c90 ffff802db5c90780\n[13058.370787] raw: ffffa02cf3e606f0 0000000000370023 00000001ffffffff 0000000000000000\n[13058.370789] page dumped because: kasan: bad access detected\n[13058.370791]\n[13058.370792] Memory state around the buggy address:\n[13058.370797] ffffa02cf3e63e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fb fb\n[13058.370801] ffffa02cf3e63e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370805] >ffffa02cf3e63f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370808] ^\n[13058.370811] ffffa02cf3e63f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370815] ffffa02cf3e64000: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc\n[13058.370817] ==================================================================\n[13058.370820] Disabling lock debugging due to kernel taint\n\nHere, we directly pass the bfqd to bfq_idle_slice_timer_body func.\n--\nV2->V3: rewrite the comment as suggested by Paolo Valente\nV1->V2: add one comment, and add Fixes and Reported-by tag.\n\nFixes: aee69d78d (\"block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler\")\nAcked-by: Paolo Valente <paolo.valente@linaro.org>\nReported-by: Wang Wang <wangwang2@huawei.com>\nSigned-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>\nSigned-off-by: Feilong Lin <linfeilong@huawei.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>",
  23790. "target": 0,
  23791. "dataset": "other",
  23792. "idx": 453310
  23793. },
  23794. {
  23795. "func": "\nstatic void bfq_depth_updated(struct blk_mq_hw_ctx *hctx)\n{\n\tstruct bfq_data *bfqd = hctx->queue->elevator->elevator_data;\n\tstruct blk_mq_tags *tags = hctx->sched_tags;\n\tunsigned int min_shallow;\n\n\tmin_shallow = bfq_update_depths(bfqd, &tags->bitmap_tags);\n\tsbitmap_queue_min_shallow_depth(&tags->bitmap_tags, min_shallow);",
  23796. "project": "linux",
  23797. "hash": 46526425900654998379064372761150223322,
  23798. "size": 9,
  23799. "commit_id": "2f95fa5c955d0a9987ffdc3a095e2f4e62c5f2a9",
  23800. "message": "block, bfq: fix use-after-free in bfq_idle_slice_timer_body\n\nIn bfq_idle_slice_timer func, bfqq = bfqd->in_service_queue is\nnot in bfqd-lock critical section. The bfqq, which is not\nequal to NULL in bfq_idle_slice_timer, may be freed after passing\nto bfq_idle_slice_timer_body. So we will access the freed memory.\n\nIn addition, considering the bfqq may be in race, we should\nfirstly check whether bfqq is in service before doing something\non it in bfq_idle_slice_timer_body func. If the bfqq in race is\nnot in service, it means the bfqq has been expired through\n__bfq_bfqq_expire func, and wait_request flags has been cleared in\n__bfq_bfqd_reset_in_service func. So we do not need to re-clear the\nwait_request of bfqq which is not in service.\n\nKASAN log is given as follows:\n[13058.354613] ==================================================================\n[13058.354640] BUG: KASAN: use-after-free in bfq_idle_slice_timer+0xac/0x290\n[13058.354644] Read of size 8 at addr ffffa02cf3e63f78 by task fork13/19767\n[13058.354646]\n[13058.354655] CPU: 96 PID: 19767 Comm: fork13\n[13058.354661] Call trace:\n[13058.354667] dump_backtrace+0x0/0x310\n[13058.354672] show_stack+0x28/0x38\n[13058.354681] dump_stack+0xd8/0x108\n[13058.354687] print_address_description+0x68/0x2d0\n[13058.354690] kasan_report+0x124/0x2e0\n[13058.354697] __asan_load8+0x88/0xb0\n[13058.354702] bfq_idle_slice_timer+0xac/0x290\n[13058.354707] __hrtimer_run_queues+0x298/0x8b8\n[13058.354710] hrtimer_interrupt+0x1b8/0x678\n[13058.354716] arch_timer_handler_phys+0x4c/0x78\n[13058.354722] handle_percpu_devid_irq+0xf0/0x558\n[13058.354731] generic_handle_irq+0x50/0x70\n[13058.354735] __handle_domain_irq+0x94/0x110\n[13058.354739] gic_handle_irq+0x8c/0x1b0\n[13058.354742] el1_irq+0xb8/0x140\n[13058.354748] do_wp_page+0x260/0xe28\n[13058.354752] __handle_mm_fault+0x8ec/0x9b0\n[13058.354756] handle_mm_fault+0x280/0x460\n[13058.354762] do_page_fault+0x3ec/0x890\n[13058.354765] do_mem_abort+0xc0/0x1b0\n[13058.354768] el0_da+0x24/0x28\n[13058.354770]\n[13058.354773] Allocated by task 19731:\n[13058.354780] kasan_kmalloc+0xe0/0x190\n[13058.354784] kasan_slab_alloc+0x14/0x20\n[13058.354788] kmem_cache_alloc_node+0x130/0x440\n[13058.354793] bfq_get_queue+0x138/0x858\n[13058.354797] bfq_get_bfqq_handle_split+0xd4/0x328\n[13058.354801] bfq_init_rq+0x1f4/0x1180\n[13058.354806] bfq_insert_requests+0x264/0x1c98\n[13058.354811] blk_mq_sched_insert_requests+0x1c4/0x488\n[13058.354818] blk_mq_flush_plug_list+0x2d4/0x6e0\n[13058.354826] blk_flush_plug_list+0x230/0x548\n[13058.354830] blk_finish_plug+0x60/0x80\n[13058.354838] read_pages+0xec/0x2c0\n[13058.354842] __do_page_cache_readahead+0x374/0x438\n[13058.354846] ondemand_readahead+0x24c/0x6b0\n[13058.354851] page_cache_sync_readahead+0x17c/0x2f8\n[13058.354858] generic_file_buffered_read+0x588/0xc58\n[13058.354862] generic_file_read_iter+0x1b4/0x278\n[13058.354965] ext4_file_read_iter+0xa8/0x1d8 [ext4]\n[13058.354972] __vfs_read+0x238/0x320\n[13058.354976] vfs_read+0xbc/0x1c0\n[13058.354980] ksys_read+0xdc/0x1b8\n[13058.354984] __arm64_sys_read+0x50/0x60\n[13058.354990] el0_svc_common+0xb4/0x1d8\n[13058.354994] el0_svc_handler+0x50/0xa8\n[13058.354998] el0_svc+0x8/0xc\n[13058.354999]\n[13058.355001] Freed by task 19731:\n[13058.355007] __kasan_slab_free+0x120/0x228\n[13058.355010] kasan_slab_free+0x10/0x18\n[13058.355014] kmem_cache_free+0x288/0x3f0\n[13058.355018] bfq_put_queue+0x134/0x208\n[13058.355022] bfq_exit_icq_bfqq+0x164/0x348\n[13058.355026] bfq_exit_icq+0x28/0x40\n[13058.355030] ioc_exit_icq+0xa0/0x150\n[13058.355035] put_io_context_active+0x250/0x438\n[13058.355038] exit_io_context+0xd0/0x138\n[13058.355045] do_exit+0x734/0xc58\n[13058.355050] do_group_exit+0x78/0x220\n[13058.355054] __wake_up_parent+0x0/0x50\n[13058.355058] el0_svc_common+0xb4/0x1d8\n[13058.355062] el0_svc_handler+0x50/0xa8\n[13058.355066] el0_svc+0x8/0xc\n[13058.355067]\n[13058.355071] The buggy address belongs to the object at ffffa02cf3e63e70#012 which belongs to the cache bfq_queue of size 464\n[13058.355075] The buggy address is located 264 bytes inside of#012 464-byte region [ffffa02cf3e63e70, ffffa02cf3e64040)\n[13058.355077] The buggy address belongs to the page:\n[13058.355083] page:ffff7e80b3cf9800 count:1 mapcount:0 mapping:ffff802db5c90780 index:0xffffa02cf3e606f0 compound_mapcount: 0\n[13058.366175] flags: 0x2ffffe0000008100(slab|head)\n[13058.370781] raw: 2ffffe0000008100 ffff7e80b53b1408 ffffa02d730c1c90 ffff802db5c90780\n[13058.370787] raw: ffffa02cf3e606f0 0000000000370023 00000001ffffffff 0000000000000000\n[13058.370789] page dumped because: kasan: bad access detected\n[13058.370791]\n[13058.370792] Memory state around the buggy address:\n[13058.370797] ffffa02cf3e63e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fb fb\n[13058.370801] ffffa02cf3e63e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370805] >ffffa02cf3e63f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370808] ^\n[13058.370811] ffffa02cf3e63f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370815] ffffa02cf3e64000: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc\n[13058.370817] ==================================================================\n[13058.370820] Disabling lock debugging due to kernel taint\n\nHere, we directly pass the bfqd to bfq_idle_slice_timer_body func.\n--\nV2->V3: rewrite the comment as suggested by Paolo Valente\nV1->V2: add one comment, and add Fixes and Reported-by tag.\n\nFixes: aee69d78d (\"block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler\")\nAcked-by: Paolo Valente <paolo.valente@linaro.org>\nReported-by: Wang Wang <wangwang2@huawei.com>\nSigned-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>\nSigned-off-by: Feilong Lin <linfeilong@huawei.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>",
  23801. "target": 0,
  23802. "dataset": "other",
  23803. "idx": 453413
  23804. },
  23805. {
  23806. "func": " */\nstatic unsigned int bfq_update_depths(struct bfq_data *bfqd,\n\t\t\t\t struct sbitmap_queue *bt)\n{\n\tunsigned int i, j, min_shallow = UINT_MAX;\n\n\t/*\n\t * In-word depths if no bfq_queue is being weight-raised:\n\t * leaving 25% of tags only for sync reads.\n\t *\n\t * In next formulas, right-shift the value\n\t * (1U<<bt->sb.shift), instead of computing directly\n\t * (1U<<(bt->sb.shift - something)), to be robust against\n\t * any possible value of bt->sb.shift, without having to\n\t * limit 'something'.\n\t */\n\t/* no more than 50% of tags for async I/O */\n\tbfqd->word_depths[0][0] = max((1U << bt->sb.shift) >> 1, 1U);\n\t/*\n\t * no more than 75% of tags for sync writes (25% extra tags\n\t * w.r.t. async I/O, to prevent async I/O from starving sync\n\t * writes)\n\t */\n\tbfqd->word_depths[0][1] = max(((1U << bt->sb.shift) * 3) >> 2, 1U);\n\n\t/*\n\t * In-word depths in case some bfq_queue is being weight-\n\t * raised: leaving ~63% of tags for sync reads. This is the\n\t * highest percentage for which, in our tests, application\n\t * start-up times didn't suffer from any regression due to tag\n\t * shortage.\n\t */\n\t/* no more than ~18% of tags for async I/O */\n\tbfqd->word_depths[1][0] = max(((1U << bt->sb.shift) * 3) >> 4, 1U);\n\t/* no more than ~37% of tags for sync writes (~20% extra tags) */\n\tbfqd->word_depths[1][1] = max(((1U << bt->sb.shift) * 6) >> 4, 1U);\n\n\tfor (i = 0; i < 2; i++)\n\t\tfor (j = 0; j < 2; j++)\n\t\t\tmin_shallow = min(min_shallow, bfqd->word_depths[i][j]);\n\n\treturn min_shallow;",
  23807. "project": "linux",
  23808. "hash": 325936854518236894026066920926641664043,
  23809. "size": 42,
  23810. "commit_id": "2f95fa5c955d0a9987ffdc3a095e2f4e62c5f2a9",
  23811. "message": "block, bfq: fix use-after-free in bfq_idle_slice_timer_body\n\nIn bfq_idle_slice_timer func, bfqq = bfqd->in_service_queue is\nnot in bfqd-lock critical section. The bfqq, which is not\nequal to NULL in bfq_idle_slice_timer, may be freed after passing\nto bfq_idle_slice_timer_body. So we will access the freed memory.\n\nIn addition, considering the bfqq may be in race, we should\nfirstly check whether bfqq is in service before doing something\non it in bfq_idle_slice_timer_body func. If the bfqq in race is\nnot in service, it means the bfqq has been expired through\n__bfq_bfqq_expire func, and wait_request flags has been cleared in\n__bfq_bfqd_reset_in_service func. So we do not need to re-clear the\nwait_request of bfqq which is not in service.\n\nKASAN log is given as follows:\n[13058.354613] ==================================================================\n[13058.354640] BUG: KASAN: use-after-free in bfq_idle_slice_timer+0xac/0x290\n[13058.354644] Read of size 8 at addr ffffa02cf3e63f78 by task fork13/19767\n[13058.354646]\n[13058.354655] CPU: 96 PID: 19767 Comm: fork13\n[13058.354661] Call trace:\n[13058.354667] dump_backtrace+0x0/0x310\n[13058.354672] show_stack+0x28/0x38\n[13058.354681] dump_stack+0xd8/0x108\n[13058.354687] print_address_description+0x68/0x2d0\n[13058.354690] kasan_report+0x124/0x2e0\n[13058.354697] __asan_load8+0x88/0xb0\n[13058.354702] bfq_idle_slice_timer+0xac/0x290\n[13058.354707] __hrtimer_run_queues+0x298/0x8b8\n[13058.354710] hrtimer_interrupt+0x1b8/0x678\n[13058.354716] arch_timer_handler_phys+0x4c/0x78\n[13058.354722] handle_percpu_devid_irq+0xf0/0x558\n[13058.354731] generic_handle_irq+0x50/0x70\n[13058.354735] __handle_domain_irq+0x94/0x110\n[13058.354739] gic_handle_irq+0x8c/0x1b0\n[13058.354742] el1_irq+0xb8/0x140\n[13058.354748] do_wp_page+0x260/0xe28\n[13058.354752] __handle_mm_fault+0x8ec/0x9b0\n[13058.354756] handle_mm_fault+0x280/0x460\n[13058.354762] do_page_fault+0x3ec/0x890\n[13058.354765] do_mem_abort+0xc0/0x1b0\n[13058.354768] el0_da+0x24/0x28\n[13058.354770]\n[13058.354773] Allocated by task 19731:\n[13058.354780] kasan_kmalloc+0xe0/0x190\n[13058.354784] kasan_slab_alloc+0x14/0x20\n[13058.354788] kmem_cache_alloc_node+0x130/0x440\n[13058.354793] bfq_get_queue+0x138/0x858\n[13058.354797] bfq_get_bfqq_handle_split+0xd4/0x328\n[13058.354801] bfq_init_rq+0x1f4/0x1180\n[13058.354806] bfq_insert_requests+0x264/0x1c98\n[13058.354811] blk_mq_sched_insert_requests+0x1c4/0x488\n[13058.354818] blk_mq_flush_plug_list+0x2d4/0x6e0\n[13058.354826] blk_flush_plug_list+0x230/0x548\n[13058.354830] blk_finish_plug+0x60/0x80\n[13058.354838] read_pages+0xec/0x2c0\n[13058.354842] __do_page_cache_readahead+0x374/0x438\n[13058.354846] ondemand_readahead+0x24c/0x6b0\n[13058.354851] page_cache_sync_readahead+0x17c/0x2f8\n[13058.354858] generic_file_buffered_read+0x588/0xc58\n[13058.354862] generic_file_read_iter+0x1b4/0x278\n[13058.354965] ext4_file_read_iter+0xa8/0x1d8 [ext4]\n[13058.354972] __vfs_read+0x238/0x320\n[13058.354976] vfs_read+0xbc/0x1c0\n[13058.354980] ksys_read+0xdc/0x1b8\n[13058.354984] __arm64_sys_read+0x50/0x60\n[13058.354990] el0_svc_common+0xb4/0x1d8\n[13058.354994] el0_svc_handler+0x50/0xa8\n[13058.354998] el0_svc+0x8/0xc\n[13058.354999]\n[13058.355001] Freed by task 19731:\n[13058.355007] __kasan_slab_free+0x120/0x228\n[13058.355010] kasan_slab_free+0x10/0x18\n[13058.355014] kmem_cache_free+0x288/0x3f0\n[13058.355018] bfq_put_queue+0x134/0x208\n[13058.355022] bfq_exit_icq_bfqq+0x164/0x348\n[13058.355026] bfq_exit_icq+0x28/0x40\n[13058.355030] ioc_exit_icq+0xa0/0x150\n[13058.355035] put_io_context_active+0x250/0x438\n[13058.355038] exit_io_context+0xd0/0x138\n[13058.355045] do_exit+0x734/0xc58\n[13058.355050] do_group_exit+0x78/0x220\n[13058.355054] __wake_up_parent+0x0/0x50\n[13058.355058] el0_svc_common+0xb4/0x1d8\n[13058.355062] el0_svc_handler+0x50/0xa8\n[13058.355066] el0_svc+0x8/0xc\n[13058.355067]\n[13058.355071] The buggy address belongs to the object at ffffa02cf3e63e70#012 which belongs to the cache bfq_queue of size 464\n[13058.355075] The buggy address is located 264 bytes inside of#012 464-byte region [ffffa02cf3e63e70, ffffa02cf3e64040)\n[13058.355077] The buggy address belongs to the page:\n[13058.355083] page:ffff7e80b3cf9800 count:1 mapcount:0 mapping:ffff802db5c90780 index:0xffffa02cf3e606f0 compound_mapcount: 0\n[13058.366175] flags: 0x2ffffe0000008100(slab|head)\n[13058.370781] raw: 2ffffe0000008100 ffff7e80b53b1408 ffffa02d730c1c90 ffff802db5c90780\n[13058.370787] raw: ffffa02cf3e606f0 0000000000370023 00000001ffffffff 0000000000000000\n[13058.370789] page dumped because: kasan: bad access detected\n[13058.370791]\n[13058.370792] Memory state around the buggy address:\n[13058.370797] ffffa02cf3e63e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fb fb\n[13058.370801] ffffa02cf3e63e80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370805] >ffffa02cf3e63f00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370808] ^\n[13058.370811] ffffa02cf3e63f80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb\n[13058.370815] ffffa02cf3e64000: fb fb fb fb fb fb fb fb fc fc fc fc fc fc fc fc\n[13058.370817] ==================================================================\n[13058.370820] Disabling lock debugging due to kernel taint\n\nHere, we directly pass the bfqd to bfq_idle_slice_timer_body func.\n--\nV2->V3: rewrite the comment as suggested by Paolo Valente\nV1->V2: add one comment, and add Fixes and Reported-by tag.\n\nFixes: aee69d78d (\"block, bfq: introduce the BFQ-v0 I/O scheduler as an extra scheduler\")\nAcked-by: Paolo Valente <paolo.valente@linaro.org>\nReported-by: Wang Wang <wangwang2@huawei.com>\nSigned-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>\nSigned-off-by: Feilong Lin <linfeilong@huawei.com>\nSigned-off-by: Jens Axboe <axboe@kernel.dk>",
  23812. "target": 0,
  23813. "dataset": "other",
  23814. "idx": 453277
  23815. }
  23816. ]
  23817. },
  23818. {
  23819. "call_depth": 4,
  23820. "longest_call_chain": [
  23821. "TracePath",
  23822. "TraceArcPath",
  23823. "TraceBezier",
  23824. "CheckPrimitiveExtent"
  23825. ],
  23826. "group_size": 4,
  23827. "functions": [
  23828. {
  23829. "func": "static MagickBooleanType TraceBezier(MVGInfo *mvg_info,\n const size_t number_coordinates)\n{\n double\n alpha,\n *coefficients,\n weight;\n\n PointInfo\n end,\n point,\n *points;\n\n PrimitiveInfo\n *primitive_info;\n\n PrimitiveInfo\n *p;\n\n ssize_t\n i,\n j;\n\n size_t\n control_points,\n quantum;\n\n /*\n Allocate coefficients.\n */\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n quantum=number_coordinates;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n {\n for (j=i+1; j < (ssize_t) number_coordinates; j++)\n {\n alpha=fabs(primitive_info[j].point.x-primitive_info[i].point.x);\n if (alpha > (double) MAGICK_SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n alpha=fabs(primitive_info[j].point.y-primitive_info[i].point.y);\n if (alpha > (double) MAGICK_SSIZE_MAX)\n {\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n if (alpha > (double) quantum)\n quantum=(size_t) alpha;\n }\n }\n coefficients=(double *) AcquireQuantumMemory(number_coordinates,\n sizeof(*coefficients));\n quantum=MagickMin(quantum/number_coordinates,BezierQuantum);\n points=(PointInfo *) AcquireQuantumMemory(quantum,number_coordinates*\n sizeof(*points));\n if ((coefficients == (double *) NULL) || (points == (PointInfo *) NULL))\n {\n if (points != (PointInfo *) NULL)\n points=(PointInfo *) RelinquishMagickMemory(points);\n if (coefficients != (double *) NULL)\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n return(MagickFalse);\n }\n control_points=quantum*number_coordinates;\n if (CheckPrimitiveExtent(mvg_info,(double) control_points+1) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n /*\n Compute bezier points.\n */\n end=primitive_info[number_coordinates-1].point;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n coefficients[i]=Permutate((ssize_t) number_coordinates-1,i);\n weight=0.0;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n p=primitive_info;\n point.x=0.0;\n point.y=0.0;\n alpha=pow((double) (1.0-weight),(double) number_coordinates-1.0);\n for (j=0; j < (ssize_t) number_coordinates; j++)\n {\n point.x+=alpha*coefficients[j]*p->point.x;\n point.y+=alpha*coefficients[j]*p->point.y;\n alpha*=weight/(1.0-weight);\n p++;\n }\n points[i]=point;\n weight+=1.0/control_points;\n }\n /*\n Bezier curves are just short segmented polys.\n */\n p=primitive_info;\n for (i=0; i < (ssize_t) control_points; i++)\n {\n if (TracePoint(p,points[i]) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n }\n if (TracePoint(p,end) == MagickFalse)\n {\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickFalse);\n }\n p+=p->coordinates;\n primitive_info->coordinates=(size_t) (p-primitive_info);\n primitive_info->closed_subpath=MagickFalse;\n for (i=0; i < (ssize_t) primitive_info->coordinates; i++)\n {\n p->primitive=primitive_info->primitive;\n p--;\n }\n points=(PointInfo *) RelinquishMagickMemory(points);\n coefficients=(double *) RelinquishMagickMemory(coefficients);\n return(MagickTrue);\n}",
  23830. "project": "ImageMagick6",
  23831. "hash": 253553152437105555548461944081055352860,
  23832. "size": 134,
  23833. "commit_id": "9a94877f7823b0b8a41d50638dd105229d91fa89",
  23834. "message": "https://github.com/ImageMagick/ImageMagick/issues/3339",
  23835. "target": 0,
  23836. "dataset": "other",
  23837. "idx": 316674
  23838. },
  23839. {
  23840. "func": "static ssize_t TracePath(Image *image,MVGInfo *mvg_info,const char *path)\n{\n char\n *next_token,\n token[MaxTextExtent];\n\n const char\n *p;\n\n double\n x,\n y;\n\n int\n attribute,\n last_attribute;\n\n MagickStatusType\n status;\n\n PointInfo\n end = {0.0, 0.0},\n points[4] = { {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0}, {0.0, 0.0} },\n point = {0.0, 0.0},\n start = {0.0, 0.0};\n\n PrimitiveInfo\n *primitive_info;\n\n PrimitiveType\n primitive_type;\n\n PrimitiveInfo\n *q;\n\n ssize_t\n i;\n\n size_t\n number_coordinates,\n z_count;\n\n ssize_t\n subpath_offset;\n\n subpath_offset=mvg_info->offset;\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n status=MagickTrue;\n attribute=0;\n number_coordinates=0;\n z_count=0;\n primitive_type=primitive_info->primitive;\n q=primitive_info;\n for (p=path; *p != '\\0'; )\n {\n if (status == MagickFalse)\n break;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == '\\0')\n break;\n last_attribute=attribute;\n attribute=(int) (*p++);\n switch (attribute)\n {\n case 'a':\n case 'A':\n {\n double\n angle = 0.0;\n\n MagickBooleanType\n large_arc = MagickFalse,\n sweep = MagickFalse;\n\n PointInfo\n arc = {0.0, 0.0};\n\n /*\n Elliptical arc.\n */\n do\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n arc.x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n arc.y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n angle=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n large_arc=StringToLong(token) != 0 ? MagickTrue : MagickFalse;\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n sweep=StringToLong(token) != 0 ? MagickTrue : MagickFalse;\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n end.x=(double) (attribute == (int) 'A' ? x : point.x+x);\n end.y=(double) (attribute == (int) 'A' ? y : point.y+y);\n status&=TraceArcPath(mvg_info,point,end,arc,angle,large_arc,sweep);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n point=end;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 'c':\n case 'C':\n {\n /*\n Cubic Bézier curve.\n */\n do\n {\n points[0]=point;\n for (i=1; i < 4; i++)\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n end.x=(double) (attribute == (int) 'C' ? x : point.x+x);\n end.y=(double) (attribute == (int) 'C' ? y : point.y+y);\n points[i]=end;\n }\n for (i=0; i < 4; i++)\n (q+i)->point=points[i];\n if (TraceBezier(mvg_info,4) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n point=end;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 'H':\n case 'h':\n {\n do\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n point.x=(double) (attribute == (int) 'H' ? x: point.x+x);\n if (CheckPrimitiveExtent(mvg_info,PrimitiveExtentPad) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n if (TracePoint(q,point) == MagickFalse)\n return(-1);\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 'l':\n case 'L':\n {\n /*\n Line to.\n */\n do\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n point.x=(double) (attribute == (int) 'L' ? x : point.x+x);\n point.y=(double) (attribute == (int) 'L' ? y : point.y+y);\n if (CheckPrimitiveExtent(mvg_info,PrimitiveExtentPad) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n if (TracePoint(q,point) == MagickFalse)\n return(-1);\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 'M':\n case 'm':\n {\n /*\n Move to.\n */\n if (mvg_info->offset != subpath_offset)\n {\n primitive_info=(*mvg_info->primitive_info)+subpath_offset;\n primitive_info->coordinates=(size_t) (q-primitive_info);\n number_coordinates+=primitive_info->coordinates;\n primitive_info=q;\n subpath_offset=mvg_info->offset;\n }\n i=0;\n do\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n point.x=(double) (attribute == (int) 'M' ? x : point.x+x);\n point.y=(double) (attribute == (int) 'M' ? y : point.y+y);\n if (i == 0)\n start=point;\n i++;\n if (CheckPrimitiveExtent(mvg_info,PrimitiveExtentPad) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n if (TracePoint(q,point) == MagickFalse)\n return(-1);\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 'q':\n case 'Q':\n {\n /*\n Quadratic Bézier curve.\n */\n do\n {\n points[0]=point;\n for (i=1; i < 3; i++)\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n if (*p == ',')\n p++;\n end.x=(double) (attribute == (int) 'Q' ? x : point.x+x);\n end.y=(double) (attribute == (int) 'Q' ? y : point.y+y);\n points[i]=end;\n }\n for (i=0; i < 3; i++)\n (q+i)->point=points[i];\n if (TraceBezier(mvg_info,3) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n point=end;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 's':\n case 'S':\n {\n /*\n Cubic Bézier curve.\n */\n do\n {\n points[0]=points[3];\n points[1].x=2.0*points[3].x-points[2].x;\n points[1].y=2.0*points[3].y-points[2].y;\n for (i=2; i < 4; i++)\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n if (*p == ',')\n p++;\n end.x=(double) (attribute == (int) 'S' ? x : point.x+x);\n end.y=(double) (attribute == (int) 'S' ? y : point.y+y);\n points[i]=end;\n }\n if (strchr(\"CcSs\",last_attribute) == (char *) NULL)\n {\n points[0]=point;\n points[1]=point;\n }\n for (i=0; i < 4; i++)\n (q+i)->point=points[i];\n if (TraceBezier(mvg_info,4) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n point=end;\n last_attribute=attribute;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 't':\n case 'T':\n {\n /*\n Quadratic Bézier curve.\n */\n do\n {\n points[0]=points[2];\n points[1].x=2.0*points[2].x-points[1].x;\n points[1].y=2.0*points[2].y-points[1].y;\n for (i=2; i < 3; i++)\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n x=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n end.x=(double) (attribute == (int) 'T' ? x : point.x+x);\n end.y=(double) (attribute == (int) 'T' ? y : point.y+y);\n points[i]=end;\n }\n if (status == MagickFalse)\n break;\n if (strchr(\"QqTt\",last_attribute) == (char *) NULL)\n {\n points[0]=point;\n points[1]=point;\n }\n for (i=0; i < 3; i++)\n (q+i)->point=points[i];\n if (TraceBezier(mvg_info,3) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n point=end;\n last_attribute=attribute;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 'v':\n case 'V':\n {\n /*\n Line to.\n */\n do\n {\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n if (*token == ',')\n (void) GetNextToken(p,&p,MaxTextExtent,token);\n y=GetDrawValue(token,&next_token);\n if (token == next_token)\n ThrowPointExpectedException(image,token);\n point.y=(double) (attribute == (int) 'V' ? y : point.y+y);\n if (CheckPrimitiveExtent(mvg_info,PrimitiveExtentPad) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n if (TracePoint(q,point) == MagickFalse)\n return(-1);\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n while (isspace((int) ((unsigned char) *p)) != 0)\n p++;\n if (*p == ',')\n p++;\n } while (IsPoint(p) != MagickFalse);\n break;\n }\n case 'z':\n case 'Z':\n {\n /*\n Close path.\n */\n point=start;\n if (CheckPrimitiveExtent(mvg_info,PrimitiveExtentPad) == MagickFalse)\n return(-1);\n q=(*mvg_info->primitive_info)+mvg_info->offset;\n if (TracePoint(q,point) == MagickFalse)\n return(-1);\n mvg_info->offset+=q->coordinates;\n q+=q->coordinates;\n primitive_info=(*mvg_info->primitive_info)+subpath_offset;\n primitive_info->coordinates=(size_t) (q-primitive_info);\n primitive_info->closed_subpath=MagickTrue;\n number_coordinates+=primitive_info->coordinates;\n primitive_info=q;\n subpath_offset=mvg_info->offset;\n z_count++;\n break;\n }\n default:\n {\n ThrowPointExpectedException(image,token);\n break;\n }\n }\n }\n if (status == MagickFalse)\n return(-1);\n primitive_info=(*mvg_info->primitive_info)+subpath_offset;\n primitive_info->coordinates=(size_t) (q-primitive_info);\n number_coordinates+=primitive_info->coordinates;\n for (i=0; i < (ssize_t) number_coordinates; i++)\n {\n q--;\n q->primitive=primitive_type;\n if (z_count > 1)\n q->method=FillToBorderMethod;\n }\n q=primitive_info;\n return((ssize_t) number_coordinates);\n}",
  23841. "project": "ImageMagick6",
  23842. "hash": 62329487104930950764409643756974280736,
  23843. "size": 511,
  23844. "commit_id": "9a94877f7823b0b8a41d50638dd105229d91fa89",
  23845. "message": "https://github.com/ImageMagick/ImageMagick/issues/3339",
  23846. "target": 0,
  23847. "dataset": "other",
  23848. "idx": 316671
  23849. },
  23850. {
  23851. "func": "static MagickBooleanType CheckPrimitiveExtent(MVGInfo *mvg_info,\n const double pad)\n{\n double\n extent;\n\n size_t\n quantum;\n\n /*\n Check if there is enough storage for drawing pimitives.\n */\n quantum=sizeof(**mvg_info->primitive_info);\n extent=(double) mvg_info->offset+pad+PrimitiveExtentPad*quantum+1.0;\n if (extent <= (double) *mvg_info->extent)\n return(MagickTrue);\n if (extent == (double) CastDoubleToLong(extent))\n {\n *mvg_info->primitive_info=(PrimitiveInfo *) ResizeQuantumMemory(\n *mvg_info->primitive_info,(size_t) extent,quantum);\n if (*mvg_info->primitive_info != (PrimitiveInfo *) NULL)\n {\n ssize_t\n i;\n\n *mvg_info->extent=(size_t) extent;\n for (i=mvg_info->offset+1; i < (ssize_t) extent; i++)\n (*mvg_info->primitive_info)[i].primitive=UndefinedPrimitive;\n return(MagickTrue);\n }\n }\n /*\n Reallocation failed, allocate a primitive to facilitate unwinding.\n */\n if (*mvg_info->primitive_info != (PrimitiveInfo *) NULL)\n *mvg_info->primitive_info=(PrimitiveInfo *) RelinquishMagickMemory(\n *mvg_info->primitive_info);\n (void) ThrowMagickException(mvg_info->exception,GetMagickModule(),\n ResourceLimitError,\"MemoryAllocationFailed\",\"`%s'\",\"\");\n *mvg_info->primitive_info=(PrimitiveInfo *) AcquireCriticalMemory(\n (size_t) (PrimitiveExtentPad*quantum));\n (void) memset(*mvg_info->primitive_info,0,(size_t)\n (PrimitiveExtentPad*quantum));\n *mvg_info->extent=1;\n return(MagickFalse);\n}",
  23852. "project": "ImageMagick6",
  23853. "hash": 255673321032456110218431166205636735831,
  23854. "size": 46,
  23855. "commit_id": "9a94877f7823b0b8a41d50638dd105229d91fa89",
  23856. "message": "https://github.com/ImageMagick/ImageMagick/issues/3339",
  23857. "target": 0,
  23858. "dataset": "other",
  23859. "idx": 316684
  23860. },
  23861. {
  23862. "func": "static MagickBooleanType TraceArcPath(MVGInfo *mvg_info,const PointInfo start,\n const PointInfo end,const PointInfo arc,const double angle,\n const MagickBooleanType large_arc,const MagickBooleanType sweep)\n{\n double\n alpha,\n beta,\n delta,\n factor,\n gamma,\n theta;\n\n MagickStatusType\n status;\n\n PointInfo\n center,\n points[3],\n radii;\n\n double\n cosine,\n sine;\n\n PrimitiveInfo\n *primitive_info;\n\n PrimitiveInfo\n *p;\n\n ssize_t\n i;\n\n size_t\n arc_segments;\n\n ssize_t\n offset;\n\n offset=mvg_info->offset;\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n primitive_info->coordinates=0;\n if ((fabs(start.x-end.x) < MagickEpsilon) &&\n (fabs(start.y-end.y) < MagickEpsilon))\n return(TracePoint(primitive_info,end));\n radii.x=fabs(arc.x);\n radii.y=fabs(arc.y);\n if ((radii.x < MagickEpsilon) || (radii.y < MagickEpsilon))\n return(TraceLine(primitive_info,start,end));\n cosine=cos(DegreesToRadians(fmod((double) angle,360.0)));\n sine=sin(DegreesToRadians(fmod((double) angle,360.0)));\n center.x=(double) (cosine*(end.x-start.x)/2+sine*(end.y-start.y)/2);\n center.y=(double) (cosine*(end.y-start.y)/2-sine*(end.x-start.x)/2);\n delta=(center.x*center.x)/(radii.x*radii.x)+(center.y*center.y)/\n (radii.y*radii.y);\n if (delta < MagickEpsilon)\n return(TraceLine(primitive_info,start,end));\n if (delta > 1.0)\n {\n radii.x*=sqrt((double) delta);\n radii.y*=sqrt((double) delta);\n }\n points[0].x=(double) (cosine*start.x/radii.x+sine*start.y/radii.x);\n points[0].y=(double) (cosine*start.y/radii.y-sine*start.x/radii.y);\n points[1].x=(double) (cosine*end.x/radii.x+sine*end.y/radii.x);\n points[1].y=(double) (cosine*end.y/radii.y-sine*end.x/radii.y);\n alpha=points[1].x-points[0].x;\n beta=points[1].y-points[0].y;\n if (fabs(alpha*alpha+beta*beta) < MagickEpsilon)\n return(TraceLine(primitive_info,start,end));\n factor=PerceptibleReciprocal(alpha*alpha+beta*beta)-0.25;\n if (factor <= 0.0)\n factor=0.0;\n else\n {\n factor=sqrt((double) factor);\n if (sweep == large_arc)\n factor=(-factor);\n }\n center.x=(double) ((points[0].x+points[1].x)/2-factor*beta);\n center.y=(double) ((points[0].y+points[1].y)/2+factor*alpha);\n alpha=atan2(points[0].y-center.y,points[0].x-center.x);\n theta=atan2(points[1].y-center.y,points[1].x-center.x)-alpha;\n if ((theta < 0.0) && (sweep != MagickFalse))\n theta+=2.0*MagickPI;\n else\n if ((theta > 0.0) && (sweep == MagickFalse))\n theta-=2.0*MagickPI;\n arc_segments=(size_t) CastDoubleToLong(ceil(fabs((double) (theta/(0.5*\n MagickPI+MagickEpsilon)))));\n p=primitive_info;\n status=MagickTrue;\n for (i=0; i < (ssize_t) arc_segments; i++)\n {\n beta=0.5*((alpha+(i+1)*theta/arc_segments)-(alpha+i*theta/arc_segments));\n gamma=(8.0/3.0)*sin(fmod((double) (0.5*beta),DegreesToRadians(360.0)))*\n sin(fmod((double) (0.5*beta),DegreesToRadians(360.0)))/\n sin(fmod((double) beta,DegreesToRadians(360.0)));\n points[0].x=(double) (center.x+cos(fmod((double) (alpha+(double) i*theta/\n arc_segments),DegreesToRadians(360.0)))-gamma*sin(fmod((double) (alpha+\n (double) i*theta/arc_segments),DegreesToRadians(360.0))));\n points[0].y=(double) (center.y+sin(fmod((double) (alpha+(double) i*theta/\n arc_segments),DegreesToRadians(360.0)))+gamma*cos(fmod((double) (alpha+\n (double) i*theta/arc_segments),DegreesToRadians(360.0))));\n points[2].x=(double) (center.x+cos(fmod((double) (alpha+(double) (i+1)*\n theta/arc_segments),DegreesToRadians(360.0))));\n points[2].y=(double) (center.y+sin(fmod((double) (alpha+(double) (i+1)*\n theta/arc_segments),DegreesToRadians(360.0))));\n points[1].x=(double) (points[2].x+gamma*sin(fmod((double) (alpha+(double)\n (i+1)*theta/arc_segments),DegreesToRadians(360.0))));\n points[1].y=(double) (points[2].y-gamma*cos(fmod((double) (alpha+(double)\n (i+1)*theta/arc_segments),DegreesToRadians(360.0))));\n p->point.x=(p == primitive_info) ? start.x : (p-1)->point.x;\n p->point.y=(p == primitive_info) ? start.y : (p-1)->point.y;\n (p+1)->point.x=(double) (cosine*radii.x*points[0].x-sine*radii.y*\n points[0].y);\n (p+1)->point.y=(double) (sine*radii.x*points[0].x+cosine*radii.y*\n points[0].y);\n (p+2)->point.x=(double) (cosine*radii.x*points[1].x-sine*radii.y*\n points[1].y);\n (p+2)->point.y=(double) (sine*radii.x*points[1].x+cosine*radii.y*\n points[1].y);\n (p+3)->point.x=(double) (cosine*radii.x*points[2].x-sine*radii.y*\n points[2].y);\n (p+3)->point.y=(double) (sine*radii.x*points[2].x+cosine*radii.y*\n points[2].y);\n if (i == (ssize_t) (arc_segments-1))\n (p+3)->point=end;\n status&=TraceBezier(mvg_info,4);\n if (status == 0)\n break;\n p=(*mvg_info->primitive_info)+mvg_info->offset;\n mvg_info->offset+=p->coordinates;\n p+=p->coordinates;\n }\n if (status == 0)\n return(MagickFalse);\n mvg_info->offset=offset;\n primitive_info=(*mvg_info->primitive_info)+mvg_info->offset;\n primitive_info->coordinates=(size_t) (p-primitive_info);\n primitive_info->closed_subpath=MagickFalse;\n for (i=0; i < (ssize_t) primitive_info->coordinates; i++)\n {\n p->primitive=primitive_info->primitive;\n p--;\n }\n return(MagickTrue);\n}",
  23863. "project": "ImageMagick6",
  23864. "hash": 73304484946342503190438339501963101627,
  23865. "size": 148,
  23866. "commit_id": "9a94877f7823b0b8a41d50638dd105229d91fa89",
  23867. "message": "https://github.com/ImageMagick/ImageMagick/issues/3339",
  23868. "target": 0,
  23869. "dataset": "other",
  23870. "idx": 316677
  23871. }
  23872. ]
  23873. },
  23874. {
  23875. "call_depth": 3,
  23876. "longest_call_chain": [
  23877. "WritePS3Image",
  23878. "WritePS3MaskImage",
  23879. "SerializeImageChannel"
  23880. ],
  23881. "group_size": 5,
  23882. "functions": [
  23883. {
  23884. "func": "static MagickBooleanType SerializeImageIndexes(const ImageInfo *image_info,\n Image *image,MemoryInfo **pixel_info,size_t *length,ExceptionInfo *exception)\n{\n MagickBooleanType\n status;\n\n register const Quantum\n *p;\n\n register ssize_t\n x;\n\n register unsigned char\n *q;\n\n ssize_t\n y;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=MagickTrue;\n *length=(size_t) image->columns*image->rows;\n *pixel_info=AcquireVirtualMemory(*length,sizeof(*q));\n if (*pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n q=(unsigned char *) GetVirtualMemoryBlob(*pixel_info);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=(unsigned char) GetPixelIndex(image,p);\n p+=GetPixelChannels(image);\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n if (status == MagickFalse)\n *pixel_info=RelinquishVirtualMemory(*pixel_info);\n return(status);\n}",
  23885. "project": "ImageMagick",
  23886. "hash": 1422216920378647312522307092579595425,
  23887. "size": 50,
  23888. "commit_id": "7b04c53c69792243d66d6876f843b850b3cc002b",
  23889. "message": "Fixed memory leaks reported in #1557.",
  23890. "target": 0,
  23891. "dataset": "other",
  23892. "idx": 416804
  23893. },
  23894. {
  23895. "func": "static MagickBooleanType WritePS3Image(const ImageInfo *image_info,Image *image,\n ExceptionInfo *exception)\n{\n static const char\n *const PostscriptProlog[]=\n {\n \"/ByteStreamDecodeFilter\",\n \"{\",\n \" /z exch def\",\n \" /r exch def\",\n \" /c exch def\",\n \" z \" PS3_NoCompression \" eq { /ASCII85Decode filter } if\",\n \" z \" PS3_FaxCompression \" eq\",\n \" {\",\n \" <<\",\n \" /K \" CCITTParam,\n \" /Columns c\",\n \" /Rows r\",\n \" >>\",\n \" /CCITTFaxDecode filter\",\n \" } if\",\n \" z \" PS3_JPEGCompression \" eq { /DCTDecode filter } if\",\n \" z \" PS3_LZWCompression \" eq { /LZWDecode filter } if\",\n \" z \" PS3_RLECompression \" eq { /RunLengthDecode filter } if\",\n \" z \" PS3_ZipCompression \" eq { /FlateDecode filter } if\",\n \"} bind def\",\n \"\",\n \"/DirectClassImageDict\",\n \"{\",\n \" colorspace \" PS3_RGBColorspace \" eq\",\n \" {\",\n \" /DeviceRGB setcolorspace\",\n \" <<\",\n \" /ImageType 1\",\n \" /Width columns\",\n \" /Height rows\",\n \" /BitsPerComponent 8\",\n \" /DataSource pixel_stream\",\n \" /MultipleDataSources false\",\n \" /ImageMatrix [columns 0 0 rows neg 0 rows]\",\n \" /Decode [0 1 0 1 0 1]\",\n \" >>\",\n \" }\",\n \" {\",\n \" /DeviceCMYK setcolorspace\",\n \" <<\",\n \" /ImageType 1\",\n \" /Width columns\",\n \" /Height rows\",\n \" /BitsPerComponent 8\",\n \" /DataSource pixel_stream\",\n \" /MultipleDataSources false\",\n \" /ImageMatrix [columns 0 0 rows neg 0 rows]\",\n \" /Decode\",\n \" compression \" PS3_JPEGCompression \" eq\",\n \" { [1 0 1 0 1 0 1 0] }\",\n \" { [0 1 0 1 0 1 0 1] }\",\n \" ifelse\",\n \" >>\",\n \" }\",\n \" ifelse\",\n \"} bind def\",\n \"\",\n \"/PseudoClassImageDict\",\n \"{\",\n \" % Colors in colormap image.\",\n \" currentfile buffer readline pop\",\n \" token pop /colors exch def pop\",\n \" colors 0 eq\",\n \" {\",\n \" % Depth of grayscale image.\",\n \" currentfile buffer readline pop\",\n \" token pop /bits exch def pop\",\n \" /DeviceGray setcolorspace\",\n \" <<\",\n \" /ImageType 1\",\n \" /Width columns\",\n \" /Height rows\",\n \" /BitsPerComponent bits\",\n \" /Decode [0 1]\",\n \" /ImageMatrix [columns 0 0 rows neg 0 rows]\",\n \" /DataSource pixel_stream\",\n \" >>\",\n \" }\",\n \" {\",\n \" % RGB colormap.\",\n \" /colormap colors 3 mul string def\",\n \" compression \" PS3_NoCompression \" eq\",\n \" { currentfile /ASCII85Decode filter colormap readstring pop pop }\",\n \" { currentfile colormap readstring pop pop }\",\n \" ifelse\",\n \" [ /Indexed /DeviceRGB colors 1 sub colormap ] setcolorspace\",\n \" <<\",\n \" /ImageType 1\",\n \" /Width columns\",\n \" /Height rows\",\n \" /BitsPerComponent 8\",\n \" /Decode [0 255]\",\n \" /ImageMatrix [columns 0 0 rows neg 0 rows]\",\n \" /DataSource pixel_stream\",\n \" >>\",\n \" }\",\n \" ifelse\",\n \"} bind def\",\n \"\",\n \"/NonMaskedImageDict\",\n \"{\",\n \" class \" PS3_PseudoClass \" eq\",\n \" { PseudoClassImageDict }\",\n \" { DirectClassImageDict }\",\n \" ifelse\",\n \"} bind def\",\n \"\",\n \"/MaskedImageDict\",\n \"{\",\n \" <<\",\n \" /ImageType 3\",\n \" /InterleaveType 3\",\n \" /DataDict NonMaskedImageDict\",\n \" /MaskDict\",\n \" <<\",\n \" /ImageType 1\",\n \" /Width columns\",\n \" /Height rows\",\n \" /BitsPerComponent 1\",\n \" /DataSource mask_stream\",\n \" /MultipleDataSources false\",\n \" /ImageMatrix [ columns 0 0 rows neg 0 rows]\",\n \" /Decode [ 0 1 ]\",\n \" >>\",\n \" >>\",\n \"} bind def\",\n \"\",\n \"/ClipImage\",\n \"{} def\",\n \"\",\n \"/DisplayImage\",\n \"{\",\n \" gsave\",\n \" /buffer 512 string def\",\n \" % Translation.\",\n \" currentfile buffer readline pop\",\n \" token pop /x exch def\",\n \" token pop /y exch def pop\",\n \" x y translate\",\n \" % Image size and font size.\",\n \" currentfile buffer readline pop\",\n \" token pop /x exch def\",\n \" token pop /y exch def pop\",\n \" currentfile buffer readline pop\",\n \" token pop /pointsize exch def pop\",\n (const char *) NULL\n },\n *const PostscriptEpilog[]=\n {\n \" x y scale\",\n \" % Clipping path.\",\n \" currentfile buffer readline pop\",\n \" token pop /clipped exch def pop\",\n \" % Showpage.\",\n \" currentfile buffer readline pop\",\n \" token pop /sp exch def pop\",\n \" % Image pixel size.\",\n \" currentfile buffer readline pop\",\n \" token pop /columns exch def\",\n \" token pop /rows exch def pop\",\n \" % Colorspace (RGB/CMYK).\",\n \" currentfile buffer readline pop\",\n \" token pop /colorspace exch def pop\",\n \" % Transparency.\",\n \" currentfile buffer readline pop\",\n \" token pop /alpha exch def pop\",\n \" % Stencil mask?\",\n \" currentfile buffer readline pop\",\n \" token pop /stencil exch def pop\",\n \" % Image class (direct/pseudo).\",\n \" currentfile buffer readline pop\",\n \" token pop /class exch def pop\",\n \" % Compression type.\",\n \" currentfile buffer readline pop\",\n \" token pop /compression exch def pop\",\n \" % Clip and render.\",\n \" /pixel_stream currentfile columns rows compression ByteStreamDecodeFilter def\",\n \" clipped { ClipImage } if\",\n \" alpha stencil not and\",\n \" { MaskedImageDict mask_stream resetfile }\",\n \" { NonMaskedImageDict }\",\n \" ifelse\",\n \" stencil { 0 setgray imagemask } { image } ifelse\",\n \" grestore\",\n \" sp { showpage } if\",\n \"} bind def\",\n (const char *) NULL\n };\n\n char\n buffer[MagickPathExtent],\n date[MagickPathExtent],\n **labels,\n page_geometry[MagickPathExtent];\n\n CompressionType\n compression;\n\n const char\n *option,\n *const *q,\n *value;\n\n double\n pointsize;\n\n GeometryInfo\n geometry_info;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset,\n scene,\n start,\n stop;\n\n MagickStatusType\n flags;\n\n MemoryInfo\n *pixel_info;\n\n PointInfo\n delta,\n resolution,\n scale;\n\n RectangleInfo\n geometry,\n media_info,\n page_info;\n\n register ssize_t\n i;\n\n SegmentInfo\n bounds;\n\n size_t\n imageListLength,\n length,\n page,\n pixel,\n text_size;\n\n ssize_t\n j;\n\n time_t\n timer;\n\n unsigned char\n *pixels;\n\n /*\n Open output image file.\n */\n assert(image_info != (const ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);\n if (status == MagickFalse)\n return(MagickFalse);\n compression=image->compression;\n if (image_info->compression != UndefinedCompression)\n compression=image_info->compression;\n switch (compression)\n {\n case FaxCompression:\n case Group4Compression:\n { \n if ((SetImageMonochrome(image,exception) == MagickFalse) ||\n (image->alpha_trait != UndefinedPixelTrait))\n compression=RLECompression;\n break;\n }\n#if !defined(MAGICKCORE_JPEG_DELEGATE)\n case JPEGCompression:\n {\n compression=RLECompression;\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"DelegateLibrarySupportNotBuiltIn\",\"`%s' (JPEG)\",\n image->filename);\n break;\n }\n#endif\n#if !defined(MAGICKCORE_ZLIB_DELEGATE)\n case ZipCompression:\n {\n compression=RLECompression;\n (void) ThrowMagickException(exception,GetMagickModule(),\n MissingDelegateError,\"DelegateLibrarySupportNotBuiltIn\",\"`%s' (ZLIB)\",\n image->filename);\n break;\n }\n#endif\n default:\n break;\n }\n (void) memset(&bounds,0,sizeof(bounds));\n page=0;\n scene=0;\n imageListLength=GetImageListLength(image);\n do\n {\n /*\n Scale relative to dots-per-inch.\n */\n delta.x=DefaultResolution;\n delta.y=DefaultResolution;\n resolution.x=image->resolution.x;\n resolution.y=image->resolution.y;\n if ((resolution.x == 0.0) || (resolution.y == 0.0))\n {\n flags=ParseGeometry(PSDensityGeometry,&geometry_info);\n resolution.x=geometry_info.rho;\n resolution.y=geometry_info.sigma;\n if ((flags & SigmaValue) == 0)\n resolution.y=resolution.x;\n }\n if (image_info->density != (char *) NULL)\n {\n flags=ParseGeometry(image_info->density,&geometry_info);\n resolution.x=geometry_info.rho;\n resolution.y=geometry_info.sigma;\n if ((flags & SigmaValue) == 0)\n resolution.y=resolution.x;\n }\n if (image->units == PixelsPerCentimeterResolution)\n {\n resolution.x=(100.0*2.54*resolution.x+0.5)/100.0;\n resolution.y=(100.0*2.54*resolution.y+0.5)/100.0;\n }\n SetGeometry(image,&geometry);\n (void) FormatLocaleString(page_geometry,MagickPathExtent,\"%.20gx%.20g\",\n (double) image->columns,(double) image->rows);\n if (image_info->page != (char *) NULL)\n (void) CopyMagickString(page_geometry,image_info->page,MagickPathExtent);\n else\n if ((image->page.width != 0) && (image->page.height != 0))\n (void) FormatLocaleString(page_geometry,MagickPathExtent,\n \"%.20gx%.20g%+.20g%+.20g\",(double) image->page.width,(double)\n image->page.height,(double) image->page.x,(double) image->page.y);\n else\n if ((image->gravity != UndefinedGravity) &&\n (LocaleCompare(image_info->magick,\"PS\") == 0))\n (void) CopyMagickString(page_geometry,PSPageGeometry,\n MagickPathExtent);\n (void) ConcatenateMagickString(page_geometry,\">\",MagickPathExtent);\n (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y,\n &geometry.width,&geometry.height);\n scale.x=PerceptibleReciprocal(resolution.x)*geometry.width*delta.x;\n geometry.width=(size_t) floor(scale.x+0.5);\n scale.y=PerceptibleReciprocal(resolution.y)*geometry.height*delta.y;\n geometry.height=(size_t) floor(scale.y+0.5);\n (void) ParseAbsoluteGeometry(page_geometry,&media_info);\n (void) ParseGravityGeometry(image,page_geometry,&page_info,exception);\n if (image->gravity != UndefinedGravity)\n {\n geometry.x=(-page_info.x);\n geometry.y=(ssize_t) (media_info.height+page_info.y-image->rows);\n }\n pointsize=12.0;\n if (image_info->pointsize != 0.0)\n pointsize=image_info->pointsize;\n text_size=0;\n value=GetImageProperty(image,\"label\",exception);\n if (value != (const char *) NULL)\n text_size=(size_t) (MultilineCensus(value)*pointsize+12);\n page++;\n if (page == 1)\n {\n /*\n Postscript header on the first page.\n */\n if (LocaleCompare(image_info->magick,\"PS3\") == 0)\n (void) CopyMagickString(buffer,\"%!PS-Adobe-3.0\\n\",MagickPathExtent);\n else\n (void) CopyMagickString(buffer,\"%!PS-Adobe-3.0 EPSF-3.0\\n\",\n MagickPathExtent);\n (void) WriteBlobString(image,buffer);\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%Creator: ImageMagick %s\\n\",MagickLibVersionText);\n (void) WriteBlobString(image,buffer);\n (void) FormatLocaleString(buffer,MagickPathExtent,\"%%%%Title: %s\\n\",\n image->filename);\n (void) WriteBlobString(image,buffer);\n timer=GetMagickTime();\n (void) FormatMagickTime(timer,MagickPathExtent,date);\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%CreationDate: %s\\n\",date);\n (void) WriteBlobString(image,buffer);\n bounds.x1=(double) geometry.x;\n bounds.y1=(double) geometry.y;\n bounds.x2=(double) geometry.x+scale.x;\n bounds.y2=(double) geometry.y+scale.y+text_size;\n if ((image_info->adjoin != MagickFalse) &&\n (GetNextImageInList(image) != (Image *) NULL))\n {\n (void) WriteBlobString(image,\"%%BoundingBox: (atend)\\n\");\n (void) WriteBlobString(image,\"%%HiResBoundingBox: (atend)\\n\");\n }\n else\n {\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%BoundingBox: %g %g %g %g\\n\",ceil(bounds.x1-0.5),\n ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));\n (void) WriteBlobString(image,buffer);\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%HiResBoundingBox: %g %g %g %g\\n\",bounds.x1,\n bounds.y1,bounds.x2,bounds.y2);\n (void) WriteBlobString(image,buffer);\n if (image->colorspace == CMYKColorspace)\n (void) WriteBlobString(image,\n \"%%DocumentProcessColors: Cyan Magenta Yellow Black\\n\");\n else\n if (SetImageGray(image,exception) != MagickFalse)\n (void) WriteBlobString(image,\n \"%%DocumentProcessColors: Black\\n\");\n }\n /*\n Font resources\n */\n value=GetImageProperty(image,\"label\",exception);\n if (value != (const char *) NULL)\n (void) WriteBlobString(image,\n \"%%DocumentNeededResources: font Helvetica\\n\");\n (void) WriteBlobString(image,\"%%LanguageLevel: 3\\n\");\n /*\n Pages, orientation and order.\n */\n if (LocaleCompare(image_info->magick,\"PS3\") != 0)\n (void) WriteBlobString(image,\"%%Pages: 1\\n\");\n else\n {\n (void) WriteBlobString(image,\"%%Orientation: Portrait\\n\");\n (void) WriteBlobString(image,\"%%PageOrder: Ascend\\n\");\n if (image_info->adjoin == MagickFalse)\n (void) CopyMagickString(buffer,\"%%Pages: 1\\n\",MagickPathExtent);\n else\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%Pages: %.20g\\n\",(double) imageListLength);\n (void) WriteBlobString(image,buffer);\n }\n if (image->colorspace == CMYKColorspace)\n (void) WriteBlobString(image,\n \"%%DocumentProcessColors: Cyan Magenta Yellow Black\\n\");\n (void) WriteBlobString(image,\"%%EndComments\\n\");\n /*\n The static postscript procedures prolog.\n */\n (void)WriteBlobString(image,\"%%BeginProlog\\n\");\n for (q=PostscriptProlog; *q; q++)\n {\n (void) WriteBlobString(image,*q);\n (void) WriteBlobByte(image,'\\n');\n }\n /*\n One label line for each line in label string.\n */\n value=GetImageProperty(image,\"label\",exception);\n if (value != (const char *) NULL)\n {\n (void) WriteBlobString(image,\"\\n %% Labels.\\n /Helvetica \"\n \" findfont pointsize scalefont setfont\\n\");\n for (i=(ssize_t) MultilineCensus(value)-1; i >= 0; i--)\n {\n (void) WriteBlobString(image,\n \" currentfile buffer readline pop token pop\\n\");\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \" 0 y %g add moveto show pop\\n\",i*pointsize+12);\n (void) WriteBlobString(image,buffer);\n }\n }\n /*\n The static postscript procedures epilog.\n */\n for (q=PostscriptEpilog; *q; q++)\n {\n (void) WriteBlobString(image,*q);\n (void) WriteBlobByte(image,'\\n');\n }\n (void)WriteBlobString(image,\"%%EndProlog\\n\");\n }\n (void) FormatLocaleString(buffer,MagickPathExtent,\"%%%%Page: 1 %.20g\\n\",\n (double) page);\n (void) WriteBlobString(image,buffer);\n /*\n Page bounding box.\n */\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%PageBoundingBox: %.20g %.20g %.20g %.20g\\n\",(double) geometry.x,\n (double) geometry.y,geometry.x+(double) geometry.width,geometry.y+\n (double) (geometry.height+text_size));\n (void) WriteBlobString(image,buffer);\n /*\n Page process colors if not RGB.\n */\n if (image->colorspace == CMYKColorspace)\n (void) WriteBlobString(image,\n \"%%PageProcessColors: Cyan Magenta Yellow Black\\n\");\n else\n if (SetImageGray(image,exception) != MagickFalse)\n (void) WriteBlobString(image,\"%%PageProcessColors: Black\\n\");\n /*\n Adjust document bounding box to bound page bounding box.\n */\n if ((double) geometry.x < bounds.x1)\n bounds.x1=(double) geometry.x;\n if ((double) geometry.y < bounds.y1)\n bounds.y1=(double) geometry.y;\n if ((double) (geometry.x+scale.x) > bounds.x2)\n bounds.x2=(double) geometry.x+scale.x;\n if ((double) (geometry.y+scale.y+text_size) > bounds.y2)\n bounds.y2=(double) geometry.y+scale.y+text_size;\n /*\n Page font resource if there's a label.\n */\n value=GetImageProperty(image,\"label\",exception);\n if (value != (const char *) NULL)\n (void) WriteBlobString(image,\"%%PageResources: font Helvetica\\n\");\n /*\n PS clipping path from Photoshop clipping path.\n */\n if (((image->channels & WriteMaskChannel) != 0) ||\n (LocaleNCompare(\"8BIM:\",image->magick_filename,5) != 0))\n (void) WriteBlobString(image,\"/ClipImage {} def\\n\");\n else\n {\n const char\n *value;\n\n value=GetImageProperty(image,image->magick_filename,exception);\n if (value == (const char *) NULL)\n return(MagickFalse);\n (void) WriteBlobString(image,value);\n (void) WriteBlobByte(image,'\\n');\n }\n /*\n Push a dictionary for our own def's if this an EPS.\n */\n if (LocaleCompare(image_info->magick,\"PS3\") != 0)\n (void) WriteBlobString(image,\"userdict begin\\n\");\n /*\n Image mask.\n */\n if ((image->alpha_trait != UndefinedPixelTrait) &&\n (WritePS3MaskImage(image_info,image,compression,exception) == MagickFalse))\n {\n (void) CloseBlob(image);\n return(MagickFalse);\n }\n /*\n Remember position of BeginData comment so we can update it.\n */\n start=TellBlob(image);\n if (start < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%BeginData:%13ld %s Bytes\\n\",0L,\n compression == NoCompression ? \"ASCII\" : \"BINARY\");\n (void) WriteBlobString(image,buffer);\n stop=TellBlob(image);\n if (stop < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n (void) WriteBlobString(image,\"DisplayImage\\n\");\n /*\n Translate, scale, and font point size.\n */\n (void) FormatLocaleString(buffer,MagickPathExtent,\"%.20g %.20g\\n%g %g\\n%g\\n\",\n (double) geometry.x,(double) geometry.y,scale.x,scale.y,pointsize);\n (void) WriteBlobString(image,buffer);\n /*\n Output labels.\n */\n labels=(char **) NULL;\n value=GetImageProperty(image,\"label\",exception);\n if (value != (const char *) NULL)\n labels=StringToList(value);\n if (labels != (char **) NULL)\n {\n for (i=0; labels[i] != (char *) NULL; i++)\n {\n if (compression != NoCompression)\n {\n for (j=0; labels[i][j] != '\\0'; j++)\n (void) WriteBlobByte(image,(unsigned char) labels[i][j]);\n (void) WriteBlobByte(image,'\\n');\n }\n else\n {\n (void) WriteBlobString(image,\"<~\");\n Ascii85Initialize(image);\n for (j=0; labels[i][j] != '\\0'; j++)\n Ascii85Encode(image,(unsigned char) labels[i][j]);\n Ascii85Flush(image);\n }\n labels[i]=DestroyString(labels[i]);\n }\n labels=(char **) RelinquishMagickMemory(labels);\n }\n /*\n Photoshop clipping path active?\n */\n if (((image->channels & WriteMaskChannel) != 0) &&\n (LocaleNCompare(\"8BIM:\",image->magick_filename,5) == 0))\n (void) WriteBlobString(image,\"true\\n\");\n else\n (void) WriteBlobString(image,\"false\\n\");\n /*\n Showpage for non-EPS.\n */\n (void) WriteBlobString(image, LocaleCompare(image_info->magick,\"PS3\") == 0 ?\n \"true\\n\" : \"false\\n\");\n /*\n Image columns, rows, and color space.\n */\n (void) FormatLocaleString(buffer,MagickPathExtent,\"%.20g %.20g\\n%s\\n\",\n (double) image->columns,(double) image->rows,image->colorspace ==\n CMYKColorspace ? PS3_CMYKColorspace : PS3_RGBColorspace);\n (void) WriteBlobString(image,buffer);\n /*\n Masked image?\n */\n (void) WriteBlobString(image,image->alpha_trait != UndefinedPixelTrait ?\n \"true\\n\" : \"false\\n\");\n /*\n Render with imagemask operator?\n */\n option=GetImageOption(image_info,\"ps3:imagemask\");\n (void) WriteBlobString(image,((option != (const char *) NULL) &&\n (SetImageMonochrome(image,exception) != MagickFalse)) ?\n \"true\\n\" : \"false\\n\");\n /*\n Output pixel data.\n */\n pixels=(unsigned char *) NULL;\n length=0;\n if ((image_info->type != TrueColorType) &&\n (image_info->type != TrueColorAlphaType) &&\n (image_info->type != ColorSeparationType) &&\n (image_info->type != ColorSeparationAlphaType) &&\n (image->colorspace != CMYKColorspace) &&\n ((SetImageGray(image,exception) != MagickFalse) ||\n (SetImageMonochrome(image,exception) != MagickFalse)))\n {\n /*\n Gray images.\n */\n (void) WriteBlobString(image,PS3_PseudoClass\"\\n\");\n switch (compression)\n {\n case NoCompression:\n default:\n {\n (void) WriteBlobString(image,PS3_NoCompression\"\\n\");\n break;\n }\n case FaxCompression:\n case Group4Compression:\n {\n (void) WriteBlobString(image,PS3_FaxCompression\"\\n\");\n break;\n }\n case JPEGCompression:\n {\n (void) WriteBlobString(image,PS3_JPEGCompression\"\\n\");\n break;\n }\n case LZWCompression:\n {\n (void) WriteBlobString(image,PS3_LZWCompression\"\\n\");\n break;\n }\n case RLECompression:\n {\n (void) WriteBlobString(image,PS3_RLECompression\"\\n\");\n break;\n }\n case ZipCompression:\n {\n (void) WriteBlobString(image,PS3_ZipCompression\"\\n\");\n break;\n }\n }\n /*\n Number of colors -- 0 for single component non-color mapped data.\n */\n (void) WriteBlobString(image,\"0\\n\");\n /*\n 1 bit or 8 bit components?\n */\n (void) FormatLocaleString(buffer,MagickPathExtent,\"%d\\n\",\n SetImageMonochrome(image,exception) != MagickFalse ? 1 : 8);\n (void) WriteBlobString(image,buffer);\n /*\n Image data.\n */\n if (compression == JPEGCompression)\n status=InjectImageBlob(image_info,image,image,\"jpeg\",exception);\n else\n if ((compression == FaxCompression) ||\n (compression == Group4Compression))\n {\n if (LocaleCompare(CCITTParam,\"0\") == 0)\n status=HuffmanEncodeImage(image_info,image,image,exception);\n else\n status=Huffman2DEncodeImage(image_info,image,image,exception);\n }\n else\n {\n status=SerializeImageChannel(image_info,image,&pixel_info,&length,\n exception);\n if (status == MagickFalse)\n {\n (void) CloseBlob(image);\n return(MagickFalse);\n }\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n switch (compression)\n {\n case NoCompression:\n default:\n {\n Ascii85Initialize(image);\n for (i=0; i < (ssize_t) length; i++)\n Ascii85Encode(image,pixels[i]);\n Ascii85Flush(image);\n status=MagickTrue;\n break;\n }\n case LZWCompression:\n {\n status=LZWEncodeImage(image,length,pixels,exception);\n break;\n }\n case RLECompression:\n {\n status=PackbitsEncodeImage(image,length,pixels,exception);\n break;\n }\n case ZipCompression:\n {\n status=ZLIBEncodeImage(image,length,pixels,exception);\n break;\n }\n }\n pixel_info=RelinquishVirtualMemory(pixel_info);\n }\n }\n else\n if ((image->storage_class == DirectClass) || (image->colors > 256) ||\n (compression == JPEGCompression))\n {\n /*\n Truecolor image.\n */\n (void) WriteBlobString(image,PS3_DirectClass\"\\n\");\n switch (compression)\n {\n case NoCompression:\n default:\n {\n (void) WriteBlobString(image,PS3_NoCompression\"\\n\");\n break;\n }\n case RLECompression:\n {\n (void) WriteBlobString(image,PS3_RLECompression\"\\n\");\n break;\n }\n case JPEGCompression:\n {\n (void) WriteBlobString(image,PS3_JPEGCompression\"\\n\");\n break;\n }\n case LZWCompression:\n {\n (void) WriteBlobString(image,PS3_LZWCompression\"\\n\");\n break;\n }\n case ZipCompression:\n {\n (void) WriteBlobString(image,PS3_ZipCompression\"\\n\");\n break;\n }\n }\n /*\n Image data.\n */\n if (compression == JPEGCompression)\n status=InjectImageBlob(image_info,image,image,\"jpeg\",exception);\n else\n {\n /*\n Stream based compressions.\n */\n status=SerializeImage(image_info,image,&pixel_info,&length,\n exception);\n if (status == MagickFalse)\n {\n (void) CloseBlob(image);\n return(MagickFalse);\n }\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n switch (compression)\n {\n case NoCompression:\n default:\n {\n Ascii85Initialize(image);\n for (i=0; i < (ssize_t) length; i++)\n Ascii85Encode(image,pixels[i]);\n Ascii85Flush(image);\n status=MagickTrue;\n break;\n }\n case RLECompression:\n {\n status=PackbitsEncodeImage(image,length,pixels,exception);\n break;\n }\n case LZWCompression:\n {\n status=LZWEncodeImage(image,length,pixels,exception);\n break;\n }\n case ZipCompression:\n {\n status=ZLIBEncodeImage(image,length,pixels,exception);\n break;\n }\n }\n pixel_info=RelinquishVirtualMemory(pixel_info);\n }\n }\n else\n {\n /*\n Colormapped images.\n */\n (void) WriteBlobString(image,PS3_PseudoClass\"\\n\");\n switch (compression)\n {\n case NoCompression:\n default:\n {\n (void) WriteBlobString(image,PS3_NoCompression\"\\n\");\n break;\n }\n case RLECompression:\n {\n (void) WriteBlobString(image,PS3_RLECompression\"\\n\");\n break;\n }\n case LZWCompression:\n {\n (void) WriteBlobString(image,PS3_LZWCompression\"\\n\");\n break;\n }\n case ZipCompression:\n {\n (void) WriteBlobString(image,PS3_ZipCompression\"\\n\");\n break;\n }\n }\n /*\n Number of colors in color map.\n */\n (void) FormatLocaleString(buffer,MagickPathExtent,\"%.20g\\n\",\n (double) image->colors);\n (void) WriteBlobString(image,buffer);\n /*\n Color map - uncompressed.\n */\n if ((compression != NoCompression) &&\n (compression != UndefinedCompression))\n {\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n pixel=ScaleQuantumToChar(image->colormap[i].red);\n (void) WriteBlobByte(image,(unsigned char) pixel);\n pixel=ScaleQuantumToChar(image->colormap[i].green);\n (void) WriteBlobByte(image,(unsigned char) pixel);\n pixel=ScaleQuantumToChar(image->colormap[i].blue);\n (void) WriteBlobByte(image,(unsigned char) pixel);\n }\n }\n else\n {\n Ascii85Initialize(image);\n for (i=0; i < (ssize_t) image->colors; i++)\n {\n pixel=ScaleQuantumToChar(image->colormap[i].red);\n Ascii85Encode(image,(unsigned char) pixel);\n pixel=ScaleQuantumToChar(image->colormap[i].green);\n Ascii85Encode(image,(unsigned char) pixel);\n pixel=ScaleQuantumToChar(image->colormap[i].blue);\n Ascii85Encode(image,(unsigned char) pixel);\n }\n Ascii85Flush(image);\n }\n status=SerializeImageIndexes(image_info,image,&pixel_info,&length,\n exception);\n if (status == MagickFalse)\n {\n (void) CloseBlob(image);\n return(MagickFalse);\n }\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n switch (compression)\n {\n case NoCompression:\n default:\n {\n Ascii85Initialize(image);\n for (i=0; i < (ssize_t) length; i++)\n Ascii85Encode(image,pixels[i]);\n Ascii85Flush(image);\n status=MagickTrue;\n break;\n }\n case RLECompression:\n {\n status=PackbitsEncodeImage(image,length,pixels,exception);\n break;\n }\n case LZWCompression:\n {\n status=LZWEncodeImage(image,length,pixels,exception);\n break;\n }\n case ZipCompression:\n {\n status=ZLIBEncodeImage(image,length,pixels,exception);\n break;\n }\n }\n pixel_info=RelinquishVirtualMemory(pixel_info);\n }\n (void) WriteBlobByte(image,'\\n');\n if (status == MagickFalse)\n {\n (void) CloseBlob(image);\n return(MagickFalse);\n }\n /*\n Update BeginData now that we know the data size.\n */\n length=(size_t) (TellBlob(image)-stop);\n stop=TellBlob(image);\n if (stop < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n offset=SeekBlob(image,start,SEEK_SET);\n if (offset < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%BeginData:%13ld %s Bytes\\n\",(long) length,\n compression == NoCompression ? \"ASCII\" : \"BINARY\");\n (void) WriteBlobString(image,buffer);\n offset=SeekBlob(image,stop,SEEK_SET);\n (void) WriteBlobString(image,\"%%EndData\\n\");\n /*\n End private dictionary if this an EPS.\n */\n if (LocaleCompare(image_info->magick,\"PS3\") != 0)\n (void) WriteBlobString(image,\"end\\n\");\n (void) WriteBlobString(image,\"%%PageTrailer\\n\");\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n status=SetImageProgress(image,SaveImagesTag,scene++,imageListLength);\n if (status == MagickFalse)\n break;\n } while (image_info->adjoin != MagickFalse);\n (void) WriteBlobString(image,\"%%Trailer\\n\");\n if (page > 1)\n {\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%BoundingBox: %g %g %g %g\\n\",ceil(bounds.x1-0.5),\n ceil(bounds.y1-0.5),floor(bounds.x2+0.5),floor(bounds.y2+0.5));\n (void) WriteBlobString(image,buffer);\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%HiResBoundingBox: %g %g %g %g\\n\",bounds.x1,bounds.y1,bounds.x2,\n bounds.y2);\n (void) WriteBlobString(image,buffer);\n }\n (void) WriteBlobString(image,\"%%EOF\\n\");\n (void) CloseBlob(image);\n return(MagickTrue);\n}",
  23896. "project": "ImageMagick",
  23897. "hash": 289615160253947806666999393939266883372,
  23898. "size": 1004,
  23899. "commit_id": "7b04c53c69792243d66d6876f843b850b3cc002b",
  23900. "message": "Fixed memory leaks reported in #1557.",
  23901. "target": 0,
  23902. "dataset": "other",
  23903. "idx": 416809
  23904. },
  23905. {
  23906. "func": "static MagickBooleanType WritePS3MaskImage(const ImageInfo *image_info,\n Image *image,const CompressionType compression,ExceptionInfo *exception)\n{\n char\n buffer[MagickPathExtent];\n\n Image\n *mask_image;\n\n MagickBooleanType\n status;\n\n MagickOffsetType\n offset,\n start,\n stop;\n\n MemoryInfo\n *pixel_info;\n\n register ssize_t\n i;\n\n size_t\n length;\n\n unsigned char\n *pixels;\n\n assert(image_info != (ImageInfo *) NULL);\n assert(image_info->signature == MagickCoreSignature);\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n assert(image->alpha_trait != UndefinedPixelTrait);\n status=MagickTrue;\n /*\n Note BeginData DSC comment for update later.\n */\n start=TellBlob(image);\n if (start < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%BeginData:%13ld %s Bytes\\n\",0L,compression == NoCompression ?\n \"ASCII\" : \"BINARY\");\n (void) WriteBlobString(image,buffer);\n stop=TellBlob(image);\n if (stop < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n /*\n Only lossless compressions for the mask.\n */\n switch (compression)\n {\n case NoCompression:\n default:\n {\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"currentfile %.20g %.20g \" PS3_NoCompression\n \" ByteStreamDecodeFilter\\n\",(double) image->columns,(double)\n image->rows);\n break;\n }\n case FaxCompression:\n case Group4Compression:\n {\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"currentfile %.20g %.20g \" PS3_FaxCompression\n \" ByteStreamDecodeFilter\\n\",(double) image->columns,(double)\n image->rows);\n break;\n }\n case LZWCompression:\n {\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"currentfile %.20g %.20g \" PS3_LZWCompression\n \" ByteStreamDecodeFilter\\n\",(double) image->columns,(double)\n image->rows);\n break;\n }\n case RLECompression:\n {\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"currentfile %.20g %.20g \" PS3_RLECompression\n \" ByteStreamDecodeFilter\\n\",(double) image->columns,(double)\n image->rows);\n break;\n }\n case ZipCompression:\n {\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"currentfile %.20g %.20g \" PS3_ZipCompression\n \" ByteStreamDecodeFilter\\n\",(double) image->columns,(double)\n image->rows);\n break;\n }\n }\n (void) WriteBlobString(image,buffer);\n (void) WriteBlobString(image,\"/ReusableStreamDecode filter\\n\");\n mask_image=SeparateImage(image,AlphaChannel,exception);\n if (mask_image == (Image *) NULL)\n ThrowWriterException(CoderError,exception->reason);\n (void) SetImageType(mask_image,BilevelType,exception);\n (void) SetImageType(mask_image,PaletteType,exception);\n mask_image->alpha_trait=UndefinedPixelTrait;\n pixels=(unsigned char *) NULL;\n length=0;\n switch (compression)\n {\n case NoCompression:\n default:\n {\n status=SerializeImageChannel(image_info,mask_image,&pixel_info,&length,\n exception);\n if (status == MagickFalse)\n break;\n Ascii85Initialize(image);\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n for (i=0; i < (ssize_t) length; i++)\n Ascii85Encode(image,pixels[i]);\n Ascii85Flush(image);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n break;\n }\n case FaxCompression:\n case Group4Compression:\n {\n if ((compression == FaxCompression) ||\n (LocaleCompare(CCITTParam,\"0\") == 0))\n status=HuffmanEncodeImage(image_info,image,mask_image,exception);\n else\n status=Huffman2DEncodeImage(image_info,image,mask_image,exception);\n break;\n }\n case LZWCompression:\n {\n status=SerializeImageChannel(image_info,mask_image,&pixel_info,&length,\n exception);\n if (status == MagickFalse)\n break;\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n status=LZWEncodeImage(image,length,pixels,exception);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n break;\n }\n case RLECompression:\n {\n status=SerializeImageChannel(image_info,mask_image,&pixel_info,&length,\n exception);\n if (status == MagickFalse)\n break;\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n status=PackbitsEncodeImage(image,length,pixels,exception);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n break;\n }\n case ZipCompression:\n {\n status=SerializeImageChannel(image_info,mask_image,&pixel_info,&length,\n exception);\n if (status == MagickFalse)\n break;\n pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info);\n status=ZLIBEncodeImage(image,length,pixels,exception);\n pixel_info=RelinquishVirtualMemory(pixel_info);\n break;\n }\n }\n mask_image=DestroyImage(mask_image);\n (void) WriteBlobByte(image,'\\n');\n length=(size_t) (TellBlob(image)-stop);\n stop=TellBlob(image);\n if (stop < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n offset=SeekBlob(image,start,SEEK_SET);\n if (offset < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n (void) FormatLocaleString(buffer,MagickPathExtent,\n \"%%%%BeginData:%13ld %s Bytes\\n\",(long) length,\n compression == NoCompression ? \"ASCII\" : \"BINARY\");\n (void) WriteBlobString(image,buffer);\n offset=SeekBlob(image,stop,SEEK_SET);\n if (offset < 0)\n ThrowWriterException(CorruptImageError,\"ImproperImageHeader\");\n (void) WriteBlobString(image,\"%%EndData\\n\");\n (void) WriteBlobString(image, \"/mask_stream exch def\\n\");\n return(status);\n}",
  23907. "project": "ImageMagick",
  23908. "hash": 50278300032645136337221449604318212735,
  23909. "size": 189,
  23910. "commit_id": "7b04c53c69792243d66d6876f843b850b3cc002b",
  23911. "message": "Fixed memory leaks reported in #1557.",
  23912. "target": 0,
  23913. "dataset": "other",
  23914. "idx": 416808
  23915. },
  23916. {
  23917. "func": "static MagickBooleanType SerializeImage(const ImageInfo *image_info,\n Image *image,MemoryInfo **pixel_info,size_t *length,ExceptionInfo *exception)\n{\n MagickBooleanType\n status;\n\n register const Quantum\n *p;\n\n register ssize_t\n x;\n\n register unsigned char\n *q;\n\n ssize_t\n y;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=MagickTrue;\n *length=(image->colorspace == CMYKColorspace ? 4 : 3)*(size_t)\n image->columns*image->rows;\n *pixel_info=AcquireVirtualMemory(*length,sizeof(*q));\n if (*pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n q=(unsigned char *) GetVirtualMemoryBlob(*pixel_info);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if (image->colorspace != CMYKColorspace)\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n p+=GetPixelChannels(image);\n }\n else\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(GetPixelRed(image,p));\n *q++=ScaleQuantumToChar(GetPixelGreen(image,p));\n *q++=ScaleQuantumToChar(GetPixelBlue(image,p));\n *q++=ScaleQuantumToChar(GetPixelBlack(image,p));\n p+=GetPixelChannels(image);\n }\n if (image->previous == (Image *) NULL)\n {\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n }\n if (status == MagickFalse)\n *pixel_info=RelinquishVirtualMemory(*pixel_info);\n return(status);\n}",
  23918. "project": "ImageMagick",
  23919. "hash": 26348891072062093223080422911288690605,
  23920. "size": 63,
  23921. "commit_id": "7b04c53c69792243d66d6876f843b850b3cc002b",
  23922. "message": "Fixed memory leaks reported in #1557.",
  23923. "target": 0,
  23924. "dataset": "other",
  23925. "idx": 416810
  23926. },
  23927. {
  23928. "func": "static MagickBooleanType SerializeImageChannel(const ImageInfo *image_info,\n Image *image,MemoryInfo **pixel_info,size_t *length,ExceptionInfo *exception)\n{\n MagickBooleanType\n status;\n\n register const Quantum\n *p;\n\n register ssize_t\n x;\n\n register unsigned char\n *q;\n\n size_t\n pack,\n padded_columns;\n\n ssize_t\n y;\n\n unsigned char\n code,\n bit;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=MagickTrue;\n pack=SetImageMonochrome(image,exception) == MagickFalse ? 1UL : 8UL;\n padded_columns=((image->columns+pack-1)/pack)*pack;\n *length=(size_t) padded_columns*image->rows/pack;\n *pixel_info=AcquireVirtualMemory(*length,sizeof(*q));\n if (*pixel_info == (MemoryInfo *) NULL)\n ThrowWriterException(ResourceLimitError,\"MemoryAllocationFailed\");\n q=(unsigned char *) GetVirtualMemoryBlob(*pixel_info);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const Quantum *) NULL)\n break;\n if (pack == 1)\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n *q++=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p)));\n p+=GetPixelChannels(image);\n }\n else\n {\n code='\\0';\n for (x=0; x < (ssize_t) padded_columns; x++)\n {\n bit=(unsigned char) 0x00;\n if (x < (ssize_t) image->columns)\n bit=(unsigned char) (GetPixelLuma(image,p) == TransparentAlpha ?\n 0x01 : 0x00);\n code=(code << 1)+bit;\n if (((x+1) % pack) == 0)\n {\n *q++=code;\n code='\\0';\n }\n p+=GetPixelChannels(image);\n }\n }\n status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n if (status == MagickFalse)\n *pixel_info=RelinquishVirtualMemory(*pixel_info);\n return(status);\n}",
  23929. "project": "ImageMagick",
  23930. "hash": 180592484966918846599004399988978191743,
  23931. "size": 76,
  23932. "commit_id": "7b04c53c69792243d66d6876f843b850b3cc002b",
  23933. "message": "Fixed memory leaks reported in #1557.",
  23934. "target": 0,
  23935. "dataset": "other",
  23936. "idx": 416800
  23937. }
  23938. ]
  23939. },
  23940. {
  23941. "call_depth": 3,
  23942. "longest_call_chain": [
  23943. "BuildOutputTensors",
  23944. "CrossCountByBatchIndex",
  23945. "FeatureCount"
  23946. ],
  23947. "group_size": 5,
  23948. "functions": [
  23949. {
  23950. "func": " Status BuildOutputTensors(const FeatureReaders& features, int64 batch_size,\n OpKernelContext* context, Tensor** values_out,\n Tensor** row_splits_out) {\n // Allocate and populate the row_splits output tensor.\n TF_RETURN_IF_ERROR(context->allocate_output(\n 1, TensorShape({batch_size + 1}), row_splits_out));\n auto flat_row_splits = (*row_splits_out)->flat<SplitsType>();\n int64 cross_count_total = 0;\n flat_row_splits(0) = 0;\n for (int64 b = 0; b < batch_size; b++) {\n cross_count_total += CrossCountByBatchIndex(features, b);\n flat_row_splits(b + 1) = cross_count_total;\n }\n\n // Allocate the values output tensor.\n TF_RETURN_IF_ERROR(context->allocate_output(\n 0, TensorShape({cross_count_total}), values_out));\n\n return Status::OK();\n }",
  23951. "project": "tensorflow",
  23952. "hash": 171822104983155099422471356921161614833,
  23953. "size": 20,
  23954. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  23955. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  23956. "target": 0,
  23957. "dataset": "other",
  23958. "idx": 230077
  23959. },
  23960. {
  23961. "func": " int64 CrossCountByBatchIndex(const FeatureReaders& features,\n int batch_index) {\n int64 cross_count = 1;\n for (int i = 0; i < features.size(); ++i) {\n const auto feature_count = features[i]->FeatureCount(batch_index);\n if (feature_count == 0) return 0;\n cross_count *= feature_count;\n }\n return cross_count;\n }",
  23962. "project": "tensorflow",
  23963. "hash": 338071543034566527060555981410393450192,
  23964. "size": 10,
  23965. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  23966. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  23967. "target": 0,
  23968. "dataset": "other",
  23969. "idx": 230097
  23970. },
  23971. {
  23972. "func": " int64 FeatureCount(int64 batch) const override {\n return row_splits_[batch + 1] - row_splits_[batch];\n }",
  23973. "project": "tensorflow",
  23974. "hash": 220213710993492817738691071664744789373,
  23975. "size": 3,
  23976. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  23977. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  23978. "target": 0,
  23979. "dataset": "other",
  23980. "idx": 230075
  23981. },
  23982. {
  23983. "func": " int64 FeatureCount(int64 batch) const override {\n return row_splits_(batch + 1) - row_splits_(batch);\n }",
  23984. "project": "tensorflow",
  23985. "hash": 248537505487492333908110778157112000063,
  23986. "size": 3,
  23987. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  23988. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  23989. "target": 0,
  23990. "dataset": "other",
  23991. "idx": 230091
  23992. },
  23993. {
  23994. "func": " int64 FeatureCount(int64 batch) const override { return feature_count_; }",
  23995. "project": "tensorflow",
  23996. "hash": 81735050557168063221551819637296283610,
  23997. "size": 1,
  23998. "commit_id": "44b7f486c0143f68b56c34e2d01e146ee445134a",
  23999. "message": "Fix out of bounds read in `ragged_cross_op.cc`.\n\nPiperOrigin-RevId: 369757702\nChange-Id: Ie6e5d2c21513a8d56bf41fcf35960caf76e890f9",
  24000. "target": 0,
  24001. "dataset": "other",
  24002. "idx": 230093
  24003. }
  24004. ]
  24005. },
  24006. {
  24007. "call_depth": 4,
  24008. "longest_call_chain": [
  24009. "LookupMapping",
  24010. "Is",
  24011. "LookupPredicate",
  24012. "GetEntry"
  24013. ],
  24014. "group_size": 12,
  24015. "functions": [
  24016. {
  24017. "func": "bool ConnectorPunctuation::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kConnectorPunctuationTable0,\n kConnectorPunctuationTable0Size,\n c);\n case 1: return LookupPredicate(kConnectorPunctuationTable1,\n kConnectorPunctuationTable1Size,\n c);\n case 7: return LookupPredicate(kConnectorPunctuationTable7,\n kConnectorPunctuationTable7Size,\n c);\n default: return false;\n }\n}",
  24018. "project": "node",
  24019. "hash": 202309568264926344252895605229406286309,
  24020. "size": 15,
  24021. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24022. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24023. "target": 0,
  24024. "dataset": "other",
  24025. "idx": 385615
  24026. },
  24027. {
  24028. "func": "bool LineTerminator::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kLineTerminatorTable0,\n kLineTerminatorTable0Size,\n c);\n case 1: return LookupPredicate(kLineTerminatorTable1,\n kLineTerminatorTable1Size,\n c);\n default: return false;\n }\n}",
  24029. "project": "node",
  24030. "hash": 306437122167880868973874944545895682089,
  24031. "size": 12,
  24032. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24033. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24034. "target": 0,
  24035. "dataset": "other",
  24036. "idx": 385617
  24037. },
  24038. {
  24039. "func": "bool CombiningMark::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kCombiningMarkTable0,\n kCombiningMarkTable0Size,\n c);\n case 1: return LookupPredicate(kCombiningMarkTable1,\n kCombiningMarkTable1Size,\n c);\n case 5: return LookupPredicate(kCombiningMarkTable5,\n kCombiningMarkTable5Size,\n c);\n case 7: return LookupPredicate(kCombiningMarkTable7,\n kCombiningMarkTable7Size,\n c);\n default: return false;\n }\n}",
  24040. "project": "node",
  24041. "hash": 328032147315409575724163176042780543029,
  24042. "size": 18,
  24043. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24044. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24045. "target": 0,
  24046. "dataset": "other",
  24047. "idx": 385621
  24048. },
  24049. {
  24050. "func": "bool Letter::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kLetterTable0,\n kLetterTable0Size,\n c);\n case 1: return LookupPredicate(kLetterTable1,\n kLetterTable1Size,\n c);\n case 2: return LookupPredicate(kLetterTable2,\n kLetterTable2Size,\n c);\n case 3: return LookupPredicate(kLetterTable3,\n kLetterTable3Size,\n c);\n case 4: return LookupPredicate(kLetterTable4,\n kLetterTable4Size,\n c);\n case 5: return LookupPredicate(kLetterTable5,\n kLetterTable5Size,\n c);\n case 6: return LookupPredicate(kLetterTable6,\n kLetterTable6Size,\n c);\n case 7: return LookupPredicate(kLetterTable7,\n kLetterTable7Size,\n c);\n default: return false;\n }\n}",
  24051. "project": "node",
  24052. "hash": 261501930601033643558167397141148141264,
  24053. "size": 30,
  24054. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24055. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24056. "target": 0,
  24057. "dataset": "other",
  24058. "idx": 385624
  24059. },
  24060. {
  24061. "func": "bool WhiteSpace::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kWhiteSpaceTable0,\n kWhiteSpaceTable0Size,\n c);\n case 1: return LookupPredicate(kWhiteSpaceTable1,\n kWhiteSpaceTable1Size,\n c);\n default: return false;\n }\n}",
  24062. "project": "node",
  24063. "hash": 28982256808811187234009115524577390228,
  24064. "size": 12,
  24065. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24066. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24067. "target": 0,
  24068. "dataset": "other",
  24069. "idx": 385625
  24070. },
  24071. {
  24072. "func": "bool Lowercase::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kLowercaseTable0,\n kLowercaseTable0Size,\n c);\n case 1: return LookupPredicate(kLowercaseTable1,\n kLowercaseTable1Size,\n c);\n case 5: return LookupPredicate(kLowercaseTable5,\n kLowercaseTable5Size,\n c);\n case 7: return LookupPredicate(kLowercaseTable7,\n kLowercaseTable7Size,\n c);\n default: return false;\n }\n}",
  24073. "project": "node",
  24074. "hash": 306415318189567837801821641777240489698,
  24075. "size": 18,
  24076. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24077. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24078. "target": 0,
  24079. "dataset": "other",
  24080. "idx": 385634
  24081. },
  24082. {
  24083. "func": "bool Uppercase::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kUppercaseTable0,\n kUppercaseTable0Size,\n c);\n case 1: return LookupPredicate(kUppercaseTable1,\n kUppercaseTable1Size,\n c);\n case 5: return LookupPredicate(kUppercaseTable5,\n kUppercaseTable5Size,\n c);\n case 7: return LookupPredicate(kUppercaseTable7,\n kUppercaseTable7Size,\n c);\n default: return false;\n }\n}",
  24084. "project": "node",
  24085. "hash": 198484716824470869928393300848719870852,
  24086. "size": 18,
  24087. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24088. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24089. "target": 0,
  24090. "dataset": "other",
  24091. "idx": 385641
  24092. },
  24093. {
  24094. "func": "bool Number::Is(uchar c) {\n int chunk_index = c >> 13;\n switch (chunk_index) {\n case 0: return LookupPredicate(kNumberTable0,\n kNumberTable0Size,\n c);\n case 5: return LookupPredicate(kNumberTable5,\n kNumberTable5Size,\n c);\n case 7: return LookupPredicate(kNumberTable7,\n kNumberTable7Size,\n c);\n default: return false;\n }\n}",
  24095. "project": "node",
  24096. "hash": 194474308187196058350851767952097962021,
  24097. "size": 15,
  24098. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24099. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24100. "target": 0,
  24101. "dataset": "other",
  24102. "idx": 385642
  24103. },
  24104. {
  24105. "func": "static inline bool IsStart(int32_t entry) {\n return (entry & kStartBit) != 0;\n}",
  24106. "project": "node",
  24107. "hash": 315163817663965948278730766709240714257,
  24108. "size": 3,
  24109. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24110. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24111. "target": 0,
  24112. "dataset": "other",
  24113. "idx": 385607
  24114. },
  24115. {
  24116. "func": "static int LookupMapping(const int32_t* table,\n uint16_t size,\n const MultiCharacterSpecialCase<kW>* multi_chars,\n uchar chr,\n uchar next,\n uchar* result,\n bool* allow_caching_ptr) {\n static const int kEntryDist = 2;\n uint16_t key = chr & (kChunkBits - 1);\n uint16_t chunk_start = chr - key;\n unsigned int low = 0;\n unsigned int high = size - 1;\n while (high != low) {\n unsigned int mid = low + ((high - low) >> 1);\n uchar current_value = GetEntry(TableGet<kEntryDist>(table, mid));\n // If we've found an entry less than or equal to this one, and the next one\n // is not also less than this one, we've arrived.\n if ((current_value <= key) &&\n (mid + 1 == size ||\n GetEntry(TableGet<kEntryDist>(table, mid + 1)) > key)) {\n low = mid;\n break;\n } else if (current_value < key) {\n low = mid + 1;\n } else if (current_value > key) {\n // If we've just checked the bottom-most value and it's not\n // the one we're looking for, we're done.\n if (mid == 0) break;\n high = mid - 1;\n }\n }\n int32_t field = TableGet<kEntryDist>(table, low);\n uchar entry = GetEntry(field);\n bool is_start = IsStart(field);\n bool found = (entry == key) || (entry < key && is_start);\n if (found) {\n int32_t value = table[2 * low + 1];\n if (value == 0) {\n // 0 means not present\n return 0;\n } else if ((value & 3) == 0) {\n // Low bits 0 means a constant offset from the given character.\n if (ranges_are_linear) {\n result[0] = chr + (value >> 2);\n } else {\n result[0] = entry + chunk_start + (value >> 2);\n }\n return 1;\n } else if ((value & 3) == 1) {\n // Low bits 1 means a special case mapping\n if (allow_caching_ptr) *allow_caching_ptr = false;\n const MultiCharacterSpecialCase<kW>& mapping = multi_chars[value >> 2];\n int length = 0;\n for (length = 0; length < kW; length++) {\n uchar mapped = mapping.chars[length];\n if (mapped == MultiCharacterSpecialCase<kW>::kEndOfEncoding) break;\n if (ranges_are_linear) {\n result[length] = mapped + (key - entry);\n } else {\n result[length] = mapped;\n }\n }\n return length;\n } else {\n // Low bits 2 means a really really special case\n if (allow_caching_ptr) *allow_caching_ptr = false;\n // The cases of this switch are defined in unicode.py in the\n // really_special_cases mapping.\n switch (value >> 2) {\n case 1:\n // Really special case 1: upper case sigma. This letter\n // converts to two different lower case sigmas depending on\n // whether or not it occurs at the end of a word.\n if (next != 0 && Letter::Is(next)) {\n result[0] = 0x03C3;\n } else {\n result[0] = 0x03C2;\n }\n return 1;\n default:\n return 0;\n }\n return -1;\n }\n } else {\n return 0;\n }\n}",
  24117. "project": "node",
  24118. "hash": 168409440951517601081803230671729981840,
  24119. "size": 88,
  24120. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24121. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24122. "target": 0,
  24123. "dataset": "other",
  24124. "idx": 385609
  24125. },
  24126. {
  24127. "func": "static bool LookupPredicate(const int32_t* table, uint16_t size, uchar chr) {\n static const int kEntryDist = 1;\n uint16_t value = chr & (kChunkBits - 1);\n unsigned int low = 0;\n unsigned int high = size - 1;\n while (high != low) {\n unsigned int mid = low + ((high - low) >> 1);\n uchar current_value = GetEntry(TableGet<kEntryDist>(table, mid));\n // If we've found an entry less than or equal to this one, and the\n // next one is not also less than this one, we've arrived.\n if ((current_value <= value) &&\n (mid + 1 == size ||\n GetEntry(TableGet<kEntryDist>(table, mid + 1)) > value)) {\n low = mid;\n break;\n } else if (current_value < value) {\n low = mid + 1;\n } else if (current_value > value) {\n // If we've just checked the bottom-most value and it's not\n // the one we're looking for, we're done.\n if (mid == 0) break;\n high = mid - 1;\n }\n }\n int32_t field = TableGet<kEntryDist>(table, low);\n uchar entry = GetEntry(field);\n bool is_start = IsStart(field);\n return (entry == value) || (entry < value && is_start);\n}",
  24128. "project": "node",
  24129. "hash": 242960315321535601813901942046283298330,
  24130. "size": 29,
  24131. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24132. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24133. "target": 0,
  24134. "dataset": "other",
  24135. "idx": 385635
  24136. },
  24137. {
  24138. "func": "static inline uchar GetEntry(int32_t entry) {\n return entry & (kStartBit - 1);\n}",
  24139. "project": "node",
  24140. "hash": 249940707140760292065099100293212879734,
  24141. "size": 3,
  24142. "commit_id": "78b0e30954111cfaba0edbeee85450d8cbc6fdf6",
  24143. "message": "deps: fix out-of-band write in utf8 decoder\n\nOriginally reported by: Kris Reeves <kris.re@bbhmedia.com>\n\nReviewed-By: Trevor Norris <trev.norris@gmail.com>",
  24144. "target": 0,
  24145. "dataset": "other",
  24146. "idx": 385628
  24147. }
  24148. ]
  24149. },
  24150. {
  24151. "call_depth": 3,
  24152. "longest_call_chain": [
  24153. "nfs4_destroy_clientid",
  24154. "nfs4_proc_destroy_clientid",
  24155. "_nfs4_proc_destroy_clientid"
  24156. ],
  24157. "group_size": 3,
  24158. "functions": [
  24159. {
  24160. "func": "static int nfs4_proc_destroy_clientid(struct nfs_client *clp,\n\t\tconst struct cred *cred)\n{\n\tunsigned int loop;\n\tint ret;\n\n\tfor (loop = NFS4_MAX_LOOP_ON_RECOVER; loop != 0; loop--) {\n\t\tret = _nfs4_proc_destroy_clientid(clp, cred);\n\t\tswitch (ret) {\n\t\tcase -NFS4ERR_DELAY:\n\t\tcase -NFS4ERR_CLIENTID_BUSY:\n\t\t\tssleep(1);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\treturn ret;\n\t\t}\n\t}\n\treturn 0;\n}",
  24161. "project": "linux",
  24162. "hash": 108392093536477804166890510351311114362,
  24163. "size": 19,
  24164. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  24165. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  24166. "target": 0,
  24167. "dataset": "other",
  24168. "idx": 431446
  24169. },
  24170. {
  24171. "func": "static int _nfs4_proc_destroy_clientid(struct nfs_client *clp,\n\t\tconst struct cred *cred)\n{\n\tstruct rpc_message msg = {\n\t\t.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DESTROY_CLIENTID],\n\t\t.rpc_argp = clp,\n\t\t.rpc_cred = cred,\n\t};\n\tint status;\n\n\tstatus = rpc_call_sync(clp->cl_rpcclient, &msg,\n\t\t\t RPC_TASK_TIMEOUT | RPC_TASK_NO_ROUND_ROBIN);\n\ttrace_nfs4_destroy_clientid(clp, status);\n\tif (status)\n\t\tdprintk(\"NFS: Got error %d from the server %s on \"\n\t\t\t\"DESTROY_CLIENTID.\", status, clp->cl_hostname);\n\treturn status;\n}",
  24172. "project": "linux",
  24173. "hash": 218443526268163435091978786734022208861,
  24174. "size": 18,
  24175. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  24176. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  24177. "target": 0,
  24178. "dataset": "other",
  24179. "idx": 431365
  24180. },
  24181. {
  24182. "func": "int nfs4_destroy_clientid(struct nfs_client *clp)\n{\n\tconst struct cred *cred;\n\tint ret = 0;\n\n\tif (clp->cl_mvops->minor_version < 1)\n\t\tgoto out;\n\tif (clp->cl_exchange_flags == 0)\n\t\tgoto out;\n\tif (clp->cl_preserve_clid)\n\t\tgoto out;\n\tcred = nfs4_get_clid_cred(clp);\n\tret = nfs4_proc_destroy_clientid(clp, cred);\n\tput_cred(cred);\n\tswitch (ret) {\n\tcase 0:\n\tcase -NFS4ERR_STALE_CLIENTID:\n\t\tclp->cl_exchange_flags = 0;\n\t}\nout:\n\treturn ret;\n}",
  24183. "project": "linux",
  24184. "hash": 212007988069544547393471888582405255655,
  24185. "size": 22,
  24186. "commit_id": "b4487b93545214a9db8cbf32e86411677b0cca21",
  24187. "message": "nfs: Fix getxattr kernel panic and memory overflow\n\nMove the buffer size check to decode_attr_security_label() before memcpy()\nOnly call memcpy() if the buffer is large enough\n\nFixes: aa9c2669626c (\"NFS: Client implementation of Labeled-NFS\")\nSigned-off-by: Jeffrey Mitchell <jeffrey.mitchell@starlab.io>\n[Trond: clean up duplicate test of label->len != 0]\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  24188. "target": 0,
  24189. "dataset": "other",
  24190. "idx": 431048
  24191. }
  24192. ]
  24193. },
  24194. {
  24195. "call_depth": 3,
  24196. "longest_call_chain": [
  24197. "rtsx_usb_ms_set_param",
  24198. "ms_power_off",
  24199. "ms_pull_ctl_disable_qfn24"
  24200. ],
  24201. "group_size": 7,
  24202. "functions": [
  24203. {
  24204. "func": "static int ms_pull_ctl_disable_lqfp48(struct rtsx_ucr *ucr)\n{\n\trtsx_usb_init_cmd(ucr);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL1, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL2, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL3, 0xFF, 0x95);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL4, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL5, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL6, 0xFF, 0xA5);\n\n\treturn rtsx_usb_send_cmd(ucr, MODE_C, 100);\n}",
  24205. "project": "linux",
  24206. "hash": 175330394433115206129616772201483010020,
  24207. "size": 13,
  24208. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  24209. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  24210. "target": 0,
  24211. "dataset": "other",
  24212. "idx": 386069
  24213. },
  24214. {
  24215. "func": "static int ms_pull_ctl_enable_qfn24(struct rtsx_ucr *ucr)\n{\n\trtsx_usb_init_cmd(ucr);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL1, 0xFF, 0x65);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL2, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL3, 0xFF, 0x95);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL4, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL5, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL6, 0xFF, 0x59);\n\n\treturn rtsx_usb_send_cmd(ucr, MODE_C, 100);\n}",
  24216. "project": "linux",
  24217. "hash": 210539641281842764705487523839336936592,
  24218. "size": 13,
  24219. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  24220. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  24221. "target": 0,
  24222. "dataset": "other",
  24223. "idx": 386071
  24224. },
  24225. {
  24226. "func": "static int ms_pull_ctl_disable_qfn24(struct rtsx_ucr *ucr)\n{\n\trtsx_usb_init_cmd(ucr);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL1, 0xFF, 0x65);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL2, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL3, 0xFF, 0x95);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL4, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL5, 0xFF, 0x56);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL6, 0xFF, 0x59);\n\n\treturn rtsx_usb_send_cmd(ucr, MODE_C, 100);\n}",
  24227. "project": "linux",
  24228. "hash": 285376566704278362797150066726714875676,
  24229. "size": 13,
  24230. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  24231. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  24232. "target": 0,
  24233. "dataset": "other",
  24234. "idx": 386064
  24235. },
  24236. {
  24237. "func": "static int ms_power_on(struct rtsx_usb_ms *host)\n{\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tint err;\n\n\tdev_dbg(ms_dev(host), \"%s\\n\", __func__);\n\n\trtsx_usb_init_cmd(ucr);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SELECT, 0x07, MS_MOD_SEL);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_SHARE_MODE,\n\t\t\tCARD_SHARE_MASK, CARD_SHARE_MS);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_CLK_EN,\n\t\t\tMS_CLK_EN, MS_CLK_EN);\n\terr = rtsx_usb_send_cmd(ucr, MODE_C, 100);\n\tif (err < 0)\n\t\treturn err;\n\n\tif (CHECK_PKG(ucr, LQFP48))\n\t\terr = ms_pull_ctl_enable_lqfp48(ucr);\n\telse\n\t\terr = ms_pull_ctl_enable_qfn24(ucr);\n\tif (err < 0)\n\t\treturn err;\n\n\terr = rtsx_usb_write_register(ucr, CARD_PWR_CTL,\n\t\t\tPOWER_MASK, PARTIAL_POWER_ON);\n\tif (err)\n\t\treturn err;\n\n\tusleep_range(800, 1000);\n\n\trtsx_usb_init_cmd(ucr);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PWR_CTL,\n\t\t\tPOWER_MASK, POWER_ON);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_OE,\n\t\t\tMS_OUTPUT_EN, MS_OUTPUT_EN);\n\n\treturn rtsx_usb_send_cmd(ucr, MODE_C, 100);\n}",
  24238. "project": "linux",
  24239. "hash": 117225087238741212943134424097667944076,
  24240. "size": 39,
  24241. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  24242. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  24243. "target": 0,
  24244. "dataset": "other",
  24245. "idx": 386068
  24246. },
  24247. {
  24248. "func": "static int ms_pull_ctl_enable_lqfp48(struct rtsx_ucr *ucr)\n{\n\trtsx_usb_init_cmd(ucr);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL1, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL2, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL3, 0xFF, 0x95);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL4, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL5, 0xFF, 0x55);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_PULL_CTL6, 0xFF, 0xA5);\n\n\treturn rtsx_usb_send_cmd(ucr, MODE_C, 100);\n}",
  24249. "project": "linux",
  24250. "hash": 211193892281656815748731135651717029490,
  24251. "size": 13,
  24252. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  24253. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  24254. "target": 0,
  24255. "dataset": "other",
  24256. "idx": 386077
  24257. },
  24258. {
  24259. "func": "static int rtsx_usb_ms_set_param(struct memstick_host *msh,\n\t\tenum memstick_param param, int value)\n{\n\tstruct rtsx_usb_ms *host = memstick_priv(msh);\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tunsigned int clock = 0;\n\tu8 ssc_depth = 0;\n\tint err;\n\n\tdev_dbg(ms_dev(host), \"%s: param = %d, value = %d\\n\",\n\t\t\t__func__, param, value);\n\n\tpm_runtime_get_sync(ms_dev(host));\n\tmutex_lock(&ucr->dev_mutex);\n\n\terr = rtsx_usb_card_exclusive_check(ucr, RTSX_USB_MS_CARD);\n\tif (err)\n\t\tgoto out;\n\n\tswitch (param) {\n\tcase MEMSTICK_POWER:\n\t\tif (value == host->power_mode)\n\t\t\tbreak;\n\n\t\tif (value == MEMSTICK_POWER_ON) {\n\t\t\tpm_runtime_get_noresume(ms_dev(host));\n\t\t\terr = ms_power_on(host);\n\t\t\tif (err)\n\t\t\t\tpm_runtime_put_noidle(ms_dev(host));\n\t\t} else if (value == MEMSTICK_POWER_OFF) {\n\t\t\terr = ms_power_off(host);\n\t\t\tif (!err)\n\t\t\t\tpm_runtime_put_noidle(ms_dev(host));\n\t\t} else\n\t\t\terr = -EINVAL;\n\t\tif (!err)\n\t\t\thost->power_mode = value;\n\t\tbreak;\n\n\tcase MEMSTICK_INTERFACE:\n\t\tif (value == MEMSTICK_SERIAL) {\n\t\t\tclock = 19000000;\n\t\t\tssc_depth = SSC_DEPTH_512K;\n\t\t\terr = rtsx_usb_write_register(ucr, MS_CFG, 0x5A,\n\t\t\t\t MS_BUS_WIDTH_1 | PUSH_TIME_DEFAULT);\n\t\t\tif (err < 0)\n\t\t\t\tbreak;\n\t\t} else if (value == MEMSTICK_PAR4) {\n\t\t\tclock = 39000000;\n\t\t\tssc_depth = SSC_DEPTH_1M;\n\n\t\t\terr = rtsx_usb_write_register(ucr, MS_CFG, 0x5A,\n\t\t\t\t\tMS_BUS_WIDTH_4 | PUSH_TIME_ODD |\n\t\t\t\t\tMS_NO_CHECK_INT);\n\t\t\tif (err < 0)\n\t\t\t\tbreak;\n\t\t} else {\n\t\t\terr = -EINVAL;\n\t\t\tbreak;\n\t\t}\n\n\t\terr = rtsx_usb_switch_clock(ucr, clock,\n\t\t\t\tssc_depth, false, true, false);\n\t\tif (err < 0) {\n\t\t\tdev_dbg(ms_dev(host), \"switch clock failed\\n\");\n\t\t\tbreak;\n\t\t}\n\n\t\thost->ssc_depth = ssc_depth;\n\t\thost->clock = clock;\n\t\thost->ifmode = value;\n\t\tbreak;\n\tdefault:\n\t\terr = -EINVAL;\n\t\tbreak;\n\t}\nout:\n\tmutex_unlock(&ucr->dev_mutex);\n\tpm_runtime_put_sync(ms_dev(host));\n\n\t/* power-on delay */\n\tif (param == MEMSTICK_POWER && value == MEMSTICK_POWER_ON) {\n\t\tusleep_range(10000, 12000);\n\n\t\tif (!host->eject)\n\t\t\tschedule_delayed_work(&host->poll_card, 100);\n\t}\n\n\tdev_dbg(ms_dev(host), \"%s: return = %d\\n\", __func__, err);\n\treturn err;\n}",
  24260. "project": "linux",
  24261. "hash": 235368188057846220972751262500656866355,
  24262. "size": 91,
  24263. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  24264. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  24265. "target": 0,
  24266. "dataset": "other",
  24267. "idx": 386054
  24268. },
  24269. {
  24270. "func": "static int ms_power_off(struct rtsx_usb_ms *host)\n{\n\tstruct rtsx_ucr *ucr = host->ucr;\n\tint err;\n\n\tdev_dbg(ms_dev(host), \"%s\\n\", __func__);\n\n\trtsx_usb_init_cmd(ucr);\n\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_CLK_EN, MS_CLK_EN, 0);\n\trtsx_usb_add_cmd(ucr, WRITE_REG_CMD, CARD_OE, MS_OUTPUT_EN, 0);\n\n\terr = rtsx_usb_send_cmd(ucr, MODE_C, 100);\n\tif (err < 0)\n\t\treturn err;\n\n\tif (CHECK_PKG(ucr, LQFP48))\n\t\treturn ms_pull_ctl_disable_lqfp48(ucr);\n\n\treturn ms_pull_ctl_disable_qfn24(ucr);\n}",
  24271. "project": "linux",
  24272. "hash": 92083583795946424760381830510686249238,
  24273. "size": 21,
  24274. "commit_id": "42933c8aa14be1caa9eda41f65cde8a3a95d3e39",
  24275. "message": "memstick: rtsx_usb_ms: fix UAF\n\nThis patch fixes the following issues:\n1. memstick_free_host() will free the host, so the use of ms_dev(host) after\nit will be a problem. To fix this, move memstick_free_host() after when we\nare done with ms_dev(host).\n2. In rtsx_usb_ms_drv_remove(), pm need to be disabled before we remove\nand free host otherwise memstick_check will be called and UAF will\nhappen.\n\n[ 11.351173] BUG: KASAN: use-after-free in rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357077] rtsx_usb_ms_drv_remove+0x94/0x140 [rtsx_usb_ms]\n[ 11.357376] platform_remove+0x2a/0x50\n[ 11.367531] Freed by task 298:\n[ 11.368537] kfree+0xa4/0x2a0\n[ 11.368711] device_release+0x51/0xe0\n[ 11.368905] kobject_put+0xa2/0x120\n[ 11.369090] rtsx_usb_ms_drv_remove+0x8c/0x140 [rtsx_usb_ms]\n[ 11.369386] platform_remove+0x2a/0x50\n\n[ 12.038408] BUG: KASAN: use-after-free in __mutex_lock.isra.0+0x3ec/0x7c0\n[ 12.045432] mutex_lock+0xc9/0xd0\n[ 12.046080] memstick_check+0x6a/0x578 [memstick]\n[ 12.046509] process_one_work+0x46d/0x750\n[ 12.052107] Freed by task 297:\n[ 12.053115] kfree+0xa4/0x2a0\n[ 12.053272] device_release+0x51/0xe0\n[ 12.053463] kobject_put+0xa2/0x120\n[ 12.053647] rtsx_usb_ms_drv_remove+0xc4/0x140 [rtsx_usb_ms]\n[ 12.053939] platform_remove+0x2a/0x50\n\nSigned-off-by: Tong Zhang <ztong0001@gmail.com>\nCo-developed-by: Ulf Hansson <ulf.hansson@linaro.org>\nLink: https://lore.kernel.org/r/20210511163944.1233295-1-ztong0001@gmail.com\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>",
  24276. "target": 0,
  24277. "dataset": "other",
  24278. "idx": 386070
  24279. }
  24280. ]
  24281. },
  24282. {
  24283. "call_depth": 3,
  24284. "longest_call_chain": [
  24285. "vhost_for_each_try_unroll",
  24286. "rte_smp_rmb",
  24287. "VHOST_LOG_DATA"
  24288. ],
  24289. "group_size": 6,
  24290. "functions": [
  24291. {
  24292. "func": "virtio_dev_rx_batch_packed(struct virtio_net *dev,\n\t\t\t struct vhost_virtqueue *vq,\n\t\t\t struct rte_mbuf **pkts)\n{\n\tbool wrap_counter = vq->avail_wrap_counter;\n\tstruct vring_packed_desc *descs = vq->desc_packed;\n\tuint16_t avail_idx = vq->last_avail_idx;\n\tuint64_t desc_addrs[PACKED_BATCH_SIZE];\n\tstruct virtio_net_hdr_mrg_rxbuf *hdrs[PACKED_BATCH_SIZE];\n\tuint32_t buf_offset = dev->vhost_hlen;\n\tuint64_t lens[PACKED_BATCH_SIZE];\n\tuint16_t ids[PACKED_BATCH_SIZE];\n\tuint16_t i;\n\n\tif (unlikely(avail_idx & PACKED_BATCH_MASK))\n\t\treturn -1;\n\n\tif (unlikely((avail_idx + PACKED_BATCH_SIZE) > vq->size))\n\t\treturn -1;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(pkts[i]->next != NULL))\n\t\t\treturn -1;\n\t\tif (unlikely(!desc_is_avail(&descs[avail_idx + i],\n\t\t\t\t\t wrap_counter)))\n\t\t\treturn -1;\n\t}\n\n\trte_smp_rmb();\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tlens[i] = descs[avail_idx + i].len;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(pkts[i]->pkt_len > (lens[i] - buf_offset)))\n\t\t\treturn -1;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tdesc_addrs[i] = vhost_iova_to_vva(dev, vq,\n\t\t\t\t\t\t descs[avail_idx + i].addr,\n\t\t\t\t\t\t &lens[i],\n\t\t\t\t\t\t VHOST_ACCESS_RW);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(lens[i] != descs[avail_idx + i].len))\n\t\t\treturn -1;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\trte_prefetch0((void *)(uintptr_t)desc_addrs[i]);\n\t\thdrs[i] = (struct virtio_net_hdr_mrg_rxbuf *)\n\t\t\t\t\t(uintptr_t)desc_addrs[i];\n\t\tlens[i] = pkts[i]->pkt_len + dev->vhost_hlen;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tvirtio_enqueue_offload(pkts[i], &hdrs[i]->hdr);\n\n\tvq_inc_last_avail_packed(vq, PACKED_BATCH_SIZE);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\trte_memcpy((void *)(uintptr_t)(desc_addrs[i] + buf_offset),\n\t\t\t rte_pktmbuf_mtod_offset(pkts[i], void *, 0),\n\t\t\t pkts[i]->pkt_len);\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tvhost_log_cache_write_iova(dev, vq, descs[avail_idx + i].addr,\n\t\t\t\t\t lens[i]);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tids[i] = descs[avail_idx + i].id;\n\n\tvhost_flush_enqueue_batch_packed(dev, vq, lens, ids);\n\n\treturn 0;\n}",
  24293. "project": "dpdk",
  24294. "hash": 141015319348152109183918601798829151336,
  24295. "size": 78,
  24296. "commit_id": "97ecc1c85c95c13bc66a87435758e93406c35c48",
  24297. "message": "vhost: fix translated address not checked\n\nMalicious guest can construct desc with invalid address and zero buffer\nlength. That will request vhost to check both translated address and\ntranslated data length. This patch will add missed address check.\n\nCVE-2020-10725\nFixes: 75ed51697820 (\"vhost: add packed ring batch dequeue\")\nFixes: ef861692c398 (\"vhost: add packed ring batch enqueue\")\nCc: stable@dpdk.org\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>",
  24298. "target": 1,
  24299. "dataset": "other",
  24300. "idx": 207646
  24301. },
  24302. {
  24303. "func": "virtio_dev_tx_batch_packed_zmbuf(struct virtio_net *dev,\n\t\t\t\t struct vhost_virtqueue *vq,\n\t\t\t\t struct rte_mempool *mbuf_pool,\n\t\t\t\t struct rte_mbuf **pkts)\n{\n\tstruct zcopy_mbuf *zmbufs[PACKED_BATCH_SIZE];\n\tuintptr_t desc_addrs[PACKED_BATCH_SIZE];\n\tuint16_t ids[PACKED_BATCH_SIZE];\n\tuint16_t i;\n\n\tuint16_t avail_idx = vq->last_avail_idx;\n\n\tif (vhost_reserve_avail_batch_packed(dev, vq, mbuf_pool, pkts,\n\t\t\t\t\t avail_idx, desc_addrs, ids))\n\t\treturn -1;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tzmbufs[i] = get_zmbuf(vq);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (!zmbufs[i])\n\t\t\tgoto free_pkt;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tzmbufs[i]->mbuf = pkts[i];\n\t\tzmbufs[i]->desc_idx = ids[i];\n\t\tzmbufs[i]->desc_count = 1;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\trte_mbuf_refcnt_update(pkts[i], 1);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tTAILQ_INSERT_TAIL(&vq->zmbuf_list, zmbufs[i], next);\n\n\tvq->nr_zmbuf += PACKED_BATCH_SIZE;\n\tvq_inc_last_avail_packed(vq, PACKED_BATCH_SIZE);\n\n\treturn 0;\n\nfree_pkt:\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\trte_pktmbuf_free(pkts[i]);\n\n\treturn -1;\n}",
  24304. "project": "dpdk",
  24305. "hash": 53804099006853604511378110308203956935,
  24306. "size": 47,
  24307. "commit_id": "97ecc1c85c95c13bc66a87435758e93406c35c48",
  24308. "message": "vhost: fix translated address not checked\n\nMalicious guest can construct desc with invalid address and zero buffer\nlength. That will request vhost to check both translated address and\ntranslated data length. This patch will add missed address check.\n\nCVE-2020-10725\nFixes: 75ed51697820 (\"vhost: add packed ring batch dequeue\")\nFixes: ef861692c398 (\"vhost: add packed ring batch enqueue\")\nCc: stable@dpdk.org\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>",
  24309. "target": 0,
  24310. "dataset": "other",
  24311. "idx": 399930
  24312. },
  24313. {
  24314. "func": "virtio_dev_rx_batch_packed(struct virtio_net *dev,\n\t\t\t struct vhost_virtqueue *vq,\n\t\t\t struct rte_mbuf **pkts)\n{\n\tbool wrap_counter = vq->avail_wrap_counter;\n\tstruct vring_packed_desc *descs = vq->desc_packed;\n\tuint16_t avail_idx = vq->last_avail_idx;\n\tuint64_t desc_addrs[PACKED_BATCH_SIZE];\n\tstruct virtio_net_hdr_mrg_rxbuf *hdrs[PACKED_BATCH_SIZE];\n\tuint32_t buf_offset = dev->vhost_hlen;\n\tuint64_t lens[PACKED_BATCH_SIZE];\n\tuint16_t ids[PACKED_BATCH_SIZE];\n\tuint16_t i;\n\n\tif (unlikely(avail_idx & PACKED_BATCH_MASK))\n\t\treturn -1;\n\n\tif (unlikely((avail_idx + PACKED_BATCH_SIZE) > vq->size))\n\t\treturn -1;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(pkts[i]->next != NULL))\n\t\t\treturn -1;\n\t\tif (unlikely(!desc_is_avail(&descs[avail_idx + i],\n\t\t\t\t\t wrap_counter)))\n\t\t\treturn -1;\n\t}\n\n\trte_smp_rmb();\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tlens[i] = descs[avail_idx + i].len;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(pkts[i]->pkt_len > (lens[i] - buf_offset)))\n\t\t\treturn -1;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tdesc_addrs[i] = vhost_iova_to_vva(dev, vq,\n\t\t\t\t\t\t descs[avail_idx + i].addr,\n\t\t\t\t\t\t &lens[i],\n\t\t\t\t\t\t VHOST_ACCESS_RW);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(!desc_addrs[i]))\n\t\t\treturn -1;\n\t\tif (unlikely(lens[i] != descs[avail_idx + i].len))\n\t\t\treturn -1;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\trte_prefetch0((void *)(uintptr_t)desc_addrs[i]);\n\t\thdrs[i] = (struct virtio_net_hdr_mrg_rxbuf *)\n\t\t\t\t\t(uintptr_t)desc_addrs[i];\n\t\tlens[i] = pkts[i]->pkt_len + dev->vhost_hlen;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tvirtio_enqueue_offload(pkts[i], &hdrs[i]->hdr);\n\n\tvq_inc_last_avail_packed(vq, PACKED_BATCH_SIZE);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\trte_memcpy((void *)(uintptr_t)(desc_addrs[i] + buf_offset),\n\t\t\t rte_pktmbuf_mtod_offset(pkts[i], void *, 0),\n\t\t\t pkts[i]->pkt_len);\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tvhost_log_cache_write_iova(dev, vq, descs[avail_idx + i].addr,\n\t\t\t\t\t lens[i]);\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tids[i] = descs[avail_idx + i].id;\n\n\tvhost_flush_enqueue_batch_packed(dev, vq, lens, ids);\n\n\treturn 0;\n}",
  24315. "project": "dpdk",
  24316. "hash": 198754053444601304377848158125427004349,
  24317. "size": 80,
  24318. "commit_id": "97ecc1c85c95c13bc66a87435758e93406c35c48",
  24319. "message": "vhost: fix translated address not checked\n\nMalicious guest can construct desc with invalid address and zero buffer\nlength. That will request vhost to check both translated address and\ntranslated data length. This patch will add missed address check.\n\nCVE-2020-10725\nFixes: 75ed51697820 (\"vhost: add packed ring batch dequeue\")\nFixes: ef861692c398 (\"vhost: add packed ring batch enqueue\")\nCc: stable@dpdk.org\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>",
  24320. "target": 0,
  24321. "dataset": "other",
  24322. "idx": 399931
  24323. },
  24324. {
  24325. "func": "vhost_reserve_avail_batch_packed(struct virtio_net *dev,\n\t\t\t\t struct vhost_virtqueue *vq,\n\t\t\t\t struct rte_mempool *mbuf_pool,\n\t\t\t\t struct rte_mbuf **pkts,\n\t\t\t\t uint16_t avail_idx,\n\t\t\t\t uintptr_t *desc_addrs,\n\t\t\t\t uint16_t *ids)\n{\n\tbool wrap = vq->avail_wrap_counter;\n\tstruct vring_packed_desc *descs = vq->desc_packed;\n\tstruct virtio_net_hdr *hdr;\n\tuint64_t lens[PACKED_BATCH_SIZE];\n\tuint64_t buf_lens[PACKED_BATCH_SIZE];\n\tuint32_t buf_offset = dev->vhost_hlen;\n\tuint16_t flags, i;\n\n\tif (unlikely(avail_idx & PACKED_BATCH_MASK))\n\t\treturn -1;\n\tif (unlikely((avail_idx + PACKED_BATCH_SIZE) > vq->size))\n\t\treturn -1;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tflags = descs[avail_idx + i].flags;\n\t\tif (unlikely((wrap != !!(flags & VRING_DESC_F_AVAIL)) ||\n\t\t\t (wrap == !!(flags & VRING_DESC_F_USED)) ||\n\t\t\t (flags & PACKED_DESC_SINGLE_DEQUEUE_FLAG)))\n\t\t\treturn -1;\n\t}\n\n\trte_smp_rmb();\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tlens[i] = descs[avail_idx + i].len;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tdesc_addrs[i] = vhost_iova_to_vva(dev, vq,\n\t\t\t\t\t\t descs[avail_idx + i].addr,\n\t\t\t\t\t\t &lens[i], VHOST_ACCESS_RW);\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(!desc_addrs[i]))\n\t\t\treturn -1;\n\t\tif (unlikely((lens[i] != descs[avail_idx + i].len)))\n\t\t\treturn -1;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tpkts[i] = virtio_dev_pktmbuf_alloc(dev, mbuf_pool, lens[i]);\n\t\tif (!pkts[i])\n\t\t\tgoto free_buf;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE)\n\t\tbuf_lens[i] = pkts[i]->buf_len - pkts[i]->data_off;\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tif (unlikely(buf_lens[i] < (lens[i] - buf_offset)))\n\t\t\tgoto free_buf;\n\t}\n\n\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\tpkts[i]->pkt_len = descs[avail_idx + i].len - buf_offset;\n\t\tpkts[i]->data_len = pkts[i]->pkt_len;\n\t\tids[i] = descs[avail_idx + i].id;\n\t}\n\n\tif (virtio_net_with_host_offload(dev)) {\n\t\tvhost_for_each_try_unroll(i, 0, PACKED_BATCH_SIZE) {\n\t\t\thdr = (struct virtio_net_hdr *)(desc_addrs[i]);\n\t\t\tvhost_dequeue_offload(hdr, pkts[i]);\n\t\t}\n\t}\n\n\treturn 0;\n\nfree_buf:\n\tfor (i = 0; i < PACKED_BATCH_SIZE; i++)\n\t\trte_pktmbuf_free(pkts[i]);\n\n\treturn -1;\n}",
  24326. "project": "dpdk",
  24327. "hash": 138353916795722732886014856375298446334,
  24328. "size": 82,
  24329. "commit_id": "97ecc1c85c95c13bc66a87435758e93406c35c48",
  24330. "message": "vhost: fix translated address not checked\n\nMalicious guest can construct desc with invalid address and zero buffer\nlength. That will request vhost to check both translated address and\ntranslated data length. This patch will add missed address check.\n\nCVE-2020-10725\nFixes: 75ed51697820 (\"vhost: add packed ring batch dequeue\")\nFixes: ef861692c398 (\"vhost: add packed ring batch enqueue\")\nCc: stable@dpdk.org\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>",
  24331. "target": 0,
  24332. "dataset": "other",
  24333. "idx": 399961
  24334. },
  24335. {
  24336. "func": "virtio_dev_rx_single_packed(struct virtio_net *dev,\n\t\t\t struct vhost_virtqueue *vq,\n\t\t\t struct rte_mbuf *pkt)\n{\n\tstruct buf_vector buf_vec[BUF_VECTOR_MAX];\n\tuint16_t nr_descs = 0;\n\n\trte_smp_rmb();\n\tif (unlikely(vhost_enqueue_single_packed(dev, vq, pkt, buf_vec,\n\t\t\t\t\t\t &nr_descs) < 0)) {\n\t\tVHOST_LOG_DATA(DEBUG,\n\t\t\t\t\"(%d) failed to get enough desc from vring\\n\",\n\t\t\t\tdev->vid);\n\t\treturn -1;\n\t}\n\n\tVHOST_LOG_DATA(DEBUG, \"(%d) current index %d | end index %d\\n\",\n\t\t\tdev->vid, vq->last_avail_idx,\n\t\t\tvq->last_avail_idx + nr_descs);\n\n\tvq_inc_last_avail_packed(vq, nr_descs);\n\n\treturn 0;\n}",
  24337. "project": "dpdk",
  24338. "hash": 234143874651352795448824707434723122016,
  24339. "size": 24,
  24340. "commit_id": "97ecc1c85c95c13bc66a87435758e93406c35c48",
  24341. "message": "vhost: fix translated address not checked\n\nMalicious guest can construct desc with invalid address and zero buffer\nlength. That will request vhost to check both translated address and\ntranslated data length. This patch will add missed address check.\n\nCVE-2020-10725\nFixes: 75ed51697820 (\"vhost: add packed ring batch dequeue\")\nFixes: ef861692c398 (\"vhost: add packed ring batch enqueue\")\nCc: stable@dpdk.org\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>",
  24342. "target": 0,
  24343. "dataset": "other",
  24344. "idx": 399922
  24345. },
  24346. {
  24347. "func": "virtio_dev_rx(struct virtio_net *dev, uint16_t queue_id,\n\tstruct rte_mbuf **pkts, uint32_t count)\n{\n\tstruct vhost_virtqueue *vq;\n\tuint32_t nb_tx = 0;\n\n\tVHOST_LOG_DATA(DEBUG, \"(%d) %s\\n\", dev->vid, __func__);\n\tif (unlikely(!is_valid_virt_queue_idx(queue_id, 0, dev->nr_vring))) {\n\t\tVHOST_LOG_DATA(ERR, \"(%d) %s: invalid virtqueue idx %d.\\n\",\n\t\t\tdev->vid, __func__, queue_id);\n\t\treturn 0;\n\t}\n\n\tvq = dev->virtqueue[queue_id];\n\n\trte_spinlock_lock(&vq->access_lock);\n\n\tif (unlikely(vq->enabled == 0))\n\t\tgoto out_access_unlock;\n\n\tif (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))\n\t\tvhost_user_iotlb_rd_lock(vq);\n\n\tif (unlikely(vq->access_ok == 0))\n\t\tif (unlikely(vring_translate(dev, vq) < 0))\n\t\t\tgoto out;\n\n\tcount = RTE_MIN((uint32_t)MAX_PKT_BURST, count);\n\tif (count == 0)\n\t\tgoto out;\n\n\tif (vq_is_packed(dev))\n\t\tnb_tx = virtio_dev_rx_packed(dev, vq, pkts, count);\n\telse\n\t\tnb_tx = virtio_dev_rx_split(dev, vq, pkts, count);\n\nout:\n\tif (dev->features & (1ULL << VIRTIO_F_IOMMU_PLATFORM))\n\t\tvhost_user_iotlb_rd_unlock(vq);\n\nout_access_unlock:\n\trte_spinlock_unlock(&vq->access_lock);\n\n\treturn nb_tx;\n}",
  24348. "project": "dpdk",
  24349. "hash": 99231903305206413438432760618655077983,
  24350. "size": 45,
  24351. "commit_id": "97ecc1c85c95c13bc66a87435758e93406c35c48",
  24352. "message": "vhost: fix translated address not checked\n\nMalicious guest can construct desc with invalid address and zero buffer\nlength. That will request vhost to check both translated address and\ntranslated data length. This patch will add missed address check.\n\nCVE-2020-10725\nFixes: 75ed51697820 (\"vhost: add packed ring batch dequeue\")\nFixes: ef861692c398 (\"vhost: add packed ring batch enqueue\")\nCc: stable@dpdk.org\n\nSigned-off-by: Marvin Liu <yong.liu@intel.com>\nReviewed-by: Maxime Coquelin <maxime.coquelin@redhat.com>",
  24353. "target": 0,
  24354. "dataset": "other",
  24355. "idx": 399940
  24356. }
  24357. ]
  24358. },
  24359. {
  24360. "call_depth": 3,
  24361. "longest_call_chain": [
  24362. "tcp_check_space",
  24363. "tcp_new_space",
  24364. "tcp_should_expand_sndbuf"
  24365. ],
  24366. "group_size": 3,
  24367. "functions": [
  24368. {
  24369. "func": "static void tcp_check_space(struct sock *sk)\n{\n\tif (sock_flag(sk, SOCK_QUEUE_SHRUNK)) {\n\t\tsock_reset_flag(sk, SOCK_QUEUE_SHRUNK);\n\t\tif (sk->sk_socket &&\n\t\t test_bit(SOCK_NOSPACE, &sk->sk_socket->flags))\n\t\t\ttcp_new_space(sk);\n\t}\n}",
  24370. "project": "net-next",
  24371. "hash": 296127787089843267932160485998070699193,
  24372. "size": 9,
  24373. "commit_id": "fdf5af0daf8019cec2396cdef8fb042d80fe71fa",
  24374. "message": "tcp: drop SYN+FIN messages\n\nDenys Fedoryshchenko reported that SYN+FIN attacks were bringing his\nlinux machines to their limits.\n\nDont call conn_request() if the TCP flags includes SYN flag\n\nReported-by: Denys Fedoryshchenko <denys@visp.net.lb>\nSigned-off-by: Eric Dumazet <eric.dumazet@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  24375. "target": 0,
  24376. "dataset": "other",
  24377. "idx": 409882
  24378. },
  24379. {
  24380. "func": "static void tcp_new_space(struct sock *sk)\n{\n\tstruct tcp_sock *tp = tcp_sk(sk);\n\n\tif (tcp_should_expand_sndbuf(sk)) {\n\t\tint sndmem = SKB_TRUESIZE(max_t(u32,\n\t\t\t\t\t\ttp->rx_opt.mss_clamp,\n\t\t\t\t\t\ttp->mss_cache) +\n\t\t\t\t\t MAX_TCP_HEADER);\n\t\tint demanded = max_t(unsigned int, tp->snd_cwnd,\n\t\t\t\t tp->reordering + 1);\n\t\tsndmem *= 2 * demanded;\n\t\tif (sndmem > sk->sk_sndbuf)\n\t\t\tsk->sk_sndbuf = min(sndmem, sysctl_tcp_wmem[2]);\n\t\ttp->snd_cwnd_stamp = tcp_time_stamp;\n\t}\n\n\tsk->sk_write_space(sk);\n}",
  24381. "project": "net-next",
  24382. "hash": 202425998378617003007172841908596303553,
  24383. "size": 19,
  24384. "commit_id": "fdf5af0daf8019cec2396cdef8fb042d80fe71fa",
  24385. "message": "tcp: drop SYN+FIN messages\n\nDenys Fedoryshchenko reported that SYN+FIN attacks were bringing his\nlinux machines to their limits.\n\nDont call conn_request() if the TCP flags includes SYN flag\n\nReported-by: Denys Fedoryshchenko <denys@visp.net.lb>\nSigned-off-by: Eric Dumazet <eric.dumazet@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  24386. "target": 0,
  24387. "dataset": "other",
  24388. "idx": 409917
  24389. },
  24390. {
  24391. "func": "static int tcp_should_expand_sndbuf(const struct sock *sk)\n{\n\tconst struct tcp_sock *tp = tcp_sk(sk);\n\n\t/* If the user specified a specific send buffer setting, do\n\t * not modify it.\n\t */\n\tif (sk->sk_userlocks & SOCK_SNDBUF_LOCK)\n\t\treturn 0;\n\n\t/* If we are under global TCP memory pressure, do not expand. */\n\tif (tcp_memory_pressure)\n\t\treturn 0;\n\n\t/* If we are under soft global TCP memory pressure, do not expand. */\n\tif (atomic_long_read(&tcp_memory_allocated) >= sysctl_tcp_mem[0])\n\t\treturn 0;\n\n\t/* If we filled the congestion window, do not expand. */\n\tif (tp->packets_out >= tp->snd_cwnd)\n\t\treturn 0;\n\n\treturn 1;\n}",
  24392. "project": "net-next",
  24393. "hash": 328883797433948867138773900014105001499,
  24394. "size": 24,
  24395. "commit_id": "fdf5af0daf8019cec2396cdef8fb042d80fe71fa",
  24396. "message": "tcp: drop SYN+FIN messages\n\nDenys Fedoryshchenko reported that SYN+FIN attacks were bringing his\nlinux machines to their limits.\n\nDont call conn_request() if the TCP flags includes SYN flag\n\nReported-by: Denys Fedoryshchenko <denys@visp.net.lb>\nSigned-off-by: Eric Dumazet <eric.dumazet@gmail.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  24397. "target": 0,
  24398. "dataset": "other",
  24399. "idx": 409918
  24400. }
  24401. ]
  24402. },
  24403. {
  24404. "call_depth": 3,
  24405. "longest_call_chain": [
  24406. "ext4_group_add",
  24407. "setup_new_group_blocks",
  24408. "extend_or_restart_transaction"
  24409. ],
  24410. "group_size": 10,
  24411. "functions": [
  24412. {
  24413. "func": "static int reserve_backup_gdb(handle_t *handle, struct inode *inode,\n\t\t\t struct ext4_new_group_data *input)\n{\n\tstruct super_block *sb = inode->i_sb;\n\tint reserved_gdb =le16_to_cpu(EXT4_SB(sb)->s_es->s_reserved_gdt_blocks);\n\tstruct buffer_head **primary;\n\tstruct buffer_head *dind;\n\tstruct ext4_iloc iloc;\n\text4_fsblk_t blk;\n\t__le32 *data, *end;\n\tint gdbackups = 0;\n\tint res, i;\n\tint err;\n\n\tprimary = kmalloc(reserved_gdb * sizeof(*primary), GFP_NOFS);\n\tif (!primary)\n\t\treturn -ENOMEM;\n\n\tdata = EXT4_I(inode)->i_data + EXT4_DIND_BLOCK;\n\tdind = sb_bread(sb, le32_to_cpu(*data));\n\tif (!dind) {\n\t\terr = -EIO;\n\t\tgoto exit_free;\n\t}\n\n\tblk = EXT4_SB(sb)->s_sbh->b_blocknr + 1 + EXT4_SB(sb)->s_gdb_count;\n\tdata = (__le32 *)dind->b_data + (EXT4_SB(sb)->s_gdb_count %\n\t\t\t\t\t EXT4_ADDR_PER_BLOCK(sb));\n\tend = (__le32 *)dind->b_data + EXT4_ADDR_PER_BLOCK(sb);\n\n\t/* Get each reserved primary GDT block and verify it holds backups */\n\tfor (res = 0; res < reserved_gdb; res++, blk++) {\n\t\tif (le32_to_cpu(*data) != blk) {\n\t\t\text4_warning(sb, __func__,\n\t\t\t\t \"reserved block %llu\"\n\t\t\t\t \" not at offset %ld\",\n\t\t\t\t blk,\n\t\t\t\t (long)(data - (__le32 *)dind->b_data));\n\t\t\terr = -EINVAL;\n\t\t\tgoto exit_bh;\n\t\t}\n\t\tprimary[res] = sb_bread(sb, blk);\n\t\tif (!primary[res]) {\n\t\t\terr = -EIO;\n\t\t\tgoto exit_bh;\n\t\t}\n\t\tif ((gdbackups = verify_reserved_gdb(sb, primary[res])) < 0) {\n\t\t\tbrelse(primary[res]);\n\t\t\terr = gdbackups;\n\t\t\tgoto exit_bh;\n\t\t}\n\t\tif (++data >= end)\n\t\t\tdata = (__le32 *)dind->b_data;\n\t}\n\n\tfor (i = 0; i < reserved_gdb; i++) {\n\t\tif ((err = ext4_journal_get_write_access(handle, primary[i]))) {\n\t\t\t/*\n\t\t\tint j;\n\t\t\tfor (j = 0; j < i; j++)\n\t\t\t\text4_journal_release_buffer(handle, primary[j]);\n\t\t\t */\n\t\t\tgoto exit_bh;\n\t\t}\n\t}\n\n\tif ((err = ext4_reserve_inode_write(handle, inode, &iloc)))\n\t\tgoto exit_bh;\n\n\t/*\n\t * Finally we can add each of the reserved backup GDT blocks from\n\t * the new group to its reserved primary GDT block.\n\t */\n\tblk = input->group * EXT4_BLOCKS_PER_GROUP(sb);\n\tfor (i = 0; i < reserved_gdb; i++) {\n\t\tint err2;\n\t\tdata = (__le32 *)primary[i]->b_data;\n\t\t/* printk(\"reserving backup %lu[%u] = %lu\\n\",\n\t\t primary[i]->b_blocknr, gdbackups,\n\t\t blk + primary[i]->b_blocknr); */\n\t\tdata[gdbackups] = cpu_to_le32(blk + primary[i]->b_blocknr);\n\t\terr2 = ext4_handle_dirty_metadata(handle, NULL, primary[i]);\n\t\tif (!err)\n\t\t\terr = err2;\n\t}\n\tinode->i_blocks += reserved_gdb * sb->s_blocksize >> 9;\n\text4_mark_iloc_dirty(handle, inode, &iloc);\n\nexit_bh:\n\twhile (--res >= 0)\n\t\tbrelse(primary[res]);\n\tbrelse(dind);\n\nexit_free:\n\tkfree(primary);\n\n\treturn err;\n}",
  24414. "target": 0,
  24415. "cwe": [
  24416. "CWE-20"
  24417. ],
  24418. "project": "linux-2.6",
  24419. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24420. "hash": 53564046847221204145026812978118434897,
  24421. "size": 98,
  24422. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24423. "dataset": "other",
  24424. "idx": 489882
  24425. },
  24426. {
  24427. "func": "static int add_new_gdb(handle_t *handle, struct inode *inode,\n\t\t struct ext4_new_group_data *input,\n\t\t struct buffer_head **primary)\n{\n\tstruct super_block *sb = inode->i_sb;\n\tstruct ext4_super_block *es = EXT4_SB(sb)->s_es;\n\tunsigned long gdb_num = input->group / EXT4_DESC_PER_BLOCK(sb);\n\text4_fsblk_t gdblock = EXT4_SB(sb)->s_sbh->b_blocknr + 1 + gdb_num;\n\tstruct buffer_head **o_group_desc, **n_group_desc;\n\tstruct buffer_head *dind;\n\tint gdbackups;\n\tstruct ext4_iloc iloc;\n\t__le32 *data;\n\tint err;\n\n\tif (test_opt(sb, DEBUG))\n\t\tprintk(KERN_DEBUG\n\t\t \"EXT4-fs: ext4_add_new_gdb: adding group block %lu\\n\",\n\t\t gdb_num);\n\n\t/*\n\t * If we are not using the primary superblock/GDT copy don't resize,\n * because the user tools have no way of handling this. Probably a\n * bad time to do it anyways.\n */\n\tif (EXT4_SB(sb)->s_sbh->b_blocknr !=\n\t le32_to_cpu(EXT4_SB(sb)->s_es->s_first_data_block)) {\n\t\text4_warning(sb, __func__,\n\t\t\t\"won't resize using backup superblock at %llu\",\n\t\t\t(unsigned long long)EXT4_SB(sb)->s_sbh->b_blocknr);\n\t\treturn -EPERM;\n\t}\n\n\t*primary = sb_bread(sb, gdblock);\n\tif (!*primary)\n\t\treturn -EIO;\n\n\tif ((gdbackups = verify_reserved_gdb(sb, *primary)) < 0) {\n\t\terr = gdbackups;\n\t\tgoto exit_bh;\n\t}\n\n\tdata = EXT4_I(inode)->i_data + EXT4_DIND_BLOCK;\n\tdind = sb_bread(sb, le32_to_cpu(*data));\n\tif (!dind) {\n\t\terr = -EIO;\n\t\tgoto exit_bh;\n\t}\n\n\tdata = (__le32 *)dind->b_data;\n\tif (le32_to_cpu(data[gdb_num % EXT4_ADDR_PER_BLOCK(sb)]) != gdblock) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"new group %u GDT block %llu not reserved\",\n\t\t\t input->group, gdblock);\n\t\terr = -EINVAL;\n\t\tgoto exit_dind;\n\t}\n\n\tif ((err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh)))\n\t\tgoto exit_dind;\n\n\tif ((err = ext4_journal_get_write_access(handle, *primary)))\n\t\tgoto exit_sbh;\n\n\tif ((err = ext4_journal_get_write_access(handle, dind)))\n\t\tgoto exit_primary;\n\n\t/* ext4_reserve_inode_write() gets a reference on the iloc */\n\tif ((err = ext4_reserve_inode_write(handle, inode, &iloc)))\n\t\tgoto exit_dindj;\n\n\tn_group_desc = kmalloc((gdb_num + 1) * sizeof(struct buffer_head *),\n\t\t\tGFP_NOFS);\n\tif (!n_group_desc) {\n\t\terr = -ENOMEM;\n\t\text4_warning(sb, __func__,\n\t\t\t \"not enough memory for %lu groups\", gdb_num + 1);\n\t\tgoto exit_inode;\n\t}\n\n\t/*\n\t * Finally, we have all of the possible failures behind us...\n\t *\n\t * Remove new GDT block from inode double-indirect block and clear out\n\t * the new GDT block for use (which also \"frees\" the backup GDT blocks\n\t * from the reserved inode). We don't need to change the bitmaps for\n\t * these blocks, because they are marked as in-use from being in the\n\t * reserved inode, and will become GDT blocks (primary and backup).\n\t */\n\tdata[gdb_num % EXT4_ADDR_PER_BLOCK(sb)] = 0;\n\text4_handle_dirty_metadata(handle, NULL, dind);\n\tbrelse(dind);\n\tinode->i_blocks -= (gdbackups + 1) * sb->s_blocksize >> 9;\n\text4_mark_iloc_dirty(handle, inode, &iloc);\n\tmemset((*primary)->b_data, 0, sb->s_blocksize);\n\text4_handle_dirty_metadata(handle, NULL, *primary);\n\n\to_group_desc = EXT4_SB(sb)->s_group_desc;\n\tmemcpy(n_group_desc, o_group_desc,\n\t EXT4_SB(sb)->s_gdb_count * sizeof(struct buffer_head *));\n\tn_group_desc[gdb_num] = *primary;\n\tEXT4_SB(sb)->s_group_desc = n_group_desc;\n\tEXT4_SB(sb)->s_gdb_count++;\n\tkfree(o_group_desc);\n\n\tle16_add_cpu(&es->s_reserved_gdt_blocks, -1);\n\text4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);\n\n\treturn 0;\n\nexit_inode:\n\t/* ext4_journal_release_buffer(handle, iloc.bh); */\n\tbrelse(iloc.bh);\nexit_dindj:\n\t/* ext4_journal_release_buffer(handle, dind); */\nexit_primary:\n\t/* ext4_journal_release_buffer(handle, *primary); */\nexit_sbh:\n\t/* ext4_journal_release_buffer(handle, *primary); */\nexit_dind:\n\tbrelse(dind);\nexit_bh:\n\tbrelse(*primary);\n\n\text4_debug(\"leaving with error %d\\n\", err);\n\treturn err;\n}",
  24428. "target": 0,
  24429. "cwe": [
  24430. "CWE-20"
  24431. ],
  24432. "project": "linux-2.6",
  24433. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24434. "hash": 332885612281430633913420144249098882494,
  24435. "size": 127,
  24436. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24437. "dataset": "other",
  24438. "idx": 489879
  24439. },
  24440. {
  24441. "func": "int ext4_group_extend(struct super_block *sb, struct ext4_super_block *es,\n\t\t ext4_fsblk_t n_blocks_count)\n{\n\text4_fsblk_t o_blocks_count;\n\text4_group_t o_groups_count;\n\text4_grpblk_t last;\n\text4_grpblk_t add;\n\tstruct buffer_head *bh;\n\thandle_t *handle;\n\tint err;\n\text4_group_t group;\n\n\t/* We don't need to worry about locking wrt other resizers just\n\t * yet: we're going to revalidate es->s_blocks_count after\n\t * taking lock_super() below. */\n\to_blocks_count = ext4_blocks_count(es);\n\to_groups_count = EXT4_SB(sb)->s_groups_count;\n\n\tif (test_opt(sb, DEBUG))\n\t\tprintk(KERN_DEBUG \"EXT4-fs: extending last group from %llu uto %llu blocks\\n\",\n\t\t o_blocks_count, n_blocks_count);\n\n\tif (n_blocks_count == 0 || n_blocks_count == o_blocks_count)\n\t\treturn 0;\n\n\tif (n_blocks_count > (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) {\n\t\tprintk(KERN_ERR \"EXT4-fs: filesystem on %s:\"\n\t\t\t\" too large to resize to %llu blocks safely\\n\",\n\t\t\tsb->s_id, n_blocks_count);\n\t\tif (sizeof(sector_t) < 8)\n\t\t\text4_warning(sb, __func__, \"CONFIG_LBD not enabled\");\n\t\treturn -EINVAL;\n\t}\n\n\tif (n_blocks_count < o_blocks_count) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"can't shrink FS - resize aborted\");\n\t\treturn -EBUSY;\n\t}\n\n\t/* Handle the remaining blocks in the last group only. */\n\text4_get_group_no_and_offset(sb, o_blocks_count, &group, &last);\n\n\tif (last == 0) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"need to use ext2online to resize further\");\n\t\treturn -EPERM;\n\t}\n\n\tadd = EXT4_BLOCKS_PER_GROUP(sb) - last;\n\n\tif (o_blocks_count + add < o_blocks_count) {\n\t\text4_warning(sb, __func__, \"blocks_count overflow\");\n\t\treturn -EINVAL;\n\t}\n\n\tif (o_blocks_count + add > n_blocks_count)\n\t\tadd = n_blocks_count - o_blocks_count;\n\n\tif (o_blocks_count + add < n_blocks_count)\n\t\text4_warning(sb, __func__,\n\t\t\t \"will only finish group (%llu\"\n\t\t\t \" blocks, %u new)\",\n\t\t\t o_blocks_count + add, add);\n\n\t/* See if the device is actually as big as what was requested */\n\tbh = sb_bread(sb, o_blocks_count + add - 1);\n\tif (!bh) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"can't read last block, resize aborted\");\n\t\treturn -ENOSPC;\n\t}\n\tbrelse(bh);\n\n\t/* We will update the superblock, one block bitmap, and\n\t * one group descriptor via ext4_free_blocks().\n\t */\n\thandle = ext4_journal_start_sb(sb, 3);\n\tif (IS_ERR(handle)) {\n\t\terr = PTR_ERR(handle);\n\t\text4_warning(sb, __func__, \"error %d on journal start\", err);\n\t\tgoto exit_put;\n\t}\n\n\tlock_super(sb);\n\tif (o_blocks_count != ext4_blocks_count(es)) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"multiple resizers run on filesystem!\");\n\t\tunlock_super(sb);\n\t\text4_journal_stop(handle);\n\t\terr = -EBUSY;\n\t\tgoto exit_put;\n\t}\n\n\tif ((err = ext4_journal_get_write_access(handle,\n\t\t\t\t\t\t EXT4_SB(sb)->s_sbh))) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"error %d on journal write access\", err);\n\t\tunlock_super(sb);\n\t\text4_journal_stop(handle);\n\t\tgoto exit_put;\n\t}\n\text4_blocks_count_set(es, o_blocks_count + add);\n\text4_handle_dirty_metadata(handle, NULL, EXT4_SB(sb)->s_sbh);\n\tsb->s_dirt = 1;\n\tunlock_super(sb);\n\text4_debug(\"freeing blocks %llu through %llu\\n\", o_blocks_count,\n\t\t o_blocks_count + add);\n\t/* We add the blocks to the bitmap and set the group need init bit */\n\text4_add_groupblocks(handle, sb, o_blocks_count, add);\n\text4_debug(\"freed blocks %llu through %llu\\n\", o_blocks_count,\n\t\t o_blocks_count + add);\n\tif ((err = ext4_journal_stop(handle)))\n\t\tgoto exit_put;\n\n\tif (test_opt(sb, DEBUG))\n\t\tprintk(KERN_DEBUG \"EXT4-fs: extended group to %llu blocks\\n\",\n\t\t ext4_blocks_count(es));\n\tupdate_backups(sb, EXT4_SB(sb)->s_sbh->b_blocknr, (char *)es,\n\t\t sizeof(struct ext4_super_block));\nexit_put:\n\treturn err;\n} /* ext4_group_extend */",
  24442. "target": 0,
  24443. "cwe": [
  24444. "CWE-20"
  24445. ],
  24446. "project": "linux-2.6",
  24447. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24448. "hash": 225669503474349997256762903535069719629,
  24449. "size": 123,
  24450. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24451. "dataset": "other",
  24452. "idx": 489878
  24453. },
  24454. {
  24455. "func": "static int verify_reserved_gdb(struct super_block *sb,\n\t\t\t struct buffer_head *primary)\n{\n\tconst ext4_fsblk_t blk = primary->b_blocknr;\n\tconst ext4_group_t end = EXT4_SB(sb)->s_groups_count;\n\tunsigned three = 1;\n\tunsigned five = 5;\n\tunsigned seven = 7;\n\tunsigned grp;\n\t__le32 *p = (__le32 *)primary->b_data;\n\tint gdbackups = 0;\n\n\twhile ((grp = ext4_list_backups(sb, &three, &five, &seven)) < end) {\n\t\tif (le32_to_cpu(*p++) !=\n\t\t grp * EXT4_BLOCKS_PER_GROUP(sb) + blk){\n\t\t\text4_warning(sb, __func__,\n\t\t\t\t \"reserved GDT %llu\"\n\t\t\t\t \" missing grp %d (%llu)\",\n\t\t\t\t blk, grp,\n\t\t\t\t grp *\n\t\t\t\t (ext4_fsblk_t)EXT4_BLOCKS_PER_GROUP(sb) +\n\t\t\t\t blk);\n\t\t\treturn -EINVAL;\n\t\t}\n\t\tif (++gdbackups > EXT4_ADDR_PER_BLOCK(sb))\n\t\t\treturn -EFBIG;\n\t}\n\n\treturn gdbackups;\n}",
  24456. "target": 0,
  24457. "cwe": [
  24458. "CWE-20"
  24459. ],
  24460. "project": "linux-2.6",
  24461. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24462. "hash": 128954304814523851738698372455195263504,
  24463. "size": 30,
  24464. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24465. "dataset": "other",
  24466. "idx": 489881
  24467. },
  24468. {
  24469. "func": "static int verify_group_input(struct super_block *sb,\n\t\t\t struct ext4_new_group_data *input)\n{\n\tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n\tstruct ext4_super_block *es = sbi->s_es;\n\text4_fsblk_t start = ext4_blocks_count(es);\n\text4_fsblk_t end = start + input->blocks_count;\n\text4_group_t group = input->group;\n\text4_fsblk_t itend = input->inode_table + sbi->s_itb_per_group;\n\tunsigned overhead = ext4_bg_has_super(sb, group) ?\n\t\t(1 + ext4_bg_num_gdb(sb, group) +\n\t\t le16_to_cpu(es->s_reserved_gdt_blocks)) : 0;\n\text4_fsblk_t metaend = start + overhead;\n\tstruct buffer_head *bh = NULL;\n\text4_grpblk_t free_blocks_count, offset;\n\tint err = -EINVAL;\n\n\tinput->free_blocks_count = free_blocks_count =\n\t\tinput->blocks_count - 2 - overhead - sbi->s_itb_per_group;\n\n\tif (test_opt(sb, DEBUG))\n\t\tprintk(KERN_DEBUG \"EXT4-fs: adding %s group %u: %u blocks \"\n\t\t \"(%d free, %u reserved)\\n\",\n\t\t ext4_bg_has_super(sb, input->group) ? \"normal\" :\n\t\t \"no-super\", input->group, input->blocks_count,\n\t\t free_blocks_count, input->reserved_blocks);\n\n\text4_get_group_no_and_offset(sb, start, NULL, &offset);\n\tif (group != sbi->s_groups_count)\n\t\text4_warning(sb, __func__,\n\t\t\t \"Cannot add at group %u (only %u groups)\",\n\t\t\t input->group, sbi->s_groups_count);\n\telse if (offset != 0)\n\t\t\text4_warning(sb, __func__, \"Last group not full\");\n\telse if (input->reserved_blocks > input->blocks_count / 5)\n\t\text4_warning(sb, __func__, \"Reserved blocks too high (%u)\",\n\t\t\t input->reserved_blocks);\n\telse if (free_blocks_count < 0)\n\t\text4_warning(sb, __func__, \"Bad blocks count %u\",\n\t\t\t input->blocks_count);\n\telse if (!(bh = sb_bread(sb, end - 1)))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Cannot read last block (%llu)\",\n\t\t\t end - 1);\n\telse if (outside(input->block_bitmap, start, end))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Block bitmap not in group (block %llu)\",\n\t\t\t (unsigned long long)input->block_bitmap);\n\telse if (outside(input->inode_bitmap, start, end))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Inode bitmap not in group (block %llu)\",\n\t\t\t (unsigned long long)input->inode_bitmap);\n\telse if (outside(input->inode_table, start, end) ||\n\t\t outside(itend - 1, start, end))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Inode table not in group (blocks %llu-%llu)\",\n\t\t\t (unsigned long long)input->inode_table, itend - 1);\n\telse if (input->inode_bitmap == input->block_bitmap)\n\t\text4_warning(sb, __func__,\n\t\t\t \"Block bitmap same as inode bitmap (%llu)\",\n\t\t\t (unsigned long long)input->block_bitmap);\n\telse if (inside(input->block_bitmap, input->inode_table, itend))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Block bitmap (%llu) in inode table (%llu-%llu)\",\n\t\t\t (unsigned long long)input->block_bitmap,\n\t\t\t (unsigned long long)input->inode_table, itend - 1);\n\telse if (inside(input->inode_bitmap, input->inode_table, itend))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Inode bitmap (%llu) in inode table (%llu-%llu)\",\n\t\t\t (unsigned long long)input->inode_bitmap,\n\t\t\t (unsigned long long)input->inode_table, itend - 1);\n\telse if (inside(input->block_bitmap, start, metaend))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Block bitmap (%llu) in GDT table\"\n\t\t\t \" (%llu-%llu)\",\n\t\t\t (unsigned long long)input->block_bitmap,\n\t\t\t start, metaend - 1);\n\telse if (inside(input->inode_bitmap, start, metaend))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Inode bitmap (%llu) in GDT table\"\n\t\t\t \" (%llu-%llu)\",\n\t\t\t (unsigned long long)input->inode_bitmap,\n\t\t\t start, metaend - 1);\n\telse if (inside(input->inode_table, start, metaend) ||\n\t\t inside(itend - 1, start, metaend))\n\t\text4_warning(sb, __func__,\n\t\t\t \"Inode table (%llu-%llu) overlaps\"\n\t\t\t \"GDT table (%llu-%llu)\",\n\t\t\t (unsigned long long)input->inode_table,\n\t\t\t itend - 1, start, metaend - 1);\n\telse\n\t\terr = 0;\n\tbrelse(bh);\n\n\treturn err;\n}",
  24470. "target": 0,
  24471. "cwe": [
  24472. "CWE-20"
  24473. ],
  24474. "project": "linux-2.6",
  24475. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24476. "hash": 228488893860518117939278009627835171771,
  24477. "size": 96,
  24478. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24479. "dataset": "other",
  24480. "idx": 489885
  24481. },
  24482. {
  24483. "func": "static int extend_or_restart_transaction(handle_t *handle, int thresh,\n\t\t\t\t\t struct buffer_head *bh)\n{\n\tint err;\n\n\tif (ext4_handle_has_enough_credits(handle, thresh))\n\t\treturn 0;\n\n\terr = ext4_journal_extend(handle, EXT4_MAX_TRANS_DATA);\n\tif (err < 0)\n\t\treturn err;\n\tif (err) {\n\t\tif ((err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA)))\n\t\t\treturn err;\n\t\tif ((err = ext4_journal_get_write_access(handle, bh)))\n\t\t\treturn err;\n\t}\n\n\treturn 0;\n}",
  24484. "target": 0,
  24485. "cwe": [
  24486. "CWE-20"
  24487. ],
  24488. "project": "linux-2.6",
  24489. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24490. "hash": 123182504547485296901476464093407721569,
  24491. "size": 20,
  24492. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24493. "dataset": "other",
  24494. "idx": 489880
  24495. },
  24496. {
  24497. "func": "int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)\n{\n\tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n\tstruct ext4_super_block *es = sbi->s_es;\n\tint reserved_gdb = ext4_bg_has_super(sb, input->group) ?\n\t\tle16_to_cpu(es->s_reserved_gdt_blocks) : 0;\n\tstruct buffer_head *primary = NULL;\n\tstruct ext4_group_desc *gdp;\n\tstruct inode *inode = NULL;\n\thandle_t *handle;\n\tint gdb_off, gdb_num;\n\tint num_grp_locked = 0;\n\tint err, err2;\n\n\tgdb_num = input->group / EXT4_DESC_PER_BLOCK(sb);\n\tgdb_off = input->group % EXT4_DESC_PER_BLOCK(sb);\n\n\tif (gdb_off == 0 && !EXT4_HAS_RO_COMPAT_FEATURE(sb,\n\t\t\t\t\tEXT4_FEATURE_RO_COMPAT_SPARSE_SUPER)) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"Can't resize non-sparse filesystem further\");\n\t\treturn -EPERM;\n\t}\n\n\tif (ext4_blocks_count(es) + input->blocks_count <\n\t ext4_blocks_count(es)) {\n\t\text4_warning(sb, __func__, \"blocks_count overflow\");\n\t\treturn -EINVAL;\n\t}\n\n\tif (le32_to_cpu(es->s_inodes_count) + EXT4_INODES_PER_GROUP(sb) <\n\t le32_to_cpu(es->s_inodes_count)) {\n\t\text4_warning(sb, __func__, \"inodes_count overflow\");\n\t\treturn -EINVAL;\n\t}\n\n\tif (reserved_gdb || gdb_off == 0) {\n\t\tif (!EXT4_HAS_COMPAT_FEATURE(sb,\n\t\t\t\t\t EXT4_FEATURE_COMPAT_RESIZE_INODE)\n\t\t || !le16_to_cpu(es->s_reserved_gdt_blocks)) {\n\t\t\text4_warning(sb, __func__,\n\t\t\t\t \"No reserved GDT blocks, can't resize\");\n\t\t\treturn -EPERM;\n\t\t}\n\t\tinode = ext4_iget(sb, EXT4_RESIZE_INO);\n\t\tif (IS_ERR(inode)) {\n\t\t\text4_warning(sb, __func__,\n\t\t\t\t \"Error opening resize inode\");\n\t\t\treturn PTR_ERR(inode);\n\t\t}\n\t}\n\n\n\tif ((err = verify_group_input(sb, input)))\n\t\tgoto exit_put;\n\n\tif ((err = setup_new_group_blocks(sb, input)))\n\t\tgoto exit_put;\n\n\t/*\n\t * We will always be modifying at least the superblock and a GDT\n\t * block. If we are adding a group past the last current GDT block,\n\t * we will also modify the inode and the dindirect block. If we\n\t * are adding a group with superblock/GDT backups we will also\n\t * modify each of the reserved GDT dindirect blocks.\n\t */\n\thandle = ext4_journal_start_sb(sb,\n\t\t\t\t ext4_bg_has_super(sb, input->group) ?\n\t\t\t\t 3 + reserved_gdb : 4);\n\tif (IS_ERR(handle)) {\n\t\terr = PTR_ERR(handle);\n\t\tgoto exit_put;\n\t}\n\n\tlock_super(sb);\n\tif (input->group != sbi->s_groups_count) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"multiple resizers run on filesystem!\");\n\t\terr = -EBUSY;\n\t\tgoto exit_journal;\n\t}\n\n\tif ((err = ext4_journal_get_write_access(handle, sbi->s_sbh)))\n\t\tgoto exit_journal;\n\n /*\n * We will only either add reserved group blocks to a backup group\n * or remove reserved blocks for the first group in a new group block.\n * Doing both would be mean more complex code, and sane people don't\n * use non-sparse filesystems anymore. This is already checked above.\n */\n\tif (gdb_off) {\n\t\tprimary = sbi->s_group_desc[gdb_num];\n\t\tif ((err = ext4_journal_get_write_access(handle, primary)))\n\t\t\tgoto exit_journal;\n\n\t\tif (reserved_gdb && ext4_bg_num_gdb(sb, input->group) &&\n\t\t (err = reserve_backup_gdb(handle, inode, input)))\n\t\t\tgoto exit_journal;\n\t} else if ((err = add_new_gdb(handle, inode, input, &primary)))\n\t\tgoto exit_journal;\n\n /*\n * OK, now we've set up the new group. Time to make it active.\n *\n * Current kernels don't lock all allocations via lock_super(),\n * so we have to be safe wrt. concurrent accesses the group\n * data. So we need to be careful to set all of the relevant\n * group descriptor data etc. *before* we enable the group.\n *\n * The key field here is sbi->s_groups_count: as long as\n * that retains its old value, nobody is going to access the new\n * group.\n *\n * So first we update all the descriptor metadata for the new\n * group; then we update the total disk blocks count; then we\n * update the groups count to enable the group; then finally we\n * update the free space counts so that the system can start\n * using the new disk blocks.\n */\n\n\tnum_grp_locked = ext4_mb_get_buddy_cache_lock(sb, input->group);\n\t/* Update group descriptor block for new group */\n\tgdp = (struct ext4_group_desc *)((char *)primary->b_data +\n\t\t\t\t\t gdb_off * EXT4_DESC_SIZE(sb));\n\n\text4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */\n\text4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */\n\text4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */\n\text4_free_blks_set(sb, gdp, input->free_blocks_count);\n\text4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));\n\tgdp->bg_flags |= cpu_to_le16(EXT4_BG_INODE_ZEROED);\n\tgdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp);\n\n\t/*\n\t * We can allocate memory for mb_alloc based on the new group\n\t * descriptor\n\t */\n\terr = ext4_mb_add_groupinfo(sb, input->group, gdp);\n\tif (err) {\n\t\text4_mb_put_buddy_cache_lock(sb, input->group, num_grp_locked);\n\t\tgoto exit_journal;\n\t}\n\n\t/*\n\t * Make the new blocks and inodes valid next. We do this before\n\t * increasing the group count so that once the group is enabled,\n\t * all of its blocks and inodes are already valid.\n\t *\n\t * We always allocate group-by-group, then block-by-block or\n\t * inode-by-inode within a group, so enabling these\n\t * blocks/inodes before the group is live won't actually let us\n\t * allocate the new space yet.\n\t */\n\text4_blocks_count_set(es, ext4_blocks_count(es) +\n\t\tinput->blocks_count);\n\tle32_add_cpu(&es->s_inodes_count, EXT4_INODES_PER_GROUP(sb));\n\n\t/*\n\t * We need to protect s_groups_count against other CPUs seeing\n\t * inconsistent state in the superblock.\n\t *\n\t * The precise rules we use are:\n\t *\n\t * * Writers of s_groups_count *must* hold lock_super\n\t * AND\n\t * * Writers must perform a smp_wmb() after updating all dependent\n\t * data and before modifying the groups count\n\t *\n\t * * Readers must hold lock_super() over the access\n\t * OR\n\t * * Readers must perform an smp_rmb() after reading the groups count\n\t * and before reading any dependent data.\n\t *\n\t * NB. These rules can be relaxed when checking the group count\n\t * while freeing data, as we can only allocate from a block\n\t * group after serialising against the group count, and we can\n\t * only then free after serialising in turn against that\n\t * allocation.\n\t */\n\tsmp_wmb();\n\n\t/* Update the global fs size fields */\n\tsbi->s_groups_count++;\n\text4_mb_put_buddy_cache_lock(sb, input->group, num_grp_locked);\n\n\text4_handle_dirty_metadata(handle, NULL, primary);\n\n\t/* Update the reserved block counts only once the new group is\n\t * active. */\n\text4_r_blocks_count_set(es, ext4_r_blocks_count(es) +\n\t\tinput->reserved_blocks);\n\n\t/* Update the free space counts */\n\tpercpu_counter_add(&sbi->s_freeblocks_counter,\n\t\t\t input->free_blocks_count);\n\tpercpu_counter_add(&sbi->s_freeinodes_counter,\n\t\t\t EXT4_INODES_PER_GROUP(sb));\n\n\tif (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {\n\t\text4_group_t flex_group;\n\t\tflex_group = ext4_flex_group(sbi, input->group);\n\t\tsbi->s_flex_groups[flex_group].free_blocks +=\n\t\t\tinput->free_blocks_count;\n\t\tsbi->s_flex_groups[flex_group].free_inodes +=\n\t\t\tEXT4_INODES_PER_GROUP(sb);\n\t}\n\n\text4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);\n\tsb->s_dirt = 1;\n\nexit_journal:\n\tunlock_super(sb);\n\tif ((err2 = ext4_journal_stop(handle)) && !err)\n\t\terr = err2;\n\tif (!err) {\n\t\tupdate_backups(sb, sbi->s_sbh->b_blocknr, (char *)es,\n\t\t\t sizeof(struct ext4_super_block));\n\t\tupdate_backups(sb, primary->b_blocknr, primary->b_data,\n\t\t\t primary->b_size);\n\t}\nexit_put:\n\tiput(inode);\n\treturn err;\n} /* ext4_group_add */",
  24498. "target": 1,
  24499. "cwe": [
  24500. "CWE-20"
  24501. ],
  24502. "project": "linux-2.6",
  24503. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24504. "hash": 281245565929730846006190005126700543134,
  24505. "size": 225,
  24506. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24507. "dataset": "other",
  24508. "idx": 215458
  24509. },
  24510. {
  24511. "func": "int ext4_group_add(struct super_block *sb, struct ext4_new_group_data *input)\n{\n\tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n\tstruct ext4_super_block *es = sbi->s_es;\n\tint reserved_gdb = ext4_bg_has_super(sb, input->group) ?\n\t\tle16_to_cpu(es->s_reserved_gdt_blocks) : 0;\n\tstruct buffer_head *primary = NULL;\n\tstruct ext4_group_desc *gdp;\n\tstruct inode *inode = NULL;\n\thandle_t *handle;\n\tint gdb_off, gdb_num;\n\tint num_grp_locked = 0;\n\tint err, err2;\n\n\tgdb_num = input->group / EXT4_DESC_PER_BLOCK(sb);\n\tgdb_off = input->group % EXT4_DESC_PER_BLOCK(sb);\n\n\tif (gdb_off == 0 && !EXT4_HAS_RO_COMPAT_FEATURE(sb,\n\t\t\t\t\tEXT4_FEATURE_RO_COMPAT_SPARSE_SUPER)) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"Can't resize non-sparse filesystem further\");\n\t\treturn -EPERM;\n\t}\n\n\tif (ext4_blocks_count(es) + input->blocks_count <\n\t ext4_blocks_count(es)) {\n\t\text4_warning(sb, __func__, \"blocks_count overflow\");\n\t\treturn -EINVAL;\n\t}\n\n\tif (le32_to_cpu(es->s_inodes_count) + EXT4_INODES_PER_GROUP(sb) <\n\t le32_to_cpu(es->s_inodes_count)) {\n\t\text4_warning(sb, __func__, \"inodes_count overflow\");\n\t\treturn -EINVAL;\n\t}\n\n\tif (reserved_gdb || gdb_off == 0) {\n\t\tif (!EXT4_HAS_COMPAT_FEATURE(sb,\n\t\t\t\t\t EXT4_FEATURE_COMPAT_RESIZE_INODE)\n\t\t || !le16_to_cpu(es->s_reserved_gdt_blocks)) {\n\t\t\text4_warning(sb, __func__,\n\t\t\t\t \"No reserved GDT blocks, can't resize\");\n\t\t\treturn -EPERM;\n\t\t}\n\t\tinode = ext4_iget(sb, EXT4_RESIZE_INO);\n\t\tif (IS_ERR(inode)) {\n\t\t\text4_warning(sb, __func__,\n\t\t\t\t \"Error opening resize inode\");\n\t\t\treturn PTR_ERR(inode);\n\t\t}\n\t}\n\n\n\tif ((err = verify_group_input(sb, input)))\n\t\tgoto exit_put;\n\n\tif ((err = setup_new_group_blocks(sb, input)))\n\t\tgoto exit_put;\n\n\t/*\n\t * We will always be modifying at least the superblock and a GDT\n\t * block. If we are adding a group past the last current GDT block,\n\t * we will also modify the inode and the dindirect block. If we\n\t * are adding a group with superblock/GDT backups we will also\n\t * modify each of the reserved GDT dindirect blocks.\n\t */\n\thandle = ext4_journal_start_sb(sb,\n\t\t\t\t ext4_bg_has_super(sb, input->group) ?\n\t\t\t\t 3 + reserved_gdb : 4);\n\tif (IS_ERR(handle)) {\n\t\terr = PTR_ERR(handle);\n\t\tgoto exit_put;\n\t}\n\n\tlock_super(sb);\n\tif (input->group != sbi->s_groups_count) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"multiple resizers run on filesystem!\");\n\t\terr = -EBUSY;\n\t\tgoto exit_journal;\n\t}\n\n\tif ((err = ext4_journal_get_write_access(handle, sbi->s_sbh)))\n\t\tgoto exit_journal;\n\n /*\n * We will only either add reserved group blocks to a backup group\n * or remove reserved blocks for the first group in a new group block.\n * Doing both would be mean more complex code, and sane people don't\n * use non-sparse filesystems anymore. This is already checked above.\n */\n\tif (gdb_off) {\n\t\tprimary = sbi->s_group_desc[gdb_num];\n\t\tif ((err = ext4_journal_get_write_access(handle, primary)))\n\t\t\tgoto exit_journal;\n\n\t\tif (reserved_gdb && ext4_bg_num_gdb(sb, input->group) &&\n\t\t (err = reserve_backup_gdb(handle, inode, input)))\n\t\t\tgoto exit_journal;\n\t} else if ((err = add_new_gdb(handle, inode, input, &primary)))\n\t\tgoto exit_journal;\n\n /*\n * OK, now we've set up the new group. Time to make it active.\n *\n * Current kernels don't lock all allocations via lock_super(),\n * so we have to be safe wrt. concurrent accesses the group\n * data. So we need to be careful to set all of the relevant\n * group descriptor data etc. *before* we enable the group.\n *\n * The key field here is sbi->s_groups_count: as long as\n * that retains its old value, nobody is going to access the new\n * group.\n *\n * So first we update all the descriptor metadata for the new\n * group; then we update the total disk blocks count; then we\n * update the groups count to enable the group; then finally we\n * update the free space counts so that the system can start\n * using the new disk blocks.\n */\n\n\tnum_grp_locked = ext4_mb_get_buddy_cache_lock(sb, input->group);\n\t/* Update group descriptor block for new group */\n\tgdp = (struct ext4_group_desc *)((char *)primary->b_data +\n\t\t\t\t\t gdb_off * EXT4_DESC_SIZE(sb));\n\n\tmemset(gdp, 0, EXT4_DESC_SIZE(sb));\n\text4_block_bitmap_set(sb, gdp, input->block_bitmap); /* LV FIXME */\n\text4_inode_bitmap_set(sb, gdp, input->inode_bitmap); /* LV FIXME */\n\text4_inode_table_set(sb, gdp, input->inode_table); /* LV FIXME */\n\text4_free_blks_set(sb, gdp, input->free_blocks_count);\n\text4_free_inodes_set(sb, gdp, EXT4_INODES_PER_GROUP(sb));\n\tgdp->bg_flags = cpu_to_le16(EXT4_BG_INODE_ZEROED);\n\tgdp->bg_checksum = ext4_group_desc_csum(sbi, input->group, gdp);\n\n\t/*\n\t * We can allocate memory for mb_alloc based on the new group\n\t * descriptor\n\t */\n\terr = ext4_mb_add_groupinfo(sb, input->group, gdp);\n\tif (err) {\n\t\text4_mb_put_buddy_cache_lock(sb, input->group, num_grp_locked);\n\t\tgoto exit_journal;\n\t}\n\n\t/*\n\t * Make the new blocks and inodes valid next. We do this before\n\t * increasing the group count so that once the group is enabled,\n\t * all of its blocks and inodes are already valid.\n\t *\n\t * We always allocate group-by-group, then block-by-block or\n\t * inode-by-inode within a group, so enabling these\n\t * blocks/inodes before the group is live won't actually let us\n\t * allocate the new space yet.\n\t */\n\text4_blocks_count_set(es, ext4_blocks_count(es) +\n\t\tinput->blocks_count);\n\tle32_add_cpu(&es->s_inodes_count, EXT4_INODES_PER_GROUP(sb));\n\n\t/*\n\t * We need to protect s_groups_count against other CPUs seeing\n\t * inconsistent state in the superblock.\n\t *\n\t * The precise rules we use are:\n\t *\n\t * * Writers of s_groups_count *must* hold lock_super\n\t * AND\n\t * * Writers must perform a smp_wmb() after updating all dependent\n\t * data and before modifying the groups count\n\t *\n\t * * Readers must hold lock_super() over the access\n\t * OR\n\t * * Readers must perform an smp_rmb() after reading the groups count\n\t * and before reading any dependent data.\n\t *\n\t * NB. These rules can be relaxed when checking the group count\n\t * while freeing data, as we can only allocate from a block\n\t * group after serialising against the group count, and we can\n\t * only then free after serialising in turn against that\n\t * allocation.\n\t */\n\tsmp_wmb();\n\n\t/* Update the global fs size fields */\n\tsbi->s_groups_count++;\n\text4_mb_put_buddy_cache_lock(sb, input->group, num_grp_locked);\n\n\text4_handle_dirty_metadata(handle, NULL, primary);\n\n\t/* Update the reserved block counts only once the new group is\n\t * active. */\n\text4_r_blocks_count_set(es, ext4_r_blocks_count(es) +\n\t\tinput->reserved_blocks);\n\n\t/* Update the free space counts */\n\tpercpu_counter_add(&sbi->s_freeblocks_counter,\n\t\t\t input->free_blocks_count);\n\tpercpu_counter_add(&sbi->s_freeinodes_counter,\n\t\t\t EXT4_INODES_PER_GROUP(sb));\n\n\tif (EXT4_HAS_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_FLEX_BG)) {\n\t\text4_group_t flex_group;\n\t\tflex_group = ext4_flex_group(sbi, input->group);\n\t\tsbi->s_flex_groups[flex_group].free_blocks +=\n\t\t\tinput->free_blocks_count;\n\t\tsbi->s_flex_groups[flex_group].free_inodes +=\n\t\t\tEXT4_INODES_PER_GROUP(sb);\n\t}\n\n\text4_handle_dirty_metadata(handle, NULL, sbi->s_sbh);\n\tsb->s_dirt = 1;\n\nexit_journal:\n\tunlock_super(sb);\n\tif ((err2 = ext4_journal_stop(handle)) && !err)\n\t\terr = err2;\n\tif (!err) {\n\t\tupdate_backups(sb, sbi->s_sbh->b_blocknr, (char *)es,\n\t\t\t sizeof(struct ext4_super_block));\n\t\tupdate_backups(sb, primary->b_blocknr, primary->b_data,\n\t\t\t primary->b_size);\n\t}\nexit_put:\n\tiput(inode);\n\treturn err;\n} /* ext4_group_add */",
  24512. "target": 0,
  24513. "cwe": [
  24514. "CWE-20"
  24515. ],
  24516. "project": "linux-2.6",
  24517. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24518. "hash": 193067835456666808284941587516352105575,
  24519. "size": 226,
  24520. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24521. "dataset": "other",
  24522. "idx": 489876
  24523. },
  24524. {
  24525. "func": "static int setup_new_group_blocks(struct super_block *sb,\n\t\t\t\t struct ext4_new_group_data *input)\n{\n\tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n\text4_fsblk_t start = ext4_group_first_block_no(sb, input->group);\n\tint reserved_gdb = ext4_bg_has_super(sb, input->group) ?\n\t\tle16_to_cpu(sbi->s_es->s_reserved_gdt_blocks) : 0;\n\tunsigned long gdblocks = ext4_bg_num_gdb(sb, input->group);\n\tstruct buffer_head *bh;\n\thandle_t *handle;\n\text4_fsblk_t block;\n\text4_grpblk_t bit;\n\tint i;\n\tint err = 0, err2;\n\n\t/* This transaction may be extended/restarted along the way */\n\thandle = ext4_journal_start_sb(sb, EXT4_MAX_TRANS_DATA);\n\n\tif (IS_ERR(handle))\n\t\treturn PTR_ERR(handle);\n\n\tlock_super(sb);\n\tif (input->group != sbi->s_groups_count) {\n\t\terr = -EBUSY;\n\t\tgoto exit_journal;\n\t}\n\n\tif (IS_ERR(bh = bclean(handle, sb, input->block_bitmap))) {\n\t\terr = PTR_ERR(bh);\n\t\tgoto exit_journal;\n\t}\n\n\tif (ext4_bg_has_super(sb, input->group)) {\n\t\text4_debug(\"mark backup superblock %#04llx (+0)\\n\", start);\n\t\text4_set_bit(0, bh->b_data);\n\t}\n\n\t/* Copy all of the GDT blocks into the backup in this group */\n\tfor (i = 0, bit = 1, block = start + 1;\n\t i < gdblocks; i++, block++, bit++) {\n\t\tstruct buffer_head *gdb;\n\n\t\text4_debug(\"update backup group %#04llx (+%d)\\n\", block, bit);\n\n\t\tif ((err = extend_or_restart_transaction(handle, 1, bh)))\n\t\t\tgoto exit_bh;\n\n\t\tgdb = sb_getblk(sb, block);\n\t\tif (!gdb) {\n\t\t\terr = -EIO;\n\t\t\tgoto exit_bh;\n\t\t}\n\t\tif ((err = ext4_journal_get_write_access(handle, gdb))) {\n\t\t\tbrelse(gdb);\n\t\t\tgoto exit_bh;\n\t\t}\n\t\tlock_buffer(gdb);\n\t\tmemcpy(gdb->b_data, sbi->s_group_desc[i]->b_data, gdb->b_size);\n\t\tset_buffer_uptodate(gdb);\n\t\tunlock_buffer(gdb);\n\t\text4_handle_dirty_metadata(handle, NULL, gdb);\n\t\text4_set_bit(bit, bh->b_data);\n\t\tbrelse(gdb);\n\t}\n\n\t/* Zero out all of the reserved backup group descriptor table blocks */\n\tfor (i = 0, bit = gdblocks + 1, block = start + bit;\n\t i < reserved_gdb; i++, block++, bit++) {\n\t\tstruct buffer_head *gdb;\n\n\t\text4_debug(\"clear reserved block %#04llx (+%d)\\n\", block, bit);\n\n\t\tif ((err = extend_or_restart_transaction(handle, 1, bh)))\n\t\t\tgoto exit_bh;\n\n\t\tif (IS_ERR(gdb = bclean(handle, sb, block))) {\n\t\t\terr = PTR_ERR(bh);\n\t\t\tgoto exit_bh;\n\t\t}\n\t\text4_handle_dirty_metadata(handle, NULL, gdb);\n\t\text4_set_bit(bit, bh->b_data);\n\t\tbrelse(gdb);\n\t}\n\text4_debug(\"mark block bitmap %#04llx (+%llu)\\n\", input->block_bitmap,\n\t\t input->block_bitmap - start);\n\text4_set_bit(input->block_bitmap - start, bh->b_data);\n\text4_debug(\"mark inode bitmap %#04llx (+%llu)\\n\", input->inode_bitmap,\n\t\t input->inode_bitmap - start);\n\text4_set_bit(input->inode_bitmap - start, bh->b_data);\n\n\t/* Zero out all of the inode table blocks */\n\tfor (i = 0, block = input->inode_table, bit = block - start;\n\t i < sbi->s_itb_per_group; i++, bit++, block++) {\n\t\tstruct buffer_head *it;\n\n\t\text4_debug(\"clear inode block %#04llx (+%d)\\n\", block, bit);\n\n\t\tif ((err = extend_or_restart_transaction(handle, 1, bh)))\n\t\t\tgoto exit_bh;\n\n\t\tif (IS_ERR(it = bclean(handle, sb, block))) {\n\t\t\terr = PTR_ERR(it);\n\t\t\tgoto exit_bh;\n\t\t}\n\t\text4_handle_dirty_metadata(handle, NULL, it);\n\t\tbrelse(it);\n\t\text4_set_bit(bit, bh->b_data);\n\t}\n\n\tif ((err = extend_or_restart_transaction(handle, 2, bh)))\n\t\tgoto exit_bh;\n\n\tmark_bitmap_end(input->blocks_count, sb->s_blocksize * 8, bh->b_data);\n\text4_handle_dirty_metadata(handle, NULL, bh);\n\tbrelse(bh);\n\t/* Mark unused entries in inode bitmap used */\n\text4_debug(\"clear inode bitmap %#04llx (+%llu)\\n\",\n\t\t input->inode_bitmap, input->inode_bitmap - start);\n\tif (IS_ERR(bh = bclean(handle, sb, input->inode_bitmap))) {\n\t\terr = PTR_ERR(bh);\n\t\tgoto exit_journal;\n\t}\n\n\tmark_bitmap_end(EXT4_INODES_PER_GROUP(sb), sb->s_blocksize * 8,\n\t\t\tbh->b_data);\n\text4_handle_dirty_metadata(handle, NULL, bh);\nexit_bh:\n\tbrelse(bh);\n\nexit_journal:\n\tunlock_super(sb);\n\tif ((err2 = ext4_journal_stop(handle)) && !err)\n\t\terr = err2;\n\n\treturn err;\n}",
  24526. "target": 0,
  24527. "cwe": [
  24528. "CWE-20"
  24529. ],
  24530. "project": "linux-2.6",
  24531. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24532. "hash": 270094313103328522278874993323389670020,
  24533. "size": 136,
  24534. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24535. "dataset": "other",
  24536. "idx": 489884
  24537. },
  24538. {
  24539. "func": "static void update_backups(struct super_block *sb,\n\t\t\t int blk_off, char *data, int size)\n{\n\tstruct ext4_sb_info *sbi = EXT4_SB(sb);\n\tconst ext4_group_t last = sbi->s_groups_count;\n\tconst int bpg = EXT4_BLOCKS_PER_GROUP(sb);\n\tunsigned three = 1;\n\tunsigned five = 5;\n\tunsigned seven = 7;\n\text4_group_t group;\n\tint rest = sb->s_blocksize - size;\n\thandle_t *handle;\n\tint err = 0, err2;\n\n\thandle = ext4_journal_start_sb(sb, EXT4_MAX_TRANS_DATA);\n\tif (IS_ERR(handle)) {\n\t\tgroup = 1;\n\t\terr = PTR_ERR(handle);\n\t\tgoto exit_err;\n\t}\n\n\twhile ((group = ext4_list_backups(sb, &three, &five, &seven)) < last) {\n\t\tstruct buffer_head *bh;\n\n\t\t/* Out of journal space, and can't get more - abort - so sad */\n\t\tif (ext4_handle_valid(handle) &&\n\t\t handle->h_buffer_credits == 0 &&\n\t\t ext4_journal_extend(handle, EXT4_MAX_TRANS_DATA) &&\n\t\t (err = ext4_journal_restart(handle, EXT4_MAX_TRANS_DATA)))\n\t\t\tbreak;\n\n\t\tbh = sb_getblk(sb, group * bpg + blk_off);\n\t\tif (!bh) {\n\t\t\terr = -EIO;\n\t\t\tbreak;\n\t\t}\n\t\text4_debug(\"update metadata backup %#04lx\\n\",\n\t\t\t (unsigned long)bh->b_blocknr);\n\t\tif ((err = ext4_journal_get_write_access(handle, bh)))\n\t\t\tbreak;\n\t\tlock_buffer(bh);\n\t\tmemcpy(bh->b_data, data, size);\n\t\tif (rest)\n\t\t\tmemset(bh->b_data + size, 0, rest);\n\t\tset_buffer_uptodate(bh);\n\t\tunlock_buffer(bh);\n\t\text4_handle_dirty_metadata(handle, NULL, bh);\n\t\tbrelse(bh);\n\t}\n\tif ((err2 = ext4_journal_stop(handle)) && !err)\n\t\terr = err2;\n\n\t/*\n\t * Ugh! Need to have e2fsck write the backup copies. It is too\n\t * late to revert the resize, we shouldn't fail just because of\n\t * the backup copies (they are only needed in case of corruption).\n\t *\n\t * However, if we got here we have a journal problem too, so we\n\t * can't really start a transaction to mark the superblock.\n\t * Chicken out and just set the flag on the hope it will be written\n\t * to disk, and if not - we will simply wait until next fsck.\n\t */\nexit_err:\n\tif (err) {\n\t\text4_warning(sb, __func__,\n\t\t\t \"can't update backup for group %u (err %d), \"\n\t\t\t \"forcing fsck on next reboot\", group, err);\n\t\tsbi->s_mount_state &= ~EXT4_VALID_FS;\n\t\tsbi->s_es->s_state &= cpu_to_le16(~EXT4_VALID_FS);\n\t\tmark_buffer_dirty(sbi->s_sbh);\n\t}\n}",
  24540. "target": 0,
  24541. "cwe": [
  24542. "CWE-20"
  24543. ],
  24544. "project": "linux-2.6",
  24545. "commit_id": "fdff73f094e7220602cc3f8959c7230517976412",
  24546. "hash": 44020648151160495114819576471010928671,
  24547. "size": 72,
  24548. "message": "ext4: Initialize the new group descriptor when resizing the filesystem\n\nMake sure all of the fields of the group descriptor are properly\ninitialized. Previously, we allowed bg_flags field to be contain\nrandom garbage, which could trigger non-deterministic behavior,\nincluding a kernel OOPS.\n\nhttp://bugzilla.kernel.org/show_bug.cgi?id=12433\n\nSigned-off-by: \"Theodore Ts'o\" <tytso@mit.edu>\nCc: stable@kernel.org",
  24549. "dataset": "other",
  24550. "idx": 489877
  24551. }
  24552. ]
  24553. },
  24554. {
  24555. "call_depth": 4,
  24556. "longest_call_chain": [
  24557. "ReadAnimatedWEBPImage",
  24558. "ReadSingleWEBPImage",
  24559. "IsWEBPImageLossless",
  24560. "ReadWebPLSBWord"
  24561. ],
  24562. "group_size": 6,
  24563. "functions": [
  24564. {
  24565. "func": "static int ReadAnimatedWEBPImage(const ImageInfo *image_info,Image *image,\n uint8_t *stream,size_t length,WebPDecoderConfig *configure,\n ExceptionInfo *exception)\n{\n Image\n *original_image;\n\n int\n image_count,\n webp_status;\n\n size_t\n canvas_width,\n canvas_height;\n\n WebPData\n data;\n\n WebPDemuxer\n *demux;\n\n WebPIterator\n iter;\n\n image_count=0;\n webp_status=0;\n original_image=image;\n webp_status=FillBasicWEBPInfo(image,stream,length,configure);\n canvas_width=image->columns;\n canvas_height=image->rows;\n data.bytes=stream;\n data.size=length;\n {\n WebPMux\n *mux;\n\n WebPMuxAnimParams\n params;\n\n WebPMuxError\n status;\n\n mux=WebPMuxCreate(&data,0);\n status=WebPMuxGetAnimationParams(mux,&params);\n if (status >= 0)\n image->iterations=params.loop_count;\n WebPMuxDelete(mux);\n }\n demux=WebPDemux(&data);\n if (WebPDemuxGetFrame(demux,1,&iter)) {\n do {\n if (image_count != 0)\n {\n AcquireNextImage(image_info,image);\n if (GetNextImageInList(image) == (Image *) NULL)\n break;\n image=SyncNextImageInList(image);\n CloneImageProperties(image, original_image);\n image->page.x=iter.x_offset;\n image->page.y=iter.y_offset;\n webp_status=ReadSingleWEBPImage(image,iter.fragment.bytes,\n iter.fragment.size,configure,exception,MagickFalse);\n }\n else\n {\n image->page.x=iter.x_offset;\n image->page.y=iter.y_offset;\n webp_status=ReadSingleWEBPImage(image,iter.fragment.bytes,\n iter.fragment.size,configure,exception,MagickTrue);\n }\n if (webp_status != VP8_STATUS_OK)\n break;\n\n image->page.width=canvas_width;\n image->page.height=canvas_height;\n image->ticks_per_second=100;\n image->delay=iter.duration/10;\n image->dispose=NoneDispose;\n if (iter.dispose_method == WEBP_MUX_DISPOSE_BACKGROUND)\n image->dispose=BackgroundDispose;\n image_count++;\n } while (WebPDemuxNextFrame(&iter));\n WebPDemuxReleaseIterator(&iter);\n }\n WebPDemuxDelete(demux);\n return(webp_status);\n}",
  24566. "project": "ImageMagick6",
  24567. "hash": 289808360935285124131109024761867440086,
  24568. "size": 87,
  24569. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  24570. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  24571. "target": 0,
  24572. "dataset": "other",
  24573. "idx": 370810
  24574. },
  24575. {
  24576. "func": "static int ReadSingleWEBPImage(Image *image,const uint8_t *stream,\n size_t length,WebPDecoderConfig *configure,ExceptionInfo *exception,\n MagickBooleanType is_first)\n{\n int\n webp_status;\n\n unsigned char\n *p;\n\n size_t\n canvas_width,\n canvas_height,\n image_width,\n image_height;\n\n ssize_t\n x_offset,\n y_offset,\n y;\n\n WebPDecBuffer\n *magick_restrict webp_image = &configure->output;\n\n MagickBooleanType\n status;\n\n if (is_first)\n {\n canvas_width=image->columns;\n canvas_height=image->rows;\n x_offset=image->page.x;\n y_offset=image->page.y;\n image->page.x=0;\n image->page.y=0;\n }\n else\n {\n x_offset=0;\n y_offset=0;\n }\n webp_status=FillBasicWEBPInfo(image,stream,length,configure);\n image_width=image->columns;\n image_height=image->rows;\n if (is_first)\n {\n image->columns=canvas_width;\n image->rows=canvas_height;\n }\n\n if (webp_status != VP8_STATUS_OK)\n return(webp_status);\n\n if (IsWEBPImageLossless(stream,length) != MagickFalse)\n image->quality=100;\n\n webp_status=WebPDecode(stream,length,configure);\n if (webp_status != VP8_STATUS_OK)\n return(webp_status);\n\n p=(unsigned char *) webp_image->u.RGBA.rgba;\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n PixelPacket\n *q;\n\n ssize_t\n x;\n\n q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);\n if (q == (PixelPacket *) NULL)\n break;\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n if ((x >= x_offset && x < (ssize_t) (x_offset+image_width)) &&\n (y >= y_offset && y < (ssize_t) (y_offset+image_height)))\n {\n SetPixelRed(q,ScaleCharToQuantum(*p++));\n SetPixelGreen(q,ScaleCharToQuantum(*p++));\n SetPixelBlue(q,ScaleCharToQuantum(*p++));\n SetPixelAlpha(q,ScaleCharToQuantum(*p++));\n }\n else\n {\n SetPixelRed(q,0);\n SetPixelGreen(q,0);\n SetPixelBlue(q,0);\n SetPixelAlpha(q,0);\n }\n q++;\n }\n if (SyncAuthenticPixels(image,exception) == MagickFalse)\n break;\n status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,\n image->rows);\n if (status == MagickFalse)\n break;\n }\n WebPFreeDecBuffer(webp_image);\n#if defined(MAGICKCORE_WEBPMUX_DELEGATE)\n {\n StringInfo\n *profile;\n\n uint32_t\n webp_flags = 0;\n\n WebPData\n chunk,\n content;\n\n WebPMux\n *mux;\n\n /*\n Extract any profiles:\n https://developers.google.com/speed/webp/docs/container-api.\n */\n content.bytes=stream;\n content.size=length;\n mux=WebPMuxCreate(&content,0);\n (void) memset(&chunk,0,sizeof(chunk));\n WebPMuxGetFeatures(mux,&webp_flags);\n if (webp_flags & ICCP_FLAG)\n {\n WebPMuxGetChunk(mux,\"ICCP\",&chunk);\n profile=BlobToStringInfo(chunk.bytes,chunk.size);\n if (profile != (StringInfo *) NULL)\n {\n SetImageProfile(image,\"ICC\",profile);\n profile=DestroyStringInfo(profile);\n }\n }\n if (webp_flags & EXIF_FLAG)\n {\n WebPMuxGetChunk(mux,\"EXIF\",&chunk);\n profile=BlobToStringInfo(chunk.bytes,chunk.size);\n if (profile != (StringInfo *) NULL)\n {\n SetImageProfile(image,\"EXIF\",profile);\n profile=DestroyStringInfo(profile);\n }\n }\n if (webp_flags & XMP_FLAG)\n {\n WebPMuxGetChunk(mux,\"XMP\",&chunk);\n profile=BlobToStringInfo(chunk.bytes,chunk.size);\n if (profile != (StringInfo *) NULL)\n {\n SetImageProfile(image,\"XMP\",profile);\n profile=DestroyStringInfo(profile);\n }\n }\n WebPMuxDelete(mux);\n }\n#endif\n return(webp_status);\n}",
  24577. "project": "ImageMagick6",
  24578. "hash": 12820978203361235442107047469631362612,
  24579. "size": 158,
  24580. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  24581. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  24582. "target": 0,
  24583. "dataset": "other",
  24584. "idx": 370819
  24585. },
  24586. {
  24587. "func": "static MagickBooleanType IsWEBPImageLossless(const unsigned char *stream,\n const size_t length)\n{\n#define VP8_CHUNK_INDEX 15\n#define LOSSLESS_FLAG 'L'\n#define EXTENDED_HEADER 'X'\n#define VP8_CHUNK_HEADER \"VP8\"\n#define VP8_CHUNK_HEADER_SIZE 3\n#define RIFF_HEADER_SIZE 12\n#define VP8X_CHUNK_SIZE 10\n#define TAG_SIZE 4\n#define CHUNK_SIZE_BYTES 4\n#define CHUNK_HEADER_SIZE 8\n#define MAX_CHUNK_PAYLOAD (~0U-CHUNK_HEADER_SIZE-1)\n\n size_t\n offset;\n\n /*\n Read simple header.\n */\n if (length <= VP8_CHUNK_INDEX)\n return(MagickFalse);\n if (stream[VP8_CHUNK_INDEX] != EXTENDED_HEADER)\n return(stream[VP8_CHUNK_INDEX] == LOSSLESS_FLAG ? MagickTrue : MagickFalse);\n /*\n Read extended header.\n */\n offset=RIFF_HEADER_SIZE+TAG_SIZE+CHUNK_SIZE_BYTES+VP8X_CHUNK_SIZE;\n while (offset <= (length-TAG_SIZE-TAG_SIZE-4))\n {\n uint32_t\n chunk_size,\n chunk_size_pad;\n\n chunk_size=ReadWebPLSBWord(stream+offset+TAG_SIZE);\n if (chunk_size > MAX_CHUNK_PAYLOAD)\n break;\n chunk_size_pad=(CHUNK_HEADER_SIZE+chunk_size+1) & ~1;\n if (memcmp(stream+offset,VP8_CHUNK_HEADER,VP8_CHUNK_HEADER_SIZE) == 0)\n return(*(stream+offset+VP8_CHUNK_HEADER_SIZE) == LOSSLESS_FLAG ?\n MagickTrue : MagickFalse);\n offset+=chunk_size_pad;\n }\n return(MagickFalse);\n}",
  24588. "project": "ImageMagick6",
  24589. "hash": 249079409081482155472943587192510982574,
  24590. "size": 46,
  24591. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  24592. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  24593. "target": 0,
  24594. "dataset": "other",
  24595. "idx": 370807
  24596. },
  24597. {
  24598. "func": "static inline uint32_t ReadWebPLSBWord(\n const unsigned char *magick_restrict data)\n{\n const unsigned char\n *p;\n\n uint32_t\n value;\n\n p=data;\n value=(uint32_t) (*p++);\n value|=((uint32_t) (*p++)) << 8;\n value|=((uint32_t) (*p++)) << 16;\n value|=((uint32_t) (*p++)) << 24;\n return(value);\n}",
  24599. "project": "ImageMagick6",
  24600. "hash": 129894979533153289444697853065786467565,
  24601. "size": 16,
  24602. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  24603. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  24604. "target": 0,
  24605. "dataset": "other",
  24606. "idx": 370812
  24607. },
  24608. {
  24609. "func": "static int FillBasicWEBPInfo(Image *image,const uint8_t *stream,size_t length,\n WebPDecoderConfig *configure)\n{\n WebPBitstreamFeatures\n *magick_restrict features = &configure->input;\n\n int\n webp_status;\n\n webp_status=WebPGetFeatures(stream,length,features);\n\n if (webp_status != VP8_STATUS_OK)\n return(webp_status);\n\n image->columns=(size_t) features->width;\n image->rows=(size_t) features->height;\n image->depth=8;\n image->matte=features->has_alpha != 0 ? MagickTrue : MagickFalse;\n\n return(webp_status);\n}",
  24610. "project": "ImageMagick6",
  24611. "hash": 88954484969752509702488546595380577529,
  24612. "size": 21,
  24613. "commit_id": "a78d92dc0f468e79c3d761aae9707042952cdaca",
  24614. "message": "https://github.com/ImageMagick/ImageMagick/issues/3176",
  24615. "target": 0,
  24616. "dataset": "other",
  24617. "idx": 370815
  24618. },
  24619. {
  24620. "func": "MagickExport void AcquireNextImage(const ImageInfo *image_info,Image *image)\n{\n /*\n Allocate image structure.\n */\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n image->next=AcquireImage(image_info);\n if (GetNextImageInList(image) == (Image *) NULL)\n return;\n (void) CopyMagickString(GetNextImageInList(image)->filename,image->filename,\n MaxTextExtent);\n if (image_info != (ImageInfo *) NULL)\n (void) CopyMagickString(GetNextImageInList(image)->filename,\n image_info->filename,MaxTextExtent);\n DestroyBlob(GetNextImageInList(image));\n image->next->blob=ReferenceBlob(image->blob);\n image->next->endian=image->endian;\n image->next->scene=image->scene+1;\n image->next->previous=image;\n}",
  24621. "project": "ImageMagick6",
  24622. "hash": 93917763940631088934569245499727034858,
  24623. "size": 23,
  24624. "commit_id": "27b1c74979ac473a430e266ff6c4b645664bc805",
  24625. "message": "https://github.com/ImageMagick/ImageMagick/issues/1522",
  24626. "target": 0,
  24627. "dataset": "other",
  24628. "idx": 438543
  24629. }
  24630. ]
  24631. },
  24632. {
  24633. "call_depth": 3,
  24634. "longest_call_chain": [
  24635. "ofpact_init",
  24636. "ofpact_put",
  24637. "ofpbuf_pull"
  24638. ],
  24639. "group_size": 4,
  24640. "functions": [
  24641. {
  24642. "func": "parse_CLONE(char *arg, const struct ofpact_parse_params *pp)\n{\n const size_t clone_offset = ofpacts_pull(pp->ofpacts);\n struct ofpact_nest *clone = ofpact_put_CLONE(pp->ofpacts);\n char *error;\n\n ofpbuf_pull(pp->ofpacts, sizeof *clone);\n error = ofpacts_parse_copy(arg, pp, false, 0);\n /* header points to the action list */\n pp->ofpacts->header = ofpbuf_push_uninit(pp->ofpacts, sizeof *clone);\n clone = pp->ofpacts->header;\n\n ofpact_finish_CLONE(pp->ofpacts, &clone);\n ofpbuf_push_uninit(pp->ofpacts, clone_offset);\n return error;\n}",
  24643. "project": "ovs",
  24644. "hash": 268068110960223550029143298353990801116,
  24645. "size": 16,
  24646. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  24647. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  24648. "target": 0,
  24649. "dataset": "other",
  24650. "idx": 280637
  24651. },
  24652. {
  24653. "func": "ofpacts_pull(struct ofpbuf *ofpacts)\n{\n size_t ofs;\n\n ofs = ofpacts->size;\n ofpbuf_pull(ofpacts, ofs);\n\n return ofs;\n}",
  24654. "project": "ovs",
  24655. "hash": 241149981455944836988584478388982093886,
  24656. "size": 9,
  24657. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  24658. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  24659. "target": 0,
  24660. "dataset": "other",
  24661. "idx": 280855
  24662. },
  24663. {
  24664. "func": "parse_WRITE_ACTIONS(char *arg, const struct ofpact_parse_params *pp)\n{\n size_t ofs = ofpacts_pull(pp->ofpacts);\n struct ofpact_nest *on;\n char *error;\n\n /* Add a Write-Actions instruction and then pull it off. */\n ofpact_put(pp->ofpacts, OFPACT_WRITE_ACTIONS, sizeof *on);\n ofpbuf_pull(pp->ofpacts, sizeof *on);\n\n /* Parse nested actions.\n *\n * We pulled off \"write-actions\" and the previous actions because the\n * OFPACT_WRITE_ACTIONS is only partially constructed: its length is such\n * that it doesn't actually include the nested actions. That means that\n * ofpacts_parse() would reject them as being part of an Apply-Actions that\n * follows a Write-Actions, which is an invalid order. */\n error = ofpacts_parse(arg, pp, false, OFPACT_WRITE_ACTIONS);\n\n /* Put the Write-Actions back on and update its length. */\n on = ofpbuf_push_uninit(pp->ofpacts, sizeof *on);\n on->ofpact.len = pp->ofpacts->size;\n\n /* Put any previous actions or instructions back on. */\n ofpbuf_push_uninit(pp->ofpacts, ofs);\n\n return error;\n}",
  24665. "project": "ovs",
  24666. "hash": 53314483554877060462350565047020467635,
  24667. "size": 28,
  24668. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  24669. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  24670. "target": 0,
  24671. "dataset": "other",
  24672. "idx": 280498
  24673. },
  24674. {
  24675. "func": "ofpact_put(struct ofpbuf *ofpacts, enum ofpact_type type, size_t len)\n{\n struct ofpact *ofpact;\n\n ofpacts->header = ofpbuf_put_uninit(ofpacts, len);\n ofpact = ofpacts->header;\n ofpact_init(ofpact, type, len);\n return ofpact;\n}",
  24676. "project": "ovs",
  24677. "hash": 65309848014828324768184622354818925175,
  24678. "size": 9,
  24679. "commit_id": "65c61b0c23a0d474696d7b1cea522a5016a8aeb3",
  24680. "message": "ofp-actions: Fix use-after-free while decoding RAW_ENCAP.\n\nWhile decoding RAW_ENCAP action, decode_ed_prop() might re-allocate\nofpbuf if there is no enough space left. However, function\n'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'\nstructure leading to write-after-free and incorrect decoding.\n\n ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address\n 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408\n WRITE of size 2 at 0x60600000011a thread T0\n #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20\n #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16\n #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21\n #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13\n #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12\n #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17\n #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13\n #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16\n #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21\n #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28\n #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9\n #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17\n #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5\n #13 0x5391ae in main utilities/ovs-ofctl.c:179:9\n #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)\n #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)\n\nFix that by getting a new pointer before using.\n\nCredit to OSS-Fuzz.\n\nFuzzer regression test will fail only with AddressSanitizer enabled.\n\nReported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851\nFixes: f839892a206a (\"OF support and translation of generic encap and decap\")\nAcked-by: William Tu <u9012063@gmail.com>\nSigned-off-by: Ilya Maximets <i.maximets@ovn.org>",
  24681. "target": 0,
  24682. "dataset": "other",
  24683. "idx": 280495
  24684. }
  24685. ]
  24686. },
  24687. {
  24688. "call_depth": 4,
  24689. "longest_call_chain": [
  24690. "uv__idna_toascii",
  24691. "uv__idna_toascii_label",
  24692. "uv__utf8_decode1",
  24693. "uv__utf8_decode1_slow"
  24694. ],
  24695. "group_size": 5,
  24696. "functions": [
  24697. {
  24698. "func": "unsigned uv__utf8_decode1(const char** p, const char* pe) {\n unsigned a;\n\n assert(*p < pe);\n\n a = (unsigned char) *(*p)++;\n\n if (a < 128)\n return a; /* ASCII, common case. */\n\n return uv__utf8_decode1_slow(p, pe, a);\n}",
  24699. "project": "libuv",
  24700. "hash": 260002193897560539801354049804924733762,
  24701. "size": 12,
  24702. "commit_id": "b7466e31e4bee160d82a68fca11b1f61d46debae",
  24703. "message": "idna: fix OOB read in punycode decoder\n\nlibuv was vulnerable to out-of-bounds reads in the uv__idna_toascii()\nfunction which is used to convert strings to ASCII. This is called by\nthe DNS resolution function and can lead to information disclosures or\ncrashes.\n\nReported by Eric Sesterhenn in collaboration with Cure53 and ExpressVPN.\n\nReported-By: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>\nFixes: https://github.com/libuv/libuv/issues/3147\nPR-URL: https://github.com/libuv/libuv-private/pull/1\nRefs: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22918\nReviewed-By: Colin Ihrig <cjihrig@gmail.com>\nReviewed-By: Richard Lau <riclau@uk.ibm.com>",
  24704. "target": 0,
  24705. "dataset": "other",
  24706. "idx": 326147
  24707. },
  24708. {
  24709. "func": "static unsigned uv__utf8_decode1_slow(const char** p,\n const char* pe,\n unsigned a) {\n unsigned b;\n unsigned c;\n unsigned d;\n unsigned min;\n\n if (a > 0xF7)\n return -1;\n\n switch (pe - *p) {\n default:\n if (a > 0xEF) {\n min = 0x10000;\n a = a & 7;\n b = (unsigned char) *(*p)++;\n c = (unsigned char) *(*p)++;\n d = (unsigned char) *(*p)++;\n break;\n }\n /* Fall through. */\n case 2:\n if (a > 0xDF) {\n min = 0x800;\n b = 0x80 | (a & 15);\n c = (unsigned char) *(*p)++;\n d = (unsigned char) *(*p)++;\n a = 0;\n break;\n }\n /* Fall through. */\n case 1:\n if (a > 0xBF) {\n min = 0x80;\n b = 0x80;\n c = 0x80 | (a & 31);\n d = (unsigned char) *(*p)++;\n a = 0;\n break;\n }\n /* Fall through. */\n case 0:\n return -1; /* Invalid continuation byte. */\n }\n\n if (0x80 != (0xC0 & (b ^ c ^ d)))\n return -1; /* Invalid sequence. */\n\n b &= 63;\n c &= 63;\n d &= 63;\n a = (a << 18) | (b << 12) | (c << 6) | d;\n\n if (a < min)\n return -1; /* Overlong sequence. */\n\n if (a > 0x10FFFF)\n return -1; /* Four-byte sequence > U+10FFFF. */\n\n if (a >= 0xD800 && a <= 0xDFFF)\n return -1; /* Surrogate pair. */\n\n return a;\n}",
  24710. "project": "libuv",
  24711. "hash": 72519685169788066819829832758156410439,
  24712. "size": 65,
  24713. "commit_id": "b7466e31e4bee160d82a68fca11b1f61d46debae",
  24714. "message": "idna: fix OOB read in punycode decoder\n\nlibuv was vulnerable to out-of-bounds reads in the uv__idna_toascii()\nfunction which is used to convert strings to ASCII. This is called by\nthe DNS resolution function and can lead to information disclosures or\ncrashes.\n\nReported by Eric Sesterhenn in collaboration with Cure53 and ExpressVPN.\n\nReported-By: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>\nFixes: https://github.com/libuv/libuv/issues/3147\nPR-URL: https://github.com/libuv/libuv-private/pull/1\nRefs: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22918\nReviewed-By: Colin Ihrig <cjihrig@gmail.com>\nReviewed-By: Richard Lau <riclau@uk.ibm.com>",
  24715. "target": 0,
  24716. "dataset": "other",
  24717. "idx": 326144
  24718. },
  24719. {
  24720. "func": "long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {\n const char* si;\n const char* st;\n unsigned c;\n char* ds;\n int rc;\n\n ds = d;\n\n for (si = s; si < se; /* empty */) {\n st = si;\n c = uv__utf8_decode1(&si, se);\n\n if (c != '.')\n if (c != 0x3002) /* 。 */\n if (c != 0xFF0E) /* . */\n if (c != 0xFF61) /* 。 */\n continue;\n\n rc = uv__idna_toascii_label(s, st, &d, de);\n\n if (rc < 0)\n return rc;\n\n if (d < de)\n *d++ = '.';\n\n s = si;\n }\n\n if (s < se) {\n rc = uv__idna_toascii_label(s, se, &d, de);\n\n if (rc < 0)\n return rc;\n }\n\n if (d < de)\n *d++ = '\\0';\n\n return d - ds; /* Number of bytes written. */\n}",
  24721. "project": "libuv",
  24722. "hash": 330726136045724320865601654107082283716,
  24723. "size": 42,
  24724. "commit_id": "b7466e31e4bee160d82a68fca11b1f61d46debae",
  24725. "message": "idna: fix OOB read in punycode decoder\n\nlibuv was vulnerable to out-of-bounds reads in the uv__idna_toascii()\nfunction which is used to convert strings to ASCII. This is called by\nthe DNS resolution function and can lead to information disclosures or\ncrashes.\n\nReported by Eric Sesterhenn in collaboration with Cure53 and ExpressVPN.\n\nReported-By: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>\nFixes: https://github.com/libuv/libuv/issues/3147\nPR-URL: https://github.com/libuv/libuv-private/pull/1\nRefs: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22918\nReviewed-By: Colin Ihrig <cjihrig@gmail.com>\nReviewed-By: Richard Lau <riclau@uk.ibm.com>",
  24726. "target": 1,
  24727. "dataset": "other",
  24728. "idx": 201892
  24729. },
  24730. {
  24731. "func": "long uv__idna_toascii(const char* s, const char* se, char* d, char* de) {\n const char* si;\n const char* st;\n unsigned c;\n char* ds;\n int rc;\n\n ds = d;\n\n si = s;\n while (si < se) {\n st = si;\n c = uv__utf8_decode1(&si, se);\n\n if (c == -1u)\n return UV_EINVAL;\n\n if (c != '.')\n if (c != 0x3002) /* 。 */\n if (c != 0xFF0E) /* . */\n if (c != 0xFF61) /* 。 */\n continue;\n\n rc = uv__idna_toascii_label(s, st, &d, de);\n\n if (rc < 0)\n return rc;\n\n if (d < de)\n *d++ = '.';\n\n s = si;\n }\n\n if (s < se) {\n rc = uv__idna_toascii_label(s, se, &d, de);\n\n if (rc < 0)\n return rc;\n }\n\n if (d < de)\n *d++ = '\\0';\n\n return d - ds; /* Number of bytes written. */\n}",
  24732. "project": "libuv",
  24733. "hash": 143364374050282701014374410463146753253,
  24734. "size": 46,
  24735. "commit_id": "b7466e31e4bee160d82a68fca11b1f61d46debae",
  24736. "message": "idna: fix OOB read in punycode decoder\n\nlibuv was vulnerable to out-of-bounds reads in the uv__idna_toascii()\nfunction which is used to convert strings to ASCII. This is called by\nthe DNS resolution function and can lead to information disclosures or\ncrashes.\n\nReported by Eric Sesterhenn in collaboration with Cure53 and ExpressVPN.\n\nReported-By: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>\nFixes: https://github.com/libuv/libuv/issues/3147\nPR-URL: https://github.com/libuv/libuv-private/pull/1\nRefs: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22918\nReviewed-By: Colin Ihrig <cjihrig@gmail.com>\nReviewed-By: Richard Lau <riclau@uk.ibm.com>",
  24737. "target": 0,
  24738. "dataset": "other",
  24739. "idx": 326145
  24740. },
  24741. {
  24742. "func": "static int uv__idna_toascii_label(const char* s, const char* se,\n char** d, char* de) {\n static const char alphabet[] = \"abcdefghijklmnopqrstuvwxyz0123456789\";\n const char* ss;\n unsigned c;\n unsigned h;\n unsigned k;\n unsigned n;\n unsigned m;\n unsigned q;\n unsigned t;\n unsigned x;\n unsigned y;\n unsigned bias;\n unsigned delta;\n unsigned todo;\n int first;\n\n h = 0;\n ss = s;\n todo = 0;\n\n /* Note: after this loop we've visited all UTF-8 characters and know\n * they're legal so we no longer need to check for decode errors.\n */\n while (s < se) {\n c = uv__utf8_decode1(&s, se);\n\n if (c == -1u)\n return UV_EINVAL;\n\n if (c < 128)\n h++;\n else\n todo++;\n }\n\n /* Only write \"xn--\" when there are non-ASCII characters. */\n if (todo > 0) {\n if (*d < de) *(*d)++ = 'x';\n if (*d < de) *(*d)++ = 'n';\n if (*d < de) *(*d)++ = '-';\n if (*d < de) *(*d)++ = '-';\n }\n\n /* Write ASCII characters. */\n x = 0;\n s = ss;\n while (s < se) {\n c = uv__utf8_decode1(&s, se);\n assert(c != -1u);\n\n if (c > 127)\n continue;\n\n if (*d < de)\n *(*d)++ = c;\n\n if (++x == h)\n break; /* Visited all ASCII characters. */\n }\n\n if (todo == 0)\n return h;\n\n /* Only write separator when we've written ASCII characters first. */\n if (h > 0)\n if (*d < de)\n *(*d)++ = '-';\n\n n = 128;\n bias = 72;\n delta = 0;\n first = 1;\n\n while (todo > 0) {\n m = -1;\n s = ss;\n\n while (s < se) {\n c = uv__utf8_decode1(&s, se);\n assert(c != -1u);\n\n if (c >= n)\n if (c < m)\n m = c;\n }\n\n x = m - n;\n y = h + 1;\n\n if (x > ~delta / y)\n return UV_E2BIG; /* Overflow. */\n\n delta += x * y;\n n = m;\n\n s = ss;\n while (s < se) {\n c = uv__utf8_decode1(&s, se);\n assert(c != -1u);\n\n if (c < n)\n if (++delta == 0)\n return UV_E2BIG; /* Overflow. */\n\n if (c != n)\n continue;\n\n for (k = 36, q = delta; /* empty */; k += 36) {\n t = 1;\n\n if (k > bias)\n t = k - bias;\n\n if (t > 26)\n t = 26;\n\n if (q < t)\n break;\n\n /* TODO(bnoordhuis) Since 1 <= t <= 26 and therefore\n * 10 <= y <= 35, we can optimize the long division\n * into a table-based reciprocal multiplication.\n */\n x = q - t;\n y = 36 - t; /* 10 <= y <= 35 since 1 <= t <= 26. */\n q = x / y;\n t = t + x % y; /* 1 <= t <= 35 because of y. */\n\n if (*d < de)\n *(*d)++ = alphabet[t];\n }\n\n if (*d < de)\n *(*d)++ = alphabet[q];\n\n delta /= 2;\n\n if (first) {\n delta /= 350;\n first = 0;\n }\n\n /* No overflow check is needed because |delta| was just\n * divided by 2 and |delta+delta >= delta + delta/h|.\n */\n h++;\n delta += delta / h;\n\n for (bias = 0; delta > 35 * 26 / 2; bias += 36)\n delta /= 35;\n\n bias += 36 * delta / (delta + 38);\n delta = 0;\n todo--;\n }\n\n delta++;\n n++;\n }\n\n return 0;\n}",
  24743. "project": "libuv",
  24744. "hash": 310982531914031347427892235781871884660,
  24745. "size": 164,
  24746. "commit_id": "b7466e31e4bee160d82a68fca11b1f61d46debae",
  24747. "message": "idna: fix OOB read in punycode decoder\n\nlibuv was vulnerable to out-of-bounds reads in the uv__idna_toascii()\nfunction which is used to convert strings to ASCII. This is called by\nthe DNS resolution function and can lead to information disclosures or\ncrashes.\n\nReported by Eric Sesterhenn in collaboration with Cure53 and ExpressVPN.\n\nReported-By: Eric Sesterhenn <eric.sesterhenn@x41-dsec.de>\nFixes: https://github.com/libuv/libuv/issues/3147\nPR-URL: https://github.com/libuv/libuv-private/pull/1\nRefs: https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-22918\nReviewed-By: Colin Ihrig <cjihrig@gmail.com>\nReviewed-By: Richard Lau <riclau@uk.ibm.com>",
  24748. "target": 0,
  24749. "dataset": "other",
  24750. "idx": 326143
  24751. }
  24752. ]
  24753. },
  24754. {
  24755. "call_depth": 3,
  24756. "longest_call_chain": [
  24757. "flac_dmx_process",
  24758. "flac_dmx_check_pid",
  24759. "flac_dmx_check_dur"
  24760. ],
  24761. "group_size": 8,
  24762. "functions": [
  24763. {
  24764. "func": "static void flac_dmx_check_dur(GF_Filter *filter, GF_FLACDmxCtx *ctx)\n{\n\tu64 rate;\n\tFILE *stream;\n\tconst GF_PropertyValue *p;\n\tif (!ctx->opid || ctx->timescale || ctx->file_loaded) return;\n\n\tif (ctx->index<=0) {\n\t\tctx->file_loaded = GF_TRUE;\n\t\treturn;\n\t}\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_FILEPATH);\n\tif (!p || !p->value.string || !strncmp(p->value.string, \"gmem://\", 7)) {\n\t\tctx->is_file = GF_FALSE;\n\t\tctx->file_loaded = GF_TRUE;\n\t\treturn;\n\t}\n\tctx->is_file = GF_TRUE;\n\n\tstream = gf_fopen(p->value.string, \"rb\");\n\tif (!stream) return;\n\tgf_fseek(stream, 0, SEEK_END);\n\n\trate = gf_ftell(stream);\n\tgf_fclose(stream);\n\tif (ctx->duration.num && !gf_sys_is_test_mode() ) {\n\t\trate *= 8 * ctx->duration.den;\n\t\trate /= ctx->duration.num;\n\t\tctx->bitrate = (u32) rate;\n\t}\n\n\tp = gf_filter_pid_get_property(ctx->ipid, GF_PROP_PID_FILE_CACHED);\n\tif (p && p->value.boolean) ctx->file_loaded = GF_TRUE;\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_CAN_DATAREF, & PROP_BOOL(GF_TRUE ) );\n}",
  24765. "project": "gpac",
  24766. "hash": 304549050216772881525607651146853564021,
  24767. "size": 36,
  24768. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24769. "message": "fixed 1718",
  24770. "target": 0,
  24771. "dataset": "other",
  24772. "idx": 255790
  24773. },
  24774. {
  24775. "func": "static GFINLINE void flac_dmx_update_cts(GF_FLACDmxCtx *ctx, u32 nb_samp)\n{\n\tif (ctx->timescale) {\n\t\tu64 inc = nb_samp;\n\t\tinc *= ctx->timescale;\n\t\tinc /= ctx->sample_rate;\n\t\tctx->cts += inc;\n\t} else {\n\t\tctx->cts += nb_samp;\n\t}\n}",
  24776. "project": "gpac",
  24777. "hash": 258395584338445488219493502543517666020,
  24778. "size": 11,
  24779. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24780. "message": "fixed 1718",
  24781. "target": 0,
  24782. "dataset": "other",
  24783. "idx": 255792
  24784. },
  24785. {
  24786. "func": "GF_Err flac_dmx_process(GF_Filter *filter)\n{\n\tGF_FLACDmxCtx *ctx = gf_filter_get_udta(filter);\n\tGF_FilterPacket *pck, *dst_pck;\n\tu8 *output;\n\tu8 *start;\n\tBool final_flush=GF_FALSE;\n\tu32 pck_size, remain, prev_pck_size;\n\tu64 cts = GF_FILTER_NO_TS;\n\tFLACHeader hdr;\n\n\t//always reparse duration\n\tif (!ctx->duration.num)\n\t\tflac_dmx_check_dur(filter, ctx);\n\n\tif (ctx->opid && !ctx->is_playing)\n\t\treturn GF_OK;\n\n\tpck = gf_filter_pid_get_packet(ctx->ipid);\n\tif (!pck) {\n\t\tif (gf_filter_pid_is_eos(ctx->ipid)) {\n\t\t\tif (!ctx->flac_buffer_size) {\n\t\t\t\tif (ctx->opid)\n\t\t\t\t\tgf_filter_pid_set_eos(ctx->opid);\n\t\t\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\t\t\tctx->src_pck = NULL;\n\t\t\t\treturn GF_EOS;\n\t\t\t}\n\t\t\tfinal_flush = GF_TRUE;\n\t\t} else {\n\t\t\treturn GF_OK;\n\t\t}\n\t}\n\n\tprev_pck_size = ctx->flac_buffer_size;\n\tif (pck && !ctx->resume_from) {\n\t\tu8 *data = (u8 *) gf_filter_pck_get_data(pck, &pck_size);\n\n\t\tif (ctx->byte_offset != GF_FILTER_NO_BO) {\n\t\t\tu64 byte_offset = gf_filter_pck_get_byte_offset(pck);\n\t\t\tif (!ctx->flac_buffer_size) {\n\t\t\t\tctx->byte_offset = byte_offset;\n\t\t\t} else if (ctx->byte_offset + ctx->flac_buffer_size != byte_offset) {\n\t\t\t\tctx->byte_offset = GF_FILTER_NO_BO;\n\t\t\t\tif ((byte_offset != GF_FILTER_NO_BO) && (byte_offset>ctx->flac_buffer_size) ) {\n\t\t\t\t\tctx->byte_offset = byte_offset - ctx->flac_buffer_size;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (ctx->flac_buffer_size + pck_size > ctx->flac_buffer_alloc) {\n\t\t\tctx->flac_buffer_alloc = ctx->flac_buffer_size + pck_size;\n\t\t\tctx->flac_buffer = gf_realloc(ctx->flac_buffer, ctx->flac_buffer_alloc);\n\t\t}\n\t\tmemcpy(ctx->flac_buffer + ctx->flac_buffer_size, data, pck_size);\n\t\tctx->flac_buffer_size += pck_size;\n\t}\n\n\t//input pid sets some timescale - we flushed pending data , update cts\n\tif (ctx->timescale && pck) {\n\t\tcts = gf_filter_pck_get_cts(pck);\n\t}\n\n\tif (cts == GF_FILTER_NO_TS) {\n\t\t//avoids updating cts\n\t\tprev_pck_size = 0;\n\t}\n\n\tremain = ctx->flac_buffer_size;\n\tstart = ctx->flac_buffer;\n\n\tif (ctx->resume_from) {\n\t\tstart += ctx->resume_from - 1;\n\t\tremain -= ctx->resume_from - 1;\n\t\tctx->resume_from = 0;\n\t}\n\n\twhile (remain>2) {\n\t\tu32 next_frame=0, nb_samp;\n\t\tu32 cur_size = remain-2;\n\t\tu8 *cur_buf = start+2;\n\t\tu8 *hdr_start = NULL;\n\n\t\tif (final_flush) {\n\t\t\tnext_frame = remain;\n\t\t} else {\n\t\t\twhile (cur_size) {\n\t\t\t\t//wait till we have a frame header\n\t\t\t\thdr_start = memchr(cur_buf, 0xFF, cur_size);\n\t\t\t\tif (!hdr_start) break;\n\t\t\t\tnext_frame = (u32) (hdr_start-start);\n\t\t\t\tif (next_frame == remain)\n\t\t\t\t\tbreak;\n\n\t\t\t\tif ((hdr_start[1]&0xFC) == 0xF8) {\n\t\t\t\t\tif (flac_parse_header(ctx, hdr_start, (u32) remain - next_frame, &hdr))\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcur_buf = hdr_start+1;\n\t\t\t\tcur_size = (u32) (cur_buf - start);\n\t\t\t\tassert(cur_size<=remain);\n\t\t\t\tcur_size = remain - cur_size;\n\t\t\t\thdr_start = NULL;\n\t\t\t}\n\t\t\tif (!hdr_start) break;\n\t\t\tif (next_frame == remain)\n\t\t\t\tbreak;\n\t\t}\n\n\n\t\tif (!ctx->initialized) {\n\t\t\tu32 size = next_frame;\n\t\t\tu32 dsi_end = 0;\n\t\t\t//we have a header\n\t\t\tgf_bs_reassign_buffer(ctx->bs, ctx->flac_buffer, size);\n\t\t\tu32 magic = gf_bs_read_u32(ctx->bs);\n\t\t\tif (magic != GF_4CC('f','L','a','C')) {\n\n\t\t\t}\n\t\t\twhile (gf_bs_available(ctx->bs)) {\n\t\t\t\tBool last = gf_bs_read_int(ctx->bs, 1);\n\t\t\t\tu32 type = gf_bs_read_int(ctx->bs, 7);\n\t\t\t\tu32 len = gf_bs_read_int(ctx->bs, 24);\n\n\t\t\t\tif (type==0) {\n\t\t\t\t\tu16 min_block_size = gf_bs_read_u16(ctx->bs);\n\t\t\t\t\tu16 max_block_size = gf_bs_read_u16(ctx->bs);\n\t\t\t\t\t/*u32 min_frame_size = */gf_bs_read_u24(ctx->bs);\n\t\t\t\t\t/*u32 max_frame_size = */gf_bs_read_u24(ctx->bs);\n\t\t\t\t\tctx->sample_rate = gf_bs_read_int(ctx->bs, 20);\n\t\t\t\t\tctx->nb_channels = 1 + gf_bs_read_int(ctx->bs, 3);\n\t\t\t\t\tctx->bits_per_sample = 1 + gf_bs_read_int(ctx->bs, 5);\n\t\t\t\t\tif (min_block_size==max_block_size) ctx->block_size = min_block_size;\n\t\t\t\t\telse ctx->block_size = 0;\n\n\t\t\t\t\tctx->duration.num = gf_bs_read_long_int(ctx->bs, 36);\n\t\t\t\t\tctx->duration.den = ctx->sample_rate;\n\t\t\t\t\t//ignore the rest\n\t\t\t\t\tgf_bs_skip_bytes(ctx->bs, 16);\n\t\t\t\t\tdsi_end = (u32) gf_bs_get_position(ctx->bs);\n\n\t\t\t\t} else {\n\t\t\t\t\t//ignore the rest for now\n\t\t\t\t\t//TODO: expose metadata, pictures and co\n\t\t\t\t\tgf_bs_skip_bytes(ctx->bs, len);\n\t\t\t\t}\n\t\t\t\tif (last) break;\n\t\t\t}\n\t\t\tflac_dmx_check_pid(filter, ctx, ctx->flac_buffer+4, dsi_end-4);\n\t\t\tremain -= size;\n\t\t\tstart += size;\n\t\t\tctx->initialized = GF_TRUE;\n\t\t\tif (!ctx->is_playing) break;\n\t\t\tcontinue;\n\t\t}\n\n\t\t//we have a next frame, check we are synchronize\n\t\tif ((start[0] != 0xFF) && ((start[1]&0xFC) != 0xF8)) {\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[FLACDmx] invalid frame, droping %d bytes and resyncing\\n\", next_frame));\n\t\t\tstart += next_frame;\n\t\t\tremain -= next_frame;\n\t\t\tcontinue;\n\t\t}\n\n\t\tflac_parse_header(ctx,start, next_frame, &hdr);\n\t\tif (hdr.sample_rate != ctx->sample_rate) {\n\t\t\tctx->sample_rate = hdr.sample_rate;\n\t\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_SAMPLE_RATE, & PROP_UINT(ctx->sample_rate));\n\t\t}\n\n\t\tnb_samp = hdr.block_size;\n\n\t\tif (ctx->in_seek) {\n\t\t\tu64 nb_samples_at_seek = (u64) (ctx->start_range * ctx->sample_rate);\n\t\t\tif (ctx->cts + nb_samp >= nb_samples_at_seek) {\n\t\t\t\t//u32 samples_to_discard = (ctx->cts + nb_samp ) - nb_samples_at_seek;\n\t\t\t\tctx->in_seek = GF_FALSE;\n\t\t\t}\n\t\t}\n\n\t\tif (ctx->timescale && !prev_pck_size && (cts != GF_FILTER_NO_TS) ) {\n\t\t\tctx->cts = cts;\n\t\t\tcts = GF_FILTER_NO_TS;\n\t\t}\n\n\t\tif (!ctx->in_seek) {\n\t\t\tdst_pck = gf_filter_pck_new_alloc(ctx->opid, next_frame, &output);\n\t\t\tmemcpy(output, start, next_frame);\n\n\t\t\tgf_filter_pck_set_cts(dst_pck, ctx->cts);\n\t\t\tif (!ctx->timescale || (ctx->timescale==ctx->sample_rate) )\n\t\t\t\tgf_filter_pck_set_duration(dst_pck, nb_samp);\n\t\t\telse {\n\t\t\t\tgf_filter_pck_set_duration(dst_pck, (nb_samp * ctx->timescale) / ctx->sample_rate);\n\t\t\t}\n\t\t\tgf_filter_pck_set_sap(dst_pck, GF_FILTER_SAP_1);\n\t\t\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_TRUE);\n\n\t\t\tif (ctx->byte_offset != GF_FILTER_NO_BO) {\n\t\t\t\tgf_filter_pck_set_byte_offset(dst_pck, ctx->byte_offset);\n\t\t\t}\n\t\t\tgf_filter_pck_send(dst_pck);\n\t\t}\n\t\tflac_dmx_update_cts(ctx, nb_samp);\n\n\t\tassert (start[0] == 0xFF);\n\t\tassert((start[1]&0xFC) == 0xF8);\n\n\t\tstart += next_frame;\n\t\tassert(remain >= next_frame);\n\t\tremain -= next_frame;\n\n\t}\n\n\tif (!pck) {\n\t\tctx->flac_buffer_size = 0;\n\t\treturn flac_dmx_process(filter);\n\t} else {\n\t\tif (remain < ctx->flac_buffer_size) {\n\t\t\tmemmove(ctx->flac_buffer, start, remain);\n\t\t}\n\t\tctx->flac_buffer_size = remain;\n\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t}\n\treturn GF_OK;\n}",
  24787. "project": "gpac",
  24788. "hash": 181202795714431631737649125597649664622,
  24789. "size": 226,
  24790. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24791. "message": "fixed 1718",
  24792. "target": 1,
  24793. "dataset": "other",
  24794. "idx": 197240
  24795. },
  24796. {
  24797. "func": "GF_Err flac_dmx_process(GF_Filter *filter)\n{\n\tGF_FLACDmxCtx *ctx = gf_filter_get_udta(filter);\n\tGF_FilterPacket *pck, *dst_pck;\n\tu8 *output;\n\tu8 *start;\n\tBool final_flush=GF_FALSE;\n\tu32 pck_size, remain, prev_pck_size;\n\tu64 cts = GF_FILTER_NO_TS;\n\tFLACHeader hdr;\n\n\tif (ctx->in_error)\n\t\treturn GF_NON_COMPLIANT_BITSTREAM;\n\n\t//always reparse duration\n\tif (!ctx->duration.num)\n\t\tflac_dmx_check_dur(filter, ctx);\n\n\tif (ctx->opid && !ctx->is_playing)\n\t\treturn GF_OK;\n\n\tpck = gf_filter_pid_get_packet(ctx->ipid);\n\tif (!pck) {\n\t\tif (gf_filter_pid_is_eos(ctx->ipid)) {\n\t\t\tif (!ctx->flac_buffer_size) {\n\t\t\t\tif (ctx->opid)\n\t\t\t\t\tgf_filter_pid_set_eos(ctx->opid);\n\t\t\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\t\t\tctx->src_pck = NULL;\n\t\t\t\treturn GF_EOS;\n\t\t\t}\n\t\t\tfinal_flush = GF_TRUE;\n\t\t} else {\n\t\t\treturn GF_OK;\n\t\t}\n\t}\n\n\tprev_pck_size = ctx->flac_buffer_size;\n\tif (pck && !ctx->resume_from) {\n\t\tu8 *data = (u8 *) gf_filter_pck_get_data(pck, &pck_size);\n\n\t\tif (ctx->byte_offset != GF_FILTER_NO_BO) {\n\t\t\tu64 byte_offset = gf_filter_pck_get_byte_offset(pck);\n\t\t\tif (!ctx->flac_buffer_size) {\n\t\t\t\tctx->byte_offset = byte_offset;\n\t\t\t} else if (ctx->byte_offset + ctx->flac_buffer_size != byte_offset) {\n\t\t\t\tctx->byte_offset = GF_FILTER_NO_BO;\n\t\t\t\tif ((byte_offset != GF_FILTER_NO_BO) && (byte_offset>ctx->flac_buffer_size) ) {\n\t\t\t\t\tctx->byte_offset = byte_offset - ctx->flac_buffer_size;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (ctx->flac_buffer_size + pck_size > ctx->flac_buffer_alloc) {\n\t\t\tctx->flac_buffer_alloc = ctx->flac_buffer_size + pck_size;\n\t\t\tctx->flac_buffer = gf_realloc(ctx->flac_buffer, ctx->flac_buffer_alloc);\n\t\t}\n\t\tmemcpy(ctx->flac_buffer + ctx->flac_buffer_size, data, pck_size);\n\t\tctx->flac_buffer_size += pck_size;\n\t}\n\n\t//input pid sets some timescale - we flushed pending data , update cts\n\tif (ctx->timescale && pck) {\n\t\tcts = gf_filter_pck_get_cts(pck);\n\t}\n\n\tif (cts == GF_FILTER_NO_TS) {\n\t\t//avoids updating cts\n\t\tprev_pck_size = 0;\n\t}\n\n\tremain = ctx->flac_buffer_size;\n\tstart = ctx->flac_buffer;\n\n\tif (ctx->resume_from) {\n\t\tstart += ctx->resume_from - 1;\n\t\tremain -= ctx->resume_from - 1;\n\t\tctx->resume_from = 0;\n\t}\n\n\twhile (remain>2) {\n\t\tu32 next_frame=0, nb_samp;\n\t\tu32 cur_size = remain-2;\n\t\tu8 *cur_buf = start+2;\n\t\tu8 *hdr_start = NULL;\n\n\t\tif (final_flush) {\n\t\t\tnext_frame = remain;\n\t\t} else {\n\t\t\twhile (cur_size) {\n\t\t\t\t//wait till we have a frame header\n\t\t\t\thdr_start = memchr(cur_buf, 0xFF, cur_size);\n\t\t\t\tif (!hdr_start) break;\n\t\t\t\tnext_frame = (u32) (hdr_start-start);\n\t\t\t\tif (next_frame == remain)\n\t\t\t\t\tbreak;\n\n\t\t\t\tif ((hdr_start[1]&0xFC) == 0xF8) {\n\t\t\t\t\tif (flac_parse_header(ctx, hdr_start, (u32) remain - next_frame, &hdr))\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tcur_buf = hdr_start+1;\n\t\t\t\tcur_size = (u32) (cur_buf - start);\n\t\t\t\tassert(cur_size<=remain);\n\t\t\t\tcur_size = remain - cur_size;\n\t\t\t\thdr_start = NULL;\n\t\t\t}\n\t\t\tif (!hdr_start) break;\n\t\t\tif (next_frame == remain)\n\t\t\t\tbreak;\n\t\t}\n\n\n\t\tif (!ctx->initialized) {\n\t\t\tu32 size = next_frame;\n\t\t\tu32 dsi_end = 0;\n\t\t\t//we have a header\n\t\t\tgf_bs_reassign_buffer(ctx->bs, ctx->flac_buffer, size);\n\t\t\tu32 magic = gf_bs_read_u32(ctx->bs);\n\t\t\tif (magic != GF_4CC('f','L','a','C')) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, (\"[FLACDmx] invalid FLAC magic\\n\"));\n\t\t\t\tctx->in_error = GF_TRUE;\n\t\t\t\tctx->flac_buffer_size = 0;\n\t\t\t\tif (pck)\n\t\t\t\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t\t\t\treturn GF_NON_COMPLIANT_BITSTREAM;\n\t\t\t}\n\t\t\twhile (gf_bs_available(ctx->bs)) {\n\t\t\t\tBool last = gf_bs_read_int(ctx->bs, 1);\n\t\t\t\tu32 type = gf_bs_read_int(ctx->bs, 7);\n\t\t\t\tu32 len = gf_bs_read_int(ctx->bs, 24);\n\n\t\t\t\tif (type==0) {\n\t\t\t\t\tu16 min_block_size = gf_bs_read_u16(ctx->bs);\n\t\t\t\t\tu16 max_block_size = gf_bs_read_u16(ctx->bs);\n\t\t\t\t\t/*u32 min_frame_size = */gf_bs_read_u24(ctx->bs);\n\t\t\t\t\t/*u32 max_frame_size = */gf_bs_read_u24(ctx->bs);\n\t\t\t\t\tctx->sample_rate = gf_bs_read_int(ctx->bs, 20);\n\t\t\t\t\tctx->nb_channels = 1 + gf_bs_read_int(ctx->bs, 3);\n\t\t\t\t\tctx->bits_per_sample = 1 + gf_bs_read_int(ctx->bs, 5);\n\t\t\t\t\tif (min_block_size==max_block_size) ctx->block_size = min_block_size;\n\t\t\t\t\telse ctx->block_size = 0;\n\n\t\t\t\t\tctx->duration.num = gf_bs_read_long_int(ctx->bs, 36);\n\t\t\t\t\tctx->duration.den = ctx->sample_rate;\n\t\t\t\t\t//ignore the rest\n\t\t\t\t\tgf_bs_skip_bytes(ctx->bs, 16);\n\t\t\t\t\tdsi_end = (u32) gf_bs_get_position(ctx->bs);\n\n\t\t\t\t} else {\n\t\t\t\t\t//ignore the rest for now\n\t\t\t\t\t//TODO: expose metadata, pictures and co\n\t\t\t\t\tgf_bs_skip_bytes(ctx->bs, len);\n\t\t\t\t}\n\t\t\t\tif (last) break;\n\t\t\t}\n\t\t\tif (!dsi_end) {\n\t\t\t\tGF_LOG(GF_LOG_ERROR, GF_LOG_PARSER, (\"[FLACDmx] invalid FLAC header\\n\"));\n\t\t\t\tctx->in_error = GF_TRUE;\n\t\t\t\tctx->flac_buffer_size = 0;\n\t\t\t\tif (pck)\n\t\t\t\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t\t\t\treturn GF_NON_COMPLIANT_BITSTREAM;\n\t\t\t}\n\t\t\tflac_dmx_check_pid(filter, ctx, ctx->flac_buffer+4, dsi_end-4);\n\t\t\tremain -= size;\n\t\t\tstart += size;\n\t\t\tctx->initialized = GF_TRUE;\n\t\t\tif (!ctx->is_playing) break;\n\t\t\tcontinue;\n\t\t}\n\n\t\t//we have a next frame, check we are synchronize\n\t\tif ((start[0] != 0xFF) && ((start[1]&0xFC) != 0xF8)) {\n\t\t\tGF_LOG(GF_LOG_WARNING, GF_LOG_PARSER, (\"[FLACDmx] invalid frame, droping %d bytes and resyncing\\n\", next_frame));\n\t\t\tstart += next_frame;\n\t\t\tremain -= next_frame;\n\t\t\tcontinue;\n\t\t}\n\n\t\tflac_parse_header(ctx,start, next_frame, &hdr);\n\t\tif (hdr.sample_rate != ctx->sample_rate) {\n\t\t\tctx->sample_rate = hdr.sample_rate;\n\t\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_SAMPLE_RATE, & PROP_UINT(ctx->sample_rate));\n\t\t}\n\n\t\tnb_samp = hdr.block_size;\n\n\t\tif (ctx->in_seek) {\n\t\t\tu64 nb_samples_at_seek = (u64) (ctx->start_range * ctx->sample_rate);\n\t\t\tif (ctx->cts + nb_samp >= nb_samples_at_seek) {\n\t\t\t\t//u32 samples_to_discard = (ctx->cts + nb_samp ) - nb_samples_at_seek;\n\t\t\t\tctx->in_seek = GF_FALSE;\n\t\t\t}\n\t\t}\n\n\t\tif (ctx->timescale && !prev_pck_size && (cts != GF_FILTER_NO_TS) ) {\n\t\t\tctx->cts = cts;\n\t\t\tcts = GF_FILTER_NO_TS;\n\t\t}\n\n\t\tif (!ctx->in_seek) {\n\t\t\tdst_pck = gf_filter_pck_new_alloc(ctx->opid, next_frame, &output);\n\t\t\tmemcpy(output, start, next_frame);\n\n\t\t\tgf_filter_pck_set_cts(dst_pck, ctx->cts);\n\t\t\tif (!ctx->timescale || (ctx->timescale==ctx->sample_rate) )\n\t\t\t\tgf_filter_pck_set_duration(dst_pck, nb_samp);\n\t\t\telse {\n\t\t\t\tgf_filter_pck_set_duration(dst_pck, (nb_samp * ctx->timescale) / ctx->sample_rate);\n\t\t\t}\n\t\t\tgf_filter_pck_set_sap(dst_pck, GF_FILTER_SAP_1);\n\t\t\tgf_filter_pck_set_framing(dst_pck, GF_TRUE, GF_TRUE);\n\n\t\t\tif (ctx->byte_offset != GF_FILTER_NO_BO) {\n\t\t\t\tgf_filter_pck_set_byte_offset(dst_pck, ctx->byte_offset);\n\t\t\t}\n\t\t\tgf_filter_pck_send(dst_pck);\n\t\t}\n\t\tflac_dmx_update_cts(ctx, nb_samp);\n\n\t\tassert (start[0] == 0xFF);\n\t\tassert((start[1]&0xFC) == 0xF8);\n\n\t\tstart += next_frame;\n\t\tassert(remain >= next_frame);\n\t\tremain -= next_frame;\n\n\t}\n\n\tif (!pck) {\n\t\tctx->flac_buffer_size = 0;\n\t\treturn flac_dmx_process(filter);\n\t} else {\n\t\tif (remain < ctx->flac_buffer_size) {\n\t\t\tmemmove(ctx->flac_buffer, start, remain);\n\t\t}\n\t\tctx->flac_buffer_size = remain;\n\t\tgf_filter_pid_drop_packet(ctx->ipid);\n\t}\n\treturn GF_OK;\n}",
  24798. "project": "gpac",
  24799. "hash": 45890451895495219456520744515811279483,
  24800. "size": 242,
  24801. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24802. "message": "fixed 1718",
  24803. "target": 0,
  24804. "dataset": "other",
  24805. "idx": 255791
  24806. },
  24807. {
  24808. "func": "u8 flac_dmx_crc8(u8 *data, u32 len)\n{\n\tu8 crc = 0;\n\twhile (len--)\n\t\tcrc = flac_dmx_crc8_table[crc ^ *data++];\n\treturn crc;\n}",
  24809. "project": "gpac",
  24810. "hash": 65863343115187189429305351586214591876,
  24811. "size": 7,
  24812. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24813. "message": "fixed 1718",
  24814. "target": 0,
  24815. "dataset": "other",
  24816. "idx": 255795
  24817. },
  24818. {
  24819. "func": "static void flac_dmx_check_pid(GF_Filter *filter, GF_FLACDmxCtx *ctx, u8 *dsi, u32 dsi_size)\n{\n\tif (!ctx->opid) {\n\t\tctx->opid = gf_filter_pid_new(filter);\n\t\tflac_dmx_check_dur(filter, ctx);\n\t}\n\t//copy properties at init or reconfig\n\tgf_filter_pid_copy_properties(ctx->opid, ctx->ipid);\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_STREAM_TYPE, & PROP_UINT( GF_STREAM_AUDIO));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_UNFRAMED, NULL );\n\tif (ctx->is_file && ctx->index) {\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_PLAYBACK_MODE, & PROP_UINT(GF_PLAYBACK_MODE_FASTFORWARD) );\n\t}\n\tif (ctx->duration.num)\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DURATION, & PROP_FRAC64(ctx->duration));\n\n\tif (!ctx->timescale) gf_filter_pid_set_name(ctx->opid, \"audio\");\n\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_DECODER_CONFIG, & PROP_DATA( dsi, dsi_size ) );\n\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_CODECID, & PROP_UINT( GF_CODECID_FLAC ) );\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_TIMESCALE, & PROP_UINT(ctx->timescale ? ctx->timescale : ctx->sample_rate));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_SAMPLE_RATE, & PROP_UINT(ctx->sample_rate));\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_NUM_CHANNELS, & PROP_UINT(ctx->nb_channels) );\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_SAMPLES_PER_FRAME, & PROP_UINT(ctx->block_size) );\n\n\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_AUDIO_BPS, & PROP_UINT(ctx->bits_per_sample) );\n\n\tif (ctx->bitrate) {\n\t\tgf_filter_pid_set_property(ctx->opid, GF_PROP_PID_BITRATE, & PROP_UINT(ctx->bitrate));\n\t}\n\n}",
  24820. "project": "gpac",
  24821. "hash": 232540434167310452360376027909602133833,
  24822. "size": 33,
  24823. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24824. "message": "fixed 1718",
  24825. "target": 0,
  24826. "dataset": "other",
  24827. "idx": 255794
  24828. },
  24829. {
  24830. "func": "static Bool flac_parse_header(GF_FLACDmxCtx *ctx, char *data, u32 size, FLACHeader *hdr)\n{\n\tu32 block_size, sample_rate, res, top, pos, crc, crc_hdr;\n\n\tgf_bs_reassign_buffer(ctx->bs, data, size);\n\tgf_bs_read_int(ctx->bs, 15);\n\t/*block_strategy = */gf_bs_read_int(ctx->bs, 1);\n\tblock_size = gf_bs_read_int(ctx->bs, 4);\n\tsample_rate = gf_bs_read_int(ctx->bs, 4);\n\t/*u32 channel_layout = */gf_bs_read_int(ctx->bs, 4);\n\t/*u32 bps = */gf_bs_read_int(ctx->bs, 3);\n\tgf_bs_read_int(ctx->bs, 1);\n\n\tres = gf_bs_read_u8(ctx->bs);\n\ttop = (res & 128) >> 1;\n\tif ((res & 0xC0) == 0x80 || (res >= 0xFE)) return GF_FALSE;\n\twhile (res & top) {\n\t\ts32 tmp = gf_bs_read_u8(ctx->bs);\n\t\ttmp -= 128;\n\t\tif(tmp>>6)\n\t\t\treturn GF_FALSE;\n\t\tres = (res<<6) + tmp;\n\t\ttop <<= 5;\n\t}\n\t//res &= (top << 1) - 1;\n\n\tif (block_size==6) block_size = 1 + gf_bs_read_int(ctx->bs, 8);\n\telse if (block_size==7) block_size = 1 + gf_bs_read_int(ctx->bs, 16);\n\telse {\n\t\tblock_size = flac_dmx_block_sizes[block_size];\n\t}\n\n#if 0\n\tif (bps==0) bps = ctx->bits_per_sample;\n\telse if (bps==1) bps = 8;\n\telse if (bps==2) bps = 12;\n\telse if (bps==4) bps = 16;\n\telse if (bps==5) bps = 20;\n\telse if (bps==6) bps = 24;\n#endif\n\n\tif (sample_rate==0) sample_rate = ctx->sample_rate;\n\telse if ((sample_rate&0xC)==0xC) {\n\t\tif (sample_rate==0xC) sample_rate = gf_bs_read_u8(ctx->bs);\n\t\telse if (sample_rate==0xD) sample_rate = gf_bs_read_u16(ctx->bs);\n\t\telse if (sample_rate==0xE) sample_rate = 10*gf_bs_read_u16(ctx->bs);\n\t} else {\n\t\tsample_rate = flac_dmx_samplerates[sample_rate];\n\t}\n\n\tpos = (u32) gf_bs_get_position(ctx->bs);\n\n\tcrc = gf_bs_read_u8(ctx->bs);\n\tcrc_hdr = flac_dmx_crc8(data, pos);\n\n\tif (crc != crc_hdr) {\n\t\treturn GF_FALSE;\n\t}\n\thdr->sample_rate = sample_rate;\n\thdr->block_size = block_size;\n\treturn GF_TRUE;\n}",
  24831. "project": "gpac",
  24832. "hash": 146940138001565824367237928998902629345,
  24833. "size": 62,
  24834. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24835. "message": "fixed 1718",
  24836. "target": 0,
  24837. "dataset": "other",
  24838. "idx": 255800
  24839. },
  24840. {
  24841. "func": "static Bool flac_dmx_process_event(GF_Filter *filter, const GF_FilterEvent *evt)\n{\n\tu32 i;\n\tGF_FilterEvent fevt;\n\tGF_FLACDmxCtx *ctx = gf_filter_get_udta(filter);\n\n\tif (evt->base.on_pid != ctx->opid) return GF_TRUE;\n\n\tswitch (evt->base.type) {\n\tcase GF_FEVT_PLAY:\n\t\tif (!ctx->is_playing) {\n\t\t\tctx->is_playing = GF_TRUE;\n\t\t}\n\t\tif (! ctx->is_file) {\n\t\t\tif (evt->play.start_range || ctx->initial_play_done) {\n\t\t\t\tctx->flac_buffer_size = 0;\n\t\t\t\tctx->resume_from = 0;\n\t\t\t}\n\t\t\tctx->initial_play_done = GF_TRUE;\n\t\t\treturn GF_FALSE;\n\t\t}\n\t\tflac_dmx_check_dur(filter, ctx);\n\n\t\tctx->start_range = evt->play.start_range;\n\t\tctx->in_seek = GF_TRUE;\n\t\tctx->file_pos = 0;\n\t\tif (ctx->start_range) {\n\t\t\tfor (i=1; i<ctx->index_size; i++) {\n\t\t\t\tif (ctx->indexes[i].duration>ctx->start_range) {\n\t\t\t\t\tctx->cts = (u64) (ctx->indexes[i-1].duration * ctx->sample_rate);\n\t\t\t\t\tctx->file_pos = ctx->indexes[i-1].pos;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tif (!ctx->initial_play_done) {\n\t\t\tctx->initial_play_done = GF_TRUE;\n\t\t\t//seek will not change the current source state, don't send a seek\n\t\t\tif (!ctx->file_pos)\n\t\t\t\treturn GF_TRUE;\n\t\t}\n\t\tctx->flac_buffer_size = 0;\n\t\tctx->resume_from = 0;\n\t\t//post a seek\n\t\tGF_FEVT_INIT(fevt, GF_FEVT_SOURCE_SEEK, ctx->ipid);\n\t\tfevt.seek.start_offset = ctx->file_pos;\n\t\tgf_filter_pid_send_event(ctx->ipid, &fevt);\n\n\t\t//cancel event\n\t\treturn GF_TRUE;\n\n\tcase GF_FEVT_STOP:\n\t\tctx->is_playing = GF_FALSE;\n\t\tif (ctx->src_pck) gf_filter_pck_unref(ctx->src_pck);\n\t\tctx->src_pck = NULL;\n\t\t//don't cancel event\n\t\treturn GF_FALSE;\n\n\tcase GF_FEVT_SET_SPEED:\n\t\t//cancel event\n\t\treturn GF_TRUE;\n\tdefault:\n\t\tbreak;\n\t}\n\t//by default don't cancel event - to rework once we have downloading in place\n\treturn GF_FALSE;\n}",
  24842. "project": "gpac",
  24843. "hash": 58796678165220143132545903613880864650,
  24844. "size": 67,
  24845. "commit_id": "da69ad1f970a7e17c865eaec9af98cc84df10d5b",
  24846. "message": "fixed 1718",
  24847. "target": 0,
  24848. "dataset": "other",
  24849. "idx": 255799
  24850. }
  24851. ]
  24852. },
  24853. {
  24854. "call_depth": 3,
  24855. "longest_call_chain": [
  24856. "udp_recvmsg",
  24857. "skb_consume_udp",
  24858. "udp_skb_has_head_state"
  24859. ],
  24860. "group_size": 3,
  24861. "functions": [
  24862. {
  24863. "func": "static bool udp_skb_has_head_state(struct sk_buff *skb)\n{\n\treturn !(udp_skb_scratch(skb)->_tsize_state & UDP_SKB_IS_STATELESS);\n}",
  24864. "project": "net",
  24865. "hash": 75596643897424437307341242919964130006,
  24866. "size": 4,
  24867. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  24868. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  24869. "target": 0,
  24870. "dataset": "other",
  24871. "idx": 468928
  24872. },
  24873. {
  24874. "func": "void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len)\n{\n\tif (unlikely(READ_ONCE(sk->sk_peek_off) >= 0)) {\n\t\tbool slow = lock_sock_fast(sk);\n\n\t\tsk_peek_offset_bwd(sk, len);\n\t\tunlock_sock_fast(sk, slow);\n\t}\n\n\t/* In the more common cases we cleared the head states previously,\n\t * see __udp_queue_rcv_skb().\n\t */\n\tif (unlikely(udp_skb_has_head_state(skb)))\n\t\tskb_release_head_state(skb);\n\tconsume_stateless_skb(skb);\n}",
  24875. "project": "net",
  24876. "hash": 225943577854652223116887108482932336234,
  24877. "size": 16,
  24878. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  24879. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  24880. "target": 0,
  24881. "dataset": "other",
  24882. "idx": 468934
  24883. },
  24884. {
  24885. "func": "int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,\n\t\tint flags, int *addr_len)\n{\n\tstruct inet_sock *inet = inet_sk(sk);\n\tDECLARE_SOCKADDR(struct sockaddr_in *, sin, msg->msg_name);\n\tstruct sk_buff *skb;\n\tunsigned int ulen, copied;\n\tint peeked, peeking, off;\n\tint err;\n\tint is_udplite = IS_UDPLITE(sk);\n\tbool checksum_valid = false;\n\n\tif (flags & MSG_ERRQUEUE)\n\t\treturn ip_recv_error(sk, msg, len, addr_len);\n\ntry_again:\n\tpeeking = off = sk_peek_offset(sk, flags);\n\tskb = __skb_recv_udp(sk, flags, noblock, &peeked, &off, &err);\n\tif (!skb)\n\t\treturn err;\n\n\tulen = udp_skb_len(skb);\n\tcopied = len;\n\tif (copied > ulen - off)\n\t\tcopied = ulen - off;\n\telse if (copied < ulen)\n\t\tmsg->msg_flags |= MSG_TRUNC;\n\n\t/*\n\t * If checksum is needed at all, try to do it while copying the\n\t * data. If the data is truncated, or if we only want a partial\n\t * coverage checksum (UDP-Lite), do it before the copy.\n\t */\n\n\tif (copied < ulen || peeking ||\n\t (is_udplite && UDP_SKB_CB(skb)->partial_cov)) {\n\t\tchecksum_valid = udp_skb_csum_unnecessary(skb) ||\n\t\t\t\t!__udp_lib_checksum_complete(skb);\n\t\tif (!checksum_valid)\n\t\t\tgoto csum_copy_err;\n\t}\n\n\tif (checksum_valid || udp_skb_csum_unnecessary(skb)) {\n\t\tif (udp_skb_is_linear(skb))\n\t\t\terr = copy_linear_skb(skb, copied, off, &msg->msg_iter);\n\t\telse\n\t\t\terr = skb_copy_datagram_msg(skb, off, msg, copied);\n\t} else {\n\t\terr = skb_copy_and_csum_datagram_msg(skb, off, msg);\n\n\t\tif (err == -EINVAL)\n\t\t\tgoto csum_copy_err;\n\t}\n\n\tif (unlikely(err)) {\n\t\tif (!peeked) {\n\t\t\tatomic_inc(&sk->sk_drops);\n\t\t\tUDP_INC_STATS(sock_net(sk),\n\t\t\t\t UDP_MIB_INERRORS, is_udplite);\n\t\t}\n\t\tkfree_skb(skb);\n\t\treturn err;\n\t}\n\n\tif (!peeked)\n\t\tUDP_INC_STATS(sock_net(sk),\n\t\t\t UDP_MIB_INDATAGRAMS, is_udplite);\n\n\tsock_recv_ts_and_drops(msg, sk, skb);\n\n\t/* Copy the address. */\n\tif (sin) {\n\t\tsin->sin_family = AF_INET;\n\t\tsin->sin_port = udp_hdr(skb)->source;\n\t\tsin->sin_addr.s_addr = ip_hdr(skb)->saddr;\n\t\tmemset(sin->sin_zero, 0, sizeof(sin->sin_zero));\n\t\t*addr_len = sizeof(*sin);\n\t}\n\tif (inet->cmsg_flags)\n\t\tip_cmsg_recv_offset(msg, sk, skb, sizeof(struct udphdr), off);\n\n\terr = copied;\n\tif (flags & MSG_TRUNC)\n\t\terr = ulen;\n\n\tskb_consume_udp(sk, skb, peeking ? -err : err);\n\treturn err;\n\ncsum_copy_err:\n\tif (!__sk_queue_drop_skb(sk, &udp_sk(sk)->reader_queue, skb, flags,\n\t\t\t\t udp_skb_destructor)) {\n\t\tUDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite);\n\t\tUDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);\n\t}\n\tkfree_skb(skb);\n\n\t/* starting over for a new packet, but check if we need to yield */\n\tcond_resched();\n\tmsg->msg_flags &= ~MSG_TRUNC;\n\tgoto try_again;\n}",
  24886. "project": "net",
  24887. "hash": 58392490434323142952560185875685509340,
  24888. "size": 101,
  24889. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  24890. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  24891. "target": 0,
  24892. "dataset": "other",
  24893. "idx": 468963
  24894. }
  24895. ]
  24896. },
  24897. {
  24898. "call_depth": 3,
  24899. "longest_call_chain": [
  24900. "DimsToShape",
  24901. "RuntimeShape",
  24902. "BuildFrom"
  24903. ],
  24904. "group_size": 7,
  24905. "functions": [
  24906. {
  24907. "func": " inline static RuntimeShape ExtendedShape(int new_shape_size,\n const RuntimeShape& shape) {\n return RuntimeShape(new_shape_size, shape, 1);\n }",
  24908. "project": "tensorflow",
  24909. "hash": 159680860774739202256470977404269601493,
  24910. "size": 4,
  24911. "commit_id": "8ee24e7949a203d234489f9da2c5bf45a7d5157d",
  24912. "message": "[tflite] Ensure `MatchingDim` does not allow buffer overflow.\n\nWe check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.\n\nA much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.\n\nPiperOrigin-RevId: 332526127\nChange-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4",
  24913. "target": 0,
  24914. "dataset": "other",
  24915. "idx": 269165
  24916. },
  24917. {
  24918. "func": " inline void BuildFrom(const T& src_iterable) {\n const int dimensions_count =\n std::distance(src_iterable.begin(), src_iterable.end());\n Resize(dimensions_count);\n int32_t* data = DimsData();\n for (auto it : src_iterable) {\n *data = it;\n ++data;\n }\n }",
  24919. "project": "tensorflow",
  24920. "hash": 188723213691498056888114153264788661533,
  24921. "size": 10,
  24922. "commit_id": "8ee24e7949a203d234489f9da2c5bf45a7d5157d",
  24923. "message": "[tflite] Ensure `MatchingDim` does not allow buffer overflow.\n\nWe check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.\n\nA much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.\n\nPiperOrigin-RevId: 332526127\nChange-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4",
  24924. "target": 0,
  24925. "dataset": "other",
  24926. "idx": 269151
  24927. },
  24928. {
  24929. "func": " inline void BuildFrom(const std::initializer_list<int> init_list) {\n BuildFrom<const std::initializer_list<int>>(init_list);\n }",
  24930. "project": "tensorflow",
  24931. "hash": 59491366147344092120214428866658525017,
  24932. "size": 3,
  24933. "commit_id": "8ee24e7949a203d234489f9da2c5bf45a7d5157d",
  24934. "message": "[tflite] Ensure `MatchingDim` does not allow buffer overflow.\n\nWe check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.\n\nA much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.\n\nPiperOrigin-RevId: 332526127\nChange-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4",
  24935. "target": 0,
  24936. "dataset": "other",
  24937. "idx": 269184
  24938. },
  24939. {
  24940. "func": "inline RuntimeShape DimsToShape(const tflite::Dims<4>& dims) {\n return RuntimeShape(\n {dims.sizes[3], dims.sizes[2], dims.sizes[1], dims.sizes[0]});\n}",
  24941. "project": "tensorflow",
  24942. "hash": 166765932906645759940963413765942152024,
  24943. "size": 4,
  24944. "commit_id": "8ee24e7949a203d234489f9da2c5bf45a7d5157d",
  24945. "message": "[tflite] Ensure `MatchingDim` does not allow buffer overflow.\n\nWe check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.\n\nA much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.\n\nPiperOrigin-RevId: 332526127\nChange-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4",
  24946. "target": 0,
  24947. "dataset": "other",
  24948. "idx": 269164
  24949. },
  24950. {
  24951. "func": " RuntimeShape() : size_(0) {}",
  24952. "project": "tensorflow",
  24953. "hash": 124986740443484127646846081410820275420,
  24954. "size": 1,
  24955. "commit_id": "8ee24e7949a203d234489f9da2c5bf45a7d5157d",
  24956. "message": "[tflite] Ensure `MatchingDim` does not allow buffer overflow.\n\nWe check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.\n\nA much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.\n\nPiperOrigin-RevId: 332526127\nChange-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4",
  24957. "target": 0,
  24958. "dataset": "other",
  24959. "idx": 269154
  24960. },
  24961. {
  24962. "func": " RuntimeShape(int dimensions_count, const int32_t* dims_data) : size_(0) {\n ReplaceWith(dimensions_count, dims_data);\n }",
  24963. "project": "tensorflow",
  24964. "hash": 146175229728474414336310525899539981310,
  24965. "size": 3,
  24966. "commit_id": "8ee24e7949a203d234489f9da2c5bf45a7d5157d",
  24967. "message": "[tflite] Ensure `MatchingDim` does not allow buffer overflow.\n\nWe check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.\n\nA much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.\n\nPiperOrigin-RevId: 332526127\nChange-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4",
  24968. "target": 0,
  24969. "dataset": "other",
  24970. "idx": 269170
  24971. },
  24972. {
  24973. "func": " RuntimeShape(const std::initializer_list<int> init_list) : size_(0) {\n BuildFrom(init_list);\n }",
  24974. "project": "tensorflow",
  24975. "hash": 24097122067391478662058055954168903884,
  24976. "size": 3,
  24977. "commit_id": "8ee24e7949a203d234489f9da2c5bf45a7d5157d",
  24978. "message": "[tflite] Ensure `MatchingDim` does not allow buffer overflow.\n\nWe check in `MatchingDim` that both arguments have the same dimensionality, however that is a `DCHECK` only enabled if building in debug mode. Hence, it could be possible to cause buffer overflows by passing in a tensor with larger dimensions as the second argument. To fix, we now make `MatchingDim` return the minimum of the two sizes.\n\nA much better fix would be to return a status object but that requires refactoring a large part of the codebase for minor benefits.\n\nPiperOrigin-RevId: 332526127\nChange-Id: If627d0d2c80a685217b6e0d1e64b0872dbf1c5e4",
  24979. "target": 0,
  24980. "dataset": "other",
  24981. "idx": 269182
  24982. }
  24983. ]
  24984. },
  24985. {
  24986. "call_depth": 3,
  24987. "longest_call_chain": [
  24988. "collatorAlwaysEqual",
  24989. "in",
  24990. "setEqualities"
  24991. ],
  24992. "group_size": 17,
  24993. "functions": [
  24994. {
  24995. "func": "TEST_F(QueryPlannerTest, EmptyQueryWithProjectionUsesCollscanIfIndexCollationDiffers) {\n params.options = QueryPlannerParams::GENERATE_COVERED_IXSCANS;\n CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kReverseString);\n addIndex(BSON(\"a\" << 1), &collator);\n runQueryAsCommand(fromjson(\"{find: 'testns', projection: {_id: 0, a: 1}}\"));\n assertNumSolutions(1);\n assertSolutionExists(\n \"{proj: {spec: {_id: 0, a: 1}, node: \"\n \"{cscan: {dir: 1}}}}\");\n}",
  24996. "project": "mongo",
  24997. "hash": 116511701241382531691326907951778309177,
  24998. "size": 10,
  24999. "commit_id": "b0ef26c639112b50648a02d969298650fbd402a4",
  25000. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25001. "target": 0,
  25002. "dataset": "other",
  25003. "idx": 392955
  25004. },
  25005. {
  25006. "func": "TEST(ComparisonMatchExpression, StringMatchingRespectsCollation) {\n BSONObj operand = BSON(\"a\"\n << \"string\");\n CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kAlwaysEqual);\n EqualityMatchExpression eq(\"a\", operand[\"a\"]);\n eq.setCollator(&collator);\n ASSERT(eq.matchesBSON(BSON(\"a\"\n << \"string2\"),\n NULL));\n}",
  25007. "project": "mongo",
  25008. "hash": 49200481839816426055067292892665845522,
  25009. "size": 10,
  25010. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25011. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25012. "target": 0,
  25013. "dataset": "other",
  25014. "idx": 422604
  25015. },
  25016. {
  25017. "func": "TEST(InMatchExpression, StringMatchingRespectsCollation) {\n BSONArray operand = BSON_ARRAY(\"string\");\n BSONObj match = BSON(\"a\"\n << \"string2\");\n CollatorInterfaceMock collator(CollatorInterfaceMock::MockType::kAlwaysEqual);\n InMatchExpression in(\"\");\n in.setCollator(&collator);\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n ASSERT(in.matchesSingleElement(match[\"a\"]));\n}",
  25018. "project": "mongo",
  25019. "hash": 313042155359170171739143330219573298473,
  25020. "size": 11,
  25021. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25022. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25023. "target": 0,
  25024. "dataset": "other",
  25025. "idx": 422656
  25026. },
  25027. {
  25028. "func": "TEST(InMatchExpression, MatchesArrayValue) {\n BSONObj operand = BSON_ARRAY(5);\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n ASSERT(in.matchesBSON(BSON(\"a\" << BSON_ARRAY(5.0 << 6)), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << BSON_ARRAY(6 << 7)), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << BSON_ARRAY(BSON_ARRAY(5))), NULL));\n}",
  25029. "project": "mongo",
  25030. "hash": 226300102127799669308814563338121385276,
  25031. "size": 10,
  25032. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25033. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25034. "target": 0,
  25035. "dataset": "other",
  25036. "idx": 422539
  25037. },
  25038. {
  25039. "func": "TEST(InMatchExpression, StringMatchingWithNullCollatorUsesBinaryComparison) {\n BSONArray operand = BSON_ARRAY(\"string\");\n BSONObj notMatch = BSON(\"a\"\n << \"string2\");\n InMatchExpression in(\"\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n ASSERT(!in.matchesSingleElement(notMatch[\"a\"]));\n}",
  25040. "project": "mongo",
  25041. "hash": 222848615768803539659319233780004606039,
  25042. "size": 9,
  25043. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25044. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25045. "target": 0,
  25046. "dataset": "other",
  25047. "idx": 422556
  25048. },
  25049. {
  25050. "func": "TEST(InMatchExpression, MatchesFullArray) {\n BSONObj operand = BSON_ARRAY(BSON_ARRAY(1 << 2) << 4 << 5);\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand[0], operand[1], operand[2]};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n ASSERT(in.matchesBSON(BSON(\"a\" << BSON_ARRAY(1 << 2)), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << BSON_ARRAY(1 << 2 << 3)), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << BSON_ARRAY(1)), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << 1), NULL));\n}",
  25051. "project": "mongo",
  25052. "hash": 83337974193960845237515657753354444386,
  25053. "size": 11,
  25054. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25055. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25056. "target": 0,
  25057. "dataset": "other",
  25058. "idx": 422558
  25059. },
  25060. {
  25061. "func": "TEST(InMatchExpression, MatchesScalar) {\n BSONObj operand = BSON_ARRAY(5);\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n ASSERT(in.matchesBSON(BSON(\"a\" << 5.0), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << 4), NULL));\n}",
  25062. "project": "mongo",
  25063. "hash": 13894676684628408898160584921075105240,
  25064. "size": 9,
  25065. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25066. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25067. "target": 0,
  25068. "dataset": "other",
  25069. "idx": 422562
  25070. },
  25071. {
  25072. "func": "TEST(InMatchExpression, ElemMatchKey) {\n BSONObj operand = BSON_ARRAY(5 << 2);\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand[0], operand[1]};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n MatchDetails details;\n details.requestElemMatchKey();\n ASSERT(!in.matchesBSON(BSON(\"a\" << 4), &details));\n ASSERT(!details.hasElemMatchKey());\n ASSERT(in.matchesBSON(BSON(\"a\" << 5), &details));\n ASSERT(!details.hasElemMatchKey());\n ASSERT(in.matchesBSON(BSON(\"a\" << BSON_ARRAY(1 << 2 << 5)), &details));\n ASSERT(details.hasElemMatchKey());\n ASSERT_EQUALS(\"1\", details.elemMatchKey());\n}",
  25073. "project": "mongo",
  25074. "hash": 216652547517168869643852088648632323168,
  25075. "size": 16,
  25076. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25077. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25078. "target": 0,
  25079. "dataset": "other",
  25080. "idx": 422584
  25081. },
  25082. {
  25083. "func": "TEST(InMatchExpression, MatchesMinKey) {\n BSONObj operand = BSON_ARRAY(MinKey);\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n ASSERT(in.matchesBSON(BSON(\"a\" << MinKey), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << MaxKey), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << 4), NULL));\n}",
  25084. "project": "mongo",
  25085. "hash": 65711962331854143501621544695867760687,
  25086. "size": 10,
  25087. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25088. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25089. "target": 0,
  25090. "dataset": "other",
  25091. "idx": 422597
  25092. },
  25093. {
  25094. "func": "TEST(InMatchExpression, MatchesElementMultiple) {\n BSONObj operand = BSON_ARRAY(1 << \"r\" << true << 1);\n InMatchExpression in(\"\");\n std::vector<BSONElement> equalities{operand[0], operand[1], operand[2], operand[3]};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n BSONObj matchFirst = BSON(\"a\" << 1);\n BSONObj matchSecond = BSON(\"a\"\n << \"r\");\n BSONObj matchThird = BSON(\"a\" << true);\n BSONObj notMatch = BSON(\"a\" << false);\n ASSERT(in.matchesSingleElement(matchFirst[\"a\"]));\n ASSERT(in.matchesSingleElement(matchSecond[\"a\"]));\n ASSERT(in.matchesSingleElement(matchThird[\"a\"]));\n ASSERT(!in.matchesSingleElement(notMatch[\"a\"]));\n}",
  25095. "project": "mongo",
  25096. "hash": 18978996959427266631071425504934045199,
  25097. "size": 16,
  25098. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25099. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25100. "target": 0,
  25101. "dataset": "other",
  25102. "idx": 422599
  25103. },
  25104. {
  25105. "func": "TEST(InMatchExpression, MatchesUndefined) {\n BSONObj operand = BSON_ARRAY(BSONUndefined);\n\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_NOT_OK(in.setEqualities(std::move(equalities)));\n}",
  25106. "project": "mongo",
  25107. "hash": 9087152684999343829843974470547880070,
  25108. "size": 7,
  25109. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25110. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25111. "target": 0,
  25112. "dataset": "other",
  25113. "idx": 422615
  25114. },
  25115. {
  25116. "func": "TEST(InMatchExpression, MatchesEmpty) {\n InMatchExpression in(\"a\");\n\n BSONObj notMatch = BSON(\"a\" << 2);\n ASSERT(!in.matchesSingleElement(notMatch[\"a\"]));\n ASSERT(!in.matchesBSON(BSON(\"a\" << 1), NULL));\n ASSERT(!in.matchesBSON(BSONObj(), NULL));\n}",
  25117. "project": "mongo",
  25118. "hash": 318137049493186870341000646874937439529,
  25119. "size": 8,
  25120. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25121. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25122. "target": 0,
  25123. "dataset": "other",
  25124. "idx": 422628
  25125. },
  25126. {
  25127. "func": "TEST(InMatchExpression, MatchesNull) {\n BSONObj operand = BSON_ARRAY(BSONNULL);\n\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n ASSERT(in.matchesBSON(BSONObj(), NULL));\n ASSERT(in.matchesBSON(BSON(\"a\" << BSONNULL), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << 4), NULL));\n // A non-existent field is treated same way as an empty bson object\n ASSERT(in.matchesBSON(BSON(\"b\" << 4), NULL));\n}",
  25128. "project": "mongo",
  25129. "hash": 313294220935155537645799218005065733327,
  25130. "size": 13,
  25131. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25132. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25133. "target": 0,
  25134. "dataset": "other",
  25135. "idx": 422639
  25136. },
  25137. {
  25138. "func": "TEST(InMatchExpression, MatchesElementSingle) {\n BSONArray operand = BSON_ARRAY(1);\n BSONObj match = BSON(\"a\" << 1);\n BSONObj notMatch = BSON(\"a\" << 2);\n InMatchExpression in(\"\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n ASSERT(in.matchesSingleElement(match[\"a\"]));\n ASSERT(!in.matchesSingleElement(notMatch[\"a\"]));\n}",
  25139. "project": "mongo",
  25140. "hash": 238284355812328079131428698018143007777,
  25141. "size": 10,
  25142. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25143. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25144. "target": 0,
  25145. "dataset": "other",
  25146. "idx": 422668
  25147. },
  25148. {
  25149. "func": "TEST(InMatchExpression, MatchesMaxKey) {\n BSONObj operand = BSON_ARRAY(MaxKey);\n InMatchExpression in(\"a\");\n std::vector<BSONElement> equalities{operand.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n\n ASSERT(in.matchesBSON(BSON(\"a\" << MaxKey), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << MinKey), NULL));\n ASSERT(!in.matchesBSON(BSON(\"a\" << 4), NULL));\n}",
  25150. "project": "mongo",
  25151. "hash": 131653085116474483340487521868016719326,
  25152. "size": 10,
  25153. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25154. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25155. "target": 0,
  25156. "dataset": "other",
  25157. "idx": 422673
  25158. },
  25159. {
  25160. "func": "Status InMatchExpression::setEqualities(std::vector<BSONElement> equalities) {\n for (auto&& equality : equalities) {\n if (equality.type() == BSONType::RegEx) {\n return Status(ErrorCodes::BadValue, \"InMatchExpression equality cannot be a regex\");\n }\n if (equality.type() == BSONType::Undefined) {\n return Status(ErrorCodes::BadValue, \"InMatchExpression equality cannot be undefined\");\n }\n\n if (equality.type() == BSONType::jstNULL) {\n _hasNull = true;\n } else if (equality.type() == BSONType::Array && equality.Obj().isEmpty()) {\n _hasEmptyArray = true;\n }\n }\n\n _originalEqualityVector = std::move(equalities);\n\n if (!std::is_sorted(_originalEqualityVector.begin(),\n _originalEqualityVector.end(),\n _eltCmp.makeLessThan())) {\n // Sort the list of equalities to work around https://svn.boost.org/trac10/ticket/13140.\n std::sort(\n _originalEqualityVector.begin(), _originalEqualityVector.end(), _eltCmp.makeLessThan());\n }\n\n _equalitySet = _eltCmp.makeBSONEltFlatSet(_originalEqualityVector);\n\n return Status::OK();\n}",
  25161. "project": "mongo",
  25162. "hash": 15848151713556943549153537753512546953,
  25163. "size": 30,
  25164. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25165. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25166. "target": 0,
  25167. "dataset": "other",
  25168. "idx": 422664
  25169. },
  25170. {
  25171. "func": "TEST(InMatchExpression, ChangingCollationAfterAddingEqualitiesPreservesEqualities) {\n BSONObj obj1 = BSON(\"\"\n << \"string1\");\n BSONObj obj2 = BSON(\"\"\n << \"string2\");\n CollatorInterfaceMock collatorAlwaysEqual(CollatorInterfaceMock::MockType::kAlwaysEqual);\n CollatorInterfaceMock collatorReverseString(CollatorInterfaceMock::MockType::kReverseString);\n InMatchExpression in(\"\");\n in.setCollator(&collatorAlwaysEqual);\n std::vector<BSONElement> equalities{obj1.firstElement(), obj2.firstElement()};\n ASSERT_OK(in.setEqualities(std::move(equalities)));\n ASSERT(in.getEqualities().size() == 1);\n in.setCollator(&collatorReverseString);\n ASSERT(in.getEqualities().size() == 2);\n ASSERT(in.getEqualities().count(obj1.firstElement()));\n ASSERT(in.getEqualities().count(obj2.firstElement()));\n}",
  25172. "project": "mongo",
  25173. "hash": 318922974627986294322587234956215187568,
  25174. "size": 17,
  25175. "commit_id": "64095239f41e9f3841d8be9088347db56d35c891",
  25176. "message": "SERVER-51083 Reject invalid UTF-8 from $regex match expressions",
  25177. "target": 0,
  25178. "dataset": "other",
  25179. "idx": 422580
  25180. }
  25181. ]
  25182. },
  25183. {
  25184. "call_depth": 3,
  25185. "longest_call_chain": [
  25186. "print_join",
  25187. "print_table_array",
  25188. "print"
  25189. ],
  25190. "group_size": 10,
  25191. "functions": [
  25192. {
  25193. "func": "static void print_join(THD *thd,\n table_map eliminated_tables,\n String *str,\n List<TABLE_LIST> *tables,\n enum_query_type query_type)\n{\n /* List is reversed => we should reverse it before using */\n List_iterator_fast<TABLE_LIST> ti(*tables);\n TABLE_LIST **table;\n DBUG_ENTER(\"print_join\");\n\n /*\n If the QT_NO_DATA_EXPANSION flag is specified, we print the\n original table list, including constant tables that have been\n optimized away, as the constant tables may be referenced in the\n expression printed by Item_field::print() when this flag is given.\n Otherwise, only non-const tables are printed.\n\n Example:\n\n Original SQL:\n select * from (select 1) t\n\n Printed without QT_NO_DATA_EXPANSION:\n select '1' AS `1` from dual\n\n Printed with QT_NO_DATA_EXPANSION:\n select `t`.`1` from (select 1 AS `1`) `t`\n */\n const bool print_const_tables= (query_type & QT_NO_DATA_EXPANSION);\n size_t tables_to_print= 0;\n\n for (TABLE_LIST *t= ti++; t ; t= ti++)\n {\n /* See comment in print_table_array() about the second condition */\n if (print_const_tables || !t->optimized_away)\n if (!is_eliminated_table(eliminated_tables, t))\n tables_to_print++;\n }\n if (tables_to_print == 0)\n {\n str->append(STRING_WITH_LEN(\"dual\"));\n DBUG_VOID_RETURN; // all tables were optimized away\n }\n ti.rewind();\n\n if (!(table= static_cast<TABLE_LIST **>(thd->alloc(sizeof(TABLE_LIST*) *\n tables_to_print))))\n DBUG_VOID_RETURN; // out of memory\n\n TABLE_LIST *tmp, **t= table + (tables_to_print - 1);\n while ((tmp= ti++))\n {\n if (tmp->optimized_away && !print_const_tables)\n continue;\n if (is_eliminated_table(eliminated_tables, tmp))\n continue;\n *t--= tmp;\n }\n\n DBUG_ASSERT(tables->elements >= 1);\n /*\n Assert that the first table in the list isn't eliminated. This comes from\n the fact that the first table can't be inner table of an outer join.\n */\n DBUG_ASSERT(!eliminated_tables || \n !(((*table)->table && ((*table)->table->map & eliminated_tables)) ||\n ((*table)->nested_join && !((*table)->nested_join->used_tables &\n ~eliminated_tables))));\n /* \n If the first table is a semi-join nest, swap it with something that is\n not a semi-join nest.\n */\n if ((*table)->sj_inner_tables)\n {\n TABLE_LIST **end= table + tables_to_print;\n for (TABLE_LIST **t2= table; t2!=end; t2++)\n {\n if (!(*t2)->sj_inner_tables)\n {\n tmp= *t2;\n *t2= *table;\n *table= tmp;\n break;\n }\n }\n }\n print_table_array(thd, eliminated_tables, str, table, \n table + tables_to_print, query_type);\n DBUG_VOID_RETURN;\n}",
  25194. "target": 0,
  25195. "cwe": [],
  25196. "project": "server",
  25197. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  25198. "hash": 158752683764176461762178093049610480322,
  25199. "size": 91,
  25200. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  25201. "dataset": "other",
  25202. "idx": 508477
  25203. },
  25204. {
  25205. "func": " void print_value(String *to) const\n {\n str_value.print(to);\n }",
  25206. "target": 0,
  25207. "cwe": [
  25208. "CWE-617"
  25209. ],
  25210. "project": "server",
  25211. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  25212. "hash": 198394178645807465600507091966696905942,
  25213. "size": 4,
  25214. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  25215. "dataset": "other",
  25216. "idx": 509040
  25217. },
  25218. {
  25219. "func": "void vers_select_conds_t::print(String *str, enum_query_type query_type) const\n{\n switch (orig_type) {\n case SYSTEM_TIME_UNSPECIFIED:\n break;\n case SYSTEM_TIME_AS_OF:\n start.print(str, query_type, STRING_WITH_LEN(\" FOR SYSTEM_TIME AS OF \"));\n break;\n case SYSTEM_TIME_FROM_TO:\n start.print(str, query_type, STRING_WITH_LEN(\" FOR SYSTEM_TIME FROM \"));\n end.print(str, query_type, STRING_WITH_LEN(\" TO \"));\n break;\n case SYSTEM_TIME_BETWEEN:\n start.print(str, query_type, STRING_WITH_LEN(\" FOR SYSTEM_TIME BETWEEN \"));\n end.print(str, query_type, STRING_WITH_LEN(\" AND \"));\n break;\n case SYSTEM_TIME_BEFORE:\n case SYSTEM_TIME_HISTORY:\n DBUG_ASSERT(0);\n break;\n case SYSTEM_TIME_ALL:\n str->append(\" FOR SYSTEM_TIME ALL\");\n break;\n }\n}",
  25220. "target": 0,
  25221. "cwe": [],
  25222. "project": "server",
  25223. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  25224. "hash": 98798937267268417188840436026413721122,
  25225. "size": 25,
  25226. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  25227. "dataset": "other",
  25228. "idx": 508491
  25229. },
  25230. {
  25231. "func": "void TABLE_LIST::print(THD *thd, table_map eliminated_tables, String *str, \n enum_query_type query_type)\n{\n if (nested_join)\n {\n str->append('(');\n print_join(thd, eliminated_tables, str, &nested_join->join_list, query_type);\n str->append(')');\n }\n else if (jtbm_subselect)\n {\n if (jtbm_subselect->engine->engine_type() ==\n subselect_engine::SINGLE_SELECT_ENGINE)\n {\n /* \n We get here when conversion into materialization didn't finish (this\n happens when\n - The subquery is a degenerate case which produces 0 or 1 record\n - subquery's optimization didn't finish because of @@max_join_size\n limits\n - ... maybe some other cases like this \n */\n str->append(STRING_WITH_LEN(\" <materialize> (\"));\n jtbm_subselect->engine->print(str, query_type);\n str->append(')');\n }\n else\n {\n str->append(STRING_WITH_LEN(\" <materialize> (\"));\n subselect_hash_sj_engine *hash_engine;\n hash_engine= (subselect_hash_sj_engine*)jtbm_subselect->engine;\n hash_engine->materialize_engine->print(str, query_type);\n str->append(')');\n }\n }\n else\n {\n const char *cmp_name; // Name to compare with alias\n if (view_name.str)\n {\n // A view\n\n if (!(belong_to_view &&\n belong_to_view->compact_view_format))\n {\n append_identifier(thd, str, &view_db);\n str->append('.');\n }\n append_identifier(thd, str, &view_name);\n cmp_name= view_name.str;\n }\n else if (derived)\n {\n if (!is_with_table())\n {\n // A derived table\n str->append('(');\n derived->print(str, query_type);\n str->append(')');\n cmp_name= \"\"; // Force printing of alias\n }\n else\n {\n append_identifier(thd, str, &table_name);\n cmp_name= table_name.str;\n }\n }\n else\n {\n // A normal table\n\n if (!(belong_to_view &&\n belong_to_view->compact_view_format))\n {\n append_identifier(thd, str, &db);\n str->append('.');\n }\n if (schema_table)\n {\n append_identifier(thd, str, &schema_table_name);\n cmp_name= schema_table_name.str;\n }\n else\n {\n append_identifier(thd, str, &table_name);\n cmp_name= table_name.str;\n }\n#ifdef WITH_PARTITION_STORAGE_ENGINE\n if (partition_names && partition_names->elements)\n {\n int i, num_parts= partition_names->elements;\n List_iterator<String> name_it(*(partition_names));\n str->append(STRING_WITH_LEN(\" PARTITION (\"));\n for (i= 1; i <= num_parts; i++)\n {\n String *name= name_it++;\n append_identifier(thd, str, name->c_ptr(), name->length());\n if (i != num_parts)\n str->append(',');\n }\n str->append(')');\n }\n#endif /* WITH_PARTITION_STORAGE_ENGINE */\n }\n if (table && table->versioned())\n vers_conditions.print(str, query_type);\n\n if (my_strcasecmp(table_alias_charset, cmp_name, alias.str))\n {\n char t_alias_buff[MAX_ALIAS_NAME];\n LEX_CSTRING t_alias= alias;\n\n str->append(' ');\n if (lower_case_table_names == 1)\n {\n if (alias.str && alias.str[0])\n {\n strmov(t_alias_buff, alias.str);\n t_alias.length= my_casedn_str(files_charset_info, t_alias_buff);\n t_alias.str= t_alias_buff;\n }\n }\n\n append_identifier(thd, str, &t_alias);\n }\n\n if (index_hints)\n {\n List_iterator<Index_hint> it(*index_hints);\n Index_hint *hint;\n\n while ((hint= it++))\n {\n str->append (STRING_WITH_LEN(\" \"));\n hint->print (thd, str);\n }\n }\n }\n}",
  25232. "target": 0,
  25233. "cwe": [],
  25234. "project": "server",
  25235. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  25236. "hash": 300728936978076169998319381053009874325,
  25237. "size": 139,
  25238. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  25239. "dataset": "other",
  25240. "idx": 508492
  25241. },
  25242. {
  25243. "func": "Index_hint::print(THD *thd, String *str)\n{\n switch (type)\n {\n case INDEX_HINT_IGNORE: str->append(STRING_WITH_LEN(\"IGNORE INDEX\")); break;\n case INDEX_HINT_USE: str->append(STRING_WITH_LEN(\"USE INDEX\")); break;\n case INDEX_HINT_FORCE: str->append(STRING_WITH_LEN(\"FORCE INDEX\")); break;\n }\n str->append (STRING_WITH_LEN(\" (\"));\n if (key_name.length)\n {\n if (thd && !my_strnncoll(system_charset_info,\n (const uchar *)key_name.str, key_name.length, \n (const uchar *)primary_key_name, \n strlen(primary_key_name)))\n str->append(primary_key_name);\n else\n append_identifier(thd, str, &key_name);\n}\n str->append(')');\n}",
  25244. "target": 0,
  25245. "cwe": [],
  25246. "project": "server",
  25247. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  25248. "hash": 134044205720613112784732010539419435169,
  25249. "size": 21,
  25250. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  25251. "dataset": "other",
  25252. "idx": 508618
  25253. },
  25254. {
  25255. "func": "void st_select_lex::print(THD *thd, String *str, enum_query_type query_type)\n{\n DBUG_ASSERT(thd);\n\n if (tvc)\n {\n tvc->print(thd, str, query_type);\n return;\n }\n\n if ((query_type & QT_SHOW_SELECT_NUMBER) &&\n thd->lex->all_selects_list &&\n thd->lex->all_selects_list->link_next &&\n select_number != UINT_MAX &&\n select_number != INT_MAX)\n {\n str->append(\"/* select#\");\n str->append_ulonglong(select_number);\n str->append(\" */ \");\n }\n\n str->append(STRING_WITH_LEN(\"select \"));\n\n if (join && join->cleaned)\n {\n /*\n JOIN already cleaned up so it is dangerous to print items\n because temporary tables they pointed on could be freed.\n */\n str->append('#');\n str->append(select_number);\n return;\n }\n\n /* First add options */\n if (options & SELECT_STRAIGHT_JOIN)\n str->append(STRING_WITH_LEN(\"straight_join \"));\n if (options & SELECT_HIGH_PRIORITY)\n str->append(STRING_WITH_LEN(\"high_priority \"));\n if (options & SELECT_DISTINCT)\n str->append(STRING_WITH_LEN(\"distinct \"));\n if (options & SELECT_SMALL_RESULT)\n str->append(STRING_WITH_LEN(\"sql_small_result \"));\n if (options & SELECT_BIG_RESULT)\n str->append(STRING_WITH_LEN(\"sql_big_result \"));\n if (options & OPTION_BUFFER_RESULT)\n str->append(STRING_WITH_LEN(\"sql_buffer_result \"));\n if (options & OPTION_FOUND_ROWS)\n str->append(STRING_WITH_LEN(\"sql_calc_found_rows \"));\n switch (sql_cache)\n {\n case SQL_NO_CACHE:\n str->append(STRING_WITH_LEN(\"sql_no_cache \"));\n break;\n case SQL_CACHE:\n str->append(STRING_WITH_LEN(\"sql_cache \"));\n break;\n case SQL_CACHE_UNSPECIFIED:\n break;\n default:\n DBUG_ASSERT(0);\n }\n\n //Item List\n bool first= 1;\n List_iterator_fast<Item> it(item_list);\n Item *item;\n while ((item= it++))\n {\n if (first)\n first= 0;\n else\n str->append(',');\n\n if (is_subquery_function() && item->is_autogenerated_name)\n {\n /*\n Do not print auto-generated aliases in subqueries. It has no purpose\n in a view definition or other contexts where the query is printed.\n */\n item->print(str, query_type);\n }\n else\n item->print_item_w_name(str, query_type);\n }\n\n /*\n from clause\n TODO: support USING/FORCE/IGNORE index\n */\n if (table_list.elements)\n {\n str->append(STRING_WITH_LEN(\" from \"));\n /* go through join tree */\n print_join(thd, join? join->eliminated_tables: 0, str, &top_join_list, query_type);\n }\n else if (where)\n {\n /*\n \"SELECT 1 FROM DUAL WHERE 2\" should not be printed as \n \"SELECT 1 WHERE 2\": the 1st syntax is valid, but the 2nd is not.\n */\n str->append(STRING_WITH_LEN(\" from DUAL \"));\n }\n\n // Where\n Item *cur_where= where;\n if (join)\n cur_where= join->conds;\n if (cur_where || cond_value != Item::COND_UNDEF)\n {\n str->append(STRING_WITH_LEN(\" where \"));\n if (cur_where)\n cur_where->print(str, query_type);\n else\n str->append(cond_value != Item::COND_FALSE ? \"1\" : \"0\");\n }\n\n // group by & olap\n if (group_list.elements)\n {\n str->append(STRING_WITH_LEN(\" group by \"));\n print_order(str, group_list.first, query_type);\n switch (olap)\n {\n case CUBE_TYPE:\n\tstr->append(STRING_WITH_LEN(\" with cube\"));\n\tbreak;\n case ROLLUP_TYPE:\n\tstr->append(STRING_WITH_LEN(\" with rollup\"));\n\tbreak;\n default:\n\t; //satisfy compiler\n }\n }\n\n // having\n Item *cur_having= having;\n if (join)\n cur_having= join->having;\n\n if (cur_having || having_value != Item::COND_UNDEF)\n {\n str->append(STRING_WITH_LEN(\" having \"));\n if (cur_having)\n cur_having->print(str, query_type);\n else\n str->append(having_value != Item::COND_FALSE ? \"1\" : \"0\");\n }\n\n if (order_list.elements)\n {\n str->append(STRING_WITH_LEN(\" order by \"));\n print_order(str, order_list.first, query_type);\n }\n\n // limit\n print_limit(thd, str, query_type);\n\n // lock type\n if (lock_type == TL_READ_WITH_SHARED_LOCKS)\n str->append(\" lock in share mode\");\n else if (lock_type == TL_WRITE)\n str->append(\" for update\");\n\n // PROCEDURE unsupported here\n}",
  25256. "target": 0,
  25257. "cwe": [],
  25258. "project": "server",
  25259. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  25260. "hash": 332339047406078563782282850125410244748,
  25261. "size": 167,
  25262. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  25263. "dataset": "other",
  25264. "idx": 508647
  25265. },
  25266. {
  25267. "func": "inline void Virtual_column_info::print(String* str)\n{\n expr->print_for_table_def(str);\n}",
  25268. "target": 0,
  25269. "cwe": [
  25270. "CWE-617"
  25271. ],
  25272. "project": "server",
  25273. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  25274. "hash": 311206635704968211615641013064330791691,
  25275. "size": 4,
  25276. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  25277. "dataset": "other",
  25278. "idx": 509143
  25279. },
  25280. {
  25281. "func": " virtual void print(String *str, enum_query_type query_type)\n { ident->print(str, query_type); }",
  25282. "target": 0,
  25283. "cwe": [
  25284. "CWE-617"
  25285. ],
  25286. "project": "server",
  25287. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  25288. "hash": 89038788561708738890534198811419204929,
  25289. "size": 2,
  25290. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  25291. "dataset": "other",
  25292. "idx": 509291
  25293. },
  25294. {
  25295. "func": "static bool is_eliminated_table(table_map eliminated_tables, TABLE_LIST *tbl)\n{\n return eliminated_tables &&\n ((tbl->table && (tbl->table->map & eliminated_tables)) ||\n (tbl->nested_join && !(tbl->nested_join->used_tables &\n ~eliminated_tables)));\n}",
  25296. "target": 0,
  25297. "cwe": [],
  25298. "project": "server",
  25299. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  25300. "hash": 312244178416601699737568920507856674799,
  25301. "size": 7,
  25302. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  25303. "dataset": "other",
  25304. "idx": 508562
  25305. },
  25306. {
  25307. "func": "static void print_table_array(THD *thd, \n table_map eliminated_tables,\n String *str, TABLE_LIST **table, \n TABLE_LIST **end,\n enum_query_type query_type)\n{\n (*table)->print(thd, eliminated_tables, str, query_type);\n\n for (TABLE_LIST **tbl= table + 1; tbl < end; tbl++)\n {\n TABLE_LIST *curr= *tbl;\n \n /*\n The \"eliminated_tables &&\" check guards againist the case of \n printing the query for CREATE VIEW. We do that without having run \n JOIN::optimize() and so will have nested_join->used_tables==0.\n */\n if (eliminated_tables &&\n ((curr->table && (curr->table->map & eliminated_tables)) ||\n (curr->nested_join && !(curr->nested_join->used_tables &\n ~eliminated_tables))))\n {\n /* as of 5.5, print_join doesnt put eliminated elements into array */\n DBUG_ASSERT(0); \n continue;\n }\n\n /* JOIN_TYPE_OUTER is just a marker unrelated to real join */\n if (curr->outer_join & (JOIN_TYPE_LEFT|JOIN_TYPE_RIGHT))\n {\n /* MySQL converts right to left joins */\n str->append(STRING_WITH_LEN(\" left join \"));\n }\n else if (curr->straight)\n str->append(STRING_WITH_LEN(\" straight_join \"));\n else if (curr->sj_inner_tables)\n str->append(STRING_WITH_LEN(\" semi join \"));\n else\n str->append(STRING_WITH_LEN(\" join \"));\n \n curr->print(thd, eliminated_tables, str, query_type);\n if (curr->on_expr)\n {\n str->append(STRING_WITH_LEN(\" on(\"));\n curr->on_expr->print(str, query_type);\n str->append(')');\n }\n }\n}",
  25308. "target": 0,
  25309. "cwe": [],
  25310. "project": "server",
  25311. "commit_id": "ff77a09bda884fe6bf3917eb29b9d3a2f53f919b",
  25312. "hash": 204891780141062851261229126640052977802,
  25313. "size": 49,
  25314. "message": "MDEV-22464 Server crash on UPDATE with nested subquery\n\nUninitialized ref_pointer_array[] because setup_fields() got empty\nfields list. mysql_multi_update() for some reason does that by\nsubstituting the fields list with empty total_list for the\nmysql_select() call (looks like wrong merge since total_list is not\nused anywhere else and is always empty). The fix would be to return\nback the original fields list. But this fails update_use_source.test\ncase:\n\n --error ER_BAD_FIELD_ERROR\n update v1 set t1c1=2 order by 1;\n\nActually not failing the above seems to be ok.\n\nThe other fix would be to keep resolve_in_select_list false (and that\nkeeps outer context from being resolved in\nItem_ref::fix_fields()). This fix is more consistent with how SELECT\nbehaves:\n\n --error ER_SUBQUERY_NO_1_ROW\n select a from t1 where a= (select 2 from t1 having (a = 3));\n\nSo this patch implements this fix.",
  25315. "dataset": "other",
  25316. "idx": 508557
  25317. }
  25318. ]
  25319. },
  25320. {
  25321. "call_depth": 3,
  25322. "longest_call_chain": [
  25323. "RemoveDuplicateLayers",
  25324. "CompareImagesBounds",
  25325. "ComparePixels"
  25326. ],
  25327. "group_size": 3,
  25328. "functions": [
  25329. {
  25330. "func": "static MagickBooleanType ComparePixels(const LayerMethod method,\n const PixelInfo *p,const PixelInfo *q)\n{\n double\n o1,\n o2;\n\n /*\n Any change in pixel values\n */\n if (method == CompareAnyLayer)\n return(IsFuzzyEquivalencePixelInfo(p,q) == MagickFalse ? MagickTrue : MagickFalse);\n o1 = (p->alpha_trait != UndefinedPixelTrait) ? p->alpha : OpaqueAlpha;\n o2 = (q->alpha_trait != UndefinedPixelTrait) ? q->alpha : OpaqueAlpha;\n /*\n Pixel goes from opaque to transprency.\n */\n if (method == CompareClearLayer)\n return((MagickBooleanType) ( (o1 >= ((double) QuantumRange/2.0)) &&\n (o2 < ((double) QuantumRange/2.0)) ) );\n /*\n Overlay would change first pixel by second.\n */\n if (method == CompareOverlayLayer)\n {\n if (o2 < ((double) QuantumRange/2.0))\n return MagickFalse;\n return(IsFuzzyEquivalencePixelInfo(p,q) == MagickFalse ? MagickTrue :\n MagickFalse);\n }\n return(MagickFalse);\n}",
  25331. "project": "ImageMagick",
  25332. "hash": 71969903763466407743223783519735972643,
  25333. "size": 32,
  25334. "commit_id": "ef59bd764f88d893f1219fee8ba696a5d3f8c1c4",
  25335. "message": "There is a Division by Zero in function OptimizeLayerFrames (#2743)\n\nin file MagickCore/layer.c. cur->ticks_per_seconds can be zero\r\nwith a crafted input argument *image. This is similar to\r\nCVE-2019-13454.",
  25336. "target": 0,
  25337. "dataset": "other",
  25338. "idx": 338503
  25339. },
  25340. {
  25341. "func": "MagickExport void RemoveDuplicateLayers(Image **images,ExceptionInfo *exception)\n{\n RectangleInfo\n bounds;\n\n register Image\n *image,\n *next;\n\n assert((*images) != (const Image *) NULL);\n assert((*images)->signature == MagickCoreSignature);\n if ((*images)->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",\n (*images)->filename);\n assert(exception != (ExceptionInfo *) NULL);\n assert(exception->signature == MagickCoreSignature);\n image=GetFirstImageInList(*images);\n for ( ; (next=GetNextImageInList(image)) != (Image *) NULL; image=next)\n {\n if ((image->columns != next->columns) || (image->rows != next->rows) ||\n (image->page.x != next->page.x) || (image->page.y != next->page.y))\n continue;\n bounds=CompareImagesBounds(image,next,CompareAnyLayer,exception);\n if (bounds.x < 0)\n {\n /*\n Two images are the same, merge time delays and delete one.\n */\n size_t\n time;\n\n time=(size_t) (1000.0*image->delay*\n PerceptibleReciprocal((double) image->ticks_per_second));\n time+=(size_t) (1000.0*next->delay*\n PerceptibleReciprocal((double) next->ticks_per_second));\n next->ticks_per_second=100L;\n next->delay=time*image->ticks_per_second/1000;\n next->iterations=image->iterations;\n *images=image;\n (void) DeleteImageFromList(images);\n }\n }\n *images=GetFirstImageInList(*images);\n}",
  25342. "project": "ImageMagick",
  25343. "hash": 142503199598786156427895124140558881737,
  25344. "size": 44,
  25345. "commit_id": "ef59bd764f88d893f1219fee8ba696a5d3f8c1c4",
  25346. "message": "There is a Division by Zero in function OptimizeLayerFrames (#2743)\n\nin file MagickCore/layer.c. cur->ticks_per_seconds can be zero\r\nwith a crafted input argument *image. This is similar to\r\nCVE-2019-13454.",
  25347. "target": 0,
  25348. "dataset": "other",
  25349. "idx": 338510
  25350. },
  25351. {
  25352. "func": "static RectangleInfo CompareImagesBounds(const Image *image1,\n const Image *image2,const LayerMethod method,ExceptionInfo *exception)\n{\n RectangleInfo\n bounds;\n\n PixelInfo\n pixel1,\n pixel2;\n\n register const Quantum\n *p,\n *q;\n\n register ssize_t\n x;\n\n ssize_t\n y;\n\n /*\n Set bounding box of the differences between images.\n */\n GetPixelInfo(image1,&pixel1);\n GetPixelInfo(image2,&pixel2);\n for (x=0; x < (ssize_t) image1->columns; x++)\n {\n p=GetVirtualPixels(image1,x,0,1,image1->rows,exception);\n q=GetVirtualPixels(image2,x,0,1,image2->rows,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n break;\n for (y=0; y < (ssize_t) image1->rows; y++)\n {\n GetPixelInfoPixel(image1,p,&pixel1);\n GetPixelInfoPixel(image2,q,&pixel2);\n if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse)\n break;\n p+=GetPixelChannels(image1);\n q+=GetPixelChannels(image2);\n }\n if (y < (ssize_t) image1->rows)\n break;\n }\n if (x >= (ssize_t) image1->columns)\n {\n /*\n Images are identical, return a null image.\n */\n bounds.x=-1;\n bounds.y=-1;\n bounds.width=1;\n bounds.height=1;\n return(bounds);\n }\n bounds.x=x;\n for (x=(ssize_t) image1->columns-1; x >= 0; x--)\n {\n p=GetVirtualPixels(image1,x,0,1,image1->rows,exception);\n q=GetVirtualPixels(image2,x,0,1,image2->rows,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n break;\n for (y=0; y < (ssize_t) image1->rows; y++)\n {\n GetPixelInfoPixel(image1,p,&pixel1);\n GetPixelInfoPixel(image2,q,&pixel2);\n if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse)\n break;\n p+=GetPixelChannels(image1);\n q+=GetPixelChannels(image2);\n }\n if (y < (ssize_t) image1->rows)\n break;\n }\n bounds.width=(size_t) (x-bounds.x+1);\n for (y=0; y < (ssize_t) image1->rows; y++)\n {\n p=GetVirtualPixels(image1,0,y,image1->columns,1,exception);\n q=GetVirtualPixels(image2,0,y,image2->columns,1,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n break;\n for (x=0; x < (ssize_t) image1->columns; x++)\n {\n GetPixelInfoPixel(image1,p,&pixel1);\n GetPixelInfoPixel(image2,q,&pixel2);\n if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse)\n break;\n p+=GetPixelChannels(image1);\n q+=GetPixelChannels(image2);\n }\n if (x < (ssize_t) image1->columns)\n break;\n }\n bounds.y=y;\n for (y=(ssize_t) image1->rows-1; y >= 0; y--)\n {\n p=GetVirtualPixels(image1,0,y,image1->columns,1,exception);\n q=GetVirtualPixels(image2,0,y,image2->columns,1,exception);\n if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))\n break;\n for (x=0; x < (ssize_t) image1->columns; x++)\n {\n GetPixelInfoPixel(image1,p,&pixel1);\n GetPixelInfoPixel(image2,q,&pixel2);\n if (ComparePixels(method,&pixel1,&pixel2) != MagickFalse)\n break;\n p+=GetPixelChannels(image1);\n q+=GetPixelChannels(image2);\n }\n if (x < (ssize_t) image1->columns)\n break;\n }\n bounds.height=(size_t) (y-bounds.y+1);\n return(bounds);\n}",
  25353. "project": "ImageMagick",
  25354. "hash": 74152169590556357975726086117689155168,
  25355. "size": 114,
  25356. "commit_id": "ef59bd764f88d893f1219fee8ba696a5d3f8c1c4",
  25357. "message": "There is a Division by Zero in function OptimizeLayerFrames (#2743)\n\nin file MagickCore/layer.c. cur->ticks_per_seconds can be zero\r\nwith a crafted input argument *image. This is similar to\r\nCVE-2019-13454.",
  25358. "target": 0,
  25359. "dataset": "other",
  25360. "idx": 338504
  25361. }
  25362. ]
  25363. },
  25364. {
  25365. "call_depth": 3,
  25366. "longest_call_chain": [
  25367. "auth_server_reconnect_timeout",
  25368. "auth_server_connection_connect",
  25369. "auth_server_connection_disconnect"
  25370. ],
  25371. "group_size": 6,
  25372. "functions": [
  25373. {
  25374. "func": "int auth_server_connection_connect(struct auth_server_connection *conn)\n{\n\tconst char *handshake;\n\tint fd;\n\n\ti_assert(!conn->connected);\n\ti_assert(conn->fd == -1);\n\n\tconn->last_connect = ioloop_time;\n\ttimeout_remove(&conn->to);\n\n\t/* max. 1 second wait here. */\n\tfd = net_connect_unix_with_retries(conn->client->auth_socket_path,\n\t\t\t\t\t 1000);\n\tif (fd == -1) {\n\t\tif (errno == EACCES) {\n\t\t\ti_error(\"auth: %s\",\n\t\t\t\teacces_error_get(\"connect\",\n\t\t\t\t\tconn->client->auth_socket_path));\n\t\t} else {\n\t\t\ti_error(\"auth: connect(%s) failed: %m\",\n\t\t\t\tconn->client->auth_socket_path);\n\t\t}\n\t\treturn -1;\n\t}\n\tconn->fd = fd;\n\tconn->io = io_add(fd, IO_READ, auth_server_connection_input, conn);\n\tconn->input = i_stream_create_fd(fd, AUTH_SERVER_CONN_MAX_LINE_LENGTH);\n\tconn->output = o_stream_create_fd(fd, (size_t)-1);\n\tconn->connected = TRUE;\n\n\thandshake = t_strdup_printf(\"VERSION\\t%u\\t%u\\nCPID\\t%u\\n\",\n\t\t\t\t AUTH_CLIENT_PROTOCOL_MAJOR_VERSION,\n AUTH_CLIENT_PROTOCOL_MINOR_VERSION,\n\t\t\t\t conn->client->client_pid);\n\tif (o_stream_send_str(conn->output, handshake) < 0) {\n\t\ti_warning(\"Error sending handshake to auth server: %s\",\n\t\t\t o_stream_get_error(conn->output));\n\t\tauth_server_connection_disconnect(conn,\n\t\t\to_stream_get_error(conn->output));\n\t\treturn -1;\n\t}\n\n\tconn->to = timeout_add(AUTH_HANDSHAKE_TIMEOUT,\n\t\t\t auth_client_handshake_timeout, conn);\n\treturn 0;\n}",
  25375. "target": 0,
  25376. "cwe": [],
  25377. "project": "core",
  25378. "commit_id": "a9b135760aea6d1790d447d351c56b78889dac22",
  25379. "hash": 248247155098641521347977298366079271112,
  25380. "size": 47,
  25381. "message": "lib-auth: Remove request after abort\n\nOtherwise the request will still stay in hash table\nand get dereferenced when all requests are aborted\ncausing an attempt to access free'd memory.\n\nFound by Apollon Oikonomopoulos <apoikos@debian.org>\n\nBroken in 1a29ed2f96da1be22fa5a4d96c7583aa81b8b060",
  25382. "dataset": "other",
  25383. "idx": 505198
  25384. },
  25385. {
  25386. "func": "static void auth_server_connection_input(struct auth_server_connection *conn)\n{\n\tstruct istream *input;\n\tconst char *line, *error;\n\tint ret;\n\n\tswitch (i_stream_read(conn->input)) {\n\tcase 0:\n\t\treturn;\n\tcase -1:\n\t\t/* disconnected */\n\t\terror = conn->input->stream_errno != 0 ?\n\t\t\tstrerror(conn->input->stream_errno) : \"EOF\";\n\t\tauth_server_connection_reconnect(conn, error);\n\t\treturn;\n\tcase -2:\n\t\t/* buffer full - can't happen unless auth is buggy */\n\t\ti_error(\"BUG: Auth server sent us more than %d bytes of data\",\n\t\t\tAUTH_SERVER_CONN_MAX_LINE_LENGTH);\n\t\tauth_server_connection_disconnect(conn, \"buffer full\");\n\t\treturn;\n\t}\n\n\tif (!conn->version_received) {\n\t\tline = i_stream_next_line(conn->input);\n\t\tif (line == NULL)\n\t\t\treturn;\n\n\t\t/* make sure the major version matches */\n\t\tif (strncmp(line, \"VERSION\\t\", 8) != 0 ||\n\t\t !str_uint_equals(t_strcut(line + 8, '\\t'),\n\t\t\t\t AUTH_CLIENT_PROTOCOL_MAJOR_VERSION)) {\n\t\t\ti_error(\"Authentication server not compatible with \"\n\t\t\t\t\"this client (mixed old and new binaries?)\");\n\t\t\tauth_server_connection_disconnect(conn,\n\t\t\t\t\"incompatible server\");\n\t\t\treturn;\n\t\t}\n\t\tconn->version_received = TRUE;\n\t}\n\n\tinput = conn->input;\n\ti_stream_ref(input);\n\twhile ((line = i_stream_next_line(input)) != NULL && !input->closed) {\n\t\tT_BEGIN {\n\t\t\tret = auth_server_connection_input_line(conn, line);\n\t\t} T_END;\n\n\t\tif (ret < 0) {\n\t\t\tauth_server_connection_disconnect(conn, t_strdup_printf(\n\t\t\t\t\"Received broken input: %s\", line));\n\t\t\tbreak;\n\t\t}\n\t}\n\ti_stream_unref(&input);\n}",
  25387. "target": 0,
  25388. "cwe": [],
  25389. "project": "core",
  25390. "commit_id": "a9b135760aea6d1790d447d351c56b78889dac22",
  25391. "hash": 261895622309149699495227662079957978387,
  25392. "size": 56,
  25393. "message": "lib-auth: Remove request after abort\n\nOtherwise the request will still stay in hash table\nand get dereferenced when all requests are aborted\ncausing an attempt to access free'd memory.\n\nFound by Apollon Oikonomopoulos <apoikos@debian.org>\n\nBroken in 1a29ed2f96da1be22fa5a4d96c7583aa81b8b060",
  25394. "dataset": "other",
  25395. "idx": 505212
  25396. },
  25397. {
  25398. "func": "static void auth_server_reconnect_timeout(struct auth_server_connection *conn)\n{\n\t(void)auth_server_connection_connect(conn);\n}",
  25399. "target": 0,
  25400. "cwe": [],
  25401. "project": "core",
  25402. "commit_id": "a9b135760aea6d1790d447d351c56b78889dac22",
  25403. "hash": 196873985221575723118301509644723633834,
  25404. "size": 4,
  25405. "message": "lib-auth: Remove request after abort\n\nOtherwise the request will still stay in hash table\nand get dereferenced when all requests are aborted\ncausing an attempt to access free'd memory.\n\nFound by Apollon Oikonomopoulos <apoikos@debian.org>\n\nBroken in 1a29ed2f96da1be22fa5a4d96c7583aa81b8b060",
  25406. "dataset": "other",
  25407. "idx": 505195
  25408. },
  25409. {
  25410. "func": "void auth_server_connection_deinit(struct auth_server_connection **_conn)\n{\n struct auth_server_connection *conn = *_conn;\n\n\t*_conn = NULL;\n\n\tauth_server_connection_disconnect(conn, \"deinitializing\");\n\ti_assert(hash_table_count(conn->requests) == 0);\n\thash_table_destroy(&conn->requests);\n\tarray_free(&conn->available_auth_mechs);\n\tpool_unref(&conn->pool);\n}",
  25411. "target": 0,
  25412. "cwe": [],
  25413. "project": "core",
  25414. "commit_id": "a9b135760aea6d1790d447d351c56b78889dac22",
  25415. "hash": 216662586418196099072702855143233170264,
  25416. "size": 12,
  25417. "message": "lib-auth: Remove request after abort\n\nOtherwise the request will still stay in hash table\nand get dereferenced when all requests are aborted\ncausing an attempt to access free'd memory.\n\nFound by Apollon Oikonomopoulos <apoikos@debian.org>\n\nBroken in 1a29ed2f96da1be22fa5a4d96c7583aa81b8b060",
  25418. "dataset": "other",
  25419. "idx": 505208
  25420. },
  25421. {
  25422. "func": "auth_server_connection_reconnect(struct auth_server_connection *conn,\n\t\t\t\t const char *disconnect_reason)\n{\n\ttime_t next_connect;\n\n\tauth_server_connection_disconnect(conn, disconnect_reason);\n\n\tnext_connect = conn->last_connect + AUTH_SERVER_RECONNECT_TIMEOUT_SECS;\n\tconn->to = timeout_add(ioloop_time >= next_connect ? 0 :\n\t\t\t (next_connect - ioloop_time) * 1000,\n\t\t\t auth_server_reconnect_timeout, conn);\n}",
  25423. "target": 0,
  25424. "cwe": [],
  25425. "project": "core",
  25426. "commit_id": "a9b135760aea6d1790d447d351c56b78889dac22",
  25427. "hash": 31521442441470921887932668469167505419,
  25428. "size": 12,
  25429. "message": "lib-auth: Remove request after abort\n\nOtherwise the request will still stay in hash table\nand get dereferenced when all requests are aborted\ncausing an attempt to access free'd memory.\n\nFound by Apollon Oikonomopoulos <apoikos@debian.org>\n\nBroken in 1a29ed2f96da1be22fa5a4d96c7583aa81b8b060",
  25430. "dataset": "other",
  25431. "idx": 505211
  25432. },
  25433. {
  25434. "func": "void auth_server_connection_disconnect(struct auth_server_connection *conn,\n\t\t\t\t const char *reason)\n{\n\tif (!conn->connected)\n\t\treturn;\n\tconn->connected = FALSE;\n\tconn->handshake_received = FALSE;\n\tconn->version_received = FALSE;\n\tconn->has_plain_mech = FALSE;\n\tconn->server_pid = 0;\n\tconn->connect_uid = 0;\n\tconn->cookie = NULL;\n\tarray_clear(&conn->available_auth_mechs);\n\n\ttimeout_remove(&conn->to);\n\tio_remove(&conn->io);\n\tif (conn->fd != -1) {\n\t\ti_stream_destroy(&conn->input);\n\t\to_stream_destroy(&conn->output);\n\n\t\tif (close(conn->fd) < 0)\n\t\t\ti_error(\"close(auth server connection) failed: %m\");\n\t\tconn->fd = -1;\n\t}\n\n\tauth_server_connection_remove_requests(conn, reason);\n\n\tif (conn->client->connect_notify_callback != NULL) {\n\t\tconn->client->connect_notify_callback(conn->client, FALSE,\n\t\t\t\tconn->client->connect_notify_context);\n\t}\n}",
  25435. "target": 0,
  25436. "cwe": [],
  25437. "project": "core",
  25438. "commit_id": "a9b135760aea6d1790d447d351c56b78889dac22",
  25439. "hash": 42639496603697390795538267128561591225,
  25440. "size": 32,
  25441. "message": "lib-auth: Remove request after abort\n\nOtherwise the request will still stay in hash table\nand get dereferenced when all requests are aborted\ncausing an attempt to access free'd memory.\n\nFound by Apollon Oikonomopoulos <apoikos@debian.org>\n\nBroken in 1a29ed2f96da1be22fa5a4d96c7583aa81b8b060",
  25442. "dataset": "other",
  25443. "idx": 505216
  25444. }
  25445. ]
  25446. },
  25447. {
  25448. "call_depth": 3,
  25449. "longest_call_chain": [
  25450. "sd_pkt_scan",
  25451. "ov511_pkt_scan",
  25452. "ov51x_handle_button"
  25453. ],
  25454. "group_size": 6,
  25455. "functions": [
  25456. {
  25457. "func": "static void ov518_pkt_scan(struct gspca_dev *gspca_dev,\n\t\t\tu8 *data,\t\t\t/* isoc packet */\n\t\t\tint len)\t\t\t/* iso packet length */\n{\n\tstruct sd *sd = (struct sd *) gspca_dev;\n\n\t/* A false positive here is likely, until OVT gives me\n\t * the definitive SOF/EOF format */\n\tif ((!(data[0] | data[1] | data[2] | data[3] | data[5])) && data[6]) {\n\t\tov51x_handle_button(gspca_dev, (data[6] >> 1) & 1);\n\t\tgspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);\n\t\tgspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);\n\t\tsd->packet_nr = 0;\n\t}\n\n\tif (gspca_dev->last_packet_type == DISCARD_PACKET)\n\t\treturn;\n\n\t/* Does this device use packet numbers ? */\n\tif (len & 7) {\n\t\tlen--;\n\t\tif (sd->packet_nr == data[len])\n\t\t\tsd->packet_nr++;\n\t\t/* The last few packets of the frame (which are all 0's\n\t\t except that they may contain part of the footer), are\n\t\t numbered 0 */\n\t\telse if (sd->packet_nr == 0 || data[len]) {\n\t\t\tgspca_err(gspca_dev, \"Invalid packet nr: %d (expect: %d)\\n\",\n\t\t\t\t (int)data[len], (int)sd->packet_nr);\n\t\t\tgspca_dev->last_packet_type = DISCARD_PACKET;\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/* intermediate packet */\n\tgspca_frame_add(gspca_dev, INTER_PACKET, data, len);\n}",
  25458. "project": "linux",
  25459. "hash": 248294460692326492688023245505605613915,
  25460. "size": 37,
  25461. "commit_id": "998912346c0da53a6dbb71fab3a138586b596b30",
  25462. "message": "media: ov519: add missing endpoint sanity checks\n\nMake sure to check that we have at least one endpoint before accessing\nthe endpoint array to avoid dereferencing a NULL-pointer on stream\nstart.\n\nNote that these sanity checks are not redundant as the driver is mixing\nlooking up altsettings by index and by number, which need not coincide.\n\nFixes: 1876bb923c98 (\"V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge\")\nFixes: b282d87332f5 (\"V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)\")\nCc: stable <stable@vger.kernel.org> # 2.6.31\nCc: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  25463. "target": 0,
  25464. "dataset": "other",
  25465. "idx": 306315
  25466. },
  25467. {
  25468. "func": "static void ov511_pkt_scan(struct gspca_dev *gspca_dev,\n\t\t\tu8 *in,\t\t\t/* isoc packet */\n\t\t\tint len)\t\t/* iso packet length */\n{\n\tstruct sd *sd = (struct sd *) gspca_dev;\n\n\t/* SOF/EOF packets have 1st to 8th bytes zeroed and the 9th\n\t * byte non-zero. The EOF packet has image width/height in the\n\t * 10th and 11th bytes. The 9th byte is given as follows:\n\t *\n\t * bit 7: EOF\n\t * 6: compression enabled\n\t * 5: 422/420/400 modes\n\t * 4: 422/420/400 modes\n\t * 3: 1\n\t * 2: snapshot button on\n\t * 1: snapshot frame\n\t * 0: even/odd field\n\t */\n\tif (!(in[0] | in[1] | in[2] | in[3] | in[4] | in[5] | in[6] | in[7]) &&\n\t (in[8] & 0x08)) {\n\t\tov51x_handle_button(gspca_dev, (in[8] >> 2) & 1);\n\t\tif (in[8] & 0x80) {\n\t\t\t/* Frame end */\n\t\t\tif ((in[9] + 1) * 8 != gspca_dev->pixfmt.width ||\n\t\t\t (in[10] + 1) * 8 != gspca_dev->pixfmt.height) {\n\t\t\t\tgspca_err(gspca_dev, \"Invalid frame size, got: %dx%d, requested: %dx%d\\n\",\n\t\t\t\t\t (in[9] + 1) * 8, (in[10] + 1) * 8,\n\t\t\t\t\t gspca_dev->pixfmt.width,\n\t\t\t\t\t gspca_dev->pixfmt.height);\n\t\t\t\tgspca_dev->last_packet_type = DISCARD_PACKET;\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t/* Add 11 byte footer to frame, might be useful */\n\t\t\tgspca_frame_add(gspca_dev, LAST_PACKET, in, 11);\n\t\t\treturn;\n\t\t} else {\n\t\t\t/* Frame start */\n\t\t\tgspca_frame_add(gspca_dev, FIRST_PACKET, in, 0);\n\t\t\tsd->packet_nr = 0;\n\t\t}\n\t}\n\n\t/* Ignore the packet number */\n\tlen--;\n\n\t/* intermediate packet */\n\tgspca_frame_add(gspca_dev, INTER_PACKET, in, len);\n}",
  25469. "project": "linux",
  25470. "hash": 150382074378047696838928351353155261202,
  25471. "size": 49,
  25472. "commit_id": "998912346c0da53a6dbb71fab3a138586b596b30",
  25473. "message": "media: ov519: add missing endpoint sanity checks\n\nMake sure to check that we have at least one endpoint before accessing\nthe endpoint array to avoid dereferencing a NULL-pointer on stream\nstart.\n\nNote that these sanity checks are not redundant as the driver is mixing\nlooking up altsettings by index and by number, which need not coincide.\n\nFixes: 1876bb923c98 (\"V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge\")\nFixes: b282d87332f5 (\"V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)\")\nCc: stable <stable@vger.kernel.org> # 2.6.31\nCc: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  25474. "target": 0,
  25475. "dataset": "other",
  25476. "idx": 306284
  25477. },
  25478. {
  25479. "func": "static void ov51x_handle_button(struct gspca_dev *gspca_dev, u8 state)\n{\n\tstruct sd *sd = (struct sd *) gspca_dev;\n\n\tif (sd->snapshot_pressed != state) {\n#if IS_ENABLED(CONFIG_INPUT)\n\t\tinput_report_key(gspca_dev->input_dev, KEY_CAMERA, state);\n\t\tinput_sync(gspca_dev->input_dev);\n#endif\n\t\tif (state)\n\t\t\tsd->snapshot_needs_reset = 1;\n\n\t\tsd->snapshot_pressed = state;\n\t} else {\n\t\t/* On the ov511 / ov519 we need to reset the button state\n\t\t multiple times, as resetting does not work as long as the\n\t\t button stays pressed */\n\t\tswitch (sd->bridge) {\n\t\tcase BRIDGE_OV511:\n\t\tcase BRIDGE_OV511PLUS:\n\t\tcase BRIDGE_OV519:\n\t\t\tif (state)\n\t\t\t\tsd->snapshot_needs_reset = 1;\n\t\t\tbreak;\n\t\t}\n\t}\n}",
  25480. "project": "linux",
  25481. "hash": 150857478172841990234806162599780883915,
  25482. "size": 27,
  25483. "commit_id": "998912346c0da53a6dbb71fab3a138586b596b30",
  25484. "message": "media: ov519: add missing endpoint sanity checks\n\nMake sure to check that we have at least one endpoint before accessing\nthe endpoint array to avoid dereferencing a NULL-pointer on stream\nstart.\n\nNote that these sanity checks are not redundant as the driver is mixing\nlooking up altsettings by index and by number, which need not coincide.\n\nFixes: 1876bb923c98 (\"V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge\")\nFixes: b282d87332f5 (\"V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)\")\nCc: stable <stable@vger.kernel.org> # 2.6.31\nCc: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  25485. "target": 0,
  25486. "dataset": "other",
  25487. "idx": 306289
  25488. },
  25489. {
  25490. "func": "static void sd_pkt_scan(struct gspca_dev *gspca_dev,\n\t\t\tu8 *data,\t\t\t/* isoc packet */\n\t\t\tint len)\t\t\t/* iso packet length */\n{\n\tstruct sd *sd = (struct sd *) gspca_dev;\n\n\tswitch (sd->bridge) {\n\tcase BRIDGE_OV511:\n\tcase BRIDGE_OV511PLUS:\n\t\tov511_pkt_scan(gspca_dev, data, len);\n\t\tbreak;\n\tcase BRIDGE_OV518:\n\tcase BRIDGE_OV518PLUS:\n\t\tov518_pkt_scan(gspca_dev, data, len);\n\t\tbreak;\n\tcase BRIDGE_OV519:\n\t\tov519_pkt_scan(gspca_dev, data, len);\n\t\tbreak;\n\tcase BRIDGE_OVFX2:\n\t\tovfx2_pkt_scan(gspca_dev, data, len);\n\t\tbreak;\n\tcase BRIDGE_W9968CF:\n\t\tw9968cf_pkt_scan(gspca_dev, data, len);\n\t\tbreak;\n\t}\n}",
  25491. "project": "linux",
  25492. "hash": 42331720888348708290121231729787661928,
  25493. "size": 26,
  25494. "commit_id": "998912346c0da53a6dbb71fab3a138586b596b30",
  25495. "message": "media: ov519: add missing endpoint sanity checks\n\nMake sure to check that we have at least one endpoint before accessing\nthe endpoint array to avoid dereferencing a NULL-pointer on stream\nstart.\n\nNote that these sanity checks are not redundant as the driver is mixing\nlooking up altsettings by index and by number, which need not coincide.\n\nFixes: 1876bb923c98 (\"V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge\")\nFixes: b282d87332f5 (\"V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)\")\nCc: stable <stable@vger.kernel.org> # 2.6.31\nCc: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  25496. "target": 0,
  25497. "dataset": "other",
  25498. "idx": 306328
  25499. },
  25500. {
  25501. "func": "static void ovfx2_pkt_scan(struct gspca_dev *gspca_dev,\n\t\t\tu8 *data,\t\t\t/* isoc packet */\n\t\t\tint len)\t\t\t/* iso packet length */\n{\n\tstruct sd *sd = (struct sd *) gspca_dev;\n\n\tgspca_frame_add(gspca_dev, INTER_PACKET, data, len);\n\n\t/* A short read signals EOF */\n\tif (len < gspca_dev->cam.bulk_size) {\n\t\t/* If the frame is short, and it is one of the first ones\n\t\t the sensor and bridge are still syncing, so drop it. */\n\t\tif (sd->first_frame) {\n\t\t\tsd->first_frame--;\n\t\t\tif (gspca_dev->image_len <\n\t\t\t\t sd->gspca_dev.pixfmt.width *\n\t\t\t\t\tsd->gspca_dev.pixfmt.height)\n\t\t\t\tgspca_dev->last_packet_type = DISCARD_PACKET;\n\t\t}\n\t\tgspca_frame_add(gspca_dev, LAST_PACKET, NULL, 0);\n\t\tgspca_frame_add(gspca_dev, FIRST_PACKET, NULL, 0);\n\t}\n}",
  25502. "project": "linux",
  25503. "hash": 144041765687203630765986724315242396265,
  25504. "size": 23,
  25505. "commit_id": "998912346c0da53a6dbb71fab3a138586b596b30",
  25506. "message": "media: ov519: add missing endpoint sanity checks\n\nMake sure to check that we have at least one endpoint before accessing\nthe endpoint array to avoid dereferencing a NULL-pointer on stream\nstart.\n\nNote that these sanity checks are not redundant as the driver is mixing\nlooking up altsettings by index and by number, which need not coincide.\n\nFixes: 1876bb923c98 (\"V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge\")\nFixes: b282d87332f5 (\"V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)\")\nCc: stable <stable@vger.kernel.org> # 2.6.31\nCc: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  25507. "target": 0,
  25508. "dataset": "other",
  25509. "idx": 306305
  25510. },
  25511. {
  25512. "func": "static void ov519_pkt_scan(struct gspca_dev *gspca_dev,\n\t\t\tu8 *data,\t\t\t/* isoc packet */\n\t\t\tint len)\t\t\t/* iso packet length */\n{\n\t/* Header of ov519 is 16 bytes:\n\t * Byte Value Description\n\t *\t0\t0xff\tmagic\n\t *\t1\t0xff\tmagic\n\t *\t2\t0xff\tmagic\n\t *\t3\t0xXX\t0x50 = SOF, 0x51 = EOF\n\t *\t9\t0xXX\t0x01 initial frame without data,\n\t *\t\t\t0x00 standard frame with image\n\t *\t14\tLo\tin EOF: length of image data / 8\n\t *\t15\tHi\n\t */\n\n\tif (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) {\n\t\tswitch (data[3]) {\n\t\tcase 0x50:\t\t/* start of frame */\n\t\t\t/* Don't check the button state here, as the state\n\t\t\t usually (always ?) changes at EOF and checking it\n\t\t\t here leads to unnecessary snapshot state resets. */\n#define HDRSZ 16\n\t\t\tdata += HDRSZ;\n\t\t\tlen -= HDRSZ;\n#undef HDRSZ\n\t\t\tif (data[0] == 0xff || data[1] == 0xd8)\n\t\t\t\tgspca_frame_add(gspca_dev, FIRST_PACKET,\n\t\t\t\t\t\tdata, len);\n\t\t\telse\n\t\t\t\tgspca_dev->last_packet_type = DISCARD_PACKET;\n\t\t\treturn;\n\t\tcase 0x51:\t\t/* end of frame */\n\t\t\tov51x_handle_button(gspca_dev, data[11] & 1);\n\t\t\tif (data[9] != 0)\n\t\t\t\tgspca_dev->last_packet_type = DISCARD_PACKET;\n\t\t\tgspca_frame_add(gspca_dev, LAST_PACKET,\n\t\t\t\t\tNULL, 0);\n\t\t\treturn;\n\t\t}\n\t}\n\n\t/* intermediate packet */\n\tgspca_frame_add(gspca_dev, INTER_PACKET, data, len);\n}",
  25513. "project": "linux",
  25514. "hash": 239224543887259682507551553288128195332,
  25515. "size": 45,
  25516. "commit_id": "998912346c0da53a6dbb71fab3a138586b596b30",
  25517. "message": "media: ov519: add missing endpoint sanity checks\n\nMake sure to check that we have at least one endpoint before accessing\nthe endpoint array to avoid dereferencing a NULL-pointer on stream\nstart.\n\nNote that these sanity checks are not redundant as the driver is mixing\nlooking up altsettings by index and by number, which need not coincide.\n\nFixes: 1876bb923c98 (\"V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge\")\nFixes: b282d87332f5 (\"V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)\")\nCc: stable <stable@vger.kernel.org> # 2.6.31\nCc: Hans de Goede <hdegoede@redhat.com>\nSigned-off-by: Johan Hovold <johan@kernel.org>\nSigned-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>\nSigned-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>",
  25518. "target": 0,
  25519. "dataset": "other",
  25520. "idx": 306286
  25521. }
  25522. ]
  25523. },
  25524. {
  25525. "call_depth": 3,
  25526. "longest_call_chain": [
  25527. "GetImageExtrema",
  25528. "GetImageChannelExtrema",
  25529. "GetImageChannelRange"
  25530. ],
  25531. "group_size": 3,
  25532. "functions": [
  25533. {
  25534. "func": "MagickExport MagickBooleanType GetImageExtrema(const Image *image,\n size_t *minima,size_t *maxima,ExceptionInfo *exception)\n{\n MagickBooleanType\n status;\n\n status=GetImageChannelExtrema(image,CompositeChannels,minima,maxima,\n exception);\n return(status);\n}",
  25535. "project": "ImageMagick6",
  25536. "hash": 89620588890280348783199772202386886778,
  25537. "size": 10,
  25538. "commit_id": "072d7b10dbe74d1cf4ec0d008990c1a28c076f9e",
  25539. "message": "https://github.com/ImageMagick/ImageMagick/issues/3332",
  25540. "target": 0,
  25541. "dataset": "other",
  25542. "idx": 279671
  25543. },
  25544. {
  25545. "func": "MagickExport MagickBooleanType GetImageChannelRange(const Image *image,\n const ChannelType channel,double *minima,double *maxima,\n ExceptionInfo *exception)\n{\n MagickPixelPacket\n pixel;\n\n ssize_t\n y;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n *maxima=(-MagickMaximumValue);\n *minima=MagickMaximumValue;\n GetMagickPixelPacket(image,&pixel);\n for (y=0; y < (ssize_t) image->rows; y++)\n {\n const IndexPacket\n *magick_restrict indexes;\n\n const PixelPacket\n *magick_restrict p;\n\n ssize_t\n x;\n\n p=GetVirtualPixels(image,0,y,image->columns,1,exception);\n if (p == (const PixelPacket *) NULL)\n break;\n indexes=GetVirtualIndexQueue(image);\n for (x=0; x < (ssize_t) image->columns; x++)\n {\n SetMagickPixelPacket(image,p,indexes+x,&pixel);\n if ((channel & RedChannel) != 0)\n {\n if (pixel.red < *minima)\n *minima=(double) pixel.red;\n if (pixel.red > *maxima)\n *maxima=(double) pixel.red;\n }\n if ((channel & GreenChannel) != 0)\n {\n if (pixel.green < *minima)\n *minima=(double) pixel.green;\n if (pixel.green > *maxima)\n *maxima=(double) pixel.green;\n }\n if ((channel & BlueChannel) != 0)\n {\n if (pixel.blue < *minima)\n *minima=(double) pixel.blue;\n if (pixel.blue > *maxima)\n *maxima=(double) pixel.blue;\n }\n if (((channel & OpacityChannel) != 0) && (image->matte != MagickFalse))\n {\n if ((QuantumRange-pixel.opacity) < *minima)\n *minima=(double) (QuantumRange-pixel.opacity);\n if ((QuantumRange-pixel.opacity) > *maxima)\n *maxima=(double) (QuantumRange-pixel.opacity);\n }\n if (((channel & IndexChannel) != 0) &&\n (image->colorspace == CMYKColorspace))\n {\n if ((double) pixel.index < *minima)\n *minima=(double) pixel.index;\n if ((double) pixel.index > *maxima)\n *maxima=(double) pixel.index;\n }\n p++;\n }\n }\n return(y == (ssize_t) image->rows ? MagickTrue : MagickFalse);\n}",
  25546. "project": "ImageMagick6",
  25547. "hash": 295910190258527588056872618957129473125,
  25548. "size": 76,
  25549. "commit_id": "072d7b10dbe74d1cf4ec0d008990c1a28c076f9e",
  25550. "message": "https://github.com/ImageMagick/ImageMagick/issues/3332",
  25551. "target": 0,
  25552. "dataset": "other",
  25553. "idx": 279669
  25554. },
  25555. {
  25556. "func": "MagickExport MagickBooleanType GetImageChannelExtrema(const Image *image,\n const ChannelType channel,size_t *minima,size_t *maxima,\n ExceptionInfo *exception)\n{\n double\n max,\n min;\n\n MagickBooleanType\n status;\n\n assert(image != (Image *) NULL);\n assert(image->signature == MagickCoreSignature);\n if (image->debug != MagickFalse)\n (void) LogMagickEvent(TraceEvent,GetMagickModule(),\"%s\",image->filename);\n status=GetImageChannelRange(image,channel,&min,&max,exception);\n *minima=(size_t) ceil(min-0.5);\n *maxima=(size_t) floor(max+0.5);\n return(status);\n}",
  25557. "project": "ImageMagick6",
  25558. "hash": 273808305612378625434513217201000660308,
  25559. "size": 20,
  25560. "commit_id": "072d7b10dbe74d1cf4ec0d008990c1a28c076f9e",
  25561. "message": "https://github.com/ImageMagick/ImageMagick/issues/3332",
  25562. "target": 0,
  25563. "dataset": "other",
  25564. "idx": 279659
  25565. }
  25566. ]
  25567. },
  25568. {
  25569. "call_depth": 3,
  25570. "longest_call_chain": [
  25571. "ip6_flush_pending_frames",
  25572. "__ip6_flush_pending_frames",
  25573. "ip6_cork_release"
  25574. ],
  25575. "group_size": 3,
  25576. "functions": [
  25577. {
  25578. "func": "static void __ip6_flush_pending_frames(struct sock *sk,\n\t\t\t\t struct sk_buff_head *queue,\n\t\t\t\t struct inet_cork_full *cork,\n\t\t\t\t struct inet6_cork *v6_cork)\n{\n\tstruct sk_buff *skb;\n\n\twhile ((skb = __skb_dequeue_tail(queue)) != NULL) {\n\t\tif (skb_dst(skb))\n\t\t\tIP6_INC_STATS(sock_net(sk), ip6_dst_idev(skb_dst(skb)),\n\t\t\t\t IPSTATS_MIB_OUTDISCARDS);\n\t\tkfree_skb(skb);\n\t}\n\n\tip6_cork_release(cork, v6_cork);\n}",
  25579. "project": "net",
  25580. "hash": 274902406864810533615672445424423331100,
  25581. "size": 16,
  25582. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  25583. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  25584. "target": 0,
  25585. "dataset": "other",
  25586. "idx": 468976
  25587. },
  25588. {
  25589. "func": "static void ip6_cork_release(struct inet_cork_full *cork,\n\t\t\t struct inet6_cork *v6_cork)\n{\n\tif (v6_cork->opt) {\n\t\tkfree(v6_cork->opt->dst0opt);\n\t\tkfree(v6_cork->opt->dst1opt);\n\t\tkfree(v6_cork->opt->hopopt);\n\t\tkfree(v6_cork->opt->srcrt);\n\t\tkfree(v6_cork->opt);\n\t\tv6_cork->opt = NULL;\n\t}\n\n\tif (cork->base.dst) {\n\t\tdst_release(cork->base.dst);\n\t\tcork->base.dst = NULL;\n\t\tcork->base.flags &= ~IPCORK_ALLFRAG;\n\t}\n\tmemset(&cork->fl, 0, sizeof(cork->fl));\n}",
  25590. "project": "net",
  25591. "hash": 305072947236491870073283779322394490711,
  25592. "size": 19,
  25593. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  25594. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  25595. "target": 0,
  25596. "dataset": "other",
  25597. "idx": 468937
  25598. },
  25599. {
  25600. "func": "void ip6_flush_pending_frames(struct sock *sk)\n{\n\t__ip6_flush_pending_frames(sk, &sk->sk_write_queue,\n\t\t\t\t &inet_sk(sk)->cork, &inet6_sk(sk)->cork);\n}",
  25601. "project": "net",
  25602. "hash": 160316371858776337464461155047973262285,
  25603. "size": 5,
  25604. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  25605. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  25606. "target": 0,
  25607. "dataset": "other",
  25608. "idx": 468987
  25609. }
  25610. ]
  25611. },
  25612. {
  25613. "call_depth": 3,
  25614. "longest_call_chain": [
  25615. "finalize",
  25616. "copy_up_to",
  25617. "append"
  25618. ],
  25619. "group_size": 5,
  25620. "functions": [
  25621. {
  25622. "func": " void append(char c) {\n assertx(p < end);\n *p++ = c;\n }",
  25623. "project": "hhvm",
  25624. "hash": 194270187745004253098062412131397465113,
  25625. "size": 4,
  25626. "commit_id": "b3679121bb3c7017ff04b4c08402ffff5cf59b13",
  25627. "message": "Fix buffer overrun in SimpleParser::handleBackslash\n\nSummary:\nIt read 4 chars, then checked for validity, but any of them could have\nbeen the end of the string, so check after each one instead.\n\nReviewed By: oulgen\n\nDifferential Revision: D19611163\n\nfbshipit-source-id: 3da0a39555cb85a93f4fd98048368f17cf37e2e4",
  25628. "target": 0,
  25629. "dataset": "other",
  25630. "idx": 227312
  25631. },
  25632. {
  25633. "func": "UnicodeString::append(UChar32 srcChar) {\n UChar buffer[U16_MAX_LENGTH];\n int32_t _length = 0;\n UBool isError = FALSE;\n U16_APPEND(buffer, _length, U16_MAX_LENGTH, srcChar, isError);\n // We test isError so that the compiler does not complain that we don't.\n // If isError then _length==0 which turns the doAppend() into a no-op anyway.\n return isError ? *this : doAppend(buffer, 0, _length);\n}",
  25634. "project": "icu",
  25635. "hash": 185527043463868504648827379672231453375,
  25636. "size": 9,
  25637. "commit_id": "b7d08bc04a4296982fcef8b6b8a354a9e4e7afca",
  25638. "message": "ICU-20958 Prevent SEGV_MAPERR in append\n\nSee #971",
  25639. "target": 0,
  25640. "dataset": "other",
  25641. "idx": 430794
  25642. },
  25643. {
  25644. "func": " bool append(Rewritable_query_parameter *p)\n {\n if (copy_up_to(p->pos_in_query) || p->append_for_log(thd, dst))\n return true;\n from= p->pos_in_query + p->len_in_query;\n return false;\n }",
  25645. "target": 0,
  25646. "cwe": [
  25647. "CWE-617"
  25648. ],
  25649. "project": "server",
  25650. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  25651. "hash": 250858376201301816218606440955927257246,
  25652. "size": 7,
  25653. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  25654. "dataset": "other",
  25655. "idx": 509165
  25656. },
  25657. {
  25658. "func": " bool finalize()\n { return copy_up_to(src_len); }",
  25659. "target": 0,
  25660. "cwe": [
  25661. "CWE-617"
  25662. ],
  25663. "project": "server",
  25664. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  25665. "hash": 186729004682616344182386535774793539415,
  25666. "size": 2,
  25667. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  25668. "dataset": "other",
  25669. "idx": 508929
  25670. },
  25671. {
  25672. "func": " bool copy_up_to(size_t bytes)\n {\n DBUG_ASSERT(bytes >= from);\n return dst->append(src + from, uint32(bytes - from));\n }",
  25673. "target": 0,
  25674. "cwe": [
  25675. "CWE-617"
  25676. ],
  25677. "project": "server",
  25678. "commit_id": "2e7891080667c59ac80f788eef4d59d447595772",
  25679. "hash": 60278060354674197881302339153674598560,
  25680. "size": 5,
  25681. "message": "MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view\n\nThis bug could manifest itself after pushing a where condition over a\nmergeable derived table / view / CTE DT into a grouping view / derived\ntable / CTE V whose item list contained set functions with constant\narguments such as MIN(2), SUM(1) etc. In such cases the field references\nused in the condition pushed into the view V that correspond set functions\nare wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation\nof the virtual method const_item() for the class Item_direct_view_ref the\nwrapped set functions with constant arguments could be erroneously taken\nfor constant items. This could lead to a wrong result set returned by the\nmain select query in 10.2. In 10.4 where a possibility of pushing condition\nfrom HAVING into WHERE had been added this could cause a crash.\n\nApproved by Sergey Petrunya <sergey.petrunya@mariadb.com>",
  25682. "dataset": "other",
  25683. "idx": 509289
  25684. }
  25685. ]
  25686. },
  25687. {
  25688. "call_depth": 3,
  25689. "longest_call_chain": [
  25690. "ctnetlink_del_conntrack",
  25691. "ctnetlink_flush_conntrack",
  25692. "ctnetlink_needs_filter"
  25693. ],
  25694. "group_size": 4,
  25695. "functions": [
  25696. {
  25697. "func": "static int ctnetlink_flush_conntrack(struct net *net,\n\t\t\t\t const struct nlattr * const cda[],\n\t\t\t\t u32 portid, int report, u8 family)\n{\n\tstruct ctnetlink_filter *filter = NULL;\n\n\tif (ctnetlink_needs_filter(family, cda)) {\n\t\tif (cda[CTA_FILTER])\n\t\t\treturn -EOPNOTSUPP;\n\n\t\tfilter = ctnetlink_alloc_filter(cda, family);\n\t\tif (IS_ERR(filter))\n\t\t\treturn PTR_ERR(filter);\n\t}\n\n\tnf_ct_iterate_cleanup_net(net, ctnetlink_flush_iterate, filter,\n\t\t\t\t portid, report);\n\tkfree(filter);\n\n\treturn 0;\n}",
  25698. "project": "linux",
  25699. "hash": 297756815088480192333216843352414705469,
  25700. "size": 21,
  25701. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  25702. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  25703. "target": 0,
  25704. "dataset": "other",
  25705. "idx": 394240
  25706. },
  25707. {
  25708. "func": "static int ctnetlink_start(struct netlink_callback *cb)\n{\n\tconst struct nlattr * const *cda = cb->data;\n\tstruct ctnetlink_filter *filter = NULL;\n\tstruct nfgenmsg *nfmsg = nlmsg_data(cb->nlh);\n\tu8 family = nfmsg->nfgen_family;\n\n\tif (ctnetlink_needs_filter(family, cda)) {\n\t\tfilter = ctnetlink_alloc_filter(cda, family);\n\t\tif (IS_ERR(filter))\n\t\t\treturn PTR_ERR(filter);\n\t}\n\n\tcb->data = filter;\n\treturn 0;\n}",
  25709. "project": "linux",
  25710. "hash": 159580088770228980568785488949841904057,
  25711. "size": 16,
  25712. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  25713. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  25714. "target": 0,
  25715. "dataset": "other",
  25716. "idx": 394264
  25717. },
  25718. {
  25719. "func": "static bool ctnetlink_needs_filter(u8 family, const struct nlattr * const *cda)\n{\n\treturn family || cda[CTA_MARK] || cda[CTA_FILTER];\n}",
  25720. "project": "linux",
  25721. "hash": 28363253343194961682266834953341645937,
  25722. "size": 4,
  25723. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  25724. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  25725. "target": 0,
  25726. "dataset": "other",
  25727. "idx": 394263
  25728. },
  25729. {
  25730. "func": "static int ctnetlink_del_conntrack(struct net *net, struct sock *ctnl,\n\t\t\t\t struct sk_buff *skb,\n\t\t\t\t const struct nlmsghdr *nlh,\n\t\t\t\t const struct nlattr * const cda[],\n\t\t\t\t struct netlink_ext_ack *extack)\n{\n\tstruct nf_conntrack_tuple_hash *h;\n\tstruct nf_conntrack_tuple tuple;\n\tstruct nf_conn *ct;\n\tstruct nfgenmsg *nfmsg = nlmsg_data(nlh);\n\tstruct nf_conntrack_zone zone;\n\tint err;\n\n\terr = ctnetlink_parse_zone(cda[CTA_ZONE], &zone);\n\tif (err < 0)\n\t\treturn err;\n\n\tif (cda[CTA_TUPLE_ORIG])\n\t\terr = ctnetlink_parse_tuple(cda, &tuple, CTA_TUPLE_ORIG,\n\t\t\t\t\t nfmsg->nfgen_family, &zone);\n\telse if (cda[CTA_TUPLE_REPLY])\n\t\terr = ctnetlink_parse_tuple(cda, &tuple, CTA_TUPLE_REPLY,\n\t\t\t\t\t nfmsg->nfgen_family, &zone);\n\telse {\n\t\tu_int8_t u3 = nfmsg->version ? nfmsg->nfgen_family : AF_UNSPEC;\n\n\t\treturn ctnetlink_flush_conntrack(net, cda,\n\t\t\t\t\t\t NETLINK_CB(skb).portid,\n\t\t\t\t\t\t nlmsg_report(nlh), u3);\n\t}\n\n\tif (err < 0)\n\t\treturn err;\n\n\th = nf_conntrack_find_get(net, &zone, &tuple);\n\tif (!h)\n\t\treturn -ENOENT;\n\n\tct = nf_ct_tuplehash_to_ctrack(h);\n\n\tif (test_bit(IPS_OFFLOAD_BIT, &ct->status)) {\n\t\tnf_ct_put(ct);\n\t\treturn -EBUSY;\n\t}\n\n\tif (cda[CTA_ID]) {\n\t\t__be32 id = nla_get_be32(cda[CTA_ID]);\n\n\t\tif (id != (__force __be32)nf_ct_get_id(ct)) {\n\t\t\tnf_ct_put(ct);\n\t\t\treturn -ENOENT;\n\t\t}\n\t}\n\n\tnf_ct_delete(ct, NETLINK_CB(skb).portid, nlmsg_report(nlh));\n\tnf_ct_put(ct);\n\n\treturn 0;\n}",
  25731. "project": "linux",
  25732. "hash": 199519794799093900485088046311685364658,
  25733. "size": 59,
  25734. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  25735. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  25736. "target": 0,
  25737. "dataset": "other",
  25738. "idx": 394209
  25739. }
  25740. ]
  25741. },
  25742. {
  25743. "call_depth": 3,
  25744. "longest_call_chain": [
  25745. "~FastHufDecoder",
  25746. "FastHufDecoder",
  25747. "readBits"
  25748. ],
  25749. "group_size": 5,
  25750. "functions": [
  25751. {
  25752. "func": "FastHufDecoder::buildTables (Int64 *base, Int64 *offset)\n{\n //\n // Build the 'left justified' base table, by shifting base left..\n //\n\n for (int i = 0; i <= MAX_CODE_LEN; ++i)\n {\n if (base[i] != 0xffffffffffffffffULL)\n {\n _ljBase[i] = base[i] << (64 - i);\n }\n else\n {\n //\n // Unused code length - insert dummy values\n //\n\n _ljBase[i] = 0xffffffffffffffffULL;\n }\n }\n\n //\n // Combine some terms into a big fat constant, which for\n // lack of a better term we'll call the 'left justified' \n // offset table (because it serves the same function\n // as 'offset', when using the left justified base table.\n //\n\n _ljOffset[0] = offset[0] - _ljBase[0];\n for (int i = 1; i <= MAX_CODE_LEN; ++i)\n _ljOffset[i] = offset[i] - (_ljBase[i] >> (64 - i));\n\n //\n // Build the acceleration tables for the lookups of\n // short codes ( <= TABLE_LOOKUP_BITS long)\n //\n\n for (Int64 i = 0; i < 1 << TABLE_LOOKUP_BITS; ++i)\n {\n Int64 value = i << (64 - TABLE_LOOKUP_BITS);\n\n _tableSymbol[i] = 0xffff;\n _tableCodeLen[i] = 0; \n\n for (int codeLen = _minCodeLength; codeLen <= _maxCodeLength; ++codeLen)\n {\n if (_ljBase[codeLen] <= value)\n {\n _tableCodeLen[i] = codeLen;\n\n Int64 id = _ljOffset[codeLen] + (value >> (64 - codeLen));\n if (id < static_cast<Int64>(_numSymbols))\n {\n _tableSymbol[i] = _idToSymbol[id];\n }\n else\n {\n throw IEX_NAMESPACE::InputExc (\"Huffman decode error \"\n \"(Overrun).\");\n }\n break;\n }\n }\n }\n\n //\n // Store the smallest value in the table that points to real data.\n // This should be the entry for the largest length that has \n // valid data (in our case, non-dummy _ljBase)\n //\n\n int minIdx = TABLE_LOOKUP_BITS;\n\n while (minIdx > 0 && _ljBase[minIdx] == 0xffffffffffffffffULL)\n minIdx--;\n\n if (minIdx < 0)\n {\n //\n // Error, no codes with lengths 0-TABLE_LOOKUP_BITS used.\n // Set the min value such that the table is never tested.\n //\n\n _tableMin = 0xffffffffffffffffULL;\n }\n else\n {\n _tableMin = _ljBase[minIdx];\n }\n}",
  25753. "project": "openexr",
  25754. "hash": 306109955892137423713079668733673743520,
  25755. "size": 91,
  25756. "commit_id": "c3ed4a1db1f39bf4524a644cb2af81dc8cfab33f",
  25757. "message": "compute Huf codelengths using 64 bit to prevent shift overflow\n\nSigned-off-by: Peter Hillman <peterh@wetafx.co.nz>",
  25758. "target": 0,
  25759. "dataset": "other",
  25760. "idx": 413445
  25761. },
  25762. {
  25763. "func": "FastHufDecoder::readBits\n (int numBits,\n Int64 &buffer, // c\n int &bufferNumBits, // lc\n const char *&currByte) // in\n{\n while (bufferNumBits < numBits)\n {\n buffer = (buffer << 8) | *(unsigned char*)(currByte++);\n bufferNumBits += 8;\n }\n\n bufferNumBits -= numBits;\n return (buffer >> bufferNumBits) & ((1 << numBits) - 1);\n}",
  25764. "project": "openexr",
  25765. "hash": 161998660677043966011742297206927694899,
  25766. "size": 15,
  25767. "commit_id": "c3ed4a1db1f39bf4524a644cb2af81dc8cfab33f",
  25768. "message": "compute Huf codelengths using 64 bit to prevent shift overflow\n\nSigned-off-by: Peter Hillman <peterh@wetafx.co.nz>",
  25769. "target": 0,
  25770. "dataset": "other",
  25771. "idx": 413448
  25772. },
  25773. {
  25774. "func": "FastHufDecoder::FastHufDecoder\n (const char *&table,\n int numBytes,\n int minSymbol,\n int maxSymbol,\n int rleSymbol)\n:\n _rleSymbol (rleSymbol),\n _numSymbols (0),\n _minCodeLength (255),\n _maxCodeLength (0),\n _idToSymbol (0)\n{\n //\n // List of symbols that we find with non-zero code lengths\n // (listed in the order we find them). Store these in the\n // same format as the code book stores codes + lengths - \n // low 6 bits are the length, everything above that is\n // the symbol.\n //\n\n std::vector<Int64> symbols;\n\n //\n // The 'base' table is the minimum code at each code length. base[i]\n // is the smallest code (numerically) of length i.\n //\n\n Int64 base[MAX_CODE_LEN + 1]; \n\n //\n // The 'offset' table is the position (in sorted order) of the first id\n // of a given code lenght. Array is indexed by code length, like base. \n //\n\n Int64 offset[MAX_CODE_LEN + 1]; \n\n //\n // Count of how many codes at each length there are. Array is \n // indexed by code length, like base and offset.\n //\n\n size_t codeCount[MAX_CODE_LEN + 1]; \n\n for (int i = 0; i <= MAX_CODE_LEN; ++i)\n {\n codeCount[i] = 0;\n base[i] = 0xffffffffffffffffULL;\n offset[i] = 0;\n }\n\n //\n // Count the number of codes, the min/max code lengths, the number of\n // codes with each length, and record symbols with non-zero code\n // length as we find them.\n //\n\n const char *currByte = table;\n Int64 currBits = 0;\n int currBitCount = 0;\n\n const int SHORT_ZEROCODE_RUN = 59;\n const int LONG_ZEROCODE_RUN = 63;\n const int SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;\n\n for (Int64 symbol = static_cast<Int64>(minSymbol); symbol <= static_cast<Int64>(maxSymbol); symbol++)\n {\n if (currByte - table > numBytes)\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Truncated table data).\");\n }\n\n //\n // Next code length - either:\n // 0-58 (literal code length)\n // 59-62 (various lengths runs of 0)\n // 63 (run of n 0's, with n is the next 8 bits)\n //\n\n Int64 codeLen = readBits (6, currBits, currBitCount, currByte);\n\n if (codeLen == (Int64) LONG_ZEROCODE_RUN)\n {\n if (currByte - table > numBytes)\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Truncated table data).\");\n }\n\n int runLen = readBits (8, currBits, currBitCount, currByte) +\n SHORTEST_LONG_RUN;\n\n if (symbol + runLen > static_cast<Int64>(maxSymbol + 1))\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Run beyond end of table).\");\n }\n \n symbol += runLen - 1;\n\n }\n else if (codeLen >= static_cast<Int64>(SHORT_ZEROCODE_RUN))\n {\n int runLen = codeLen - SHORT_ZEROCODE_RUN + 2;\n\n if (symbol + runLen > static_cast<Int64>(maxSymbol + 1))\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Run beyond end of table).\");\n }\n\n symbol += runLen - 1;\n\n }\n else if (codeLen != 0)\n {\n symbols.push_back ((symbol << 6) | (codeLen & 63));\n\n if (codeLen < _minCodeLength)\n _minCodeLength = codeLen;\n\n if (codeLen > _maxCodeLength)\n _maxCodeLength = codeLen;\n\n codeCount[codeLen]++;\n }\n }\n\n for (int i = 0; i < MAX_CODE_LEN; ++i)\n _numSymbols += codeCount[i];\n\n table = currByte;\n\n //\n // Compute base - once we have the code length counts, there\n // is a closed form solution for this\n //\n\n {\n double* countTmp = new double[_maxCodeLength+1];\n\n for (int l = _minCodeLength; l <= _maxCodeLength; ++l)\n {\n countTmp[l] = (double)codeCount[l] * \n (double)(2 << (_maxCodeLength-l));\n }\n \n for (int l = _minCodeLength; l <= _maxCodeLength; ++l)\n {\n double tmp = 0;\n\n for (int k =l + 1; k <= _maxCodeLength; ++k)\n tmp += countTmp[k];\n \n tmp /= (double)(2 << (_maxCodeLength - l));\n\n base[l] = (Int64)ceil (tmp);\n }\n\n delete [] countTmp;\n }\n \n //\n // Compute offset - these are the positions of the first\n // id (not symbol) that has length [i]\n //\n\n offset[_maxCodeLength] = 0;\n\n for (int i= _maxCodeLength - 1; i >= _minCodeLength; i--)\n offset[i] = offset[i + 1] + codeCount[i + 1];\n\n //\n // Allocate and fill the symbol-to-id mapping. Smaller Ids should be\n // mapped to less-frequent symbols (which have longer codes). Use\n // the offset table to tell us where the id's for a given code \n // length start off.\n //\n\n _idToSymbol = new int[_numSymbols];\n\n Int64 mapping[MAX_CODE_LEN + 1];\n for (int i = 0; i < MAX_CODE_LEN + 1; ++i) \n mapping[i] = -1;\n for (int i = _minCodeLength; i <= _maxCodeLength; ++i)\n mapping[i] = offset[i];\n\n for (std::vector<Int64>::const_iterator i = symbols.begin(); \n i != symbols.end();\n ++i)\n {\n int codeLen = *i & 63;\n int symbol = *i >> 6;\n\n if (mapping[codeLen] >= static_cast<Int64>(_numSymbols))\n {\n delete[] _idToSymbol;\n _idToSymbol = NULL;\n throw IEX_NAMESPACE::InputExc (\"Huffman decode error \"\n \"(Invalid symbol in header).\");\n }\n _idToSymbol[mapping[codeLen]] = symbol;\n mapping[codeLen]++;\n }\n\n //\n // exceptions can be thrown whilst building tables. Delete\n // _idToSynmbol before re-throwing to prevent memory leak\n //\n try\n {\n buildTables(base, offset);\n }catch(...)\n {\n delete[] _idToSymbol;\n _idToSymbol = NULL;\n throw;\n }\n}",
  25775. "project": "openexr",
  25776. "hash": 295327035492456381923444384031538504049,
  25777. "size": 220,
  25778. "commit_id": "c3ed4a1db1f39bf4524a644cb2af81dc8cfab33f",
  25779. "message": "compute Huf codelengths using 64 bit to prevent shift overflow\n\nSigned-off-by: Peter Hillman <peterh@wetafx.co.nz>",
  25780. "target": 1,
  25781. "dataset": "other",
  25782. "idx": 208675
  25783. },
  25784. {
  25785. "func": "FastHufDecoder::FastHufDecoder\n (const char *&table,\n int numBytes,\n int minSymbol,\n int maxSymbol,\n int rleSymbol)\n:\n _rleSymbol (rleSymbol),\n _numSymbols (0),\n _minCodeLength (255),\n _maxCodeLength (0),\n _idToSymbol (0)\n{\n //\n // List of symbols that we find with non-zero code lengths\n // (listed in the order we find them). Store these in the\n // same format as the code book stores codes + lengths - \n // low 6 bits are the length, everything above that is\n // the symbol.\n //\n\n std::vector<Int64> symbols;\n\n //\n // The 'base' table is the minimum code at each code length. base[i]\n // is the smallest code (numerically) of length i.\n //\n\n Int64 base[MAX_CODE_LEN + 1]; \n\n //\n // The 'offset' table is the position (in sorted order) of the first id\n // of a given code lenght. Array is indexed by code length, like base. \n //\n\n Int64 offset[MAX_CODE_LEN + 1]; \n\n //\n // Count of how many codes at each length there are. Array is \n // indexed by code length, like base and offset.\n //\n\n size_t codeCount[MAX_CODE_LEN + 1]; \n\n for (int i = 0; i <= MAX_CODE_LEN; ++i)\n {\n codeCount[i] = 0;\n base[i] = 0xffffffffffffffffULL;\n offset[i] = 0;\n }\n\n //\n // Count the number of codes, the min/max code lengths, the number of\n // codes with each length, and record symbols with non-zero code\n // length as we find them.\n //\n\n const char *currByte = table;\n Int64 currBits = 0;\n int currBitCount = 0;\n\n const int SHORT_ZEROCODE_RUN = 59;\n const int LONG_ZEROCODE_RUN = 63;\n const int SHORTEST_LONG_RUN = 2 + LONG_ZEROCODE_RUN - SHORT_ZEROCODE_RUN;\n\n for (Int64 symbol = static_cast<Int64>(minSymbol); symbol <= static_cast<Int64>(maxSymbol); symbol++)\n {\n if (currByte - table > numBytes)\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Truncated table data).\");\n }\n\n //\n // Next code length - either:\n // 0-58 (literal code length)\n // 59-62 (various lengths runs of 0)\n // 63 (run of n 0's, with n is the next 8 bits)\n //\n\n Int64 codeLen = readBits (6, currBits, currBitCount, currByte);\n\n if (codeLen == (Int64) LONG_ZEROCODE_RUN)\n {\n if (currByte - table > numBytes)\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Truncated table data).\");\n }\n\n int runLen = readBits (8, currBits, currBitCount, currByte) +\n SHORTEST_LONG_RUN;\n\n if (symbol + runLen > static_cast<Int64>(maxSymbol + 1))\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Run beyond end of table).\");\n }\n \n symbol += runLen - 1;\n\n }\n else if (codeLen >= static_cast<Int64>(SHORT_ZEROCODE_RUN))\n {\n int runLen = codeLen - SHORT_ZEROCODE_RUN + 2;\n\n if (symbol + runLen > static_cast<Int64>(maxSymbol + 1))\n {\n throw IEX_NAMESPACE::InputExc (\"Error decoding Huffman table \"\n \"(Run beyond end of table).\");\n }\n\n symbol += runLen - 1;\n\n }\n else if (codeLen != 0)\n {\n symbols.push_back ((symbol << 6) | (codeLen & 63));\n\n if (codeLen < _minCodeLength)\n _minCodeLength = codeLen;\n\n if (codeLen > _maxCodeLength)\n _maxCodeLength = codeLen;\n\n codeCount[codeLen]++;\n }\n }\n\n for (int i = 0; i < MAX_CODE_LEN; ++i)\n _numSymbols += codeCount[i];\n\n table = currByte;\n\n //\n // Compute base - once we have the code length counts, there\n // is a closed form solution for this\n //\n\n {\n double* countTmp = new double[_maxCodeLength+1];\n\n for (int l = _minCodeLength; l <= _maxCodeLength; ++l)\n {\n countTmp[l] = (double)codeCount[l] * \n (double)(2ll << (_maxCodeLength-l));\n }\n \n for (int l = _minCodeLength; l <= _maxCodeLength; ++l)\n {\n double tmp = 0;\n\n for (int k =l + 1; k <= _maxCodeLength; ++k)\n tmp += countTmp[k];\n \n tmp /= (double)(2ll << (_maxCodeLength - l));\n\n base[l] = (Int64)ceil (tmp);\n }\n\n delete [] countTmp;\n }\n \n //\n // Compute offset - these are the positions of the first\n // id (not symbol) that has length [i]\n //\n\n offset[_maxCodeLength] = 0;\n\n for (int i= _maxCodeLength - 1; i >= _minCodeLength; i--)\n offset[i] = offset[i + 1] + codeCount[i + 1];\n\n //\n // Allocate and fill the symbol-to-id mapping. Smaller Ids should be\n // mapped to less-frequent symbols (which have longer codes). Use\n // the offset table to tell us where the id's for a given code \n // length start off.\n //\n\n _idToSymbol = new int[_numSymbols];\n\n Int64 mapping[MAX_CODE_LEN + 1];\n for (int i = 0; i < MAX_CODE_LEN + 1; ++i) \n mapping[i] = -1;\n for (int i = _minCodeLength; i <= _maxCodeLength; ++i)\n mapping[i] = offset[i];\n\n for (std::vector<Int64>::const_iterator i = symbols.begin(); \n i != symbols.end();\n ++i)\n {\n int codeLen = *i & 63;\n int symbol = *i >> 6;\n\n if (mapping[codeLen] >= static_cast<Int64>(_numSymbols))\n {\n delete[] _idToSymbol;\n _idToSymbol = NULL;\n throw IEX_NAMESPACE::InputExc (\"Huffman decode error \"\n \"(Invalid symbol in header).\");\n }\n _idToSymbol[mapping[codeLen]] = symbol;\n mapping[codeLen]++;\n }\n\n //\n // exceptions can be thrown whilst building tables. Delete\n // _idToSynmbol before re-throwing to prevent memory leak\n //\n try\n {\n buildTables(base, offset);\n }catch(...)\n {\n delete[] _idToSymbol;\n _idToSymbol = NULL;\n throw;\n }\n}",
  25786. "project": "openexr",
  25787. "hash": 153643357904600972132151102261211578620,
  25788. "size": 220,
  25789. "commit_id": "c3ed4a1db1f39bf4524a644cb2af81dc8cfab33f",
  25790. "message": "compute Huf codelengths using 64 bit to prevent shift overflow\n\nSigned-off-by: Peter Hillman <peterh@wetafx.co.nz>",
  25791. "target": 0,
  25792. "dataset": "other",
  25793. "idx": 413449
  25794. },
  25795. {
  25796. "func": "FastHufDecoder::~FastHufDecoder()\n{\n delete[] _idToSymbol;\n}",
  25797. "project": "openexr",
  25798. "hash": 34370562759391630391791074889164252260,
  25799. "size": 4,
  25800. "commit_id": "c3ed4a1db1f39bf4524a644cb2af81dc8cfab33f",
  25801. "message": "compute Huf codelengths using 64 bit to prevent shift overflow\n\nSigned-off-by: Peter Hillman <peterh@wetafx.co.nz>",
  25802. "target": 0,
  25803. "dataset": "other",
  25804. "idx": 413443
  25805. }
  25806. ]
  25807. },
  25808. {
  25809. "call_depth": 3,
  25810. "longest_call_chain": [
  25811. "dlpar_free_cc_nodes",
  25812. "dlpar_free_one_cc_node",
  25813. "dlpar_free_cc_property"
  25814. ],
  25815. "group_size": 3,
  25816. "functions": [
  25817. {
  25818. "func": "void dlpar_free_cc_nodes(struct device_node *dn)\n{\n\tif (dn->child)\n\t\tdlpar_free_cc_nodes(dn->child);\n\n\tif (dn->sibling)\n\t\tdlpar_free_cc_nodes(dn->sibling);\n\n\tdlpar_free_one_cc_node(dn);\n}",
  25819. "project": "linux",
  25820. "hash": 294886270254998832875064053259382175941,
  25821. "size": 10,
  25822. "commit_id": "efa9ace68e487ddd29c2b4d6dd23242158f1f607",
  25823. "message": "powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()\n\nIn dlpar_parse_cc_property(), 'prop->name' is allocated by kstrdup().\nkstrdup() may return NULL, so it should be checked and handle error.\nAnd prop should be freed if 'prop->name' is NULL.\n\nSigned-off-by: Gen Zhang <blackgod016574@gmail.com>\nSigned-off-by: Michael Ellerman <mpe@ellerman.id.au>",
  25824. "target": 0,
  25825. "dataset": "other",
  25826. "idx": 380136
  25827. },
  25828. {
  25829. "func": "void dlpar_free_cc_property(struct property *prop)\n{\n\tkfree(prop->name);\n\tkfree(prop->value);\n\tkfree(prop);\n}",
  25830. "project": "linux",
  25831. "hash": 104293824315803097735386120227292768607,
  25832. "size": 6,
  25833. "commit_id": "efa9ace68e487ddd29c2b4d6dd23242158f1f607",
  25834. "message": "powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()\n\nIn dlpar_parse_cc_property(), 'prop->name' is allocated by kstrdup().\nkstrdup() may return NULL, so it should be checked and handle error.\nAnd prop should be freed if 'prop->name' is NULL.\n\nSigned-off-by: Gen Zhang <blackgod016574@gmail.com>\nSigned-off-by: Michael Ellerman <mpe@ellerman.id.au>",
  25835. "target": 0,
  25836. "dataset": "other",
  25837. "idx": 380131
  25838. },
  25839. {
  25840. "func": "static void dlpar_free_one_cc_node(struct device_node *dn)\n{\n\tstruct property *prop;\n\n\twhile (dn->properties) {\n\t\tprop = dn->properties;\n\t\tdn->properties = prop->next;\n\t\tdlpar_free_cc_property(prop);\n\t}\n\n\tkfree(dn->full_name);\n\tkfree(dn);\n}",
  25841. "project": "linux",
  25842. "hash": 39009601055864260210951865566015111448,
  25843. "size": 13,
  25844. "commit_id": "efa9ace68e487ddd29c2b4d6dd23242158f1f607",
  25845. "message": "powerpc/pseries/dlpar: Fix a missing check in dlpar_parse_cc_property()\n\nIn dlpar_parse_cc_property(), 'prop->name' is allocated by kstrdup().\nkstrdup() may return NULL, so it should be checked and handle error.\nAnd prop should be freed if 'prop->name' is NULL.\n\nSigned-off-by: Gen Zhang <blackgod016574@gmail.com>\nSigned-off-by: Michael Ellerman <mpe@ellerman.id.au>",
  25846. "target": 0,
  25847. "dataset": "other",
  25848. "idx": 380130
  25849. }
  25850. ]
  25851. },
  25852. {
  25853. "call_depth": 3,
  25854. "longest_call_chain": [
  25855. "ntlm_compute_lm_v2_response",
  25856. "ntlm_compute_ntlm_v2_hash",
  25857. "ntlm_convert_password_hash"
  25858. ],
  25859. "group_size": 5,
  25860. "functions": [
  25861. {
  25862. "func": "int ntlm_compute_lm_v2_response(NTLM_CONTEXT* context)\n{\n\tBYTE* response;\n\tBYTE value[WINPR_MD5_DIGEST_LENGTH];\n\n\tif (context->LmCompatibilityLevel < 2)\n\t{\n\t\tif (!sspi_SecBufferAlloc(&context->LmChallengeResponse, 24))\n\t\t\treturn -1;\n\n\t\tZeroMemory(context->LmChallengeResponse.pvBuffer, 24);\n\t\treturn 1;\n\t}\n\n\t/* Compute the NTLMv2 hash */\n\n\tif (ntlm_compute_ntlm_v2_hash(context, context->NtlmV2Hash) < 0)\n\t\treturn -1;\n\n\t/* Concatenate the server and client challenges */\n\tCopyMemory(value, context->ServerChallenge, 8);\n\tCopyMemory(&value[8], context->ClientChallenge, 8);\n\n\tif (!sspi_SecBufferAlloc(&context->LmChallengeResponse, 24))\n\t\treturn -1;\n\n\tresponse = (BYTE*)context->LmChallengeResponse.pvBuffer;\n\t/* Compute the HMAC-MD5 hash of the resulting value using the NTLMv2 hash as the key */\n\twinpr_HMAC(WINPR_MD_MD5, (void*)context->NtlmV2Hash, WINPR_MD5_DIGEST_LENGTH, (BYTE*)value,\n\t WINPR_MD5_DIGEST_LENGTH, (BYTE*)response, WINPR_MD5_DIGEST_LENGTH);\n\t/* Concatenate the resulting HMAC-MD5 hash and the client challenge, giving us the LMv2 response\n\t * (24 bytes) */\n\tCopyMemory(&response[16], context->ClientChallenge, 8);\n\treturn 1;\n}",
  25863. "project": "FreeRDP",
  25864. "hash": 287281750704487996322467746096463896731,
  25865. "size": 35,
  25866. "commit_id": "c098f21fdaadca57ff649eee1674f6cc321a2ec4",
  25867. "message": "Fixed oob read in ntlm_read_ntlm_v2_response",
  25868. "target": 0,
  25869. "dataset": "other",
  25870. "idx": 424854
  25871. },
  25872. {
  25873. "func": "static int ntlm_compute_ntlm_v2_hash(NTLM_CONTEXT* context, BYTE* hash)\n{\n\tSSPI_CREDENTIALS* credentials = context->credentials;\n#ifdef WITH_DEBUG_NTLM\n\n\tif (credentials)\n\t{\n\t\tWLog_DBG(TAG, \"Password (length = %\" PRIu32 \")\", credentials->identity.PasswordLength * 2);\n\t\twinpr_HexDump(TAG, WLOG_DEBUG, (BYTE*)credentials->identity.Password,\n\t\t credentials->identity.PasswordLength * 2);\n\t\tWLog_DBG(TAG, \"Username (length = %\" PRIu32 \")\", credentials->identity.UserLength * 2);\n\t\twinpr_HexDump(TAG, WLOG_DEBUG, (BYTE*)credentials->identity.User,\n\t\t credentials->identity.UserLength * 2);\n\t\tWLog_DBG(TAG, \"Domain (length = %\" PRIu32 \")\", credentials->identity.DomainLength * 2);\n\t\twinpr_HexDump(TAG, WLOG_DEBUG, (BYTE*)credentials->identity.Domain,\n\t\t credentials->identity.DomainLength * 2);\n\t}\n\telse\n\t\tWLog_DBG(TAG, \"Strange, NTLM_CONTEXT is missing valid credentials...\");\n\n\tWLog_DBG(TAG, \"Workstation (length = %\" PRIu16 \")\", context->Workstation.Length);\n\twinpr_HexDump(TAG, WLOG_DEBUG, (BYTE*)context->Workstation.Buffer, context->Workstation.Length);\n\tWLog_DBG(TAG, \"NTOWFv2, NTLMv2 Hash\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, context->NtlmV2Hash, WINPR_MD5_DIGEST_LENGTH);\n#endif\n\n\tif (memcmp(context->NtlmV2Hash, NTLM_NULL_BUFFER, 16) != 0)\n\t\treturn 1;\n\n\tif (!credentials)\n\t\treturn -1;\n\telse if (memcmp(context->NtlmHash, NTLM_NULL_BUFFER, 16) != 0)\n\t{\n\t\tNTOWFv2FromHashW(context->NtlmHash, (LPWSTR)credentials->identity.User,\n\t\t credentials->identity.UserLength * 2, (LPWSTR)credentials->identity.Domain,\n\t\t credentials->identity.DomainLength * 2, (BYTE*)hash);\n\t}\n\telse if (credentials->identity.PasswordLength > SSPI_CREDENTIALS_HASH_LENGTH_OFFSET)\n\t{\n\t\t/* Special case for WinPR: password hash */\n\t\tif (ntlm_convert_password_hash(context, context->NtlmHash) < 0)\n\t\t\treturn -1;\n\n\t\tNTOWFv2FromHashW(context->NtlmHash, (LPWSTR)credentials->identity.User,\n\t\t credentials->identity.UserLength * 2, (LPWSTR)credentials->identity.Domain,\n\t\t credentials->identity.DomainLength * 2, (BYTE*)hash);\n\t}\n\telse if (credentials->identity.Password)\n\t{\n\t\tNTOWFv2W((LPWSTR)credentials->identity.Password, credentials->identity.PasswordLength * 2,\n\t\t (LPWSTR)credentials->identity.User, credentials->identity.UserLength * 2,\n\t\t (LPWSTR)credentials->identity.Domain, credentials->identity.DomainLength * 2,\n\t\t (BYTE*)hash);\n\t}\n\telse if (context->HashCallback)\n\t{\n\t\tint ret;\n\t\tSecBuffer proofValue, micValue;\n\n\t\tif (ntlm_computeProofValue(context, &proofValue) != SEC_E_OK)\n\t\t\treturn -1;\n\n\t\tif (ntlm_computeMicValue(context, &micValue) != SEC_E_OK)\n\t\t{\n\t\t\tsspi_SecBufferFree(&proofValue);\n\t\t\treturn -1;\n\t\t}\n\n\t\tret = context->HashCallback(context->HashCallbackArg, &credentials->identity, &proofValue,\n\t\t context->EncryptedRandomSessionKey,\n\t\t (&context->AUTHENTICATE_MESSAGE)->MessageIntegrityCheck,\n\t\t &micValue, hash);\n\t\tsspi_SecBufferFree(&proofValue);\n\t\tsspi_SecBufferFree(&micValue);\n\t\treturn ret ? 1 : -1;\n\t}\n\telse if (context->UseSamFileDatabase)\n\t{\n\t\treturn ntlm_fetch_ntlm_v2_hash(context, hash);\n\t}\n\n\treturn 1;\n}",
  25874. "project": "FreeRDP",
  25875. "hash": 104785729071403500667549068738056476351,
  25876. "size": 83,
  25877. "commit_id": "c098f21fdaadca57ff649eee1674f6cc321a2ec4",
  25878. "message": "Fixed oob read in ntlm_read_ntlm_v2_response",
  25879. "target": 0,
  25880. "dataset": "other",
  25881. "idx": 424876
  25882. },
  25883. {
  25884. "func": "static int ntlm_convert_password_hash(NTLM_CONTEXT* context, BYTE* hash)\n{\n\tint status;\n\tint i, hn, ln;\n\tchar* PasswordHash = NULL;\n\tUINT32 PasswordHashLength = 0;\n\tSSPI_CREDENTIALS* credentials = context->credentials;\n\t/* Password contains a password hash of length (PasswordLength -\n\t * SSPI_CREDENTIALS_HASH_LENGTH_OFFSET) */\n\tPasswordHashLength = credentials->identity.PasswordLength - SSPI_CREDENTIALS_HASH_LENGTH_OFFSET;\n\tstatus = ConvertFromUnicode(CP_UTF8, 0, (LPCWSTR)credentials->identity.Password,\n\t PasswordHashLength, &PasswordHash, 0, NULL, NULL);\n\n\tif (status <= 0)\n\t\treturn -1;\n\n\tCharUpperBuffA(PasswordHash, PasswordHashLength);\n\n\tfor (i = 0; i < 32; i += 2)\n\t{\n\t\thn = PasswordHash[i] > '9' ? PasswordHash[i] - 'A' + 10 : PasswordHash[i] - '0';\n\t\tln = PasswordHash[i + 1] > '9' ? PasswordHash[i + 1] - 'A' + 10 : PasswordHash[i + 1] - '0';\n\t\thash[i / 2] = (hn << 4) | ln;\n\t}\n\n\tfree(PasswordHash);\n\treturn 1;\n}",
  25885. "project": "FreeRDP",
  25886. "hash": 140653494673210334616659165600908872734,
  25887. "size": 28,
  25888. "commit_id": "c098f21fdaadca57ff649eee1674f6cc321a2ec4",
  25889. "message": "Fixed oob read in ntlm_read_ntlm_v2_response",
  25890. "target": 0,
  25891. "dataset": "other",
  25892. "idx": 424856
  25893. },
  25894. {
  25895. "func": "static int ntlm_fetch_ntlm_v2_hash(NTLM_CONTEXT* context, BYTE* hash)\n{\n\tWINPR_SAM* sam;\n\tWINPR_SAM_ENTRY* entry;\n\tSSPI_CREDENTIALS* credentials = context->credentials;\n\tsam = SamOpen(context->SamFile, TRUE);\n\n\tif (!sam)\n\t\treturn -1;\n\n\tentry = SamLookupUserW(\n\t sam, (LPWSTR)credentials->identity.User, credentials->identity.UserLength * 2,\n\t (LPWSTR)credentials->identity.Domain, credentials->identity.DomainLength * 2);\n\n\tif (entry)\n\t{\n#ifdef WITH_DEBUG_NTLM\n\t\tWLog_DBG(TAG, \"NTLM Hash:\");\n\t\twinpr_HexDump(TAG, WLOG_DEBUG, entry->NtHash, 16);\n#endif\n\t\tNTOWFv2FromHashW(entry->NtHash, (LPWSTR)credentials->identity.User,\n\t\t credentials->identity.UserLength * 2, (LPWSTR)credentials->identity.Domain,\n\t\t credentials->identity.DomainLength * 2, (BYTE*)hash);\n\t\tSamFreeEntry(sam, entry);\n\t\tSamClose(sam);\n\t\treturn 1;\n\t}\n\n\tentry = SamLookupUserW(sam, (LPWSTR)credentials->identity.User,\n\t credentials->identity.UserLength * 2, NULL, 0);\n\n\tif (entry)\n\t{\n#ifdef WITH_DEBUG_NTLM\n\t\tWLog_DBG(TAG, \"NTLM Hash:\");\n\t\twinpr_HexDump(TAG, WLOG_DEBUG, entry->NtHash, 16);\n#endif\n\t\tNTOWFv2FromHashW(entry->NtHash, (LPWSTR)credentials->identity.User,\n\t\t credentials->identity.UserLength * 2, (LPWSTR)credentials->identity.Domain,\n\t\t credentials->identity.DomainLength * 2, (BYTE*)hash);\n\t\tSamFreeEntry(sam, entry);\n\t\tSamClose(sam);\n\t\treturn 1;\n\t}\n\telse\n\t{\n\t\tSamClose(sam);\n\t\tWLog_ERR(TAG, \"Error: Could not find user in SAM database\");\n\t\treturn 0;\n\t}\n\n\tSamClose(sam);\n\treturn 1;\n}",
  25896. "project": "FreeRDP",
  25897. "hash": 302789123549310958569220928699431208926,
  25898. "size": 54,
  25899. "commit_id": "c098f21fdaadca57ff649eee1674f6cc321a2ec4",
  25900. "message": "Fixed oob read in ntlm_read_ntlm_v2_response",
  25901. "target": 0,
  25902. "dataset": "other",
  25903. "idx": 424853
  25904. },
  25905. {
  25906. "func": "int ntlm_compute_ntlm_v2_response(NTLM_CONTEXT* context)\n{\n\tBYTE* blob;\n\tSecBuffer ntlm_v2_temp = { 0 };\n\tSecBuffer ntlm_v2_temp_chal = { 0 };\n\tPSecBuffer TargetInfo = &context->ChallengeTargetInfo;\n\tint ret = -1;\n\n\tif (!sspi_SecBufferAlloc(&ntlm_v2_temp, TargetInfo->cbBuffer + 28))\n\t\tgoto exit;\n\n\tZeroMemory(ntlm_v2_temp.pvBuffer, ntlm_v2_temp.cbBuffer);\n\tblob = (BYTE*)ntlm_v2_temp.pvBuffer;\n\n\t/* Compute the NTLMv2 hash */\n\tif (ntlm_compute_ntlm_v2_hash(context, (BYTE*)context->NtlmV2Hash) < 0)\n\t\tgoto exit;\n\n\t/* Construct temp */\n\tblob[0] = 1; /* RespType (1 byte) */\n\tblob[1] = 1; /* HighRespType (1 byte) */\n\t/* Reserved1 (2 bytes) */\n\t/* Reserved2 (4 bytes) */\n\tCopyMemory(&blob[8], context->Timestamp, 8); /* Timestamp (8 bytes) */\n\tCopyMemory(&blob[16], context->ClientChallenge, 8); /* ClientChallenge (8 bytes) */\n\t/* Reserved3 (4 bytes) */\n\tCopyMemory(&blob[28], TargetInfo->pvBuffer, TargetInfo->cbBuffer);\n#ifdef WITH_DEBUG_NTLM\n\tWLog_DBG(TAG, \"NTLMv2 Response Temp Blob\");\n\twinpr_HexDump(TAG, WLOG_DEBUG, ntlm_v2_temp.pvBuffer, ntlm_v2_temp.cbBuffer);\n#endif\n\n\t/* Concatenate server challenge with temp */\n\n\tif (!sspi_SecBufferAlloc(&ntlm_v2_temp_chal, ntlm_v2_temp.cbBuffer + 8))\n\t\tgoto exit;\n\n\tblob = (BYTE*)ntlm_v2_temp_chal.pvBuffer;\n\tCopyMemory(blob, context->ServerChallenge, 8);\n\tCopyMemory(&blob[8], ntlm_v2_temp.pvBuffer, ntlm_v2_temp.cbBuffer);\n\twinpr_HMAC(WINPR_MD_MD5, (BYTE*)context->NtlmV2Hash, WINPR_MD5_DIGEST_LENGTH,\n\t (BYTE*)ntlm_v2_temp_chal.pvBuffer, ntlm_v2_temp_chal.cbBuffer,\n\t context->NtProofString, WINPR_MD5_DIGEST_LENGTH);\n\n\t/* NtChallengeResponse, Concatenate NTProofStr with temp */\n\n\tif (!sspi_SecBufferAlloc(&context->NtChallengeResponse, ntlm_v2_temp.cbBuffer + 16))\n\t\tgoto exit;\n\n\tblob = (BYTE*)context->NtChallengeResponse.pvBuffer;\n\tCopyMemory(blob, context->NtProofString, WINPR_MD5_DIGEST_LENGTH);\n\tCopyMemory(&blob[16], ntlm_v2_temp.pvBuffer, ntlm_v2_temp.cbBuffer);\n\t/* Compute SessionBaseKey, the HMAC-MD5 hash of NTProofStr using the NTLMv2 hash as the key */\n\twinpr_HMAC(WINPR_MD_MD5, (BYTE*)context->NtlmV2Hash, WINPR_MD5_DIGEST_LENGTH,\n\t context->NtProofString, WINPR_MD5_DIGEST_LENGTH, context->SessionBaseKey,\n\t WINPR_MD5_DIGEST_LENGTH);\n\tret = 1;\nexit:\n\tsspi_SecBufferFree(&ntlm_v2_temp);\n\tsspi_SecBufferFree(&ntlm_v2_temp_chal);\n\treturn ret;\n}",
  25907. "project": "FreeRDP",
  25908. "hash": 293239048048938838522778955487585675814,
  25909. "size": 62,
  25910. "commit_id": "c098f21fdaadca57ff649eee1674f6cc321a2ec4",
  25911. "message": "Fixed oob read in ntlm_read_ntlm_v2_response",
  25912. "target": 0,
  25913. "dataset": "other",
  25914. "idx": 424864
  25915. }
  25916. ]
  25917. },
  25918. {
  25919. "call_depth": 3,
  25920. "longest_call_chain": [
  25921. "ctnetlink_flush_iterate",
  25922. "ctnetlink_filter_match",
  25923. "ctnetlink_filter_match_tuple"
  25924. ],
  25925. "group_size": 3,
  25926. "functions": [
  25927. {
  25928. "func": "static int ctnetlink_filter_match_tuple(struct nf_conntrack_tuple *filter_tuple,\n\t\t\t\t\tstruct nf_conntrack_tuple *ct_tuple,\n\t\t\t\t\tu_int32_t flags, int family)\n{\n\tswitch (family) {\n\tcase NFPROTO_IPV4:\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_IP_SRC)) &&\n\t\t filter_tuple->src.u3.ip != ct_tuple->src.u3.ip)\n\t\t\treturn 0;\n\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_IP_DST)) &&\n\t\t filter_tuple->dst.u3.ip != ct_tuple->dst.u3.ip)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase NFPROTO_IPV6:\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_IP_SRC)) &&\n\t\t !ipv6_addr_cmp(&filter_tuple->src.u3.in6,\n\t\t\t\t &ct_tuple->src.u3.in6))\n\t\t\treturn 0;\n\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_IP_DST)) &&\n\t\t !ipv6_addr_cmp(&filter_tuple->dst.u3.in6,\n\t\t\t\t &ct_tuple->dst.u3.in6))\n\t\t\treturn 0;\n\t\tbreak;\n\t}\n\n\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_NUM)) &&\n\t filter_tuple->dst.protonum != ct_tuple->dst.protonum)\n\t\treturn 0;\n\n\tswitch (ct_tuple->dst.protonum) {\n\tcase IPPROTO_TCP:\n\tcase IPPROTO_UDP:\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_SRC_PORT)) &&\n\t\t filter_tuple->src.u.tcp.port != ct_tuple->src.u.tcp.port)\n\t\t\treturn 0;\n\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_DST_PORT)) &&\n\t\t filter_tuple->dst.u.tcp.port != ct_tuple->dst.u.tcp.port)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase IPPROTO_ICMP:\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_ICMP_TYPE)) &&\n\t\t filter_tuple->dst.u.icmp.type != ct_tuple->dst.u.icmp.type)\n\t\t\treturn 0;\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_ICMP_CODE)) &&\n\t\t filter_tuple->dst.u.icmp.code != ct_tuple->dst.u.icmp.code)\n\t\t\treturn 0;\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_ICMP_ID)) &&\n\t\t filter_tuple->src.u.icmp.id != ct_tuple->src.u.icmp.id)\n\t\t\treturn 0;\n\t\tbreak;\n\tcase IPPROTO_ICMPV6:\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_ICMPV6_TYPE)) &&\n\t\t filter_tuple->dst.u.icmp.type != ct_tuple->dst.u.icmp.type)\n\t\t\treturn 0;\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_ICMPV6_CODE)) &&\n\t\t filter_tuple->dst.u.icmp.code != ct_tuple->dst.u.icmp.code)\n\t\t\treturn 0;\n\t\tif ((flags & CTA_FILTER_FLAG(CTA_PROTO_ICMPV6_ID)) &&\n\t\t filter_tuple->src.u.icmp.id != ct_tuple->src.u.icmp.id)\n\t\t\treturn 0;\n\t\tbreak;\n\t}\n\n\treturn 1;\n}",
  25929. "project": "linux",
  25930. "hash": 282718761364807328440030437337385326064,
  25931. "size": 68,
  25932. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  25933. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  25934. "target": 0,
  25935. "dataset": "other",
  25936. "idx": 394177
  25937. },
  25938. {
  25939. "func": "static int ctnetlink_flush_iterate(struct nf_conn *ct, void *data)\n{\n\tif (test_bit(IPS_OFFLOAD_BIT, &ct->status))\n\t\treturn 0;\n\n\treturn ctnetlink_filter_match(ct, data);\n}",
  25940. "project": "linux",
  25941. "hash": 182928000598968957127516725942562810938,
  25942. "size": 7,
  25943. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  25944. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  25945. "target": 0,
  25946. "dataset": "other",
  25947. "idx": 394179
  25948. },
  25949. {
  25950. "func": "static int ctnetlink_filter_match(struct nf_conn *ct, void *data)\n{\n\tstruct ctnetlink_filter *filter = data;\n\tstruct nf_conntrack_tuple *tuple;\n\n\tif (filter == NULL)\n\t\tgoto out;\n\n\t/* Match entries of a given L3 protocol number.\n\t * If it is not specified, ie. l3proto == 0,\n\t * then match everything.\n\t */\n\tif (filter->family && nf_ct_l3num(ct) != filter->family)\n\t\tgoto ignore_entry;\n\n\tif (filter->orig_flags) {\n\t\ttuple = nf_ct_tuple(ct, IP_CT_DIR_ORIGINAL);\n\t\tif (!ctnetlink_filter_match_tuple(&filter->orig, tuple,\n\t\t\t\t\t\t filter->orig_flags,\n\t\t\t\t\t\t filter->family))\n\t\t\tgoto ignore_entry;\n\t}\n\n\tif (filter->reply_flags) {\n\t\ttuple = nf_ct_tuple(ct, IP_CT_DIR_REPLY);\n\t\tif (!ctnetlink_filter_match_tuple(&filter->reply, tuple,\n\t\t\t\t\t\t filter->reply_flags,\n\t\t\t\t\t\t filter->family))\n\t\t\tgoto ignore_entry;\n\t}\n\n#ifdef CONFIG_NF_CONNTRACK_MARK\n\tif ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK_MASK)) &&\n\t (ct->mark & filter->mark.mask) != filter->mark.val)\n\t\tgoto ignore_entry;\n\telse if ((filter->cta_flags & CTA_FILTER_FLAG(CTA_MARK)) &&\n\t\t ct->mark != filter->mark.val)\n\t\tgoto ignore_entry;\n#endif\n\nout:\n\treturn 1;\n\nignore_entry:\n\treturn 0;\n}",
  25951. "project": "linux",
  25952. "hash": 274958493638342873070273360948319359578,
  25953. "size": 46,
  25954. "commit_id": "1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6",
  25955. "message": "netfilter: ctnetlink: add a range check for l3/l4 protonum\n\nThe indexes to the nf_nat_l[34]protos arrays come from userspace. So\ncheck the tuple's family, e.g. l3num, when creating the conntrack in\norder to prevent an OOB memory access during setup. Here is an example\nkernel panic on 4.14.180 when userspace passes in an index greater than\nNFPROTO_NUMPROTO.\n\nInternal error: Oops - BUG: 0 [#1] PREEMPT SMP\nModules linked in:...\nProcess poc (pid: 5614, stack limit = 0x00000000a3933121)\nCPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483\nHardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM\ntask: 000000002a3dfffe task.stack: 00000000a3933121\npc : __cfi_check_fail+0x1c/0x24\nlr : __cfi_check_fail+0x1c/0x24\n...\nCall trace:\n__cfi_check_fail+0x1c/0x24\nname_to_dev_t+0x0/0x468\nnfnetlink_parse_nat_setup+0x234/0x258\nctnetlink_parse_nat_setup+0x4c/0x228\nctnetlink_new_conntrack+0x590/0xc40\nnfnetlink_rcv_msg+0x31c/0x4d4\nnetlink_rcv_skb+0x100/0x184\nnfnetlink_rcv+0xf4/0x180\nnetlink_unicast+0x360/0x770\nnetlink_sendmsg+0x5a0/0x6a4\n___sys_sendmsg+0x314/0x46c\nSyS_sendmsg+0xb4/0x108\nel0_svc_naked+0x34/0x38\n\nThis crash is not happening since 5.4+, however, ctnetlink still\nallows for creating entries with unsupported layer 3 protocol number.\n\nFixes: c1d10adb4a521 (\"[NETFILTER]: Add ctnetlink port for nf_conntrack\")\nSigned-off-by: Will McVicker <willmcvicker@google.com>\n[pablo@netfilter.org: rebased original patch on top of nf.git]\nSigned-off-by: Pablo Neira Ayuso <pablo@netfilter.org>",
  25956. "target": 0,
  25957. "dataset": "other",
  25958. "idx": 394244
  25959. }
  25960. ]
  25961. },
  25962. {
  25963. "call_depth": 5,
  25964. "longest_call_chain": [
  25965. "iwl_fw_dbg_collect_trig",
  25966. "iwl_fw_dbg_collect",
  25967. "iwl_fw_dbg_collect_desc",
  25968. "iwl_fw_dbg_ini_collect",
  25969. "_iwl_fw_dbg_ini_collect"
  25970. ],
  25971. "group_size": 6,
  25972. "functions": [
  25973. {
  25974. "func": "int iwl_fw_dbg_error_collect(struct iwl_fw_runtime *fwrt,\n\t\t\t enum iwl_fw_dbg_trigger trig_type)\n{\n\tint ret;\n\tstruct iwl_fw_dump_desc *iwl_dump_error_desc;\n\n\tif (!test_bit(STATUS_DEVICE_ENABLED, &fwrt->trans->status))\n\t\treturn -EIO;\n\n\tiwl_dump_error_desc = kmalloc(sizeof(*iwl_dump_error_desc), GFP_KERNEL);\n\tif (!iwl_dump_error_desc)\n\t\treturn -ENOMEM;\n\n\tiwl_dump_error_desc->trig_desc.type = cpu_to_le32(trig_type);\n\tiwl_dump_error_desc->len = 0;\n\n\tret = iwl_fw_dbg_collect_desc(fwrt, iwl_dump_error_desc, false, 0);\n\tif (ret)\n\t\tkfree(iwl_dump_error_desc);\n\telse\n\t\tiwl_trans_sync_nmi(fwrt->trans);\n\n\treturn ret;\n}",
  25975. "project": "linux",
  25976. "hash": 179299705507294275077513320510570789995,
  25977. "size": 24,
  25978. "commit_id": "b4b814fec1a5a849383f7b3886b654a13abbda7d",
  25979. "message": "iwlwifi: dbg_ini: fix memory leak in alloc_sgtable\n\nIn alloc_sgtable if alloc_page fails, the alocated table should be\nreleased.\n\nSigned-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>\nSigned-off-by: Luca Coelho <luciano.coelho@intel.com>",
  25980. "target": 0,
  25981. "dataset": "other",
  25982. "idx": 384512
  25983. },
  25984. {
  25985. "func": "int iwl_fw_dbg_collect(struct iwl_fw_runtime *fwrt,\n\t\t enum iwl_fw_dbg_trigger trig,\n\t\t const char *str, size_t len,\n\t\t struct iwl_fw_dbg_trigger_tlv *trigger)\n{\n\tstruct iwl_fw_dump_desc *desc;\n\tunsigned int delay = 0;\n\tbool monitor_only = false;\n\n\tif (trigger) {\n\t\tu16 occurrences = le16_to_cpu(trigger->occurrences) - 1;\n\n\t\tif (!le16_to_cpu(trigger->occurrences))\n\t\t\treturn 0;\n\n\t\tif (trigger->flags & IWL_FW_DBG_FORCE_RESTART) {\n\t\t\tIWL_WARN(fwrt, \"Force restart: trigger %d fired.\\n\",\n\t\t\t\t trig);\n\t\t\tiwl_force_nmi(fwrt->trans);\n\t\t\treturn 0;\n\t\t}\n\n\t\ttrigger->occurrences = cpu_to_le16(occurrences);\n\t\tmonitor_only = trigger->mode & IWL_FW_DBG_TRIGGER_MONITOR_ONLY;\n\n\t\t/* convert msec to usec */\n\t\tdelay = le32_to_cpu(trigger->stop_delay) * USEC_PER_MSEC;\n\t}\n\n\tdesc = kzalloc(sizeof(*desc) + len, GFP_ATOMIC);\n\tif (!desc)\n\t\treturn -ENOMEM;\n\n\n\tdesc->len = len;\n\tdesc->trig_desc.type = cpu_to_le32(trig);\n\tmemcpy(desc->trig_desc.data, str, len);\n\n\treturn iwl_fw_dbg_collect_desc(fwrt, desc, monitor_only, delay);\n}",
  25986. "project": "linux",
  25987. "hash": 185875951263182919810949925842734487958,
  25988. "size": 40,
  25989. "commit_id": "b4b814fec1a5a849383f7b3886b654a13abbda7d",
  25990. "message": "iwlwifi: dbg_ini: fix memory leak in alloc_sgtable\n\nIn alloc_sgtable if alloc_page fails, the alocated table should be\nreleased.\n\nSigned-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>\nSigned-off-by: Luca Coelho <luciano.coelho@intel.com>",
  25991. "target": 0,
  25992. "dataset": "other",
  25993. "idx": 384498
  25994. },
  25995. {
  25996. "func": "int _iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt,\n\t\t\t enum iwl_fw_ini_trigger_id id)\n{\n\tstruct iwl_fw_ini_active_triggers *active;\n\tu32 occur, delay;\n\tunsigned long idx;\n\n\tif (WARN_ON(!iwl_fw_ini_trigger_on(fwrt, id)))\n\t\treturn -EINVAL;\n\n\tif (!iwl_fw_ini_trigger_on(fwrt, id)) {\n\t\tIWL_WARN(fwrt, \"WRT: Trigger %d is not active, aborting dump\\n\",\n\t\t\t id);\n\t\treturn -EINVAL;\n\t}\n\n\tactive = &fwrt->dump.active_trigs[id];\n\tdelay = le32_to_cpu(active->trig->dump_delay);\n\toccur = le32_to_cpu(active->trig->occurrences);\n\tif (!occur)\n\t\treturn 0;\n\n\tactive->trig->occurrences = cpu_to_le32(--occur);\n\n\tif (le32_to_cpu(active->trig->force_restart)) {\n\t\tIWL_WARN(fwrt, \"WRT: Force restart: trigger %d fired.\\n\", id);\n\t\tiwl_force_nmi(fwrt->trans);\n\t\treturn 0;\n\t}\n\n\t/* Check there is an available worker.\n\t * ffz return value is undefined if no zero exists,\n\t * so check against ~0UL first.\n\t */\n\tif (fwrt->dump.active_wks == ~0UL)\n\t\treturn -EBUSY;\n\n\tidx = ffz(fwrt->dump.active_wks);\n\n\tif (idx >= IWL_FW_RUNTIME_DUMP_WK_NUM ||\n\t test_and_set_bit(fwrt->dump.wks[idx].idx, &fwrt->dump.active_wks))\n\t\treturn -EBUSY;\n\n\tfwrt->dump.wks[idx].ini_trig_id = id;\n\n\tIWL_WARN(fwrt, \"WRT: Collecting data: ini trigger %d fired.\\n\", id);\n\n\tschedule_delayed_work(&fwrt->dump.wks[idx].wk, usecs_to_jiffies(delay));\n\n\treturn 0;\n}",
  25997. "project": "linux",
  25998. "hash": 115079245489843583928037103034620477581,
  25999. "size": 51,
  26000. "commit_id": "b4b814fec1a5a849383f7b3886b654a13abbda7d",
  26001. "message": "iwlwifi: dbg_ini: fix memory leak in alloc_sgtable\n\nIn alloc_sgtable if alloc_page fails, the alocated table should be\nreleased.\n\nSigned-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>\nSigned-off-by: Luca Coelho <luciano.coelho@intel.com>",
  26002. "target": 0,
  26003. "dataset": "other",
  26004. "idx": 384500
  26005. },
  26006. {
  26007. "func": "int iwl_fw_dbg_ini_collect(struct iwl_fw_runtime *fwrt, u32 legacy_trigger_id)\n{\n\tint id;\n\n\tswitch (legacy_trigger_id) {\n\tcase FW_DBG_TRIGGER_FW_ASSERT:\n\tcase FW_DBG_TRIGGER_ALIVE_TIMEOUT:\n\tcase FW_DBG_TRIGGER_DRIVER:\n\t\tid = IWL_FW_TRIGGER_ID_FW_ASSERT;\n\t\tbreak;\n\tcase FW_DBG_TRIGGER_USER:\n\t\tid = IWL_FW_TRIGGER_ID_USER_TRIGGER;\n\t\tbreak;\n\tdefault:\n\t\treturn -EIO;\n\t}\n\n\treturn _iwl_fw_dbg_ini_collect(fwrt, id);\n}",
  26008. "project": "linux",
  26009. "hash": 48189044191970065292804985077428113242,
  26010. "size": 19,
  26011. "commit_id": "b4b814fec1a5a849383f7b3886b654a13abbda7d",
  26012. "message": "iwlwifi: dbg_ini: fix memory leak in alloc_sgtable\n\nIn alloc_sgtable if alloc_page fails, the alocated table should be\nreleased.\n\nSigned-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>\nSigned-off-by: Luca Coelho <luciano.coelho@intel.com>",
  26013. "target": 0,
  26014. "dataset": "other",
  26015. "idx": 384513
  26016. },
  26017. {
  26018. "func": "int iwl_fw_dbg_collect_trig(struct iwl_fw_runtime *fwrt,\n\t\t\t struct iwl_fw_dbg_trigger_tlv *trigger,\n\t\t\t const char *fmt, ...)\n{\n\tint ret, len = 0;\n\tchar buf[64];\n\n\tif (fmt) {\n\t\tva_list ap;\n\n\t\tbuf[sizeof(buf) - 1] = '\\0';\n\n\t\tva_start(ap, fmt);\n\t\tvsnprintf(buf, sizeof(buf), fmt, ap);\n\t\tva_end(ap);\n\n\t\t/* check for truncation */\n\t\tif (WARN_ON_ONCE(buf[sizeof(buf) - 1]))\n\t\t\tbuf[sizeof(buf) - 1] = '\\0';\n\n\t\tlen = strlen(buf) + 1;\n\t}\n\n\tret = iwl_fw_dbg_collect(fwrt, le32_to_cpu(trigger->id), buf, len,\n\t\t\t\t trigger);\n\n\tif (ret)\n\t\treturn ret;\n\n\treturn 0;\n}",
  26019. "project": "linux",
  26020. "hash": 31999427507886365065530315839349252764,
  26021. "size": 31,
  26022. "commit_id": "b4b814fec1a5a849383f7b3886b654a13abbda7d",
  26023. "message": "iwlwifi: dbg_ini: fix memory leak in alloc_sgtable\n\nIn alloc_sgtable if alloc_page fails, the alocated table should be\nreleased.\n\nSigned-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>\nSigned-off-by: Luca Coelho <luciano.coelho@intel.com>",
  26024. "target": 0,
  26025. "dataset": "other",
  26026. "idx": 384468
  26027. },
  26028. {
  26029. "func": "int iwl_fw_dbg_collect_desc(struct iwl_fw_runtime *fwrt,\n\t\t\t const struct iwl_fw_dump_desc *desc,\n\t\t\t bool monitor_only,\n\t\t\t unsigned int delay)\n{\n\tu32 trig_type = le32_to_cpu(desc->trig_desc.type);\n\tint ret;\n\n\tif (iwl_trans_dbg_ini_valid(fwrt->trans)) {\n\t\tret = iwl_fw_dbg_ini_collect(fwrt, trig_type);\n\t\tif (!ret)\n\t\t\tiwl_fw_free_dump_desc(fwrt);\n\n\t\treturn ret;\n\t}\n\n\t/* use wks[0] since dump flow prior to ini does not need to support\n\t * consecutive triggers collection\n\t */\n\tif (test_and_set_bit(fwrt->dump.wks[0].idx, &fwrt->dump.active_wks))\n\t\treturn -EBUSY;\n\n\tif (WARN_ON(fwrt->dump.desc))\n\t\tiwl_fw_free_dump_desc(fwrt);\n\n\tIWL_WARN(fwrt, \"Collecting data: trigger %d fired.\\n\",\n\t\t le32_to_cpu(desc->trig_desc.type));\n\n\tfwrt->dump.desc = desc;\n\tfwrt->dump.monitor_only = monitor_only;\n\n\tschedule_delayed_work(&fwrt->dump.wks[0].wk, usecs_to_jiffies(delay));\n\n\treturn 0;\n}",
  26030. "project": "linux",
  26031. "hash": 116402012900464947830285900179065452573,
  26032. "size": 35,
  26033. "commit_id": "b4b814fec1a5a849383f7b3886b654a13abbda7d",
  26034. "message": "iwlwifi: dbg_ini: fix memory leak in alloc_sgtable\n\nIn alloc_sgtable if alloc_page fails, the alocated table should be\nreleased.\n\nSigned-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>\nSigned-off-by: Luca Coelho <luciano.coelho@intel.com>",
  26035. "target": 0,
  26036. "dataset": "other",
  26037. "idx": 384485
  26038. }
  26039. ]
  26040. },
  26041. {
  26042. "call_depth": 3,
  26043. "longest_call_chain": [
  26044. "ff_layout_commit_prepare_v4",
  26045. "ff_layout_commit_prepare_common",
  26046. "ff_layout_commit_record_layoutstats_start"
  26047. ],
  26048. "group_size": 4,
  26049. "functions": [
  26050. {
  26051. "func": "static void ff_layout_commit_prepare_v3(struct rpc_task *task, void *data)\n{\n\tff_layout_commit_prepare_common(task, data);\n\trpc_call_start(task);\n}",
  26052. "project": "linux",
  26053. "hash": 295029019518512631715379364109019110239,
  26054. "size": 5,
  26055. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  26056. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  26057. "target": 0,
  26058. "dataset": "other",
  26059. "idx": 234391
  26060. },
  26061. {
  26062. "func": "static void ff_layout_commit_prepare_common(struct rpc_task *task,\n\t\tstruct nfs_commit_data *cdata)\n{\n\tff_layout_commit_record_layoutstats_start(task, cdata);\n}",
  26063. "project": "linux",
  26064. "hash": 79501687639063805324356772586497104609,
  26065. "size": 5,
  26066. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  26067. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  26068. "target": 0,
  26069. "dataset": "other",
  26070. "idx": 234494
  26071. },
  26072. {
  26073. "func": "static void ff_layout_commit_prepare_v4(struct rpc_task *task, void *data)\n{\n\tstruct nfs_commit_data *wdata = data;\n\n\tif (nfs4_setup_sequence(wdata->ds_clp,\n\t\t\t\t&wdata->args.seq_args,\n\t\t\t\t&wdata->res.seq_res,\n\t\t\t\ttask))\n\t\treturn;\n\tff_layout_commit_prepare_common(task, data);\n}",
  26074. "project": "linux",
  26075. "hash": 58373963151584553919228009400623120131,
  26076. "size": 11,
  26077. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  26078. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  26079. "target": 0,
  26080. "dataset": "other",
  26081. "idx": 234468
  26082. },
  26083. {
  26084. "func": "static void ff_layout_commit_record_layoutstats_start(struct rpc_task *task,\n\t\tstruct nfs_commit_data *cdata)\n{\n\tif (test_and_set_bit(NFS_IOHDR_STAT, &cdata->flags))\n\t\treturn;\n\tnfs4_ff_layout_stat_io_start_write(cdata->inode,\n\t\t\tFF_LAYOUT_COMP(cdata->lseg, cdata->ds_commit_index),\n\t\t\t0, task->tk_start);\n}",
  26085. "project": "linux",
  26086. "hash": 300992929852829700481817492813862146425,
  26087. "size": 9,
  26088. "commit_id": "ed34695e15aba74f45247f1ee2cf7e09d449f925",
  26089. "message": "pNFS/flexfiles: fix incorrect size check in decode_nfs_fh()\n\nWe (adam zabrocki, alexander matrosov, alexander tereshkin, maksym\nbazalii) observed the check:\n\n\tif (fh->size > sizeof(struct nfs_fh))\n\nshould not use the size of the nfs_fh struct which includes an extra two\nbytes from the size field.\n\nstruct nfs_fh {\n\tunsigned short size;\n\tunsigned char data[NFS_MAXFHSIZE];\n}\n\nbut should determine the size from data[NFS_MAXFHSIZE] so the memcpy\nwill not write 2 bytes beyond destination. The proposed fix is to\ncompare against the NFS_MAXFHSIZE directly, as is done elsewhere in fs\ncode base.\n\nFixes: d67ae825a59d (\"pnfs/flexfiles: Add the FlexFile Layout Driver\")\nSigned-off-by: Nikola Livic <nlivic@gmail.com>\nSigned-off-by: Dan Carpenter <dan.carpenter@oracle.com>\nSigned-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>",
  26090. "target": 0,
  26091. "dataset": "other",
  26092. "idx": 234429
  26093. }
  26094. ]
  26095. },
  26096. {
  26097. "call_depth": 3,
  26098. "longest_call_chain": [
  26099. "virt_to_scatterlist",
  26100. "sg_init_table",
  26101. "encrypt_scatterlist"
  26102. ],
  26103. "group_size": 4,
  26104. "functions": [
  26105. {
  26106. "func": "static int encrypt_scatterlist(struct ecryptfs_crypt_stat *crypt_stat,\n\t\t\t struct scatterlist *dest_sg,\n\t\t\t struct scatterlist *src_sg, int size,\n\t\t\t unsigned char *iv)\n{\n\tstruct blkcipher_desc desc = {\n\t\t.tfm = crypt_stat->tfm,\n\t\t.info = iv,\n\t\t.flags = CRYPTO_TFM_REQ_MAY_SLEEP\n\t};\n\tint rc = 0;\n\n\tBUG_ON(!crypt_stat || !crypt_stat->tfm\n\t || !(crypt_stat->flags & ECRYPTFS_STRUCT_INITIALIZED));\n\tif (unlikely(ecryptfs_verbosity > 0)) {\n\t\tecryptfs_printk(KERN_DEBUG, \"Key size [%d]; key:\\n\",\n\t\t\t\tcrypt_stat->key_size);\n\t\tecryptfs_dump_hex(crypt_stat->key,\n\t\t\t\t crypt_stat->key_size);\n\t}\n\t/* Consider doing this once, when the file is opened */\n\tmutex_lock(&crypt_stat->cs_tfm_mutex);\n\tif (!(crypt_stat->flags & ECRYPTFS_KEY_SET)) {\n\t\trc = crypto_blkcipher_setkey(crypt_stat->tfm, crypt_stat->key,\n\t\t\t\t\t crypt_stat->key_size);\n\t\tcrypt_stat->flags |= ECRYPTFS_KEY_SET;\n\t}\n\tif (rc) {\n\t\tecryptfs_printk(KERN_ERR, \"Error setting key; rc = [%d]\\n\",\n\t\t\t\trc);\n\t\tmutex_unlock(&crypt_stat->cs_tfm_mutex);\n\t\trc = -EINVAL;\n\t\tgoto out;\n\t}\n\tecryptfs_printk(KERN_DEBUG, \"Encrypting [%d] bytes.\\n\", size);\n\tcrypto_blkcipher_encrypt_iv(&desc, dest_sg, src_sg, size);\n\tmutex_unlock(&crypt_stat->cs_tfm_mutex);\nout:\n\treturn rc;\n}",
  26107. "target": 0,
  26108. "cwe": [
  26109. "CWE-189"
  26110. ],
  26111. "project": "linux-2.6",
  26112. "commit_id": "8faece5f906725c10e7a1f6caf84452abadbdc7b",
  26113. "hash": 43093249919420749145666564157705188509,
  26114. "size": 40,
  26115. "message": "eCryptfs: Allocate a variable number of pages for file headers\n\nWhen allocating the memory used to store the eCryptfs header contents, a\nsingle, zeroed page was being allocated with get_zeroed_page().\nHowever, the size of an eCryptfs header is either PAGE_CACHE_SIZE or\nECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE (8192), whichever is larger, and is\nstored in the file's private_data->crypt_stat->num_header_bytes_at_front\nfield.\n\necryptfs_write_metadata_to_contents() was using\nnum_header_bytes_at_front to decide how many bytes should be written to\nthe lower filesystem for the file header. Unfortunately, at least 8K\nwas being written from the page, despite the chance of the single,\nzeroed page being smaller than 8K. This resulted in random areas of\nkernel memory being written between the 0x1000 and 0x1FFF bytes offsets\nin the eCryptfs file headers if PAGE_SIZE was 4K.\n\nThis patch allocates a variable number of pages, calculated with\nnum_header_bytes_at_front, and passes the number of allocated pages\nalong to ecryptfs_write_metadata_to_contents().\n\nThanks to Florian Streibelt for reporting the data leak and working with\nme to find the problem. 2.6.28 is the only kernel release with this\nvulnerability. Corresponds to CVE-2009-0787\n\nSigned-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>\nAcked-by: Dustin Kirkland <kirkland@canonical.com>\nReviewed-by: Eric Sandeen <sandeen@redhat.com>\nReviewed-by: Eugene Teo <eugeneteo@kernel.sg>\nCc: Greg KH <greg@kroah.com>\nCc: dann frazier <dannf@dannf.org>\nCc: Serge E. Hallyn <serue@us.ibm.com>\nCc: Florian Streibelt <florian@f-streibelt.de>\nCc: stable@kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26116. "dataset": "other",
  26117. "idx": 490191
  26118. },
  26119. {
  26120. "func": "int virt_to_scatterlist(const void *addr, int size, struct scatterlist *sg,\n\t\t\tint sg_size)\n{\n\tint i = 0;\n\tstruct page *pg;\n\tint offset;\n\tint remainder_of_page;\n\n\tsg_init_table(sg, sg_size);\n\n\twhile (size > 0 && i < sg_size) {\n\t\tpg = virt_to_page(addr);\n\t\toffset = offset_in_page(addr);\n\t\tif (sg)\n\t\t\tsg_set_page(&sg[i], pg, 0, offset);\n\t\tremainder_of_page = PAGE_CACHE_SIZE - offset;\n\t\tif (size >= remainder_of_page) {\n\t\t\tif (sg)\n\t\t\t\tsg[i].length = remainder_of_page;\n\t\t\taddr += remainder_of_page;\n\t\t\tsize -= remainder_of_page;\n\t\t} else {\n\t\t\tif (sg)\n\t\t\t\tsg[i].length = size;\n\t\t\taddr += size;\n\t\t\tsize = 0;\n\t\t}\n\t\ti++;\n\t}\n\tif (size > 0)\n\t\treturn -ENOMEM;\n\treturn i;\n}",
  26121. "target": 0,
  26122. "cwe": [
  26123. "CWE-189"
  26124. ],
  26125. "project": "linux-2.6",
  26126. "commit_id": "8faece5f906725c10e7a1f6caf84452abadbdc7b",
  26127. "hash": 177263979817146619645509490018394809225,
  26128. "size": 33,
  26129. "message": "eCryptfs: Allocate a variable number of pages for file headers\n\nWhen allocating the memory used to store the eCryptfs header contents, a\nsingle, zeroed page was being allocated with get_zeroed_page().\nHowever, the size of an eCryptfs header is either PAGE_CACHE_SIZE or\nECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE (8192), whichever is larger, and is\nstored in the file's private_data->crypt_stat->num_header_bytes_at_front\nfield.\n\necryptfs_write_metadata_to_contents() was using\nnum_header_bytes_at_front to decide how many bytes should be written to\nthe lower filesystem for the file header. Unfortunately, at least 8K\nwas being written from the page, despite the chance of the single,\nzeroed page being smaller than 8K. This resulted in random areas of\nkernel memory being written between the 0x1000 and 0x1FFF bytes offsets\nin the eCryptfs file headers if PAGE_SIZE was 4K.\n\nThis patch allocates a variable number of pages, calculated with\nnum_header_bytes_at_front, and passes the number of allocated pages\nalong to ecryptfs_write_metadata_to_contents().\n\nThanks to Florian Streibelt for reporting the data leak and working with\nme to find the problem. 2.6.28 is the only kernel release with this\nvulnerability. Corresponds to CVE-2009-0787\n\nSigned-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>\nAcked-by: Dustin Kirkland <kirkland@canonical.com>\nReviewed-by: Eric Sandeen <sandeen@redhat.com>\nReviewed-by: Eugene Teo <eugeneteo@kernel.sg>\nCc: Greg KH <greg@kroah.com>\nCc: dann frazier <dannf@dannf.org>\nCc: Serge E. Hallyn <serue@us.ibm.com>\nCc: Florian Streibelt <florian@f-streibelt.de>\nCc: stable@kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26130. "dataset": "other",
  26131. "idx": 490190
  26132. },
  26133. {
  26134. "func": "ecryptfs_decrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat,\n\t\t\t struct page *dst_page, int dst_offset,\n\t\t\t struct page *src_page, int src_offset, int size,\n\t\t\t unsigned char *iv)\n{\n\tstruct scatterlist src_sg, dst_sg;\n\n\tsg_init_table(&src_sg, 1);\n\tsg_set_page(&src_sg, src_page, size, src_offset);\n\n\tsg_init_table(&dst_sg, 1);\n\tsg_set_page(&dst_sg, dst_page, size, dst_offset);\n\n\treturn decrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv);\n}",
  26135. "target": 0,
  26136. "cwe": [
  26137. "CWE-189"
  26138. ],
  26139. "project": "linux-2.6",
  26140. "commit_id": "8faece5f906725c10e7a1f6caf84452abadbdc7b",
  26141. "hash": 159230256980142015078679405117409515842,
  26142. "size": 15,
  26143. "message": "eCryptfs: Allocate a variable number of pages for file headers\n\nWhen allocating the memory used to store the eCryptfs header contents, a\nsingle, zeroed page was being allocated with get_zeroed_page().\nHowever, the size of an eCryptfs header is either PAGE_CACHE_SIZE or\nECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE (8192), whichever is larger, and is\nstored in the file's private_data->crypt_stat->num_header_bytes_at_front\nfield.\n\necryptfs_write_metadata_to_contents() was using\nnum_header_bytes_at_front to decide how many bytes should be written to\nthe lower filesystem for the file header. Unfortunately, at least 8K\nwas being written from the page, despite the chance of the single,\nzeroed page being smaller than 8K. This resulted in random areas of\nkernel memory being written between the 0x1000 and 0x1FFF bytes offsets\nin the eCryptfs file headers if PAGE_SIZE was 4K.\n\nThis patch allocates a variable number of pages, calculated with\nnum_header_bytes_at_front, and passes the number of allocated pages\nalong to ecryptfs_write_metadata_to_contents().\n\nThanks to Florian Streibelt for reporting the data leak and working with\nme to find the problem. 2.6.28 is the only kernel release with this\nvulnerability. Corresponds to CVE-2009-0787\n\nSigned-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>\nAcked-by: Dustin Kirkland <kirkland@canonical.com>\nReviewed-by: Eric Sandeen <sandeen@redhat.com>\nReviewed-by: Eugene Teo <eugeneteo@kernel.sg>\nCc: Greg KH <greg@kroah.com>\nCc: dann frazier <dannf@dannf.org>\nCc: Serge E. Hallyn <serue@us.ibm.com>\nCc: Florian Streibelt <florian@f-streibelt.de>\nCc: stable@kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26144. "dataset": "other",
  26145. "idx": 490181
  26146. },
  26147. {
  26148. "func": "ecryptfs_encrypt_page_offset(struct ecryptfs_crypt_stat *crypt_stat,\n\t\t\t struct page *dst_page, int dst_offset,\n\t\t\t struct page *src_page, int src_offset, int size,\n\t\t\t unsigned char *iv)\n{\n\tstruct scatterlist src_sg, dst_sg;\n\n\tsg_init_table(&src_sg, 1);\n\tsg_init_table(&dst_sg, 1);\n\n\tsg_set_page(&src_sg, src_page, size, src_offset);\n\tsg_set_page(&dst_sg, dst_page, size, dst_offset);\n\treturn encrypt_scatterlist(crypt_stat, &dst_sg, &src_sg, size, iv);\n}",
  26149. "target": 0,
  26150. "cwe": [
  26151. "CWE-189"
  26152. ],
  26153. "project": "linux-2.6",
  26154. "commit_id": "8faece5f906725c10e7a1f6caf84452abadbdc7b",
  26155. "hash": 183798196938772397655950918983478031786,
  26156. "size": 14,
  26157. "message": "eCryptfs: Allocate a variable number of pages for file headers\n\nWhen allocating the memory used to store the eCryptfs header contents, a\nsingle, zeroed page was being allocated with get_zeroed_page().\nHowever, the size of an eCryptfs header is either PAGE_CACHE_SIZE or\nECRYPTFS_MINIMUM_HEADER_EXTENT_SIZE (8192), whichever is larger, and is\nstored in the file's private_data->crypt_stat->num_header_bytes_at_front\nfield.\n\necryptfs_write_metadata_to_contents() was using\nnum_header_bytes_at_front to decide how many bytes should be written to\nthe lower filesystem for the file header. Unfortunately, at least 8K\nwas being written from the page, despite the chance of the single,\nzeroed page being smaller than 8K. This resulted in random areas of\nkernel memory being written between the 0x1000 and 0x1FFF bytes offsets\nin the eCryptfs file headers if PAGE_SIZE was 4K.\n\nThis patch allocates a variable number of pages, calculated with\nnum_header_bytes_at_front, and passes the number of allocated pages\nalong to ecryptfs_write_metadata_to_contents().\n\nThanks to Florian Streibelt for reporting the data leak and working with\nme to find the problem. 2.6.28 is the only kernel release with this\nvulnerability. Corresponds to CVE-2009-0787\n\nSigned-off-by: Tyler Hicks <tyhicks@linux.vnet.ibm.com>\nAcked-by: Dustin Kirkland <kirkland@canonical.com>\nReviewed-by: Eric Sandeen <sandeen@redhat.com>\nReviewed-by: Eugene Teo <eugeneteo@kernel.sg>\nCc: Greg KH <greg@kroah.com>\nCc: dann frazier <dannf@dannf.org>\nCc: Serge E. Hallyn <serue@us.ibm.com>\nCc: Florian Streibelt <florian@f-streibelt.de>\nCc: stable@kernel.org\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26158. "dataset": "other",
  26159. "idx": 490184
  26160. }
  26161. ]
  26162. },
  26163. {
  26164. "call_depth": 3,
  26165. "longest_call_chain": [
  26166. "gdImageColorClosestHWB",
  26167. "HWB_Diff",
  26168. "RGB_to_HWB"
  26169. ],
  26170. "group_size": 3,
  26171. "functions": [
  26172. {
  26173. "func": "static HWBType * RGB_to_HWB (RGBType RGB, HWBType * HWB)\n{\n\t/*\n\t * RGB are each on [0, 1]. W and B are returned on [0, 1] and H is\n\t * returned on [0, 6]. Exception: H is returned UNDEFINED if W == 1 - B.\n\t */\n\n\tfloat R = RGB.R, G = RGB.G, B = RGB.B, w, v, b, f;\n\tint i;\n\n\tw = MIN3 (R, G, B);\n\tv = MAX3 (R, G, B);\n\tb = 1 - v;\n\tif (v == w) {\n\t\tRETURN_HWB(HWB_UNDEFINED, w, b);\n\t}\n\tf = (R == w) ? G - B : ((G == w) ? B - R : R - G);\n\ti = (R == w) ? 3 : ((G == w) ? 5 : 1);\n\n\tRETURN_HWB(i - f / (v - w), w, b);\n}",
  26174. "project": "php-src",
  26175. "hash": 209277974453491243576497135035707535616,
  26176. "size": 21,
  26177. "commit_id": "c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6",
  26178. "message": "iFixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow",
  26179. "target": 0,
  26180. "dataset": "other",
  26181. "idx": 295136
  26182. },
  26183. {
  26184. "func": "int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b)\n{\n\tint i;\n\t/* long rd, gd, bd; */\n\tint ct = (-1);\n\tint first = 1;\n\tfloat mindist = 0;\n\tif (im->trueColor) {\n\t\treturn gdTrueColor(r, g, b);\n\t}\n\tfor (i = 0; i < im->colorsTotal; i++) {\n\t\tfloat dist;\n\t\tif (im->open[i]) {\n\t\t\tcontinue;\n\t\t}\n\t\tdist = HWB_Diff(im->red[i], im->green[i], im->blue[i], r, g, b);\n\t\tif (first || (dist < mindist)) {\n\t\t\tmindist = dist;\n\t\t\tct = i;\n\t\t\tfirst = 0;\n\t\t}\n\t}\n\treturn ct;\n}",
  26185. "project": "php-src",
  26186. "hash": 286423259348331400973450044841647401848,
  26187. "size": 24,
  26188. "commit_id": "c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6",
  26189. "message": "iFixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow",
  26190. "target": 0,
  26191. "dataset": "other",
  26192. "idx": 295140
  26193. },
  26194. {
  26195. "func": "static float HWB_Diff (int r1, int g1, int b1, int r2, int g2, int b2)\n{\n\tRGBType RGB1, RGB2;\n\tHWBType HWB1, HWB2;\n\tfloat diff;\n\n\tSETUP_RGB(RGB1, r1, g1, b1);\n\tSETUP_RGB(RGB2, r2, g2, b2);\n\n\tRGB_to_HWB(RGB1, &HWB1);\n\tRGB_to_HWB(RGB2, &HWB2);\n\n\t/*\n\t * I made this bit up; it seems to produce OK results, and it is certainly\n\t * more visually correct than the current RGB metric. (PJW)\n\t */\n\n\tif ((HWB1.H == HWB_UNDEFINED) || (HWB2.H == HWB_UNDEFINED)) {\n\t\tdiff = 0.0f;\t/* Undefined hues always match... */\n\t} else {\n\t\tdiff = fabsf(HWB1.H - HWB2.H);\n\t\tif (diff > 3.0f) {\n\t\t\tdiff = 6.0f - diff;\t/* Remember, it's a colour circle */\n\t\t}\n\t}\n\n\tdiff = diff * diff + (HWB1.W - HWB2.W) * (HWB1.W - HWB2.W) + (HWB1.B - HWB2.B) * (HWB1.B - HWB2.B);\n\n\treturn diff;\n}",
  26196. "project": "php-src",
  26197. "hash": 313028172626822137293146407959188761999,
  26198. "size": 30,
  26199. "commit_id": "c395c6e5d7e8df37a21265ff76e48fe75ceb5ae6",
  26200. "message": "iFixed bug #72446 - Integer Overflow in gdImagePaletteToTrueColor() resulting in heap overflow",
  26201. "target": 0,
  26202. "dataset": "other",
  26203. "idx": 295192
  26204. }
  26205. ]
  26206. },
  26207. {
  26208. "call_depth": 3,
  26209. "longest_call_chain": [
  26210. "acpi_register_gsi",
  26211. "acpi_gsi_to_irq",
  26212. "gsi_irq_sharing"
  26213. ],
  26214. "group_size": 3,
  26215. "functions": [
  26216. {
  26217. "func": "static inline int gsi_irq_sharing(int gsi) { return gsi; }",
  26218. "target": 0,
  26219. "cwe": [],
  26220. "project": "linux-2.6",
  26221. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  26222. "hash": 198778032469776663148951417793982406815,
  26223. "size": 1,
  26224. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  26225. "dataset": "other",
  26226. "idx": 500011
  26227. },
  26228. {
  26229. "func": "int acpi_register_gsi(u32 gsi, int triggering, int polarity)\n{\n\tunsigned int irq;\n\tunsigned int plat_gsi = gsi;\n\n#ifdef CONFIG_PCI\n\t/*\n\t * Make sure all (legacy) PCI IRQs are set as level-triggered.\n\t */\n\tif (acpi_irq_model == ACPI_IRQ_MODEL_PIC) {\n\t\textern void eisa_set_level_irq(unsigned int irq);\n\n\t\tif (triggering == ACPI_LEVEL_SENSITIVE)\n\t\t\teisa_set_level_irq(gsi);\n\t}\n#endif\n\n#ifdef CONFIG_X86_IO_APIC\n\tif (acpi_irq_model == ACPI_IRQ_MODEL_IOAPIC) {\n\t\tplat_gsi = mp_register_gsi(gsi, triggering, polarity);\n\t}\n#endif\n\tacpi_gsi_to_irq(plat_gsi, &irq);\n\treturn irq;\n}",
  26230. "target": 0,
  26231. "cwe": [],
  26232. "project": "linux-2.6",
  26233. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  26234. "hash": 200884129183344529493421747188799869647,
  26235. "size": 25,
  26236. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  26237. "dataset": "other",
  26238. "idx": 500014
  26239. },
  26240. {
  26241. "func": "int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)\n{\n#ifdef CONFIG_X86_IO_APIC\n\tif (use_pci_vector() && !platform_legacy_irq(gsi))\n\t\t*irq = IO_APIC_VECTOR(gsi);\n\telse\n#endif\n\t\t*irq = gsi_irq_sharing(gsi);\n\treturn 0;\n}",
  26242. "target": 0,
  26243. "cwe": [],
  26244. "project": "linux-2.6",
  26245. "commit_id": "f0f4c3432e5e1087b3a8c0e6bd4113d3c37497ff",
  26246. "hash": 161080048401573734831045432367301008968,
  26247. "size": 10,
  26248. "message": "[PATCH] i386: add HPET(s) into resource map\n\nAdd HPET(s) into resource map. This will allow for the HPET(s) to be\nvisibile within /proc/iomem.\n\nSigned-off-by: Aaron Durbin <adurbin@google.com>\nSigned-off-by: Andi Kleen <ak@suse.de>",
  26249. "dataset": "other",
  26250. "idx": 499998
  26251. }
  26252. ]
  26253. },
  26254. {
  26255. "call_depth": 3,
  26256. "longest_call_chain": [
  26257. "rsi_mac80211_suspend",
  26258. "rsi_config_wowlan",
  26259. "rsi_wow_map_triggers"
  26260. ],
  26261. "group_size": 3,
  26262. "functions": [
  26263. {
  26264. "func": "static u16 rsi_wow_map_triggers(struct rsi_common *common,\n\t\t\t\tstruct cfg80211_wowlan *wowlan)\n{\n\tu16 wow_triggers = 0;\n\n\trsi_dbg(INFO_ZONE, \"Mapping wowlan triggers\\n\");\n\n\tif (wowlan->any)\n\t\twow_triggers |= RSI_WOW_ANY;\n\tif (wowlan->magic_pkt)\n\t\twow_triggers |= RSI_WOW_MAGIC_PKT;\n\tif (wowlan->disconnect)\n\t\twow_triggers |= RSI_WOW_DISCONNECT;\n\tif (wowlan->gtk_rekey_failure || wowlan->eap_identity_req ||\n\t wowlan->four_way_handshake)\n\t\twow_triggers |= RSI_WOW_GTK_REKEY;\n\n\treturn wow_triggers;\n}",
  26265. "project": "linux",
  26266. "hash": 291939068704885584682270027831021533582,
  26267. "size": 19,
  26268. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  26269. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  26270. "target": 0,
  26271. "dataset": "other",
  26272. "idx": 461654
  26273. },
  26274. {
  26275. "func": "int rsi_config_wowlan(struct rsi_hw *adapter, struct cfg80211_wowlan *wowlan)\n{\n\tstruct rsi_common *common = adapter->priv;\n\tu16 triggers = 0;\n\tu16 rx_filter_word = 0;\n\tstruct ieee80211_bss_conf *bss = NULL;\n\n\trsi_dbg(INFO_ZONE, \"Config WoWLAN to device\\n\");\n\n\tif (!adapter->vifs[0])\n\t\treturn -EINVAL;\n\n\tbss = &adapter->vifs[0]->bss_conf;\n\n\tif (WARN_ON(!wowlan)) {\n\t\trsi_dbg(ERR_ZONE, \"WoW triggers not enabled\\n\");\n\t\treturn -EINVAL;\n\t}\n\n\tcommon->wow_flags |= RSI_WOW_ENABLED;\n\ttriggers = rsi_wow_map_triggers(common, wowlan);\n\tif (!triggers) {\n\t\trsi_dbg(ERR_ZONE, \"%s:No valid WoW triggers\\n\", __func__);\n\t\treturn -EINVAL;\n\t}\n\tif (!bss->assoc) {\n\t\trsi_dbg(ERR_ZONE,\n\t\t\t\"Cannot configure WoWLAN (Station not connected)\\n\");\n\t\tcommon->wow_flags |= RSI_WOW_NO_CONNECTION;\n\t\treturn 0;\n\t}\n\trsi_dbg(INFO_ZONE, \"TRIGGERS %x\\n\", triggers);\n\trsi_send_wowlan_request(common, triggers, 1);\n\n\t/**\n\t * Increase the beacon_miss threshold & keep-alive timers in\n\t * vap_update frame\n\t */\n\trsi_send_vap_dynamic_update(common);\n\n\trx_filter_word = (ALLOW_DATA_ASSOC_PEER | DISALLOW_BEACONS);\n\trsi_send_rx_filter_frame(common, rx_filter_word);\n\n\treturn 0;\n}",
  26276. "project": "linux",
  26277. "hash": 120071220139982796540823250810229927855,
  26278. "size": 45,
  26279. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  26280. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  26281. "target": 0,
  26282. "dataset": "other",
  26283. "idx": 461668
  26284. },
  26285. {
  26286. "func": "static int rsi_mac80211_suspend(struct ieee80211_hw *hw,\n\t\t\t\tstruct cfg80211_wowlan *wowlan)\n{\n\tstruct rsi_hw *adapter = hw->priv;\n\tstruct rsi_common *common = adapter->priv;\n\n\trsi_dbg(INFO_ZONE, \"%s: mac80211 suspend\\n\", __func__);\n\tmutex_lock(&common->mutex);\n\tif (rsi_config_wowlan(adapter, wowlan)) {\n\t\trsi_dbg(ERR_ZONE, \"Failed to configure WoWLAN\\n\");\n\t\tmutex_unlock(&common->mutex);\n\t\treturn 1;\n\t}\n\tmutex_unlock(&common->mutex);\n\n\treturn 0;\n}",
  26287. "project": "linux",
  26288. "hash": 9567306817360433743729872099058819311,
  26289. "size": 17,
  26290. "commit_id": "abd39c6ded9db53aa44c2540092bdd5fb6590fa8",
  26291. "message": "rsi: add fix for crash during assertions\n\nObserved crash in some scenarios when assertion has occurred,\nthis is because hw structure is freed and is tried to get\naccessed in some functions where null check is already\npresent. So, avoided the crash by making the hw to NULL after\nfreeing.\n\nSigned-off-by: Sanjay Konduri <sanjay.konduri@redpinesignals.com>\nSigned-off-by: Sushant Kumar Mishra <sushant.mishra@redpinesignals.com>\nSigned-off-by: Kalle Valo <kvalo@codeaurora.org>",
  26292. "target": 0,
  26293. "dataset": "other",
  26294. "idx": 461652
  26295. }
  26296. ]
  26297. },
  26298. {
  26299. "call_depth": 3,
  26300. "longest_call_chain": [
  26301. "ip_finish_output",
  26302. "ip_finish_output_gso",
  26303. "ip_finish_output2"
  26304. ],
  26305. "group_size": 4,
  26306. "functions": [
  26307. {
  26308. "func": "static int ip_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,\n\t\t unsigned int mtu,\n\t\t int (*output)(struct net *, struct sock *, struct sk_buff *))\n{\n\tstruct iphdr *iph = ip_hdr(skb);\n\n\tif ((iph->frag_off & htons(IP_DF)) == 0)\n\t\treturn ip_do_fragment(net, sk, skb, output);\n\n\tif (unlikely(!skb->ignore_df ||\n\t\t (IPCB(skb)->frag_max_size &&\n\t\t IPCB(skb)->frag_max_size > mtu))) {\n\t\tIP_INC_STATS(net, IPSTATS_MIB_FRAGFAILS);\n\t\ticmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED,\n\t\t\t htonl(mtu));\n\t\tkfree_skb(skb);\n\t\treturn -EMSGSIZE;\n\t}\n\n\treturn ip_do_fragment(net, sk, skb, output);\n}",
  26309. "project": "net",
  26310. "hash": 154873400028567929086961473551016671506,
  26311. "size": 21,
  26312. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  26313. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  26314. "target": 0,
  26315. "dataset": "other",
  26316. "idx": 468966
  26317. },
  26318. {
  26319. "func": "static int ip_finish_output2(struct net *net, struct sock *sk, struct sk_buff *skb)\n{\n\tstruct dst_entry *dst = skb_dst(skb);\n\tstruct rtable *rt = (struct rtable *)dst;\n\tstruct net_device *dev = dst->dev;\n\tunsigned int hh_len = LL_RESERVED_SPACE(dev);\n\tstruct neighbour *neigh;\n\tu32 nexthop;\n\n\tif (rt->rt_type == RTN_MULTICAST) {\n\t\tIP_UPD_PO_STATS(net, IPSTATS_MIB_OUTMCAST, skb->len);\n\t} else if (rt->rt_type == RTN_BROADCAST)\n\t\tIP_UPD_PO_STATS(net, IPSTATS_MIB_OUTBCAST, skb->len);\n\n\t/* Be paranoid, rather than too clever. */\n\tif (unlikely(skb_headroom(skb) < hh_len && dev->header_ops)) {\n\t\tstruct sk_buff *skb2;\n\n\t\tskb2 = skb_realloc_headroom(skb, LL_RESERVED_SPACE(dev));\n\t\tif (!skb2) {\n\t\t\tkfree_skb(skb);\n\t\t\treturn -ENOMEM;\n\t\t}\n\t\tif (skb->sk)\n\t\t\tskb_set_owner_w(skb2, skb->sk);\n\t\tconsume_skb(skb);\n\t\tskb = skb2;\n\t}\n\n\tif (lwtunnel_xmit_redirect(dst->lwtstate)) {\n\t\tint res = lwtunnel_xmit(skb);\n\n\t\tif (res < 0 || res == LWTUNNEL_XMIT_DONE)\n\t\t\treturn res;\n\t}\n\n\trcu_read_lock_bh();\n\tnexthop = (__force u32) rt_nexthop(rt, ip_hdr(skb)->daddr);\n\tneigh = __ipv4_neigh_lookup_noref(dev, nexthop);\n\tif (unlikely(!neigh))\n\t\tneigh = __neigh_create(&arp_tbl, &nexthop, dev, false);\n\tif (!IS_ERR(neigh)) {\n\t\tint res;\n\n\t\tsock_confirm_neigh(skb, neigh);\n\t\tres = neigh_output(neigh, skb);\n\n\t\trcu_read_unlock_bh();\n\t\treturn res;\n\t}\n\trcu_read_unlock_bh();\n\n\tnet_dbg_ratelimited(\"%s: No header cache and no neighbour!\\n\",\n\t\t\t __func__);\n\tkfree_skb(skb);\n\treturn -EINVAL;\n}",
  26320. "project": "net",
  26321. "hash": 279874634117793563501036273622582830759,
  26322. "size": 57,
  26323. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  26324. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  26325. "target": 0,
  26326. "dataset": "other",
  26327. "idx": 468958
  26328. },
  26329. {
  26330. "func": "static int ip_finish_output_gso(struct net *net, struct sock *sk,\n\t\t\t\tstruct sk_buff *skb, unsigned int mtu)\n{\n\tnetdev_features_t features;\n\tstruct sk_buff *segs;\n\tint ret = 0;\n\n\t/* common case: seglen is <= mtu\n\t */\n\tif (skb_gso_validate_mtu(skb, mtu))\n\t\treturn ip_finish_output2(net, sk, skb);\n\n\t/* Slowpath - GSO segment length exceeds the egress MTU.\n\t *\n\t * This can happen in several cases:\n\t * - Forwarding of a TCP GRO skb, when DF flag is not set.\n\t * - Forwarding of an skb that arrived on a virtualization interface\n\t * (virtio-net/vhost/tap) with TSO/GSO size set by other network\n\t * stack.\n\t * - Local GSO skb transmitted on an NETIF_F_TSO tunnel stacked over an\n\t * interface with a smaller MTU.\n\t * - Arriving GRO skb (or GSO skb in a virtualized environment) that is\n\t * bridged to a NETIF_F_TSO tunnel stacked over an interface with an\n\t * insufficent MTU.\n\t */\n\tfeatures = netif_skb_features(skb);\n\tBUILD_BUG_ON(sizeof(*IPCB(skb)) > SKB_SGO_CB_OFFSET);\n\tsegs = skb_gso_segment(skb, features & ~NETIF_F_GSO_MASK);\n\tif (IS_ERR_OR_NULL(segs)) {\n\t\tkfree_skb(skb);\n\t\treturn -ENOMEM;\n\t}\n\n\tconsume_skb(skb);\n\n\tdo {\n\t\tstruct sk_buff *nskb = segs->next;\n\t\tint err;\n\n\t\tsegs->next = NULL;\n\t\terr = ip_fragment(net, sk, segs, mtu, ip_finish_output2);\n\n\t\tif (err && ret == 0)\n\t\t\tret = err;\n\t\tsegs = nskb;\n\t} while (segs);\n\n\treturn ret;\n}",
  26331. "project": "net",
  26332. "hash": 299472189074641285610112881268118105183,
  26333. "size": 49,
  26334. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  26335. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  26336. "target": 0,
  26337. "dataset": "other",
  26338. "idx": 468959
  26339. },
  26340. {
  26341. "func": "static int ip_finish_output(struct net *net, struct sock *sk, struct sk_buff *skb)\n{\n\tunsigned int mtu;\n\tint ret;\n\n\tret = BPF_CGROUP_RUN_PROG_INET_EGRESS(sk, skb);\n\tif (ret) {\n\t\tkfree_skb(skb);\n\t\treturn ret;\n\t}\n\n#if defined(CONFIG_NETFILTER) && defined(CONFIG_XFRM)\n\t/* Policy lookup after SNAT yielded a new policy */\n\tif (skb_dst(skb)->xfrm) {\n\t\tIPCB(skb)->flags |= IPSKB_REROUTED;\n\t\treturn dst_output(net, sk, skb);\n\t}\n#endif\n\tmtu = ip_skb_dst_mtu(sk, skb);\n\tif (skb_is_gso(skb))\n\t\treturn ip_finish_output_gso(net, sk, skb, mtu);\n\n\tif (skb->len > mtu || (IPCB(skb)->flags & IPSKB_FRAG_PMTU))\n\t\treturn ip_fragment(net, sk, skb, mtu, ip_finish_output2);\n\n\treturn ip_finish_output2(net, sk, skb);\n}",
  26342. "project": "net",
  26343. "hash": 191822427021009706653025673605283189168,
  26344. "size": 27,
  26345. "commit_id": "85f1bd9a7b5a79d5baa8bf44af19658f7bf77bfa",
  26346. "message": "udp: consistently apply ufo or fragmentation\n\nWhen iteratively building a UDP datagram with MSG_MORE and that\ndatagram exceeds MTU, consistently choose UFO or fragmentation.\n\nOnce skb_is_gso, always apply ufo. Conversely, once a datagram is\nsplit across multiple skbs, do not consider ufo.\n\nSendpage already maintains the first invariant, only add the second.\nIPv6 does not have a sendpage implementation to modify.\n\nA gso skb must have a partial checksum, do not follow sk_no_check_tx\nin udp_send_skb.\n\nFound by syzkaller.\n\nFixes: e89e9cf539a2 (\"[IPv4/IPv6]: UFO Scatter-gather approach\")\nReported-by: Andrey Konovalov <andreyknvl@google.com>\nSigned-off-by: Willem de Bruijn <willemb@google.com>\nSigned-off-by: David S. Miller <davem@davemloft.net>",
  26347. "target": 0,
  26348. "dataset": "other",
  26349. "idx": 469014
  26350. }
  26351. ]
  26352. },
  26353. {
  26354. "call_depth": 3,
  26355. "longest_call_chain": [
  26356. "mmdrop_async_fn",
  26357. "__mmdrop",
  26358. "check_mm"
  26359. ],
  26360. "group_size": 4,
  26361. "functions": [
  26362. {
  26363. "func": "static void mmdrop_async_fn(struct work_struct *work)\n{\n\tstruct mm_struct *mm;\n\n\tmm = container_of(work, struct mm_struct, async_put_work);\n\t__mmdrop(mm);\n}",
  26364. "project": "linux",
  26365. "hash": 92149953274283011598925228937866465334,
  26366. "size": 7,
  26367. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  26368. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26369. "target": 0,
  26370. "dataset": "other",
  26371. "idx": 293713
  26372. },
  26373. {
  26374. "func": "void __mmdrop(struct mm_struct *mm)\n{\n\tBUG_ON(mm == &init_mm);\n\tWARN_ON_ONCE(mm == current->mm);\n\tWARN_ON_ONCE(mm == current->active_mm);\n\tmm_free_pgd(mm);\n\tdestroy_context(mm);\n\tmmu_notifier_subscriptions_destroy(mm);\n\tcheck_mm(mm);\n\tput_user_ns(mm->user_ns);\n\tfree_mm(mm);\n}",
  26375. "project": "linux",
  26376. "hash": 140936636376116300533502763524354099192,
  26377. "size": 12,
  26378. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  26379. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26380. "target": 0,
  26381. "dataset": "other",
  26382. "idx": 293639
  26383. },
  26384. {
  26385. "func": "static inline void mm_free_pgd(struct mm_struct *mm)\n{\n\tpgd_free(mm, mm->pgd);\n}",
  26386. "project": "linux",
  26387. "hash": 29738674307397040606404287122312356129,
  26388. "size": 4,
  26389. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  26390. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26391. "target": 0,
  26392. "dataset": "other",
  26393. "idx": 293685
  26394. },
  26395. {
  26396. "func": "static void check_mm(struct mm_struct *mm)\n{\n\tint i;\n\n\tBUILD_BUG_ON_MSG(ARRAY_SIZE(resident_page_types) != NR_MM_COUNTERS,\n\t\t\t \"Please make sure 'struct resident_page_types[]' is updated as well\");\n\n\tfor (i = 0; i < NR_MM_COUNTERS; i++) {\n\t\tlong x = atomic_long_read(&mm->rss_stat.count[i]);\n\n\t\tif (unlikely(x))\n\t\t\tpr_alert(\"BUG: Bad rss-counter state mm:%p type:%s val:%ld\\n\",\n\t\t\t\t mm, resident_page_types[i], x);\n\t}\n\n\tif (mm_pgtables_bytes(mm))\n\t\tpr_alert(\"BUG: non-zero pgtables_bytes on freeing mm: %ld\\n\",\n\t\t\t\tmm_pgtables_bytes(mm));\n\n#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS\n\tVM_BUG_ON_MM(mm->pmd_huge_pte, mm);\n#endif\n}",
  26397. "project": "linux",
  26398. "hash": 190587792120355999114255332097185446222,
  26399. "size": 23,
  26400. "commit_id": "b4e00444cab4c3f3fec876dc0cccc8cbb0d1a948",
  26401. "message": "fork: fix copy_process(CLONE_PARENT) race with the exiting ->real_parent\n\ncurrent->group_leader->exit_signal may change during copy_process() if\ncurrent->real_parent exits.\n\nMove the assignment inside tasklist_lock to avoid the race.\n\nSigned-off-by: Eddy Wu <eddy_wu@trendmicro.com>\nAcked-by: Oleg Nesterov <oleg@redhat.com>\nSigned-off-by: Linus Torvalds <torvalds@linux-foundation.org>",
  26402. "target": 0,
  26403. "dataset": "other",
  26404. "idx": 293634
  26405. }
  26406. ]
  26407. },
  26408. {
  26409. "call_depth": 3,
  26410. "longest_call_chain": [
  26411. "match_sums",
  26412. "hash_search",
  26413. "matched"
  26414. ],
  26415. "group_size": 5,
  26416. "functions": [
  26417. {
  26418. "func": "void match_sums(int f, struct sum_struct *s, struct map_struct *buf, OFF_T len)\n{\n\tchar file_sum[MAX_DIGEST_LEN];\n\tint sum_len;\n\n\tlast_match = 0;\n\tfalse_alarms = 0;\n\thash_hits = 0;\n\tmatches = 0;\n\tdata_transfer = 0;\n\n\tsum_init(checksum_seed);\n\n\tif (append_mode > 0) {\n\t\tif (append_mode == 2) {\n\t\t\tOFF_T j = 0;\n\t\t\tfor (j = CHUNK_SIZE; j < s->flength; j += CHUNK_SIZE) {\n\t\t\t\tif (buf && do_progress)\n\t\t\t\t\tshow_progress(last_match, buf->file_size);\n\t\t\t\tsum_update(map_ptr(buf, last_match, CHUNK_SIZE),\n\t\t\t\t\t CHUNK_SIZE);\n\t\t\t\tlast_match = j;\n\t\t\t}\n\t\t\tif (last_match < s->flength) {\n\t\t\t\tint32 n = (int32)(s->flength - last_match);\n\t\t\t\tif (buf && do_progress)\n\t\t\t\t\tshow_progress(last_match, buf->file_size);\n\t\t\t\tsum_update(map_ptr(buf, last_match, n), n);\n\t\t\t}\n\t\t}\n\t\tlast_match = s->flength;\n\t\ts->count = 0;\n\t}\n\n\tif (len > 0 && s->count > 0) {\n\t\tbuild_hash_table(s);\n\n\t\tif (verbose > 2)\n\t\t\trprintf(FINFO,\"built hash table\\n\");\n\n\t\thash_search(f, s, buf, len);\n\n\t\tif (verbose > 2)\n\t\t\trprintf(FINFO,\"done hash search\\n\");\n\t} else {\n\t\tOFF_T j;\n\t\t/* by doing this in pieces we avoid too many seeks */\n\t\tfor (j = last_match + CHUNK_SIZE; j < len; j += CHUNK_SIZE)\n\t\t\tmatched(f, s, buf, j, -2);\n\t\tmatched(f, s, buf, len, -1);\n\t}\n\n\tsum_len = sum_end(file_sum);\n\t/* If we had a read error, send a bad checksum. */\n\tif (buf && buf->status != 0)\n\t\tfile_sum[0]++;\n\n\tif (verbose > 2)\n\t\trprintf(FINFO,\"sending file_sum\\n\");\n\twrite_buf(f, file_sum, sum_len);\n\n\tif (verbose > 2)\n\t\trprintf(FINFO, \"false_alarms=%d hash_hits=%d matches=%d\\n\",\n\t\t\tfalse_alarms, hash_hits, matches);\n\n\ttotal_hash_hits += hash_hits;\n\ttotal_false_alarms += false_alarms;\n\ttotal_matches += matches;\n\tstats.literal_data += data_transfer;\n}",
  26419. "project": "rsync",
  26420. "hash": 37923117477280821757970530343326723404,
  26421. "size": 70,
  26422. "commit_id": "c8255147b06b74dad940d32f9cef5fbe17595239",
  26423. "message": "Optimize finding the sum that matches our --inplace position.",
  26424. "target": 0,
  26425. "dataset": "other",
  26426. "idx": 248547
  26427. },
  26428. {
  26429. "func": "static void matched(int f, struct sum_struct *s, struct map_struct *buf,\n\t\t OFF_T offset, int32 i)\n{\n\tint32 n = (int32)(offset - last_match); /* max value: block_size (int32) */\n\tint32 j;\n\n\tif (verbose > 2 && i >= 0) {\n\t\trprintf(FINFO,\n\t\t\t\"match at %.0f last_match=%.0f j=%d len=%ld n=%ld\\n\",\n\t\t\t(double)offset, (double)last_match, i,\n\t\t\t(long)s->sums[i].len, (long)n);\n\t}\n\n\tsend_token(f, i, buf, last_match, n, i < 0 ? 0 : s->sums[i].len);\n\tdata_transfer += n;\n\n\tif (i >= 0) {\n\t\tstats.matched_data += s->sums[i].len;\n\t\tn += s->sums[i].len;\n\t}\n\n\tfor (j = 0; j < n; j += CHUNK_SIZE) {\n\t\tint32 n1 = MIN(CHUNK_SIZE, n - j);\n\t\tsum_update(map_ptr(buf, last_match + j, n1), n1);\n\t}\n\n\tif (i >= 0)\n\t\tlast_match = offset + s->sums[i].len;\n\telse\n\t\tlast_match = offset;\n\n\tif (buf && do_progress)\n\t\tshow_progress(last_match, buf->file_size);\n}",
  26430. "project": "rsync",
  26431. "hash": 57643269069713905410840787588128113674,
  26432. "size": 34,
  26433. "commit_id": "c8255147b06b74dad940d32f9cef5fbe17595239",
  26434. "message": "Optimize finding the sum that matches our --inplace position.",
  26435. "target": 0,
  26436. "dataset": "other",
  26437. "idx": 248546
  26438. },
  26439. {
  26440. "func": "static void hash_search(int f,struct sum_struct *s,\n\t\t\tstruct map_struct *buf, OFF_T len)\n{\n\tOFF_T offset, aligned_offset, end;\n\tint32 k, want_i, backup;\n\tchar sum2[SUM_LENGTH];\n\tuint32 s1, s2, sum;\n\tint more;\n\tschar *map;\n\n\t/* want_i is used to encourage adjacent matches, allowing the RLL\n\t * coding of the output to work more efficiently. */\n\twant_i = 0;\n\n\tif (verbose > 2) {\n\t\trprintf(FINFO, \"hash search b=%ld len=%.0f\\n\",\n\t\t\t(long)s->blength, (double)len);\n\t}\n\n\tk = (int32)MIN(len, (OFF_T)s->blength);\n\n\tmap = (schar *)map_ptr(buf, 0, k);\n\n\tsum = get_checksum1((char *)map, k);\n\ts1 = sum & 0xFFFF;\n\ts2 = sum >> 16;\n\tif (verbose > 3)\n\t\trprintf(FINFO, \"sum=%.8x k=%ld\\n\", sum, (long)k);\n\n\toffset = aligned_offset = 0;\n\n\tend = len + 1 - s->sums[s->count-1].len;\n\n\tif (verbose > 3) {\n\t\trprintf(FINFO, \"hash search s->blength=%ld len=%.0f count=%.0f\\n\",\n\t\t\t(long)s->blength, (double)len, (double)s->count);\n\t}\n\n\tdo {\n\t\tint done_csum2 = 0;\n\t\tint32 i;\n\n\t\tif (verbose > 4) {\n\t\t\trprintf(FINFO, \"offset=%.0f sum=%04x%04x\\n\",\n\t\t\t\t(double)offset, s2 & 0xFFFF, s1 & 0xFFFF);\n\t\t}\n\n\t\tif (tablesize == TRADITIONAL_TABLESIZE) {\n\t\t\tif ((i = hash_table[SUM2HASH2(s1,s2)]) < 0)\n\t\t\t\tgoto null_hash;\n\t\t\tsum = (s1 & 0xffff) | (s2 << 16);\n\t\t} else {\n\t\t\tsum = (s1 & 0xffff) | (s2 << 16);\n\t\t\tif ((i = hash_table[BIG_SUM2HASH(sum)]) < 0)\n\t\t\t\tgoto null_hash;\n\t\t}\n\n\t\thash_hits++;\n\t\tdo {\n\t\t\tint32 l;\n\n\t\t\tif (sum != s->sums[i].sum1)\n\t\t\t\tcontinue;\n\n\t\t\t/* also make sure the two blocks are the same length */\n\t\t\tl = (int32)MIN((OFF_T)s->blength, len-offset);\n\t\t\tif (l != s->sums[i].len)\n\t\t\t\tcontinue;\n\n\t\t\t/* in-place: ensure chunk's offset is either >= our\n\t\t\t * offset or that the data didn't move. */\n\t\t\tif (updating_basis_file && s->sums[i].offset < offset\n\t\t\t && !(s->sums[i].flags & SUMFLG_SAME_OFFSET))\n\t\t\t\tcontinue;\n\n\t\t\tif (verbose > 3) {\n\t\t\t\trprintf(FINFO,\n\t\t\t\t\t\"potential match at %.0f i=%ld sum=%08x\\n\",\n\t\t\t\t\t(double)offset, (long)i, sum);\n\t\t\t}\n\n\t\t\tif (!done_csum2) {\n\t\t\t\tmap = (schar *)map_ptr(buf,offset,l);\n\t\t\t\tget_checksum2((char *)map,l,sum2);\n\t\t\t\tdone_csum2 = 1;\n\t\t\t}\n\n\t\t\tif (memcmp(sum2,s->sums[i].sum2,s->s2length) != 0) {\n\t\t\t\tfalse_alarms++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/* When updating in-place, the best possible match is\n\t\t\t * one with an identical offset, so we prefer that over\n\t\t\t * the adjacent want_i optimization. */\n\t\t\tif (updating_basis_file) {\n\t\t\t\t/* All the generator's chunks start at blength boundaries. */\n\t\t\t\twhile (aligned_offset < offset)\n\t\t\t\t\taligned_offset += s->blength;\n\t\t\t\tif (offset == aligned_offset) {\n\t\t\t\t\tint32 i2;\n\t\t\t\t\tfor (i2 = i; i2 >= 0; i2 = s->sums[i2].chain) {\n\t\t\t\t\t\tif (s->sums[i2].offset != offset)\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\tif (i2 != i) {\n\t\t\t\t\t\t\tif (sum != s->sums[i2].sum1\n\t\t\t\t\t\t\t || l != s->sums[i2].len\n\t\t\t\t\t\t\t || memcmp(sum2, s->sums[i2].sum2, s->s2length) != 0)\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\ti = i2;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* This chunk remained in the same spot in the old and new file. */\n\t\t\t\t\t\ts->sums[i].flags |= SUMFLG_SAME_OFFSET;\n\t\t\t\t\t\twant_i = i;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t/* we've found a match, but now check to see\n\t\t\t * if want_i can hint at a better match. */\n\t\t\tif (i != want_i && want_i < s->count\n\t\t\t && (!updating_basis_file || s->sums[want_i].offset >= offset\n\t\t\t || s->sums[want_i].flags & SUMFLG_SAME_OFFSET)\n\t\t\t && sum == s->sums[want_i].sum1\n\t\t\t && memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) {\n\t\t\t\t/* we've found an adjacent match - the RLL coder\n\t\t\t\t * will be happy */\n\t\t\t\ti = want_i;\n\t\t\t}\n\t\t\twant_i = i + 1;\n\n\t\t\tmatched(f,s,buf,offset,i);\n\t\t\toffset += s->sums[i].len - 1;\n\t\t\tk = (int32)MIN((OFF_T)s->blength, len-offset);\n\t\t\tmap = (schar *)map_ptr(buf, offset, k);\n\t\t\tsum = get_checksum1((char *)map, k);\n\t\t\ts1 = sum & 0xFFFF;\n\t\t\ts2 = sum >> 16;\n\t\t\tmatches++;\n\t\t\tbreak;\n\t\t} while ((i = s->sums[i].chain) >= 0);\n\n\t null_hash:\n\t\tbackup = (int32)(offset - last_match);\n\t\t/* We sometimes read 1 byte prior to last_match... */\n\t\tif (backup < 0)\n\t\t\tbackup = 0;\n\n\t\t/* Trim off the first byte from the checksum */\n\t\tmore = offset + k < len;\n\t\tmap = (schar *)map_ptr(buf, offset - backup, k + more + backup)\n\t\t + backup;\n\t\ts1 -= map[0] + CHAR_OFFSET;\n\t\ts2 -= k * (map[0]+CHAR_OFFSET);\n\n\t\t/* Add on the next byte (if there is one) to the checksum */\n\t\tif (more) {\n\t\t\ts1 += map[k] + CHAR_OFFSET;\n\t\t\ts2 += s1;\n\t\t} else\n\t\t\t--k;\n\n\t\t/* By matching early we avoid re-reading the\n\t\t data 3 times in the case where a token\n\t\t match comes a long way after last\n\t\t match. The 3 reads are caused by the\n\t\t running match, the checksum update and the\n\t\t literal send. */\n\t\tif (backup >= s->blength+CHUNK_SIZE && end-offset > CHUNK_SIZE)\n\t\t\tmatched(f, s, buf, offset - s->blength, -2);\n\t} while (++offset < end);\n\n\tmatched(f, s, buf, len, -1);\n\tmap_ptr(buf, len-1, 1);\n}",
  26441. "project": "rsync",
  26442. "hash": 13269351929661258568831239064102968322,
  26443. "size": 176,
  26444. "commit_id": "c8255147b06b74dad940d32f9cef5fbe17595239",
  26445. "message": "Optimize finding the sum that matches our --inplace position.",
  26446. "target": 1,
  26447. "dataset": "other",
  26448. "idx": 196927
  26449. },
  26450. {
  26451. "func": "static void hash_search(int f,struct sum_struct *s,\n\t\t\tstruct map_struct *buf, OFF_T len)\n{\n\tOFF_T offset, aligned_offset, end;\n\tint32 k, want_i, aligned_i, backup;\n\tchar sum2[SUM_LENGTH];\n\tuint32 s1, s2, sum;\n\tint more;\n\tschar *map;\n\n\t/* want_i is used to encourage adjacent matches, allowing the RLL\n\t * coding of the output to work more efficiently. */\n\twant_i = 0;\n\n\tif (verbose > 2) {\n\t\trprintf(FINFO, \"hash search b=%ld len=%.0f\\n\",\n\t\t\t(long)s->blength, (double)len);\n\t}\n\n\tk = (int32)MIN(len, (OFF_T)s->blength);\n\n\tmap = (schar *)map_ptr(buf, 0, k);\n\n\tsum = get_checksum1((char *)map, k);\n\ts1 = sum & 0xFFFF;\n\ts2 = sum >> 16;\n\tif (verbose > 3)\n\t\trprintf(FINFO, \"sum=%.8x k=%ld\\n\", sum, (long)k);\n\n\toffset = aligned_offset = aligned_i = 0;\n\n\tend = len + 1 - s->sums[s->count-1].len;\n\n\tif (verbose > 3) {\n\t\trprintf(FINFO, \"hash search s->blength=%ld len=%.0f count=%.0f\\n\",\n\t\t\t(long)s->blength, (double)len, (double)s->count);\n\t}\n\n\tdo {\n\t\tint done_csum2 = 0;\n\t\tint32 i;\n\n\t\tif (verbose > 4) {\n\t\t\trprintf(FINFO, \"offset=%.0f sum=%04x%04x\\n\",\n\t\t\t\t(double)offset, s2 & 0xFFFF, s1 & 0xFFFF);\n\t\t}\n\n\t\tif (tablesize == TRADITIONAL_TABLESIZE) {\n\t\t\tif ((i = hash_table[SUM2HASH2(s1,s2)]) < 0)\n\t\t\t\tgoto null_hash;\n\t\t\tsum = (s1 & 0xffff) | (s2 << 16);\n\t\t} else {\n\t\t\tsum = (s1 & 0xffff) | (s2 << 16);\n\t\t\tif ((i = hash_table[BIG_SUM2HASH(sum)]) < 0)\n\t\t\t\tgoto null_hash;\n\t\t}\n\n\t\thash_hits++;\n\t\tdo {\n\t\t\tint32 l;\n\n\t\t\tif (sum != s->sums[i].sum1)\n\t\t\t\tcontinue;\n\n\t\t\t/* also make sure the two blocks are the same length */\n\t\t\tl = (int32)MIN((OFF_T)s->blength, len-offset);\n\t\t\tif (l != s->sums[i].len)\n\t\t\t\tcontinue;\n\n\t\t\t/* in-place: ensure chunk's offset is either >= our\n\t\t\t * offset or that the data didn't move. */\n\t\t\tif (updating_basis_file && s->sums[i].offset < offset\n\t\t\t && !(s->sums[i].flags & SUMFLG_SAME_OFFSET))\n\t\t\t\tcontinue;\n\n\t\t\tif (verbose > 3) {\n\t\t\t\trprintf(FINFO,\n\t\t\t\t\t\"potential match at %.0f i=%ld sum=%08x\\n\",\n\t\t\t\t\t(double)offset, (long)i, sum);\n\t\t\t}\n\n\t\t\tif (!done_csum2) {\n\t\t\t\tmap = (schar *)map_ptr(buf,offset,l);\n\t\t\t\tget_checksum2((char *)map,l,sum2);\n\t\t\t\tdone_csum2 = 1;\n\t\t\t}\n\n\t\t\tif (memcmp(sum2,s->sums[i].sum2,s->s2length) != 0) {\n\t\t\t\tfalse_alarms++;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t/* When updating in-place, the best possible match is\n\t\t\t * one with an identical offset, so we prefer that over\n\t\t\t * the adjacent want_i optimization. */\n\t\t\tif (updating_basis_file) {\n\t\t\t\t/* All the generator's chunks start at blength boundaries. */\n\t\t\t\twhile (aligned_offset < offset) {\n\t\t\t\t\taligned_offset += s->blength;\n\t\t\t\t\taligned_i++;\n\t\t\t\t}\n\t\t\t\tif (offset == aligned_offset) {\n\t\t\t\t\tif (i != aligned_i) {\n\t\t\t\t\t\tif (sum != s->sums[aligned_i].sum1\n\t\t\t\t\t\t || l != s->sums[aligned_i].len\n\t\t\t\t\t\t || memcmp(sum2, s->sums[aligned_i].sum2, s->s2length) != 0)\n\t\t\t\t\t\t\tgoto check_want_i;\n\t\t\t\t\t\ti = aligned_i;\n\t\t\t\t\t}\n\t\t\t\t\t/* This identical chunk is in the same spot in the old and new file. */\n\t\t\t\t\ts->sums[i].flags |= SUMFLG_SAME_OFFSET;\n\t\t\t\t\twant_i = i;\n\t\t\t\t}\n\t\t\t}\n\n\t\t check_want_i:\n\t\t\t/* we've found a match, but now check to see\n\t\t\t * if want_i can hint at a better match. */\n\t\t\tif (i != want_i && want_i < s->count\n\t\t\t && (!updating_basis_file || s->sums[want_i].offset >= offset\n\t\t\t || s->sums[want_i].flags & SUMFLG_SAME_OFFSET)\n\t\t\t && sum == s->sums[want_i].sum1\n\t\t\t && memcmp(sum2, s->sums[want_i].sum2, s->s2length) == 0) {\n\t\t\t\t/* we've found an adjacent match - the RLL coder\n\t\t\t\t * will be happy */\n\t\t\t\ti = want_i;\n\t\t\t}\n\t\t\twant_i = i + 1;\n\n\t\t\tmatched(f,s,buf,offset,i);\n\t\t\toffset += s->sums[i].len - 1;\n\t\t\tk = (int32)MIN((OFF_T)s->blength, len-offset);\n\t\t\tmap = (schar *)map_ptr(buf, offset, k);\n\t\t\tsum = get_checksum1((char *)map, k);\n\t\t\ts1 = sum & 0xFFFF;\n\t\t\ts2 = sum >> 16;\n\t\t\tmatches++;\n\t\t\tbreak;\n\t\t} while ((i = s->sums[i].chain) >= 0);\n\n\t null_hash:\n\t\tbackup = (int32)(offset - last_match);\n\t\t/* We sometimes read 1 byte prior to last_match... */\n\t\tif (backup < 0)\n\t\t\tbackup = 0;\n\n\t\t/* Trim off the first byte from the checksum */\n\t\tmore = offset + k < len;\n\t\tmap = (schar *)map_ptr(buf, offset - backup, k + more + backup)\n\t\t + backup;\n\t\ts1 -= map[0] + CHAR_OFFSET;\n\t\ts2 -= k * (map[0]+CHAR_OFFSET);\n\n\t\t/* Add on the next byte (if there is one) to the checksum */\n\t\tif (more) {\n\t\t\ts1 += map[k] + CHAR_OFFSET;\n\t\t\ts2 += s1;\n\t\t} else\n\t\t\t--k;\n\n\t\t/* By matching early we avoid re-reading the\n\t\t data 3 times in the case where a token\n\t\t match comes a long way after last\n\t\t match. The 3 reads are caused by the\n\t\t running match, the checksum update and the\n\t\t literal send. */\n\t\tif (backup >= s->blength+CHUNK_SIZE && end-offset > CHUNK_SIZE)\n\t\t\tmatched(f, s, buf, offset - s->blength, -2);\n\t} while (++offset < end);\n\n\tmatched(f, s, buf, len, -1);\n\tmap_ptr(buf, len-1, 1);\n}",
  26452. "project": "rsync",
  26453. "hash": 282231606510893388476838486510622012833,
  26454. "size": 173,
  26455. "commit_id": "c8255147b06b74dad940d32f9cef5fbe17595239",
  26456. "message": "Optimize finding the sum that matches our --inplace position.",
  26457. "target": 0,
  26458. "dataset": "other",
  26459. "idx": 248548
  26460. },
  26461. {
  26462. "func": "static void build_hash_table(struct sum_struct *s)\n{\n\tstatic uint32 alloc_size;\n\tint32 i;\n\n\t/* Dynamically calculate the hash table size so that the hash load\n\t * for big files is about 80%. A number greater than the traditional\n\t * size must be odd or s2 will not be able to span the entire set. */\n\ttablesize = (uint32)(s->count/8) * 10 + 11;\n\tif (tablesize < TRADITIONAL_TABLESIZE)\n\t\ttablesize = TRADITIONAL_TABLESIZE;\n\tif (tablesize > alloc_size || tablesize < alloc_size - 16*1024) {\n\t\tif (hash_table)\n\t\t\tfree(hash_table);\n\t\thash_table = new_array(int32, tablesize);\n\t\tif (!hash_table)\n\t\t\tout_of_memory(\"build_hash_table\");\n\t\talloc_size = tablesize;\n\t}\n\n\tmemset(hash_table, 0xFF, tablesize * sizeof hash_table[0]);\n\n\tif (tablesize == TRADITIONAL_TABLESIZE) {\n\t\tfor (i = 0; i < s->count; i++) {\n\t\t\tuint32 t = SUM2HASH(s->sums[i].sum1);\n\t\t\ts->sums[i].chain = hash_table[t];\n\t\t\thash_table[t] = i;\n\t\t}\n\t} else {\n\t\tfor (i = 0; i < s->count; i++) {\n\t\t\tuint32 t = BIG_SUM2HASH(s->sums[i].sum1);\n\t\t\ts->sums[i].chain = hash_table[t];\n\t\t\thash_table[t] = i;\n\t\t}\n\t}\n}",
  26463. "project": "rsync",
  26464. "hash": 61600810833803559858293273796463637691,
  26465. "size": 36,
  26466. "commit_id": "c8255147b06b74dad940d32f9cef5fbe17595239",
  26467. "message": "Optimize finding the sum that matches our --inplace position.",
  26468. "target": 0,
  26469. "dataset": "other",
  26470. "idx": 248549
  26471. }
  26472. ]
  26473. },
  26474. {
  26475. "call_depth": 3,
  26476. "longest_call_chain": [
  26477. "EncodePyBytesArray",
  26478. "PyBytesArrayMap",
  26479. "PyObjectToString"
  26480. ],
  26481. "group_size": 3,
  26482. "functions": [
  26483. {
  26484. "func": "Status PyBytesArrayMap(PyArrayObject* array, F f) {\n Safe_PyObjectPtr iter = tensorflow::make_safe(\n PyArray_IterNew(reinterpret_cast<PyObject*>(array)));\n while (PyArray_ITER_NOTDONE(iter.get())) {\n auto item = tensorflow::make_safe(PyArray_GETITEM(\n array, static_cast<char*>(PyArray_ITER_DATA(iter.get()))));\n if (!item) {\n return errors::Internal(\"Unable to get element from the feed - no item.\");\n }\n Py_ssize_t len;\n const char* ptr;\n PyObject* ptr_owner = nullptr;\n TF_RETURN_IF_ERROR(PyObjectToString(item.get(), &ptr, &len, &ptr_owner));\n f(ptr, len);\n Py_XDECREF(ptr_owner);\n PyArray_ITER_NEXT(iter.get());\n }\n return Status::OK();\n}",
  26485. "project": "tensorflow",
  26486. "hash": 31978297791717305580156936004676711223,
  26487. "size": 19,
  26488. "commit_id": "030af767d357d1b4088c4a25c72cb3906abac489",
  26489. "message": "Fix `tf.raw_ops.ResourceCountUpTo` null pointer dereference.\n\nPiperOrigin-RevId: 368294347\nChange-Id: I2c16fbfc9b4966c402c3d8e311f0d665a9c852d8",
  26490. "target": 0,
  26491. "dataset": "other",
  26492. "idx": 232667
  26493. },
  26494. {
  26495. "func": "Status PyObjectToString(PyObject* obj, const char** ptr, Py_ssize_t* len,\n PyObject** ptr_owner) {\n *ptr_owner = nullptr;\n if (PyBytes_Check(obj)) {\n char* buf;\n if (PyBytes_AsStringAndSize(obj, &buf, len) != 0) {\n return errors::Internal(\"Unable to get element as bytes.\");\n }\n *ptr = buf;\n return Status::OK();\n } else if (PyUnicode_Check(obj)) {\n#if (PY_MAJOR_VERSION > 3 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 3))\n *ptr = PyUnicode_AsUTF8AndSize(obj, len);\n if (*ptr != nullptr) return Status::OK();\n#else\n PyObject* utemp = PyUnicode_AsUTF8String(obj);\n char* buf;\n if (utemp != nullptr && PyBytes_AsStringAndSize(utemp, &buf, len) != -1) {\n *ptr = buf;\n *ptr_owner = utemp;\n return Status::OK();\n }\n Py_XDECREF(utemp);\n#endif\n return errors::Internal(\"Unable to convert element to UTF-8\");\n } else {\n return errors::Internal(\"Unsupported object type \", obj->ob_type->tp_name);\n }\n}",
  26496. "project": "tensorflow",
  26497. "hash": 121658595224769143400305589780284555962,
  26498. "size": 29,
  26499. "commit_id": "030af767d357d1b4088c4a25c72cb3906abac489",
  26500. "message": "Fix `tf.raw_ops.ResourceCountUpTo` null pointer dereference.\n\nPiperOrigin-RevId: 368294347\nChange-Id: I2c16fbfc9b4966c402c3d8e311f0d665a9c852d8",
  26501. "target": 0,
  26502. "dataset": "other",
  26503. "idx": 232664
  26504. },
  26505. {
  26506. "func": "Status EncodePyBytesArray(PyArrayObject* array, tensorflow::int64 nelems,\n size_t* size, void** buffer) {\n // Encode all strings.\n *size = nelems * sizeof(tensorflow::tstring);\n std::unique_ptr<tensorflow::tstring[]> base_ptr(\n new tensorflow::tstring[nelems]);\n tensorflow::tstring* dst = base_ptr.get();\n\n TF_RETURN_IF_ERROR(\n PyBytesArrayMap(array, [&dst](const char* ptr, Py_ssize_t len) {\n dst->assign(ptr, len);\n dst++;\n }));\n *buffer = base_ptr.release();\n return Status::OK();\n}",
  26507. "project": "tensorflow",
  26508. "hash": 185399263651554758855895348056249803992,
  26509. "size": 16,
  26510. "commit_id": "030af767d357d1b4088c4a25c72cb3906abac489",
  26511. "message": "Fix `tf.raw_ops.ResourceCountUpTo` null pointer dereference.\n\nPiperOrigin-RevId: 368294347\nChange-Id: I2c16fbfc9b4966c402c3d8e311f0d665a9c852d8",
  26512. "target": 0,
  26513. "dataset": "other",
  26514. "idx": 232669
  26515. }
  26516. ]
  26517. },
  26518. {
  26519. "call_depth": 3,
  26520. "longest_call_chain": [
  26521. "XML_SetUserData",
  26522. "freeUserdata",
  26523. "freeString"
  26524. ],
  26525. "group_size": 3,
  26526. "functions": [
  26527. {
  26528. "func": "static void freeString(slist * stk)\n{\n slist *sp;\n\n while (stk) {\n\tsp = stk->next;\n\tfree(stk);\n\tstk = sp;\n }\n}",
  26529. "target": 0,
  26530. "cwe": [
  26531. "CWE-476"
  26532. ],
  26533. "project": "graphviz",
  26534. "commit_id": "839085f8026afd6f6920a0c31ad2a9d880d97932",
  26535. "hash": 323766937958692114121772654913768533116,
  26536. "size": 10,
  26537. "message": "attempted fix for null pointer deference on malformed input",
  26538. "dataset": "other",
  26539. "idx": 505488
  26540. },
  26541. {
  26542. "func": "static void freeUserdata(userdata_t * ud)\n{\n dtclose(ud->nameMap);\n agxbfree(&(ud->xml_attr_name));\n agxbfree(&(ud->xml_attr_value));\n agxbfree(&(ud->composite_buffer));\n freeString(ud->elements);\n free(ud);\n}",
  26543. "target": 0,
  26544. "cwe": [
  26545. "CWE-476"
  26546. ],
  26547. "project": "graphviz",
  26548. "commit_id": "839085f8026afd6f6920a0c31ad2a9d880d97932",
  26549. "hash": 51490874138293443175062885090212690882,
  26550. "size": 9,
  26551. "message": "attempted fix for null pointer deference on malformed input",
  26552. "dataset": "other",
  26553. "idx": 505482
  26554. },
  26555. {
  26556. "func": "Agraph_t *graphml_to_gv(char* gname, FILE * graphmlFile, int* rv)\n{\n char buf[BUFSIZE];\n int done;\n userdata_t *udata = genUserdata(gname);\n XML_Parser parser = XML_ParserCreate(NULL);\n\n *rv = 0;\n XML_SetUserData(parser, udata);\n XML_SetElementHandler(parser, startElementHandler, endElementHandler);\n XML_SetCharacterDataHandler(parser, characterDataHandler);\n\n Current_class = TAG_GRAPH;\n root = 0;\n do {\n\tsize_t len = fread(buf, 1, sizeof(buf), graphmlFile);\n\tif (len == 0)\n\t break;\n\tdone = len < sizeof(buf);\n\tif (XML_Parse(parser, buf, len, done) == XML_STATUS_ERROR) {\n\t fprintf(stderr,\n\t\t \"%s at line %lu\\n\",\n\t\t XML_ErrorString(XML_GetErrorCode(parser)),\n\t\t XML_GetCurrentLineNumber(parser));\n\t *rv = 1;\n\t break;\n\t}\n } while (!done);\n XML_ParserFree(parser);\n freeUserdata(udata);\n\n return root;\n}",
  26557. "target": 0,
  26558. "cwe": [
  26559. "CWE-476"
  26560. ],
  26561. "project": "graphviz",
  26562. "commit_id": "839085f8026afd6f6920a0c31ad2a9d880d97932",
  26563. "hash": 179642333214400244061262734492515282421,
  26564. "size": 33,
  26565. "message": "attempted fix for null pointer deference on malformed input",
  26566. "dataset": "other",
  26567. "idx": 505496
  26568. }
  26569. ]
  26570. }
  26571. ]
  26572. }