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 void cirrus_bitblt_reset ( CirrusVGAState * s ) {
int need_update ;
s -> vga . gr [ 0x31 ] &= ~ ( CIRRUS_BLT_START | CIRRUS_BLT_BUSY | CIRRUS_BLT_FIFOUSED ) ;
need_update = s -> cirrus_srcptr != & s -> cirrus_bltbuf [ 0 ] || s -> cirrus_srcptr_end != & s -> cirrus_bltbuf [ 0 ] ;
s -> cirrus_srcptr = & s -> cirrus_bltbuf [ 0 ] ;
s -> cirrus_srcptr_end = & s -> cirrus_bltbuf [ 0 ] ;
s -> cirrus_srccounter = 0 ;
if ( ! need_update ) return ;
cirrus_update_memory_access ( s ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSReturnCode TSHttpTxnConfigFloatSet ( TSHttpTxn txnp , TSOverridableConfigKey conf , TSMgmtFloat value ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * s = reinterpret_cast < HttpSM * > ( txnp ) ;
OverridableDataType type ;
s -> t_state . setup_per_txn_configs ( ) ;
TSMgmtFloat * dest = static_cast < TSMgmtFloat * > ( _conf_to_memberp ( conf , s -> t_state . txn_conf , & type ) ) ;
if ( type != OVERRIDABLE_TYPE_FLOAT ) {
return TS_ERROR ;
}
if ( dest ) {
* dest = value ;
return TS_SUCCESS ;
}
return TS_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void security_init ( void ) {
uintptr_t stack_chk_guard = _dl_setup_stack_chk_guard ( _dl_random ) ;
# ifdef THREAD_SET_STACK_GUARD THREAD_SET_STACK_GUARD ( stack_chk_guard ) ;
# else __stack_chk_guard = stack_chk_guard ;
# endif if ( GLRO ( dl_pointer_guard ) ) {
uintptr_t pointer_chk_guard = _dl_setup_pointer_guard ( _dl_random , stack_chk_guard ) ;
# ifdef THREAD_SET_POINTER_GUARD THREAD_SET_POINTER_GUARD ( pointer_chk_guard ) ;
# endif __pointer_chk_guard_local = pointer_chk_guard ;
}
_dl_random = NULL ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | List * get_op_btree_interpretation ( Oid opno ) {
List * result = NIL ;
OpBtreeInterpretation * thisresult ;
CatCList * catlist ;
int i ;
catlist = SearchSysCacheList1 ( AMOPOPID , ObjectIdGetDatum ( opno ) ) ;
for ( i = 0 ;
i < catlist -> n_members ;
i ++ ) {
HeapTuple op_tuple = & catlist -> members [ i ] -> tuple ;
Form_pg_amop op_form = ( Form_pg_amop ) GETSTRUCT ( op_tuple ) ;
StrategyNumber op_strategy ;
if ( op_form -> amopmethod != BTREE_AM_OID ) continue ;
op_strategy = ( StrategyNumber ) op_form -> amopstrategy ;
Assert ( op_strategy >= 1 && op_strategy <= 5 ) ;
thisresult = ( OpBtreeInterpretation * ) palloc ( sizeof ( OpBtreeInterpretation ) ) ;
thisresult -> opfamily_id = op_form -> amopfamily ;
thisresult -> strategy = op_strategy ;
thisresult -> oplefttype = op_form -> amoplefttype ;
thisresult -> oprighttype = op_form -> amoprighttype ;
result = lappend ( result , thisresult ) ;
}
ReleaseSysCacheList ( catlist ) ;
if ( result == NIL ) {
Oid op_negator = get_negator ( opno ) ;
if ( OidIsValid ( op_negator ) ) {
catlist = SearchSysCacheList1 ( AMOPOPID , ObjectIdGetDatum ( op_negator ) ) ;
for ( i = 0 ;
i < catlist -> n_members ;
i ++ ) {
HeapTuple op_tuple = & catlist -> members [ i ] -> tuple ;
Form_pg_amop op_form = ( Form_pg_amop ) GETSTRUCT ( op_tuple ) ;
StrategyNumber op_strategy ;
if ( op_form -> amopmethod != BTREE_AM_OID ) continue ;
op_strategy = ( StrategyNumber ) op_form -> amopstrategy ;
Assert ( op_strategy >= 1 && op_strategy <= 5 ) ;
if ( op_strategy != BTEqualStrategyNumber ) continue ;
thisresult = ( OpBtreeInterpretation * ) palloc ( sizeof ( OpBtreeInterpretation ) ) ;
thisresult -> opfamily_id = op_form -> amopfamily ;
thisresult -> strategy = ROWCOMPARE_NE ;
thisresult -> oplefttype = op_form -> amoplefttype ;
thisresult -> oprighttype = op_form -> amoprighttype ;
result = lappend ( result , thisresult ) ;
}
ReleaseSysCacheList ( catlist ) ;
}
}
return result ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void * _TIFFmalloc ( tmsize_t s ) {
if ( s == 0 ) return ( ( void * ) NULL ) ;
return ( malloc ( ( size_t ) s ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static diam_avp_t * build_appid_avp ( const avp_type_t * type , guint32 code , diam_vnd_t * vendor , const char * name , const value_string * vs _U_ , void * data _U_ ) {
diam_avp_t * a ;
field_display_e base ;
a = ( diam_avp_t * ) wmem_alloc0 ( wmem_epan_scope ( ) , sizeof ( diam_avp_t ) ) ;
a -> code = code ;
a -> vendor = vendor ;
a -> dissector_v16 = type -> v16 ;
a -> dissector_rfc = type -> rfc ;
a -> ett = - 1 ;
a -> hf_value = - 1 ;
if ( vs != NULL ) {
report_failure ( "Diameter Dictionary: AVP '%s' (of type AppId) has a list of values but the list won't be used\n" , name ) ;
}
base = ( field_display_e ) ( type -> base | BASE_EXT_STRING ) ;
basic_avp_reginfo ( a , name , type -> ft , base , dictionary . applications ) ;
return a ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static const char * fix_for_comment ( const char * ident ) {
static char buf [ 1024 ] ;
char c , * s = buf ;
while ( ( c = * s ++ = * ident ++ ) ) {
if ( s >= buf + sizeof ( buf ) - 10 ) {
strmov ( s , "..." ) ;
break ;
}
if ( c == '\n' ) s = strmov ( s , "-- " ) ;
}
return buf ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | Oid getTypeIOParam ( HeapTuple typeTuple ) {
Form_pg_type typeStruct = ( Form_pg_type ) GETSTRUCT ( typeTuple ) ;
if ( OidIsValid ( typeStruct -> typelem ) ) return typeStruct -> typelem ;
else return HeapTupleGetOid ( typeTuple ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void U_CALLCONV _UTF7Reset ( UConverter * cnv , UConverterResetChoice choice ) {
if ( choice <= UCNV_RESET_TO_UNICODE ) {
cnv -> toUnicodeStatus = 0x1000000 ;
cnv -> toULength = 0 ;
}
if ( choice != UCNV_RESET_TO_UNICODE ) {
cnv -> fromUnicodeStatus = ( cnv -> fromUnicodeStatus & 0xf0000000 ) | 0x1000000 ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int EVP_DecryptInit_ex ( EVP_CIPHER_CTX * ctx , const EVP_CIPHER * cipher , ENGINE * impl , const unsigned char * key , const unsigned char * iv ) {
return EVP_CipherInit_ex ( ctx , cipher , impl , key , iv , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VALUE cState_allow_nan_p ( VALUE self ) {
GET_STATE ( self ) ;
return state -> allow_nan ? Qtrue : Qfalse ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void TSTextLogObjectHeaderSet ( TSTextLogObject the_object , const char * header ) {
sdk_assert ( sdk_sanity_check_iocore_structure ( the_object ) == TS_SUCCESS ) ;
( ( TextLogObject * ) the_object ) -> set_log_file_header ( header ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean lacks_thumbnail ( NautilusFile * file ) {
return nautilus_file_should_show_thumbnail ( file ) && file -> details -> thumbnail_path != NULL && ! file -> details -> thumbnail_is_up_to_date ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int cng_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
AVFrame * frame = data ;
CNGContext * p = avctx -> priv_data ;
int buf_size = avpkt -> size ;
int ret , i ;
int16_t * buf_out ;
float e = 1.0 ;
float scaling ;
if ( avpkt -> size ) {
int dbov = - avpkt -> data [ 0 ] ;
p -> target_energy = 1081109975 * pow ( 10 , dbov / 10.0 ) * 0.75 ;
memset ( p -> target_refl_coef , 0 , p -> order * sizeof ( * p -> target_refl_coef ) ) ;
for ( i = 0 ;
i < FFMIN ( avpkt -> size - 1 , p -> order ) ;
i ++ ) {
p -> target_refl_coef [ i ] = ( avpkt -> data [ 1 + i ] - 127 ) / 128.0 ;
}
}
if ( p -> inited ) {
p -> energy = p -> energy / 2 + p -> target_energy / 2 ;
for ( i = 0 ;
i < p -> order ;
i ++ ) p -> refl_coef [ i ] = 0.6 * p -> refl_coef [ i ] + 0.4 * p -> target_refl_coef [ i ] ;
}
else {
p -> energy = p -> target_energy ;
memcpy ( p -> refl_coef , p -> target_refl_coef , p -> order * sizeof ( * p -> refl_coef ) ) ;
p -> inited = 1 ;
}
make_lpc_coefs ( p -> lpc_coef , p -> refl_coef , p -> order ) ;
for ( i = 0 ;
i < p -> order ;
i ++ ) e *= 1.0 - p -> refl_coef [ i ] * p -> refl_coef [ i ] ;
scaling = sqrt ( e * p -> energy / 1081109975 ) ;
for ( i = 0 ;
i < avctx -> frame_size ;
i ++ ) {
int r = ( av_lfg_get ( & p -> lfg ) & 0xffff ) - 0x8000 ;
p -> excitation [ i ] = scaling * r ;
}
ff_celp_lp_synthesis_filterf ( p -> filter_out + p -> order , p -> lpc_coef , p -> excitation , avctx -> frame_size , p -> order ) ;
frame -> nb_samples = avctx -> frame_size ;
if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
buf_out = ( int16_t * ) frame -> data [ 0 ] ;
for ( i = 0 ;
i < avctx -> frame_size ;
i ++ ) buf_out [ i ] = p -> filter_out [ i + p -> order ] ;
memcpy ( p -> filter_out , p -> filter_out + avctx -> frame_size , p -> order * sizeof ( * p -> filter_out ) ) ;
* got_frame_ptr = 1 ;
return buf_size ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | gboolean nautilus_mime_file_extracts ( NautilusFile * file ) {
return get_activation_action ( file ) == ACTIVATION_ACTION_EXTRACT ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int read_huffman_tree ( AVCodecContext * avctx , GetBitContext * gb ) {
Vp3DecodeContext * s = avctx -> priv_data ;
if ( get_bits1 ( gb ) ) {
int token ;
if ( s -> entries >= 32 ) {
av_log ( avctx , AV_LOG_ERROR , "huffman tree overflow\n" ) ;
return - 1 ;
}
token = get_bits ( gb , 5 ) ;
av_dlog ( avctx , "hti %d hbits %x token %d entry : %d size %d\n" , s -> hti , s -> hbits , token , s -> entries , s -> huff_code_size ) ;
s -> huffman_table [ s -> hti ] [ token ] [ 0 ] = s -> hbits ;
s -> huffman_table [ s -> hti ] [ token ] [ 1 ] = s -> huff_code_size ;
s -> entries ++ ;
}
else {
if ( s -> huff_code_size >= 32 ) {
av_log ( avctx , AV_LOG_ERROR , "huffman tree overflow\n" ) ;
return - 1 ;
}
s -> huff_code_size ++ ;
s -> hbits <<= 1 ;
if ( read_huffman_tree ( avctx , gb ) ) return - 1 ;
s -> hbits |= 1 ;
if ( read_huffman_tree ( avctx , gb ) ) return - 1 ;
s -> hbits >>= 1 ;
s -> huff_code_size -- ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static const char * _UTF16GetName ( const UConverter * cnv ) {
if ( UCNV_GET_VERSION ( cnv ) == 0 ) {
return "UTF-16" ;
}
else if ( UCNV_GET_VERSION ( cnv ) == 1 ) {
return "UTF-16,version=1" ;
}
else {
return "UTF-16,version=2" ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_RequestSeqNum ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 724 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 65535U , & ( h225_pi -> requestSeqNum ) , FALSE ) ;
# line 732 "./asn1/h225/h225.cnf" }
return offset ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static const char * hfinfo_number_vals_format64 ( const header_field_info * hfinfo , char buf [ 64 ] , guint64 value ) {
int display = hfinfo -> display & FIELD_DISPLAY_E_MASK ;
if ( display == BASE_NONE ) return NULL ;
if ( display == BASE_DEC_HEX ) display = BASE_DEC ;
if ( display == BASE_HEX_DEC ) display = BASE_HEX ;
return hfinfo_number_value_format_display64 ( hfinfo , display , buf , value ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void pdf_run_m ( fz_context * ctx , pdf_processor * proc , float x , float y ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
fz_moveto ( ctx , pr -> path , x , y ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_IS13818AudioCapability ( 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_h245_IS13818AudioCapability , IS13818AudioCapability_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void pdf_grestore ( fz_context * ctx , pdf_run_processor * pr ) {
pdf_gstate * gs = pr -> gstate + pr -> gtop ;
int clip_depth = gs -> clip_depth ;
if ( pr -> gtop <= pr -> gbot ) {
fz_warn ( ctx , "gstate underflow in content stream" ) ;
return ;
}
pdf_drop_gstate ( ctx , gs ) ;
pr -> gtop -- ;
gs = pr -> gstate + pr -> gtop ;
while ( clip_depth > gs -> clip_depth ) {
fz_try ( ctx ) {
fz_pop_clip ( ctx , pr -> dev ) ;
}
fz_catch ( ctx ) {
}
clip_depth -- ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int pdf_dsc_process ( gx_device_pdf * pdev , const gs_param_string_array * pma ) {
int code = 0 ;
uint i ;
if ( ! pdev -> ParseDSCComments ) return 0 ;
for ( i = 0 ;
i + 1 < pma -> size && code >= 0 ;
i += 2 ) {
const gs_param_string * pkey = & pma -> data [ i ] ;
gs_param_string * pvalue = ( gs_param_string * ) & pma -> data [ i + 1 ] ;
const char * key ;
int newsize ;
if ( pdf_key_eq ( pkey , "Creator" ) && pdev -> CompatibilityLevel <= 1.7 ) {
key = "/Creator" ;
newsize = unescape_octals ( pdev , ( char * ) pvalue -> data , pvalue -> size ) ;
code = cos_dict_put_c_key_string ( pdev -> Info , key , pvalue -> data , newsize ) ;
continue ;
}
else if ( pdf_key_eq ( pkey , "Title" ) && pdev -> CompatibilityLevel <= 1.7 ) {
key = "/Title" ;
newsize = unescape_octals ( pdev , ( char * ) pvalue -> data , pvalue -> size ) ;
code = cos_dict_put_c_key_string ( pdev -> Info , key , pvalue -> data , newsize ) ;
continue ;
}
else if ( pdf_key_eq ( pkey , "For" ) && pdev -> CompatibilityLevel <= 1.7 ) {
key = "/Author" ;
newsize = unescape_octals ( pdev , ( char * ) pvalue -> data , pvalue -> size ) ;
code = cos_dict_put_c_key_string ( pdev -> Info , key , pvalue -> data , newsize ) ;
continue ;
}
else {
pdf_page_dsc_info_t * ppdi ;
char scan_buf [ 200 ] ;
if ( ( ppdi = & pdev -> doc_dsc_info , pdf_key_eq ( pkey , "Orientation" ) ) || ( ppdi = & pdev -> page_dsc_info , pdf_key_eq ( pkey , "PageOrientation" ) ) ) {
if ( pvalue -> size == 1 && pvalue -> data [ 0 ] >= '0' && pvalue -> data [ 0 ] <= '3' ) ppdi -> orientation = pvalue -> data [ 0 ] - '0' ;
else ppdi -> orientation = - 1 ;
}
else if ( ( ppdi = & pdev -> doc_dsc_info , pdf_key_eq ( pkey , "ViewingOrientation" ) ) || ( ppdi = & pdev -> page_dsc_info , pdf_key_eq ( pkey , "PageViewingOrientation" ) ) ) {
gs_matrix mat ;
int orient ;
if ( pvalue -> size >= sizeof ( scan_buf ) - 1 ) continue ;
memcpy ( scan_buf , pvalue -> data , pvalue -> size ) ;
scan_buf [ pvalue -> size ] = 0 ;
if ( sscanf ( scan_buf , "[%g %g %g %g]" , & mat . xx , & mat . xy , & mat . yx , & mat . yy ) != 4 ) continue ;
for ( orient = 0 ;
orient < 4 ;
++ orient ) {
if ( mat . xx == 1 && mat . xy == 0 && mat . yx == 0 && mat . yy == 1 ) break ;
gs_matrix_rotate ( & mat , - 90.0 , & mat ) ;
}
if ( orient == 4 ) orient = - 1 ;
ppdi -> viewing_orientation = orient ;
}
else {
gs_rect box ;
if ( pdf_key_eq ( pkey , "EPSF" ) ) {
pdev -> is_EPS = ( pvalue -> size >= 1 && pvalue -> data [ 0 ] != '0' ) ;
continue ;
}
if ( pdf_key_eq ( pkey , "BoundingBox" ) ) ppdi = & pdev -> doc_dsc_info ;
else if ( pdf_key_eq ( pkey , "PageBoundingBox" ) ) ppdi = & pdev -> page_dsc_info ;
else continue ;
if ( pvalue -> size >= sizeof ( scan_buf ) - 1 ) continue ;
memcpy ( scan_buf , pvalue -> data , pvalue -> size ) ;
scan_buf [ pvalue -> size ] = 0 ;
if ( sscanf ( scan_buf , "[%lg %lg %lg %lg]" , & box . p . x , & box . p . y , & box . q . x , & box . q . y ) != 4 ) continue ;
ppdi -> bounding_box = box ;
}
continue ;
}
}
return code ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void read_sbr_dtdf ( SpectralBandReplication * sbr , GetBitContext * gb , SBRData * ch_data ) {
get_bits1_vector ( gb , ch_data -> bs_df_env , ch_data -> bs_num_env ) ;
get_bits1_vector ( gb , ch_data -> bs_df_noise , ch_data -> bs_num_noise ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void tb_page_remove ( TranslationBlock * * ptb , TranslationBlock * tb ) {
TranslationBlock * tb1 ;
unsigned int n1 ;
for ( ;
;
) {
tb1 = * ptb ;
n1 = ( uintptr_t ) tb1 & 3 ;
tb1 = ( TranslationBlock * ) ( ( uintptr_t ) tb1 & ~ 3 ) ;
if ( tb1 == tb ) {
* ptb = tb1 -> page_next [ n1 ] ;
break ;
}
ptb = & tb1 -> page_next [ n1 ] ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | 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 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static guint32 dissect_trunkcall_nots ( tvbuff_t * tvb , guint32 offset , proto_tree * iax2_tree , guint16 * scallno ) {
proto_tree * call_tree ;
guint16 datalen , rlen ;
* scallno = tvb_get_ntohs ( tvb , offset ) ;
datalen = tvb_get_ntohs ( tvb , offset + 2 ) ;
rlen = MIN ( tvb_captured_length ( tvb ) - offset - 4 , datalen ) ;
if ( iax2_tree ) {
call_tree = proto_tree_add_subtree_format ( iax2_tree , tvb , offset , rlen + 6 , ett_iax2_trunk_call , NULL , "Trunk call from %u" , * scallno ) ;
proto_tree_add_item ( call_tree , hf_iax2_trunk_call_scallno , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( call_tree , hf_iax2_trunk_call_len , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( call_tree , hf_iax2_trunk_call_data , tvb , offset + 4 , rlen , ENC_NA ) ;
}
offset += 4 + rlen ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline int base_key_length ( const cipher_type_t * cipher , int key_length ) {
switch ( cipher -> id ) {
case AES_128_ICM : case AES_192_ICM : case AES_256_ICM : return key_length - 14 ;
break ;
case AES_128_GCM : return 16 ;
break ;
case AES_256_GCM : return 32 ;
break ;
default : return key_length ;
break ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int parse_args ( int argc , char * * argv ) {
if ( load_defaults ( "my" , load_default_groups , & argc , & argv ) ) exit ( 1 ) ;
default_argv = argv ;
if ( ( handle_options ( & argc , & argv , my_long_options , get_one_option ) ) ) exit ( 1 ) ;
if ( argc > 1 ) {
usage ( ) ;
exit ( 1 ) ;
}
if ( argc == 1 ) opt_db = * argv ;
if ( tty_password ) opt_pass = get_tty_password ( NullS ) ;
if ( debug_info_flag ) my_end_arg = MY_CHECK_ERROR | MY_GIVE_INFO ;
if ( debug_check_flag ) my_end_arg |= MY_CHECK_ERROR ;
if ( global_subst != NULL ) {
char * comma = strstr ( global_subst , "," ) ;
if ( comma == NULL ) die ( "wrong --global-subst, must be X,Y" ) ;
memcpy ( global_subst_from , global_subst , ( comma - global_subst ) ) ;
global_subst_from [ comma - global_subst ] = 0 ;
memcpy ( global_subst_to , comma + 1 , strlen ( comma ) ) ;
}
if ( ! opt_suite_dir ) opt_suite_dir = "./" ;
suite_dir_len = strlen ( opt_suite_dir ) ;
overlay_dir_len = opt_overlay_dir ? strlen ( opt_overlay_dir ) : 0 ;
if ( ! record ) {
if ( result_file_name && access ( result_file_name , F_OK ) != 0 ) die ( "The specified result file '%s' does not exist" , result_file_name ) ;
}
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void TSMgmtUpdateRegister ( TSCont contp , const char * plugin_name ) {
sdk_assert ( sdk_sanity_check_iocore_structure ( contp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) plugin_name ) == TS_SUCCESS ) ;
global_config_cbs -> insert ( ( INKContInternal * ) contp , plugin_name ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( FullscreenControllerStateUnitTest , ExitFullscreenViaBrowserWindow ) {
AddTab ( browser ( ) , GURL ( url : : kAboutBlankURL ) ) ;
ASSERT_TRUE ( InvokeEvent ( TOGGLE_FULLSCREEN ) ) ;
ASSERT_TRUE ( InvokeEvent ( WINDOW_CHANGE ) ) ;
ASSERT_TRUE ( browser ( ) -> window ( ) -> IsFullscreen ( ) ) ;
browser ( ) -> window ( ) -> ExitFullscreen ( ) ;
ChangeWindowFullscreenState ( ) ;
EXPECT_EQ ( EXCLUSIVE_ACCESS_BUBBLE_TYPE_NONE , browser ( ) -> fullscreen_controller ( ) -> GetExclusiveAccessBubbleType ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ;
return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ;
\ }
void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ;
}
void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ;
}
unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ;
return * sse ;
}
VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) SUBPIX_AVG_VAR ( 8 , 16 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static const char * * slirp_dnssearch ( const StringList * dnsname ) {
const StringList * c = dnsname ;
size_t i = 0 , num_opts = 0 ;
const char * * ret ;
while ( c ) {
num_opts ++ ;
c = c -> next ;
}
if ( num_opts == 0 ) {
return NULL ;
}
ret = g_malloc ( ( num_opts + 1 ) * sizeof ( * ret ) ) ;
c = dnsname ;
while ( c ) {
ret [ i ++ ] = c -> value -> str ;
c = c -> next ;
}
ret [ i ] = NULL ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void setup_masks_indic ( const hb_ot_shape_plan_t * plan HB_UNUSED , hb_buffer_t * buffer , hb_font_t * font HB_UNUSED ) {
HB_BUFFER_ALLOCATE_VAR ( buffer , indic_category ) ;
HB_BUFFER_ALLOCATE_VAR ( buffer , indic_position ) ;
unsigned int count = buffer -> len ;
hb_glyph_info_t * info = buffer -> info ;
for ( unsigned int i = 0 ;
i < count ;
i ++ ) set_indic_properties ( info [ i ] ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_first_pass ( VP9_COMP * cpi , const struct lookahead_entry * source ) {
int mb_row , mb_col ;
MACROBLOCK * const x = & cpi -> mb ;
VP9_COMMON * const cm = & cpi -> common ;
MACROBLOCKD * const xd = & x -> e_mbd ;
TileInfo tile ;
struct macroblock_plane * const p = x -> plane ;
struct macroblockd_plane * const pd = xd -> plane ;
const PICK_MODE_CONTEXT * ctx = & cpi -> pc_root -> none ;
int i ;
int recon_yoffset , recon_uvoffset ;
YV12_BUFFER_CONFIG * const lst_yv12 = get_ref_frame_buffer ( cpi , LAST_FRAME ) ;
YV12_BUFFER_CONFIG * gld_yv12 = get_ref_frame_buffer ( cpi , GOLDEN_FRAME ) ;
YV12_BUFFER_CONFIG * const new_yv12 = get_frame_new_buffer ( cm ) ;
int recon_y_stride = lst_yv12 -> y_stride ;
int recon_uv_stride = lst_yv12 -> uv_stride ;
int uv_mb_height = 16 >> ( lst_yv12 -> y_height > lst_yv12 -> uv_height ) ;
int64_t intra_error = 0 ;
int64_t coded_error = 0 ;
int64_t sr_coded_error = 0 ;
int sum_mvr = 0 , sum_mvc = 0 ;
int sum_mvr_abs = 0 , sum_mvc_abs = 0 ;
int64_t sum_mvrs = 0 , sum_mvcs = 0 ;
int mvcount = 0 ;
int intercount = 0 ;
int second_ref_count = 0 ;
int intrapenalty = 256 ;
int neutral_count = 0 ;
int new_mv_count = 0 ;
int sum_in_vectors = 0 ;
MV lastmv = {
0 , 0 }
;
TWO_PASS * twopass = & cpi -> twopass ;
const MV zero_mv = {
0 , 0 }
;
const YV12_BUFFER_CONFIG * first_ref_buf = lst_yv12 ;
LAYER_CONTEXT * const lc = is_two_pass_svc ( cpi ) ? & cpi -> svc . layer_context [ cpi -> svc . spatial_layer_id ] : NULL ;
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats ) {
vp9_zero_array ( cpi -> twopass . frame_mb_stats_buf , cm -> MBs ) ;
}
# endif vp9_clear_system_state ( ) ;
set_first_pass_params ( cpi ) ;
vp9_set_quantizer ( cm , find_fp_qindex ( ) ) ;
if ( lc != NULL ) {
MV_REFERENCE_FRAME ref_frame = LAST_FRAME ;
twopass = & lc -> twopass ;
if ( cpi -> common . current_video_frame == 0 ) {
cpi -> ref_frame_flags = 0 ;
}
else {
if ( lc -> current_video_frame_in_layer < ( unsigned int ) cpi -> svc . number_temporal_layers ) cpi -> ref_frame_flags = VP9_GOLD_FLAG ;
else cpi -> ref_frame_flags = VP9_LAST_FLAG | VP9_GOLD_FLAG ;
}
vp9_scale_references ( cpi ) ;
if ( cpi -> ref_frame_flags & VP9_LAST_FLAG ) {
first_ref_buf = vp9_get_scaled_ref_frame ( cpi , LAST_FRAME ) ;
ref_frame = LAST_FRAME ;
if ( first_ref_buf == NULL ) first_ref_buf = get_ref_frame_buffer ( cpi , LAST_FRAME ) ;
}
else if ( cpi -> ref_frame_flags & VP9_GOLD_FLAG ) {
first_ref_buf = vp9_get_scaled_ref_frame ( cpi , GOLDEN_FRAME ) ;
ref_frame = GOLDEN_FRAME ;
if ( first_ref_buf == NULL ) first_ref_buf = get_ref_frame_buffer ( cpi , GOLDEN_FRAME ) ;
}
recon_y_stride = new_yv12 -> y_stride ;
recon_uv_stride = new_yv12 -> uv_stride ;
uv_mb_height = 16 >> ( new_yv12 -> y_height > new_yv12 -> uv_height ) ;
gld_yv12 = NULL ;
set_ref_ptrs ( cm , xd , ref_frame , NONE ) ;
cpi -> Source = vp9_scale_if_required ( cm , cpi -> un_scaled_source , & cpi -> scaled_source ) ;
}
vp9_setup_block_planes ( & x -> e_mbd , cm -> subsampling_x , cm -> subsampling_y ) ;
vp9_setup_src_planes ( x , cpi -> Source , 0 , 0 ) ;
vp9_setup_pre_planes ( xd , 0 , first_ref_buf , 0 , 0 , NULL ) ;
vp9_setup_dst_planes ( xd -> plane , new_yv12 , 0 , 0 ) ;
xd -> mi = cm -> mi_grid_visible ;
xd -> mi [ 0 ] = cm -> mi ;
vp9_frame_init_quantizer ( cpi ) ;
for ( i = 0 ;
i < MAX_MB_PLANE ;
++ i ) {
p [ i ] . coeff = ctx -> coeff_pbuf [ i ] [ 1 ] ;
p [ i ] . qcoeff = ctx -> qcoeff_pbuf [ i ] [ 1 ] ;
pd [ i ] . dqcoeff = ctx -> dqcoeff_pbuf [ i ] [ 1 ] ;
p [ i ] . eobs = ctx -> eobs_pbuf [ i ] [ 1 ] ;
}
x -> skip_recode = 0 ;
vp9_init_mv_probs ( cm ) ;
vp9_initialize_rd_consts ( cpi ) ;
vp9_tile_init ( & tile , cm , 0 , 0 ) ;
for ( mb_row = 0 ;
mb_row < cm -> mb_rows ;
++ mb_row ) {
MV best_ref_mv = {
0 , 0 }
;
xd -> up_available = ( mb_row != 0 ) ;
recon_yoffset = ( mb_row * recon_y_stride * 16 ) ;
recon_uvoffset = ( mb_row * recon_uv_stride * uv_mb_height ) ;
x -> mv_row_min = - ( ( mb_row * 16 ) + BORDER_MV_PIXELS_B16 ) ;
x -> mv_row_max = ( ( cm -> mb_rows - 1 - mb_row ) * 16 ) + BORDER_MV_PIXELS_B16 ;
for ( mb_col = 0 ;
mb_col < cm -> mb_cols ;
++ mb_col ) {
int this_error ;
const int use_dc_pred = ( mb_col || mb_row ) && ( ! mb_col || ! mb_row ) ;
double error_weight = 1.0 ;
const BLOCK_SIZE bsize = get_bsize ( cm , mb_row , mb_col ) ;
# if CONFIG_FP_MB_STATS const int mb_index = mb_row * cm -> mb_cols + mb_col ;
# endif vp9_clear_system_state ( ) ;
xd -> plane [ 0 ] . dst . buf = new_yv12 -> y_buffer + recon_yoffset ;
xd -> plane [ 1 ] . dst . buf = new_yv12 -> u_buffer + recon_uvoffset ;
xd -> plane [ 2 ] . dst . buf = new_yv12 -> v_buffer + recon_uvoffset ;
xd -> left_available = ( mb_col != 0 ) ;
xd -> mi [ 0 ] -> mbmi . sb_type = bsize ;
xd -> mi [ 0 ] -> mbmi . ref_frame [ 0 ] = INTRA_FRAME ;
set_mi_row_col ( xd , & tile , mb_row << 1 , num_8x8_blocks_high_lookup [ bsize ] , mb_col << 1 , num_8x8_blocks_wide_lookup [ bsize ] , cm -> mi_rows , cm -> mi_cols ) ;
if ( cpi -> oxcf . aq_mode == VARIANCE_AQ ) {
const int energy = vp9_block_energy ( cpi , x , bsize ) ;
error_weight = vp9_vaq_inv_q_ratio ( energy ) ;
}
x -> skip_encode = 0 ;
xd -> mi [ 0 ] -> mbmi . mode = DC_PRED ;
xd -> mi [ 0 ] -> mbmi . tx_size = use_dc_pred ? ( bsize >= BLOCK_16X16 ? TX_16X16 : TX_8X8 ) : TX_4X4 ;
vp9_encode_intra_block_plane ( x , bsize , 0 ) ;
this_error = vp9_get_mb_ss ( x -> plane [ 0 ] . src_diff ) ;
if ( cpi -> oxcf . aq_mode == VARIANCE_AQ ) {
vp9_clear_system_state ( ) ;
this_error = ( int ) ( this_error * error_weight ) ;
}
this_error += intrapenalty ;
intra_error += ( int64_t ) this_error ;
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] = 0 ;
}
# endif x -> mv_col_min = - ( ( mb_col * 16 ) + BORDER_MV_PIXELS_B16 ) ;
x -> mv_col_max = ( ( cm -> mb_cols - 1 - mb_col ) * 16 ) + BORDER_MV_PIXELS_B16 ;
if ( cm -> current_video_frame > 0 ) {
int tmp_err , motion_error , raw_motion_error ;
MV mv = {
0 , 0 }
, tmp_mv = {
0 , 0 }
;
struct buf_2d unscaled_last_source_buf_2d ;
xd -> plane [ 0 ] . pre [ 0 ] . buf = first_ref_buf -> y_buffer + recon_yoffset ;
motion_error = get_prediction_error ( bsize , & x -> plane [ 0 ] . src , & xd -> plane [ 0 ] . pre [ 0 ] ) ;
unscaled_last_source_buf_2d . buf = cpi -> unscaled_last_source -> y_buffer + recon_yoffset ;
unscaled_last_source_buf_2d . stride = cpi -> unscaled_last_source -> y_stride ;
raw_motion_error = get_prediction_error ( bsize , & x -> plane [ 0 ] . src , & unscaled_last_source_buf_2d ) ;
if ( raw_motion_error > 25 || lc != NULL ) {
first_pass_motion_search ( cpi , x , & best_ref_mv , & mv , & motion_error ) ;
if ( cpi -> oxcf . aq_mode == VARIANCE_AQ ) {
vp9_clear_system_state ( ) ;
motion_error = ( int ) ( motion_error * error_weight ) ;
}
if ( ! is_zero_mv ( & best_ref_mv ) ) {
tmp_err = INT_MAX ;
first_pass_motion_search ( cpi , x , & zero_mv , & tmp_mv , & tmp_err ) ;
if ( cpi -> oxcf . aq_mode == VARIANCE_AQ ) {
vp9_clear_system_state ( ) ;
tmp_err = ( int ) ( tmp_err * error_weight ) ;
}
if ( tmp_err < motion_error ) {
motion_error = tmp_err ;
mv = tmp_mv ;
}
}
if ( cm -> current_video_frame > 1 && gld_yv12 != NULL ) {
int gf_motion_error ;
xd -> plane [ 0 ] . pre [ 0 ] . buf = gld_yv12 -> y_buffer + recon_yoffset ;
gf_motion_error = get_prediction_error ( bsize , & x -> plane [ 0 ] . src , & xd -> plane [ 0 ] . pre [ 0 ] ) ;
first_pass_motion_search ( cpi , x , & zero_mv , & tmp_mv , & gf_motion_error ) ;
if ( cpi -> oxcf . aq_mode == VARIANCE_AQ ) {
vp9_clear_system_state ( ) ;
gf_motion_error = ( int ) ( gf_motion_error * error_weight ) ;
}
if ( gf_motion_error < motion_error && gf_motion_error < this_error ) ++ second_ref_count ;
xd -> plane [ 0 ] . pre [ 0 ] . buf = first_ref_buf -> y_buffer + recon_yoffset ;
xd -> plane [ 1 ] . pre [ 0 ] . buf = first_ref_buf -> u_buffer + recon_uvoffset ;
xd -> plane [ 2 ] . pre [ 0 ] . buf = first_ref_buf -> v_buffer + recon_uvoffset ;
if ( gf_motion_error < this_error ) sr_coded_error += gf_motion_error ;
else sr_coded_error += this_error ;
}
else {
sr_coded_error += motion_error ;
}
}
else {
sr_coded_error += motion_error ;
}
best_ref_mv . row = 0 ;
best_ref_mv . col = 0 ;
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] = 0 ;
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_DCINTRA_MASK ;
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_MOTION_ZERO_MASK ;
if ( this_error > FPMB_ERROR_LARGE_TH ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_ERROR_LARGE_MASK ;
}
else if ( this_error < FPMB_ERROR_SMALL_TH ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_ERROR_SMALL_MASK ;
}
}
# endif if ( motion_error <= this_error ) {
if ( ( ( this_error - intrapenalty ) * 9 <= motion_error * 10 ) && this_error < 2 * intrapenalty ) ++ neutral_count ;
mv . row *= 8 ;
mv . col *= 8 ;
this_error = motion_error ;
xd -> mi [ 0 ] -> mbmi . mode = NEWMV ;
xd -> mi [ 0 ] -> mbmi . mv [ 0 ] . as_mv = mv ;
xd -> mi [ 0 ] -> mbmi . tx_size = TX_4X4 ;
xd -> mi [ 0 ] -> mbmi . ref_frame [ 0 ] = LAST_FRAME ;
xd -> mi [ 0 ] -> mbmi . ref_frame [ 1 ] = NONE ;
vp9_build_inter_predictors_sby ( xd , mb_row << 1 , mb_col << 1 , bsize ) ;
vp9_encode_sby_pass1 ( x , bsize ) ;
sum_mvr += mv . row ;
sum_mvr_abs += abs ( mv . row ) ;
sum_mvc += mv . col ;
sum_mvc_abs += abs ( mv . col ) ;
sum_mvrs += mv . row * mv . row ;
sum_mvcs += mv . col * mv . col ;
++ intercount ;
best_ref_mv = mv ;
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] = 0 ;
cpi -> twopass . frame_mb_stats_buf [ mb_index ] &= ~ FPMB_DCINTRA_MASK ;
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_MOTION_ZERO_MASK ;
if ( this_error > FPMB_ERROR_LARGE_TH ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_ERROR_LARGE_MASK ;
}
else if ( this_error < FPMB_ERROR_SMALL_TH ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_ERROR_SMALL_MASK ;
}
}
# endif if ( ! is_zero_mv ( & mv ) ) {
++ mvcount ;
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] &= ~ FPMB_MOTION_ZERO_MASK ;
if ( mv . as_mv . col > 0 && mv . as_mv . col >= abs ( mv . as_mv . row ) ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_MOTION_RIGHT_MASK ;
}
else if ( mv . as_mv . row < 0 && abs ( mv . as_mv . row ) >= abs ( mv . as_mv . col ) ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_MOTION_UP_MASK ;
}
else if ( mv . as_mv . col < 0 && abs ( mv . as_mv . col ) >= abs ( mv . as_mv . row ) ) {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_MOTION_LEFT_MASK ;
}
else {
cpi -> twopass . frame_mb_stats_buf [ mb_index ] |= FPMB_MOTION_DOWN_MASK ;
}
}
# endif if ( ! is_equal_mv ( & mv , & lastmv ) ) ++ new_mv_count ;
lastmv = mv ;
if ( mb_row < cm -> mb_rows / 2 ) {
if ( mv . row > 0 ) -- sum_in_vectors ;
else if ( mv . row < 0 ) ++ sum_in_vectors ;
}
else if ( mb_row > cm -> mb_rows / 2 ) {
if ( mv . row > 0 ) ++ sum_in_vectors ;
else if ( mv . row < 0 ) -- sum_in_vectors ;
}
if ( mb_col < cm -> mb_cols / 2 ) {
if ( mv . col > 0 ) -- sum_in_vectors ;
else if ( mv . col < 0 ) ++ sum_in_vectors ;
}
else if ( mb_col > cm -> mb_cols / 2 ) {
if ( mv . col > 0 ) ++ sum_in_vectors ;
else if ( mv . col < 0 ) -- sum_in_vectors ;
}
}
}
}
else {
sr_coded_error += ( int64_t ) this_error ;
}
coded_error += ( int64_t ) this_error ;
x -> plane [ 0 ] . src . buf += 16 ;
x -> plane [ 1 ] . src . buf += uv_mb_height ;
x -> plane [ 2 ] . src . buf += uv_mb_height ;
recon_yoffset += 16 ;
recon_uvoffset += uv_mb_height ;
}
x -> plane [ 0 ] . src . buf += 16 * x -> plane [ 0 ] . src . stride - 16 * cm -> mb_cols ;
x -> plane [ 1 ] . src . buf += uv_mb_height * x -> plane [ 1 ] . src . stride - uv_mb_height * cm -> mb_cols ;
x -> plane [ 2 ] . src . buf += uv_mb_height * x -> plane [ 1 ] . src . stride - uv_mb_height * cm -> mb_cols ;
vp9_clear_system_state ( ) ;
}
vp9_clear_system_state ( ) ;
{
FIRSTPASS_STATS fps ;
fps . frame = cm -> current_video_frame ;
fps . spatial_layer_id = cpi -> svc . spatial_layer_id ;
fps . intra_error = ( double ) ( intra_error >> 8 ) ;
fps . coded_error = ( double ) ( coded_error >> 8 ) ;
fps . sr_coded_error = ( double ) ( sr_coded_error >> 8 ) ;
fps . count = 1.0 ;
fps . pcnt_inter = ( double ) intercount / cm -> MBs ;
fps . pcnt_second_ref = ( double ) second_ref_count / cm -> MBs ;
fps . pcnt_neutral = ( double ) neutral_count / cm -> MBs ;
if ( mvcount > 0 ) {
fps . MVr = ( double ) sum_mvr / mvcount ;
fps . mvr_abs = ( double ) sum_mvr_abs / mvcount ;
fps . MVc = ( double ) sum_mvc / mvcount ;
fps . mvc_abs = ( double ) sum_mvc_abs / mvcount ;
fps . MVrv = ( ( double ) sum_mvrs - ( fps . MVr * fps . MVr / mvcount ) ) / mvcount ;
fps . MVcv = ( ( double ) sum_mvcs - ( fps . MVc * fps . MVc / mvcount ) ) / mvcount ;
fps . mv_in_out_count = ( double ) sum_in_vectors / ( mvcount * 2 ) ;
fps . new_mv_count = new_mv_count ;
fps . pcnt_motion = ( double ) mvcount / cm -> MBs ;
}
else {
fps . MVr = 0.0 ;
fps . mvr_abs = 0.0 ;
fps . MVc = 0.0 ;
fps . mvc_abs = 0.0 ;
fps . MVrv = 0.0 ;
fps . MVcv = 0.0 ;
fps . mv_in_out_count = 0.0 ;
fps . new_mv_count = 0.0 ;
fps . pcnt_motion = 0.0 ;
}
fps . duration = ( double ) ( source -> ts_end - source -> ts_start ) ;
twopass -> this_frame_stats = fps ;
output_stats ( & twopass -> this_frame_stats , cpi -> output_pkt_list ) ;
accumulate_stats ( & twopass -> total_stats , & fps ) ;
# if CONFIG_FP_MB_STATS if ( cpi -> use_fp_mb_stats ) {
output_fpmb_stats ( twopass -> frame_mb_stats_buf , cm , cpi -> output_pkt_list ) ;
}
# endif }
if ( ( twopass -> sr_update_lag > 3 ) || ( ( cm -> current_video_frame > 0 ) && ( twopass -> this_frame_stats . pcnt_inter > 0.20 ) && ( ( twopass -> this_frame_stats . intra_error / DOUBLE_DIVIDE_CHECK ( twopass -> this_frame_stats . coded_error ) ) > 2.0 ) ) ) {
if ( gld_yv12 != NULL ) {
vp8_yv12_copy_frame ( lst_yv12 , gld_yv12 ) ;
}
twopass -> sr_update_lag = 1 ;
}
else {
++ twopass -> sr_update_lag ;
}
vp9_extend_frame_borders ( new_yv12 ) ;
if ( lc != NULL ) {
vp9_update_reference_frames ( cpi ) ;
}
else {
swap_yv12 ( lst_yv12 , new_yv12 ) ;
}
if ( cm -> current_video_frame == 0 && gld_yv12 != NULL ) {
vp8_yv12_copy_frame ( lst_yv12 , gld_yv12 ) ;
}
if ( 0 ) {
char filename [ 512 ] ;
FILE * recon_file ;
snprintf ( filename , sizeof ( filename ) , "enc%04d.yuv" , ( int ) cm -> current_video_frame ) ;
if ( cm -> current_video_frame == 0 ) recon_file = fopen ( filename , "wb" ) ;
else recon_file = fopen ( filename , "ab" ) ;
( void ) fwrite ( lst_yv12 -> buffer_alloc , lst_yv12 -> frame_size , 1 , recon_file ) ;
fclose ( recon_file ) ;
}
++ cm -> current_video_frame ;
if ( cpi -> use_svc ) vp9_inc_frame_in_layer ( cpi ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int AddEntry ( struct pskeydict * dict , struct psstack * stack , int sp ) {
int i ;
if ( dict -> cnt >= dict -> max ) {
if ( dict -> cnt == 0 ) {
dict -> max = 30 ;
dict -> entries = malloc ( dict -> max * sizeof ( struct pskeyval ) ) ;
}
else {
dict -> max += 30 ;
dict -> entries = realloc ( dict -> entries , dict -> max * sizeof ( struct pskeyval ) ) ;
}
}
if ( sp < 2 ) return ( sp ) ;
if ( stack [ sp - 2 ] . type != ps_string && stack [ sp - 2 ] . type != ps_lit ) {
LogError ( _ ( "Key for a def must be a string or name literal\n" ) ) ;
return ( sp - 2 ) ;
}
for ( i = 0 ;
i < dict -> cnt ;
++ i ) if ( strcmp ( dict -> entries [ i ] . key , stack [ sp - 2 ] . u . str ) == 0 ) break ;
if ( i != dict -> cnt ) {
free ( stack [ sp - 2 ] . u . str ) ;
if ( dict -> entries [ i ] . type == ps_string || dict -> entries [ i ] . type == ps_instr || dict -> entries [ i ] . type == ps_lit ) free ( dict -> entries [ i ] . u . str ) ;
}
else {
memset ( & dict -> entries [ i ] , '\0' , sizeof ( struct pskeyval ) ) ;
dict -> entries [ i ] . key = stack [ sp - 2 ] . u . str ;
++ dict -> cnt ;
}
dict -> entries [ i ] . type = stack [ sp - 1 ] . type ;
dict -> entries [ i ] . u = stack [ sp - 1 ] . u ;
return ( sp - 2 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static bfd_boolean srec_new_symbol ( bfd * abfd , const char * name , bfd_vma val ) {
struct srec_symbol * n ;
n = ( struct srec_symbol * ) bfd_alloc ( abfd , sizeof ( * n ) ) ;
if ( n == NULL ) return FALSE ;
n -> name = name ;
n -> val = val ;
if ( abfd -> tdata . srec_data -> symbols == NULL ) abfd -> tdata . srec_data -> symbols = n ;
else abfd -> tdata . srec_data -> symtail -> next = n ;
abfd -> tdata . srec_data -> symtail = n ;
n -> next = NULL ;
++ abfd -> symcount ;
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean is_link_trusted ( NautilusFile * file , gboolean is_launcher ) {
GFile * location ;
gboolean res ;
if ( ! is_launcher ) {
return TRUE ;
}
if ( nautilus_file_can_execute ( file ) ) {
return TRUE ;
}
res = FALSE ;
if ( nautilus_file_is_local ( file ) ) {
location = nautilus_file_get_location ( file ) ;
res = nautilus_is_in_system_dir ( location ) ;
g_object_unref ( location ) ;
}
return res ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int tipc_nl_compat_link_dump ( struct tipc_nl_compat_msg * msg , struct nlattr * * attrs ) {
struct nlattr * link [ TIPC_NLA_LINK_MAX + 1 ] ;
struct tipc_link_info link_info ;
int err ;
if ( ! attrs [ TIPC_NLA_LINK ] ) return - EINVAL ;
err = nla_parse_nested ( link , TIPC_NLA_LINK_MAX , attrs [ TIPC_NLA_LINK ] , NULL ) ;
if ( err ) return err ;
link_info . dest = nla_get_flag ( link [ TIPC_NLA_LINK_DEST ] ) ;
link_info . up = htonl ( nla_get_flag ( link [ TIPC_NLA_LINK_UP ] ) ) ;
strcpy ( link_info . str , nla_data ( link [ TIPC_NLA_LINK_NAME ] ) ) ;
return tipc_add_tlv ( msg -> rep , TIPC_TLV_LINK_INFO , & link_info , sizeof ( link_info ) ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void update_mbgraph_frame_stats ( VP9_COMP * cpi , MBGRAPH_FRAME_STATS * stats , YV12_BUFFER_CONFIG * buf , YV12_BUFFER_CONFIG * golden_ref , YV12_BUFFER_CONFIG * alt_ref ) {
MACROBLOCK * const x = & cpi -> mb ;
MACROBLOCKD * const xd = & x -> e_mbd ;
VP9_COMMON * const cm = & cpi -> common ;
int mb_col , mb_row , offset = 0 ;
int mb_y_offset = 0 , arf_y_offset = 0 , gld_y_offset = 0 ;
MV gld_top_mv = {
0 , 0 }
;
MODE_INFO mi_local ;
vp9_zero ( mi_local ) ;
x -> mv_row_min = - BORDER_MV_PIXELS_B16 ;
x -> mv_row_max = ( cm -> mb_rows - 1 ) * 8 + BORDER_MV_PIXELS_B16 ;
xd -> up_available = 0 ;
xd -> plane [ 0 ] . dst . stride = buf -> y_stride ;
xd -> plane [ 0 ] . pre [ 0 ] . stride = buf -> y_stride ;
xd -> plane [ 1 ] . dst . stride = buf -> uv_stride ;
xd -> mi [ 0 ] = & mi_local ;
mi_local . mbmi . sb_type = BLOCK_16X16 ;
mi_local . mbmi . ref_frame [ 0 ] = LAST_FRAME ;
mi_local . mbmi . ref_frame [ 1 ] = NONE ;
for ( mb_row = 0 ;
mb_row < cm -> mb_rows ;
mb_row ++ ) {
MV gld_left_mv = gld_top_mv ;
int mb_y_in_offset = mb_y_offset ;
int arf_y_in_offset = arf_y_offset ;
int gld_y_in_offset = gld_y_offset ;
x -> mv_col_min = - BORDER_MV_PIXELS_B16 ;
x -> mv_col_max = ( cm -> mb_cols - 1 ) * 8 + BORDER_MV_PIXELS_B16 ;
xd -> left_available = 0 ;
for ( mb_col = 0 ;
mb_col < cm -> mb_cols ;
mb_col ++ ) {
MBGRAPH_MB_STATS * mb_stats = & stats -> mb_stats [ offset + mb_col ] ;
update_mbgraph_mb_stats ( cpi , mb_stats , buf , mb_y_in_offset , golden_ref , & gld_left_mv , alt_ref , mb_row , mb_col ) ;
gld_left_mv = mb_stats -> ref [ GOLDEN_FRAME ] . m . mv . as_mv ;
if ( mb_col == 0 ) {
gld_top_mv = gld_left_mv ;
}
xd -> left_available = 1 ;
mb_y_in_offset += 16 ;
gld_y_in_offset += 16 ;
arf_y_in_offset += 16 ;
x -> mv_col_min -= 16 ;
x -> mv_col_max -= 16 ;
}
xd -> up_available = 1 ;
mb_y_offset += buf -> y_stride * 16 ;
gld_y_offset += golden_ref -> y_stride * 16 ;
if ( alt_ref ) arf_y_offset += alt_ref -> y_stride * 16 ;
x -> mv_row_min -= 16 ;
x -> mv_row_max -= 16 ;
offset += cm -> mb_cols ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static vpx_codec_err_t ctrl_set_cpuused ( vpx_codec_alg_priv_t * ctx , va_list args ) {
struct vp9_extracfg extra_cfg = ctx -> extra_cfg ;
extra_cfg . cpu_used = CAST ( VP8E_SET_CPUUSED , args ) ;
return update_extra_cfg ( ctx , & extra_cfg ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int superblock_has_perm ( const struct cred * cred , struct super_block * sb , u32 perms , struct common_audit_data * ad ) {
struct superblock_security_struct * sbsec ;
u32 sid = cred_sid ( cred ) ;
sbsec = sb -> s_security ;
return avc_has_perm ( sid , sbsec -> sid , SECCLASS_FILESYSTEM , perms , ad ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( BluetoothChooserBrowserTest , InvokeDialog_PairedModal ) {
set_status ( FakeBluetoothChooserController : : BluetoothStatus : : IDLE ) ;
AddPairedDevice ( ) ;
RunDialog ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static block_t * PacketizeStreamBlock ( decoder_t * p_dec , block_t * * pp_block ) {
decoder_sys_t * p_sys = p_dec -> p_sys ;
uint8_t p_header [ ADTS_HEADER_SIZE + LOAS_HEADER_SIZE ] ;
block_t * p_out_buffer ;
uint8_t * p_buf ;
if ( ! pp_block || ! * pp_block ) return NULL ;
if ( ( * pp_block ) -> i_flags & ( BLOCK_FLAG_DISCONTINUITY | BLOCK_FLAG_CORRUPTED ) ) {
if ( ( * pp_block ) -> i_flags & BLOCK_FLAG_CORRUPTED ) {
p_sys -> i_state = STATE_NOSYNC ;
block_BytestreamEmpty ( & p_sys -> bytestream ) ;
}
date_Set ( & p_sys -> end_date , 0 ) ;
block_Release ( * pp_block ) ;
return NULL ;
}
if ( ! date_Get ( & p_sys -> end_date ) && ( * pp_block ) -> i_pts <= VLC_TS_INVALID ) {
block_Release ( * pp_block ) ;
return NULL ;
}
block_BytestreamPush ( & p_sys -> bytestream , * pp_block ) ;
for ( ;
;
) {
switch ( p_sys -> i_state ) {
case STATE_NOSYNC : while ( block_PeekBytes ( & p_sys -> bytestream , p_header , 2 ) == VLC_SUCCESS ) {
if ( p_header [ 0 ] == 0xff && ( p_header [ 1 ] & 0xf6 ) == 0xf0 ) {
if ( p_sys -> i_type != TYPE_ADTS ) msg_Dbg ( p_dec , "detected ADTS format" ) ;
p_sys -> i_state = STATE_SYNC ;
p_sys -> i_type = TYPE_ADTS ;
break ;
}
else if ( p_header [ 0 ] == 0x56 && ( p_header [ 1 ] & 0xe0 ) == 0xe0 ) {
if ( p_sys -> i_type != TYPE_LOAS ) msg_Dbg ( p_dec , "detected LOAS format" ) ;
p_sys -> i_state = STATE_SYNC ;
p_sys -> i_type = TYPE_LOAS ;
break ;
}
block_SkipByte ( & p_sys -> bytestream ) ;
}
if ( p_sys -> i_state != STATE_SYNC ) {
block_BytestreamFlush ( & p_sys -> bytestream ) ;
return NULL ;
}
case STATE_SYNC : p_sys -> i_pts = p_sys -> bytestream . p_block -> i_pts ;
if ( p_sys -> i_pts > VLC_TS_INVALID && p_sys -> i_pts != date_Get ( & p_sys -> end_date ) ) date_Set ( & p_sys -> end_date , p_sys -> i_pts ) ;
p_sys -> i_state = STATE_HEADER ;
break ;
case STATE_HEADER : if ( p_sys -> i_type == TYPE_ADTS ) {
if ( block_PeekBytes ( & p_sys -> bytestream , p_header , ADTS_HEADER_SIZE ) != VLC_SUCCESS ) return NULL ;
p_sys -> i_frame_size = ADTSSyncInfo ( p_dec , p_header , & p_sys -> i_channels , & p_sys -> i_rate , & p_sys -> i_frame_length , & p_sys -> i_header_size ) ;
}
else {
assert ( p_sys -> i_type == TYPE_LOAS ) ;
if ( block_PeekBytes ( & p_sys -> bytestream , p_header , LOAS_HEADER_SIZE ) != VLC_SUCCESS ) return NULL ;
p_sys -> i_frame_size = LOASSyncInfo ( p_header , & p_sys -> i_header_size ) ;
}
if ( p_sys -> i_frame_size <= 0 ) {
msg_Dbg ( p_dec , "emulated sync word" ) ;
block_SkipByte ( & p_sys -> bytestream ) ;
p_sys -> i_state = STATE_NOSYNC ;
break ;
}
p_sys -> i_state = STATE_NEXT_SYNC ;
case STATE_NEXT_SYNC : if ( p_sys -> bytestream . p_block == NULL ) {
p_sys -> i_state = STATE_NOSYNC ;
block_BytestreamFlush ( & p_sys -> bytestream ) ;
return NULL ;
}
if ( block_PeekOffsetBytes ( & p_sys -> bytestream , p_sys -> i_frame_size + p_sys -> i_header_size , p_header , 2 ) != VLC_SUCCESS ) return NULL ;
assert ( ( p_sys -> i_type == TYPE_ADTS ) || ( p_sys -> i_type == TYPE_LOAS ) ) ;
if ( ( ( p_sys -> i_type == TYPE_ADTS ) && ( p_header [ 0 ] != 0xff || ( p_header [ 1 ] & 0xf6 ) != 0xf0 ) ) || ( ( p_sys -> i_type == TYPE_LOAS ) && ( p_header [ 0 ] != 0x56 || ( p_header [ 1 ] & 0xe0 ) != 0xe0 ) ) ) {
msg_Dbg ( p_dec , "emulated sync word " "(no sync on following frame)" ) ;
p_sys -> i_state = STATE_NOSYNC ;
block_SkipByte ( & p_sys -> bytestream ) ;
break ;
}
p_sys -> i_state = STATE_SEND_DATA ;
break ;
case STATE_GET_DATA : if ( block_WaitBytes ( & p_sys -> bytestream , p_sys -> i_frame_size + p_sys -> i_header_size ) != VLC_SUCCESS ) return NULL ;
p_sys -> i_state = STATE_SEND_DATA ;
case STATE_SEND_DATA : p_out_buffer = block_Alloc ( p_sys -> i_frame_size ) ;
if ( ! p_out_buffer ) {
return NULL ;
}
p_buf = p_out_buffer -> p_buffer ;
block_SkipBytes ( & p_sys -> bytestream , p_sys -> i_header_size ) ;
if ( p_sys -> i_type == TYPE_ADTS ) {
block_GetBytes ( & p_sys -> bytestream , p_buf , p_sys -> i_frame_size ) ;
}
else {
assert ( p_sys -> i_type == TYPE_LOAS ) ;
block_GetBytes ( & p_sys -> bytestream , p_buf , p_sys -> i_frame_size ) ;
p_out_buffer -> i_buffer = LOASParse ( p_dec , p_buf , p_sys -> i_frame_size ) ;
if ( p_out_buffer -> i_buffer <= 0 ) {
if ( ! p_sys -> b_latm_cfg ) msg_Warn ( p_dec , "waiting for header" ) ;
block_Release ( p_out_buffer ) ;
p_out_buffer = NULL ;
p_sys -> i_state = STATE_NOSYNC ;
break ;
}
}
SetupOutput ( p_dec , p_out_buffer ) ;
if ( p_sys -> i_pts == p_sys -> bytestream . p_block -> i_pts ) p_sys -> i_pts = p_sys -> bytestream . p_block -> i_pts = VLC_TS_INVALID ;
* pp_block = block_BytestreamPop ( & p_sys -> bytestream ) ;
p_sys -> i_state = STATE_NOSYNC ;
return p_out_buffer ;
}
}
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int cirrus_vga_read_sr ( CirrusVGAState * s ) {
switch ( s -> vga . sr_index ) {
case 0x00 : case 0x01 : case 0x02 : case 0x03 : case 0x04 : return s -> vga . sr [ s -> vga . sr_index ] ;
case 0x06 : return s -> vga . sr [ s -> vga . sr_index ] ;
case 0x10 : case 0x30 : case 0x50 : case 0x70 : case 0x90 : case 0xb0 : case 0xd0 : case 0xf0 : return s -> vga . sr [ 0x10 ] ;
case 0x11 : case 0x31 : case 0x51 : case 0x71 : case 0x91 : case 0xb1 : case 0xd1 : case 0xf1 : return s -> vga . sr [ 0x11 ] ;
case 0x05 : case 0x07 : case 0x08 : case 0x09 : case 0x0a : case 0x0b : case 0x0c : case 0x0d : case 0x0e : case 0x0f : case 0x12 : case 0x13 : case 0x14 : case 0x15 : case 0x16 : case 0x17 : case 0x18 : case 0x19 : case 0x1a : case 0x1b : case 0x1c : case 0x1d : case 0x1e : case 0x1f : # ifdef DEBUG_CIRRUS printf ( "cirrus: handled inport sr_index %02x\n" , s -> vga . sr_index ) ;
# endif return s -> vga . sr [ s -> vga . sr_index ] ;
default : # ifdef DEBUG_CIRRUS printf ( "cirrus: inport sr_index %02x\n" , s -> vga . sr_index ) ;
# endif return 0xff ;
break ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int build_def_list ( Picture * def , Picture * * in , int len , int is_long , int sel ) {
int i [ 2 ] = {
0 }
;
int index = 0 ;
while ( i [ 0 ] < len || i [ 1 ] < len ) {
while ( i [ 0 ] < len && ! ( in [ i [ 0 ] ] && ( in [ i [ 0 ] ] -> reference & sel ) ) ) i [ 0 ] ++ ;
while ( i [ 1 ] < len && ! ( in [ i [ 1 ] ] && ( in [ i [ 1 ] ] -> reference & ( sel ^ 3 ) ) ) ) i [ 1 ] ++ ;
if ( i [ 0 ] < len ) {
in [ i [ 0 ] ] -> pic_id = is_long ? i [ 0 ] : in [ i [ 0 ] ] -> frame_num ;
split_field_copy ( & def [ index ++ ] , in [ i [ 0 ] ++ ] , sel , 1 ) ;
}
if ( i [ 1 ] < len ) {
in [ i [ 1 ] ] -> pic_id = is_long ? i [ 1 ] : in [ i [ 1 ] ] -> frame_num ;
split_field_copy ( & def [ index ++ ] , in [ i [ 1 ] ++ ] , sel ^ 3 , 0 ) ;
}
}
return index ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static bool fts_build_body_begin ( struct fts_mail_build_context * ctx , struct message_part * part , bool * binary_body_r ) {
struct mail_storage * storage ;
const char * content_type ;
struct fts_backend_build_key key ;
i_assert ( ctx -> body_parser == NULL ) ;
* binary_body_r = FALSE ;
i_zero ( & key ) ;
key . uid = ctx -> mail -> uid ;
key . part = part ;
content_type = ctx -> content_type != NULL ? ctx -> content_type : "text/plain" ;
if ( strncmp ( content_type , "multipart/" , 10 ) == 0 ) {
return FALSE ;
}
storage = mailbox_get_storage ( ctx -> mail -> box ) ;
if ( fts_parser_init ( mail_storage_get_user ( storage ) , content_type , ctx -> content_disposition , & ctx -> body_parser ) ) {
* binary_body_r = TRUE ;
key . type = FTS_BACKEND_BUILD_KEY_BODY_PART ;
}
else if ( strncmp ( content_type , "text/" , 5 ) == 0 || strncmp ( content_type , "message/" , 8 ) == 0 ) {
key . type = FTS_BACKEND_BUILD_KEY_BODY_PART ;
ctx -> body_parser = fts_parser_text_init ( ) ;
}
else {
if ( ( ctx -> update_ctx -> backend -> flags & FTS_BACKEND_FLAG_BINARY_MIME_PARTS ) == 0 ) return FALSE ;
* binary_body_r = TRUE ;
key . type = FTS_BACKEND_BUILD_KEY_BODY_PART_BINARY ;
}
key . body_content_type = content_type ;
key . body_content_disposition = ctx -> content_disposition ;
ctx -> cur_user_lang = NULL ;
if ( ! fts_backend_update_set_build_key ( ctx -> update_ctx , & key ) ) {
if ( ctx -> body_parser != NULL ) ( void ) fts_parser_deinit ( & ctx -> body_parser ) ;
return FALSE ;
}
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int dissect_h245_Capability ( 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_Capability , Capability_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserCloseBeforeUnloadCancel ) {
NavigateToDataURL ( BEFORE_UNLOAD_HTML , "beforeunload" ) ;
chrome : : CloseWindow ( browser ( ) ) ;
base : : string16 expected_title = base : : ASCIIToUTF16 ( "cancelled" ) ;
content : : TitleWatcher title_watcher ( browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) , expected_title ) ;
ClickModalDialogButton ( false ) ;
ASSERT_EQ ( expected_title , title_watcher . WaitAndGetTitle ( ) ) ;
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 | static int vorbis_parse_audio_packet ( vorbis_context * vc , float * * floor_ptr ) {
GetBitContext * gb = & vc -> gb ;
FFTContext * mdct ;
unsigned previous_window = vc -> previous_window ;
unsigned mode_number , blockflag , blocksize ;
int i , j ;
uint8_t no_residue [ 255 ] ;
uint8_t do_not_decode [ 255 ] ;
vorbis_mapping * mapping ;
float * ch_res_ptr = vc -> channel_residues ;
uint8_t res_chan [ 255 ] ;
unsigned res_num = 0 ;
int retlen = 0 ;
unsigned ch_left = vc -> audio_channels ;
unsigned vlen ;
if ( get_bits1 ( gb ) ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Not a Vorbis I audio packet.\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( vc -> mode_count == 1 ) {
mode_number = 0 ;
}
else {
GET_VALIDATED_INDEX ( mode_number , ilog ( vc -> mode_count - 1 ) , vc -> mode_count ) }
vc -> mode_number = mode_number ;
mapping = & vc -> mappings [ vc -> modes [ mode_number ] . mapping ] ;
av_dlog ( NULL , " Mode number: %u , mapping: %d , blocktype %d\n" , mode_number , vc -> modes [ mode_number ] . mapping , vc -> modes [ mode_number ] . blockflag ) ;
blockflag = vc -> modes [ mode_number ] . blockflag ;
blocksize = vc -> blocksize [ blockflag ] ;
vlen = blocksize / 2 ;
if ( blockflag ) {
previous_window = get_bits ( gb , 1 ) ;
skip_bits1 ( gb ) ;
}
memset ( ch_res_ptr , 0 , sizeof ( float ) * vc -> audio_channels * vlen ) ;
for ( i = 0 ;
i < vc -> audio_channels ;
++ i ) memset ( floor_ptr [ i ] , 0 , vlen * sizeof ( floor_ptr [ 0 ] [ 0 ] ) ) ;
for ( i = 0 ;
i < vc -> audio_channels ;
++ i ) {
vorbis_floor * floor ;
int ret ;
if ( mapping -> submaps > 1 ) {
floor = & vc -> floors [ mapping -> submap_floor [ mapping -> mux [ i ] ] ] ;
}
else {
floor = & vc -> floors [ mapping -> submap_floor [ 0 ] ] ;
}
ret = floor -> decode ( vc , & floor -> data , floor_ptr [ i ] ) ;
if ( ret < 0 ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Invalid codebook in vorbis_floor_decode.\n" ) ;
return AVERROR_INVALIDDATA ;
}
no_residue [ i ] = ret ;
}
for ( i = mapping -> coupling_steps - 1 ;
i >= 0 ;
-- i ) {
if ( ! ( no_residue [ mapping -> magnitude [ i ] ] & no_residue [ mapping -> angle [ i ] ] ) ) {
no_residue [ mapping -> magnitude [ i ] ] = 0 ;
no_residue [ mapping -> angle [ i ] ] = 0 ;
}
}
for ( i = 0 ;
i < mapping -> submaps ;
++ i ) {
vorbis_residue * residue ;
unsigned ch = 0 ;
int ret ;
for ( j = 0 ;
j < vc -> audio_channels ;
++ j ) {
if ( ( mapping -> submaps == 1 ) || ( i == mapping -> mux [ j ] ) ) {
res_chan [ j ] = res_num ;
if ( no_residue [ j ] ) {
do_not_decode [ ch ] = 1 ;
}
else {
do_not_decode [ ch ] = 0 ;
}
++ ch ;
++ res_num ;
}
}
residue = & vc -> residues [ mapping -> submap_residue [ i ] ] ;
if ( ch_left < ch ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Too many channels in vorbis_floor_decode.\n" ) ;
return - 1 ;
}
if ( ch ) {
ret = vorbis_residue_decode ( vc , residue , ch , do_not_decode , ch_res_ptr , vlen , ch_left ) ;
if ( ret < 0 ) return ret ;
}
ch_res_ptr += ch * vlen ;
ch_left -= ch ;
}
if ( ch_left > 0 ) return AVERROR_INVALIDDATA ;
for ( i = mapping -> coupling_steps - 1 ;
i >= 0 ;
-- i ) {
float * mag , * ang ;
mag = vc -> channel_residues + res_chan [ mapping -> magnitude [ i ] ] * blocksize / 2 ;
ang = vc -> channel_residues + res_chan [ mapping -> angle [ i ] ] * blocksize / 2 ;
vc -> dsp . vorbis_inverse_coupling ( mag , ang , blocksize / 2 ) ;
}
mdct = & vc -> mdct [ blockflag ] ;
for ( j = vc -> audio_channels - 1 ;
j >= 0 ;
j -- ) {
ch_res_ptr = vc -> channel_residues + res_chan [ j ] * blocksize / 2 ;
vc -> fdsp . vector_fmul ( floor_ptr [ j ] , floor_ptr [ j ] , ch_res_ptr , blocksize / 2 ) ;
mdct -> imdct_half ( mdct , ch_res_ptr , floor_ptr [ j ] ) ;
}
retlen = ( blocksize + vc -> blocksize [ previous_window ] ) / 4 ;
for ( j = 0 ;
j < vc -> audio_channels ;
j ++ ) {
unsigned bs0 = vc -> blocksize [ 0 ] ;
unsigned bs1 = vc -> blocksize [ 1 ] ;
float * residue = vc -> channel_residues + res_chan [ j ] * blocksize / 2 ;
float * saved = vc -> saved + j * bs1 / 4 ;
float * ret = floor_ptr [ j ] ;
float * buf = residue ;
const float * win = vc -> win [ blockflag & previous_window ] ;
if ( blockflag == previous_window ) {
vc -> fdsp . vector_fmul_window ( ret , saved , buf , win , blocksize / 4 ) ;
}
else if ( blockflag > previous_window ) {
vc -> fdsp . vector_fmul_window ( ret , saved , buf , win , bs0 / 4 ) ;
memcpy ( ret + bs0 / 2 , buf + bs0 / 4 , ( ( bs1 - bs0 ) / 4 ) * sizeof ( float ) ) ;
}
else {
memcpy ( ret , saved , ( ( bs1 - bs0 ) / 4 ) * sizeof ( float ) ) ;
vc -> fdsp . vector_fmul_window ( ret + ( bs1 - bs0 ) / 4 , saved + ( bs1 - bs0 ) / 4 , buf , win , bs0 / 4 ) ;
}
memcpy ( saved , buf + blocksize / 4 , blocksize / 4 * sizeof ( float ) ) ;
}
vc -> previous_window = blockflag ;
return retlen ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static struct evhttp * http_setup ( short * pport , struct event_base * base ) {
int i ;
struct evhttp * myhttp ;
short port = - 1 ;
myhttp = evhttp_new ( base ) ;
for ( i = 0 ;
i < 50 ;
++ i ) {
if ( evhttp_bind_socket ( myhttp , "127.0.0.1" , 8080 + i ) != - 1 ) {
port = 8080 + i ;
break ;
}
}
if ( port == - 1 ) event_errx ( 1 , "Could not start web server" ) ;
evhttp_set_cb ( myhttp , "/test" , http_basic_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/chunked" , http_chunked_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/postit" , http_post_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/largedelay" , http_large_delay_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/badrequest" , http_badreq_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/" , http_dispatcher_cb , NULL ) ;
* pport = port ;
return ( myhttp ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void xsltSetLoaderFunc ( xsltDocLoaderFunc f ) {
if ( f == NULL ) xsltDocDefaultLoader = xsltDocDefaultLoaderFunc ;
else xsltDocDefaultLoader = f ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int check_authenticated_user_and_ip ( int userid , struct query * q ) {
int res = check_user_and_ip ( userid , q ) ;
if ( res ) return res ;
if ( ! users [ userid ] . authenticated ) return 1 ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | gboolean k12_dump_open ( wtap_dumper * wdh , int * err ) {
k12_dump_t * k12 ;
if ( ! wtap_dump_file_write ( wdh , k12_file_magic , 8 , err ) ) {
return FALSE ;
}
if ( wtap_dump_file_seek ( wdh , K12_FILE_HDR_LEN , SEEK_SET , err ) == - 1 ) return FALSE ;
wdh -> subtype_write = k12_dump ;
wdh -> subtype_finish = k12_dump_finish ;
k12 = ( k12_dump_t * ) g_malloc ( sizeof ( k12_dump_t ) ) ;
wdh -> priv = ( void * ) k12 ;
k12 -> file_len = K12_FILE_HDR_LEN ;
k12 -> num_of_records = 0 ;
k12 -> file_offset = K12_FILE_HDR_LEN ;
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | struct im_connection * purple_ic_by_pa ( PurpleAccount * pa ) {
GSList * i ;
struct purple_data * pd ;
for ( i = purple_connections ;
i ;
i = i -> next ) {
pd = ( ( struct im_connection * ) i -> data ) -> proto_data ;
if ( pd -> account == pa ) {
return i -> data ;
}
}
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int qemuAssignDeviceMemoryAlias ( virDomainDefPtr def , virDomainMemoryDefPtr mem ) {
size_t i ;
int maxidx = 0 ;
int idx ;
for ( i = 0 ;
i < def -> nmems ;
i ++ ) {
if ( ( idx = qemuDomainDeviceAliasIndex ( & def -> mems [ i ] -> info , "dimm" ) ) >= maxidx ) maxidx = idx + 1 ;
}
if ( virAsprintf ( & mem -> info . alias , "dimm%d" , maxidx ) < 0 ) return - 1 ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( PrefsFunctionalTest , TestDownloadDirPref ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
base : : ScopedAllowBlockingForTesting allow_blocking ;
base : : ScopedTempDir new_download_dir ;
ASSERT_TRUE ( new_download_dir . CreateUniqueTempDir ( ) ) ;
base : : FilePath downloaded_pkg = new_download_dir . GetPath ( ) . AppendASCII ( "a_zip_file.zip" ) ;
browser ( ) -> profile ( ) -> GetPrefs ( ) -> SetFilePath ( prefs : : kDownloadDefaultDirectory , new_download_dir . GetPath ( ) ) ;
std : : unique_ptr < content : : DownloadTestObserver > downloads_observer ( CreateWaiter ( browser ( ) , 1 ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/downloads/a_zip_file.zip" ) ) ;
downloads_observer -> WaitForFinished ( ) ;
EXPECT_TRUE ( base : : PathExists ( downloaded_pkg ) ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void lower_mv_precision ( MV * mv , int allow_hp ) {
const int use_hp = allow_hp && vp9_use_mv_hp ( mv ) ;
if ( ! use_hp ) {
if ( mv -> row & 1 ) mv -> row += ( mv -> row > 0 ? - 1 : 1 ) ;
if ( mv -> col & 1 ) mv -> col += ( mv -> col > 0 ? - 1 : 1 ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static GList * completion_joinlist ( GList * list1 , GList * list2 ) {
GList * old ;
old = list2 ;
while ( list2 != NULL ) {
if ( ! glist_find_icase_string ( list1 , list2 -> data ) ) list1 = g_list_append ( list1 , list2 -> data ) ;
else g_free ( list2 -> data ) ;
list2 = list2 -> next ;
}
g_list_free ( old ) ;
return list1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | hb_bool_t hb_set_set_user_data ( hb_set_t * set , hb_user_data_key_t * key , void * data , hb_destroy_func_t destroy , hb_bool_t replace ) {
return hb_object_set_user_data ( set , key , data , destroy , replace ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_SET_SIZE_1_256_OF_Q2931Address ( 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_Q2931Address , SET_SIZE_1_256_OF_Q2931Address_set_of , 1 , 256 , FALSE ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_sad ## m ## x ## n ## x ## k ## _c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < k ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , & ref [ i ] , ref_stride ) ;
\ }
# define sadMxNx4D ( m , n ) void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void ff_h264_pred_direct_motion ( H264Context * const h , int * mb_type ) {
if ( h -> direct_spatial_mv_pred ) {
pred_spatial_direct_motion ( h , mb_type ) ;
}
else {
pred_temp_direct_motion ( h , mb_type ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void destroy_int_fifo ( int_fifo * fifo ) {
int_node * i_n ;
if ( fifo != NULL ) {
do {
UNLINK_FIFO ( i_n , * fifo , link ) ;
if ( i_n != NULL ) free ( i_n ) ;
}
while ( i_n != NULL ) ;
free ( fifo ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int total_adj_weak_thresh ( BLOCK_SIZE bs , int increase_denoising ) {
return widths [ bs ] * heights [ bs ] * ( increase_denoising ? 3 : 2 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ProtocolHandlerRegistryTest , MAYBE_TestClearDefaultGetsPropagatedToIO ) {
std : : string scheme ( "mailto" ) ;
ProtocolHandler ph1 = CreateProtocolHandler ( scheme , "test1" ) ;
registry ( ) -> OnAcceptRegisterProtocolHandler ( ph1 ) ;
registry ( ) -> ClearDefault ( scheme ) ;
scoped_ptr < ProtocolHandlerRegistry : : JobInterceptorFactory > interceptor ( registry ( ) -> CreateJobInterceptorFactory ( ) ) ;
AssertWillHandle ( scheme , false , interceptor . get ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gpgme_error_t add_io_cb ( engine_uiserver_t uiserver , iocb_data_t * iocbd , gpgme_io_cb_t handler ) {
gpgme_error_t err ;
TRACE_BEG2 ( DEBUG_ENGINE , "engine-uiserver:add_io_cb" , uiserver , "fd %d, dir %d" , iocbd -> fd , iocbd -> dir ) ;
err = ( * uiserver -> io_cbs . add ) ( uiserver -> io_cbs . add_priv , iocbd -> fd , iocbd -> dir , handler , iocbd -> data , & iocbd -> tag ) ;
if ( err ) return TRACE_ERR ( err ) ;
if ( ! iocbd -> dir ) err = _gpgme_io_set_nonblocking ( iocbd -> fd ) ;
return TRACE_ERR ( err ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static __inline__ void TLV_LIST_STEP ( struct tlv_list_desc * list ) {
__u16 tlv_space = TLV_ALIGN ( ntohs ( list -> tlv_ptr -> tlv_len ) ) ;
list -> tlv_ptr = ( struct tlv_desc * ) ( ( char * ) list -> tlv_ptr + tlv_space ) ;
list -> tlv_space -= tlv_space ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_ReleaseComplete_UUIE ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 525 "./asn1/h225/h225.cnf" h225_packet_info * h225_pi ;
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_ReleaseComplete_UUIE , ReleaseComplete_UUIE_sequence ) ;
# line 529 "./asn1/h225/h225.cnf" h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
h225_pi -> cs_type = H225_RELEASE_COMPLET ;
g_snprintf ( h225_pi -> frame_label , 50 , "%s" , val_to_str ( h225_pi -> cs_type , T_h323_message_body_vals , "<unknown>" ) ) ;
}
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | const char * http_hdr_reason_get ( HTTPHdrImpl * hh , int * length ) {
ink_assert ( hh -> m_polarity == HTTP_TYPE_RESPONSE ) ;
* length = hh -> u . resp . m_len_reason ;
return ( hh -> u . resp . m_ptr_reason ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void srtp_add_address ( packet_info * pinfo , address * addr , int port , int other_port , const gchar * setup_method , guint32 setup_frame_number , gboolean is_video _U_ , rtp_dyn_payload_t * rtp_dyn_payload , struct srtp_info * srtp_info ) {
address null_addr ;
conversation_t * p_conv ;
struct _rtp_conversation_info * p_conv_data = NULL ;
if ( ( pinfo -> fd -> flags . visited ) || ( rtp_handle == NULL ) ) {
return ;
}
DPRINT ( ( "#%u: %srtp_add_address(%s, %u, %u, %s, %u)" , pinfo -> fd -> num , ( srtp_info ) ? "s" : "" , ep_address_to_str ( addr ) , port , other_port , setup_method , setup_frame_number ) ) ;
DINDENT ( ) ;
SET_ADDRESS ( & null_addr , AT_NONE , 0 , NULL ) ;
p_conv = find_conversation ( setup_frame_number , addr , & null_addr , PT_UDP , port , other_port , NO_ADDR_B | ( ! other_port ? NO_PORT_B : 0 ) ) ;
DENDENT ( ) ;
DPRINT ( ( "did %sfind conversation" , p_conv ? "" : "NOT " ) ) ;
if ( ! p_conv || p_conv -> setup_frame != setup_frame_number ) {
p_conv = conversation_new ( setup_frame_number , addr , & null_addr , PT_UDP , ( guint32 ) port , ( guint32 ) other_port , NO_ADDR2 | ( ! other_port ? NO_PORT2 : 0 ) ) ;
}
conversation_set_dissector ( p_conv , rtp_handle ) ;
p_conv_data = ( struct _rtp_conversation_info * ) conversation_get_proto_data ( p_conv , proto_rtp ) ;
if ( ! p_conv_data ) {
DPRINT ( ( "creating new conversation data" ) ) ;
p_conv_data = wmem_new ( wmem_file_scope ( ) , struct _rtp_conversation_info ) ;
p_conv_data -> rtp_dyn_payload = NULL ;
p_conv_data -> extended_seqno = 0x10000 ;
p_conv_data -> rtp_conv_info = wmem_new ( wmem_file_scope ( ) , rtp_private_conv_info ) ;
p_conv_data -> rtp_conv_info -> multisegment_pdus = wmem_tree_new ( wmem_file_scope ( ) ) ;
DINDENT ( ) ;
conversation_add_proto_data ( p_conv , proto_rtp , p_conv_data ) ;
DENDENT ( ) ;
}
# ifdef DEBUG_CONVERSATION else {
DPRINT ( ( "conversation already exists" ) ) ;
}
# endif if ( p_conv_data -> rtp_dyn_payload != rtp_dyn_payload ) {
rtp_dyn_payload_free ( p_conv_data -> rtp_dyn_payload ) ;
p_conv_data -> rtp_dyn_payload = rtp_dyn_payload_ref ( rtp_dyn_payload ) ;
}
else {
DPRINT ( ( "passed-in rtp_dyn_payload is the same as in the conversation" ) ) ;
}
g_strlcpy ( p_conv_data -> method , setup_method , MAX_RTP_SETUP_METHOD_SIZE + 1 ) ;
p_conv_data -> frame_number = setup_frame_number ;
p_conv_data -> is_video = is_video ;
p_conv_data -> srtp_info = srtp_info ;
p_conv_data -> bta2dp_info = NULL ;
p_conv_data -> btvdp_info = NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int ipvideo_decode_block_opcode_0x6 ( IpvideoContext * s ) {
av_log ( s -> avctx , AV_LOG_ERROR , " Interplay video: Help! Mystery opcode 0x6 seen\n" ) ;
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static inline MagickRealType GetPixelLuminance ( const Image * restrict image , const Quantum * restrict pixel ) {
MagickRealType blue , green , red ;
if ( image -> colorspace == GRAYColorspace ) return ( ( MagickRealType ) pixel [ image -> channel_map [ GrayPixelChannel ] . offset ] ) ;
if ( image -> colorspace != sRGBColorspace ) return ( 0.212656f * pixel [ image -> channel_map [ RedPixelChannel ] . offset ] + 0.715158f * pixel [ image -> channel_map [ GreenPixelChannel ] . offset ] + 0.072186f * pixel [ image -> channel_map [ BluePixelChannel ] . offset ] ) ;
red = DecodePixelGamma ( ( MagickRealType ) pixel [ image -> channel_map [ RedPixelChannel ] . offset ] ) ;
green = DecodePixelGamma ( ( MagickRealType ) pixel [ image -> channel_map [ GreenPixelChannel ] . offset ] ) ;
blue = DecodePixelGamma ( ( MagickRealType ) pixel [ image -> channel_map [ BluePixelChannel ] . offset ] ) ;
return ( 0.212656f * red + 0.715158f * green + 0.072186f * blue ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static jas_image_cmpt_t * jas_image_cmpt_create ( uint_fast32_t tlx , uint_fast32_t tly , uint_fast32_t hstep , uint_fast32_t vstep , uint_fast32_t width , uint_fast32_t height , uint_fast16_t depth , bool sgnd , uint_fast32_t inmem ) {
jas_image_cmpt_t * cmpt ;
long size ;
if ( ! ( cmpt = jas_malloc ( sizeof ( jas_image_cmpt_t ) ) ) ) {
return 0 ;
}
cmpt -> type_ = JAS_IMAGE_CT_UNKNOWN ;
cmpt -> tlx_ = tlx ;
cmpt -> tly_ = tly ;
cmpt -> hstep_ = hstep ;
cmpt -> vstep_ = vstep ;
cmpt -> width_ = width ;
cmpt -> height_ = height ;
cmpt -> prec_ = depth ;
cmpt -> sgnd_ = sgnd ;
cmpt -> stream_ = 0 ;
cmpt -> cps_ = ( depth + 7 ) / 8 ;
size = cmpt -> width_ * cmpt -> height_ * cmpt -> cps_ ;
cmpt -> stream_ = ( inmem ) ? jas_stream_memopen ( 0 , size ) : jas_stream_tmpfile ( ) ;
if ( ! cmpt -> stream_ ) {
jas_image_cmpt_destroy ( cmpt ) ;
return 0 ;
}
if ( jas_stream_seek ( cmpt -> stream_ , size - 1 , SEEK_SET ) < 0 || jas_stream_putc ( cmpt -> stream_ , 0 ) == EOF || jas_stream_seek ( cmpt -> stream_ , 0 , SEEK_SET ) < 0 ) {
jas_image_cmpt_destroy ( cmpt ) ;
return 0 ;
}
return cmpt ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int SpoolssEnumForms_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) {
dcerpc_call_value * dcv = ( dcerpc_call_value * ) di -> call_data ;
BUFFER buffer ;
guint32 level = GPOINTER_TO_UINT ( dcv -> se_data ) , i , count ;
int buffer_offset ;
proto_item * hidden_item ;
hidden_item = proto_tree_add_uint ( tree , hf_form , tvb , offset , 0 , 1 ) ;
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
offset = dissect_spoolss_buffer ( tvb , offset , pinfo , tree , di , drep , & buffer ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_needed , NULL ) ;
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", level %d" , level ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_enumforms_num , & count ) ;
buffer_offset = 0 ;
for ( i = 0 ;
i < count ;
i ++ ) {
int struct_start = buffer_offset ;
buffer_offset = dissect_FORM_REL ( buffer . tvb , buffer_offset , pinfo , buffer . tree , di , drep , struct_start ) ;
}
offset = dissect_doserror ( tvb , offset , pinfo , tree , di , drep , hf_rc , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void pushfogio ( IO * wrapper , FILE * fog ) {
_IO * io = calloc ( 1 , sizeof ( _IO ) ) ;
io -> prev = wrapper -> top ;
io -> fog = fog ;
io -> backedup = EOF ;
io -> cnt = 1 ;
io -> isloop = false ;
wrapper -> top = io ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int scannum ( struct vars * v ) {
int n = 0 ;
while ( SEE ( DIGIT ) && n < DUPMAX ) {
n = n * 10 + v -> nextvalue ;
NEXT ( ) ;
}
if ( SEE ( DIGIT ) || n > DUPMAX ) {
ERR ( REG_BADBR ) ;
return 0 ;
}
return n ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int storesid ( struct alltabs * at , const char * str ) {
int i ;
FILE * news ;
const char * pt ;
long pos ;
if ( str != NULL ) {
for ( i = 0 ;
cffnames [ i ] != NULL ;
++ i ) {
if ( strcmp ( cffnames [ i ] , str ) == 0 ) return ( i ) ;
}
}
pos = ftell ( at -> sidf ) + 1 ;
if ( pos >= 65536 && ! at -> sidlongoffset ) {
at -> sidlongoffset = true ;
news = tmpfile ( ) ;
rewind ( at -> sidh ) ;
for ( i = 0 ;
i < at -> sidcnt ;
++ i ) putlong ( news , getushort ( at -> sidh ) ) ;
fclose ( at -> sidh ) ;
at -> sidh = news ;
}
if ( at -> sidlongoffset ) putlong ( at -> sidh , pos ) ;
else putshort ( at -> sidh , pos ) ;
if ( str != NULL ) {
for ( pt = str ;
* pt ;
++ pt ) putc ( * pt , at -> sidf ) ;
}
return ( at -> sidcnt ++ + nStdStrings ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void parseDiagnosticInfo ( proto_tree * tree , tvbuff_t * tvb , packet_info * pinfo , gint * pOffset , const char * szFieldName ) {
static const int * diag_mask [ ] = {
& hf_opcua_diag_mask_symbolicflag , & hf_opcua_diag_mask_namespaceflag , & hf_opcua_diag_mask_localizedtextflag , & hf_opcua_diag_mask_localeflag , & hf_opcua_diag_mask_additionalinfoflag , & hf_opcua_diag_mask_innerstatuscodeflag , & hf_opcua_diag_mask_innerdiaginfoflag , NULL }
;
gint iOffset = * pOffset ;
guint8 EncodingMask ;
proto_tree * subtree ;
proto_item * ti ;
guint opcua_nested_count ;
subtree = proto_tree_add_subtree_format ( tree , tvb , * pOffset , - 1 , ett_opcua_diagnosticinfo , & ti , "%s: DiagnosticInfo" , szFieldName ) ;
opcua_nested_count = GPOINTER_TO_UINT ( p_get_proto_data ( pinfo -> pool , pinfo , proto_opcua , 0 ) ) ;
if ( ++ opcua_nested_count > MAX_NESTING_DEPTH ) {
expert_add_info ( pinfo , ti , & ei_nesting_depth ) ;
return ;
}
p_add_proto_data ( pinfo -> pool , pinfo , proto_opcua , 0 , GUINT_TO_POINTER ( opcua_nested_count ) ) ;
EncodingMask = tvb_get_guint8 ( tvb , iOffset ) ;
proto_tree_add_bitmask ( subtree , tvb , iOffset , hf_opcua_diag_mask , ett_opcua_diagnosticinfo_encodingmask , diag_mask , ENC_LITTLE_ENDIAN ) ;
iOffset ++ ;
if ( EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_SYMBOLICID_FLAG ) {
parseInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_diag_symbolicid ) ;
}
if ( EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_NAMESPACE_FLAG ) {
parseInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_diag_namespace ) ;
}
if ( EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_LOCALIZEDTEXT_FLAG ) {
parseInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_diag_localizedtext ) ;
}
if ( EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_LOCALE_FLAG ) {
parseInt32 ( subtree , tvb , pinfo , & iOffset , hf_opcua_diag_locale ) ;
}
if ( EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_ADDITIONALINFO_FLAG ) {
parseString ( subtree , tvb , pinfo , & iOffset , hf_opcua_diag_additionalinfo ) ;
}
if ( EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_INNERSTATUSCODE_FLAG ) {
parseStatusCode ( subtree , tvb , pinfo , & iOffset , hf_opcua_diag_innerstatuscode ) ;
}
if ( EncodingMask & DIAGNOSTICINFO_ENCODINGMASK_INNERDIAGNOSTICINFO_FLAG ) {
parseDiagnosticInfo ( subtree , tvb , pinfo , & iOffset , "Inner DiagnosticInfo" ) ;
}
proto_item_set_end ( ti , tvb , iOffset ) ;
* pOffset = iOffset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int rtp_packetize_h263 ( sout_stream_id_sys_t * id , block_t * in ) {
uint8_t * p_data = in -> p_buffer ;
int i_data = in -> i_buffer ;
int i ;
int i_max = rtp_mtu ( id ) - RTP_H263_HEADER_SIZE ;
int i_count ;
int b_p_bit ;
int b_v_bit = 0 ;
int i_plen = 0 ;
int i_pebit = 0 ;
uint16_t h ;
if ( i_data < 2 ) {
block_Release ( in ) ;
return VLC_EGENERIC ;
}
if ( p_data [ 0 ] || p_data [ 1 ] ) {
block_Release ( in ) ;
return VLC_EGENERIC ;
}
p_data += 2 ;
i_data -= 2 ;
i_count = ( i_data + i_max - 1 ) / i_max ;
for ( i = 0 ;
i < i_count ;
i ++ ) {
int i_payload = __MIN ( i_max , i_data ) ;
block_t * out = block_Alloc ( RTP_H263_PAYLOAD_START + i_payload ) ;
b_p_bit = ( i == 0 ) ? 1 : 0 ;
h = ( b_p_bit << 10 ) | ( b_v_bit << 9 ) | ( i_plen << 3 ) | i_pebit ;
rtp_packetize_common ( id , out , ( i == i_count - 1 ) ? 1 : 0 , in -> i_pts > VLC_TS_INVALID ? in -> i_pts : in -> i_dts ) ;
SetWBE ( out -> p_buffer + 12 , h ) ;
memcpy ( & out -> p_buffer [ RTP_H263_PAYLOAD_START ] , p_data , i_payload ) ;
out -> i_dts = in -> i_dts + i * in -> i_length / i_count ;
out -> i_length = in -> i_length / i_count ;
rtp_packetize_send ( id , out ) ;
p_data += i_payload ;
i_data -= i_payload ;
}
block_Release ( in ) ;
return VLC_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static FormInfo * AddFormInfo ( char * value , char * contenttype , FormInfo * parent_form_info ) {
FormInfo * form_info ;
form_info = calloc ( 1 , sizeof ( struct FormInfo ) ) ;
if ( form_info ) {
if ( value ) form_info -> value = value ;
if ( contenttype ) form_info -> contenttype = contenttype ;
form_info -> flags = HTTPPOST_FILENAME ;
}
else return NULL ;
if ( parent_form_info ) {
form_info -> more = parent_form_info -> more ;
parent_form_info -> more = form_info ;
}
return form_info ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_coap_opt_location_path ( tvbuff_t * tvb , proto_item * head_item , proto_tree * subtree , gint offset , gint opt_length , int hf ) {
const guint8 * str = NULL ;
if ( opt_length == 0 ) {
str = nullstr ;
}
else {
str = tvb_get_string_enc ( wmem_packet_scope ( ) , tvb , offset , opt_length , ENC_ASCII ) ;
}
proto_tree_add_string ( subtree , hf , tvb , offset , opt_length , str ) ;
proto_item_append_text ( head_item , ": %s" , str ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_T_h245Routing ( 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_h225_T_h245Routing , T_h245Routing_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | SPL_METHOD ( SplFileInfo , getLinkTarget ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
int ret ;
char buff [ MAXPATHLEN ] ;
zend_error_handling error_handling ;
if ( zend_parse_parameters_none ( ) == FAILURE ) {
return ;
}
zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ;
# if defined ( PHP_WIN32 ) || HAVE_SYMLINK if ( intern -> file_name == NULL ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "Empty filename" ) ;
RETURN_FALSE ;
}
else if ( ! IS_ABSOLUTE_PATH ( intern -> file_name , intern -> file_name_len ) ) {
char expanded_path [ MAXPATHLEN ] ;
if ( ! expand_filepath_with_mode ( intern -> file_name , expanded_path , NULL , 0 , CWD_EXPAND TSRMLS_CC ) ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "No such file or directory" ) ;
RETURN_FALSE ;
}
ret = php_sys_readlink ( expanded_path , buff , MAXPATHLEN - 1 ) ;
}
else {
ret = php_sys_readlink ( intern -> file_name , buff , MAXPATHLEN - 1 ) ;
}
# else ret = - 1 ;
# endif if ( ret == - 1 ) {
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , "Unable to read link %s, error: %s" , intern -> file_name , strerror ( errno ) ) ;
RETVAL_FALSE ;
}
else {
buff [ ret ] = '\0' ;
RETVAL_STRINGL ( buff , ret , 1 ) ;
}
zend_restore_error_handling ( & error_handling TSRMLS_CC ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int nsv_parse_NSVf_header ( AVFormatContext * s ) {
NSVContext * nsv = s -> priv_data ;
AVIOContext * pb = s -> pb ;
unsigned int av_unused file_size ;
unsigned int size ;
int64_t duration ;
int strings_size ;
int table_entries ;
int table_entries_used ;
nsv -> state = NSV_UNSYNC ;
size = avio_rl32 ( pb ) ;
if ( size < 28 ) return - 1 ;
nsv -> NSVf_end = size ;
file_size = ( uint32_t ) avio_rl32 ( pb ) ;
av_log ( s , AV_LOG_TRACE , "NSV NSVf chunk_size %u\n" , size ) ;
av_log ( s , AV_LOG_TRACE , "NSV NSVf file_size %u\n" , file_size ) ;
nsv -> duration = duration = avio_rl32 ( pb ) ;
av_log ( s , AV_LOG_TRACE , "NSV NSVf duration %" PRId64 " ms\n" , duration ) ;
strings_size = avio_rl32 ( pb ) ;
table_entries = avio_rl32 ( pb ) ;
table_entries_used = avio_rl32 ( pb ) ;
av_log ( s , AV_LOG_TRACE , "NSV NSVf info-strings size: %d, table entries: %d, bis %d\n" , strings_size , table_entries , table_entries_used ) ;
if ( avio_feof ( pb ) ) return - 1 ;
av_log ( s , AV_LOG_TRACE , "NSV got header;
filepos %" PRId64 "\n" , avio_tell ( pb ) ) ;
if ( strings_size > 0 ) {
char * strings ;
char * p , * endp ;
char * token , * value ;
char quote ;
p = strings = av_mallocz ( ( size_t ) strings_size + 1 ) ;
if ( ! p ) return AVERROR ( ENOMEM ) ;
endp = strings + strings_size ;
avio_read ( pb , strings , strings_size ) ;
while ( p < endp ) {
while ( * p == ' ' ) p ++ ;
if ( p >= endp - 2 ) break ;
token = p ;
p = strchr ( p , '=' ) ;
if ( ! p || p >= endp - 2 ) break ;
* p ++ = '\0' ;
quote = * p ++ ;
value = p ;
p = strchr ( p , quote ) ;
if ( ! p || p >= endp ) break ;
* p ++ = '\0' ;
av_log ( s , AV_LOG_TRACE , "NSV NSVf INFO: %s='%s'\n" , token , value ) ;
av_dict_set ( & s -> metadata , token , value , 0 ) ;
}
av_free ( strings ) ;
}
if ( avio_feof ( pb ) ) return - 1 ;
av_log ( s , AV_LOG_TRACE , "NSV got infos;
filepos %" PRId64 "\n" , avio_tell ( pb ) ) ;
if ( table_entries_used > 0 ) {
int i ;
nsv -> index_entries = table_entries_used ;
if ( ( unsigned ) table_entries_used >= UINT_MAX / sizeof ( uint32_t ) ) return - 1 ;
nsv -> nsvs_file_offset = av_malloc_array ( ( unsigned ) table_entries_used , sizeof ( uint32_t ) ) ;
if ( ! nsv -> nsvs_file_offset ) return AVERROR ( ENOMEM ) ;
for ( i = 0 ;
i < table_entries_used ;
i ++ ) nsv -> nsvs_file_offset [ i ] = avio_rl32 ( pb ) + size ;
if ( table_entries > table_entries_used && avio_rl32 ( pb ) == MKTAG ( 'T' , 'O' , 'C' , '2' ) ) {
nsv -> nsvs_timestamps = av_malloc_array ( ( unsigned ) table_entries_used , sizeof ( uint32_t ) ) ;
if ( ! nsv -> nsvs_timestamps ) return AVERROR ( ENOMEM ) ;
for ( i = 0 ;
i < table_entries_used ;
i ++ ) {
nsv -> nsvs_timestamps [ i ] = avio_rl32 ( pb ) ;
}
}
}
av_log ( s , AV_LOG_TRACE , "NSV got index;
filepos %" PRId64 "\n" , avio_tell ( pb ) ) ;
avio_seek ( pb , nsv -> base_offset + size , SEEK_SET ) ;
if ( avio_feof ( pb ) ) return - 1 ;
nsv -> state = NSV_HAS_READ_NSVF ;
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void DecoderPlayAudio ( decoder_t * p_dec , block_t * p_audio , int * pi_played_sum , int * pi_lost_sum ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
audio_output_t * p_aout = p_owner -> p_aout ;
if ( p_audio && p_audio -> i_pts <= VLC_TS_INVALID ) {
msg_Warn ( p_dec , "non-dated audio buffer received" ) ;
* pi_lost_sum += 1 ;
block_Release ( p_audio ) ;
return ;
}
vlc_mutex_lock ( & p_owner -> lock ) ;
if ( p_audio && p_owner -> b_waiting ) {
p_owner -> b_has_data = true ;
vlc_cond_signal ( & p_owner -> wait_acknowledge ) ;
}
for ( ;
;
) {
bool b_paused ;
bool b_reject = DecoderWaitUnblock ( p_dec ) ;
b_paused = p_owner -> b_paused ;
if ( ! p_audio ) break ;
int i_rate = INPUT_RATE_DEFAULT ;
DecoderFixTs ( p_dec , & p_audio -> i_pts , NULL , & p_audio -> i_length , & i_rate , AOUT_MAX_ADVANCE_TIME ) ;
if ( p_audio -> i_pts <= VLC_TS_INVALID || i_rate < INPUT_RATE_DEFAULT / AOUT_MAX_INPUT_RATE || i_rate > INPUT_RATE_DEFAULT * AOUT_MAX_INPUT_RATE ) b_reject = true ;
DecoderWaitDate ( p_dec , & b_reject , p_audio -> i_pts - AOUT_MAX_PREPARE_TIME ) ;
if ( unlikely ( p_owner -> b_paused != b_paused ) ) continue ;
if ( p_aout == NULL ) b_reject = true ;
if ( ! b_reject ) {
assert ( ! p_owner -> b_paused ) ;
if ( ! aout_DecPlay ( p_aout , p_audio , i_rate ) ) * pi_played_sum += 1 ;
* pi_lost_sum += aout_DecGetResetLost ( p_aout ) ;
}
else {
msg_Dbg ( p_dec , "discarded audio buffer" ) ;
* pi_lost_sum += 1 ;
block_Release ( p_audio ) ;
}
break ;
}
vlc_mutex_unlock ( & p_owner -> lock ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int event_base_once ( struct event_base * base , int fd , short events , void ( * callback ) ( int , short , void * ) , void * arg , const struct timeval * tv ) {
struct event_once * eonce ;
struct timeval etv ;
int res ;
if ( events & EV_SIGNAL ) return ( - 1 ) ;
if ( ( eonce = calloc ( 1 , sizeof ( struct event_once ) ) ) == NULL ) return ( - 1 ) ;
eonce -> cb = callback ;
eonce -> arg = arg ;
if ( events == EV_TIMEOUT ) {
if ( tv == NULL ) {
evutil_timerclear ( & etv ) ;
tv = & etv ;
}
evtimer_set ( & eonce -> ev , event_once_cb , eonce ) ;
}
else if ( events & ( EV_READ | EV_WRITE ) ) {
events &= EV_READ | EV_WRITE ;
event_set ( & eonce -> ev , fd , events , event_once_cb , eonce ) ;
}
else {
free ( eonce ) ;
return ( - 1 ) ;
}
res = event_base_set ( base , & eonce -> ev ) ;
if ( res == 0 ) res = event_add ( & eonce -> ev , tv ) ;
if ( res != 0 ) {
free ( eonce ) ;
return ( res ) ;
}
return ( 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void uprv_arrayCopy ( const double * src , int32_t srcStart , double * dst , int32_t dstStart , int32_t count ) {
uprv_memcpy ( dst + dstStart , src + srcStart , ( size_t ) count * sizeof ( * src ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | fz_colorspace * fz_new_cal_colorspace ( fz_context * ctx , const char * name , float * wp , float * bp , float * gamma , float * matrix ) {
fz_colorspace * cs = NULL ;
enum fz_colorspace_type type ;
int num ;
fz_cal_colorspace * cal_data ;
if ( matrix ) {
type = FZ_COLORSPACE_RGB ;
num = 3 ;
}
else {
type = FZ_COLORSPACE_GRAY ;
num = 1 ;
}
cal_data = fz_malloc_struct ( ctx , fz_cal_colorspace ) ;
memcpy ( & cal_data -> bp , bp , sizeof ( float ) * 3 ) ;
memcpy ( & cal_data -> wp , wp , sizeof ( float ) * 3 ) ;
memcpy ( & cal_data -> gamma , gamma , sizeof ( float ) * num ) ;
if ( matrix != NULL ) memcpy ( & cal_data -> matrix , matrix , sizeof ( float ) * 9 ) ;
cal_data -> n = num ;
fz_try ( ctx ) cs = fz_new_colorspace ( ctx , name , type , FZ_COLORSPACE_IS_CAL , num , NULL , NULL , NULL , NULL , free_cal , cal_data , sizeof ( cal_data ) ) ;
fz_catch ( ctx ) {
fz_free ( ctx , cal_data ) ;
fz_rethrow ( ctx ) ;
}
return cs ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gint32 get_int_value ( proto_tree * tree , tvbuff_t * tvb , gint offset , gint length , const guint encoding ) {
gint32 value ;
gboolean length_error ;
switch ( length ) {
case 1 : value = ( gint8 ) tvb_get_guint8 ( tvb , offset ) ;
break ;
case 2 : value = ( gint16 ) ( encoding ? tvb_get_letohs ( tvb , offset ) : tvb_get_ntohs ( tvb , offset ) ) ;
break ;
case 3 : value = encoding ? tvb_get_letoh24 ( tvb , offset ) : tvb_get_ntoh24 ( tvb , offset ) ;
if ( value & 0x00800000 ) {
value |= 0xFF000000 ;
}
break ;
case 4 : value = encoding ? tvb_get_letohl ( tvb , offset ) : tvb_get_ntohl ( tvb , offset ) ;
break ;
default : if ( length < 1 ) {
length_error = TRUE ;
value = 0 ;
}
else {
length_error = FALSE ;
value = encoding ? tvb_get_letohl ( tvb , offset ) : tvb_get_ntohl ( tvb , offset ) ;
}
report_type_length_mismatch ( tree , "a signed integer" , length , length_error ) ;
break ;
}
return value ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void allow_coredumps ( ) {
# ifdef PR_SET_DUMPABLE if ( test_flags & TEST_CORE_ON_SIGNAL ) {
( void ) prctl ( PR_SET_DUMPABLE , 1 ) ;
}
# endif } | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_zcl_appl_ctrl_attr_data ( proto_tree * tree , tvbuff_t * tvb , guint * offset , guint16 attr_id , guint data_type ) {
static const int * flags [ ] = {
& hf_zbee_zcl_appl_ctrl_time_mm , & hf_zbee_zcl_appl_ctrl_time_encoding_type , & hf_zbee_zcl_appl_ctrl_time_hh , NULL }
;
switch ( attr_id ) {
case ZBEE_ZCL_ATTR_ID_APPL_CTRL_START_TIME : case ZBEE_ZCL_ATTR_ID_APPL_CTRL_FINISH_TIME : case ZBEE_ZCL_ATTR_ID_APPL_CTRL_REMAINING_TIME : proto_tree_add_bitmask ( tree , tvb , * offset , hf_zbee_zcl_appl_ctrl_time , ett_zbee_zcl_appl_ctrl_time , flags , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
break ;
default : dissect_zcl_attr_data ( tvb , tree , offset , data_type ) ;
break ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_iht16x16_add ( TX_TYPE tx_type , const int16_t * input , uint8_t * dest , int stride , int eob ) {
if ( tx_type == DCT_DCT ) {
vp9_idct16x16_add ( input , dest , stride , eob ) ;
}
else {
vp9_iht16x16_256_add ( input , dest , stride , tx_type ) ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( UsbChooserBrowserTest , InvokeDialog_NoDevicesBubble ) {
RunDialog ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | SPL_METHOD ( SplFileInfo , openFile ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
spl_filesystem_object_create_type ( ht , intern , SPL_FS_FILE , NULL , return_value TSRMLS_CC ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static bool tsc_is_stable_and_known ( CPUX86State * env ) {
if ( ! env -> tsc_khz ) {
return false ;
}
return ( env -> features [ FEAT_8000_0007_EDX ] & CPUID_APM_INVTSC ) || env -> user_tsc_khz ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void mime_field_value_insert_comma_val ( HdrHeap * heap , MIMEHdrImpl * mh , MIMEField * field , int idx , const char * new_piece_str , int new_piece_len ) {
int len ;
Str * cell , * prev ;
StrList list ( false ) ;
HttpCompat : : parse_tok_list ( & list , 0 , field -> m_ptr_value , field -> m_len_value , ',' ) ;
if ( idx < 0 ) {
idx = list . count ;
}
if ( idx > list . count ) {
return ;
}
cell = list . new_cell ( new_piece_str , new_piece_len ) ;
if ( idx == 0 ) {
list . prepend ( cell ) ;
}
else {
prev = list . get_idx ( idx - 1 ) ;
list . add_after ( prev , cell ) ;
}
field -> m_ptr_value = mime_field_value_str_from_strlist ( heap , & len , & list ) ;
field -> m_len_value = len ;
field -> m_n_v_raw_printable = 0 ;
if ( field -> is_live ( ) && field -> is_cooked ( ) ) {
mh -> recompute_cooked_stuff ( field ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void record_sys_stats ( void ) {
l_fp now ;
u_long day ;
if ( ! stats_control ) return ;
get_systime ( & now ) ;
filegen_setup ( & sysstats , now . l_ui ) ;
day = now . l_ui / 86400 + MJD_1900 ;
now . l_ui %= 86400 ;
if ( sysstats . fp != NULL ) {
fprintf ( sysstats . fp , "%lu %s %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu %lu\n" , day , ulfptoa ( & now , 3 ) , current_time - sys_stattime , sys_received , sys_processed , sys_newversion , sys_oldversion , sys_restricted , sys_badlength , sys_badauth , sys_declined , sys_limitrejected , sys_kodsent ) ;
fflush ( sysstats . fp ) ;
proto_clr_stats ( ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void imcb_file_finished ( struct im_connection * ic , file_transfer_t * file ) {
bee_t * bee = ic -> bee ;
if ( bee -> ui -> ft_finished ) {
bee -> ui -> ft_finished ( ic , file ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int set_str_a_characters_bp ( struct archive_write * a , unsigned char * bp , int from , int to , const char * s , enum vdc vdc ) {
int r ;
switch ( vdc ) {
case VDC_STD : set_str ( bp + from , s , to - from + 1 , 0x20 , a_characters_map ) ;
r = ARCHIVE_OK ;
break ;
case VDC_LOWERCASE : set_str ( bp + from , s , to - from + 1 , 0x20 , a1_characters_map ) ;
r = ARCHIVE_OK ;
break ;
case VDC_UCS2 : case VDC_UCS2_DIRECT : r = set_str_utf16be ( a , bp + from , s , to - from + 1 , 0x0020 , vdc ) ;
break ;
default : r = ARCHIVE_FATAL ;
}
return ( r ) ;
} | 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.