instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False | static cmsBool Type_LUTA2B_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
cmsPipeline * Lut = ( cmsPipeline * ) Ptr ;
int inputChan , outputChan ;
cmsStage * A = NULL , * B = NULL , * M = NULL ;
cmsStage * Matrix = NULL ;
cmsStage * CLUT = NULL ;
cmsUInt32Number offsetB = 0 , offsetMat = 0 , offsetM = 0 , offsetC = 0 , offsetA = 0 ;
cmsUInt32Number BaseOffset , DirectoryPos , CurrentPos ;
BaseOffset = io -> Tell ( io ) - sizeof ( _cmsTagBase ) ;
if ( Lut -> Elements != NULL ) if ( ! cmsPipelineCheckAndRetreiveStages ( Lut , 1 , cmsSigCurveSetElemType , & B ) ) if ( ! cmsPipelineCheckAndRetreiveStages ( Lut , 3 , cmsSigCurveSetElemType , cmsSigMatrixElemType , cmsSigCurveSetElemType , & M , & Matrix , & B ) ) if ( ! cmsPipelineCheckAndRetreiveStages ( Lut , 3 , cmsSigCurveSetElemType , cmsSigCLutElemType , cmsSigCurveSetElemType , & A , & CLUT , & B ) ) if ( ! cmsPipelineCheckAndRetreiveStages ( Lut , 5 , cmsSigCurveSetElemType , cmsSigCLutElemType , cmsSigCurveSetElemType , cmsSigMatrixElemType , cmsSigCurveSetElemType , & A , & CLUT , & M , & Matrix , & B ) ) {
cmsSignalError ( self -> ContextID , cmsERROR_NOT_SUITABLE , "LUT is not suitable to be saved as LutAToB" ) ;
return FALSE ;
}
inputChan = cmsPipelineInputChannels ( Lut ) ;
outputChan = cmsPipelineOutputChannels ( Lut ) ;
if ( ! _cmsWriteUInt8Number ( io , ( cmsUInt8Number ) inputChan ) ) return FALSE ;
if ( ! _cmsWriteUInt8Number ( io , ( cmsUInt8Number ) outputChan ) ) return FALSE ;
if ( ! _cmsWriteUInt16Number ( io , 0 ) ) return FALSE ;
DirectoryPos = io -> Tell ( io ) ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) return FALSE ;
if ( A != NULL ) {
offsetA = io -> Tell ( io ) - BaseOffset ;
if ( ! WriteSetOfCurves ( self , io , cmsSigParametricCurveType , A ) ) return FALSE ;
}
if ( CLUT != NULL ) {
offsetC = io -> Tell ( io ) - BaseOffset ;
if ( ! WriteCLUT ( self , io , Lut -> SaveAs8Bits ? 1 : 2 , CLUT ) ) return FALSE ;
}
if ( M != NULL ) {
offsetM = io -> Tell ( io ) - BaseOffset ;
if ( ! WriteSetOfCurves ( self , io , cmsSigParametricCurveType , M ) ) return FALSE ;
}
if ( Matrix != NULL ) {
offsetMat = io -> Tell ( io ) - BaseOffset ;
if ( ! WriteMatrix ( self , io , Matrix ) ) return FALSE ;
}
if ( B != NULL ) {
offsetB = io -> Tell ( io ) - BaseOffset ;
if ( ! WriteSetOfCurves ( self , io , cmsSigParametricCurveType , B ) ) return FALSE ;
}
CurrentPos = io -> Tell ( io ) ;
if ( ! io -> Seek ( io , DirectoryPos ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , offsetB ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , offsetMat ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , offsetM ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , offsetC ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , offsetA ) ) return FALSE ;
if ( ! io -> Seek ( io , CurrentPos ) ) return FALSE ;
return TRUE ;
cmsUNUSED_PARAMETER ( nItems ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dict_threshold2_params ( const ref * pdict , gs_threshold2_halftone * ptp , ref * ptproc , gs_memory_t * mem ) {
ref * tstring ;
int code = dict_threshold_common_params ( pdict , ( gs_threshold_halftone_common * ) ptp , & tstring , ptproc ) ;
int bps ;
uint size ;
int cw2 , ch2 ;
if ( code < 0 || ( code = cw2 = dict_int_param ( pdict , "Width2" , 0 , 0x7fff , 0 , & ptp -> width2 ) ) < 0 || ( code = ch2 = dict_int_param ( pdict , "Height2" , 0 , 0x7fff , 0 , & ptp -> height2 ) ) < 0 || ( code = dict_int_param ( pdict , "BitsPerSample" , 8 , 16 , - 1 , & bps ) ) < 0 ) return code ;
if ( ( bps != 8 && bps != 16 ) || cw2 != ch2 || ( ! cw2 && ( ptp -> width2 == 0 || ptp -> height2 == 0 ) ) ) return_error ( gs_error_rangecheck ) ;
ptp -> bytes_per_sample = bps / 8 ;
switch ( r_type ( tstring ) ) {
case t_string : size = r_size ( tstring ) ;
gs_bytestring_from_string ( & ptp -> thresholds , tstring -> value . const_bytes , size ) ;
break ;
case t_astruct : if ( gs_object_type ( mem , tstring -> value . pstruct ) != & st_bytes ) return_error ( gs_error_typecheck ) ;
size = gs_object_size ( mem , tstring -> value . pstruct ) ;
gs_bytestring_from_bytes ( & ptp -> thresholds , r_ptr ( tstring , byte ) , 0 , size ) ;
break ;
default : return_error ( gs_error_typecheck ) ;
}
check_read ( * tstring ) ;
if ( size != ( ptp -> width * ptp -> height + ptp -> width2 * ptp -> height2 ) * ptp -> bytes_per_sample ) return_error ( gs_error_rangecheck ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | Oid get_equality_op_for_ordering_op ( Oid opno , bool * reverse ) {
Oid result = InvalidOid ;
Oid opfamily ;
Oid opcintype ;
int16 strategy ;
if ( get_ordering_op_properties ( opno , & opfamily , & opcintype , & strategy ) ) {
result = get_opfamily_member ( opfamily , opcintype , opcintype , BTEqualStrategyNumber ) ;
if ( reverse ) * reverse = ( strategy == BTGreaterStrategyNumber ) ;
}
return result ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void setup_address_and_port ( const char * * address , const char * * port ) {
if ( * address == NULL ) {
* address = "0.0.0.0" ;
}
if ( * port == NULL ) {
* port = stringify ( NBD_DEFAULT_PORT ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void free_used_memory ( ) {
uint i ;
DBUG_ENTER ( "free_used_memory" ) ;
if ( connections ) close_connections ( ) ;
close_files ( ) ;
my_hash_free ( & var_hash ) ;
for ( i = 0 ;
i < q_lines . elements ;
i ++ ) {
struct st_command * * q = dynamic_element ( & q_lines , i , struct st_command * * ) ;
my_free ( ( * q ) -> query_buf ) ;
if ( ( * q ) -> eval_query . str ) dynstr_free ( & ( * q ) -> eval_query ) ;
if ( ( * q ) -> content . str ) dynstr_free ( & ( * q ) -> content ) ;
my_free ( ( * q ) ) ;
}
for ( i = 0 ;
i < 10 ;
i ++ ) {
if ( var_reg [ i ] . alloced_len ) my_free ( var_reg [ i ] . str_val ) ;
}
while ( embedded_server_arg_count > 1 ) my_free ( embedded_server_args [ -- embedded_server_arg_count ] ) ;
delete_dynamic ( & q_lines ) ;
dynstr_free ( & ds_res ) ;
if ( ds_warn ) dynstr_free ( ds_warn ) ;
free_all_replace ( ) ;
my_free ( opt_pass ) ;
free_defaults ( default_argv ) ;
free_root ( & require_file_root , MYF ( 0 ) ) ;
free_re ( ) ;
# ifdef __WIN__ free_tmp_sh_file ( ) ;
free_win_path_patterns ( ) ;
# endif DBUG_VOID_RETURN ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | SPL_METHOD ( DirectoryIterator , getBasename ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
char * suffix = 0 , * fname ;
int slen = 0 ;
size_t flen ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|s" , & suffix , & slen ) == FAILURE ) {
return ;
}
php_basename ( intern -> u . dir . entry . d_name , strlen ( intern -> u . dir . entry . d_name ) , suffix , slen , & fname , & flen TSRMLS_CC ) ;
RETURN_STRINGL ( fname , flen , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void _slurm_rpc_shutdown_controller ( slurm_msg_t * msg ) {
int error_code = SLURM_SUCCESS , i ;
uint16_t options = 0 ;
shutdown_msg_t * shutdown_msg = ( shutdown_msg_t * ) msg -> data ;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
slurmctld_lock_t node_read_lock = {
NO_LOCK , NO_LOCK , READ_LOCK , NO_LOCK , NO_LOCK }
;
if ( ! validate_super_user ( uid ) ) {
error ( "Security violation, SHUTDOWN RPC from uid=%d" , uid ) ;
error_code = ESLURM_USER_ID_MISSING ;
}
if ( error_code ) ;
else if ( msg -> msg_type == REQUEST_CONTROL ) {
info ( "Performing RPC: REQUEST_CONTROL" ) ;
slurmctld_config . resume_backup = true ;
}
else {
info ( "Performing RPC: REQUEST_SHUTDOWN" ) ;
options = shutdown_msg -> options ;
}
if ( error_code ) ;
else if ( options == 1 ) info ( "performing immeditate shutdown without state save" ) ;
else if ( slurmctld_config . shutdown_time ) debug2 ( "shutdown RPC issued when already in progress" ) ;
else {
if ( ( msg -> msg_type == REQUEST_SHUTDOWN ) && ( options == 0 ) ) {
lock_slurmctld ( node_read_lock ) ;
msg_to_slurmd ( REQUEST_SHUTDOWN ) ;
unlock_slurmctld ( node_read_lock ) ;
}
if ( slurmctld_config . thread_id_sig ) pthread_kill ( slurmctld_config . thread_id_sig , SIGTERM ) ;
else {
error ( "thread_id_sig undefined, hard shutdown" ) ;
slurmctld_config . shutdown_time = time ( NULL ) ;
slurmctld_shutdown ( ) ;
}
}
if ( msg -> msg_type == REQUEST_CONTROL ) {
for ( i = 1 ;
i < ( CONTROL_TIMEOUT * 10 ) ;
i ++ ) {
if ( slurmctld_config . server_thread_count <= 1 ) break ;
usleep ( 100000 ) ;
}
if ( slurmctld_config . server_thread_count > 1 ) error ( "REQUEST_CONTROL reply with %d active threads" , slurmctld_config . server_thread_count ) ;
( void ) g_slurm_jobcomp_fini ( ) ;
}
slurm_send_rc_msg ( msg , error_code ) ;
if ( ( error_code == SLURM_SUCCESS ) && ( options == 1 ) && ( slurmctld_config . thread_id_sig ) ) pthread_kill ( slurmctld_config . thread_id_sig , SIGABRT ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void vacuum_all_databases ( vacuumingOptions * vacopts , bool analyze_in_stages , const char * maintenance_db , const char * host , const char * port , const char * username , enum trivalue prompt_password , int concurrentCons , const char * progname , bool echo , bool quiet ) {
PGconn * conn ;
PGresult * result ;
int stage ;
int i ;
conn = connectMaintenanceDatabase ( maintenance_db , host , port , username , prompt_password , progname ) ;
result = executeQuery ( conn , "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;
" , progname , echo ) ;
PQfinish ( conn ) ;
if ( analyze_in_stages ) {
for ( stage = 0 ;
stage < ANALYZE_NUM_STAGES ;
stage ++ ) {
for ( i = 0 ;
i < PQntuples ( result ) ;
i ++ ) {
const char * dbname ;
dbname = PQgetvalue ( result , i , 0 ) ;
vacuum_one_database ( dbname , vacopts , stage , NULL , host , port , username , prompt_password , concurrentCons , progname , echo , quiet ) ;
}
}
}
else {
for ( i = 0 ;
i < PQntuples ( result ) ;
i ++ ) {
const char * dbname ;
dbname = PQgetvalue ( result , i , 0 ) ;
vacuum_one_database ( dbname , vacopts , ANALYZE_NO_STAGE , NULL , host , port , username , prompt_password , concurrentCons , progname , echo , quiet ) ;
}
}
PQclear ( result ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | void get_type_category_preferred ( Oid typid , char * typcategory , bool * typispreferred ) {
HeapTuple tp ;
Form_pg_type typtup ;
tp = SearchSysCache1 ( TYPEOID , ObjectIdGetDatum ( typid ) ) ;
if ( ! HeapTupleIsValid ( tp ) ) elog ( ERROR , "cache lookup failed for type %u" , typid ) ;
typtup = ( Form_pg_type ) GETSTRUCT ( tp ) ;
* typcategory = typtup -> typcategory ;
* typispreferred = typtup -> typispreferred ;
ReleaseSysCache ( tp ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserCloseBeforeUnloadOK ) {
NavigateToDataURL ( BEFORE_UNLOAD_HTML , "beforeunload" ) ;
content : : WindowedNotificationObserver window_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , content : : NotificationService : : AllSources ( ) ) ;
chrome : : CloseWindow ( browser ( ) ) ;
ClickModalDialogButton ( true ) ;
window_observer . Wait ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ScoredHistoryMatchTest , Scoring ) {
base : : Time now = base : : Time : : NowFromSystemTime ( ) ;
history : : URLRow row_a ( MakeURLRow ( "http://fedcba" , "abcd bcd" , 3 , 30 , 1 ) ) ;
RowWordStarts word_starts_a ;
PopulateWordStarts ( row_a , & word_starts_a ) ;
WordStarts one_word_no_offset ( 1 , 0u ) ;
VisitInfoVector visits_a = CreateVisitInfoVector ( 3 , 30 , now ) ;
visits_a [ 0 ] . second = ui : : PAGE_TRANSITION_TYPED ;
ScoredHistoryMatch scored_a ( row_a , visits_a , std : : string ( ) , ASCIIToUTF16 ( "abc" ) , Make1Term ( "abc" ) , one_word_no_offset , word_starts_a , false , nullptr , now ) ;
history : : URLRow row_b ( MakeURLRow ( "http://abcdef" , "abcd bcd" , 10 , 30 , 1 ) ) ;
RowWordStarts word_starts_b ;
PopulateWordStarts ( row_b , & word_starts_b ) ;
VisitInfoVector visits_b = CreateVisitInfoVector ( 10 , 30 , now ) ;
visits_b [ 0 ] . second = ui : : PAGE_TRANSITION_TYPED ;
ScoredHistoryMatch scored_b ( row_b , visits_b , std : : string ( ) , ASCIIToUTF16 ( "abc" ) , Make1Term ( "abc" ) , one_word_no_offset , word_starts_b , false , nullptr , now ) ;
EXPECT_GT ( scored_b . raw_score , scored_a . raw_score ) ;
history : : URLRow row_c ( MakeURLRow ( "http://abcdef" , "abcd bcd" , 3 , 10 , 1 ) ) ;
RowWordStarts word_starts_c ;
PopulateWordStarts ( row_c , & word_starts_c ) ;
VisitInfoVector visits_c = CreateVisitInfoVector ( 3 , 10 , now ) ;
visits_c [ 0 ] . second = ui : : PAGE_TRANSITION_TYPED ;
ScoredHistoryMatch scored_c ( row_c , visits_c , std : : string ( ) , ASCIIToUTF16 ( "abc" ) , Make1Term ( "abc" ) , one_word_no_offset , word_starts_c , false , nullptr , now ) ;
EXPECT_GT ( scored_c . raw_score , scored_a . raw_score ) ;
history : : URLRow row_d ( MakeURLRow ( "http://abcdef" , "abcd bcd" , 3 , 30 , 3 ) ) ;
RowWordStarts word_starts_d ;
PopulateWordStarts ( row_d , & word_starts_d ) ;
VisitInfoVector visits_d = CreateVisitInfoVector ( 3 , 30 , now ) ;
visits_d [ 0 ] . second = ui : : PAGE_TRANSITION_TYPED ;
visits_d [ 1 ] . second = ui : : PAGE_TRANSITION_TYPED ;
visits_d [ 2 ] . second = ui : : PAGE_TRANSITION_TYPED ;
ScoredHistoryMatch scored_d ( row_d , visits_d , std : : string ( ) , ASCIIToUTF16 ( "abc" ) , Make1Term ( "abc" ) , one_word_no_offset , word_starts_d , false , nullptr , now ) ;
EXPECT_GT ( scored_d . raw_score , scored_a . raw_score ) ;
history : : URLRow row_e ( MakeURLRow ( "http://csi.csi.csi/csi_csi" , "CSI Guide to CSI Las Vegas, CSI New York, CSI Provo" , 3 , 30 , 3 ) ) ;
RowWordStarts word_starts_e ;
PopulateWordStarts ( row_e , & word_starts_e ) ;
const VisitInfoVector visits_e = visits_d ;
ScoredHistoryMatch scored_e ( row_e , visits_e , std : : string ( ) , ASCIIToUTF16 ( "csi" ) , Make1Term ( "csi" ) , one_word_no_offset , word_starts_e , false , nullptr , now ) ;
EXPECT_LT ( scored_e . raw_score , 1400 ) ;
ScoredHistoryMatch scored_f ( row_a , visits_a , std : : string ( ) , ASCIIToUTF16 ( "cd" ) , Make1Term ( "cd" ) , one_word_no_offset , word_starts_a , false , nullptr , now ) ;
EXPECT_EQ ( scored_f . raw_score , 0 ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( TemplateURLParserTest , TestMSDN ) {
ASSERT_NO_FATAL_FAILURE ( ParseFile ( "msdn.xml" , nullptr ) ) ;
ASSERT_TRUE ( template_url_ ) ;
EXPECT_EQ ( ASCIIToUTF16 ( "Search \" MSDN" ) , template_url_ -> short_name ( ) ) ;
EXPECT_EQ ( GURL ( "http://search.msdn.microsoft.com/search/favicon.ico" ) , template_url_ -> favicon_url ( ) ) ;
EXPECT_TRUE ( template_url_ -> url_ref ( ) . SupportsReplacement ( SearchTermsData ( ) ) ) ;
EXPECT_EQ ( "http://search.msdn.microsoft.com/search/default.aspx?" "Query={
searchTerms}
&brand=msdn&locale=en-US" , template_url_ -> url ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSReturnCode TSCacheDataTypeReady ( TSCacheDataType type , int * is_ready ) {
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) is_ready ) == TS_SUCCESS ) ;
CacheFragType frag_type ;
switch ( type ) {
case TS_CACHE_DATA_TYPE_NONE : frag_type = CACHE_FRAG_TYPE_NONE ;
break ;
case TS_CACHE_DATA_TYPE_OTHER : case TS_CACHE_DATA_TYPE_HTTP : frag_type = CACHE_FRAG_TYPE_HTTP ;
break ;
default : * is_ready = 0 ;
return TS_ERROR ;
}
* is_ready = cacheProcessor . IsCacheReady ( frag_type ) ;
return TS_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void compute_curve_gamma_table_type_parametric ( float gamma_table [ 256 ] , float parameter [ 7 ] , int count ) {
size_t X ;
float interval ;
float a , b , c , e , f ;
float y = parameter [ 0 ] ;
if ( count == 0 ) {
a = 1 ;
b = 0 ;
c = 0 ;
e = 0 ;
f = 0 ;
interval = - INFINITY ;
}
else if ( count == 1 ) {
a = parameter [ 1 ] ;
b = parameter [ 2 ] ;
c = 0 ;
e = 0 ;
f = 0 ;
interval = - 1 * parameter [ 2 ] / parameter [ 1 ] ;
}
else if ( count == 2 ) {
a = parameter [ 1 ] ;
b = parameter [ 2 ] ;
c = 0 ;
e = parameter [ 3 ] ;
f = parameter [ 3 ] ;
interval = - 1 * parameter [ 2 ] / parameter [ 1 ] ;
}
else if ( count == 3 ) {
a = parameter [ 1 ] ;
b = parameter [ 2 ] ;
c = parameter [ 3 ] ;
e = - c ;
f = 0 ;
interval = parameter [ 4 ] ;
}
else if ( count == 4 ) {
a = parameter [ 1 ] ;
b = parameter [ 2 ] ;
c = parameter [ 3 ] ;
e = parameter [ 5 ] - c ;
f = parameter [ 6 ] ;
interval = parameter [ 4 ] ;
}
else {
assert ( 0 && "invalid parametric function type." ) ;
a = 1 ;
b = 0 ;
c = 0 ;
e = 0 ;
f = 0 ;
interval = - INFINITY ;
}
for ( X = 0 ;
X < 256 ;
X ++ ) {
float x = X / 255.0 ;
if ( x >= interval ) {
gamma_table [ X ] = clamp_float ( pow ( a * x + b , y ) + c + e ) ;
}
else {
gamma_table [ X ] = clamp_float ( c * x + f ) ;
}
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | int zreadonly ( i_ctx_t * i_ctx_p ) {
return access_check ( i_ctx_p , a_readonly , true ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int vp9_get_pred_context_single_ref_p2 ( const MACROBLOCKD * xd ) {
int pred_context ;
const MB_MODE_INFO * const above_mbmi = get_mbmi ( get_above_mi ( xd ) ) ;
const MB_MODE_INFO * const left_mbmi = get_mbmi ( get_left_mi ( xd ) ) ;
const int has_above = above_mbmi != NULL ;
const int has_left = left_mbmi != NULL ;
if ( has_above && has_left ) {
const int above_intra = ! is_inter_block ( above_mbmi ) ;
const int left_intra = ! is_inter_block ( left_mbmi ) ;
if ( above_intra && left_intra ) {
pred_context = 2 ;
}
else if ( above_intra || left_intra ) {
const MB_MODE_INFO * edge_mbmi = above_intra ? left_mbmi : above_mbmi ;
if ( ! has_second_ref ( edge_mbmi ) ) {
if ( edge_mbmi -> ref_frame [ 0 ] == LAST_FRAME ) pred_context = 3 ;
else pred_context = 4 * ( edge_mbmi -> ref_frame [ 0 ] == GOLDEN_FRAME ) ;
}
else {
pred_context = 1 + 2 * ( edge_mbmi -> ref_frame [ 0 ] == GOLDEN_FRAME || edge_mbmi -> ref_frame [ 1 ] == GOLDEN_FRAME ) ;
}
}
else {
const int above_has_second = has_second_ref ( above_mbmi ) ;
const int left_has_second = has_second_ref ( left_mbmi ) ;
const MV_REFERENCE_FRAME above0 = above_mbmi -> ref_frame [ 0 ] ;
const MV_REFERENCE_FRAME above1 = above_mbmi -> ref_frame [ 1 ] ;
const MV_REFERENCE_FRAME left0 = left_mbmi -> ref_frame [ 0 ] ;
const MV_REFERENCE_FRAME left1 = left_mbmi -> ref_frame [ 1 ] ;
if ( above_has_second && left_has_second ) {
if ( above0 == left0 && above1 == left1 ) pred_context = 3 * ( above0 == GOLDEN_FRAME || above1 == GOLDEN_FRAME || left0 == GOLDEN_FRAME || left1 == GOLDEN_FRAME ) ;
else pred_context = 2 ;
}
else if ( above_has_second || left_has_second ) {
const MV_REFERENCE_FRAME rfs = ! above_has_second ? above0 : left0 ;
const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0 ;
const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1 ;
if ( rfs == GOLDEN_FRAME ) pred_context = 3 + ( crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME ) ;
else if ( rfs == ALTREF_FRAME ) pred_context = crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME ;
else pred_context = 1 + 2 * ( crf1 == GOLDEN_FRAME || crf2 == GOLDEN_FRAME ) ;
}
else {
if ( above0 == LAST_FRAME && left0 == LAST_FRAME ) {
pred_context = 3 ;
}
else if ( above0 == LAST_FRAME || left0 == LAST_FRAME ) {
const MV_REFERENCE_FRAME edge0 = ( above0 == LAST_FRAME ) ? left0 : above0 ;
pred_context = 4 * ( edge0 == GOLDEN_FRAME ) ;
}
else {
pred_context = 2 * ( above0 == GOLDEN_FRAME ) + * ( left0 == GOLDEN_FRAME ) ;
}
}
}
}
else if ( has_above || has_left ) {
const MB_MODE_INFO * edge_mbmi = has_above ? above_mbmi : left_mbmi ;
if ( ! is_inter_block ( edge_mbmi ) || ( edge_mbmi -> ref_frame [ 0 ] == LAST_FRAME && ! has_second_ref ( edge_mbmi ) ) ) pred_context = 2 ;
else if ( ! has_second_ref ( edge_mbmi ) ) pred_context = 4 * ( edge_mbmi -> ref_frame [ 0 ] == GOLDEN_FRAME ) ;
else pred_context = 3 * ( edge_mbmi -> ref_frame [ 0 ] == GOLDEN_FRAME || edge_mbmi -> ref_frame [ 1 ] == GOLDEN_FRAME ) ;
}
else {
pred_context = 2 ;
}
assert ( pred_context >= 0 && pred_context < REF_CONTEXTS ) ;
return pred_context ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static guint32 fpdu_total_length ( struct tcpinfo * tcpinfo ) {
guint32 size = 0 ;
if ( tcpinfo -> seq < tcpinfo -> nxtseq ) {
size = tcpinfo -> nxtseq - tcpinfo -> seq ;
}
if ( tcpinfo -> seq >= tcpinfo -> nxtseq ) {
size = tcpinfo -> nxtseq + ( TCP_MAX_SEQ - tcpinfo -> seq ) ;
}
return size ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void rv34_mc_1mv ( RV34DecContext * r , const int block_type , const int xoff , const int yoff , int mv_off , const int width , const int height , int dir ) {
rv34_mc ( r , block_type , xoff , yoff , mv_off , width , height , dir , r -> rv30 , 0 , r -> rdsp . put_pixels_tab , r -> rdsp . put_chroma_pixels_tab ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int remoteStreamHandleFinish ( struct qemud_client * client , struct qemud_client_stream * stream , struct qemud_client_message * msg ) {
remote_error rerr ;
int ret ;
VIR_DEBUG ( "stream=%p proc=%d serial=%d" , stream , msg -> hdr . proc , msg -> hdr . serial ) ;
memset ( & rerr , 0 , sizeof rerr ) ;
stream -> closed = 1 ;
virStreamEventRemoveCallback ( stream -> st ) ;
ret = virStreamFinish ( stream -> st ) ;
if ( ret < 0 ) {
remoteDispatchConnError ( & rerr , client -> conn ) ;
return remoteSerializeReplyError ( client , & rerr , & msg -> hdr ) ;
}
else {
if ( remoteSendStreamData ( client , stream , NULL , 0 ) < 0 ) return - 1 ;
}
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int rescale ( int val , int num , int denom ) {
int64_t llnum = num ;
int64_t llden = denom ;
int64_t llval = val ;
return ( int ) ( llval * llnum / llden ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void activation_start_mountables ( ActivateParameters * parameters ) {
NautilusFile * file ;
GMountOperation * start_op ;
if ( parameters -> start_mountables != NULL ) {
file = parameters -> start_mountables -> data ;
start_op = gtk_mount_operation_new ( parameters -> parent_window ) ;
g_signal_connect ( start_op , "notify::is-showing" , G_CALLBACK ( activate_mount_op_active ) , parameters ) ;
nautilus_file_start ( file , start_op , parameters -> cancellable , activation_mountable_started , parameters ) ;
g_object_unref ( start_op ) ;
return ;
}
if ( parameters -> mountables == NULL && parameters -> start_mountables == NULL ) {
activation_get_activation_uris ( parameters ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_q931_pdu ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gboolean is_over_ip ) {
int offset = 0 ;
proto_tree * q931_tree = NULL ;
proto_tree * ie_tree = NULL ;
proto_item * ti ;
guint8 prot_discr ;
guint8 call_ref_len ;
guint8 call_ref [ 16 ] ;
guint32 call_ref_val ;
guint8 message_type , segmented_message_type ;
guint8 info_element ;
guint16 info_element_len ;
gboolean first_frag , more_frags ;
guint32 frag_len ;
fragment_head * fd_head ;
tvbuff_t * next_tvb = NULL ;
q931_pi = wmem_new ( wmem_packet_scope ( ) , q931_packet_info ) ;
reset_q931_packet_info ( q931_pi ) ;
have_valid_q931_pi = TRUE ;
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "Q.931" ) ;
prot_discr = tvb_get_guint8 ( tvb , offset ) ;
ti = proto_tree_add_item ( tree , proto_q931 , tvb , offset , - 1 , ENC_NA ) ;
if ( tree ) {
q931_tree = proto_item_add_subtree ( ti , ett_q931 ) ;
dissect_q931_protocol_discriminator ( tvb , offset , q931_tree ) ;
}
offset += 1 ;
call_ref_len = tvb_get_guint8 ( tvb , offset ) & 0xF ;
if ( q931_tree != NULL ) proto_tree_add_uint ( q931_tree , hf_q931_call_ref_len , tvb , offset , 1 , call_ref_len ) ;
offset += 1 ;
switch ( call_ref_len ) {
case 0 : call_ref_val = 0 ;
break ;
case 1 : call_ref_val = tvb_get_guint8 ( tvb , offset ) ;
break ;
case 2 : call_ref_val = tvb_get_ntohs ( tvb , offset ) ;
break ;
case 3 : call_ref_val = tvb_get_ntoh24 ( tvb , offset ) ;
break ;
default : call_ref_val = tvb_get_ntohl ( tvb , offset ) ;
}
if ( call_ref_len != 0 ) {
tvb_memcpy ( tvb , call_ref , offset , call_ref_len ) ;
if ( q931_tree != NULL ) {
proto_tree_add_boolean ( q931_tree , hf_q931_call_ref_flag , tvb , offset , 1 , ( call_ref [ 0 ] & 0x80 ) != 0 ) ;
call_ref [ 0 ] &= 0x7F ;
proto_tree_add_bytes ( q931_tree , hf_q931_call_ref , tvb , offset , call_ref_len , call_ref ) ;
}
else {
call_ref [ 0 ] &= 0x7F ;
}
memcpy ( & ( q931_pi -> crv ) , call_ref , call_ref_len > sizeof ( q931_pi -> crv ) ? sizeof ( q931_pi -> crv ) : call_ref_len ) ;
offset += call_ref_len ;
}
message_type = tvb_get_guint8 ( tvb , offset ) ;
if ( have_valid_q931_pi && q931_pi ) {
q931_pi -> message_type = message_type ;
}
col_add_str ( pinfo -> cinfo , COL_INFO , get_message_name ( prot_discr , message_type ) ) ;
if ( prot_discr == NLPID_DMS ) proto_tree_add_item ( q931_tree , hf_q931_maintenance_message_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
else proto_tree_add_item ( q931_tree , hf_q931_message_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset += 1 ;
if ( ( message_type != Q931_SEGMENT ) || ! q931_reassembly || ( tvb_reported_length_remaining ( tvb , offset ) <= 4 ) ) {
dissect_q931_IEs ( tvb , pinfo , tree , q931_tree , is_over_ip , offset , 0 ) ;
return ;
}
info_element = tvb_get_guint8 ( tvb , offset ) ;
info_element_len = tvb_get_guint8 ( tvb , offset + 1 ) ;
if ( ( info_element != Q931_IE_SEGMENTED_MESSAGE ) || ( info_element_len < 2 ) ) {
dissect_q931_IEs ( tvb , pinfo , tree , q931_tree , is_over_ip , offset , 0 ) ;
return ;
}
ie_tree = proto_tree_add_subtree ( q931_tree , tvb , offset , 1 + 1 + info_element_len , ett_q931_ie [ info_element ] , NULL , val_to_str ( info_element , q931_info_element_vals [ 0 ] , "Unknown information element (0x%02X)" ) ) ;
proto_tree_add_uint_format_value ( ie_tree , hf_q931_information_element , tvb , offset , 1 , info_element , "%s" , val_to_str ( info_element , q931_info_element_vals [ 0 ] , "Unknown (0x%02X)" ) ) ;
proto_tree_add_item ( ie_tree , hf_q931_information_element_len , tvb , offset + 1 , 1 , ENC_NA ) ;
dissect_q931_segmented_message_ie ( tvb , pinfo , offset + 2 , info_element_len , ie_tree , ti ) ;
first_frag = ( tvb_get_guint8 ( tvb , offset + 2 ) & 0x80 ) != 0 ;
more_frags = ( tvb_get_guint8 ( tvb , offset + 2 ) & 0x7F ) != 0 ;
segmented_message_type = tvb_get_guint8 ( tvb , offset + 3 ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , " of %s" , val_to_str_ext ( segmented_message_type , & q931_message_type_vals_ext , "Unknown message type (0x%02X)" ) ) ;
offset += 1 + 1 + info_element_len ;
frag_len = tvb_reported_length_remaining ( tvb , offset ) ;
if ( first_frag && fragment_get ( & q931_reassembly_table , pinfo , call_ref_val , NULL ) ) {
fragment_end_seq_next ( & q931_reassembly_table , pinfo , call_ref_val , NULL ) ;
}
fd_head = fragment_add_seq_next ( & q931_reassembly_table , tvb , offset , pinfo , call_ref_val , NULL , frag_len , more_frags ) ;
if ( fd_head ) {
if ( pinfo -> num == fd_head -> reassembled_in ) {
if ( fd_head -> next != NULL ) {
next_tvb = tvb_new_chain ( tvb , fd_head -> tvb_data ) ;
add_new_data_source ( pinfo , next_tvb , "Reassembled Q.931 IEs" ) ;
if ( tree ) {
proto_item * frag_tree_item ;
show_fragment_seq_tree ( fd_head , & q931_frag_items , q931_tree , pinfo , next_tvb , & frag_tree_item ) ;
}
}
else {
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
}
col_add_fstr ( pinfo -> cinfo , COL_INFO , "%s [reassembled]" , val_to_str_ext ( segmented_message_type , & q931_message_type_vals_ext , "Unknown message type (0x%02X)" ) ) ;
}
else {
if ( tree ) proto_tree_add_uint ( q931_tree , hf_q931_reassembled_in , tvb , offset , frag_len , fd_head -> reassembled_in ) ;
}
}
if ( next_tvb ) dissect_q931_IEs ( next_tvb , pinfo , tree , q931_tree , is_over_ip , 0 , 0 ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int SpoolssStartPagePrinter_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
e_ctx_hnd policy_hnd ;
char * pol_name ;
offset = dissect_nt_policy_hnd ( tvb , offset , pinfo , tree , di , drep , hf_hnd , & policy_hnd , NULL , FALSE , FALSE ) ;
dcerpc_fetch_polhnd_data ( & policy_hnd , & pol_name , NULL , NULL , NULL , pinfo -> num ) ;
if ( pol_name ) col_append_fstr ( pinfo -> cinfo , COL_INFO , ", %s" , pol_name ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ossl_inline t2 * sk_ ## t1 ## _value ( const STACK_OF ( t1 ) * sk , int idx ) {
return ( t2 * ) OPENSSL_sk_value ( ( const OPENSSL_STACK * ) sk , idx ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new ( sk_ ## t1 ## _compfunc compare ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new ( ( OPENSSL_sk_compfunc ) compare ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ;
}
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) {
return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ;
}
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void U_CALLCONV ucnv_toUnicode_UTF8_OFFSETS_LOGIC ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
UConverter * cnv = args -> converter ;
const unsigned char * mySource = ( unsigned char * ) args -> source ;
UChar * myTarget = args -> target ;
int32_t * myOffsets = args -> offsets ;
int32_t offsetNum = 0 ;
const unsigned char * sourceLimit = ( unsigned char * ) args -> sourceLimit ;
const UChar * targetLimit = args -> targetLimit ;
unsigned char * toUBytes = cnv -> toUBytes ;
UBool isCESU8 = hasCESU8Data ( cnv ) ;
uint32_t ch , ch2 = 0 ;
int32_t i , inBytes ;
if ( cnv -> toUnicodeStatus && myTarget < targetLimit ) {
inBytes = cnv -> mode ;
i = cnv -> toULength ;
cnv -> toULength = 0 ;
ch = cnv -> toUnicodeStatus ;
cnv -> toUnicodeStatus = 0 ;
goto morebytes ;
}
while ( mySource < sourceLimit && myTarget < targetLimit ) {
ch = * ( mySource ++ ) ;
if ( ch < 0x80 ) {
* ( myTarget ++ ) = ( UChar ) ch ;
* ( myOffsets ++ ) = offsetNum ++ ;
}
else {
toUBytes [ 0 ] = ( char ) ch ;
inBytes = bytesFromUTF8 [ ch ] ;
i = 1 ;
morebytes : while ( i < inBytes ) {
if ( mySource < sourceLimit ) {
toUBytes [ i ] = ( char ) ( ch2 = * mySource ) ;
if ( ! U8_IS_TRAIL ( ch2 ) ) {
break ;
}
ch = ( ch << 6 ) + ch2 ;
++ mySource ;
i ++ ;
}
else {
cnv -> toUnicodeStatus = ch ;
cnv -> mode = inBytes ;
cnv -> toULength = ( int8_t ) i ;
goto donefornow ;
}
}
ch -= offsetsFromUTF8 [ inBytes ] ;
if ( i == inBytes && ch <= MAXIMUM_UTF && ch >= utf8_minChar32 [ i ] && ( isCESU8 ? i <= 3 : ! U_IS_SURROGATE ( ch ) ) ) {
if ( ch <= MAXIMUM_UCS2 ) {
* ( myTarget ++ ) = ( UChar ) ch ;
* ( myOffsets ++ ) = offsetNum ;
}
else {
ch -= HALF_BASE ;
* ( myTarget ++ ) = ( UChar ) ( ( ch >> HALF_SHIFT ) + SURROGATE_HIGH_START ) ;
* ( myOffsets ++ ) = offsetNum ;
ch = ( ch & HALF_MASK ) + SURROGATE_LOW_START ;
if ( myTarget < targetLimit ) {
* ( myTarget ++ ) = ( UChar ) ch ;
* ( myOffsets ++ ) = offsetNum ;
}
else {
cnv -> UCharErrorBuffer [ 0 ] = ( UChar ) ch ;
cnv -> UCharErrorBufferLength = 1 ;
* err = U_BUFFER_OVERFLOW_ERROR ;
}
}
offsetNum += i ;
}
else {
cnv -> toULength = ( int8_t ) i ;
* err = U_ILLEGAL_CHAR_FOUND ;
break ;
}
}
}
donefornow : if ( mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS ( * err ) ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
}
args -> target = myTarget ;
args -> source = ( const char * ) mySource ;
args -> offsets = myOffsets ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void purple_gg_buddylist_import ( PurpleConnection * gc ) {
struct im_connection * ic = purple_ic_by_gc ( gc ) ;
if ( set_getstr ( & ic -> acc -> set , "gg_sync_contacts" ) ) {
GList * actions = gc -> prpl -> info -> actions ( gc -> prpl , gc ) ;
GList * p ;
for ( p = g_list_first ( actions ) ;
p ;
p = p -> next ) {
if ( ( ( PurplePluginAction * ) p -> data ) && purple_menu_cmp ( ( ( PurplePluginAction * ) p -> data ) -> label , "Download buddylist from Server" ) == 0 ) {
PurplePluginAction action ;
action . plugin = gc -> prpl ;
action . context = gc ;
action . user_data = NULL ;
( ( PurplePluginAction * ) p -> data ) -> callback ( & action ) ;
break ;
}
}
g_list_free ( actions ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_SEQUENCE_OF_PictureReference ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h245_SEQUENCE_OF_PictureReference , SEQUENCE_OF_PictureReference_sequence_of ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void getTypeInputInfo ( Oid type , Oid * typInput , Oid * typIOParam ) {
HeapTuple typeTuple ;
Form_pg_type pt ;
typeTuple = SearchSysCache1 ( TYPEOID , ObjectIdGetDatum ( type ) ) ;
if ( ! HeapTupleIsValid ( typeTuple ) ) elog ( ERROR , "cache lookup failed for type %u" , type ) ;
pt = ( Form_pg_type ) GETSTRUCT ( typeTuple ) ;
if ( ! pt -> typisdefined ) ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_OBJECT ) , errmsg ( "type %s is only a shell" , format_type_be ( type ) ) ) ) ;
if ( ! OidIsValid ( pt -> typinput ) ) ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_FUNCTION ) , errmsg ( "no input function available for type %s" , format_type_be ( type ) ) ) ) ;
* typInput = pt -> typinput ;
* typIOParam = getTypeIOParam ( typeTuple ) ;
ReleaseSysCache ( typeTuple ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VALUE ossl_x509name_eql ( VALUE self , VALUE other ) {
if ( ! rb_obj_is_kind_of ( other , cX509Name ) ) return Qfalse ;
return ossl_x509name_cmp0 ( self , other ) == 0 ? Qtrue : Qfalse ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static TX_SIZE read_selected_tx_size ( VP9_COMMON * cm , MACROBLOCKD * xd , TX_SIZE max_tx_size , vp9_reader * r ) {
const int ctx = vp9_get_tx_size_context ( xd ) ;
const vp9_prob * tx_probs = get_tx_probs ( max_tx_size , ctx , & cm -> fc . tx_probs ) ;
int tx_size = vp9_read ( r , tx_probs [ 0 ] ) ;
if ( tx_size != TX_4X4 && max_tx_size >= TX_16X16 ) {
tx_size += vp9_read ( r , tx_probs [ 1 ] ) ;
if ( tx_size != TX_8X8 && max_tx_size >= TX_32X32 ) tx_size += vp9_read ( r , tx_probs [ 2 ] ) ;
}
if ( ! cm -> frame_parallel_decoding_mode ) ++ get_tx_counts ( max_tx_size , ctx , & cm -> counts . tx ) [ tx_size ] ;
return ( TX_SIZE ) tx_size ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_SEQUENCE_OF_ConferenceIdentifier ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_OF_ConferenceIdentifier , SEQUENCE_OF_ConferenceIdentifier_sequence_of ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( DownloadNotificationTest , CloseNotificationAfterDownload ) {
CreateDownload ( ) ;
CompleteTheDownload ( ) ;
CloseNotification ( ) ;
VerifyDownloadState ( download : : DownloadItem : : COMPLETE ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void qemuAgentNotifyClose ( qemuAgentPtr mon ) {
if ( ! mon ) return ;
VIR_DEBUG ( "mon=%p" , mon ) ;
virObjectLock ( mon ) ;
qemuAgentNotifyCloseLocked ( mon ) ;
virObjectUnlock ( mon ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_QOSMode ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_QOSMode , QOSMode_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void cpTag ( TIFF * in , TIFF * out , uint16 tag , uint16 count , TIFFDataType type ) {
switch ( type ) {
case TIFF_SHORT : if ( count == 1 ) {
uint16 shortv ;
CopyField ( tag , shortv ) ;
}
else if ( count == 2 ) {
uint16 shortv1 , shortv2 ;
CopyField2 ( tag , shortv1 , shortv2 ) ;
}
else if ( count == 4 ) {
uint16 * tr , * tg , * tb , * ta ;
CopyField4 ( tag , tr , tg , tb , ta ) ;
}
else if ( count == ( uint16 ) - 1 ) {
uint16 shortv1 ;
uint16 * shortav ;
CopyField2 ( tag , shortv1 , shortav ) ;
}
break ;
case TIFF_LONG : {
uint32 longv ;
CopyField ( tag , longv ) ;
}
break ;
case TIFF_RATIONAL : if ( count == 1 ) {
float floatv ;
CopyField ( tag , floatv ) ;
}
else if ( count == ( uint16 ) - 1 ) {
float * floatav ;
CopyField ( tag , floatav ) ;
}
break ;
case TIFF_ASCII : {
char * stringv ;
CopyField ( tag , stringv ) ;
}
break ;
case TIFF_DOUBLE : if ( count == 1 ) {
double doublev ;
CopyField ( tag , doublev ) ;
}
else if ( count == ( uint16 ) - 1 ) {
double * doubleav ;
CopyField ( tag , doubleav ) ;
}
break ;
default : TIFFError ( TIFFFileName ( in ) , "Data type %d is not supported, tag %d skipped." , tag , type ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static cmsBool ReadPositionTable ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number Count , cmsUInt32Number BaseOffset , void * Cargo , PositionTableEntryFn ElementFn ) {
cmsUInt32Number i ;
cmsUInt32Number * ElementOffsets = NULL , * ElementSizes = NULL ;
ElementOffsets = ( cmsUInt32Number * ) _cmsCalloc ( io -> ContextID , Count , sizeof ( cmsUInt32Number ) ) ;
if ( ElementOffsets == NULL ) goto Error ;
ElementSizes = ( cmsUInt32Number * ) _cmsCalloc ( io -> ContextID , Count , sizeof ( cmsUInt32Number ) ) ;
if ( ElementSizes == NULL ) goto Error ;
for ( i = 0 ;
i < Count ;
i ++ ) {
if ( ! _cmsReadUInt32Number ( io , & ElementOffsets [ i ] ) ) goto Error ;
if ( ! _cmsReadUInt32Number ( io , & ElementSizes [ i ] ) ) goto Error ;
ElementOffsets [ i ] += BaseOffset ;
}
for ( i = 0 ;
i < Count ;
i ++ ) {
if ( ! io -> Seek ( io , ElementOffsets [ i ] ) ) goto Error ;
if ( ! ElementFn ( self , io , Cargo , i , ElementSizes [ i ] ) ) goto Error ;
}
if ( ElementOffsets != NULL ) _cmsFree ( io -> ContextID , ElementOffsets ) ;
if ( ElementSizes != NULL ) _cmsFree ( io -> ContextID , ElementSizes ) ;
return TRUE ;
Error : if ( ElementOffsets != NULL ) _cmsFree ( io -> ContextID , ElementOffsets ) ;
if ( ElementSizes != NULL ) _cmsFree ( io -> ContextID , ElementSizes ) ;
return FALSE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int at1_imdct_block ( AT1SUCtx * su , AT1Ctx * q ) {
int band_num , band_samples , log2_block_count , nbits , num_blocks , block_size ;
unsigned int start_pos , ref_pos = 0 , pos = 0 ;
for ( band_num = 0 ;
band_num < AT1_QMF_BANDS ;
band_num ++ ) {
float * prev_buf ;
int j ;
band_samples = samples_per_band [ band_num ] ;
log2_block_count = su -> log2_block_count [ band_num ] ;
num_blocks = 1 << log2_block_count ;
if ( num_blocks == 1 ) {
block_size = band_samples >> log2_block_count ;
nbits = mdct_long_nbits [ band_num ] - log2_block_count ;
if ( nbits != 5 && nbits != 7 && nbits != 8 ) return AVERROR_INVALIDDATA ;
}
else {
block_size = 32 ;
nbits = 5 ;
}
start_pos = 0 ;
prev_buf = & su -> spectrum [ 1 ] [ ref_pos + band_samples - 16 ] ;
for ( j = 0 ;
j < num_blocks ;
j ++ ) {
at1_imdct ( q , & q -> spec [ pos ] , & su -> spectrum [ 0 ] [ ref_pos + start_pos ] , nbits , band_num ) ;
q -> fdsp . vector_fmul_window ( & q -> bands [ band_num ] [ start_pos ] , prev_buf , & su -> spectrum [ 0 ] [ ref_pos + start_pos ] , ff_sine_32 , 16 ) ;
prev_buf = & su -> spectrum [ 0 ] [ ref_pos + start_pos + 16 ] ;
start_pos += block_size ;
pos += block_size ;
}
if ( num_blocks == 1 ) memcpy ( q -> bands [ band_num ] + 32 , & su -> spectrum [ 0 ] [ ref_pos + 16 ] , 240 * sizeof ( float ) ) ;
ref_pos += band_samples ;
}
FFSWAP ( float * , su -> spectrum [ 0 ] , su -> spectrum [ 1 ] ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gpgme_error_t set_recipients ( engine_uiserver_t uiserver , gpgme_key_t recp [ ] ) {
gpgme_error_t err = 0 ;
assuan_context_t ctx = uiserver -> assuan_ctx ;
char * line ;
int linelen ;
int invalid_recipients = 0 ;
int i ;
linelen = 10 + 40 + 1 ;
line = malloc ( 10 + 40 + 1 ) ;
if ( ! line ) return gpg_error_from_syserror ( ) ;
strcpy ( line , "RECIPIENT " ) ;
for ( i = 0 ;
! err && recp [ i ] ;
i ++ ) {
char * uid ;
int newlen ;
if ( ! recp [ i ] -> uids || ! ( uid = recp [ i ] -> uids -> uid ) || ! * uid ) {
invalid_recipients ++ ;
continue ;
}
newlen = 11 + strlen ( uid ) ;
if ( linelen < newlen ) {
char * newline = realloc ( line , newlen ) ;
if ( ! newline ) {
int saved_err = gpg_error_from_syserror ( ) ;
free ( line ) ;
return saved_err ;
}
line = newline ;
linelen = newlen ;
}
strcpy ( & line [ 10 ] , uid ) ;
err = uiserver_assuan_simple_command ( ctx , line , uiserver -> status . fnc , uiserver -> status . fnc_value ) ;
if ( gpg_err_code ( err ) == GPG_ERR_NO_PUBKEY ) invalid_recipients ++ ;
else if ( err ) {
free ( line ) ;
return err ;
}
}
free ( line ) ;
return gpg_error ( invalid_recipients ? GPG_ERR_UNUSABLE_PUBKEY : GPG_ERR_NO_ERROR ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint64_t ar_atol8 ( const char * p , unsigned char_cnt ) {
uint64_t l , limit , last_digit_limit ;
unsigned int digit , base ;
base = 8 ;
limit = UINT64_MAX / base ;
last_digit_limit = UINT64_MAX % base ;
while ( ( * p == ' ' || * p == '\t' ) && char_cnt -- > 0 ) p ++ ;
l = 0 ;
digit = * p - '0' ;
while ( * p >= '0' && digit < base && char_cnt -- > 0 ) {
if ( l > limit || ( l == limit && digit > last_digit_limit ) ) {
l = UINT64_MAX ;
break ;
}
l = ( l * base ) + digit ;
digit = * ++ p - '0' ;
}
return ( l ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void gs_heap_free_all ( gs_memory_t * mem , uint free_mask , client_name_t cname ) {
gs_malloc_memory_t * const mmem = ( gs_malloc_memory_t * ) mem ;
gx_monitor_t * mon = mmem -> monitor ;
mmem -> monitor = NULL ;
gx_monitor_free ( mon ) ;
# ifndef MEMENTO if ( free_mask & FREE_ALL_DATA ) {
gs_malloc_block_t * bp = mmem -> allocated ;
gs_malloc_block_t * np ;
for ( ;
bp != 0 ;
bp = np ) {
np = bp -> next ;
if_debug3m ( 'a' , mem , "[a]gs_heap_free_all(%s) 0x%lx(%u)\n" , client_name_string ( bp -> cname ) , ( ulong ) ( bp + 1 ) , bp -> size ) ;
gs_alloc_fill ( bp + 1 , gs_alloc_fill_free , bp -> size ) ;
free ( bp ) ;
}
}
# endif if ( free_mask & FREE_ALL_ALLOCATOR ) free ( mem ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint64_t vmsvga_io_read ( void * opaque , hwaddr addr , unsigned size ) {
struct vmsvga_state_s * s = opaque ;
switch ( addr ) {
case SVGA_IO_MUL * SVGA_INDEX_PORT : return vmsvga_index_read ( s , addr ) ;
case SVGA_IO_MUL * SVGA_VALUE_PORT : return vmsvga_value_read ( s , addr ) ;
case SVGA_IO_MUL * SVGA_BIOS_PORT : return vmsvga_bios_read ( s , addr ) ;
default : return - 1u ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static guint prefix_hash ( gconstpointer key ) {
gchar * copy = g_strdup ( ( const gchar * ) key ) ;
gchar * c = copy ;
guint tmp ;
for ( ;
* c ;
c ++ ) {
if ( * c == '.' ) {
* c = 0 ;
break ;
}
}
tmp = g_str_hash ( copy ) ;
g_free ( copy ) ;
return tmp ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean gst_asf_demux_get_string ( gchar * * p_str , guint16 * p_strlen , guint8 * * p_data , guint64 * p_size ) {
guint16 s_length ;
guint8 * s ;
* p_str = NULL ;
if ( * p_size < 2 ) return FALSE ;
s_length = gst_asf_demux_get_uint16 ( p_data , p_size ) ;
if ( p_strlen ) * p_strlen = s_length ;
if ( s_length == 0 ) {
GST_WARNING ( "zero-length string" ) ;
* p_str = g_strdup ( "" ) ;
return TRUE ;
}
if ( ! gst_asf_demux_get_bytes ( & s , s_length , p_data , p_size ) ) return FALSE ;
g_assert ( s != NULL ) ;
if ( s [ s_length - 1 ] != '\0' ) {
s = g_realloc ( s , s_length + 1 ) ;
s [ s_length ] = '\0' ;
}
* p_str = ( gchar * ) s ;
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_s_validator_prod_cons_fault_count ( packet_info * pinfo , proto_tree * tree , proto_item * item , tvbuff_t * tvb , int offset , int total_len ) {
int i , size ;
proto_tree_add_item ( tree , hf_cip_svalidator_prod_cons_fault_count_size , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ;
size = tvb_get_guint8 ( tvb , offset ) ;
if ( total_len < size + 1 ) {
expert_add_info ( pinfo , item , & ei_mal_svalidator_prod_cons_fault_count ) ;
return total_len ;
}
for ( i = 0 ;
i < size ;
i ++ ) {
proto_tree_add_item ( tree , hf_cip_svalidator_prod_cons_fault_count_item , tvb , offset + 1 + i , 1 , ENC_LITTLE_ENDIAN ) ;
}
return ( size + 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void gx_ttfExport__LineTo ( ttfExport * self , FloatPoint * p ) {
gx_ttfExport * e = ( gx_ttfExport * ) self ;
if ( ! e -> error ) e -> error = gx_path_add_line_notes ( e -> path , float2fixed ( p -> x ) , float2fixed ( p -> y ) , sn_none ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void safe_put_field ( const char * pos , ulong length ) {
if ( ! pos ) tee_fputs ( "NULL" , PAGER ) ;
else {
if ( opt_raw_data ) {
unsigned long i ;
for ( i = 0 ;
i < length ;
i ++ , pos ++ ) tee_putc ( * pos , PAGER ) ;
}
else for ( const char * end = pos + length ;
pos != end ;
pos ++ ) {
# ifdef USE_MB int l ;
if ( use_mb ( charset_info ) && ( l = my_ismbchar ( charset_info , pos , end ) ) ) {
while ( l -- ) tee_putc ( * pos ++ , PAGER ) ;
pos -- ;
continue ;
}
# endif if ( ! * pos ) tee_fputs ( "\\0" , PAGER ) ;
else if ( * pos == '\t' ) tee_fputs ( "\\t" , PAGER ) ;
else if ( * pos == '\n' ) tee_fputs ( "\\n" , PAGER ) ;
else if ( * pos == '\\' ) tee_fputs ( "\\\\" , PAGER ) ;
else tee_putc ( * pos , PAGER ) ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerBrowserTest , MAYBE_TestUnloadMultipleSlowTabs ) {
const int kTabCount = 5 ;
const int kResposiveTabIndex = 2 ;
for ( int i = 0 ;
i < kTabCount ;
i ++ ) {
if ( i ) AddBlankTabAndShow ( browsers_ [ 0 ] ) ;
ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browsers_ [ 0 ] , embedded_test_server ( ) -> GetURL ( ( i == kResposiveTabIndex ) ? "/beforeunload.html" : "/beforeunload_slow.html" ) ) ) ;
}
PrepareForDialog ( browsers_ [ 0 ] -> tab_strip_model ( ) -> GetWebContentsAt ( kResposiveTabIndex ) ) ;
RepeatedNotificationObserver cancel_observer ( chrome : : NOTIFICATION_BROWSER_CLOSE_CANCELLED , 1 ) ;
chrome : : CloseAllBrowsersAndQuit ( ) ;
ASSERT_NO_FATAL_FAILURE ( CancelClose ( ) ) ;
cancel_observer . Wait ( ) ;
EXPECT_FALSE ( browser_shutdown : : IsTryingToQuit ( ) ) ;
EXPECT_EQ ( kTabCount , browsers_ [ 0 ] -> tab_strip_model ( ) -> count ( ) ) ;
RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 1 ) ;
chrome : : CloseAllBrowsersAndQuit ( ) ;
ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ;
close_observer . Wait ( ) ;
EXPECT_TRUE ( browser_shutdown : : IsTryingToQuit ( ) ) ;
EXPECT_TRUE ( BrowserList : : GetInstance ( ) -> empty ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned long # endif # undef mul # undef mul_add # define mul_add ( r , a , word , carry ) do {
\ register BN_ULONG high , low ;
\ asm ( "mulq %3" \ : "=a" ( low ) , "=d" ( high ) \ : "a" ( word ) , "m" ( a ) \ : "cc" ) ;
\ asm ( "addq %2,%0;
adcq %3,%1" \ : "+r" ( carry ) , "+d" ( high ) \ : "a" ( low ) , "g" ( 0 ) \ : "cc" ) ;
\ asm ( "addq %2,%0;
adcq %3,%1" \ : "+m" ( r ) , "+d" ( high ) \ : "r" ( carry ) , "g" ( 0 ) \ : "cc" ) ;
\ carry = high ;
\ }
while ( 0 ) # define mul ( r , a , word , carry ) do {
\ register BN_ULONG high , low ;
\ asm ( "mulq %3" \ : "=a" ( low ) , "=d" ( high ) \ : "a" ( word ) , "g" ( a ) \ : "cc" ) ;
\ asm ( "addq %2,%0;
adcq %3,%1" \ : "+r" ( carry ) , "+d" ( high ) \ : "a" ( low ) , "g" ( 0 ) \ : "cc" ) ;
\ ( r ) = carry , carry = high ;
\ }
while ( 0 ) # undef sqr # define sqr ( r0 , r1 , a ) \ asm ( "mulq %2" \ : "=a" ( r0 ) , "=d" ( r1 ) \ : "a" ( a ) \ : "cc" ) ;
BN_ULONG bn_mul_add_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) {
BN_ULONG c1 = 0 ;
if ( num <= 0 ) return ( c1 ) ;
while ( num & ~ 3 ) {
mul_add ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
mul_add ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
mul_add ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
mul_add ( rp [ 3 ] , ap [ 3 ] , w , c1 ) ;
ap += 4 ;
rp += 4 ;
num -= 4 ;
}
if ( num ) {
mul_add ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul_add ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul_add ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
return c1 ;
}
return ( c1 ) ;
}
BN_ULONG bn_mul_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) {
BN_ULONG c1 = 0 ;
if ( num <= 0 ) return ( c1 ) ;
while ( num & ~ 3 ) {
mul ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
mul ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
mul ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
mul ( rp [ 3 ] , ap [ 3 ] , w , c1 ) ;
ap += 4 ;
rp += 4 ;
num -= 4 ;
}
if ( num ) {
mul ( rp [ 0 ] , ap [ 0 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul ( rp [ 1 ] , ap [ 1 ] , w , c1 ) ;
if ( -- num == 0 ) return c1 ;
mul ( rp [ 2 ] , ap [ 2 ] , w , c1 ) ;
}
return ( c1 ) ;
}
void bn_sqr_words ( BN_ULONG * r , const BN_ULONG * a , int n ) {
if ( n <= 0 ) return ;
while ( n & ~ 3 ) {
sqr ( r [ 0 ] , r [ 1 ] , a [ 0 ] ) ;
sqr ( r [ 2 ] , r [ 3 ] , a [ 1 ] ) ;
sqr ( r [ 4 ] , r [ 5 ] , a [ 2 ] ) ;
sqr ( r [ 6 ] , r [ 7 ] , a [ 3 ] ) ;
a += 4 ;
r += 8 ;
n -= 4 ;
}
if ( n ) {
sqr ( r [ 0 ] , r [ 1 ] , a [ 0 ] ) ;
if ( -- n == 0 ) return ;
sqr ( r [ 2 ] , r [ 3 ] , a [ 1 ] ) ;
if ( -- n == 0 ) return ;
sqr ( r [ 4 ] , r [ 5 ] , a [ 2 ] ) ;
}
}
BN_ULONG bn_div_words ( BN_ULONG h , BN_ULONG l , BN_ULONG d ) {
BN_ULONG ret , waste ;
asm ( "divq %4" : "=a" ( ret ) , "=d" ( waste ) : "a" ( l ) , "d" ( h ) , "g" ( d ) : "cc" ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( FullscreenControllerStateUnitTest , DISABLED_ToggleTabWhenPendingTab ) {
if ( FullscreenControllerStateTest : : IsWindowFullscreenStateChangedReentrant ( ) ) return ;
AddTab ( browser ( ) , GURL ( url : : kAboutBlankURL ) ) ;
ASSERT_NO_FATAL_FAILURE ( TransitionToState ( STATE_TO_TAB_FULLSCREEN ) ) << GetAndClearDebugLog ( ) ;
ASSERT_TRUE ( InvokeEvent ( TAB_FULLSCREEN_TRUE ) ) << GetAndClearDebugLog ( ) ;
ASSERT_TRUE ( InvokeEvent ( TAB_FULLSCREEN_FALSE ) ) << GetAndClearDebugLog ( ) ;
ASSERT_TRUE ( InvokeEvent ( WINDOW_CHANGE ) ) << GetAndClearDebugLog ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static MAIN_WINDOW_REC * mainwindows_find_upper ( MAIN_WINDOW_REC * window ) {
int first_line ;
MAIN_WINDOW_REC * best ;
GSList * tmp ;
if ( window != NULL ) first_line = window -> first_line ;
else first_line = screen_height ;
best = NULL ;
for ( tmp = mainwindows ;
tmp != NULL ;
tmp = tmp -> next ) {
MAIN_WINDOW_REC * rec = tmp -> data ;
if ( rec -> last_line < first_line && ( best == NULL || rec -> last_line > best -> last_line ) ) best = rec ;
}
return best ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gpgme_error_t gpgsm_passwd ( void * engine , gpgme_key_t key , unsigned int flags ) {
engine_gpgsm_t gpgsm = engine ;
gpgme_error_t err ;
char * line ;
if ( ! key || ! key -> subkeys || ! key -> subkeys -> fpr ) return gpg_error ( GPG_ERR_INV_CERT_OBJ ) ;
if ( asprintf ( & line , "PASSWD -- %s" , key -> subkeys -> fpr ) < 0 ) return gpg_error_from_syserror ( ) ;
gpgsm_clear_fd ( gpgsm , OUTPUT_FD ) ;
gpgsm_clear_fd ( gpgsm , INPUT_FD ) ;
gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ;
gpgsm -> inline_data = NULL ;
err = start ( gpgsm , line ) ;
free ( line ) ;
return err ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int ilbc_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
ILBCDecContext * s = avctx -> priv_data ;
AVFrame * frame = data ;
int ret ;
if ( s -> decoder . no_of_bytes > buf_size ) {
av_log ( avctx , AV_LOG_ERROR , "iLBC frame too short (%u, should be %u)\n" , buf_size , s -> decoder . no_of_bytes ) ;
return AVERROR_INVALIDDATA ;
}
frame -> nb_samples = s -> decoder . blockl ;
if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
WebRtcIlbcfix_DecodeImpl ( ( WebRtc_Word16 * ) frame -> data [ 0 ] , ( const WebRtc_UWord16 * ) buf , & s -> decoder , 1 ) ;
* got_frame_ptr = 1 ;
return s -> decoder . no_of_bytes ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int isoent_make_sorted_files ( struct archive_write * a , struct isoent * isoent , struct idr * idr ) {
struct archive_rb_node * rn ;
struct isoent * * children ;
children = malloc ( isoent -> children . cnt * sizeof ( struct isoent * ) ) ;
if ( children == NULL ) {
archive_set_error ( & a -> archive , ENOMEM , "Can't allocate memory" ) ;
return ( ARCHIVE_FATAL ) ;
}
isoent -> children_sorted = children ;
ARCHIVE_RB_TREE_FOREACH ( rn , & ( idr -> rbtree ) ) {
struct idrent * idrent = ( struct idrent * ) rn ;
* children ++ = idrent -> isoent ;
}
return ( ARCHIVE_OK ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void proto_register_diameter ( void ) {
dictionary_load ( ) ;
real_proto_register_diameter ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_loopexit_multiple ( void ) {
struct timeval tv ;
struct event_base * base ;
setup_test ( "Loop Multiple exit: " ) ;
base = event_base_new ( ) ;
tv . tv_usec = 0 ;
tv . tv_sec = 1 ;
event_base_loopexit ( base , & tv ) ;
tv . tv_usec = 0 ;
tv . tv_sec = 2 ;
event_base_loopexit ( base , & tv ) ;
event_base_dispatch ( base ) ;
event_base_free ( base ) ;
test_ok = 1 ;
cleanup_test ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void processEncodingEntry ( ArchiveHandle * AH , TocEntry * te ) {
char * defn = pg_strdup ( te -> defn ) ;
char * ptr1 ;
char * ptr2 = NULL ;
int encoding ;
ptr1 = strchr ( defn , '\'' ) ;
if ( ptr1 ) ptr2 = strchr ( ++ ptr1 , '\'' ) ;
if ( ptr2 ) {
* ptr2 = '\0' ;
encoding = pg_char_to_encoding ( ptr1 ) ;
if ( encoding < 0 ) exit_horribly ( modulename , "unrecognized encoding \"%s\"\n" , ptr1 ) ;
AH -> public . encoding = encoding ;
}
else exit_horribly ( modulename , "invalid ENCODING item: %s\n" , te -> defn ) ;
free ( defn ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void reorder_block ( MPADecodeContext * s , GranuleDef * g ) {
int i , j , len ;
INTFLOAT * ptr , * dst , * ptr1 ;
INTFLOAT tmp [ 576 ] ;
if ( g -> block_type != 2 ) return ;
if ( g -> switch_point ) {
if ( s -> sample_rate_index != 8 ) ptr = g -> sb_hybrid + 36 ;
else ptr = g -> sb_hybrid + 72 ;
}
else {
ptr = g -> sb_hybrid ;
}
for ( i = g -> short_start ;
i < 13 ;
i ++ ) {
len = band_size_short [ s -> sample_rate_index ] [ i ] ;
ptr1 = ptr ;
dst = tmp ;
for ( j = len ;
j > 0 ;
j -- ) {
* dst ++ = ptr [ 0 * len ] ;
* dst ++ = ptr [ 1 * len ] ;
* dst ++ = ptr [ 2 * len ] ;
ptr ++ ;
}
ptr += 2 * len ;
memcpy ( ptr1 , tmp , len * 3 * sizeof ( * ptr1 ) ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void * _getBuffer ( UEnumeration * en , int32_t capacity ) {
if ( en -> baseContext != NULL ) {
if ( ( ( _UEnumBuffer * ) en -> baseContext ) -> len < capacity ) {
capacity += PAD ;
en -> baseContext = uprv_realloc ( en -> baseContext , sizeof ( int32_t ) + capacity ) ;
if ( en -> baseContext == NULL ) {
return NULL ;
}
( ( _UEnumBuffer * ) en -> baseContext ) -> len = capacity ;
}
}
else {
capacity += PAD ;
en -> baseContext = uprv_malloc ( sizeof ( int32_t ) + capacity ) ;
if ( en -> baseContext == NULL ) {
return NULL ;
}
( ( _UEnumBuffer * ) en -> baseContext ) -> len = capacity ;
}
return ( void * ) & ( ( _UEnumBuffer * ) en -> baseContext ) -> data ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void h245_set_h223_set_mc_handle ( h223_set_mc_handle_t handle ) {
h223_set_mc_handle = handle ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void proto_tree_set_int ( field_info * fi , gint32 value ) {
header_field_info * hfinfo ;
guint32 integer ;
gint no_of_bits ;
hfinfo = fi -> hfinfo ;
integer = ( guint32 ) value ;
if ( hfinfo -> bitmask ) {
integer &= ( guint32 ) ( hfinfo -> bitmask ) ;
integer >>= hfinfo_bitshift ( hfinfo ) ;
no_of_bits = ws_count_ones ( hfinfo -> bitmask ) ;
integer = ws_sign_ext32 ( integer , no_of_bits ) ;
}
fvalue_set_sinteger ( & fi -> value , integer ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void macio_ide_class_init ( ObjectClass * oc , void * data ) {
DeviceClass * dc = DEVICE_CLASS ( oc ) ;
dc -> realize = macio_ide_realizefn ;
dc -> reset = macio_ide_reset ;
dc -> vmsd = & vmstate_pmac ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_zcl_appl_ctrl_wr_funcs ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
proto_tree * sub_tree = NULL ;
guint tvb_len ;
guint i = 0 ;
tvb_len = tvb_reported_length ( tvb ) ;
while ( * offset < tvb_len && i < ZBEE_ZCL_APPL_CTRL_NUM_FUNC_ETT ) {
sub_tree = proto_tree_add_subtree_format ( tree , tvb , * offset , 0 , ett_zbee_zcl_appl_ctrl_func [ i ] , NULL , "Function #%d" , i ) ;
i ++ ;
dissect_zcl_appl_ctrl_attr_func ( tvb , sub_tree , offset ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void tm2_null_res_block ( TM2Context * ctx , AVFrame * pic , int bx , int by ) {
int i ;
int ct ;
int left , right , diff ;
int deltas [ 16 ] ;
TM2_INIT_POINTERS ( ) ;
deltas [ 0 ] = deltas [ 1 ] = deltas [ 2 ] = deltas [ 3 ] = 0 ;
tm2_low_chroma ( U , Ustride , clast , ctx -> CD , deltas , bx ) ;
deltas [ 0 ] = deltas [ 1 ] = deltas [ 2 ] = deltas [ 3 ] = 0 ;
tm2_low_chroma ( V , Vstride , clast + 2 , ctx -> CD + 2 , deltas , bx ) ;
for ( i = 0 ;
i < 16 ;
i ++ ) deltas [ i ] = 0 ;
ct = ctx -> D [ 0 ] + ctx -> D [ 1 ] + ctx -> D [ 2 ] + ctx -> D [ 3 ] ;
if ( bx > 0 ) left = last [ - 1 ] - ct ;
else left = 0 ;
right = last [ 3 ] ;
diff = right - left ;
last [ 0 ] = left + ( diff >> 2 ) ;
last [ 1 ] = left + ( diff >> 1 ) ;
last [ 2 ] = right - ( diff >> 2 ) ;
last [ 3 ] = right ;
{
int tp = left ;
ctx -> D [ 0 ] = ( tp + ( ct >> 2 ) ) - left ;
left += ctx -> D [ 0 ] ;
ctx -> D [ 1 ] = ( tp + ( ct >> 1 ) ) - left ;
left += ctx -> D [ 1 ] ;
ctx -> D [ 2 ] = ( ( tp + ct ) - ( ct >> 2 ) ) - left ;
left += ctx -> D [ 2 ] ;
ctx -> D [ 3 ] = ( tp + ct ) - left ;
}
tm2_apply_deltas ( ctx , Y , Ystride , deltas , last ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void rfbNewClientConnection ( rfbScreenInfoPtr rfbScreen , int sock ) {
rfbNewClient ( rfbScreen , sock ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ScoredHistoryMatchTest , GetTopicalityScoreTrailingSlash ) {
const float hostname = GetTopicalityScoreOfTermAgainstURLAndTitle ( ASCIIToUTF16 ( "def" ) , ASCIIToUTF16 ( "http://abc.def.com/" ) , ASCIIToUTF16 ( "Non-Matching Title" ) ) ;
const float hostname_no_slash = GetTopicalityScoreOfTermAgainstURLAndTitle ( ASCIIToUTF16 ( "def" ) , ASCIIToUTF16 ( "http://abc.def.com" ) , ASCIIToUTF16 ( "Non-Matching Title" ) ) ;
EXPECT_EQ ( hostname_no_slash , hostname ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void curses_connection_data_split ( void ) {
char tmp [ MAX_ASCII_ADDR_LEN ] ;
char title [ MAX_ASCII_ADDR_LEN + 6 ] ;
DEBUG_MSG ( "curses_connection_data_split" ) ;
if ( wdg_conndata ) {
struct conn_object * tmp_conn = curr_conn ;
wdg_destroy_object ( & wdg_conndata ) ;
curses_destroy_conndata ( ) ;
curr_conn = tmp_conn ;
}
curr_conn -> flags |= CONN_VIEWING ;
wdg_create_object ( & wdg_conndata , WDG_COMPOUND , WDG_OBJ_WANT_FOCUS ) ;
wdg_set_color ( wdg_conndata , WDG_COLOR_SCREEN , EC_COLOR ) ;
wdg_set_color ( wdg_conndata , WDG_COLOR_WINDOW , EC_COLOR ) ;
wdg_set_color ( wdg_conndata , WDG_COLOR_FOCUS , EC_COLOR_FOCUS ) ;
wdg_set_color ( wdg_conndata , WDG_COLOR_TITLE , EC_COLOR_TITLE ) ;
wdg_set_title ( wdg_conndata , "Connection data" , WDG_ALIGN_LEFT ) ;
wdg_set_size ( wdg_conndata , 1 , 2 , - 1 , SYSMSG_WIN_SIZE - 1 ) ;
wdg_create_object ( & wdg_c1 , WDG_SCROLL , 0 ) ;
snprintf ( title , MAX_ASCII_ADDR_LEN + 6 , "%s:%d" , ip_addr_ntoa ( & curr_conn -> L3_addr1 , tmp ) , ntohs ( curr_conn -> L4_addr1 ) ) ;
wdg_set_title ( wdg_c1 , title , WDG_ALIGN_LEFT ) ;
wdg_set_color ( wdg_c1 , WDG_COLOR_TITLE , EC_COLOR_TITLE ) ;
wdg_set_color ( wdg_c1 , WDG_COLOR_FOCUS , EC_COLOR_FOCUS ) ;
wdg_set_size ( wdg_c1 , 2 , 3 , current_screen . cols / 2 , SYSMSG_WIN_SIZE - 2 ) ;
wdg_create_object ( & wdg_c2 , WDG_SCROLL , 0 ) ;
snprintf ( title , MAX_ASCII_ADDR_LEN + 6 , "%s:%d" , ip_addr_ntoa ( & curr_conn -> L3_addr2 , tmp ) , ntohs ( curr_conn -> L4_addr2 ) ) ;
wdg_set_title ( wdg_c2 , title , WDG_ALIGN_LEFT ) ;
wdg_set_color ( wdg_c2 , WDG_COLOR_TITLE , EC_COLOR_TITLE ) ;
wdg_set_color ( wdg_c2 , WDG_COLOR_FOCUS , EC_COLOR_FOCUS ) ;
wdg_set_size ( wdg_c2 , current_screen . cols / 2 + 1 , 3 , - 2 , SYSMSG_WIN_SIZE - 2 ) ;
wdg_scroll_set_lines ( wdg_c1 , GBL_CONF -> connection_buffer / ( current_screen . cols / 2 ) ) ;
wdg_scroll_set_lines ( wdg_c2 , GBL_CONF -> connection_buffer / ( current_screen . cols / 2 ) ) ;
wdg_compound_add ( wdg_conndata , wdg_c1 ) ;
wdg_compound_add ( wdg_conndata , wdg_c2 ) ;
wdg_add_destroy_key ( wdg_conndata , CTRL ( 'Q' ) , curses_destroy_conndata ) ;
wdg_compound_add_callback ( wdg_conndata , 'j' , curses_connection_data_join ) ;
wdg_compound_add_callback ( wdg_conndata , 'y' , curses_connection_inject ) ;
wdg_compound_add_callback ( wdg_conndata , 'Y' , curses_connection_inject_file ) ;
wdg_compound_add_callback ( wdg_conndata , 'k' , curses_connection_kill_wrapper ) ;
wdg_compound_add_callback ( wdg_conndata , ' ' , curses_connection_data_help ) ;
wdg_draw_object ( wdg_conndata ) ;
wdg_set_focus ( wdg_conndata ) ;
connbuf_print ( & curr_conn -> data , split_print ) ;
conntrack_hook_conn_add ( curr_conn , split_print_po ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | char * qemuAliasTLSObjFromChardevAlias ( const char * chardev_alias ) {
char * ret ;
ignore_value ( virAsprintf ( & ret , "obj%s_tls0" , chardev_alias ) ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void test_rfc2231_parser ( void ) {
const char * input = ";
key4*=us-ascii''foo" ";
key*2=ba%" ";
key2*0=a" ";
key3*0*=us-ascii'en'xyz" ";
key*0=\"foo\"" ";
key2*1*=b%25" ";
key3*1=plop%" ";
key*1=baz" ;
const char * output [ ] = {
"key" , "foobazba%" , "key2*" , "''ab%25" , "key3*" , "us-ascii'en'xyzplop%25" , "key4*" , "us-ascii''foo" , NULL }
;
struct rfc822_parser_context parser ;
const char * const * result ;
unsigned int i ;
test_begin ( "rfc2231 parser" ) ;
rfc822_parser_init ( & parser , ( const void * ) input , strlen ( input ) , NULL ) ;
test_assert ( rfc2231_parse ( & parser , & result ) == 0 ) ;
for ( i = 0 ;
output [ i ] != NULL && result [ i ] != NULL ;
i ++ ) test_assert ( strcmp ( output [ i ] , result [ i ] ) == 0 ) ;
test_assert ( output [ i ] == NULL && result [ i ] == NULL ) ;
test_end ( ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | void input_DecoderChangePause ( decoder_t * p_dec , bool b_paused , mtime_t i_date ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
vlc_mutex_lock ( & p_owner -> lock ) ;
if ( likely ( p_owner -> b_paused != b_paused ) ) {
p_owner -> b_paused = b_paused ;
p_owner -> pause . i_date = i_date ;
p_owner -> pause . i_ignore = 0 ;
vlc_cond_signal ( & p_owner -> wait_request ) ;
DecoderOutputChangePause ( p_dec , b_paused , i_date ) ;
}
vlc_mutex_unlock ( & p_owner -> lock ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VALUE ossl_x509name_hash ( VALUE self ) {
X509_NAME * name ;
unsigned long hash ;
GetX509Name ( self , name ) ;
hash = X509_NAME_hash ( name ) ;
return ULONG2NUM ( hash ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , NonHttpOrHttpsUrl ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , GURL ( chrome : : kChromeUIVersionURL ) ) ;
NavigateToUntrackedUrl ( ) ;
EXPECT_TRUE ( NoPageLoadMetricsRecorded ( ) ) << "Recorded metrics: " << GetRecordedPageLoadMetricNames ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ;
DECL_PIOCTL ( PSetAcl ) ;
DECL_PIOCTL ( PStoreBehind ) ;
DECL_PIOCTL ( PGCPAGs ) ;
DECL_PIOCTL ( PGetAcl ) ;
DECL_PIOCTL ( PNoop ) ;
DECL_PIOCTL ( PBogus ) ;
DECL_PIOCTL ( PGetFileCell ) ;
DECL_PIOCTL ( PGetWSCell ) ;
DECL_PIOCTL ( PGetUserCell ) ;
DECL_PIOCTL ( PSetTokens ) ;
DECL_PIOCTL ( PGetVolumeStatus ) ;
DECL_PIOCTL ( PSetVolumeStatus ) ;
DECL_PIOCTL ( PFlush ) ;
DECL_PIOCTL ( PNewStatMount ) ;
DECL_PIOCTL ( PGetTokens ) ;
DECL_PIOCTL ( PUnlog ) ;
DECL_PIOCTL ( PMariner ) ;
DECL_PIOCTL ( PCheckServers ) ;
DECL_PIOCTL ( PCheckVolNames ) ;
DECL_PIOCTL ( PCheckAuth ) ;
DECL_PIOCTL ( PFindVolume ) ;
DECL_PIOCTL ( PViceAccess ) ;
DECL_PIOCTL ( PSetCacheSize ) ;
DECL_PIOCTL ( PGetCacheSize ) ;
DECL_PIOCTL ( PRemoveCallBack ) ;
DECL_PIOCTL ( PNewCell ) ;
DECL_PIOCTL ( PNewAlias ) ;
DECL_PIOCTL ( PListCells ) ;
DECL_PIOCTL ( PListAliases ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int32_t u_printf_octal_handler ( const u_printf_stream_handler * handler , void * context , ULocaleBundle * formatBundle , const u_printf_spec_info * info , const ufmt_args * args ) {
int64_t num = args [ 0 ] . int64Value ;
UChar result [ UPRINTF_BUFFER_SIZE ] ;
int32_t len = UPRINTF_BUFFER_SIZE ;
if ( info -> fIsShort ) num &= UINT16_MAX ;
else if ( ! info -> fIsLongLong ) num &= UINT32_MAX ;
ufmt_64tou ( result , & len , num , 8 , FALSE , info -> fPrecision == - 1 && info -> fZero ? info -> fWidth : info -> fPrecision ) ;
if ( info -> fAlt && result [ 0 ] != 0x0030 && len < UPRINTF_BUFFER_SIZE - 1 ) {
memmove ( result + 1 , result , len * sizeof ( UChar ) ) ;
result [ 0 ] = 0x0030 ;
len += 1 ;
}
return handler -> pad_and_justify ( context , info , result , len ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | relpRetVal relpTcpSetOwnCert ( relpTcp_t * pThis , char * cert ) {
ENTER_RELPFUNC ;
RELPOBJ_assert ( pThis , Tcp ) ;
free ( pThis -> ownCertFile ) ;
if ( cert == NULL ) {
pThis -> ownCertFile = NULL ;
}
else {
if ( ( pThis -> ownCertFile = strdup ( cert ) ) == NULL ) ABORT_FINALIZE ( RELP_RET_OUT_OF_MEMORY ) ;
}
finalize_it : LEAVE_RELPFUNC ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int _nss_nis_parse_aliasent ( const char * key , char * alias , struct aliasent * result , char * buffer , size_t buflen , int * errnop ) {
char * first_unused = buffer + strlen ( alias ) + 1 ;
size_t room_left = buflen - ( buflen % __alignof__ ( char * ) ) - strlen ( alias ) - 2 ;
char * line ;
char * cp ;
result -> alias_members_len = 0 ;
* first_unused = '\0' ;
first_unused ++ ;
strcpy ( first_unused , key ) ;
if ( first_unused [ room_left - 1 ] != '\0' ) {
no_more_room : * errnop = ERANGE ;
return - 1 ;
}
result -> alias_name = first_unused ;
cp = strpbrk ( alias , "#\n" ) ;
if ( cp != NULL ) * cp = '\0' ;
first_unused += strlen ( result -> alias_name ) + 1 ;
first_unused += __alignof__ ( char * ) - 1 ;
first_unused -= ( ( first_unused - ( char * ) 0 ) % __alignof__ ( char * ) ) ;
result -> alias_members = ( char * * ) first_unused ;
line = alias ;
while ( * line != '\0' ) {
while ( isspace ( * line ) ) line ++ ;
if ( * line == '\0' ) break ;
if ( room_left < sizeof ( char * ) ) goto no_more_room ;
room_left -= sizeof ( char * ) ;
result -> alias_members [ result -> alias_members_len ] = line ;
while ( * line != '\0' && * line != ',' ) line ++ ;
if ( line != result -> alias_members [ result -> alias_members_len ] ) {
* line = '\0' ;
line ++ ;
result -> alias_members_len ++ ;
}
}
return result -> alias_members_len == 0 ? 0 : 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_GatekeeperRequest ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_GatekeeperRequest , GatekeeperRequest_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static __inline__ __u32 __fswab32 ( __u32 val ) {
# if defined ( __arch_swab32 ) return __arch_swab32 ( val ) ;
# else return ___constant_swab32 ( val ) ;
# endif } | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_t38_Type_of_msg ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_t38_Type_of_msg , Type_of_msg_choice , & Type_of_msg_value ) ;
# line 22 "../../asn1/t38/t38.cnf" if ( primary_part ) t38_info -> type_msg = Type_of_msg_value ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void bind_date_conv ( uint row_count , my_bool preserveFractions ) {
MYSQL_STMT * stmt = 0 ;
uint rc , i , count = row_count ;
ulong length [ 4 ] ;
MYSQL_BIND my_bind [ 4 ] ;
my_bool is_null [ 4 ] = {
0 }
;
MYSQL_TIME tm [ 4 ] ;
ulong second_part ;
uint year , month , day , hour , minute , sec ;
uint now_year = 1990 , now_month = 3 , now_day = 13 ;
rc = mysql_query ( mysql , "SET timestamp=UNIX_TIMESTAMP('1990-03-13')" ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , "INSERT INTO test_date VALUES(?, ?, ?, ?)" ) ;
check_stmt ( stmt ) ;
verify_param_count ( stmt , 4 ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
my_bind [ 0 ] . buffer_type = MYSQL_TYPE_TIMESTAMP ;
my_bind [ 1 ] . buffer_type = MYSQL_TYPE_TIME ;
my_bind [ 2 ] . buffer_type = MYSQL_TYPE_DATETIME ;
my_bind [ 3 ] . buffer_type = MYSQL_TYPE_DATE ;
for ( i = 0 ;
i < ( int ) array_elements ( my_bind ) ;
i ++ ) {
my_bind [ i ] . buffer = ( void * ) & tm [ i ] ;
my_bind [ i ] . is_null = & is_null [ i ] ;
my_bind [ i ] . length = & length [ i ] ;
my_bind [ i ] . buffer_length = 30 ;
length [ i ] = 20 ;
}
second_part = 0 ;
year = 2000 ;
month = 01 ;
day = 10 ;
hour = 11 ;
minute = 16 ;
sec = 20 ;
rc = mysql_stmt_bind_param ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
for ( count = 0 ;
count < row_count ;
count ++ ) {
for ( i = 0 ;
i < ( int ) array_elements ( my_bind ) ;
i ++ ) {
tm [ i ] . neg = 0 ;
tm [ i ] . second_part = second_part + count ;
if ( my_bind [ i ] . buffer_type != MYSQL_TYPE_TIME ) {
tm [ i ] . year = year + count ;
tm [ i ] . month = month + count ;
tm [ i ] . day = day + count ;
}
else tm [ i ] . year = tm [ i ] . month = tm [ i ] . day = 0 ;
if ( my_bind [ i ] . buffer_type != MYSQL_TYPE_DATE ) {
tm [ i ] . hour = hour + count ;
tm [ i ] . minute = minute + count ;
tm [ i ] . second = sec + count ;
}
else tm [ i ] . hour = tm [ i ] . minute = tm [ i ] . second = 0 ;
}
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
}
rc = mysql_commit ( mysql ) ;
myquery ( rc ) ;
mysql_stmt_close ( stmt ) ;
rc = my_stmt_result ( "SELECT * FROM test_date" ) ;
DIE_UNLESS ( row_count == rc ) ;
stmt = mysql_simple_prepare ( mysql , "SELECT * FROM test_date" ) ;
check_stmt ( stmt ) ;
rc = mysql_stmt_bind_result ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_store_result ( stmt ) ;
check_execute ( stmt , rc ) ;
for ( count = 0 ;
count < row_count ;
count ++ ) {
rc = mysql_stmt_fetch ( stmt ) ;
DIE_UNLESS ( rc == 0 || rc == MYSQL_DATA_TRUNCATED ) ;
if ( ! opt_silent ) fprintf ( stdout , "\n" ) ;
for ( i = 0 ;
i < array_elements ( my_bind ) ;
i ++ ) {
if ( ! opt_silent ) fprintf ( stdout , "\ntime[%d]: %02d-%02d-%02d %02d:%02d:%02d.%06lu" , i , tm [ i ] . year , tm [ i ] . month , tm [ i ] . day , tm [ i ] . hour , tm [ i ] . minute , tm [ i ] . second , tm [ i ] . second_part ) ;
DIE_UNLESS ( tm [ i ] . year == 0 || tm [ i ] . year == year + count || ( tm [ i ] . year == now_year && my_bind [ i ] . buffer_type == MYSQL_TYPE_TIME ) ) ;
DIE_UNLESS ( tm [ i ] . month == 0 || tm [ i ] . month == month + count || ( tm [ i ] . month == now_month && my_bind [ i ] . buffer_type == MYSQL_TYPE_TIME ) ) ;
DIE_UNLESS ( tm [ i ] . day == 0 || tm [ i ] . day == day + count || ( tm [ i ] . day == now_day && my_bind [ i ] . buffer_type == MYSQL_TYPE_TIME ) ) ;
DIE_UNLESS ( tm [ i ] . hour == 0 || tm [ i ] . hour == hour + count ) ;
DIE_UNLESS ( tm [ i ] . minute == 0 || tm [ i ] . minute == minute + count ) ;
DIE_UNLESS ( tm [ i ] . second == 0 || tm [ i ] . second == sec + count ) ;
if ( preserveFractions ) {
if ( i == 3 ) {
DIE_UNLESS ( tm [ i ] . second_part == 0 ) ;
}
else {
DIE_UNLESS ( tm [ i ] . second_part == second_part + count ) ;
}
}
else {
DIE_UNLESS ( ( tm [ i ] . second_part == 0 ) || tm [ i ] . second_part == second_part + count ) ;
}
}
}
rc = mysql_stmt_fetch ( stmt ) ;
DIE_UNLESS ( rc == MYSQL_NO_DATA ) ;
mysql_stmt_close ( stmt ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void uiserver_set_io_cbs ( void * engine , gpgme_io_cbs_t io_cbs ) {
engine_uiserver_t uiserver = engine ;
uiserver -> io_cbs = * io_cbs ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * custom_time_to_string ( char * format , va_list va ) {
int secs ;
secs = va_arg ( va , int ) ;
return format_time ( secs ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_s_supervisor_configuration_unid ( packet_info * pinfo , proto_tree * tree _U_ , proto_item * item , tvbuff_t * tvb , int offset , int total_len ) {
if ( total_len < 10 ) {
expert_add_info ( pinfo , item , & ei_mal_ssupervisor_configuration_unid ) ;
return total_len ;
}
dissect_unid ( tvb , pinfo , offset , item , "CFUNID SSN" , hf_cip_ssupervisor_configuration_unid_ssn_timestamp , hf_cip_ssupervisor_configuration_unid_ssn_date , hf_cip_ssupervisor_configuration_unid_ssn_time , hf_cip_ssupervisor_configuration_unid_macid , ett_ssupervisor_configuration_unid , ett_ssupervisor_configuration_unid_ssn ) ;
return 10 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static hb_position_t hb_font_get_glyph_h_kerning_nil ( hb_font_t * font , void * font_data HB_UNUSED , hb_codepoint_t left_glyph , hb_codepoint_t right_glyph , void * user_data HB_UNUSED ) {
if ( font -> parent ) return font -> parent_scale_x_distance ( font -> parent -> get_glyph_h_kerning ( left_glyph , right_glyph ) ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static TRBCCode xhci_address_slot ( XHCIState * xhci , unsigned int slotid , uint64_t pictx , bool bsr ) {
XHCISlot * slot ;
USBPort * uport ;
USBDevice * dev ;
dma_addr_t ictx , octx , dcbaap ;
uint64_t poctx ;
uint32_t ictl_ctx [ 2 ] ;
uint32_t slot_ctx [ 4 ] ;
uint32_t ep0_ctx [ 5 ] ;
int i ;
TRBCCode res ;
assert ( slotid >= 1 && slotid <= xhci -> numslots ) ;
dcbaap = xhci_addr64 ( xhci -> dcbaap_low , xhci -> dcbaap_high ) ;
poctx = ldq_le_pci_dma ( PCI_DEVICE ( xhci ) , dcbaap + 8 * slotid ) ;
ictx = xhci_mask64 ( pictx ) ;
octx = xhci_mask64 ( poctx ) ;
DPRINTF ( "xhci: input context at " DMA_ADDR_FMT "\n" , ictx ) ;
DPRINTF ( "xhci: output context at " DMA_ADDR_FMT "\n" , octx ) ;
xhci_dma_read_u32s ( xhci , ictx , ictl_ctx , sizeof ( ictl_ctx ) ) ;
if ( ictl_ctx [ 0 ] != 0x0 || ictl_ctx [ 1 ] != 0x3 ) {
DPRINTF ( "xhci: invalid input context control %08x %08x\n" , ictl_ctx [ 0 ] , ictl_ctx [ 1 ] ) ;
return CC_TRB_ERROR ;
}
xhci_dma_read_u32s ( xhci , ictx + 32 , slot_ctx , sizeof ( slot_ctx ) ) ;
xhci_dma_read_u32s ( xhci , ictx + 64 , ep0_ctx , sizeof ( ep0_ctx ) ) ;
DPRINTF ( "xhci: input slot context: %08x %08x %08x %08x\n" , slot_ctx [ 0 ] , slot_ctx [ 1 ] , slot_ctx [ 2 ] , slot_ctx [ 3 ] ) ;
DPRINTF ( "xhci: input ep0 context: %08x %08x %08x %08x %08x\n" , ep0_ctx [ 0 ] , ep0_ctx [ 1 ] , ep0_ctx [ 2 ] , ep0_ctx [ 3 ] , ep0_ctx [ 4 ] ) ;
uport = xhci_lookup_uport ( xhci , slot_ctx ) ;
if ( uport == NULL ) {
DPRINTF ( "xhci: port not found\n" ) ;
return CC_TRB_ERROR ;
}
trace_usb_xhci_slot_address ( slotid , uport -> path ) ;
dev = uport -> dev ;
if ( ! dev || ! dev -> attached ) {
DPRINTF ( "xhci: port %s not connected\n" , uport -> path ) ;
return CC_USB_TRANSACTION_ERROR ;
}
for ( i = 0 ;
i < xhci -> numslots ;
i ++ ) {
if ( i == slotid - 1 ) {
continue ;
}
if ( xhci -> slots [ i ] . uport == uport ) {
DPRINTF ( "xhci: port %s already assigned to slot %d\n" , uport -> path , i + 1 ) ;
return CC_TRB_ERROR ;
}
}
slot = & xhci -> slots [ slotid - 1 ] ;
slot -> uport = uport ;
slot -> ctx = octx ;
usb_device_reset ( dev ) ;
if ( bsr ) {
slot_ctx [ 3 ] = SLOT_DEFAULT << SLOT_STATE_SHIFT ;
}
else {
USBPacket p ;
uint8_t buf [ 1 ] ;
slot_ctx [ 3 ] = ( SLOT_ADDRESSED << SLOT_STATE_SHIFT ) | slotid ;
memset ( & p , 0 , sizeof ( p ) ) ;
usb_packet_addbuf ( & p , buf , sizeof ( buf ) ) ;
usb_packet_setup ( & p , USB_TOKEN_OUT , usb_ep_get ( dev , USB_TOKEN_OUT , 0 ) , 0 , 0 , false , false ) ;
usb_device_handle_control ( dev , & p , DeviceOutRequest | USB_REQ_SET_ADDRESS , slotid , 0 , 0 , NULL ) ;
assert ( p . status != USB_RET_ASYNC ) ;
}
res = xhci_enable_ep ( xhci , slotid , 1 , octx + 32 , ep0_ctx ) ;
DPRINTF ( "xhci: output slot context: %08x %08x %08x %08x\n" , slot_ctx [ 0 ] , slot_ctx [ 1 ] , slot_ctx [ 2 ] , slot_ctx [ 3 ] ) ;
DPRINTF ( "xhci: output ep0 context: %08x %08x %08x %08x %08x\n" , ep0_ctx [ 0 ] , ep0_ctx [ 1 ] , ep0_ctx [ 2 ] , ep0_ctx [ 3 ] , ep0_ctx [ 4 ] ) ;
xhci_dma_write_u32s ( xhci , octx , slot_ctx , sizeof ( slot_ctx ) ) ;
xhci_dma_write_u32s ( xhci , octx + 32 , ep0_ctx , sizeof ( ep0_ctx ) ) ;
xhci -> slots [ slotid - 1 ] . addressed = 1 ;
return res ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ssize_t qio_channel_websock_read_wire ( QIOChannelWebsock * ioc , Error * * errp ) {
ssize_t ret ;
if ( ioc -> encinput . offset < 4096 ) {
size_t want = 4096 - ioc -> encinput . offset ;
buffer_reserve ( & ioc -> encinput , want ) ;
ret = qio_channel_read ( ioc -> master , ( char * ) ioc -> encinput . buffer + ioc -> encinput . offset , want , errp ) ;
if ( ret < 0 ) {
return ret ;
}
if ( ret == 0 && ioc -> encinput . offset == 0 ) {
ioc -> io_eof = TRUE ;
return 0 ;
}
ioc -> encinput . offset += ret ;
}
while ( ioc -> encinput . offset != 0 ) {
if ( ioc -> payload_remain == 0 ) {
ret = qio_channel_websock_decode_header ( ioc , errp ) ;
if ( ret < 0 ) {
return ret ;
}
}
ret = qio_channel_websock_decode_payload ( ioc , errp ) ;
if ( ret < 0 ) {
return ret ;
}
}
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_SET_SIZE_1_256_OF_CapabilityTableEntry ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_set_of ( tvb , offset , actx , tree , hf_index , ett_h245_SET_SIZE_1_256_OF_CapabilityTableEntry , SET_SIZE_1_256_OF_CapabilityTableEntry_set_of , 1 , 256 , FALSE ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void encode_frame_to_data_rate ( VP8_COMP * cpi , unsigned long * size , unsigned char * dest , unsigned char * dest_end , unsigned int * frame_flags ) {
int Q ;
int frame_over_shoot_limit ;
int frame_under_shoot_limit ;
int Loop = 0 ;
int loop_count ;
VP8_COMMON * cm = & cpi -> common ;
int active_worst_qchanged = 0 ;
# if ! ( CONFIG_REALTIME_ONLY ) int q_low ;
int q_high ;
int zbin_oq_high ;
int zbin_oq_low = 0 ;
int top_index ;
int bottom_index ;
int overshoot_seen = 0 ;
int undershoot_seen = 0 ;
# endif int drop_mark = ( int ) ( cpi -> oxcf . drop_frames_water_mark * cpi -> oxcf . optimal_buffer_level / 100 ) ;
int drop_mark75 = drop_mark * 2 / 3 ;
int drop_mark50 = drop_mark / 4 ;
int drop_mark25 = drop_mark / 8 ;
vp8_clear_system_state ( ) ;
# if CONFIG_MULTITHREAD if ( cpi -> b_lpf_running ) {
sem_wait ( & cpi -> h_event_end_lpf ) ;
cpi -> b_lpf_running = 0 ;
}
# endif if ( cpi -> force_next_frame_intra ) {
cm -> frame_type = KEY_FRAME ;
cpi -> force_next_frame_intra = 0 ;
}
# if ! ( CONFIG_REALTIME_ONLY ) if ( cpi -> pass == 2 ) {
if ( cpi -> common . refresh_alt_ref_frame ) {
cpi -> per_frame_bandwidth = cpi -> twopass . gf_bits ;
cpi -> target_bandwidth = ( int ) ( cpi -> twopass . gf_bits * cpi -> output_framerate ) ;
}
}
else # endif cpi -> per_frame_bandwidth = ( int ) ( cpi -> target_bandwidth / cpi -> output_framerate ) ;
cm -> copy_buffer_to_gf = 0 ;
cm -> copy_buffer_to_arf = 0 ;
cpi -> mb . zbin_over_quant = 0 ;
cpi -> mb . zbin_mode_boost = 0 ;
cpi -> mb . zbin_mode_boost_enabled = 1 ;
if ( cpi -> pass == 2 ) {
if ( cpi -> gfu_boost <= 400 ) {
cpi -> mb . zbin_mode_boost_enabled = 0 ;
}
}
if ( cpi -> source_alt_ref_active ) cpi -> common . ref_frame_sign_bias [ ALTREF_FRAME ] = 1 ;
else cpi -> common . ref_frame_sign_bias [ ALTREF_FRAME ] = 0 ;
if ( ( cm -> current_video_frame == 0 ) || ( cm -> frame_flags & FRAMEFLAGS_KEY ) || ( cpi -> oxcf . auto_key && ( cpi -> frames_since_key % cpi -> key_frame_frequency == 0 ) ) ) {
cm -> frame_type = KEY_FRAME ;
# if CONFIG_TEMPORAL_DENOISING if ( cpi -> oxcf . noise_sensitivity == 4 ) {
vp8_denoiser_set_parameters ( & cpi -> denoiser , kDenoiserOnYUV ) ;
}
# endif }
# if CONFIG_MULTI_RES_ENCODING if ( cpi -> oxcf . mr_encoder_id ) {
LOWER_RES_FRAME_INFO * low_res_frame_info = ( LOWER_RES_FRAME_INFO * ) cpi -> oxcf . mr_low_res_mode_info ;
cm -> frame_type = low_res_frame_info -> frame_type ;
if ( cm -> frame_type != KEY_FRAME ) {
cpi -> mr_low_res_mv_avail = 1 ;
cpi -> mr_low_res_mv_avail &= ! ( low_res_frame_info -> is_frame_dropped ) ;
if ( cpi -> ref_frame_flags & VP8_LAST_FRAME ) cpi -> mr_low_res_mv_avail &= ( cpi -> current_ref_frames [ LAST_FRAME ] == low_res_frame_info -> low_res_ref_frames [ LAST_FRAME ] ) ;
if ( cpi -> ref_frame_flags & VP8_GOLD_FRAME ) cpi -> mr_low_res_mv_avail &= ( cpi -> current_ref_frames [ GOLDEN_FRAME ] == low_res_frame_info -> low_res_ref_frames [ GOLDEN_FRAME ] ) ;
if ( cpi -> ref_frame_flags & VP8_ALTR_FRAME ) cpi -> mr_low_res_mv_avail &= ( cpi -> current_ref_frames [ ALTREF_FRAME ] == low_res_frame_info -> low_res_ref_frames [ ALTREF_FRAME ] ) ;
}
}
# endif cpi -> closest_reference_frame = LAST_FRAME ;
if ( cm -> frame_type != KEY_FRAME ) {
int i ;
MV_REFERENCE_FRAME closest_ref = INTRA_FRAME ;
if ( cpi -> ref_frame_flags & VP8_LAST_FRAME ) {
closest_ref = LAST_FRAME ;
}
else if ( cpi -> ref_frame_flags & VP8_GOLD_FRAME ) {
closest_ref = GOLDEN_FRAME ;
}
else if ( cpi -> ref_frame_flags & VP8_ALTR_FRAME ) {
closest_ref = ALTREF_FRAME ;
}
for ( i = 1 ;
i <= 3 ;
i ++ ) {
vpx_ref_frame_type_t ref_frame_type = ( vpx_ref_frame_type_t ) ( ( i == 3 ) ? 4 : i ) ;
if ( cpi -> ref_frame_flags & ref_frame_type ) {
if ( ( cm -> current_video_frame - cpi -> current_ref_frames [ i ] ) < ( cm -> current_video_frame - cpi -> current_ref_frames [ closest_ref ] ) ) {
closest_ref = i ;
}
}
}
cpi -> closest_reference_frame = closest_ref ;
}
if ( cm -> frame_type == KEY_FRAME ) {
int i ;
setup_features ( cpi ) ;
cpi -> source_alt_ref_active = 0 ;
for ( i = 0 ;
i < MAX_MODES ;
i ++ ) {
cpi -> mb . rd_thresh_mult [ i ] = 128 ;
}
vpx_memset ( cpi -> consec_zero_last , 0 , cm -> mb_rows * cm -> mb_cols ) ;
}
# if 0 {
cpi -> one_pass_frame_index = cm -> current_video_frame % MAX_LAG_BUFFERS ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frames_so_far = 0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_intra_error = 0.0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_coded_error = 0.0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_pcnt_inter = 0.0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_pcnt_motion = 0.0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_mvr = 0.0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_mvr_abs = 0.0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_mvc = 0.0 ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_mvc_abs = 0.0 ;
}
# endif update_rd_ref_frame_probs ( cpi ) ;
if ( cpi -> drop_frames_allowed ) {
if ( ( cpi -> buffer_level > drop_mark ) && ( cpi -> decimation_factor > 0 ) ) cpi -> decimation_factor -- ;
if ( cpi -> buffer_level > drop_mark75 && cpi -> decimation_factor > 0 ) cpi -> decimation_factor = 1 ;
else if ( cpi -> buffer_level < drop_mark25 && ( cpi -> decimation_factor == 2 || cpi -> decimation_factor == 3 ) ) {
cpi -> decimation_factor = 3 ;
}
else if ( cpi -> buffer_level < drop_mark50 && ( cpi -> decimation_factor == 1 || cpi -> decimation_factor == 2 ) ) {
cpi -> decimation_factor = 2 ;
}
else if ( cpi -> buffer_level < drop_mark75 && ( cpi -> decimation_factor == 0 || cpi -> decimation_factor == 1 ) ) {
cpi -> decimation_factor = 1 ;
}
}
if ( cpi -> decimation_factor > 0 ) {
switch ( cpi -> decimation_factor ) {
case 1 : cpi -> per_frame_bandwidth = cpi -> per_frame_bandwidth * 3 / 2 ;
break ;
case 2 : cpi -> per_frame_bandwidth = cpi -> per_frame_bandwidth * 5 / 4 ;
break ;
case 3 : cpi -> per_frame_bandwidth = cpi -> per_frame_bandwidth * 5 / 4 ;
break ;
}
if ( cm -> frame_type == KEY_FRAME ) {
cpi -> decimation_count = cpi -> decimation_factor ;
}
else if ( cpi -> decimation_count > 0 ) {
cpi -> decimation_count -- ;
cpi -> bits_off_target += cpi -> av_per_frame_bandwidth ;
if ( cpi -> bits_off_target > cpi -> oxcf . maximum_buffer_size ) cpi -> bits_off_target = cpi -> oxcf . maximum_buffer_size ;
# if CONFIG_MULTI_RES_ENCODING vp8_store_drop_frame_info ( cpi ) ;
# endif cm -> current_video_frame ++ ;
cpi -> frames_since_key ++ ;
cpi -> temporal_pattern_counter ++ ;
# if CONFIG_INTERNAL_STATS cpi -> count ++ ;
# endif cpi -> buffer_level = cpi -> bits_off_target ;
if ( cpi -> oxcf . number_of_layers > 1 ) {
unsigned int i ;
for ( i = cpi -> current_layer + 1 ;
i < cpi -> oxcf . number_of_layers ;
i ++ ) {
LAYER_CONTEXT * lc = & cpi -> layer_context [ i ] ;
lc -> bits_off_target += ( int ) ( lc -> target_bandwidth / lc -> framerate ) ;
if ( lc -> bits_off_target > lc -> maximum_buffer_size ) lc -> bits_off_target = lc -> maximum_buffer_size ;
lc -> buffer_level = lc -> bits_off_target ;
}
}
return ;
}
else cpi -> decimation_count = cpi -> decimation_factor ;
}
else cpi -> decimation_count = 0 ;
if ( ! vp8_pick_frame_size ( cpi ) ) {
# if CONFIG_MULTI_RES_ENCODING vp8_store_drop_frame_info ( cpi ) ;
# endif cm -> current_video_frame ++ ;
cpi -> frames_since_key ++ ;
cpi -> temporal_pattern_counter ++ ;
return ;
}
if ( ( cpi -> oxcf . end_usage == USAGE_STREAM_FROM_SERVER ) && ( cpi -> buffer_level >= cpi -> oxcf . optimal_buffer_level ) && cpi -> buffered_mode ) {
int Adjustment = cpi -> active_worst_quality / 4 ;
if ( Adjustment ) {
int buff_lvl_step ;
if ( cpi -> buffer_level < cpi -> oxcf . maximum_buffer_size ) {
buff_lvl_step = ( int ) ( ( cpi -> oxcf . maximum_buffer_size - cpi -> oxcf . optimal_buffer_level ) / Adjustment ) ;
if ( buff_lvl_step ) Adjustment = ( int ) ( ( cpi -> buffer_level - cpi -> oxcf . optimal_buffer_level ) / buff_lvl_step ) ;
else Adjustment = 0 ;
}
cpi -> active_worst_quality -= Adjustment ;
if ( cpi -> active_worst_quality < cpi -> active_best_quality ) cpi -> active_worst_quality = cpi -> active_best_quality ;
}
}
if ( ( cpi -> pass == 2 ) || ( cpi -> ni_frames > 150 ) ) {
vp8_clear_system_state ( ) ;
Q = cpi -> active_worst_quality ;
if ( cm -> frame_type == KEY_FRAME ) {
if ( cpi -> pass == 2 ) {
if ( cpi -> gfu_boost > 600 ) cpi -> active_best_quality = kf_low_motion_minq [ Q ] ;
else cpi -> active_best_quality = kf_high_motion_minq [ Q ] ;
if ( cpi -> this_key_frame_forced ) {
if ( cpi -> active_best_quality > cpi -> avg_frame_qindex * 7 / 8 ) cpi -> active_best_quality = cpi -> avg_frame_qindex * 7 / 8 ;
else if ( cpi -> active_best_quality < cpi -> avg_frame_qindex >> 2 ) cpi -> active_best_quality = cpi -> avg_frame_qindex >> 2 ;
}
}
else cpi -> active_best_quality = kf_high_motion_minq [ Q ] ;
}
else if ( cpi -> oxcf . number_of_layers == 1 && ( cm -> refresh_golden_frame || cpi -> common . refresh_alt_ref_frame ) ) {
if ( ( cpi -> frames_since_key > 1 ) && ( cpi -> avg_frame_qindex < cpi -> active_worst_quality ) ) {
Q = cpi -> avg_frame_qindex ;
}
if ( ( cpi -> oxcf . end_usage == USAGE_CONSTRAINED_QUALITY ) && ( Q < cpi -> cq_target_quality ) ) {
Q = cpi -> cq_target_quality ;
}
if ( cpi -> pass == 2 ) {
if ( cpi -> gfu_boost > 1000 ) cpi -> active_best_quality = gf_low_motion_minq [ Q ] ;
else if ( cpi -> gfu_boost < 400 ) cpi -> active_best_quality = gf_high_motion_minq [ Q ] ;
else cpi -> active_best_quality = gf_mid_motion_minq [ Q ] ;
if ( cpi -> oxcf . end_usage == USAGE_CONSTRAINED_QUALITY ) {
cpi -> active_best_quality = cpi -> active_best_quality * 15 / 16 ;
}
}
else cpi -> active_best_quality = gf_high_motion_minq [ Q ] ;
}
else {
cpi -> active_best_quality = inter_minq [ Q ] ;
if ( ( cpi -> oxcf . end_usage == USAGE_CONSTRAINED_QUALITY ) && ( cpi -> active_best_quality < cpi -> cq_target_quality ) ) {
if ( cpi -> rolling_actual_bits < cpi -> min_frame_bandwidth ) cpi -> active_best_quality = cpi -> oxcf . cq_level ;
else cpi -> active_best_quality = cpi -> cq_target_quality ;
}
}
if ( cpi -> oxcf . end_usage == USAGE_STREAM_FROM_SERVER ) {
if ( cpi -> buffer_level >= cpi -> oxcf . maximum_buffer_size ) cpi -> active_best_quality = cpi -> best_quality ;
else if ( cpi -> buffer_level > cpi -> oxcf . optimal_buffer_level ) {
int Fraction = ( int ) ( ( ( cpi -> buffer_level - cpi -> oxcf . optimal_buffer_level ) * 128 ) / ( cpi -> oxcf . maximum_buffer_size - cpi -> oxcf . optimal_buffer_level ) ) ;
int min_qadjustment = ( ( cpi -> active_best_quality - cpi -> best_quality ) * Fraction ) / 128 ;
cpi -> active_best_quality -= min_qadjustment ;
}
}
}
else if ( cpi -> oxcf . end_usage == USAGE_CONSTRAINED_QUALITY ) {
if ( ( cm -> frame_type == KEY_FRAME ) || cm -> refresh_golden_frame || cpi -> common . refresh_alt_ref_frame ) {
cpi -> active_best_quality = cpi -> best_quality ;
}
else if ( cpi -> active_best_quality < cpi -> cq_target_quality ) {
cpi -> active_best_quality = cpi -> cq_target_quality ;
}
}
if ( cpi -> active_worst_quality > cpi -> worst_quality ) cpi -> active_worst_quality = cpi -> worst_quality ;
if ( cpi -> active_best_quality < cpi -> best_quality ) cpi -> active_best_quality = cpi -> best_quality ;
if ( cpi -> active_worst_quality < cpi -> active_best_quality ) cpi -> active_worst_quality = cpi -> active_best_quality ;
Q = vp8_regulate_q ( cpi , cpi -> this_frame_target ) ;
# if ! ( CONFIG_REALTIME_ONLY ) if ( cm -> frame_type == KEY_FRAME ) zbin_oq_high = 0 ;
else if ( ( cpi -> oxcf . number_of_layers == 1 ) && ( ( cm -> refresh_alt_ref_frame || ( cm -> refresh_golden_frame && ! cpi -> source_alt_ref_active ) ) ) ) {
zbin_oq_high = 16 ;
}
else zbin_oq_high = ZBIN_OQ_MAX ;
# endif if ( cpi -> cyclic_refresh_mode_enabled ) {
if ( cpi -> current_layer == 0 ) cyclic_background_refresh ( cpi , Q , 0 ) ;
else disable_segmentation ( cpi ) ;
}
vp8_compute_frame_size_bounds ( cpi , & frame_under_shoot_limit , & frame_over_shoot_limit ) ;
# if ! ( CONFIG_REALTIME_ONLY ) bottom_index = cpi -> active_best_quality ;
top_index = cpi -> active_worst_quality ;
q_low = cpi -> active_best_quality ;
q_high = cpi -> active_worst_quality ;
# endif vp8_save_coding_context ( cpi ) ;
loop_count = 0 ;
scale_and_extend_source ( cpi -> un_scaled_source , cpi ) ;
# if ! ( CONFIG_REALTIME_ONLY ) && CONFIG_POSTPROC && ! ( CONFIG_TEMPORAL_DENOISING ) if ( cpi -> oxcf . noise_sensitivity > 0 ) {
unsigned char * src ;
int l = 0 ;
switch ( cpi -> oxcf . noise_sensitivity ) {
case 1 : l = 20 ;
break ;
case 2 : l = 40 ;
break ;
case 3 : l = 60 ;
break ;
case 4 : l = 80 ;
break ;
case 5 : l = 100 ;
break ;
case 6 : l = 150 ;
break ;
}
if ( cm -> frame_type == KEY_FRAME ) {
vp8_de_noise ( cm , cpi -> Source , cpi -> Source , l , 1 , 0 ) ;
}
else {
vp8_de_noise ( cm , cpi -> Source , cpi -> Source , l , 1 , 0 ) ;
src = cpi -> Source -> y_buffer ;
if ( cpi -> Source -> y_stride < 0 ) {
src += cpi -> Source -> y_stride * ( cpi -> Source -> y_height - 1 ) ;
}
}
}
# endif # ifdef OUTPUT_YUV_SRC vp8_write_yuv_frame ( yuv_file , cpi -> Source ) ;
# endif do {
vp8_clear_system_state ( ) ;
vp8_set_quantizer ( cpi , Q ) ;
if ( cpi -> common . mb_no_coeff_skip ) {
cpi -> prob_skip_false = cpi -> base_skip_false_prob [ Q ] ;
if ( cm -> frame_type != KEY_FRAME ) {
if ( cpi -> common . refresh_alt_ref_frame ) {
if ( cpi -> last_skip_false_probs [ 2 ] != 0 ) cpi -> prob_skip_false = cpi -> last_skip_false_probs [ 2 ] ;
}
else if ( cpi -> common . refresh_golden_frame ) {
if ( cpi -> last_skip_false_probs [ 1 ] != 0 ) cpi -> prob_skip_false = cpi -> last_skip_false_probs [ 1 ] ;
}
else {
if ( cpi -> last_skip_false_probs [ 0 ] != 0 ) cpi -> prob_skip_false = cpi -> last_skip_false_probs [ 0 ] ;
}
if ( cpi -> prob_skip_false < 5 ) cpi -> prob_skip_false = 5 ;
if ( cpi -> prob_skip_false > 250 ) cpi -> prob_skip_false = 250 ;
if ( cpi -> oxcf . number_of_layers == 1 && cpi -> is_src_frame_alt_ref ) cpi -> prob_skip_false = 1 ;
}
# if 0 if ( cpi -> pass != 1 ) {
FILE * f = fopen ( "skip.stt" , "a" ) ;
fprintf ( f , "%d, %d, %4d " , cpi -> common . refresh_golden_frame , cpi -> common . refresh_alt_ref_frame , cpi -> prob_skip_false ) ;
fclose ( f ) ;
}
# endif }
if ( cm -> frame_type == KEY_FRAME ) {
if ( resize_key_frame ( cpi ) ) {
Q = vp8_regulate_q ( cpi , cpi -> this_frame_target ) ;
if ( cpi -> cyclic_refresh_mode_enabled ) {
if ( cpi -> current_layer == 0 ) cyclic_background_refresh ( cpi , Q , 0 ) ;
else disable_segmentation ( cpi ) ;
}
vpx_memset ( cpi -> consec_zero_last , 0 , cm -> mb_rows * cm -> mb_cols ) ;
vp8_set_quantizer ( cpi , Q ) ;
}
vp8_setup_key_frame ( cpi ) ;
}
# if CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING {
if ( cpi -> oxcf . error_resilient_mode ) cm -> refresh_entropy_probs = 0 ;
if ( cpi -> oxcf . error_resilient_mode & VPX_ERROR_RESILIENT_PARTITIONS ) {
if ( cm -> frame_type == KEY_FRAME ) cm -> refresh_entropy_probs = 1 ;
}
if ( cm -> refresh_entropy_probs == 0 ) {
vpx_memcpy ( & cm -> lfc , & cm -> fc , sizeof ( cm -> fc ) ) ;
}
vp8_update_coef_context ( cpi ) ;
vp8_update_coef_probs ( cpi ) ;
vp8_encode_frame ( cpi ) ;
}
# else vp8_encode_frame ( cpi ) ;
cpi -> projected_frame_size -= vp8_estimate_entropy_savings ( cpi ) ;
cpi -> projected_frame_size = ( cpi -> projected_frame_size > 0 ) ? cpi -> projected_frame_size : 0 ;
# endif vp8_clear_system_state ( ) ;
if ( cpi -> pass != 2 && cpi -> oxcf . auto_key && cm -> frame_type != KEY_FRAME && cpi -> compressor_speed != 2 ) {
# if ! ( CONFIG_REALTIME_ONLY ) if ( decide_key_frame ( cpi ) ) {
cm -> frame_type = KEY_FRAME ;
vp8_pick_frame_size ( cpi ) ;
cpi -> source_alt_ref_active = 0 ;
setup_features ( cpi ) ;
vp8_restore_coding_context ( cpi ) ;
Q = vp8_regulate_q ( cpi , cpi -> this_frame_target ) ;
vp8_compute_frame_size_bounds ( cpi , & frame_under_shoot_limit , & frame_over_shoot_limit ) ;
bottom_index = cpi -> active_best_quality ;
top_index = cpi -> active_worst_quality ;
q_low = cpi -> active_best_quality ;
q_high = cpi -> active_worst_quality ;
loop_count ++ ;
Loop = 1 ;
continue ;
}
# endif }
vp8_clear_system_state ( ) ;
if ( frame_over_shoot_limit == 0 ) frame_over_shoot_limit = 1 ;
if ( ( ( cpi -> pass != 2 ) || ( cpi -> oxcf . end_usage == USAGE_STREAM_FROM_SERVER ) ) && ( Q == cpi -> active_worst_quality ) && ( cpi -> active_worst_quality < cpi -> worst_quality ) && ( cpi -> projected_frame_size > frame_over_shoot_limit ) ) {
int over_size_percent = ( ( cpi -> projected_frame_size - frame_over_shoot_limit ) * 100 ) / frame_over_shoot_limit ;
while ( ( cpi -> active_worst_quality < cpi -> worst_quality ) && ( over_size_percent > 0 ) ) {
cpi -> active_worst_quality ++ ;
over_size_percent = ( int ) ( over_size_percent * 0.96 ) ;
}
# if ! ( CONFIG_REALTIME_ONLY ) top_index = cpi -> active_worst_quality ;
# endif active_worst_qchanged = 1 ;
}
else active_worst_qchanged = 0 ;
# if ! ( CONFIG_REALTIME_ONLY ) if ( ( cm -> frame_type == KEY_FRAME ) && cpi -> this_key_frame_forced ) {
int last_q = Q ;
int kf_err = vp8_calc_ss_err ( cpi -> Source , & cm -> yv12_fb [ cm -> new_fb_idx ] ) ;
if ( kf_err > ( ( cpi -> ambient_err * 7 ) >> 3 ) ) {
q_high = ( Q > q_low ) ? ( Q - 1 ) : q_low ;
Q = ( q_high + q_low ) >> 1 ;
}
else if ( kf_err < ( cpi -> ambient_err >> 1 ) ) {
q_low = ( Q < q_high ) ? ( Q + 1 ) : q_high ;
Q = ( q_high + q_low + 1 ) >> 1 ;
}
if ( Q > q_high ) Q = q_high ;
else if ( Q < q_low ) Q = q_low ;
Loop = Q != last_q ;
}
else if ( recode_loop_test ( cpi , frame_over_shoot_limit , frame_under_shoot_limit , Q , top_index , bottom_index ) ) {
int last_q = Q ;
int Retries = 0 ;
if ( cpi -> projected_frame_size > cpi -> this_frame_target ) {
q_low = ( Q < q_high ) ? ( Q + 1 ) : q_high ;
if ( cpi -> mb . zbin_over_quant > 0 ) zbin_oq_low = ( cpi -> mb . zbin_over_quant < zbin_oq_high ) ? ( cpi -> mb . zbin_over_quant + 1 ) : zbin_oq_high ;
if ( undershoot_seen ) {
if ( ! active_worst_qchanged ) vp8_update_rate_correction_factors ( cpi , 1 ) ;
Q = ( q_high + q_low + 1 ) / 2 ;
if ( Q < MAXQ ) cpi -> mb . zbin_over_quant = 0 ;
else {
zbin_oq_low = ( cpi -> mb . zbin_over_quant < zbin_oq_high ) ? ( cpi -> mb . zbin_over_quant + 1 ) : zbin_oq_high ;
cpi -> mb . zbin_over_quant = ( zbin_oq_high + zbin_oq_low ) / 2 ;
}
}
else {
if ( ! active_worst_qchanged ) vp8_update_rate_correction_factors ( cpi , 0 ) ;
Q = vp8_regulate_q ( cpi , cpi -> this_frame_target ) ;
while ( ( ( Q < q_low ) || ( cpi -> mb . zbin_over_quant < zbin_oq_low ) ) && ( Retries < 10 ) ) {
vp8_update_rate_correction_factors ( cpi , 0 ) ;
Q = vp8_regulate_q ( cpi , cpi -> this_frame_target ) ;
Retries ++ ;
}
}
overshoot_seen = 1 ;
}
else {
if ( cpi -> mb . zbin_over_quant == 0 ) q_high = ( Q > q_low ) ? ( Q - 1 ) : q_low ;
else zbin_oq_high = ( cpi -> mb . zbin_over_quant > zbin_oq_low ) ? ( cpi -> mb . zbin_over_quant - 1 ) : zbin_oq_low ;
if ( overshoot_seen ) {
if ( ! active_worst_qchanged ) vp8_update_rate_correction_factors ( cpi , 1 ) ;
Q = ( q_high + q_low ) / 2 ;
if ( Q < MAXQ ) cpi -> mb . zbin_over_quant = 0 ;
else cpi -> mb . zbin_over_quant = ( zbin_oq_high + zbin_oq_low ) / 2 ;
}
else {
if ( ! active_worst_qchanged ) vp8_update_rate_correction_factors ( cpi , 0 ) ;
Q = vp8_regulate_q ( cpi , cpi -> this_frame_target ) ;
if ( ( cpi -> oxcf . end_usage == USAGE_CONSTRAINED_QUALITY ) && ( Q < q_low ) ) {
q_low = Q ;
}
while ( ( ( Q > q_high ) || ( cpi -> mb . zbin_over_quant > zbin_oq_high ) ) && ( Retries < 10 ) ) {
vp8_update_rate_correction_factors ( cpi , 0 ) ;
Q = vp8_regulate_q ( cpi , cpi -> this_frame_target ) ;
Retries ++ ;
}
}
undershoot_seen = 1 ;
}
if ( Q > q_high ) Q = q_high ;
else if ( Q < q_low ) Q = q_low ;
cpi -> mb . zbin_over_quant = ( cpi -> mb . zbin_over_quant < zbin_oq_low ) ? zbin_oq_low : ( cpi -> mb . zbin_over_quant > zbin_oq_high ) ? zbin_oq_high : cpi -> mb . zbin_over_quant ;
Loop = Q != last_q ;
}
else # endif Loop = 0 ;
if ( cpi -> is_src_frame_alt_ref ) Loop = 0 ;
if ( Loop == 1 ) {
vp8_restore_coding_context ( cpi ) ;
loop_count ++ ;
# if CONFIG_INTERNAL_STATS cpi -> tot_recode_hits ++ ;
# endif }
}
while ( Loop == 1 ) ;
# if 0 {
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_coded_error = ( double ) cpi -> prediction_error ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_intra_error = ( double ) cpi -> intra_error ;
cpi -> one_pass_frame_stats [ cpi -> one_pass_frame_index ] . frame_pcnt_inter = ( double ) ( 100 - cpi -> this_frame_percent_intra ) / 100.0 ;
}
# endif if ( cpi -> next_key_frame_forced && ( cpi -> twopass . frames_to_key == 0 ) ) {
cpi -> ambient_err = vp8_calc_ss_err ( cpi -> Source , & cm -> yv12_fb [ cm -> new_fb_idx ] ) ;
}
# if CONFIG_MULTI_RES_ENCODING if ( ! cpi -> oxcf . mr_encoder_id && cm -> show_frame ) # else if ( cm -> show_frame ) # endif {
int mb_row ;
int mb_col ;
MODE_INFO * tmp = cm -> mip ;
if ( cm -> frame_type != KEY_FRAME ) {
for ( mb_row = 0 ;
mb_row < cm -> mb_rows + 1 ;
mb_row ++ ) {
for ( mb_col = 0 ;
mb_col < cm -> mb_cols + 1 ;
mb_col ++ ) {
if ( tmp -> mbmi . ref_frame != INTRA_FRAME ) cpi -> lfmv [ mb_col + mb_row * ( cm -> mode_info_stride + 1 ) ] . as_int = tmp -> mbmi . mv . as_int ;
cpi -> lf_ref_frame_sign_bias [ mb_col + mb_row * ( cm -> mode_info_stride + 1 ) ] = cm -> ref_frame_sign_bias [ tmp -> mbmi . ref_frame ] ;
cpi -> lf_ref_frame [ mb_col + mb_row * ( cm -> mode_info_stride + 1 ) ] = tmp -> mbmi . ref_frame ;
tmp ++ ;
}
}
}
}
{
int mb_row ;
int mb_col ;
MODE_INFO * tmp = cm -> mi ;
cpi -> zeromv_count = 0 ;
if ( cm -> frame_type != KEY_FRAME ) {
for ( mb_row = 0 ;
mb_row < cm -> mb_rows ;
mb_row ++ ) {
for ( mb_col = 0 ;
mb_col < cm -> mb_cols ;
mb_col ++ ) {
if ( tmp -> mbmi . mode == ZEROMV && tmp -> mbmi . ref_frame == LAST_FRAME ) cpi -> zeromv_count ++ ;
tmp ++ ;
}
tmp ++ ;
}
}
}
# if CONFIG_MULTI_RES_ENCODING vp8_cal_dissimilarity ( cpi ) ;
# endif if ( cpi -> oxcf . number_of_layers == 1 ) vp8_update_gf_useage_maps ( cpi , cm , & cpi -> mb ) ;
if ( cm -> frame_type == KEY_FRAME ) cm -> refresh_last_frame = 1 ;
# if 0 {
FILE * f = fopen ( "gfactive.stt" , "a" ) ;
fprintf ( f , "%8d %8d %8d %8d %8d\n" , cm -> current_video_frame , ( 100 * cpi -> gf_active_count ) / ( cpi -> common . mb_rows * cpi -> common . mb_cols ) , cpi -> this_iiratio , cpi -> next_iiratio , cm -> refresh_golden_frame ) ;
fclose ( f ) ;
}
# endif if ( ! cpi -> oxcf . error_resilient_mode && cm -> refresh_golden_frame ) cm -> copy_buffer_to_arf = 2 ;
else cm -> copy_buffer_to_arf = 0 ;
cm -> frame_to_show = & cm -> yv12_fb [ cm -> new_fb_idx ] ;
# if CONFIG_TEMPORAL_DENOISING if ( cpi -> oxcf . noise_sensitivity == 4 && cpi -> frames_since_key % 8 == 0 && cm -> frame_type != KEY_FRAME ) {
process_denoiser_mode_change ( cpi ) ;
}
# endif # if CONFIG_MULTITHREAD if ( cpi -> b_multi_threaded ) {
sem_post ( & cpi -> h_event_start_lpf ) ;
cpi -> b_lpf_running = 1 ;
}
else # endif {
vp8_loopfilter_frame ( cpi , cm ) ;
}
update_reference_frames ( cpi ) ;
# ifdef OUTPUT_YUV_DENOISED vp8_write_yuv_frame ( yuv_denoised_file , & cpi -> denoiser . yv12_running_avg [ INTRA_FRAME ] ) ;
# endif # if ! ( CONFIG_REALTIME_ONLY & CONFIG_ONTHEFLY_BITPACKING ) if ( cpi -> oxcf . error_resilient_mode ) {
cm -> refresh_entropy_probs = 0 ;
}
# endif # if CONFIG_MULTITHREAD if ( cpi -> b_multi_threaded ) sem_wait ( & cpi -> h_event_end_lpf ) ;
# endif vp8_pack_bitstream ( cpi , dest , dest_end , size ) ;
# if CONFIG_MULTITHREAD if ( cpi -> b_lpf_running && cpi -> b_calculate_psnr ) {
sem_wait ( & cpi -> h_event_end_lpf ) ;
cpi -> b_lpf_running = 0 ;
}
# endif cm -> last_frame_type = cm -> frame_type ;
cpi -> total_byte_count += ( * size ) ;
cpi -> projected_frame_size = ( * size ) << 3 ;
if ( cpi -> oxcf . number_of_layers > 1 ) {
unsigned int i ;
for ( i = cpi -> current_layer + 1 ;
i < cpi -> oxcf . number_of_layers ;
i ++ ) cpi -> layer_context [ i ] . total_byte_count += ( * size ) ;
}
if ( ! active_worst_qchanged ) vp8_update_rate_correction_factors ( cpi , 2 ) ;
cpi -> last_q [ cm -> frame_type ] = cm -> base_qindex ;
if ( cm -> frame_type == KEY_FRAME ) {
vp8_adjust_key_frame_context ( cpi ) ;
}
if ( cm -> frame_type != KEY_FRAME ) cpi -> avg_frame_qindex = ( 2 + 3 * cpi -> avg_frame_qindex + cm -> base_qindex ) >> 2 ;
if ( ( cm -> frame_type != KEY_FRAME ) && ( ( cpi -> oxcf . number_of_layers > 1 ) || ( ! cm -> refresh_golden_frame && ! cm -> refresh_alt_ref_frame ) ) ) {
cpi -> ni_frames ++ ;
if ( cpi -> pass == 2 ) {
cpi -> ni_tot_qi += Q ;
cpi -> ni_av_qi = ( cpi -> ni_tot_qi / cpi -> ni_frames ) ;
}
else {
if ( cpi -> ni_frames > 150 ) {
cpi -> ni_tot_qi += Q ;
cpi -> ni_av_qi = ( cpi -> ni_tot_qi / cpi -> ni_frames ) ;
}
else {
cpi -> ni_tot_qi += Q ;
cpi -> ni_av_qi = ( ( cpi -> ni_tot_qi / cpi -> ni_frames ) + cpi -> worst_quality + 1 ) / 2 ;
}
if ( Q > cpi -> ni_av_qi ) cpi -> ni_av_qi = Q - 1 ;
}
}
if ( ! cm -> show_frame ) cpi -> bits_off_target -= cpi -> projected_frame_size ;
else cpi -> bits_off_target += cpi -> av_per_frame_bandwidth - cpi -> projected_frame_size ;
if ( cpi -> bits_off_target > cpi -> oxcf . maximum_buffer_size ) cpi -> bits_off_target = cpi -> oxcf . maximum_buffer_size ;
cpi -> rolling_target_bits = ( ( cpi -> rolling_target_bits * 3 ) + cpi -> this_frame_target + 2 ) / 4 ;
cpi -> rolling_actual_bits = ( ( cpi -> rolling_actual_bits * 3 ) + cpi -> projected_frame_size + 2 ) / 4 ;
cpi -> long_rolling_target_bits = ( ( cpi -> long_rolling_target_bits * 31 ) + cpi -> this_frame_target + 16 ) / 32 ;
cpi -> long_rolling_actual_bits = ( ( cpi -> long_rolling_actual_bits * 31 ) + cpi -> projected_frame_size + 16 ) / 32 ;
cpi -> total_actual_bits += cpi -> projected_frame_size ;
cpi -> total_target_vs_actual += ( cpi -> this_frame_target - cpi -> projected_frame_size ) ;
cpi -> buffer_level = cpi -> bits_off_target ;
if ( cpi -> oxcf . number_of_layers > 1 ) {
unsigned int i ;
for ( i = cpi -> current_layer + 1 ;
i < cpi -> oxcf . number_of_layers ;
i ++ ) {
LAYER_CONTEXT * lc = & cpi -> layer_context [ i ] ;
int bits_off_for_this_layer = ( int ) ( lc -> target_bandwidth / lc -> framerate - cpi -> projected_frame_size ) ;
lc -> bits_off_target += bits_off_for_this_layer ;
if ( lc -> bits_off_target > lc -> maximum_buffer_size ) lc -> bits_off_target = lc -> maximum_buffer_size ;
lc -> total_actual_bits += cpi -> projected_frame_size ;
lc -> total_target_vs_actual += bits_off_for_this_layer ;
lc -> buffer_level = lc -> bits_off_target ;
}
}
if ( cm -> frame_type == KEY_FRAME ) {
cpi -> twopass . kf_group_bits += cpi -> this_frame_target - cpi -> projected_frame_size ;
if ( cpi -> twopass . kf_group_bits < 0 ) cpi -> twopass . kf_group_bits = 0 ;
}
else if ( cm -> refresh_golden_frame || cm -> refresh_alt_ref_frame ) {
cpi -> twopass . gf_group_bits += cpi -> this_frame_target - cpi -> projected_frame_size ;
if ( cpi -> twopass . gf_group_bits < 0 ) cpi -> twopass . gf_group_bits = 0 ;
}
if ( cm -> frame_type != KEY_FRAME ) {
if ( cpi -> common . refresh_alt_ref_frame ) {
cpi -> last_skip_false_probs [ 2 ] = cpi -> prob_skip_false ;
cpi -> last_skip_probs_q [ 2 ] = cm -> base_qindex ;
}
else if ( cpi -> common . refresh_golden_frame ) {
cpi -> last_skip_false_probs [ 1 ] = cpi -> prob_skip_false ;
cpi -> last_skip_probs_q [ 1 ] = cm -> base_qindex ;
}
else {
cpi -> last_skip_false_probs [ 0 ] = cpi -> prob_skip_false ;
cpi -> last_skip_probs_q [ 0 ] = cm -> base_qindex ;
cpi -> base_skip_false_prob [ cm -> base_qindex ] = cpi -> prob_skip_false ;
}
}
# if 0 && CONFIG_INTERNAL_STATS {
FILE * f = fopen ( "tmp.stt" , "a" ) ;
vp8_clear_system_state ( ) ;
if ( cpi -> twopass . total_left_stats . coded_error != 0.0 ) fprintf ( f , "%10d %10d %10d %10d %10d %10" PRId64 " %10" PRId64 "%10" PRId64 " %10d %6d %6d %6d %6d %5d %5d %5d %8d " "%8.2lf %" PRId64 " %10.3lf %10" PRId64 " %8d\n" , cpi -> common . current_video_frame , cpi -> this_frame_target , cpi -> projected_frame_size , ( cpi -> projected_frame_size - cpi -> this_frame_target ) , cpi -> total_target_vs_actual , cpi -> buffer_level , ( cpi -> oxcf . starting_buffer_level - cpi -> bits_off_target ) , cpi -> total_actual_bits , cm -> base_qindex , cpi -> active_best_quality , cpi -> active_worst_quality , cpi -> ni_av_qi , cpi -> cq_target_quality , cm -> refresh_golden_frame , cm -> refresh_alt_ref_frame , cm -> frame_type , cpi -> gfu_boost , cpi -> twopass . est_max_qcorrection_factor , cpi -> twopass . bits_left , cpi -> twopass . total_left_stats . coded_error , ( double ) cpi -> twopass . bits_left / cpi -> twopass . total_left_stats . coded_error , cpi -> tot_recode_hits ) ;
else fprintf ( f , "%10d %10d %10d %10d %10d %10" PRId64 " %10" PRId64 "%10" PRId64 " %10d %6d %6d %6d %6d %5d %5d %5d %8d " "%8.2lf %" PRId64 " %10.3lf %8d\n" , cpi -> common . current_video_frame , cpi -> this_frame_target , cpi -> projected_frame_size , ( cpi -> projected_frame_size - cpi -> this_frame_target ) , cpi -> total_target_vs_actual , cpi -> buffer_level , ( cpi -> oxcf . starting_buffer_level - cpi -> bits_off_target ) , cpi -> total_actual_bits , cm -> base_qindex , cpi -> active_best_quality , cpi -> active_worst_quality , cpi -> ni_av_qi , cpi -> cq_target_quality , cm -> refresh_golden_frame , cm -> refresh_alt_ref_frame , cm -> frame_type , cpi -> gfu_boost , cpi -> twopass . est_max_qcorrection_factor , cpi -> twopass . bits_left , cpi -> twopass . total_left_stats . coded_error , cpi -> tot_recode_hits ) ;
fclose ( f ) ;
{
FILE * fmodes = fopen ( "Modes.stt" , "a" ) ;
fprintf ( fmodes , "%6d:%1d:%1d:%1d " , cpi -> common . current_video_frame , cm -> frame_type , cm -> refresh_golden_frame , cm -> refresh_alt_ref_frame ) ;
fprintf ( fmodes , "\n" ) ;
fclose ( fmodes ) ;
}
}
# endif if ( cm -> refresh_golden_frame == 1 ) cm -> frame_flags = cm -> frame_flags | FRAMEFLAGS_GOLDEN ;
else cm -> frame_flags = cm -> frame_flags & ~ FRAMEFLAGS_GOLDEN ;
if ( cm -> refresh_alt_ref_frame == 1 ) cm -> frame_flags = cm -> frame_flags | FRAMEFLAGS_ALTREF ;
else cm -> frame_flags = cm -> frame_flags & ~ FRAMEFLAGS_ALTREF ;
if ( cm -> refresh_last_frame & cm -> refresh_golden_frame ) cpi -> gold_is_last = 1 ;
else if ( cm -> refresh_last_frame ^ cm -> refresh_golden_frame ) cpi -> gold_is_last = 0 ;
if ( cm -> refresh_last_frame & cm -> refresh_alt_ref_frame ) cpi -> alt_is_last = 1 ;
else if ( cm -> refresh_last_frame ^ cm -> refresh_alt_ref_frame ) cpi -> alt_is_last = 0 ;
if ( cm -> refresh_alt_ref_frame & cm -> refresh_golden_frame ) cpi -> gold_is_alt = 1 ;
else if ( cm -> refresh_alt_ref_frame ^ cm -> refresh_golden_frame ) cpi -> gold_is_alt = 0 ;
cpi -> ref_frame_flags = VP8_ALTR_FRAME | VP8_GOLD_FRAME | VP8_LAST_FRAME ;
if ( cpi -> gold_is_last ) cpi -> ref_frame_flags &= ~ VP8_GOLD_FRAME ;
if ( cpi -> alt_is_last ) cpi -> ref_frame_flags &= ~ VP8_ALTR_FRAME ;
if ( cpi -> gold_is_alt ) cpi -> ref_frame_flags &= ~ VP8_ALTR_FRAME ;
if ( ! cpi -> oxcf . error_resilient_mode ) {
if ( cpi -> oxcf . play_alternate && cm -> refresh_alt_ref_frame && ( cm -> frame_type != KEY_FRAME ) ) update_alt_ref_frame_stats ( cpi ) ;
else update_golden_frame_stats ( cpi ) ;
}
if ( cm -> frame_type == KEY_FRAME ) {
* frame_flags = cm -> frame_flags | FRAMEFLAGS_KEY ;
cm -> frame_type = INTER_FRAME ;
cpi -> last_frame_percent_intra = 100 ;
}
else {
* frame_flags = cm -> frame_flags & ~ FRAMEFLAGS_KEY ;
cpi -> last_frame_percent_intra = cpi -> this_frame_percent_intra ;
}
cpi -> mb . e_mbd . update_mb_segmentation_map = 0 ;
cpi -> mb . e_mbd . update_mb_segmentation_data = 0 ;
cpi -> mb . e_mbd . mode_ref_lf_delta_update = 0 ;
if ( cm -> show_frame ) {
cm -> current_video_frame ++ ;
cpi -> frames_since_key ++ ;
cpi -> temporal_pattern_counter ++ ;
}
# if 0 {
char filename [ 512 ] ;
FILE * recon_file ;
sprintf ( filename , "enc%04d.yuv" , ( int ) cm -> current_video_frame ) ;
recon_file = fopen ( filename , "wb" ) ;
fwrite ( cm -> yv12_fb [ cm -> lst_fb_idx ] . buffer_alloc , cm -> yv12_fb [ cm -> lst_fb_idx ] . frame_size , 1 , recon_file ) ;
fclose ( recon_file ) ;
}
# endif } | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void use_normal_update_speed ( WmallDecodeCtx * s , int ich ) {
int ilms , recent , icoef ;
for ( ilms = s -> cdlms_ttl [ ich ] - 1 ;
ilms >= 0 ;
ilms -- ) {
recent = s -> cdlms [ ich ] [ ilms ] . recent ;
if ( s -> update_speed [ ich ] == 8 ) continue ;
if ( s -> bV3RTM ) for ( icoef = 0 ;
icoef < s -> cdlms [ ich ] [ ilms ] . order ;
icoef ++ ) s -> cdlms [ ich ] [ ilms ] . lms_updates [ icoef + recent ] /= 2 ;
else for ( icoef = 0 ;
icoef < s -> cdlms [ ich ] [ ilms ] . order ;
icoef ++ ) s -> cdlms [ ich ] [ ilms ] . lms_updates [ icoef ] /= 2 ;
}
s -> update_speed [ ich ] = 8 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int selinux_msg_msg_alloc_security ( struct msg_msg * msg ) {
return msg_msg_alloc_security ( msg ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static UConverter * U_CALLCONV _SCSUSafeClone ( const UConverter * cnv , void * stackBuffer , int32_t * pBufferSize , UErrorCode * status ) {
struct cloneSCSUStruct * localClone ;
int32_t bufferSizeNeeded = sizeof ( struct cloneSCSUStruct ) ;
if ( U_FAILURE ( * status ) ) {
return 0 ;
}
if ( * pBufferSize == 0 ) {
* pBufferSize = bufferSizeNeeded ;
return 0 ;
}
localClone = ( struct cloneSCSUStruct * ) stackBuffer ;
uprv_memcpy ( & localClone -> mydata , cnv -> extraInfo , sizeof ( SCSUData ) ) ;
localClone -> cnv . extraInfo = & localClone -> mydata ;
localClone -> cnv . isExtraLocal = TRUE ;
return & localClone -> cnv ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void hb_face_set_index ( hb_face_t * face , unsigned int index ) {
if ( face -> immutable ) return ;
face -> index = index ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_T_messageContent_item ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 646 "../../asn1/h245/h245.cnf" gef_ctx_t * parent_gefx ;
parent_gefx = gef_ctx_get ( actx -> private_data ) ;
actx -> private_data = gef_ctx_alloc ( parent_gefx , NULL ) ;
offset = dissect_h245_GenericParameter ( tvb , offset , actx , tree , hf_index ) ;
# line 651 "../../asn1/h245/h245.cnf" actx -> private_data = parent_gefx ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int opt_show_ ## section ( const char * opt , const char * arg ) {
mark_section_show_entries ( SECTION_ID_ ## target_section_id , 1 , NULL ) ;
return 0 ;
}
DEFINE_OPT_SHOW_SECTION ( chapters , CHAPTERS ) DEFINE_OPT_SHOW_SECTION ( error , ERROR ) DEFINE_OPT_SHOW_SECTION ( format , FORMAT ) DEFINE_OPT_SHOW_SECTION ( frames , FRAMES ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint64_t malta_fpga_read ( void * opaque , hwaddr addr , unsigned size ) {
MaltaFPGAState * s = opaque ;
uint32_t val = 0 ;
uint32_t saddr ;
saddr = ( addr & 0xfffff ) ;
switch ( saddr ) {
case 0x00200 : val = 0x00000000 ;
break ;
case 0x00208 : # ifdef TARGET_WORDS_BIGENDIAN val = 0x00000012 ;
# else val = 0x00000010 ;
# endif break ;
case 0x00210 : val = 0x00 ;
break ;
case 0x00408 : val = s -> leds ;
break ;
case 0x00508 : val = s -> brk ;
break ;
case 0x00a00 : val = s -> gpout ;
break ;
case 0x00a08 : if ( s -> i2csel ) val = s -> i2cout ;
else val = 0x00 ;
break ;
case 0x00b00 : val = ( ( s -> i2cin & ~ 1 ) | eeprom24c0x_read ( ) ) ;
break ;
case 0x00b08 : val = s -> i2coe ;
break ;
case 0x00b10 : val = s -> i2cout ;
break ;
case 0x00b18 : val = s -> i2csel ;
break ;
default : # if 0 printf ( "malta_fpga_read: Bad register offset 0x" TARGET_FMT_lx "\n" , addr ) ;
# endif break ;
}
return val ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | METHOD ( certificate_t , issued_by , bool , private_x509_cert_t * this , certificate_t * issuer , signature_scheme_t * schemep ) {
public_key_t * key ;
signature_scheme_t scheme ;
bool valid ;
x509_t * x509 = ( x509_t * ) issuer ;
if ( & this -> public . interface . interface == issuer ) {
if ( this -> flags & X509_SELF_SIGNED ) {
return TRUE ;
}
}
else {
if ( issuer -> get_type ( issuer ) != CERT_X509 ) {
return FALSE ;
}
if ( ! ( x509 -> get_flags ( x509 ) & X509_CA ) ) {
return FALSE ;
}
}
if ( ! this -> issuer -> equals ( this -> issuer , issuer -> get_subject ( issuer ) ) ) {
return FALSE ;
}
scheme = signature_scheme_from_oid ( this -> algorithm ) ;
if ( scheme == SIGN_UNKNOWN ) {
return FALSE ;
}
key = issuer -> get_public_key ( issuer ) ;
if ( ! key ) {
return FALSE ;
}
valid = key -> verify ( key , scheme , this -> tbsCertificate , this -> signature ) ;
key -> destroy ( key ) ;
if ( valid && schemep ) {
* schemep = scheme ;
}
return valid ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int test_gf2m_mod_mul ( BIO * bp , BN_CTX * ctx ) {
BIGNUM * a , * b [ 2 ] , * c , * d , * e , * f , * g , * h ;
int i , j , ret = 0 ;
int p0 [ ] = {
163 , 7 , 6 , 3 , 0 , - 1 }
;
int p1 [ ] = {
193 , 15 , 0 , - 1 }
;
a = BN_new ( ) ;
b [ 0 ] = BN_new ( ) ;
b [ 1 ] = BN_new ( ) ;
c = BN_new ( ) ;
d = BN_new ( ) ;
e = BN_new ( ) ;
f = BN_new ( ) ;
g = BN_new ( ) ;
h = BN_new ( ) ;
BN_GF2m_arr2poly ( p0 , b [ 0 ] ) ;
BN_GF2m_arr2poly ( p1 , b [ 1 ] ) ;
for ( i = 0 ;
i < num0 ;
i ++ ) {
BN_bntest_rand ( a , 1024 , 0 , 0 ) ;
BN_bntest_rand ( c , 1024 , 0 , 0 ) ;
BN_bntest_rand ( d , 1024 , 0 , 0 ) ;
for ( j = 0 ;
j < 2 ;
j ++ ) {
BN_GF2m_mod_mul ( e , a , c , b [ j ] , ctx ) ;
# if 0 if ( bp != NULL ) {
if ( ! results ) {
BN_print ( bp , a ) ;
BIO_puts ( bp , " * " ) ;
BN_print ( bp , c ) ;
BIO_puts ( bp , " % " ) ;
BN_print ( bp , b [ j ] ) ;
BIO_puts ( bp , " - " ) ;
BN_print ( bp , e ) ;
BIO_puts ( bp , "\n" ) ;
}
}
# endif BN_GF2m_add ( f , a , d ) ;
BN_GF2m_mod_mul ( g , f , c , b [ j ] , ctx ) ;
BN_GF2m_mod_mul ( h , d , c , b [ j ] , ctx ) ;
BN_GF2m_add ( f , e , g ) ;
BN_GF2m_add ( f , f , h ) ;
if ( ! BN_is_zero ( f ) ) {
fprintf ( stderr , "GF(2^m) modular multiplication test failed!\n" ) ;
goto err ;
}
}
}
ret = 1 ;
err : BN_free ( a ) ;
BN_free ( b [ 0 ] ) ;
BN_free ( b [ 1 ] ) ;
BN_free ( c ) ;
BN_free ( d ) ;
BN_free ( e ) ;
BN_free ( f ) ;
BN_free ( g ) ;
BN_free ( h ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( PrintPreviewUIUnitTest , PrintPreviewData ) {
WebContents * initiator = browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ;
ASSERT_TRUE ( initiator ) ;
EXPECT_FALSE ( IsShowingWebContentsModalDialog ( initiator ) ) ;
printing : : PrintPreviewDialogController * controller = printing : : PrintPreviewDialogController : : GetInstance ( ) ;
ASSERT_TRUE ( controller ) ;
printing : : PrintViewManager * print_view_manager = printing : : PrintViewManager : : FromWebContents ( initiator ) ;
print_view_manager -> PrintPreviewNow ( initiator -> GetMainFrame ( ) , false ) ;
WebContents * preview_dialog = controller -> GetOrCreatePreviewDialog ( initiator ) ;
EXPECT_NE ( initiator , preview_dialog ) ;
EXPECT_EQ ( 1 , browser ( ) -> tab_strip_model ( ) -> count ( ) ) ;
EXPECT_TRUE ( IsShowingWebContentsModalDialog ( initiator ) ) ;
PrintPreviewUI * preview_ui = static_cast < PrintPreviewUI * > ( preview_dialog -> GetWebUI ( ) -> GetController ( ) ) ;
ASSERT_TRUE ( preview_ui != NULL ) ;
scoped_refptr < base : : RefCountedBytes > data ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : COMPLETE_PREVIEW_DOCUMENT_INDEX , & data ) ;
EXPECT_EQ ( NULL , data . get ( ) ) ;
scoped_refptr < base : : RefCountedBytes > dummy_data = CreateTestData ( ) ;
preview_ui -> SetPrintPreviewDataForIndex ( printing : : COMPLETE_PREVIEW_DOCUMENT_INDEX , dummy_data . get ( ) ) ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : COMPLETE_PREVIEW_DOCUMENT_INDEX , & data ) ;
EXPECT_EQ ( dummy_data -> size ( ) , data -> size ( ) ) ;
EXPECT_EQ ( dummy_data . get ( ) , data . get ( ) ) ;
dummy_data = new base : : RefCountedBytes ( ) ;
preview_ui -> SetPrintPreviewDataForIndex ( printing : : FIRST_PAGE_INDEX , dummy_data . get ( ) ) ;
preview_ui -> ClearAllPreviewData ( ) ;
preview_ui -> GetPrintPreviewDataForIndex ( printing : : COMPLETE_PREVIEW_DOCUMENT_INDEX , & data ) ;
EXPECT_EQ ( NULL , data . get ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline int ohci_read_hcca ( OHCIState * ohci , dma_addr_t addr , struct ohci_hcca * hcca ) {
return dma_memory_read ( ohci -> as , addr + ohci -> localmem_base , hcca , sizeof ( * hcca ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void strip_header ( char * header_bag , char * lc_header_bag , const char * lc_header_name ) {
char * lc_header_start = strstr ( lc_header_bag , lc_header_name ) ;
char * header_start = header_bag + ( lc_header_start - lc_header_bag ) ;
if ( lc_header_start && ( lc_header_start == lc_header_bag || * ( lc_header_start - 1 ) == '\n' ) ) {
char * lc_eol = strchr ( lc_header_start , '\n' ) ;
char * eol = header_start + ( lc_eol - lc_header_start ) ;
if ( lc_eol ) {
size_t eollen = strlen ( lc_eol ) ;
memmove ( lc_header_start , lc_eol + 1 , eollen ) ;
memmove ( header_start , eol + 1 , eollen ) ;
}
else {
* lc_header_start = '\0' ;
* header_start = '\0' ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static u16 default_transaction_id_fn ( void ) {
u16 trans_id ;
# ifdef DNS_USE_CPU_CLOCK_FOR_ID struct timespec ts ;
static int clkid = - 1 ;
if ( clkid == - 1 ) {
clkid = CLOCK_REALTIME ;
# ifdef CLOCK_MONOTONIC if ( clock_gettime ( CLOCK_MONOTONIC , & ts ) != - 1 ) clkid = CLOCK_MONOTONIC ;
# endif }
if ( clock_gettime ( clkid , & ts ) == - 1 ) event_err ( 1 , "clock_gettime" ) ;
trans_id = ts . tv_nsec & 0xffff ;
# endif # ifdef DNS_USE_FTIME_FOR_ID struct _timeb tb ;
_ftime ( & tb ) ;
trans_id = tb . millitm & 0xffff ;
# endif # ifdef DNS_USE_GETTIMEOFDAY_FOR_ID struct timeval tv ;
evutil_gettimeofday ( & tv , NULL ) ;
trans_id = tv . tv_usec & 0xffff ;
# endif # ifdef DNS_USE_OPENSSL_FOR_ID if ( RAND_pseudo_bytes ( ( u8 * ) & trans_id , 2 ) == - 1 ) {
abort ( ) ;
}
# endif return trans_id ;
} | 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.