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 __inline__ int ethtool_validate_duplex ( __u8 duplex ) { switch ( duplex ) { case DUPLEX_HALF : case DUPLEX_FULL : case DUPLEX_UNKNOWN : return 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void update_mv_probs ( vp9_prob * p , int n , vp9_reader * r ) { int i ; for ( i = 0 ; i < n ; ++ i ) if ( vp9_read ( r , MV_UPDATE_PROB ) ) p [ i ] = ( vp9_read_literal ( r , 7 ) << 1 ) | 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
mbfl_buffer_converter * mbfl_buffer_converter_new2 ( const mbfl_encoding * from , const mbfl_encoding * to , int buf_initsz ) { mbfl_buffer_converter * convd ; convd = ( mbfl_buffer_converter * ) mbfl_malloc ( sizeof ( mbfl_buffer_converter ) ) ; if ( convd == NULL ) { return NULL ; } convd -> from = from ; convd -> to = to ; convd -> filter1 = NULL ; convd -> filter2 = NULL ; if ( mbfl_convert_filter_get_vtbl ( convd -> from -> no_encoding , convd -> to -> no_encoding ) != NULL ) { convd -> filter1 = mbfl_convert_filter_new ( convd -> from -> no_encoding , convd -> to -> no_encoding , mbfl_memory_device_output , NULL , & convd -> device ) ; } else { convd -> filter2 = mbfl_convert_filter_new ( mbfl_no_encoding_wchar , convd -> to -> no_encoding , mbfl_memory_device_output , NULL , & convd -> device ) ; if ( convd -> filter2 != NULL ) { convd -> filter1 = mbfl_convert_filter_new ( convd -> from -> no_encoding , mbfl_no_encoding_wchar , ( int ( * ) ( int , void * ) ) convd -> filter2 -> filter_function , ( int ( * ) ( void * ) ) convd -> filter2 -> filter_flush , convd -> filter2 ) ; if ( convd -> filter1 == NULL ) { mbfl_convert_filter_delete ( convd -> filter2 ) ; } } } if ( convd -> filter1 == NULL ) { return NULL ; } mbfl_memory_device_init ( & convd -> device , buf_initsz , buf_initsz / 4 ) ; return convd ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int tls1_generate_key_block ( SSL * s , unsigned char * km , unsigned char * tmp , int num ) { int ret ; ret = tls1_PRF ( ssl_get_algorithm2 ( s ) , TLS_MD_KEY_EXPANSION_CONST , TLS_MD_KEY_EXPANSION_CONST_SIZE , s -> s3 -> server_random , SSL3_RANDOM_SIZE , s -> s3 -> client_random , SSL3_RANDOM_SIZE , NULL , 0 , NULL , 0 , s -> session -> master_key , s -> session -> master_key_length , km , tmp , num ) ; # ifdef KSSL_DEBUG printf ( "tls1_generate_key_block() ==> %d byte master_key =\n\t" , s -> session -> master_key_length ) ; { int i ; for ( i = 0 ; i < s -> session -> master_key_length ; i ++ ) { printf ( "%02X" , s -> session -> master_key [ i ] ) ; } printf ( "\n" ) ; } # endif return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void xps_select_best_font_encoding ( xps_document * doc , fz_font * font ) { static struct { int pid , eid ; } xps_cmap_list [ ] = { { 3 , 10 } , { 3 , 1 } , { 3 , 5 } , { 3 , 4 } , { 3 , 3 } , { 3 , 2 } , { 3 , 0 } , { 1 , 0 } , { - 1 , - 1 } , } ; int i , k , n , pid , eid ; n = xps_count_font_encodings ( font ) ; for ( k = 0 ; xps_cmap_list [ k ] . pid != - 1 ; k ++ ) { for ( i = 0 ; i < n ; i ++ ) { xps_identify_font_encoding ( font , i , & pid , & eid ) ; if ( pid == xps_cmap_list [ k ] . pid && eid == xps_cmap_list [ k ] . eid ) { xps_select_font_encoding ( font , i ) ; return ; } } } fz_warn ( doc -> ctx , "cannot find a suitable cmap" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int qemuMonitorParseBalloonInfo ( char * text , virDomainMemoryStatPtr stats , unsigned int nr_stats ) { char * p = text ; unsigned int nr_stats_found = 0 ; if ( parseMemoryStat ( & p , VIR_DOMAIN_MEMORY_STAT_ACTUAL_BALLOON , "actual=" , & stats [ nr_stats_found ] ) == 1 ) { nr_stats_found ++ ; } while ( * p && nr_stats_found < nr_stats ) { if ( parseMemoryStat ( & p , VIR_DOMAIN_MEMORY_STAT_SWAP_IN , ",mem_swapped_in=" , & stats [ nr_stats_found ] ) || parseMemoryStat ( & p , VIR_DOMAIN_MEMORY_STAT_SWAP_OUT , ",mem_swapped_out=" , & stats [ nr_stats_found ] ) || parseMemoryStat ( & p , VIR_DOMAIN_MEMORY_STAT_MAJOR_FAULT , ",major_page_faults=" , & stats [ nr_stats_found ] ) || parseMemoryStat ( & p , VIR_DOMAIN_MEMORY_STAT_MINOR_FAULT , ",minor_page_faults=" , & stats [ nr_stats_found ] ) || parseMemoryStat ( & p , VIR_DOMAIN_MEMORY_STAT_UNUSED , ",free_mem=" , & stats [ nr_stats_found ] ) || parseMemoryStat ( & p , VIR_DOMAIN_MEMORY_STAT_AVAILABLE , ",total_mem=" , & stats [ nr_stats_found ] ) ) nr_stats_found ++ ; if ( * p == ',' ) p ++ ; p = strchr ( p , ',' ) ; if ( ! p ) break ; } return nr_stats_found ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int evhttp_add_header ( struct evkeyvalq * headers , const char * key , const char * value ) { event_debug ( ( "%s: key: %s val: %s\n" , __func__ , key , value ) ) ; if ( strchr ( key , '\r' ) != NULL || strchr ( key , '\n' ) != NULL ) { event_debug ( ( "%s: dropping illegal header key\n" , __func__ ) ) ; return ( - 1 ) ; } if ( ! evhttp_header_is_valid_value ( value ) ) { event_debug ( ( "%s: dropping illegal header value\n" , __func__ ) ) ; return ( - 1 ) ; } return ( evhttp_add_header_internal ( headers , key , value ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int evbuffer_add_vprintf ( struct evbuffer * buf , const char * fmt , va_list ap ) { char * buffer ; size_t space ; size_t oldoff = buf -> off ; int sz ; va_list aq ; evbuffer_expand ( buf , 64 ) ; for ( ; ; ) { size_t used = buf -> misalign + buf -> off ; buffer = ( char * ) buf -> buffer + buf -> off ; assert ( buf -> totallen >= used ) ; space = buf -> totallen - used ; # ifndef va_copy # define va_copy ( dst , src ) memcpy ( & ( dst ) , & ( src ) , sizeof ( va_list ) ) # endif va_copy ( aq , ap ) ; sz = evutil_vsnprintf ( buffer , space , fmt , aq ) ; va_end ( aq ) ; if ( sz < 0 ) return ( - 1 ) ; if ( ( size_t ) sz < space ) { buf -> off += sz ; if ( buf -> cb != NULL ) ( * buf -> cb ) ( buf , oldoff , buf -> off , buf -> cbarg ) ; return ( sz ) ; } if ( evbuffer_expand ( buf , sz + 1 ) == - 1 ) return ( - 1 ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static CURLcode header_append ( struct Curl_easy * data , struct SingleRequest * k , size_t length ) { if ( k -> hbuflen + length >= data -> state . headersize ) { char * newbuff ; size_t hbufp_index ; size_t newsize ; if ( k -> hbuflen + length > CURL_MAX_HTTP_HEADER ) { failf ( data , "Avoided giant realloc for header (max is %d)!" , CURL_MAX_HTTP_HEADER ) ; return CURLE_OUT_OF_MEMORY ; } newsize = CURLMAX ( ( k -> hbuflen + length ) * 3 / 2 , data -> state . headersize * 2 ) ; hbufp_index = k -> hbufp - data -> state . headerbuff ; newbuff = realloc ( data -> state . headerbuff , newsize ) ; if ( ! newbuff ) { failf ( data , "Failed to alloc memory for big header!" ) ; return CURLE_OUT_OF_MEMORY ; } data -> state . headersize = newsize ; data -> state . headerbuff = newbuff ; k -> hbufp = data -> state . headerbuff + hbufp_index ; } memcpy ( k -> hbufp , k -> str_start , length ) ; k -> hbufp += length ; k -> hbuflen += length ; * k -> hbufp = 0 ; return CURLE_OK ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void PyString_ConcatAndDel ( register PyObject * * pv , register PyObject * w ) { PyString_Concat ( pv , w ) ; Py_XDECREF ( w ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_MaintenanceLoopOffCommand ( 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_MaintenanceLoopOffCommand , MaintenanceLoopOffCommand_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_init3smotion_compensation ( search_site_config * cfg , int stride ) { int len , ss_count = 1 ; cfg -> ss [ 0 ] . mv . col = cfg -> ss [ 0 ] . mv . row = 0 ; cfg -> ss [ 0 ] . offset = 0 ; for ( len = MAX_FIRST_STEP ; len > 0 ; len /= 2 ) { const MV ss_mvs [ 8 ] = { { - len , 0 } , { len , 0 } , { 0 , - len } , { 0 , len } , { - len , - len } , { - len , len } , { len , - len } , { len , len } } ; int i ; for ( i = 0 ; i < 8 ; ++ i ) { search_site * const ss = & cfg -> ss [ ss_count ++ ] ; ss -> mv = ss_mvs [ i ] ; ss -> offset = ss -> mv . row * stride + ss -> mv . col ; } } cfg -> ss_count = ss_count ; cfg -> searches_per_step = 8 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bug10214 ( ) { int len ; char out [ 8 ] ; myheader ( "test_bug10214" ) ; DIE_UNLESS ( ! ( mysql -> server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES ) ) ; len = mysql_real_escape_string ( mysql , out , "a'b\\c" , 5 ) ; DIE_UNLESS ( memcmp ( out , "a\\'b\\\\c" , len ) == 0 ) ; mysql_query ( mysql , "set sql_mode='NO_BACKSLASH_ESCAPES'" ) ; DIE_UNLESS ( mysql -> server_status & SERVER_STATUS_NO_BACKSLASH_ESCAPES ) ; len = mysql_real_escape_string ( mysql , out , "a'b\\c" , 5 ) ; DIE_UNLESS ( memcmp ( out , "a''b\\c" , len ) == 0 ) ; mysql_query ( mysql , "set sql_mode=''" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static MV mi_mv_pred_q4 ( const MODE_INFO * mi , int idx ) { MV res = { round_mv_comp_q4 ( mi -> bmi [ 0 ] . as_mv [ idx ] . as_mv . row + mi -> bmi [ 1 ] . as_mv [ idx ] . as_mv . row + mi -> bmi [ 2 ] . as_mv [ idx ] . as_mv . row + mi -> bmi [ 3 ] . as_mv [ idx ] . as_mv . row ) , round_mv_comp_q4 ( mi -> bmi [ 0 ] . as_mv [ idx ] . as_mv . col + mi -> bmi [ 1 ] . as_mv [ idx ] . as_mv . col + mi -> bmi [ 2 ] . as_mv [ idx ] . as_mv . col + mi -> bmi [ 3 ] . as_mv [ idx ] . as_mv . col ) } ; return res ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_INTEGER_2_8191 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 2U , 8191U , NULL , FALSE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct inode_security_struct * inode_security ( struct inode * inode ) { __inode_security_revalidate ( inode , NULL , true ) ; return inode -> i_security ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
Datum ExecEvalExprSwitchContext ( ExprState * expression , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { Datum retDatum ; MemoryContext oldContext ; oldContext = MemoryContextSwitchTo ( econtext -> ecxt_per_tuple_memory ) ; retDatum = ExecEvalExpr ( expression , econtext , isNull , isDone ) ; MemoryContextSwitchTo ( oldContext ) ; return retDatum ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static List * add_function_defaults ( List * args , HeapTuple func_tuple ) { Form_pg_proc funcform = ( Form_pg_proc ) GETSTRUCT ( func_tuple ) ; int nargsprovided = list_length ( args ) ; List * defaults ; int ndelete ; defaults = fetch_function_defaults ( func_tuple ) ; ndelete = nargsprovided + list_length ( defaults ) - funcform -> pronargs ; if ( ndelete < 0 ) elog ( ERROR , "not enough default arguments" ) ; while ( ndelete -- > 0 ) defaults = list_delete_first ( defaults ) ; return list_concat ( list_copy ( args ) , defaults ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void do_remove_files_wildcard ( struct st_command * command ) { int error = 0 , sys_errno = 0 ; uint i ; size_t directory_length ; MY_DIR * dir_info ; FILEINFO * file ; char dir_separator [ 2 ] ; static DYNAMIC_STRING ds_directory ; static DYNAMIC_STRING ds_wild ; static DYNAMIC_STRING ds_file_to_remove ; char dirname [ FN_REFLEN ] ; const struct command_arg rm_args [ ] = { { "directory" , ARG_STRING , TRUE , & ds_directory , "Directory containing files to delete" } , { "filename" , ARG_STRING , FALSE , & ds_wild , "File pattern to delete" } } ; DBUG_ENTER ( "do_remove_files_wildcard" ) ; check_command_args ( command , command -> first_argument , rm_args , sizeof ( rm_args ) / sizeof ( struct command_arg ) , ' ' ) ; fn_format ( dirname , ds_directory . str , "" , "" , MY_UNPACK_FILENAME ) ; DBUG_PRINT ( "info" , ( "listing directory: %s" , dirname ) ) ; if ( ! ( dir_info = my_dir ( dirname , MYF ( MY_DONT_SORT | MY_WANT_STAT | MY_WME ) ) ) ) { error = 1 ; sys_errno = my_errno ; goto end ; } init_dynamic_string ( & ds_file_to_remove , dirname , 1024 , 1024 ) ; dir_separator [ 0 ] = FN_LIBCHAR ; dynstr_append_mem ( & ds_file_to_remove , dir_separator , 1 ) ; directory_length = ds_file_to_remove . length ; set_wild_chars ( 1 ) ; for ( i = 0 ; i < ( uint ) dir_info -> number_off_files ; i ++ ) { file = dir_info -> dir_entry + i ; if ( MY_S_ISDIR ( file -> mystat -> st_mode ) ) continue ; if ( ds_wild . length && wild_compare ( file -> name , ds_wild . str , 0 ) ) continue ; ds_file_to_remove . length = directory_length ; dynstr_append ( & ds_file_to_remove , file -> name ) ; DBUG_PRINT ( "info" , ( "removing file: %s" , ds_file_to_remove . str ) ) ; if ( ( error = ( my_delete ( ds_file_to_remove . str , MYF ( MY_WME ) ) != 0 ) ) ) sys_errno = my_errno ; if ( error ) break ; } set_wild_chars ( 0 ) ; my_dirend ( dir_info ) ; end : handle_command_error ( command , error , sys_errno ) ; dynstr_free ( & ds_directory ) ; dynstr_free ( & ds_wild ) ; dynstr_free ( & ds_file_to_remove ) ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ztype ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; ref tnref ; int code = array_get ( imemory , op , ( long ) r_btype ( op - 1 ) , & tnref ) ; if ( code < 0 ) return code ; if ( ! r_has_type ( & tnref , t_name ) ) { check_op ( 2 ) ; { if ( op [ - 1 ] . value . pstruct != 0x00 ) { const char * sname = gs_struct_type_name_string ( gs_object_type ( imemory , op [ - 1 ] . value . pstruct ) ) ; int code = name_ref ( imemory , ( const byte * ) sname , strlen ( sname ) , ( ref * ) ( op - 1 ) , 0 ) ; if ( code < 0 ) return code ; } else return_error ( gs_error_stackunderflow ) ; } r_set_attrs ( op - 1 , a_executable ) ; } else { ref_assign ( op - 1 , & tnref ) ; } pop ( 1 ) ; return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void update_key_parts ( MI_KEYDEF * keyinfo , ulong * rec_per_key_part , ulonglong * unique , ulonglong * notnull , ulonglong records ) { ulonglong count = 0 , tmp , unique_tuples ; ulonglong tuples = records ; uint parts ; for ( parts = 0 ; parts < keyinfo -> keysegs ; parts ++ ) { count += unique [ parts ] ; unique_tuples = count + 1 ; if ( notnull ) { tuples = notnull [ parts ] ; unique_tuples -= ( records - notnull [ parts ] ) ; } if ( unique_tuples == 0 ) tmp = 1 ; else if ( count == 0 ) tmp = tuples ; else tmp = ( tuples + unique_tuples / 2 ) / unique_tuples ; set_if_bigger ( tmp , 1 ) ; if ( tmp >= ( ulonglong ) ~ ( ulong ) 0 ) tmp = ( ulonglong ) ~ ( ulong ) 0 ; * rec_per_key_part = ( ulong ) tmp ; rec_per_key_part ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int opt_read_intervals ( void * optctx , const char * opt , const char * arg ) { return parse_read_intervals ( arg ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void tokenize ( const char * line , char * * tokens , int * ntok ) { register const char * cp ; register char * sp ; static char tspace [ MAXLINE ] ; sp = tspace ; cp = line ; for ( * ntok = 0 ; * ntok < MAXTOKENS ; ( * ntok ) ++ ) { tokens [ * ntok ] = sp ; while ( ISSPACE ( * cp ) ) cp ++ ; if ( ISEOL ( * cp ) ) break ; if ( * ntok == 1 && tokens [ 0 ] [ 0 ] == ':' ) { do { if ( sp - tspace >= MAXLINE ) goto toobig ; * sp ++ = * cp ++ ; } while ( ! ISEOL ( * cp ) ) ; } else if ( * cp == '\"' ) { ++ cp ; do { if ( sp - tspace >= MAXLINE ) goto toobig ; * sp ++ = * cp ++ ; } while ( ( * cp != '\"' ) && ! ISEOL ( * cp ) ) ; } else { do { if ( sp - tspace >= MAXLINE ) goto toobig ; * sp ++ = * cp ++ ; } while ( ( * cp != '\"' ) && ! ISSPACE ( * cp ) && ! ISEOL ( * cp ) ) ; } if ( sp - tspace >= MAXLINE ) goto toobig ; * sp ++ = '\0' ; } return ; toobig : * ntok = 0 ; fprintf ( stderr , "***Line `%s' is too big\n" , line ) ; return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct object_entry * find_object ( unsigned char * sha1 ) { unsigned int h = sha1 [ 0 ] << 8 | sha1 [ 1 ] ; struct object_entry * e ; for ( e = object_table [ h ] ; e ; e = e -> next ) if ( ! hashcmp ( sha1 , e -> idx . sha1 ) ) return e ; return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) { OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) { return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ; } static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) { return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) { return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ; } # define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ; typedef const char * OPENSSL_CSTRING ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char )
1True
Categorize the following code snippet as vulnerable or not. True or False
static inline int asv2_get_bits ( GetBitContext * gb , int n ) { return ff_reverse [ get_bits ( gb , n ) << ( 8 - n ) ] ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_containedThreads ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h245_T_containedThreads , T_containedThreads_sequence_of , 1 , 256 , FALSE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int xan_decode_chroma ( AVCodecContext * avctx , unsigned chroma_off ) { XanContext * s = avctx -> priv_data ; uint8_t * U , * V ; int val , uval , vval ; int i , j ; const uint8_t * src , * src_end ; const uint8_t * table ; int mode , offset , dec_size , table_size ; if ( ! chroma_off ) return 0 ; if ( chroma_off + 4 >= bytestream2_get_bytes_left ( & s -> gb ) ) { av_log ( avctx , AV_LOG_ERROR , "Invalid chroma block position\n" ) ; return AVERROR_INVALIDDATA ; } bytestream2_seek ( & s -> gb , chroma_off + 4 , SEEK_SET ) ; mode = bytestream2_get_le16 ( & s -> gb ) ; table = s -> gb . buffer ; table_size = bytestream2_get_le16 ( & s -> gb ) ; offset = table_size * 2 ; table_size += 1 ; if ( offset >= bytestream2_get_bytes_left ( & s -> gb ) ) { av_log ( avctx , AV_LOG_ERROR , "Invalid chroma block offset\n" ) ; return AVERROR_INVALIDDATA ; } bytestream2_skip ( & s -> gb , offset ) ; memset ( s -> scratch_buffer , 0 , s -> buffer_size ) ; dec_size = xan_unpack ( s , s -> scratch_buffer , s -> buffer_size ) ; if ( dec_size < 0 ) { av_log ( avctx , AV_LOG_ERROR , "Chroma unpacking failed\n" ) ; return dec_size ; } U = s -> pic . data [ 1 ] ; V = s -> pic . data [ 2 ] ; src = s -> scratch_buffer ; src_end = src + dec_size ; if ( mode ) { for ( j = 0 ; j < avctx -> height >> 1 ; j ++ ) { for ( i = 0 ; i < avctx -> width >> 1 ; i ++ ) { val = * src ++ ; if ( val && val < table_size ) { val = AV_RL16 ( table + ( val << 1 ) ) ; uval = ( val >> 3 ) & 0xF8 ; vval = ( val >> 8 ) & 0xF8 ; U [ i ] = uval | ( uval >> 5 ) ; V [ i ] = vval | ( vval >> 5 ) ; } if ( src == src_end ) return 0 ; } U += s -> pic . linesize [ 1 ] ; V += s -> pic . linesize [ 2 ] ; } if ( avctx -> height & 1 ) { memcpy ( U , U - s -> pic . linesize [ 1 ] , avctx -> width >> 1 ) ; memcpy ( V , V - s -> pic . linesize [ 2 ] , avctx -> width >> 1 ) ; } } else { uint8_t * U2 = U + s -> pic . linesize [ 1 ] ; uint8_t * V2 = V + s -> pic . linesize [ 2 ] ; for ( j = 0 ; j < avctx -> height >> 2 ; j ++ ) { for ( i = 0 ; i < avctx -> width >> 1 ; i += 2 ) { val = * src ++ ; if ( val && val < table_size ) { val = AV_RL16 ( table + ( val << 1 ) ) ; uval = ( val >> 3 ) & 0xF8 ; vval = ( val >> 8 ) & 0xF8 ; U [ i ] = U [ i + 1 ] = U2 [ i ] = U2 [ i + 1 ] = uval | ( uval >> 5 ) ; V [ i ] = V [ i + 1 ] = V2 [ i ] = V2 [ i + 1 ] = vval | ( vval >> 5 ) ; } } U += s -> pic . linesize [ 1 ] * 2 ; V += s -> pic . linesize [ 2 ] * 2 ; U2 += s -> pic . linesize [ 1 ] * 2 ; V2 += s -> pic . linesize [ 2 ] * 2 ; } if ( avctx -> height & 3 ) { int lines = ( ( avctx -> height + 1 ) >> 1 ) - ( avctx -> height >> 2 ) * 2 ; memcpy ( U , U - lines * s -> pic . linesize [ 1 ] , lines * s -> pic . linesize [ 1 ] ) ; memcpy ( V , V - lines * s -> pic . linesize [ 2 ] , lines * s -> pic . linesize [ 2 ] ) ; } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int main ( int argc , char * * argv ) { int i , c ; int pid_flags = 0 ; char * acl = NULL ; char * user = NULL ; char * password = NULL ; char * timeout = NULL ; char * method = NULL ; char * pid_path = NULL ; char * conf_path = NULL ; char * iface = NULL ; char * manager_address = NULL ; char * plugin = NULL ; char * plugin_opts = NULL ; int fast_open = 0 ; int reuse_port = 0 ; int mode = TCP_ONLY ; int mtu = 0 ; int ipv6first = 0 ; # ifdef HAVE_SETRLIMIT static int nofile = 0 ; # endif int server_num = 0 ; char * server_host [ MAX_REMOTE_NUM ] ; char * nameservers [ MAX_DNS_NUM + 1 ] ; int nameserver_num = 0 ; jconf_t * conf = NULL ; static struct option long_options [ ] = { { "fast-open" , no_argument , NULL , GETOPT_VAL_FAST_OPEN } , { "reuse-port" , no_argument , NULL , GETOPT_VAL_REUSE_PORT } , { "acl" , required_argument , NULL , GETOPT_VAL_ACL } , { "manager-address" , required_argument , NULL , GETOPT_VAL_MANAGER_ADDRESS } , { "executable" , required_argument , NULL , GETOPT_VAL_EXECUTABLE } , { "mtu" , required_argument , NULL , GETOPT_VAL_MTU } , { "plugin" , required_argument , NULL , GETOPT_VAL_PLUGIN } , { "plugin-opts" , required_argument , NULL , GETOPT_VAL_PLUGIN_OPTS } , { "password" , required_argument , NULL , GETOPT_VAL_PASSWORD } , { "help" , no_argument , NULL , GETOPT_VAL_HELP } , { NULL , 0 , NULL , 0 } } ; opterr = 0 ; USE_TTY ( ) ; while ( ( c = getopt_long ( argc , argv , "f:s:l:k:t:m:c:i:d:a:n:6huUvA" , long_options , NULL ) ) != - 1 ) switch ( c ) { case GETOPT_VAL_REUSE_PORT : reuse_port = 1 ; break ; case GETOPT_VAL_FAST_OPEN : fast_open = 1 ; break ; case GETOPT_VAL_ACL : acl = optarg ; break ; case GETOPT_VAL_MANAGER_ADDRESS : manager_address = optarg ; break ; case GETOPT_VAL_EXECUTABLE : executable = optarg ; break ; case GETOPT_VAL_MTU : mtu = atoi ( optarg ) ; break ; case GETOPT_VAL_PLUGIN : plugin = optarg ; break ; case GETOPT_VAL_PLUGIN_OPTS : plugin_opts = optarg ; break ; case 's' : if ( server_num < MAX_REMOTE_NUM ) { server_host [ server_num ++ ] = optarg ; } break ; case GETOPT_VAL_PASSWORD : case 'k' : password = optarg ; break ; case 'f' : pid_flags = 1 ; pid_path = optarg ; break ; case 't' : timeout = optarg ; break ; case 'm' : method = optarg ; break ; case 'c' : conf_path = optarg ; break ; case 'i' : iface = optarg ; break ; case 'd' : if ( nameserver_num < MAX_DNS_NUM ) { nameservers [ nameserver_num ++ ] = optarg ; } break ; case 'a' : user = optarg ; break ; case 'u' : mode = TCP_AND_UDP ; break ; case 'U' : mode = UDP_ONLY ; break ; case '6' : ipv6first = 1 ; break ; case 'v' : verbose = 1 ; break ; case GETOPT_VAL_HELP : case 'h' : usage ( ) ; exit ( EXIT_SUCCESS ) ; # ifdef HAVE_SETRLIMIT case 'n' : nofile = atoi ( optarg ) ; break ; # endif case 'A' : FATAL ( "One time auth has been deprecated. Try AEAD ciphers instead." ) ; break ; case '?' : LOGE ( "Unrecognized option: %s" , optarg ) ; opterr = 1 ; break ; } if ( opterr ) { usage ( ) ; exit ( EXIT_FAILURE ) ; } if ( conf_path != NULL ) { conf = read_jconf ( conf_path ) ; if ( server_num == 0 ) { server_num = conf -> remote_num ; for ( i = 0 ; i < server_num ; i ++ ) server_host [ i ] = conf -> remote_addr [ i ] . host ; } if ( password == NULL ) { password = conf -> password ; } if ( method == NULL ) { method = conf -> method ; } if ( timeout == NULL ) { timeout = conf -> timeout ; } if ( user == NULL ) { user = conf -> user ; } if ( fast_open == 0 ) { fast_open = conf -> fast_open ; } if ( reuse_port == 0 ) { reuse_port = conf -> reuse_port ; } if ( conf -> nameserver != NULL ) { nameservers [ nameserver_num ++ ] = conf -> nameserver ; } if ( mode == TCP_ONLY ) { mode = conf -> mode ; } if ( mtu == 0 ) { mtu = conf -> mtu ; } if ( plugin == NULL ) { plugin = conf -> plugin ; } if ( plugin_opts == NULL ) { plugin_opts = conf -> plugin_opts ; } if ( ipv6first == 0 ) { ipv6first = conf -> ipv6_first ; } # ifdef HAVE_SETRLIMIT if ( nofile == 0 ) { nofile = conf -> nofile ; } # endif } if ( server_num == 0 ) { server_host [ server_num ++ ] = "0.0.0.0" ; } if ( method == NULL ) { method = "table" ; } if ( timeout == NULL ) { timeout = "60" ; } USE_SYSLOG ( argv [ 0 ] , pid_flags ) ; if ( pid_flags ) { daemonize ( pid_path ) ; } if ( manager_address == NULL ) { manager_address = "127.0.0.1:8839" ; LOGI ( "using the default manager address: %s" , manager_address ) ; } if ( server_num == 0 || manager_address == NULL ) { usage ( ) ; exit ( EXIT_FAILURE ) ; } if ( fast_open == 1 ) { # ifdef TCP_FASTOPEN LOGI ( "using tcp fast open" ) ; # else LOGE ( "tcp fast open is not supported by this environment" ) ; # endif } signal ( SIGPIPE , SIG_IGN ) ; signal ( SIGCHLD , SIG_IGN ) ; signal ( SIGABRT , SIG_IGN ) ; struct ev_signal sigint_watcher ; struct ev_signal sigterm_watcher ; ev_signal_init ( & sigint_watcher , signal_cb , SIGINT ) ; ev_signal_init ( & sigterm_watcher , signal_cb , SIGTERM ) ; ev_signal_start ( EV_DEFAULT , & sigint_watcher ) ; ev_signal_start ( EV_DEFAULT , & sigterm_watcher ) ; struct manager_ctx manager ; memset ( & manager , 0 , sizeof ( struct manager_ctx ) ) ; manager . reuse_port = reuse_port ; manager . fast_open = fast_open ; manager . verbose = verbose ; manager . mode = mode ; manager . password = password ; manager . timeout = timeout ; manager . method = method ; manager . iface = iface ; manager . acl = acl ; manager . user = user ; manager . manager_address = manager_address ; manager . hosts = server_host ; manager . host_num = server_num ; manager . nameservers = nameservers ; manager . nameserver_num = nameserver_num ; manager . mtu = mtu ; manager . plugin = plugin ; manager . plugin_opts = plugin_opts ; manager . ipv6first = ipv6first ; # ifdef HAVE_SETRLIMIT manager . nofile = nofile ; # endif struct ev_loop * loop = EV_DEFAULT ; if ( geteuid ( ) == 0 ) { LOGI ( "running from root user" ) ; } struct passwd * pw = getpwuid ( getuid ( ) ) ; const char * homedir = pw -> pw_dir ; working_dir_size = strlen ( homedir ) + 15 ; working_dir = ss_malloc ( working_dir_size ) ; snprintf ( working_dir , working_dir_size , "%s/.shadowsocks" , homedir ) ; int err = mkdir ( working_dir , S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH ) ; if ( err != 0 && errno != EEXIST ) { ERROR ( "mkdir" ) ; ss_free ( working_dir ) ; FATAL ( "unable to create working directory" ) ; } DIR * dp ; struct dirent * ep ; dp = opendir ( working_dir ) ; if ( dp != NULL ) { while ( ( ep = readdir ( dp ) ) != NULL ) { size_t len = strlen ( ep -> d_name ) ; if ( strcmp ( ep -> d_name + len - 3 , "pid" ) == 0 ) { kill_server ( working_dir , ep -> d_name ) ; if ( verbose ) LOGI ( "kill %s" , ep -> d_name ) ; } } closedir ( dp ) ; } else { ss_free ( working_dir ) ; FATAL ( "Couldn't open the directory" ) ; } server_table = cork_string_hash_table_new ( MAX_PORT_NUM , 0 ) ; if ( conf != NULL ) { for ( i = 0 ; i < conf -> port_password_num ; i ++ ) { struct server * server = ss_malloc ( sizeof ( struct server ) ) ; memset ( server , 0 , sizeof ( struct server ) ) ; strncpy ( server -> port , conf -> port_password [ i ] . port , 8 ) ; strncpy ( server -> password , conf -> port_password [ i ] . password , 128 ) ; add_server ( & manager , server ) ; } } int sfd ; ss_addr_t ip_addr = { . host = NULL , . port = NULL } ; parse_addr ( manager_address , & ip_addr ) ; if ( ip_addr . host == NULL || ip_addr . port == NULL ) { struct sockaddr_un svaddr ; sfd = socket ( AF_UNIX , SOCK_DGRAM , 0 ) ; if ( sfd == - 1 ) { ss_free ( working_dir ) ; FATAL ( "socket" ) ; } setnonblocking ( sfd ) ; if ( remove ( manager_address ) == - 1 && errno != ENOENT ) { ERROR ( "bind" ) ; ss_free ( working_dir ) ; exit ( EXIT_FAILURE ) ; } memset ( & svaddr , 0 , sizeof ( struct sockaddr_un ) ) ; svaddr . sun_family = AF_UNIX ; strncpy ( svaddr . sun_path , manager_address , sizeof ( svaddr . sun_path ) - 1 ) ; if ( bind ( sfd , ( struct sockaddr * ) & svaddr , sizeof ( struct sockaddr_un ) ) == - 1 ) { ERROR ( "bind" ) ; ss_free ( working_dir ) ; exit ( EXIT_FAILURE ) ; } } else { sfd = create_server_socket ( ip_addr . host , ip_addr . port ) ; if ( sfd == - 1 ) { ss_free ( working_dir ) ; FATAL ( "socket" ) ; } } manager . fd = sfd ; ev_io_init ( & manager . io , manager_recv_cb , manager . fd , EV_READ ) ; ev_io_start ( loop , & manager . io ) ; ev_run ( loop , 0 ) ; if ( verbose ) { LOGI ( "closed gracefully" ) ; } struct cork_hash_table_entry * entry ; struct cork_hash_table_iterator server_iter ; cork_hash_table_iterator_init ( server_table , & server_iter ) ; while ( ( entry = cork_hash_table_iterator_next ( & server_iter ) ) != NULL ) { struct server * server = ( struct server * ) entry -> value ; stop_server ( working_dir , server -> port ) ; } ev_signal_stop ( EV_DEFAULT , & sigint_watcher ) ; ev_signal_stop ( EV_DEFAULT , & sigterm_watcher ) ; ss_free ( working_dir ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ProfileInfoCacheTest , GAIAName ) { GetCache ( ) -> AddProfileToCache ( GetProfilePath ( "path_1" ) , ASCIIToUTF16 ( "Person 1" ) , base : : string16 ( ) , 0 , std : : string ( ) ) ; base : : string16 profile_name ( ASCIIToUTF16 ( "Person 2" ) ) ; GetCache ( ) -> AddProfileToCache ( GetProfilePath ( "path_2" ) , profile_name , base : : string16 ( ) , 0 , std : : string ( ) ) ; int index1 = GetCache ( ) -> GetIndexOfProfileWithPath ( GetProfilePath ( "path_1" ) ) ; int index2 = GetCache ( ) -> GetIndexOfProfileWithPath ( GetProfilePath ( "path_2" ) ) ; EXPECT_TRUE ( GetCache ( ) -> GetGAIANameOfProfileAtIndex ( index1 ) . empty ( ) ) ; EXPECT_TRUE ( GetCache ( ) -> GetGAIANameOfProfileAtIndex ( index2 ) . empty ( ) ) ; base : : string16 gaia_name ( ASCIIToUTF16 ( "Pat Smith" ) ) ; GetCache ( ) -> SetGAIANameOfProfileAtIndex ( index2 , gaia_name ) ; index1 = GetCache ( ) -> GetIndexOfProfileWithPath ( GetProfilePath ( "path_1" ) ) ; index2 = GetCache ( ) -> GetIndexOfProfileWithPath ( GetProfilePath ( "path_2" ) ) ; EXPECT_TRUE ( GetCache ( ) -> GetGAIANameOfProfileAtIndex ( index1 ) . empty ( ) ) ; EXPECT_EQ ( gaia_name , GetCache ( ) -> GetGAIANameOfProfileAtIndex ( index2 ) ) ; EXPECT_EQ ( gaia_name , GetCache ( ) -> GetNameOfProfileAtIndex ( index2 ) ) ; base : : string16 custom_name ( ASCIIToUTF16 ( "Custom name" ) ) ; GetCache ( ) -> SetNameOfProfileAtIndex ( index2 , custom_name ) ; GetCache ( ) -> SetProfileIsUsingDefaultNameAtIndex ( index2 , false ) ; index1 = GetCache ( ) -> GetIndexOfProfileWithPath ( GetProfilePath ( "path_1" ) ) ; index2 = GetCache ( ) -> GetIndexOfProfileWithPath ( GetProfilePath ( "path_2" ) ) ; EXPECT_EQ ( custom_name , GetCache ( ) -> GetNameOfProfileAtIndex ( index2 ) ) ; EXPECT_EQ ( gaia_name , GetCache ( ) -> GetGAIANameOfProfileAtIndex ( index2 ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int finish_transfer ( const char * fname , const char * fnametmp , const char * fnamecmp , const char * partialptr , struct file_struct * file , int ok_to_set_time , int overwriting_basis ) { int ret ; const char * temp_copy_name = partialptr && * partialptr != '/' ? partialptr : NULL ; if ( inplace ) { if ( DEBUG_GTE ( RECV , 1 ) ) rprintf ( FINFO , "finishing %s\n" , fname ) ; fnametmp = fname ; goto do_set_file_attrs ; } if ( make_backups > 0 && overwriting_basis ) { int ok = make_backup ( fname , False ) ; if ( ! ok ) exit_cleanup ( RERR_FILEIO ) ; if ( ok == 1 && fnamecmp == fname ) fnamecmp = get_backup_name ( fname ) ; } set_file_attrs ( fnametmp , file , NULL , fnamecmp , ok_to_set_time ? 0 : ATTRS_SKIP_MTIME ) ; if ( DEBUG_GTE ( RECV , 1 ) ) rprintf ( FINFO , "renaming %s to %s\n" , fnametmp , fname ) ; ret = robust_rename ( fnametmp , fname , temp_copy_name , file -> mode ) ; if ( ret < 0 ) { rsyserr ( FERROR_XFER , errno , "%s %s -> \"%s\"" , ret == - 2 ? "copy" : "rename" , full_fname ( fnametmp ) , fname ) ; if ( ! partialptr || ( ret == - 2 && temp_copy_name ) || robust_rename ( fnametmp , partialptr , NULL , file -> mode ) < 0 ) do_unlink ( fnametmp ) ; return 0 ; } if ( ret == 0 ) { return 1 ; } fnametmp = temp_copy_name ? temp_copy_name : fname ; do_set_file_attrs : set_file_attrs ( fnametmp , file , NULL , fnamecmp , ok_to_set_time ? 0 : ATTRS_SKIP_MTIME ) ; if ( temp_copy_name ) { if ( do_rename ( fnametmp , fname ) < 0 ) { rsyserr ( FERROR_XFER , errno , "rename %s -> \"%s\"" , full_fname ( fnametmp ) , fname ) ; return 0 ; } handle_partial_dir ( temp_copy_name , PDIR_DELETE ) ; } return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
PGconn * connectToServer ( ClusterInfo * cluster , const char * db_name ) { PGconn * conn = get_db_conn ( cluster , db_name ) ; if ( conn == NULL || PQstatus ( conn ) != CONNECTION_OK ) { pg_log ( PG_REPORT , "connection to database failed: %s\n" , PQerrorMessage ( conn ) ) ; if ( conn ) PQfinish ( conn ) ; printf ( "Failure, exiting\n" ) ; exit ( 1 ) ; } return conn ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pirlvl_destroy ( jpc_pirlvl_t * rlvl ) { if ( rlvl -> prclyrnos ) { jas_free ( rlvl -> prclyrnos ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_g7231 ( 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_T_g7231 , T_g7231_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ShortcutsProviderTest , DaysAgoMatches ) { base : : string16 text ( ASCIIToUTF16 ( "ago" ) ) ; ExpectedURLs expected_urls ; expected_urls . push_back ( ExpectedURLAndAllowedToBeDefault ( "http://www.daysagotest.com/a.html" , false ) ) ; expected_urls . push_back ( ExpectedURLAndAllowedToBeDefault ( "http://www.daysagotest.com/b.html" , false ) ) ; expected_urls . push_back ( ExpectedURLAndAllowedToBeDefault ( "http://www.daysagotest.com/c.html" , false ) ) ; RunShortcutsProviderTest ( provider_ , text , false , expected_urls , "http://www.daysagotest.com/a.html" , base : : string16 ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void Type_Dictionary_Free ( struct _cms_typehandler_struct * self , void * Ptr ) { cmsDictFree ( ( cmsHANDLE ) Ptr ) ; cmsUNUSED_PARAMETER ( self ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vc1_mc_4mv_chroma ( VC1Context * v , int dir ) { MpegEncContext * s = & v -> s ; H264ChromaContext * h264chroma = & v -> h264chroma ; uint8_t * srcU , * srcV ; int uvmx , uvmy , uvsrc_x , uvsrc_y ; int k , tx = 0 , ty = 0 ; int mvx [ 4 ] , mvy [ 4 ] , intra [ 4 ] , mv_f [ 4 ] ; int valid_count ; int chroma_ref_type = v -> cur_field_type , off = 0 ; int v_edge_pos = s -> v_edge_pos >> v -> field_mode ; if ( ! v -> field_mode && ! v -> s . last_picture . f . data [ 0 ] ) return ; if ( s -> flags & CODEC_FLAG_GRAY ) return ; for ( k = 0 ; k < 4 ; k ++ ) { mvx [ k ] = s -> mv [ dir ] [ k ] [ 0 ] ; mvy [ k ] = s -> mv [ dir ] [ k ] [ 1 ] ; intra [ k ] = v -> mb_type [ 0 ] [ s -> block_index [ k ] ] ; if ( v -> field_mode ) mv_f [ k ] = v -> mv_f [ dir ] [ s -> block_index [ k ] + v -> blocks_off ] ; } if ( ! v -> field_mode || ( v -> field_mode && ! v -> numref ) ) { valid_count = get_chroma_mv ( mvx , mvy , intra , 0 , & tx , & ty ) ; chroma_ref_type = v -> reffield ; if ( ! valid_count ) { s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 0 ] = 0 ; s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 1 ] = 0 ; v -> luma_mv [ s -> mb_x ] [ 0 ] = v -> luma_mv [ s -> mb_x ] [ 1 ] = 0 ; return ; / o need to do MC for intra blocks } } else { int dominant = 0 ; if ( mv_f [ 0 ] + mv_f [ 1 ] + mv_f [ 2 ] + mv_f [ 3 ] > 2 ) dominant = 1 ; valid_count = get_chroma_mv ( mvx , mvy , mv_f , dominant , & tx , & ty ) ; if ( dominant ) chroma_ref_type = ! v -> cur_field_type ; } if ( v -> field_mode && chroma_ref_type == 1 && v -> cur_field_type == 1 && ! v -> s . last_picture . f . data [ 0 ] ) return ; s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 0 ] = tx ; s -> current_picture . f . motion_val [ 1 ] [ s -> block_index [ 0 ] + v -> blocks_off ] [ 1 ] = ty ; uvmx = ( tx + ( ( tx & 3 ) == 3 ) ) >> 1 ; uvmy = ( ty + ( ( ty & 3 ) == 3 ) ) >> 1 ; v -> luma_mv [ s -> mb_x ] [ 0 ] = uvmx ; v -> luma_mv [ s -> mb_x ] [ 1 ] = uvmy ; if ( v -> fastuvmc ) { uvmx = uvmx + ( ( uvmx < 0 ) ? ( uvmx & 1 ) : - ( uvmx & 1 ) ) ; uvmy = uvmy + ( ( uvmy < 0 ) ? ( uvmy & 1 ) : - ( uvmy & 1 ) ) ; } if ( v -> cur_field_type != chroma_ref_type ) uvmy += 2 - 4 * chroma_ref_type ; uvsrc_x = s -> mb_x * 8 + ( uvmx >> 2 ) ; uvsrc_y = s -> mb_y * 8 + ( uvmy >> 2 ) ; if ( v -> profile != PROFILE_ADVANCED ) { uvsrc_x = av_clip ( uvsrc_x , - 8 , s -> mb_width * 8 ) ; uvsrc_y = av_clip ( uvsrc_y , - 8 , s -> mb_height * 8 ) ; } else { uvsrc_x = av_clip ( uvsrc_x , - 8 , s -> avctx -> coded_width >> 1 ) ; uvsrc_y = av_clip ( uvsrc_y , - 8 , s -> avctx -> coded_height >> 1 ) ; } if ( ! dir ) { if ( v -> field_mode ) { if ( ( v -> cur_field_type != chroma_ref_type ) && v -> cur_field_type ) { srcU = s -> current_picture . f . data [ 1 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; srcV = s -> current_picture . f . data [ 2 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; } else { srcU = s -> last_picture . f . data [ 1 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; srcV = s -> last_picture . f . data [ 2 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; } } else { srcU = s -> last_picture . f . data [ 1 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; srcV = s -> last_picture . f . data [ 2 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; } } else { srcU = s -> next_picture . f . data [ 1 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; srcV = s -> next_picture . f . data [ 2 ] + uvsrc_y * s -> uvlinesize + uvsrc_x ; } if ( v -> field_mode ) { if ( chroma_ref_type ) { srcU += s -> current_picture_ptr -> f . linesize [ 1 ] ; srcV += s -> current_picture_ptr -> f . linesize [ 2 ] ; } off = v -> cur_field_type ? s -> current_picture_ptr -> f . linesize [ 1 ] : 0 ; } if ( v -> rangeredfrm || ( v -> mv_mode == MV_PMODE_INTENSITY_COMP ) || s -> h_edge_pos < 18 || v_edge_pos < 18 || ( unsigned ) uvsrc_x > ( s -> h_edge_pos >> 1 ) - 9 || ( unsigned ) uvsrc_y > ( v_edge_pos >> 1 ) - 9 ) { s -> vdsp . emulated_edge_mc ( s -> edge_emu_buffer , srcU , s -> uvlinesize , 8 + 1 , 8 + 1 , uvsrc_x , uvsrc_y , s -> h_edge_pos >> 1 , v_edge_pos >> 1 ) ; s -> vdsp . emulated_edge_mc ( s -> edge_emu_buffer + 16 , srcV , s -> uvlinesize , 8 + 1 , 8 + 1 , uvsrc_x , uvsrc_y , s -> h_edge_pos >> 1 , v_edge_pos >> 1 ) ; srcU = s -> edge_emu_buffer ; srcV = s -> edge_emu_buffer + 16 ; if ( v -> rangeredfrm ) { int i , j ; uint8_t * src , * src2 ; src = srcU ; src2 = srcV ; for ( j = 0 ; j < 9 ; j ++ ) { for ( i = 0 ; i < 9 ; i ++ ) { src [ i ] = ( ( src [ i ] - 128 ) >> 1 ) + 128 ; src2 [ i ] = ( ( src2 [ i ] - 128 ) >> 1 ) + 128 ; } src += s -> uvlinesize ; src2 += s -> uvlinesize ; } } if ( v -> mv_mode == MV_PMODE_INTENSITY_COMP ) { int i , j ; uint8_t * src , * src2 ; src = srcU ; src2 = srcV ; for ( j = 0 ; j < 9 ; j ++ ) { for ( i = 0 ; i < 9 ; i ++ ) { src [ i ] = v -> lutuv [ src [ i ] ] ; src2 [ i ] = v -> lutuv [ src2 [ i ] ] ; } src += s -> uvlinesize ; src2 += s -> uvlinesize ; } } } uvmx = ( uvmx & 3 ) << 1 ; uvmy = ( uvmy & 3 ) << 1 ; if ( ! v -> rnd ) { h264chroma -> put_h264_chroma_pixels_tab [ 0 ] ( s -> dest [ 1 ] + off , srcU , s -> uvlinesize , 8 , uvmx , uvmy ) ; h264chroma -> put_h264_chroma_pixels_tab [ 0 ] ( s -> dest [ 2 ] + off , srcV , s -> uvlinesize , 8 , uvmx , uvmy ) ; } else { v -> vc1dsp . put_no_rnd_vc1_chroma_pixels_tab [ 0 ] ( s -> dest [ 1 ] + off , srcU , s -> uvlinesize , 8 , uvmx , uvmy ) ; v -> vc1dsp . put_no_rnd_vc1_chroma_pixels_tab [ 0 ] ( s -> dest [ 2 ] + off , srcV , s -> uvlinesize , 8 , uvmx , uvmy ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
void TSTextLogObjectFlush ( TSTextLogObject the_object ) { sdk_assert ( sdk_sanity_check_iocore_structure ( the_object ) == TS_SUCCESS ) ; ( ( TextLogObject * ) the_object ) -> force_new_buffer ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void Type_UcrBg_Free ( struct _cms_typehandler_struct * self , void * Ptr ) { cmsUcrBg * Src = ( cmsUcrBg * ) Ptr ; if ( Src -> Ucr ) cmsFreeToneCurve ( Src -> Ucr ) ; if ( Src -> Bg ) cmsFreeToneCurve ( Src -> Bg ) ; if ( Src -> Desc ) cmsMLUfree ( Src -> Desc ) ; _cmsFree ( self -> ContextID , Ptr ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
ssize_t e1000e_receive_iov ( E1000ECore * core , const struct iovec * iov , int iovcnt ) { static const int maximum_ethernet_hdr_len = ( 14 + 4 ) ; static const int min_buf_size = 60 ; uint32_t n = 0 ; uint8_t min_buf [ min_buf_size ] ; struct iovec min_iov ; uint8_t * filter_buf ; size_t size , orig_size ; size_t iov_ofs = 0 ; E1000E_RxRing rxr ; E1000E_RSSInfo rss_info ; size_t total_size ; ssize_t retval ; bool rdmts_hit ; trace_e1000e_rx_receive_iov ( iovcnt ) ; if ( ! e1000x_hw_rx_enabled ( core -> mac ) ) { return - 1 ; } if ( core -> has_vnet ) { net_rx_pkt_set_vhdr_iovec ( core -> rx_pkt , iov , iovcnt ) ; iov_ofs = sizeof ( struct virtio_net_hdr ) ; } filter_buf = iov -> iov_base + iov_ofs ; orig_size = iov_size ( iov , iovcnt ) ; size = orig_size - iov_ofs ; if ( size < sizeof ( min_buf ) ) { iov_to_buf ( iov , iovcnt , iov_ofs , min_buf , size ) ; memset ( & min_buf [ size ] , 0 , sizeof ( min_buf ) - size ) ; e1000x_inc_reg_if_not_full ( core -> mac , RUC ) ; min_iov . iov_base = filter_buf = min_buf ; min_iov . iov_len = size = sizeof ( min_buf ) ; iovcnt = 1 ; iov = & min_iov ; iov_ofs = 0 ; } else if ( iov -> iov_len < maximum_ethernet_hdr_len ) { iov_to_buf ( iov , iovcnt , iov_ofs , min_buf , maximum_ethernet_hdr_len ) ; filter_buf = min_buf ; } if ( e1000x_is_oversized ( core -> mac , size ) ) { return orig_size ; } net_rx_pkt_set_packet_type ( core -> rx_pkt , get_eth_packet_type ( PKT_GET_ETH_HDR ( filter_buf ) ) ) ; if ( ! e1000e_receive_filter ( core , filter_buf , size ) ) { trace_e1000e_rx_flt_dropped ( ) ; return orig_size ; } net_rx_pkt_attach_iovec_ex ( core -> rx_pkt , iov , iovcnt , iov_ofs , e1000x_vlan_enabled ( core -> mac ) , core -> vet ) ; e1000e_rss_parse_packet ( core , core -> rx_pkt , & rss_info ) ; e1000e_rx_ring_init ( core , & rxr , rss_info . queue ) ; trace_e1000e_rx_rss_dispatched_to_queue ( rxr . i -> idx ) ; total_size = net_rx_pkt_get_total_len ( core -> rx_pkt ) + e1000x_fcs_len ( core -> mac ) ; if ( e1000e_has_rxbufs ( core , rxr . i , total_size ) ) { e1000e_rx_fix_l4_csum ( core , core -> rx_pkt ) ; e1000e_write_packet_to_guest ( core , core -> rx_pkt , & rxr , & rss_info ) ; retval = orig_size ; if ( total_size < core -> mac [ RSRPD ] ) { n |= E1000_ICS_SRPD ; } if ( ! ( core -> mac [ RFCTL ] & E1000_RFCTL_ACK_DIS ) && ( e1000e_is_tcp_ack ( core , core -> rx_pkt ) ) ) { n |= E1000_ICS_ACK ; } rdmts_hit = e1000e_rx_descr_threshold_hit ( core , rxr . i ) ; n |= e1000e_rx_wb_interrupt_cause ( core , rxr . i -> idx , rdmts_hit ) ; trace_e1000e_rx_written_to_guest ( n ) ; } else { n |= E1000_ICS_RXO ; retval = 0 ; trace_e1000e_rx_not_written_to_guest ( n ) ; } if ( ! e1000e_intrmgr_delay_rx_causes ( core , & n ) ) { trace_e1000e_rx_interrupt_set ( n ) ; e1000e_set_interrupt_cause ( core , n ) ; } else { trace_e1000e_rx_interrupt_delayed ( n ) ; } return retval ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
kadm5_ret_t kadm5_chpass_principal_3 ( void * server_handle , krb5_principal principal , krb5_boolean keepold , int n_ks_tuple , krb5_key_salt_tuple * ks_tuple , char * password ) { krb5_int32 now ; kadm5_policy_ent_rec pol ; osa_princ_ent_rec adb ; krb5_db_entry * kdb ; int ret , ret2 , last_pwd , hist_added ; krb5_boolean have_pol = FALSE ; kadm5_server_handle_t handle = server_handle ; osa_pw_hist_ent hist ; krb5_keyblock * act_mkey , * hist_keyblocks = NULL ; krb5_kvno act_kvno , hist_kvno ; int new_n_ks_tuple = 0 ; krb5_key_salt_tuple * new_ks_tuple = NULL ; CHECK_HANDLE ( server_handle ) ; krb5_clear_error_message ( handle -> context ) ; hist_added = 0 ; memset ( & hist , 0 , sizeof ( hist ) ) ; if ( principal == NULL || password == NULL ) return EINVAL ; if ( ( krb5_principal_compare ( handle -> context , principal , hist_princ ) ) == TRUE ) return KADM5_PROTECT_PRINCIPAL ; if ( ( ret = kdb_get_entry ( handle , principal , & kdb , & adb ) ) ) return ( ret ) ; ret = apply_keysalt_policy ( handle , adb . policy , n_ks_tuple , ks_tuple , & new_n_ks_tuple , & new_ks_tuple ) ; if ( ret ) goto done ; if ( ( adb . aux_attributes & KADM5_POLICY ) ) { ret = get_policy ( handle , adb . policy , & pol , & have_pol ) ; if ( ret ) goto done ; } if ( have_pol ) { ret = kdb_get_hist_key ( handle , & hist_keyblocks , & hist_kvno ) ; if ( ret ) goto done ; ret = create_history_entry ( handle -> context , & hist_keyblocks [ 0 ] , kdb -> n_key_data , kdb -> key_data , & hist ) ; if ( ret ) goto done ; } if ( ( ret = passwd_check ( handle , password , have_pol ? & pol : NULL , principal ) ) ) goto done ; ret = kdb_get_active_mkey ( handle , & act_kvno , & act_mkey ) ; if ( ret ) goto done ; ret = krb5_dbe_cpw ( handle -> context , act_mkey , new_ks_tuple , new_n_ks_tuple , password , 0 , keepold , kdb ) ; if ( ret ) goto done ; ret = krb5_dbe_update_mkvno ( handle -> context , kdb , act_kvno ) ; if ( ret ) goto done ; kdb -> attributes &= ~ KRB5_KDB_REQUIRES_PWCHANGE ; ret = krb5_timeofday ( handle -> context , & now ) ; if ( ret ) goto done ; if ( ( adb . aux_attributes & KADM5_POLICY ) ) { ret = krb5_dbe_lookup_last_pwd_change ( handle -> context , kdb , & last_pwd ) ; if ( ret ) goto done ; # if 0 if ( ( now - last_pwd ) < pol . pw_min_life && ! ( kdb -> attributes & KRB5_KDB_REQUIRES_PWCHANGE ) ) { ret = KADM5_PASS_TOOSOON ; goto done ; } # endif ret = check_pw_reuse ( handle -> context , hist_keyblocks , kdb -> n_key_data , kdb -> key_data , 1 , & hist ) ; if ( ret ) goto done ; if ( pol . pw_history_num > 1 ) { if ( adb . admin_history_kvno == hist_kvno ) { ret = check_pw_reuse ( handle -> context , hist_keyblocks , kdb -> n_key_data , kdb -> key_data , adb . old_key_len , adb . old_keys ) ; if ( ret ) goto done ; } ret = add_to_history ( handle -> context , hist_kvno , & adb , & pol , & hist ) ; if ( ret ) goto done ; hist_added = 1 ; } if ( pol . pw_max_life ) kdb -> pw_expiration = now + pol . pw_max_life ; else kdb -> pw_expiration = 0 ; } else { kdb -> pw_expiration = 0 ; } # ifdef USE_PASSWORD_SERVER if ( kadm5_use_password_server ( ) && ( krb5_princ_size ( handle -> context , principal ) == 1 ) ) { krb5_data * princ = krb5_princ_component ( handle -> context , principal , 0 ) ; const char * path = "/usr/sbin/mkpassdb" ; char * argv [ ] = { "mkpassdb" , "-setpassword" , NULL , NULL } ; char * pstring = NULL ; if ( ! ret ) { pstring = malloc ( ( princ -> length + 1 ) * sizeof ( char ) ) ; if ( pstring == NULL ) { ret = ENOMEM ; } } if ( ! ret ) { memcpy ( pstring , princ -> data , princ -> length ) ; pstring [ princ -> length ] = '\0' ; argv [ 2 ] = pstring ; ret = kadm5_launch_task ( handle -> context , path , argv , password ) ; } if ( pstring != NULL ) free ( pstring ) ; if ( ret ) goto done ; } # endif ret = krb5_dbe_update_last_pwd_change ( handle -> context , kdb , now ) ; if ( ret ) goto done ; kdb -> fail_auth_count = 0 ; kdb -> mask = KADM5_KEY_DATA | KADM5_ATTRIBUTES | KADM5_FAIL_AUTH_COUNT ; ret = k5_kadm5_hook_chpass ( handle -> context , handle -> hook_handles , KADM5_HOOK_STAGE_PRECOMMIT , principal , keepold , new_n_ks_tuple , new_ks_tuple , password ) ; if ( ret ) goto done ; if ( ( ret = kdb_put_entry ( handle , kdb , & adb ) ) ) goto done ; ( void ) k5_kadm5_hook_chpass ( handle -> context , handle -> hook_handles , KADM5_HOOK_STAGE_POSTCOMMIT , principal , keepold , new_n_ks_tuple , new_ks_tuple , password ) ; ret = KADM5_OK ; done : free ( new_ks_tuple ) ; if ( ! hist_added && hist . key_data ) free_history_entry ( handle -> context , & hist ) ; kdb_free_entry ( handle , kdb , & adb ) ; kdb_free_keyblocks ( handle , hist_keyblocks ) ; if ( have_pol && ( ret2 = kadm5_free_policy_ent ( handle -> lhandle , & pol ) ) && ! ret ) ret = ret2 ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int matroska_parse_rm_audio ( MatroskaDemuxContext * matroska , MatroskaTrack * track , AVStream * st , uint8_t * data , int size , uint64_t timecode , uint64_t duration , int64_t pos ) { int a = st -> codec -> block_align ; int sps = track -> audio . sub_packet_size ; int cfs = track -> audio . coded_framesize ; int h = track -> audio . sub_packet_h ; int y = track -> audio . sub_packet_cnt ; int w = track -> audio . frame_size ; int x ; if ( ! track -> audio . pkt_cnt ) { if ( track -> audio . sub_packet_cnt == 0 ) track -> audio . buf_timecode = timecode ; if ( st -> codec -> codec_id == AV_CODEC_ID_RA_288 ) { if ( size < cfs * h / 2 ) { av_log ( matroska -> ctx , AV_LOG_ERROR , "Corrupt int4 RM-style audio packet size\n" ) ; return AVERROR_INVALIDDATA ; } for ( x = 0 ; x < h / 2 ; x ++ ) memcpy ( track -> audio . buf + x * 2 * w + y * cfs , data + x * cfs , cfs ) ; } else if ( st -> codec -> codec_id == AV_CODEC_ID_SIPR ) { if ( size < w ) { av_log ( matroska -> ctx , AV_LOG_ERROR , "Corrupt sipr RM-style audio packet size\n" ) ; return AVERROR_INVALIDDATA ; } memcpy ( track -> audio . buf + y * w , data , w ) ; } else { if ( size < sps * w / sps ) { av_log ( matroska -> ctx , AV_LOG_ERROR , "Corrupt generic RM-style audio packet size\n" ) ; return AVERROR_INVALIDDATA ; } for ( x = 0 ; x < w / sps ; x ++ ) memcpy ( track -> audio . buf + sps * ( h * x + ( ( h + 1 ) / 2 ) * ( y & 1 ) + ( y >> 1 ) ) , data + x * sps , sps ) ; } if ( ++ track -> audio . sub_packet_cnt >= h ) { if ( st -> codec -> codec_id == AV_CODEC_ID_SIPR ) ff_rm_reorder_sipr_data ( track -> audio . buf , h , w ) ; track -> audio . sub_packet_cnt = 0 ; track -> audio . pkt_cnt = h * w / a ; } } while ( track -> audio . pkt_cnt ) { int ret ; AVPacket * pkt = av_mallocz ( sizeof ( AVPacket ) ) ; if ( ! pkt ) return AVERROR ( ENOMEM ) ; ret = av_new_packet ( pkt , a ) ; if ( ret < 0 ) { av_free ( pkt ) ; return ret ; } memcpy ( pkt -> data , track -> audio . buf + a * ( h * w / a - track -> audio . pkt_cnt -- ) , a ) ; pkt -> pts = track -> audio . buf_timecode ; track -> audio . buf_timecode = AV_NOPTS_VALUE ; pkt -> pos = pos ; pkt -> stream_index = st -> index ; dynarray_add ( & matroska -> packets , & matroska -> num_packets , pkt ) ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int script_contents_read ( struct mail_user * user ) { struct fts_parser_script_user * suser = SCRIPT_USER_CONTEXT ( user ) ; const char * path , * cmd , * line ; char * * args ; struct istream * input ; struct content * content ; bool eof_seen = FALSE ; int fd , ret = 0 ; fd = script_connect ( user , & path ) ; if ( fd == - 1 ) return - 1 ; cmd = t_strdup_printf ( SCRIPT_HANDSHAKE "\n" ) ; if ( write_full ( fd , cmd , strlen ( cmd ) ) < 0 ) { i_error ( "write(%s) failed: %m" , path ) ; i_close_fd ( & fd ) ; return - 1 ; } input = i_stream_create_fd_autoclose ( & fd , 1024 ) ; while ( ( line = i_stream_read_next_line ( input ) ) != NULL ) { args = p_strsplit_spaces ( user -> pool , line , " " ) ; if ( args [ 0 ] == NULL ) { eof_seen = TRUE ; break ; } if ( args [ 0 ] [ 0 ] == '\0' || args [ 1 ] == NULL ) { i_error ( "parser script sent invalid input: %s" , line ) ; continue ; } content = array_append_space ( & suser -> content ) ; content -> content_type = args [ 0 ] ; content -> extensions = ( const void * ) ( args + 1 ) ; } if ( input -> stream_errno != 0 ) { i_error ( "parser script read(%s) failed: %s" , path , i_stream_get_error ( input ) ) ; ret = - 1 ; } else if ( ! eof_seen ) { if ( input -> v_offset == 0 ) i_error ( "parser script didn't send any data" ) ; else i_error ( "parser script didn't send empty EOF line" ) ; } i_stream_destroy ( & input ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void qio_channel_websock_register_types ( void ) { type_register_static ( & qio_channel_websock_info ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void name ## _free ( type * a ) ; # define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ; # define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ; TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ; # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ; # define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ; # else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ; # define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ; # endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st { int type ; union { char * ptr ; ASN1_BOOLEAN boolean ; ASN1_STRING * asn1_string ; ASN1_OBJECT * object ; ASN1_INTEGER * integer ; ASN1_ENUMERATED * enumerated ; ASN1_BIT_STRING * bit_string ; ASN1_OCTET_STRING * octet_string ; ASN1_PRINTABLESTRING * printablestring ; ASN1_T61STRING * t61string ; ASN1_IA5STRING * ia5string ; ASN1_GENERALSTRING * generalstring ; ASN1_BMPSTRING * bmpstring ; ASN1_UNIVERSALSTRING * universalstring ; ASN1_UTCTIME * utctime ; ASN1_GENERALIZEDTIME * generalizedtime ; ASN1_VISIBLESTRING * visiblestring ; ASN1_UTF8STRING * utf8string ; ASN1_STRING * set ; ASN1_STRING * sequence ; ASN1_VALUE * asn1_value ; } value ; } ASN1_TYPE ; DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ; DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st { int bitnum ; const char * lname ; const char * sname ; } BIT_STRING_BITNAME ; # define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ; void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ; int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ; int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ; ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ; void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ; ASN1_OBJECT * ASN1_OBJECT_new ( void ) ; void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ; int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ; ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ; DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ; void ASN1_STRING_free ( ASN1_STRING * a ) ; void ASN1_STRING_clear_free ( ASN1_STRING * a ) ; int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ; ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ; ASN1_STRING * ASN1_STRING_type_new ( int type ) ; int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ; int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ; void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ; int ASN1_STRING_length ( const ASN1_STRING * x ) ; void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ; int ASN1_STRING_type ( const ASN1_STRING * x ) ; DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ; int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ; int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ; int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ; int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ; int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ; int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ; ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ; int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ; ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ; ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ; int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ; int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ; int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ; ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ; ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ; int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ; int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ; int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ; int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) DECLARE_ASN1_FUNCTIONS ( ASN1_BMPSTRING ) int UTF8_getc ( const unsigned char * str , int len , unsigned long * val ) ; int UTF8_putc ( unsigned char * str , int len , unsigned long value ) ; DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , ASN1_PRINTABLE ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DIRECTORYSTRING ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DISPLAYTEXT ) DECLARE_ASN1_FUNCTIONS ( ASN1_PRINTABLESTRING )
1True
Categorize the following code snippet as vulnerable or not. True or False
static Asn1Generic * DecodeAsn1DerIA5String ( const unsigned char * buffer , uint32_t max_size , uint8_t depth , uint32_t * errcode ) { const unsigned char * d_ptr = buffer ; uint32_t length , numbytes ; Asn1Generic * a ; unsigned char c ; d_ptr ++ ; c = d_ptr [ 0 ] ; if ( ( c & ( 1 << 7 ) ) >> 7 == 0 ) { length = c ; d_ptr ++ ; } else { numbytes = c & 0x7f ; d_ptr ++ ; if ( DecodeAsn1BuildValue ( & d_ptr , & length , numbytes , errcode ) == - 1 ) { return NULL ; } } if ( length == UINT32_MAX || length > max_size ) { if ( errcode ) * errcode = ERR_DER_ELEMENT_SIZE_TOO_BIG ; return NULL ; } a = Asn1GenericNew ( ) ; if ( a == NULL ) return NULL ; a -> type = ASN1_IA5STRING ; a -> strlen = length ; a -> str = SCMalloc ( length + 1 ) ; if ( a -> str == NULL ) { SCFree ( a ) ; return NULL ; } strlcpy ( a -> str , ( const char * ) d_ptr , length + 1 ) ; d_ptr += length ; a -> length = ( d_ptr - buffer ) ; return a ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int main ( int argc , char * * argv ) { int frame_cnt = 0 ; FILE * outfile = NULL ; vpx_codec_ctx_t codec ; const VpxInterface * decoder = NULL ; VpxVideoReader * reader = NULL ; const VpxVideoInfo * info = NULL ; int n = 0 ; int m = 0 ; int is_range = 0 ; char * nptr = NULL ; exec_name = argv [ 0 ] ; if ( argc != 4 ) die ( "Invalid number of arguments." ) ; reader = vpx_video_reader_open ( argv [ 1 ] ) ; if ( ! reader ) die ( "Failed to open %s for reading." , argv [ 1 ] ) ; if ( ! ( outfile = fopen ( argv [ 2 ] , "wb" ) ) ) die ( "Failed to open %s for writing." , argv [ 2 ] ) ; n = strtol ( argv [ 3 ] , & nptr , 0 ) ; m = strtol ( nptr + 1 , NULL , 0 ) ; is_range = ( * nptr == '-' ) ; if ( ! n || ! m || ( * nptr != '-' && * nptr != '/' ) ) die ( "Couldn't parse pattern %s.\n" , argv [ 3 ] ) ; info = vpx_video_reader_get_info ( reader ) ; decoder = get_vpx_decoder_by_fourcc ( info -> codec_fourcc ) ; if ( ! decoder ) die ( "Unknown input codec." ) ; printf ( "Using %s\n" , vpx_codec_iface_name ( decoder -> codec_interface ( ) ) ) ; if ( vpx_codec_dec_init ( & codec , decoder -> codec_interface ( ) , NULL , 0 ) ) die_codec ( & codec , "Failed to initialize decoder." ) ; while ( vpx_video_reader_read_frame ( reader ) ) { vpx_codec_iter_t iter = NULL ; vpx_image_t * img = NULL ; size_t frame_size = 0 ; int skip ; const unsigned char * frame = vpx_video_reader_get_frame ( reader , & frame_size ) ; if ( vpx_codec_decode ( & codec , frame , ( unsigned int ) frame_size , NULL , 0 ) ) die_codec ( & codec , "Failed to decode frame." ) ; ++ frame_cnt ; skip = ( is_range && frame_cnt >= n && frame_cnt <= m ) || ( ! is_range && m - ( frame_cnt - 1 ) % m <= n ) ; if ( ! skip ) { putc ( '.' , stdout ) ; while ( ( img = vpx_codec_get_frame ( & codec , & iter ) ) != NULL ) vpx_img_write ( img , outfile ) ; } else { putc ( 'X' , stdout ) ; } fflush ( stdout ) ; } printf ( "Processed %d frames.\n" , frame_cnt ) ; if ( vpx_codec_destroy ( & codec ) ) die_codec ( & codec , "Failed to destroy codec." ) ; printf ( "Play: ffplay -f rawvideo -pix_fmt yuv420p -s %dx%d %s\n" , info -> frame_width , info -> frame_height , argv [ 2 ] ) ; vpx_video_reader_close ( reader ) ; fclose ( outfile ) ; return EXIT_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
rfbBool rfbSendLastRectMarker ( rfbClientPtr cl ) { rfbFramebufferUpdateRectHeader rect ; if ( cl -> ublen + sz_rfbFramebufferUpdateRectHeader > UPDATE_BUF_SIZE ) { if ( ! rfbSendUpdateBuf ( cl ) ) return FALSE ; } rect . encoding = Swap32IfLE ( rfbEncodingLastRect ) ; rect . r . x = 0 ; rect . r . y = 0 ; rect . r . w = 0 ; rect . r . h = 0 ; memcpy ( & cl -> updateBuf [ cl -> ublen ] , ( char * ) & rect , sz_rfbFramebufferUpdateRectHeader ) ; cl -> ublen += sz_rfbFramebufferUpdateRectHeader ; rfbStatRecordEncodingSent ( cl , rfbEncodingLastRect , sz_rfbFramebufferUpdateRectHeader , sz_rfbFramebufferUpdateRectHeader ) ; return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_find_best_sub_pixel_tree_pruned ( const MACROBLOCK * x , MV * bestmv , const MV * ref_mv , int allow_hp , int error_per_bit , const vp9_variance_fn_ptr_t * vfp , int forced_stop , int iters_per_step , int * sad_list , int * mvjcost , int * mvcost [ 2 ] , int * distortion , unsigned int * sse1 , const uint8_t * second_pred , int w , int h ) { SETUP_SUBPEL_SEARCH ; if ( sad_list && sad_list [ 0 ] != INT_MAX && sad_list [ 1 ] != INT_MAX && sad_list [ 2 ] != INT_MAX && sad_list [ 3 ] != INT_MAX && sad_list [ 4 ] != INT_MAX ) { unsigned int left , right , up , down , diag ; whichdir = ( sad_list [ 1 ] < sad_list [ 3 ] ? 0 : 1 ) + ( sad_list [ 2 ] < sad_list [ 4 ] ? 0 : 2 ) ; switch ( whichdir ) { case 0 : CHECK_BETTER ( left , tr , tc - hstep ) ; CHECK_BETTER ( down , tr + hstep , tc ) ; CHECK_BETTER ( diag , tr + hstep , tc - hstep ) ; break ; case 1 : CHECK_BETTER ( right , tr , tc + hstep ) ; CHECK_BETTER ( down , tr + hstep , tc ) ; CHECK_BETTER ( diag , tr + hstep , tc + hstep ) ; break ; case 2 : CHECK_BETTER ( left , tr , tc - hstep ) ; CHECK_BETTER ( up , tr - hstep , tc ) ; CHECK_BETTER ( diag , tr - hstep , tc - hstep ) ; break ; case 3 : CHECK_BETTER ( right , tr , tc + hstep ) ; CHECK_BETTER ( up , tr - hstep , tc ) ; CHECK_BETTER ( diag , tr - hstep , tc + hstep ) ; break ; } } else { FIRST_LEVEL_CHECKS ; if ( halfiters > 1 ) { SECOND_LEVEL_CHECKS ; } } tr = br ; tc = bc ; if ( forced_stop != 2 ) { hstep >>= 1 ; FIRST_LEVEL_CHECKS ; if ( quarteriters > 1 ) { SECOND_LEVEL_CHECKS ; } tr = br ; tc = bc ; } if ( allow_hp && vp9_use_mv_hp ( ref_mv ) && forced_stop == 0 ) { hstep >>= 1 ; FIRST_LEVEL_CHECKS ; if ( eighthiters > 1 ) { SECOND_LEVEL_CHECKS ; } tr = br ; tc = bc ; } ( void ) tr ; ( void ) tc ; bestmv -> row = br ; bestmv -> col = bc ; if ( ( abs ( bestmv -> col - ref_mv -> col ) > ( MAX_FULL_PEL_VAL << 3 ) ) || ( abs ( bestmv -> row - ref_mv -> row ) > ( MAX_FULL_PEL_VAL << 3 ) ) ) return INT_MAX ; return besterr ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int pxa2xx_i2c_initfn ( SysBusDevice * dev ) { PXA2xxI2CState * s = FROM_SYSBUS ( PXA2xxI2CState , dev ) ; s -> bus = i2c_init_bus ( & dev -> qdev , "i2c" ) ; memory_region_init_io ( & s -> iomem , OBJECT ( s ) , & pxa2xx_i2c_ops , s , "pxa2xx-i2c" , s -> region_size ) ; sysbus_init_mmio ( dev , & s -> iomem ) ; sysbus_init_irq ( dev , & s -> irq ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorTextAddPCIDisk ( qemuMonitorPtr mon , const char * path , const char * bus , virDomainDevicePCIAddress * guestAddr ) { char * cmd = NULL ; char * reply = NULL ; char * safe_path = NULL ; int tryOldSyntax = 0 ; int ret = - 1 ; safe_path = qemuMonitorEscapeArg ( path ) ; if ( ! safe_path ) { virReportOOMError ( ) ; return - 1 ; } try_command : if ( virAsprintf ( & cmd , "pci_add %s storage file=%s,if=%s" , ( tryOldSyntax ? "0" : "pci_addr=auto" ) , safe_path , bus ) < 0 ) { virReportOOMError ( ) ; goto cleanup ; } if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) < 0 ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "cannot attach %s disk %s" ) , bus , path ) ; goto cleanup ; } if ( qemuMonitorTextParsePciAddReply ( mon , reply , guestAddr ) < 0 ) { if ( ! tryOldSyntax && strstr ( reply , "invalid char in expression" ) ) { VIR_FREE ( reply ) ; VIR_FREE ( cmd ) ; tryOldSyntax = 1 ; goto try_command ; } qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "adding %s disk failed %s: %s" ) , bus , path , reply ) ; goto cleanup ; } ret = 0 ; cleanup : VIR_FREE ( safe_path ) ; VIR_FREE ( cmd ) ; VIR_FREE ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint get_dns_pdu_len ( packet_info * pinfo _U_ , tvbuff_t * tvb , int offset , void * data _U_ ) { guint16 plen ; plen = tvb_get_ntohs ( tvb , offset ) ; return plen + 2 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void list_cpus ( FILE * f , fprintf_function cpu_fprintf , const char * optarg ) { # if defined ( cpu_list ) cpu_list ( f , cpu_fprintf ) ; # endif }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pdf_run_F ( fz_context * ctx , pdf_processor * proc ) { pdf_run_processor * pr = ( pdf_run_processor * ) proc ; pdf_show_path ( ctx , pr , 0 , 1 , 0 , 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int arith2_get_consumed_bytes ( ArithCoder * c ) { int diff = ( c -> high >> 16 ) - ( c -> low >> 16 ) ; int bp = bytestream2_tell ( c -> gbc . gB ) - 3 << 3 ; int bits = 1 ; while ( ! ( diff & 0x80 ) ) { bits ++ ; diff <<= 1 ; } return ( bits + bp + 7 >> 3 ) + ( ( c -> low >> 16 ) + 1 == c -> high >> 16 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vmsvga_reset ( DeviceState * dev ) { struct pci_vmsvga_state_s * pci = VMWARE_SVGA ( dev ) ; struct vmsvga_state_s * s = & pci -> chip ; s -> index = 0 ; s -> enable = 0 ; s -> config = 0 ; s -> svgaid = SVGA_ID ; s -> cursor . on = 0 ; s -> redraw_fifo_first = 0 ; s -> redraw_fifo_last = 0 ; s -> syncing = 0 ; vga_dirty_log_start ( & s -> vga ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void client_use_result ( ) { MYSQL_RES * result ; int rc ; myheader ( "client_use_result" ) ; rc = mysql_query ( mysql , "SELECT * FROM t1" ) ; myquery ( rc ) ; result = mysql_use_result ( mysql ) ; mytest ( result ) ; ( void ) my_process_result_set ( result ) ; mysql_free_result ( result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_register_nlm ( void ) { static hf_register_info hf [ ] = { { & hf_nlm_procedure_v1 , { "V1 Procedure" , "nlm.procedure_v1" , FT_UINT32 , BASE_DEC , VALS ( nlm1_proc_vals ) , 0 , NULL , HFILL } } , { & hf_nlm_procedure_v2 , { "V2 Procedure" , "nlm.procedure_v2" , FT_UINT32 , BASE_DEC , VALS ( nlm2_proc_vals ) , 0 , NULL , HFILL } } , { & hf_nlm_procedure_v3 , { "V3 Procedure" , "nlm.procedure_v3" , FT_UINT32 , BASE_DEC , VALS ( nlm3_proc_vals ) , 0 , NULL , HFILL } } , { & hf_nlm_procedure_v4 , { "V4 Procedure" , "nlm.procedure_v4" , FT_UINT32 , BASE_DEC , VALS ( nlm4_proc_vals ) , 0 , NULL , HFILL } } , { & hf_nlm_cookie , { "cookie" , "nlm.cookie" , FT_BYTES , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_block , { "block" , "nlm.block" , FT_BOOLEAN , BASE_NONE , TFS ( & tfs_yes_no ) , 0x0 , NULL , HFILL } } , { & hf_nlm_exclusive , { "exclusive" , "nlm.exclusive" , FT_BOOLEAN , BASE_NONE , TFS ( & tfs_yes_no ) , 0x0 , NULL , HFILL } } , { & hf_nlm_lock , { "lock" , "nlm.lock" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_lock_caller_name , { "caller_name" , "nlm.lock.caller_name" , FT_STRING , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_lock_owner , { "owner" , "nlm.lock.owner" , FT_BYTES , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_lock_svid , { "svid" , "nlm.lock.svid" , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_nlm_lock_l_offset64 , { "l_offset" , "nlm.lock.l_offset" , FT_UINT64 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_nlm_lock_l_offset , { "l_offset" , "nlm.lock.l_offset" , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_nlm_lock_l_len64 , { "l_len" , "nlm.lock.l_len" , FT_UINT64 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_nlm_lock_l_len , { "l_len" , "nlm.lock.l_len" , FT_UINT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_nlm_reclaim , { "reclaim" , "nlm.reclaim" , FT_BOOLEAN , BASE_NONE , TFS ( & tfs_yes_no ) , 0x0 , NULL , HFILL } } , { & hf_nlm_state , { "state" , "nlm.state" , FT_UINT32 , BASE_DEC , NULL , 0 , "STATD state" , HFILL } } , { & hf_nlm_stat , { "stat" , "nlm.stat" , FT_UINT32 , BASE_DEC , VALS ( names_nlm_stats ) , 0 , NULL , HFILL } } , { & hf_nlm_test_stat , { "test_stat" , "nlm.test_stat" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_test_stat_stat , { "stat" , "nlm.test_stat.stat" , FT_UINT32 , BASE_DEC , VALS ( names_nlm_stats ) , 0 , NULL , HFILL } } , { & hf_nlm_holder , { "holder" , "nlm.holder" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_share , { "share" , "nlm.share" , FT_NONE , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_share_mode , { "mode" , "nlm.share.mode" , FT_UINT32 , BASE_DEC , VALS ( names_fsh_mode ) , 0 , NULL , HFILL } } , { & hf_nlm_share_access , { "access" , "nlm.share.access" , FT_UINT32 , BASE_DEC , VALS ( names_fsh_access ) , 0 , NULL , HFILL } } , { & hf_nlm_share_name , { "name" , "nlm.share.name" , FT_STRING , BASE_NONE , NULL , 0 , NULL , HFILL } } , { & hf_nlm_sequence , { "sequence" , "nlm.sequence" , FT_INT32 , BASE_DEC , NULL , 0 , NULL , HFILL } } , { & hf_nlm_request_in , { "Request MSG in" , "nlm.msg_in" , FT_UINT32 , BASE_DEC , NULL , 0 , "The RES packet is a response to the MSG in this packet" , HFILL } } , { & hf_nlm_reply_in , { "Reply RES in" , "nlm.res_in" , FT_UINT32 , BASE_DEC , NULL , 0 , "The response to this MSG packet is in this packet" , HFILL } } , { & hf_nlm_time , { "Time from request" , "nlm.time" , FT_RELATIVE_TIME , BASE_NONE , NULL , 0 , "Time between Request and Reply for async NLM calls" , HFILL } } , } ; static gint * ett [ ] = { & ett_nlm , & ett_nlm_lock , } ; module_t * nlm_module ; proto_nlm = proto_register_protocol ( "Network Lock Manager Protocol" , "NLM" , "nlm" ) ; proto_register_field_array ( proto_nlm , hf , array_length ( hf ) ) ; proto_register_subtree_array ( ett , array_length ( ett ) ) ; nlm_module = prefs_register_protocol ( proto_nlm , NULL ) ; prefs_register_bool_preference ( nlm_module , "msg_res_matching" , "Match MSG/RES packets for async NLM" , "Whether the dissector will track and match MSG and RES calls for asynchronous NLM" , & nlm_match_msgres ) ; register_init_routine ( nlm_msg_res_match_init ) ; register_cleanup_routine ( nlm_msg_res_match_cleanup ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int64_t ticks_to_timebase_units ( const vpx_rational_t * timebase , int64_t n ) { const int64_t round = TICKS_PER_SEC * timebase -> num / 2 - 1 ; return ( n * timebase -> den + round ) / timebase -> num / TICKS_PER_SEC ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void curl_formfree ( struct curl_httppost * form ) { struct curl_httppost * next ; if ( ! form ) return ; do { next = form -> next ; if ( form -> more ) curl_formfree ( form -> more ) ; if ( ! ( form -> flags & HTTPPOST_PTRNAME ) && form -> name ) free ( form -> name ) ; if ( ! ( form -> flags & ( HTTPPOST_PTRCONTENTS | HTTPPOST_BUFFER | HTTPPOST_CALLBACK ) ) && form -> contents ) free ( form -> contents ) ; if ( form -> contenttype ) free ( form -> contenttype ) ; if ( form -> showfilename ) free ( form -> showfilename ) ; free ( form ) ; } while ( ( form = next ) != NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int SpoolssOpenPrinterEx_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 ; e_ctx_hnd policy_hnd ; proto_item * hnd_item ; guint32 status ; offset = dissect_nt_policy_hnd ( tvb , offset , pinfo , tree , di , drep , hf_hnd , & policy_hnd , & hnd_item , TRUE , FALSE ) ; offset = dissect_doserror ( tvb , offset , pinfo , tree , di , drep , hf_rc , & status ) ; if ( status == 0 ) { const char * pol_name ; if ( dcv -> se_data ) { pol_name = wmem_strdup_printf ( wmem_packet_scope ( ) , "OpenPrinterEx(%s)" , ( char * ) dcv -> se_data ) ; } else { pol_name = "Unknown OpenPrinterEx() handle" ; } if ( ! pinfo -> fd -> flags . visited ) { dcerpc_store_polhnd_name ( & policy_hnd , pinfo , pol_name ) ; } if ( hnd_item ) proto_item_append_text ( hnd_item , ": %s" , pol_name ) ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void qcms_transform_module_gamma_lut ( struct qcms_modular_transform * transform , float * src , float * dest , size_t length ) { size_t i ; float out_r , out_g , out_b ; for ( i = 0 ; i < length ; i ++ ) { float in_r = * src ++ ; float in_g = * src ++ ; float in_b = * src ++ ; out_r = lut_interp_linear ( in_r , transform -> output_gamma_lut_r , transform -> output_gamma_lut_r_length ) ; out_g = lut_interp_linear ( in_g , transform -> output_gamma_lut_g , transform -> output_gamma_lut_g_length ) ; out_b = lut_interp_linear ( in_b , transform -> output_gamma_lut_b , transform -> output_gamma_lut_b_length ) ; * dest ++ = clamp_float ( out_r ) ; * dest ++ = clamp_float ( out_g ) ; * dest ++ = clamp_float ( out_b ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void prepare_dummy_password ( char * buf , size_t sz ) { size_t i ; strlcpy ( buf , "6F a[" , sz ) ; for ( i = strlen ( buf ) ; i < sz - 1 ; i ++ ) buf [ i ] = 'a' + ( i % 26 ) ; buf [ sz - 1 ] = '\0' ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int evport_dispatch ( struct event_base * base , void * arg , struct timeval * tv ) { int i , res ; struct evport_data * epdp = arg ; port_event_t pevtlist [ EVENTS_PER_GETN ] ; int nevents = 1 ; struct timespec ts ; struct timespec * ts_p = NULL ; if ( tv != NULL ) { ts . tv_sec = tv -> tv_sec ; ts . tv_nsec = tv -> tv_usec * 1000 ; ts_p = & ts ; } for ( i = 0 ; i < EVENTS_PER_GETN ; ++ i ) { struct fd_info * fdi = NULL ; if ( epdp -> ed_pending [ i ] != - 1 ) { fdi = & ( epdp -> ed_fds [ epdp -> ed_pending [ i ] ] ) ; } if ( fdi != NULL && FDI_HAS_EVENTS ( fdi ) ) { int fd = FDI_HAS_READ ( fdi ) ? fdi -> fdi_revt -> ev_fd : fdi -> fdi_wevt -> ev_fd ; reassociate ( epdp , fdi , fd ) ; epdp -> ed_pending [ i ] = - 1 ; } } if ( ( res = port_getn ( epdp -> ed_port , pevtlist , EVENTS_PER_GETN , ( unsigned int * ) & nevents , ts_p ) ) == - 1 ) { if ( errno == EINTR || errno == EAGAIN ) { evsignal_process ( base ) ; return ( 0 ) ; } else if ( errno == ETIME ) { if ( nevents == 0 ) return ( 0 ) ; } else { event_warn ( "port_getn" ) ; return ( - 1 ) ; } } else if ( base -> sig . evsignal_caught ) { evsignal_process ( base ) ; } event_debug ( ( "%s: port_getn reports %d events" , __func__ , nevents ) ) ; for ( i = 0 ; i < nevents ; ++ i ) { struct event * ev ; struct fd_info * fdi ; port_event_t * pevt = & pevtlist [ i ] ; int fd = ( int ) pevt -> portev_object ; check_evportop ( epdp ) ; check_event ( pevt ) ; epdp -> ed_pending [ i ] = fd ; res = 0 ; if ( pevt -> portev_events & POLLIN ) res |= EV_READ ; if ( pevt -> portev_events & POLLOUT ) res |= EV_WRITE ; assert ( epdp -> ed_nevents > fd ) ; fdi = & ( epdp -> ed_fds [ fd ] ) ; if ( ( res & EV_READ ) && ( ( ev = fdi -> fdi_revt ) != NULL ) ) { event_active ( ev , res , 1 ) ; } if ( ( res & EV_WRITE ) && ( ( ev = fdi -> fdi_wevt ) != NULL ) ) { event_active ( ev , res , 1 ) ; } } check_evportop ( epdp ) ; return ( 0 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void crypto_policy_set_aes_cm_256_hmac_sha1_32 ( crypto_policy_t * p ) { p -> cipher_type = AES_ICM ; p -> cipher_key_len = 46 ; p -> auth_type = HMAC_SHA1 ; p -> auth_key_len = 20 ; p -> auth_tag_len = 4 ; p -> sec_serv = sec_serv_conf_and_auth ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int jpc_enc_encodemainbody ( jpc_enc_t * enc ) { int tileno ; int tilex ; int tiley ; int i ; jpc_sot_t * sot ; jpc_enc_tcmpt_t * comp ; jpc_enc_tcmpt_t * endcomps ; jpc_enc_band_t * band ; jpc_enc_band_t * endbands ; jpc_enc_rlvl_t * lvl ; int rlvlno ; jpc_qcc_t * qcc ; jpc_cod_t * cod ; int adjust ; int j ; int absbandno ; long numbytes ; long tilehdrlen ; long tilelen ; jpc_enc_tile_t * tile ; jpc_enc_cp_t * cp ; double rho ; int lyrno ; int cmptno ; int samestepsizes ; jpc_enc_ccp_t * ccps ; jpc_enc_tccp_t * tccp ; int bandno ; uint_fast32_t x ; uint_fast32_t y ; int mingbits ; int actualnumbps ; jpc_fix_t mxmag ; jpc_fix_t mag ; int numgbits ; cp = enc -> cp ; numbytes = 0 ; for ( tileno = 0 ; tileno < JAS_CAST ( int , cp -> numtiles ) ; ++ tileno ) { tilex = tileno % cp -> numhtiles ; tiley = tileno / cp -> numhtiles ; if ( ! ( enc -> curtile = jpc_enc_tile_create ( enc -> cp , enc -> image , tileno ) ) ) { abort ( ) ; } tile = enc -> curtile ; if ( jas_getdbglevel ( ) >= 10 ) { jpc_enc_dump ( enc ) ; } endcomps = & tile -> tcmpts [ tile -> numtcmpts ] ; for ( cmptno = 0 , comp = tile -> tcmpts ; cmptno < tile -> numtcmpts ; ++ cmptno , ++ comp ) { if ( ! cp -> ccps [ cmptno ] . sgnd ) { adjust = 1 << ( cp -> ccps [ cmptno ] . prec - 1 ) ; for ( i = 0 ; i < jas_matrix_numrows ( comp -> data ) ; ++ i ) { for ( j = 0 ; j < jas_matrix_numcols ( comp -> data ) ; ++ j ) { * jas_matrix_getref ( comp -> data , i , j ) -= adjust ; } } } } if ( ! tile -> intmode ) { endcomps = & tile -> tcmpts [ tile -> numtcmpts ] ; for ( comp = tile -> tcmpts ; comp != endcomps ; ++ comp ) { jas_matrix_asl ( comp -> data , JPC_FIX_FRACBITS ) ; } } switch ( tile -> mctid ) { case JPC_MCT_RCT : assert ( jas_image_numcmpts ( enc -> image ) == 3 ) ; jpc_rct ( tile -> tcmpts [ 0 ] . data , tile -> tcmpts [ 1 ] . data , tile -> tcmpts [ 2 ] . data ) ; break ; case JPC_MCT_ICT : assert ( jas_image_numcmpts ( enc -> image ) == 3 ) ; jpc_ict ( tile -> tcmpts [ 0 ] . data , tile -> tcmpts [ 1 ] . data , tile -> tcmpts [ 2 ] . data ) ; break ; default : break ; } for ( i = 0 ; i < jas_image_numcmpts ( enc -> image ) ; ++ i ) { comp = & tile -> tcmpts [ i ] ; jpc_tsfb_analyze ( comp -> tsfb , comp -> data ) ; } endcomps = & tile -> tcmpts [ tile -> numtcmpts ] ; for ( cmptno = 0 , comp = tile -> tcmpts ; comp != endcomps ; ++ cmptno , ++ comp ) { mingbits = 0 ; absbandno = 0 ; memset ( comp -> stepsizes , 0 , sizeof ( comp -> stepsizes ) ) ; for ( rlvlno = 0 , lvl = comp -> rlvls ; rlvlno < comp -> numrlvls ; ++ rlvlno , ++ lvl ) { if ( ! lvl -> bands ) { absbandno += rlvlno ? 3 : 1 ; continue ; } endbands = & lvl -> bands [ lvl -> numbands ] ; for ( band = lvl -> bands ; band != endbands ; ++ band ) { if ( ! band -> data ) { ++ absbandno ; continue ; } actualnumbps = 0 ; mxmag = 0 ; for ( y = 0 ; y < JAS_CAST ( uint_fast32_t , jas_matrix_numrows ( band -> data ) ) ; ++ y ) { for ( x = 0 ; x < JAS_CAST ( uint_fast32_t , jas_matrix_numcols ( band -> data ) ) ; ++ x ) { mag = JAS_ABS ( jas_matrix_get ( band -> data , y , x ) ) ; if ( mag > mxmag ) { mxmag = mag ; } } } if ( tile -> intmode ) { actualnumbps = jpc_firstone ( mxmag ) + 1 ; } else { actualnumbps = jpc_firstone ( mxmag ) + 1 - JPC_FIX_FRACBITS ; } numgbits = actualnumbps - ( cp -> ccps [ cmptno ] . prec - 1 + band -> analgain ) ; # if 0 jas_eprintf ( "%d %d mag=%d actual=%d numgbits=%d\n" , cp -> ccps [ cmptno ] . prec , band -> analgain , mxmag , actualnumbps , numgbits ) ; # endif if ( numgbits > mingbits ) { mingbits = numgbits ; } if ( ! tile -> intmode ) { band -> absstepsize = jpc_fix_div ( jpc_inttofix ( 1 << ( band -> analgain + 1 ) ) , band -> synweight ) ; } else { band -> absstepsize = jpc_inttofix ( 1 ) ; } band -> stepsize = jpc_abstorelstepsize ( band -> absstepsize , cp -> ccps [ cmptno ] . prec + band -> analgain ) ; band -> numbps = cp -> tccp . numgbits + JPC_QCX_GETEXPN ( band -> stepsize ) - 1 ; if ( ( ! tile -> intmode ) && band -> data ) { jpc_quantize ( band -> data , band -> absstepsize ) ; } comp -> stepsizes [ absbandno ] = band -> stepsize ; ++ absbandno ; } } assert ( JPC_FIX_FRACBITS >= JPC_NUMEXTRABITS ) ; if ( ! tile -> intmode ) { jas_matrix_divpow2 ( comp -> data , JPC_FIX_FRACBITS - JPC_NUMEXTRABITS ) ; } else { jas_matrix_asl ( comp -> data , JPC_NUMEXTRABITS ) ; } # if 0 jas_eprintf ( "mingbits %d\n" , mingbits ) ; # endif if ( mingbits > cp -> tccp . numgbits ) { jas_eprintf ( "error: too few guard bits (need at least %d)\n" , mingbits ) ; return - 1 ; } } if ( ! ( enc -> tmpstream = jas_stream_memopen ( 0 , 0 ) ) ) { jas_eprintf ( "cannot open tmp file\n" ) ; return - 1 ; } if ( ! ( enc -> mrk = jpc_ms_create ( JPC_MS_SOT ) ) ) { return - 1 ; } sot = & enc -> mrk -> parms . sot ; sot -> len = 0 ; sot -> tileno = tileno ; sot -> partno = 0 ; sot -> numparts = 1 ; if ( jpc_putms ( enc -> tmpstream , enc -> cstate , enc -> mrk ) ) { jas_eprintf ( "cannot write SOT marker\n" ) ; return - 1 ; } jpc_ms_destroy ( enc -> mrk ) ; enc -> mrk = 0 ; tccp = & cp -> tccp ; for ( cmptno = 0 ; cmptno < JAS_CAST ( int , cp -> numcmpts ) ; ++ cmptno ) { comp = & tile -> tcmpts [ cmptno ] ; if ( comp -> numrlvls != tccp -> maxrlvls ) { if ( ! ( enc -> mrk = jpc_ms_create ( JPC_MS_COD ) ) ) { return - 1 ; } comp = & tile -> tcmpts [ 0 ] ; cod = & enc -> mrk -> parms . cod ; cod -> compparms . csty = 0 ; cod -> compparms . numdlvls = comp -> numrlvls - 1 ; cod -> prg = tile -> prg ; cod -> numlyrs = tile -> numlyrs ; cod -> compparms . cblkwidthval = JPC_COX_CBLKSIZEEXPN ( comp -> cblkwidthexpn ) ; cod -> compparms . cblkheightval = JPC_COX_CBLKSIZEEXPN ( comp -> cblkheightexpn ) ; cod -> compparms . cblksty = comp -> cblksty ; cod -> compparms . qmfbid = comp -> qmfbid ; cod -> mctrans = ( tile -> mctid != JPC_MCT_NONE ) ; for ( i = 0 ; i < comp -> numrlvls ; ++ i ) { cod -> compparms . rlvls [ i ] . parwidthval = comp -> rlvls [ i ] . prcwidthexpn ; cod -> compparms . rlvls [ i ] . parheightval = comp -> rlvls [ i ] . prcheightexpn ; } if ( jpc_putms ( enc -> tmpstream , enc -> cstate , enc -> mrk ) ) { return - 1 ; } jpc_ms_destroy ( enc -> mrk ) ; enc -> mrk = 0 ; } } for ( cmptno = 0 , comp = tile -> tcmpts ; cmptno < JAS_CAST ( int , cp -> numcmpts ) ; ++ cmptno , ++ comp ) { ccps = & cp -> ccps [ cmptno ] ; if ( JAS_CAST ( int , ccps -> numstepsizes ) == comp -> numstepsizes ) { samestepsizes = 1 ; for ( bandno = 0 ; bandno < JAS_CAST ( int , ccps -> numstepsizes ) ; ++ bandno ) { if ( ccps -> stepsizes [ bandno ] != comp -> stepsizes [ bandno ] ) { samestepsizes = 0 ; break ; } } } else { samestepsizes = 0 ; } if ( ! samestepsizes ) { if ( ! ( enc -> mrk = jpc_ms_create ( JPC_MS_QCC ) ) ) { return - 1 ; } qcc = & enc -> mrk -> parms . qcc ; qcc -> compno = cmptno ; qcc -> compparms . numguard = cp -> tccp . numgbits ; qcc -> compparms . qntsty = ( comp -> qmfbid == JPC_COX_INS ) ? JPC_QCX_SEQNT : JPC_QCX_NOQNT ; qcc -> compparms . numstepsizes = comp -> numstepsizes ; qcc -> compparms . stepsizes = comp -> stepsizes ; if ( jpc_putms ( enc -> tmpstream , enc -> cstate , enc -> mrk ) ) { return - 1 ; } qcc -> compparms . stepsizes = 0 ; jpc_ms_destroy ( enc -> mrk ) ; enc -> mrk = 0 ; } } if ( ! ( enc -> mrk = jpc_ms_create ( JPC_MS_SOD ) ) ) { return - 1 ; } if ( jpc_putms ( enc -> tmpstream , enc -> cstate , enc -> mrk ) ) { jas_eprintf ( "cannot write SOD marker\n" ) ; return - 1 ; } jpc_ms_destroy ( enc -> mrk ) ; enc -> mrk = 0 ; tilehdrlen = jas_stream_getrwcount ( enc -> tmpstream ) ; assert ( tilehdrlen >= 0 ) ; if ( jpc_enc_enccblks ( enc ) ) { abort ( ) ; return - 1 ; } cp = enc -> cp ; rho = ( double ) ( tile -> brx - tile -> tlx ) * ( tile -> bry - tile -> tly ) / ( ( cp -> refgrdwidth - cp -> imgareatlx ) * ( cp -> refgrdheight - cp -> imgareatly ) ) ; tile -> rawsize = cp -> rawsize * rho ; for ( lyrno = 0 ; lyrno < tile -> numlyrs - 1 ; ++ lyrno ) { tile -> lyrsizes [ lyrno ] = tile -> rawsize * jpc_fixtodbl ( cp -> tcp . ilyrrates [ lyrno ] ) ; } # if ! defined ( __clang__ ) tile -> lyrsizes [ tile -> numlyrs - 1 ] = ( cp -> totalsize != UINT_FAST32_MAX ) ? ( rho * enc -> mainbodysize ) : UINT_FAST32_MAX ; # else if ( cp -> totalsize != UINT_FAST32_MAX ) { tile -> lyrsizes [ tile -> numlyrs - 1 ] = ( rho * enc -> mainbodysize ) ; } else { tile -> lyrsizes [ tile -> numlyrs - 1 ] = UINT_FAST32_MAX ; } # endif for ( lyrno = 0 ; lyrno < tile -> numlyrs ; ++ lyrno ) { if ( tile -> lyrsizes [ lyrno ] != UINT_FAST32_MAX ) { if ( JAS_CAST ( uint_fast32_t , tilehdrlen ) <= tile -> lyrsizes [ lyrno ] ) { tile -> lyrsizes [ lyrno ] -= tilehdrlen ; } else { tile -> lyrsizes [ lyrno ] = 0 ; } } } if ( rateallocate ( enc , tile -> numlyrs , tile -> lyrsizes ) ) { return - 1 ; } # if 0 jas_eprintf ( "ENCODE TILE DATA\n" ) ; # endif if ( jpc_enc_encodetiledata ( enc ) ) { jas_eprintf ( "dotile failed\n" ) ; return - 1 ; } tilelen = jas_stream_tell ( enc -> tmpstream ) ; if ( jas_stream_seek ( enc -> tmpstream , 6 , SEEK_SET ) < 0 ) { return - 1 ; } jpc_putuint32 ( enc -> tmpstream , tilelen ) ; if ( jas_stream_seek ( enc -> tmpstream , 0 , SEEK_SET ) < 0 ) { return - 1 ; } if ( jpc_putdata ( enc -> out , enc -> tmpstream , - 1 ) ) { return - 1 ; } enc -> len += tilelen ; jas_stream_close ( enc -> tmpstream ) ; enc -> tmpstream = 0 ; jpc_enc_tile_destroy ( enc -> curtile ) ; enc -> curtile = 0 ; } return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void proto_reg_handoff_packetbb ( void ) { static gboolean packetbb_prefs_initialized = FALSE ; static dissector_handle_t packetbb_handle ; static guint packetbb_udp_port ; if ( ! packetbb_prefs_initialized ) { packetbb_handle = create_dissector_handle ( dissect_packetbb , proto_packetbb ) ; packetbb_prefs_initialized = TRUE ; } else { dissector_delete_uint ( "udp.port" , global_packetbb_port , packetbb_handle ) ; } packetbb_udp_port = global_packetbb_port ; dissector_add_uint ( "udp.port" , packetbb_udp_port , packetbb_handle ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void reset_all_seen ( void ) { unsigned int i ; for ( i = 0 ; i < seen_objects_nr ; ++ i ) { seen_objects [ i ] -> flags &= ~ ( SEEN | ADDED | SHOWN ) ; } seen_objects_nr = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int qcow2_open ( BlockDriverState * bs , QDict * options , int flags , Error * * errp ) { BDRVQcowState * s = bs -> opaque ; unsigned int len , i ; int ret = 0 ; QCowHeader header ; QemuOpts * opts ; Error * local_err = NULL ; uint64_t ext_end ; uint64_t l1_vm_state_index ; const char * opt_overlap_check ; int overlap_check_template = 0 ; ret = bdrv_pread ( bs -> file , 0 , & header , sizeof ( header ) ) ; if ( ret < 0 ) { error_setg_errno ( errp , - ret , "Could not read qcow2 header" ) ; goto fail ; } be32_to_cpus ( & header . magic ) ; be32_to_cpus ( & header . version ) ; be64_to_cpus ( & header . backing_file_offset ) ; be32_to_cpus ( & header . backing_file_size ) ; be64_to_cpus ( & header . size ) ; be32_to_cpus ( & header . cluster_bits ) ; be32_to_cpus ( & header . crypt_method ) ; be64_to_cpus ( & header . l1_table_offset ) ; be32_to_cpus ( & header . l1_size ) ; be64_to_cpus ( & header . refcount_table_offset ) ; be32_to_cpus ( & header . refcount_table_clusters ) ; be64_to_cpus ( & header . snapshots_offset ) ; be32_to_cpus ( & header . nb_snapshots ) ; if ( header . magic != QCOW_MAGIC ) { error_setg ( errp , "Image is not in qcow2 format" ) ; ret = - EINVAL ; goto fail ; } if ( header . version < 2 || header . version > 3 ) { report_unsupported ( bs , errp , "QCOW version %d" , header . version ) ; ret = - ENOTSUP ; goto fail ; } s -> qcow_version = header . version ; if ( header . cluster_bits < MIN_CLUSTER_BITS || header . cluster_bits > MAX_CLUSTER_BITS ) { error_setg ( errp , "Unsupported cluster size: 2^%i" , header . cluster_bits ) ; ret = - EINVAL ; goto fail ; } s -> cluster_bits = header . cluster_bits ; s -> cluster_size = 1 << s -> cluster_bits ; s -> cluster_sectors = 1 << ( s -> cluster_bits - 9 ) ; if ( header . version == 2 ) { header . incompatible_features = 0 ; header . compatible_features = 0 ; header . autoclear_features = 0 ; header . refcount_order = 4 ; header . header_length = 72 ; } else { be64_to_cpus ( & header . incompatible_features ) ; be64_to_cpus ( & header . compatible_features ) ; be64_to_cpus ( & header . autoclear_features ) ; be32_to_cpus ( & header . refcount_order ) ; be32_to_cpus ( & header . header_length ) ; if ( header . header_length < 104 ) { error_setg ( errp , "qcow2 header too short" ) ; ret = - EINVAL ; goto fail ; } } if ( header . header_length > s -> cluster_size ) { error_setg ( errp , "qcow2 header exceeds cluster size" ) ; ret = - EINVAL ; goto fail ; } if ( header . header_length > sizeof ( header ) ) { s -> unknown_header_fields_size = header . header_length - sizeof ( header ) ; s -> unknown_header_fields = g_malloc ( s -> unknown_header_fields_size ) ; ret = bdrv_pread ( bs -> file , sizeof ( header ) , s -> unknown_header_fields , s -> unknown_header_fields_size ) ; if ( ret < 0 ) { error_setg_errno ( errp , - ret , "Could not read unknown qcow2 header " "fields" ) ; goto fail ; } } if ( header . backing_file_offset > s -> cluster_size ) { error_setg ( errp , "Invalid backing file offset" ) ; ret = - EINVAL ; goto fail ; } if ( header . backing_file_offset ) { ext_end = header . backing_file_offset ; } else { ext_end = 1 << header . cluster_bits ; } s -> incompatible_features = header . incompatible_features ; s -> compatible_features = header . compatible_features ; s -> autoclear_features = header . autoclear_features ; if ( s -> incompatible_features & ~ QCOW2_INCOMPAT_MASK ) { void * feature_table = NULL ; qcow2_read_extensions ( bs , header . header_length , ext_end , & feature_table , NULL ) ; report_unsupported_feature ( bs , errp , feature_table , s -> incompatible_features & ~ QCOW2_INCOMPAT_MASK ) ; ret = - ENOTSUP ; g_free ( feature_table ) ; goto fail ; } if ( s -> incompatible_features & QCOW2_INCOMPAT_CORRUPT ) { if ( ( flags & BDRV_O_RDWR ) && ! ( flags & BDRV_O_CHECK ) ) { error_setg ( errp , "qcow2: Image is corrupt; cannot be opened " "read/write" ) ; ret = - EACCES ; goto fail ; } } if ( header . refcount_order != 4 ) { report_unsupported ( bs , errp , "%d bit reference counts" , 1 << header . refcount_order ) ; ret = - ENOTSUP ; goto fail ; } s -> refcount_order = header . refcount_order ; if ( header . crypt_method > QCOW_CRYPT_AES ) { error_setg ( errp , "Unsupported encryption method: %i" , header . crypt_method ) ; ret = - EINVAL ; goto fail ; } s -> crypt_method_header = header . crypt_method ; if ( s -> crypt_method_header ) { bs -> encrypted = 1 ; } s -> l2_bits = s -> cluster_bits - 3 ; s -> l2_size = 1 << s -> l2_bits ; bs -> total_sectors = header . size / 512 ; s -> csize_shift = ( 62 - ( s -> cluster_bits - 8 ) ) ; s -> csize_mask = ( 1 << ( s -> cluster_bits - 8 ) ) - 1 ; s -> cluster_offset_mask = ( 1LL << s -> csize_shift ) - 1 ; s -> refcount_table_offset = header . refcount_table_offset ; s -> refcount_table_size = header . refcount_table_clusters << ( s -> cluster_bits - 3 ) ; if ( header . refcount_table_clusters > qcow2_max_refcount_clusters ( s ) ) { error_setg ( errp , "Reference count table too large" ) ; ret = - EINVAL ; goto fail ; } ret = validate_table_offset ( bs , s -> refcount_table_offset , s -> refcount_table_size , sizeof ( uint64_t ) ) ; if ( ret < 0 ) { error_setg ( errp , "Invalid reference count table offset" ) ; goto fail ; } if ( header . nb_snapshots > QCOW_MAX_SNAPSHOTS ) { error_setg ( errp , "Too many snapshots" ) ; ret = - EINVAL ; goto fail ; } ret = validate_table_offset ( bs , header . snapshots_offset , header . nb_snapshots , sizeof ( QCowSnapshotHeader ) ) ; if ( ret < 0 ) { error_setg ( errp , "Invalid snapshot table offset" ) ; goto fail ; } s -> snapshots_offset = header . snapshots_offset ; s -> nb_snapshots = header . nb_snapshots ; if ( header . l1_size > 0x2000000 ) { error_setg ( errp , "Active L1 table too large" ) ; ret = - EFBIG ; goto fail ; } s -> l1_size = header . l1_size ; l1_vm_state_index = size_to_l1 ( s , header . size ) ; if ( l1_vm_state_index > INT_MAX ) { error_setg ( errp , "Image is too big" ) ; ret = - EFBIG ; goto fail ; } s -> l1_vm_state_index = l1_vm_state_index ; if ( s -> l1_size < s -> l1_vm_state_index ) { error_setg ( errp , "L1 table is too small" ) ; ret = - EINVAL ; goto fail ; } ret = validate_table_offset ( bs , header . l1_table_offset , header . l1_size , sizeof ( uint64_t ) ) ; if ( ret < 0 ) { error_setg ( errp , "Invalid L1 table offset" ) ; goto fail ; } s -> l1_table_offset = header . l1_table_offset ; if ( s -> l1_size > 0 ) { s -> l1_table = g_malloc0 ( align_offset ( s -> l1_size * sizeof ( uint64_t ) , 512 ) ) ; ret = bdrv_pread ( bs -> file , s -> l1_table_offset , s -> l1_table , s -> l1_size * sizeof ( uint64_t ) ) ; if ( ret < 0 ) { error_setg_errno ( errp , - ret , "Could not read L1 table" ) ; goto fail ; } for ( i = 0 ; i < s -> l1_size ; i ++ ) { be64_to_cpus ( & s -> l1_table [ i ] ) ; } } s -> l2_table_cache = qcow2_cache_create ( bs , L2_CACHE_SIZE ) ; s -> refcount_block_cache = qcow2_cache_create ( bs , REFCOUNT_CACHE_SIZE ) ; s -> cluster_cache = g_malloc ( s -> cluster_size ) ; s -> cluster_data = qemu_blockalign ( bs , QCOW_MAX_CRYPT_CLUSTERS * s -> cluster_size + 512 ) ; s -> cluster_cache_offset = - 1 ; s -> flags = flags ; ret = qcow2_refcount_init ( bs ) ; if ( ret != 0 ) { error_setg_errno ( errp , - ret , "Could not initialize refcount handling" ) ; goto fail ; } QLIST_INIT ( & s -> cluster_allocs ) ; QTAILQ_INIT ( & s -> discards ) ; if ( qcow2_read_extensions ( bs , header . header_length , ext_end , NULL , & local_err ) ) { error_propagate ( errp , local_err ) ; ret = - EINVAL ; goto fail ; } if ( header . backing_file_offset != 0 ) { len = header . backing_file_size ; if ( len > MIN ( 1023 , s -> cluster_size - header . backing_file_offset ) ) { error_setg ( errp , "Backing file name too long" ) ; ret = - EINVAL ; goto fail ; } ret = bdrv_pread ( bs -> file , header . backing_file_offset , bs -> backing_file , len ) ; if ( ret < 0 ) { error_setg_errno ( errp , - ret , "Could not read backing file name" ) ; goto fail ; } bs -> backing_file [ len ] = '\0' ; } ret = qcow2_read_snapshots ( bs ) ; if ( ret < 0 ) { error_setg_errno ( errp , - ret , "Could not read snapshots" ) ; goto fail ; } if ( ! bs -> read_only && ! ( flags & BDRV_O_INCOMING ) && s -> autoclear_features ) { s -> autoclear_features = 0 ; ret = qcow2_update_header ( bs ) ; if ( ret < 0 ) { error_setg_errno ( errp , - ret , "Could not update qcow2 header" ) ; goto fail ; } } qemu_co_mutex_init ( & s -> lock ) ; if ( ! ( flags & ( BDRV_O_CHECK | BDRV_O_INCOMING ) ) && ! bs -> read_only && ( s -> incompatible_features & QCOW2_INCOMPAT_DIRTY ) ) { BdrvCheckResult result = { 0 } ; ret = qcow2_check ( bs , & result , BDRV_FIX_ERRORS ) ; if ( ret < 0 ) { error_setg_errno ( errp , - ret , "Could not repair dirty image" ) ; goto fail ; } } opts = qemu_opts_create ( & qcow2_runtime_opts , NULL , 0 , & error_abort ) ; qemu_opts_absorb_qdict ( opts , options , & local_err ) ; if ( local_err ) { error_propagate ( errp , local_err ) ; ret = - EINVAL ; goto fail ; } s -> use_lazy_refcounts = qemu_opt_get_bool ( opts , QCOW2_OPT_LAZY_REFCOUNTS , ( s -> compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS ) ) ; s -> discard_passthrough [ QCOW2_DISCARD_NEVER ] = false ; s -> discard_passthrough [ QCOW2_DISCARD_ALWAYS ] = true ; s -> discard_passthrough [ QCOW2_DISCARD_REQUEST ] = qemu_opt_get_bool ( opts , QCOW2_OPT_DISCARD_REQUEST , flags & BDRV_O_UNMAP ) ; s -> discard_passthrough [ QCOW2_DISCARD_SNAPSHOT ] = qemu_opt_get_bool ( opts , QCOW2_OPT_DISCARD_SNAPSHOT , true ) ; s -> discard_passthrough [ QCOW2_DISCARD_OTHER ] = qemu_opt_get_bool ( opts , QCOW2_OPT_DISCARD_OTHER , false ) ; opt_overlap_check = qemu_opt_get ( opts , "overlap-check" ) ? : "cached" ; if ( ! strcmp ( opt_overlap_check , "none" ) ) { overlap_check_template = 0 ; } else if ( ! strcmp ( opt_overlap_check , "constant" ) ) { overlap_check_template = QCOW2_OL_CONSTANT ; } else if ( ! strcmp ( opt_overlap_check , "cached" ) ) { overlap_check_template = QCOW2_OL_CACHED ; } else if ( ! strcmp ( opt_overlap_check , "all" ) ) { overlap_check_template = QCOW2_OL_ALL ; } else { error_setg ( errp , "Unsupported value '%s' for qcow2 option " "'overlap-check'. Allowed are either of the following: " "none, constant, cached, all" , opt_overlap_check ) ; qemu_opts_del ( opts ) ; ret = - EINVAL ; goto fail ; } s -> overlap_check = 0 ; for ( i = 0 ; i < QCOW2_OL_MAX_BITNR ; i ++ ) { s -> overlap_check |= qemu_opt_get_bool ( opts , overlap_bool_option_names [ i ] , overlap_check_template & ( 1 << i ) ) << i ; } qemu_opts_del ( opts ) ; if ( s -> use_lazy_refcounts && s -> qcow_version < 3 ) { error_setg ( errp , "Lazy refcounts require a qcow2 image with at least " "qemu 1.1 compatibility level" ) ; ret = - EINVAL ; goto fail ; } # ifdef DEBUG_ALLOC { BdrvCheckResult result = { 0 } ; qcow2_check_refcounts ( bs , & result , 0 ) ; } # endif return ret ; fail : g_free ( s -> unknown_header_fields ) ; cleanup_unknown_header_ext ( bs ) ; qcow2_free_snapshots ( bs ) ; qcow2_refcount_close ( bs ) ; g_free ( s -> l1_table ) ; s -> l1_table = NULL ; if ( s -> l2_table_cache ) { qcow2_cache_destroy ( bs , s -> l2_table_cache ) ; } if ( s -> refcount_block_cache ) { qcow2_cache_destroy ( bs , s -> refcount_block_cache ) ; } g_free ( s -> cluster_cache ) ; qemu_vfree ( s -> cluster_data ) ; return ret ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void wiener_denoise ( WMAVoiceContext * s , int fcb_type , float * synth_pf , int size , const float * lpcs ) { int remainder , lim , n ; if ( fcb_type != FCB_TYPE_SILENCE ) { float * tilted_lpcs = s -> tilted_lpcs_pf , * coeffs = s -> denoise_coeffs_pf , tilt_mem = 0 ; tilted_lpcs [ 0 ] = 1.0 ; memcpy ( & tilted_lpcs [ 1 ] , lpcs , sizeof ( lpcs [ 0 ] ) * s -> lsps ) ; memset ( & tilted_lpcs [ s -> lsps + 1 ] , 0 , sizeof ( tilted_lpcs [ 0 ] ) * ( 128 - s -> lsps - 1 ) ) ; ff_tilt_compensation ( & tilt_mem , 0.7 * tilt_factor ( lpcs , s -> lsps ) , tilted_lpcs , s -> lsps + 2 ) ; remainder = FFMIN ( 127 - size , size - 1 ) ; calc_input_response ( s , tilted_lpcs , fcb_type , coeffs , remainder ) ; memset ( & synth_pf [ size ] , 0 , sizeof ( synth_pf [ 0 ] ) * ( 128 - size ) ) ; s -> rdft . rdft_calc ( & s -> rdft , synth_pf ) ; s -> rdft . rdft_calc ( & s -> rdft , coeffs ) ; synth_pf [ 0 ] *= coeffs [ 0 ] ; synth_pf [ 1 ] *= coeffs [ 1 ] ; for ( n = 1 ; n < 64 ; n ++ ) { float v1 = synth_pf [ n * 2 ] , v2 = synth_pf [ n * 2 + 1 ] ; synth_pf [ n * 2 ] = v1 * coeffs [ n * 2 ] - v2 * coeffs [ n * 2 + 1 ] ; synth_pf [ n * 2 + 1 ] = v2 * coeffs [ n * 2 ] + v1 * coeffs [ n * 2 + 1 ] ; } s -> irdft . rdft_calc ( & s -> irdft , synth_pf ) ; } if ( s -> denoise_filter_cache_size ) { lim = FFMIN ( s -> denoise_filter_cache_size , size ) ; for ( n = 0 ; n < lim ; n ++ ) synth_pf [ n ] += s -> denoise_filter_cache [ n ] ; s -> denoise_filter_cache_size -= lim ; memmove ( s -> denoise_filter_cache , & s -> denoise_filter_cache [ size ] , sizeof ( s -> denoise_filter_cache [ 0 ] ) * s -> denoise_filter_cache_size ) ; } if ( fcb_type != FCB_TYPE_SILENCE ) { lim = FFMIN ( remainder , s -> denoise_filter_cache_size ) ; for ( n = 0 ; n < lim ; n ++ ) s -> denoise_filter_cache [ n ] += synth_pf [ size + n ] ; if ( lim < remainder ) { memcpy ( & s -> denoise_filter_cache [ lim ] , & synth_pf [ size + lim ] , sizeof ( s -> denoise_filter_cache [ 0 ] ) * ( remainder - lim ) ) ; s -> denoise_filter_cache_size = remainder ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void guestfwd_read ( void * opaque , const uint8_t * buf , int size ) { struct GuestFwd * fwd = opaque ; slirp_socket_recv ( fwd -> slirp , fwd -> server , fwd -> port , buf , size ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int astream_base64_decode_lf ( struct attachment_istream_part * part ) { if ( part -> base64_have_crlf && part -> base64_state != BASE64_STATE_CR ) { return - 1 ; } part -> base64_state = BASE64_STATE_0 ; if ( part -> cur_base64_blocks < part -> base64_line_blocks ) { part -> base64_state = BASE64_STATE_EOM ; return 0 ; } else if ( part -> base64_line_blocks == 0 ) { if ( part -> cur_base64_blocks == 0 ) return - 1 ; part -> base64_line_blocks = part -> cur_base64_blocks ; } else if ( part -> cur_base64_blocks == part -> base64_line_blocks ) { } else { return - 1 ; } part -> cur_base64_blocks = 0 ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void invert_quant ( int16_t * quant , int16_t * shift , int d ) { unsigned t ; int l ; t = d ; for ( l = 0 ; t > 1 ; l ++ ) t >>= 1 ; t = 1 + ( 1 << ( 16 + l ) ) / d ; * quant = ( int16_t ) ( t - ( 1 << 16 ) ) ; * shift = 1 << ( 16 - l ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void Pass0Encode ( VP9_COMP * cpi , size_t * size , uint8_t * dest , unsigned int * frame_flags ) { if ( cpi -> oxcf . rc_mode == VPX_CBR ) { vp9_rc_get_one_pass_cbr_params ( cpi ) ; } else { vp9_rc_get_one_pass_vbr_params ( cpi ) ; } encode_frame_to_data_rate ( cpi , size , dest , frame_flags ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * map_data_enc ( gpgme_data_t d ) { switch ( gpgme_data_get_encoding ( d ) ) { case GPGME_DATA_ENCODING_NONE : break ; case GPGME_DATA_ENCODING_BINARY : return "--binary" ; case GPGME_DATA_ENCODING_BASE64 : return "--base64" ; case GPGME_DATA_ENCODING_ARMOR : return "--armor" ; default : break ; } return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static teReqs _tocEntryRequired ( TocEntry * te , teSection curSection , RestoreOptions * ropt ) { teReqs res = REQ_SCHEMA | REQ_DATA ; if ( strcmp ( te -> desc , "ENCODING" ) == 0 || strcmp ( te -> desc , "STDSTRINGS" ) == 0 ) return REQ_SPECIAL ; if ( ropt -> aclsSkip && _tocEntryIsACL ( te ) ) return 0 ; if ( ropt -> no_security_labels && strcmp ( te -> desc , "SECURITY LABEL" ) == 0 ) return 0 ; switch ( curSection ) { case SECTION_PRE_DATA : if ( ! ( ropt -> dumpSections & DUMP_PRE_DATA ) ) return 0 ; break ; case SECTION_DATA : if ( ! ( ropt -> dumpSections & DUMP_DATA ) ) return 0 ; break ; case SECTION_POST_DATA : if ( ! ( ropt -> dumpSections & DUMP_POST_DATA ) ) return 0 ; break ; default : return 0 ; } if ( ropt -> schemaNames . head != NULL ) { if ( ! te -> namespace ) return 0 ; if ( ! ( simple_string_list_member ( & ropt -> schemaNames , te -> namespace ) ) ) return 0 ; } if ( ropt -> selTypes ) { if ( strcmp ( te -> desc , "TABLE" ) == 0 || strcmp ( te -> desc , "TABLE DATA" ) == 0 || strcmp ( te -> desc , "VIEW" ) == 0 || strcmp ( te -> desc , "FOREIGN TABLE" ) == 0 || strcmp ( te -> desc , "MATERIALIZED VIEW" ) == 0 || strcmp ( te -> desc , "MATERIALIZED VIEW DATA" ) == 0 || strcmp ( te -> desc , "SEQUENCE" ) == 0 || strcmp ( te -> desc , "SEQUENCE SET" ) == 0 ) { if ( ! ropt -> selTable ) return 0 ; if ( ropt -> tableNames . head != NULL && ( ! ( simple_string_list_member ( & ropt -> tableNames , te -> tag ) ) ) ) return 0 ; } else if ( strcmp ( te -> desc , "INDEX" ) == 0 ) { if ( ! ropt -> selIndex ) return 0 ; if ( ropt -> indexNames . head != NULL && ( ! ( simple_string_list_member ( & ropt -> indexNames , te -> tag ) ) ) ) return 0 ; } else if ( strcmp ( te -> desc , "FUNCTION" ) == 0 ) { if ( ! ropt -> selFunction ) return 0 ; if ( ropt -> functionNames . head != NULL && ( ! ( simple_string_list_member ( & ropt -> functionNames , te -> tag ) ) ) ) return 0 ; } else if ( strcmp ( te -> desc , "TRIGGER" ) == 0 ) { if ( ! ropt -> selTrigger ) return 0 ; if ( ropt -> triggerNames . head != NULL && ( ! ( simple_string_list_member ( & ropt -> triggerNames , te -> tag ) ) ) ) return 0 ; } else return 0 ; } if ( ! te -> hadDumper ) { if ( strcmp ( te -> desc , "SEQUENCE SET" ) == 0 || strcmp ( te -> desc , "BLOB" ) == 0 || ( strcmp ( te -> desc , "ACL" ) == 0 && strncmp ( te -> tag , "LARGE OBJECT " , 13 ) == 0 ) || ( strcmp ( te -> desc , "COMMENT" ) == 0 && strncmp ( te -> tag , "LARGE OBJECT " , 13 ) == 0 ) || ( strcmp ( te -> desc , "SECURITY LABEL" ) == 0 && strncmp ( te -> tag , "LARGE OBJECT " , 13 ) == 0 ) ) res = res & REQ_DATA ; else res = res & ~ REQ_DATA ; } if ( ( strcmp ( te -> desc , "<Init>" ) == 0 ) && ( strcmp ( te -> tag , "Max OID" ) == 0 ) ) return 0 ; if ( ropt -> schemaOnly ) res = res & REQ_SCHEMA ; if ( ropt -> dataOnly ) res = res & REQ_DATA ; if ( ! te -> defn || strlen ( te -> defn ) == 0 ) res = res & ~ REQ_SCHEMA ; if ( ropt -> idWanted && ! ropt -> idWanted [ te -> dumpId - 1 ] ) return 0 ; return res ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gint rtmpt_basic_header_length ( gint id ) { switch ( id & 0x3f ) { case 0 : return 2 ; case 1 : return 3 ; default : return 1 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
gcry_sexp_t gcry_sexp_append ( const gcry_sexp_t a , const gcry_sexp_t n ) { ( void ) a ; ( void ) n ; BUG ( ) ; return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void generate_filename ( const char * pattern , char * out , size_t q_len , unsigned int d_w , unsigned int d_h , unsigned int frame_in ) { const char * p = pattern ; char * q = out ; do { char * next_pat = strchr ( p , '%' ) ; if ( p == next_pat ) { size_t pat_len ; q [ q_len - 1 ] = '\0' ; switch ( p [ 1 ] ) { case 'w' : snprintf ( q , q_len - 1 , "%d" , d_w ) ; break ; case 'h' : snprintf ( q , q_len - 1 , "%d" , d_h ) ; break ; case '1' : snprintf ( q , q_len - 1 , "%d" , frame_in ) ; break ; case '2' : snprintf ( q , q_len - 1 , "%02d" , frame_in ) ; break ; case '3' : snprintf ( q , q_len - 1 , "%03d" , frame_in ) ; break ; case '4' : snprintf ( q , q_len - 1 , "%04d" , frame_in ) ; break ; case '5' : snprintf ( q , q_len - 1 , "%05d" , frame_in ) ; break ; case '6' : snprintf ( q , q_len - 1 , "%06d" , frame_in ) ; break ; case '7' : snprintf ( q , q_len - 1 , "%07d" , frame_in ) ; break ; case '8' : snprintf ( q , q_len - 1 , "%08d" , frame_in ) ; break ; case '9' : snprintf ( q , q_len - 1 , "%09d" , frame_in ) ; break ; default : die ( "Unrecognized pattern %%%c\n" , p [ 1 ] ) ; break ; } pat_len = strlen ( q ) ; if ( pat_len >= q_len - 1 ) die ( "Output filename too long.\n" ) ; q += pat_len ; p += 2 ; q_len -= pat_len ; } else { size_t copy_len ; if ( ! next_pat ) copy_len = strlen ( p ) ; else copy_len = next_pat - p ; if ( copy_len >= q_len - 1 ) die ( "Output filename too long.\n" ) ; memcpy ( q , p , copy_len ) ; q [ copy_len ] = '\0' ; q += copy_len ; p += copy_len ; q_len -= copy_len ; } } while ( * p ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TSAction TSCacheWrite ( TSCont contp , TSCacheKey key ) { sdk_assert ( sdk_sanity_check_iocore_structure ( contp ) == TS_SUCCESS ) ; sdk_assert ( sdk_sanity_check_cachekey ( key ) == TS_SUCCESS ) ; FORCE_PLUGIN_SCOPED_MUTEX ( contp ) ; CacheInfo * info = ( CacheInfo * ) key ; Continuation * i = ( INKContInternal * ) contp ; return ( TSAction ) cacheProcessor . open_write ( i , & info -> cache_key , true , info -> frag_type , 0 , false , info -> pin_in_cache , info -> hostname , info -> len ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ProcessUtilTest , MAYBE_GetTerminationStatusCrash ) { const std : : string signal_file = ProcessUtilTest : : GetSignalFilePath ( kSignalFileCrash ) ; remove ( signal_file . c_str ( ) ) ; base : : Process process = SpawnChild ( "CrashingChildProcess" ) ; ASSERT_TRUE ( process . IsValid ( ) ) ; int exit_code = 42 ; EXPECT_EQ ( base : : TERMINATION_STATUS_STILL_RUNNING , base : : GetTerminationStatus ( process . Handle ( ) , & exit_code ) ) ; EXPECT_EQ ( kExpectedStillRunningExitCode , exit_code ) ; SignalChildren ( signal_file . c_str ( ) ) ; exit_code = 42 ; base : : TerminationStatus status = WaitForChildTermination ( process . Handle ( ) , & exit_code ) ; EXPECT_EQ ( base : : TERMINATION_STATUS_PROCESS_CRASHED , status ) ; # if defined ( OS_WIN ) EXPECT_EQ ( 0xc0000005 , exit_code ) ; # elif defined ( OS_POSIX ) int signaled = WIFSIGNALED ( exit_code ) ; EXPECT_NE ( 0 , signaled ) ; int signal = WTERMSIG ( exit_code ) ; EXPECT_EQ ( SIGSEGV , signal ) ; # endif base : : debug : : EnableInProcessStackDumping ( ) ; remove ( signal_file . c_str ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void qtrle_decode_8bpp ( QtrleContext * s , int row_ptr , int lines_to_change ) { int rle_code ; int pixel_ptr ; int row_inc = s -> frame . linesize [ 0 ] ; unsigned char pi1 , pi2 , pi3 , pi4 ; unsigned char * rgb = s -> frame . data [ 0 ] ; int pixel_limit = s -> frame . linesize [ 0 ] * s -> avctx -> height ; while ( lines_to_change -- ) { pixel_ptr = row_ptr + ( 4 * ( bytestream2_get_byte ( & s -> g ) - 1 ) ) ; CHECK_PIXEL_PTR ( 0 ) ; while ( ( rle_code = ( signed char ) bytestream2_get_byte ( & s -> g ) ) != - 1 ) { if ( rle_code == 0 ) { pixel_ptr += ( 4 * ( bytestream2_get_byte ( & s -> g ) - 1 ) ) ; CHECK_PIXEL_PTR ( 0 ) ; } else if ( rle_code < 0 ) { rle_code = - rle_code ; pi1 = bytestream2_get_byte ( & s -> g ) ; pi2 = bytestream2_get_byte ( & s -> g ) ; pi3 = bytestream2_get_byte ( & s -> g ) ; pi4 = bytestream2_get_byte ( & s -> g ) ; CHECK_PIXEL_PTR ( rle_code * 4 ) ; while ( rle_code -- ) { rgb [ pixel_ptr ++ ] = pi1 ; rgb [ pixel_ptr ++ ] = pi2 ; rgb [ pixel_ptr ++ ] = pi3 ; rgb [ pixel_ptr ++ ] = pi4 ; } } else { rle_code *= 4 ; CHECK_PIXEL_PTR ( rle_code ) ; while ( rle_code -- ) { rgb [ pixel_ptr ++ ] = bytestream2_get_byte ( & s -> g ) ; } } } row_ptr += row_inc ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int s302m_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) { AVFrame * frame = data ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; int block_size , ret ; int frame_size = s302m_parse_frame_header ( avctx , buf , buf_size ) ; if ( frame_size < 0 ) return frame_size ; buf_size -= AES3_HEADER_LEN ; buf += AES3_HEADER_LEN ; block_size = ( avctx -> bits_per_coded_sample + 4 ) / 4 ; frame -> nb_samples = 2 * ( buf_size / block_size ) / avctx -> channels ; if ( ( ret = ff_get_buffer ( avctx , frame ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } buf_size = ( frame -> nb_samples * avctx -> channels / 2 ) * block_size ; if ( avctx -> bits_per_coded_sample == 24 ) { uint32_t * o = ( uint32_t * ) frame -> data [ 0 ] ; for ( ; buf_size > 6 ; buf_size -= 7 ) { * o ++ = ( ff_reverse [ buf [ 2 ] ] << 24 ) | ( ff_reverse [ buf [ 1 ] ] << 16 ) | ( ff_reverse [ buf [ 0 ] ] << 8 ) ; * o ++ = ( ff_reverse [ buf [ 6 ] & 0xf0 ] << 28 ) | ( ff_reverse [ buf [ 5 ] ] << 20 ) | ( ff_reverse [ buf [ 4 ] ] << 12 ) | ( ff_reverse [ buf [ 3 ] & 0x0f ] << 4 ) ; buf += 7 ; } } else if ( avctx -> bits_per_coded_sample == 20 ) { uint32_t * o = ( uint32_t * ) frame -> data [ 0 ] ; for ( ; buf_size > 5 ; buf_size -= 6 ) { * o ++ = ( ff_reverse [ buf [ 2 ] & 0xf0 ] << 28 ) | ( ff_reverse [ buf [ 1 ] ] << 20 ) | ( ff_reverse [ buf [ 0 ] ] << 12 ) ; * o ++ = ( ff_reverse [ buf [ 5 ] & 0xf0 ] << 28 ) | ( ff_reverse [ buf [ 4 ] ] << 20 ) | ( ff_reverse [ buf [ 3 ] ] << 12 ) ; buf += 6 ; } } else { uint16_t * o = ( uint16_t * ) frame -> data [ 0 ] ; for ( ; buf_size > 4 ; buf_size -= 5 ) { * o ++ = ( ff_reverse [ buf [ 1 ] ] << 8 ) | ff_reverse [ buf [ 0 ] ] ; * o ++ = ( ff_reverse [ buf [ 4 ] & 0xf0 ] << 12 ) | ( ff_reverse [ buf [ 3 ] ] << 4 ) | ( ff_reverse [ buf [ 2 ] ] >> 4 ) ; buf += 5 ; } } * got_frame_ptr = 1 ; return avpkt -> size ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static gpgme_error_t gpgsm_keylist_ext ( void * engine , const char * pattern [ ] , int secret_only , int reserved , gpgme_keylist_mode_t mode ) { engine_gpgsm_t gpgsm = engine ; char * line ; gpgme_error_t err ; int length = 15 + 1 ; char * linep ; int any_pattern = 0 ; int list_mode = 0 ; if ( reserved ) return gpg_error ( GPG_ERR_INV_VALUE ) ; if ( mode & GPGME_KEYLIST_MODE_LOCAL ) list_mode |= 1 ; if ( mode & GPGME_KEYLIST_MODE_EXTERN ) list_mode |= 2 ; if ( asprintf ( & line , "OPTION list-mode=%d" , ( list_mode & 3 ) ) < 0 ) return gpg_error_from_syserror ( ) ; err = gpgsm_assuan_simple_command ( gpgsm -> assuan_ctx , line , NULL , NULL ) ; free ( line ) ; if ( err ) return err ; gpgsm_assuan_simple_command ( gpgsm -> assuan_ctx , ( mode & GPGME_KEYLIST_MODE_VALIDATE ) ? "OPTION with-validation=1" : "OPTION with-validation=0" , NULL , NULL ) ; gpgsm_assuan_simple_command ( gpgsm -> assuan_ctx , ( mode & GPGME_KEYLIST_MODE_WITH_SECRET ) ? "OPTION with-secret=1" : "OPTION with-secret=0" , NULL , NULL ) ; if ( pattern && * pattern ) { const char * * pat = pattern ; while ( * pat ) { const char * patlet = * pat ; while ( * patlet ) { length ++ ; if ( * patlet == '%' || * patlet == ' ' || * patlet == '+' ) length += 2 ; patlet ++ ; } pat ++ ; length ++ ; } } line = malloc ( length ) ; if ( ! line ) return gpg_error_from_syserror ( ) ; if ( secret_only ) { strcpy ( line , "LISTSECRETKEYS " ) ; linep = & line [ 15 ] ; } else { strcpy ( line , "LISTKEYS " ) ; linep = & line [ 9 ] ; } if ( pattern && * pattern ) { while ( * pattern ) { const char * patlet = * pattern ; while ( * patlet ) { switch ( * patlet ) { case '%' : * ( linep ++ ) = '%' ; * ( linep ++ ) = '2' ; * ( linep ++ ) = '5' ; break ; case ' ' : * ( linep ++ ) = '%' ; * ( linep ++ ) = '2' ; * ( linep ++ ) = '0' ; break ; case '+' : * ( linep ++ ) = '%' ; * ( linep ++ ) = '2' ; * ( linep ++ ) = 'B' ; break ; default : * ( linep ++ ) = * patlet ; break ; } patlet ++ ; } any_pattern = 1 ; * linep ++ = ' ' ; pattern ++ ; } } if ( any_pattern ) linep -- ; * linep = '\0' ; gpgsm_clear_fd ( gpgsm , INPUT_FD ) ; gpgsm_clear_fd ( gpgsm , OUTPUT_FD ) ; gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ; gpgsm -> inline_data = NULL ; err = start ( gpgsm , line ) ; free ( line ) ; return err ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * purple_get_account_prpl_id ( account_t * acc ) { if ( g_strcmp0 ( acc -> prpl -> name , "oscar" ) == 0 ) { return ( g_ascii_isdigit ( acc -> user [ 0 ] ) ) ? "prpl-icq" : "prpl-aim" ; } return acc -> prpl -> data ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , UseCounterFeaturesInIframes ) { ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ; auto waiter = CreatePageLoadMetricsWaiter ( ) ; waiter -> AddPageExpectation ( TimingField : : LOAD_EVENT ) ; ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/page_load_metrics/use_counter_features_in_iframes.html" ) ) ; waiter -> Wait ( ) ; NavigateToUntrackedUrl ( ) ; histogram_tester_ . ExpectBucketCount ( internal : : kFeaturesHistogramName , static_cast < int32_t > ( WebFeature : : kTextWholeText ) , 1 ) ; histogram_tester_ . ExpectBucketCount ( internal : : kFeaturesHistogramName , static_cast < int32_t > ( WebFeature : : kV8Element_Animate_Method ) , 1 ) ; histogram_tester_ . ExpectBucketCount ( internal : : kFeaturesHistogramName , static_cast < int32_t > ( WebFeature : : kNavigatorVibrate ) , 1 ) ; histogram_tester_ . ExpectBucketCount ( internal : : kFeaturesHistogramName , static_cast < int32_t > ( WebFeature : : kPageVisits ) , 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void dtls1_stop_timer ( SSL * s ) { memset ( & s -> d1 -> timeout , 0 , sizeof ( s -> d1 -> timeout ) ) ; memset ( & s -> d1 -> next_timeout , 0 , sizeof ( s -> d1 -> next_timeout ) ) ; s -> d1 -> timeout_duration = 1 ; BIO_ctrl ( SSL_get_rbio ( s ) , BIO_CTRL_DGRAM_SET_NEXT_TIMEOUT , 0 , & ( s -> d1 -> next_timeout ) ) ; dtls1_clear_sent_buffer ( s ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static PREDICTION_MODE read_intra_mode_uv ( VP9_COMMON * cm , vp9_reader * r , PREDICTION_MODE y_mode ) { const PREDICTION_MODE uv_mode = read_intra_mode ( r , cm -> fc . uv_mode_prob [ y_mode ] ) ; if ( ! cm -> frame_parallel_decoding_mode ) ++ cm -> counts . uv_mode [ y_mode ] [ uv_mode ] ; return uv_mode ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void tm2_med_res_block ( TM2Context * ctx , AVFrame * pic , int bx , int by ) { int i ; int deltas [ 16 ] ; TM2_INIT_POINTERS ( ) ; deltas [ 0 ] = GET_TOK ( ctx , TM2_C_LO ) ; deltas [ 1 ] = deltas [ 2 ] = deltas [ 3 ] = 0 ; tm2_low_chroma ( U , Ustride , clast , ctx -> CD , deltas , bx ) ; deltas [ 0 ] = GET_TOK ( ctx , TM2_C_LO ) ; deltas [ 1 ] = deltas [ 2 ] = deltas [ 3 ] = 0 ; tm2_low_chroma ( V , Vstride , clast + 2 , ctx -> CD + 2 , deltas , bx ) ; for ( i = 0 ; i < 16 ; i ++ ) deltas [ i ] = GET_TOK ( ctx , TM2_L_HI ) ; tm2_apply_deltas ( ctx , Y , Ystride , deltas , last ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ASN1_UTCTIME * obj_to_asn1utime ( VALUE time ) { time_t sec ; ASN1_UTCTIME * t ; # if defined ( HAVE_ASN1_TIME_ADJ ) int off_days ; ossl_time_split ( time , & sec , & off_days ) ; if ( ! ( t = ASN1_UTCTIME_adj ( NULL , sec , off_days , 0 ) ) ) # else sec = time_to_time_t ( time ) ; if ( ! ( t = ASN1_UTCTIME_set ( NULL , sec ) ) ) # endif ossl_raise ( eASN1Error , NULL ) ; return t ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
mbfl_encoding_detector * mbfl_encoding_detector_new2 ( const mbfl_encoding * * elist , int elistsz , int strict ) { mbfl_encoding_detector * identd ; int i , num ; mbfl_identify_filter * filter ; if ( elist == NULL || elistsz <= 0 ) { return NULL ; } identd = ( mbfl_encoding_detector * ) mbfl_malloc ( sizeof ( mbfl_encoding_detector ) ) ; if ( identd == NULL ) { return NULL ; } identd -> filter_list = ( mbfl_identify_filter * * ) mbfl_calloc ( elistsz , sizeof ( mbfl_identify_filter * ) ) ; if ( identd -> filter_list == NULL ) { mbfl_free ( identd ) ; return NULL ; } i = 0 ; num = 0 ; while ( i < elistsz ) { filter = mbfl_identify_filter_new2 ( elist [ i ] ) ; if ( filter != NULL ) { identd -> filter_list [ num ] = filter ; num ++ ; } i ++ ; } identd -> filter_list_size = num ; identd -> strict = strict ; return identd ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int test_address_cache ( xd3_stream * stream , int unused ) { int ret ; usize_t i ; usize_t offset ; usize_t * addrs ; uint8_t * big_buf , * buf_max ; const uint8_t * buf ; xd3_output * outp ; uint8_t * modes ; int mode_counts [ 16 ] ; stream -> acache . s_near = stream -> code_table_desc -> near_modes ; stream -> acache . s_same = stream -> code_table_desc -> same_modes ; if ( ( ret = xd3_encode_init_partial ( stream ) ) ) { return ret ; } addrs = ( usize_t * ) xd3_alloc ( stream , sizeof ( usize_t ) , ADDR_CACHE_ROUNDS ) ; modes = ( uint8_t * ) xd3_alloc ( stream , sizeof ( uint8_t ) , ADDR_CACHE_ROUNDS ) ; memset ( mode_counts , 0 , sizeof ( mode_counts ) ) ; memset ( modes , 0 , ADDR_CACHE_ROUNDS ) ; addrs [ 0 ] = 0 ; mt_init ( & static_mtrand , 0x9f73f7fc ) ; xd3_init_cache ( & stream -> acache ) ; for ( offset = 1 ; offset < ADDR_CACHE_ROUNDS ; offset += 1 ) { double p ; usize_t addr ; usize_t prev_i ; usize_t nearby ; p = ( mt_random ( & static_mtrand ) / ( double ) USIZE_T_MAX ) ; prev_i = mt_random ( & static_mtrand ) % offset ; nearby = ( mt_random ( & static_mtrand ) % 256 ) % offset ; nearby = max ( 1U , nearby ) ; if ( p < 0.1 ) { addr = addrs [ offset - nearby ] ; } else if ( p < 0.4 ) { addr = min ( addrs [ prev_i ] + nearby , offset - 1 ) ; } else { addr = prev_i ; } if ( ( ret = xd3_encode_address ( stream , addr , offset , & modes [ offset ] ) ) ) { return ret ; } addrs [ offset ] = addr ; mode_counts [ modes [ offset ] ] += 1 ; } big_buf = ( uint8_t * ) xd3_alloc ( stream , xd3_sizeof_output ( ADDR_HEAD ( stream ) ) , 1 ) ; for ( offset = 0 , outp = ADDR_HEAD ( stream ) ; outp != NULL ; offset += outp -> next , outp = outp -> next_page ) { memcpy ( big_buf + offset , outp -> base , outp -> next ) ; } buf_max = big_buf + offset ; buf = big_buf ; xd3_init_cache ( & stream -> acache ) ; for ( offset = 1 ; offset < ADDR_CACHE_ROUNDS ; offset += 1 ) { uint32_t addr ; if ( ( ret = xd3_decode_address ( stream , offset , modes [ offset ] , & buf , buf_max , & addr ) ) ) { return ret ; } if ( addr != addrs [ offset ] ) { stream -> msg = "incorrect decoded address" ; return XD3_INTERNAL ; } } if ( buf != buf_max ) { stream -> msg = "address bytes not used" ; return XD3_INTERNAL ; } for ( i = 0 ; i < ( 2 + stream -> acache . s_same + stream -> acache . s_near ) ; i += 1 ) { if ( mode_counts [ i ] == 0 ) { stream -> msg = "address mode not used" ; return XD3_INTERNAL ; } } xd3_free ( stream , modes ) ; xd3_free ( stream , addrs ) ; xd3_free ( stream , big_buf ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void gsm_a_dtap_tp_stat_init ( new_stat_tap_ui * new_stat , new_stat_tap_gui_init_cb gui_callback , void * gui_data ) { gsm_a_stat_init ( new_stat , gui_callback , gui_data , "GSM A-I/F DTAP Special Conformance Testing Functions" , gsm_a_dtap_msg_tp_strings ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline int sub_left_prediction ( HYuvContext * s , uint8_t * dst , const uint8_t * src , int w , int left ) { int i ; if ( w < 32 ) { for ( i = 0 ; i < w ; i ++ ) { const int temp = src [ i ] ; dst [ i ] = temp - left ; left = temp ; } return left ; } else { for ( i = 0 ; i < 16 ; i ++ ) { const int temp = src [ i ] ; dst [ i ] = temp - left ; left = temp ; } s -> dsp . diff_bytes ( dst + 16 , src + 16 , src + 15 , w - 16 ) ; return src [ w - 1 ] ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void write_image_file ( const vpx_image_t * img , const int planes [ 3 ] , FILE * file ) { int i , y ; # if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH const int bytes_per_sample = ( ( img -> fmt & VPX_IMG_FMT_HIGHBITDEPTH ) ? 2 : 1 ) ; # else const int bytes_per_sample = 1 ; # endif for ( i = 0 ; i < 3 ; ++ i ) { const int plane = planes [ i ] ; const unsigned char * buf = img -> planes [ plane ] ; const int stride = img -> stride [ plane ] ; const int w = vpx_img_plane_width ( img , plane ) ; const int h = vpx_img_plane_height ( img , plane ) ; for ( y = 0 ; y < h ; ++ y ) { fwrite ( buf , bytes_per_sample , w , file ) ; buf += stride ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void rfbClientConnFailed ( rfbClientPtr cl , const char * reason ) { char * buf ; int len = strlen ( reason ) ; rfbLog ( "rfbClientConnFailed(\"%s\")\n" , reason ) ; buf = ( char * ) malloc ( 8 + len ) ; ( ( uint32_t * ) buf ) [ 0 ] = Swap32IfLE ( rfbConnFailed ) ; ( ( uint32_t * ) buf ) [ 1 ] = Swap32IfLE ( len ) ; memcpy ( buf + 8 , reason , len ) ; if ( rfbWriteExact ( cl , buf , 8 + len ) < 0 ) rfbLogPerror ( "rfbClientConnFailed: write" ) ; free ( buf ) ; rfbCloseClient ( cl ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool contain_leaked_vars_checker ( Oid func_id , void * context ) { return ! get_func_leakproof ( func_id ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_block_info ( slurm_msg_t * msg ) { int error_code = SLURM_SUCCESS ; Buf buffer = NULL ; block_info_request_msg_t * sel_req_msg = ( block_info_request_msg_t * ) msg -> data ; slurm_msg_t response_msg ; slurmctld_lock_t config_read_lock = { READ_LOCK , NO_LOCK , NO_LOCK , NO_LOCK , NO_LOCK } ; DEF_TIMERS ; uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ; START_TIMER ; debug2 ( "Processing RPC: REQUEST_BLOCK_INFO from uid=%d" , uid ) ; lock_slurmctld ( config_read_lock ) ; if ( ( slurmctld_conf . private_data & PRIVATE_DATA_NODES ) && ! validate_operator ( uid ) ) { error_code = ESLURM_ACCESS_DENIED ; error ( "Security violation, REQUEST_BLOCK_INFO RPC from uid=%d" , uid ) ; } unlock_slurmctld ( config_read_lock ) ; if ( error_code == SLURM_SUCCESS ) { error_code = select_g_pack_select_info ( sel_req_msg -> last_update , sel_req_msg -> show_flags , & buffer , msg -> protocol_version ) ; } END_TIMER2 ( "_slurm_rpc_block_info" ) ; if ( error_code ) { debug3 ( "_slurm_rpc_block_info: %s" , slurm_strerror ( error_code ) ) ; slurm_send_rc_msg ( msg , error_code ) ; } else { slurm_msg_t_init ( & response_msg ) ; response_msg . flags = msg -> flags ; response_msg . protocol_version = msg -> protocol_version ; response_msg . address = msg -> address ; response_msg . conn = msg -> conn ; response_msg . msg_type = RESPONSE_BLOCK_INFO ; response_msg . data = get_buf_data ( buffer ) ; response_msg . data_size = get_buf_offset ( buffer ) ; slurm_send_node_msg ( msg -> conn_fd , & response_msg ) ; free_buf ( buffer ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ps2_write_keyboard ( void * opaque , int val ) { PS2KbdState * s = ( PS2KbdState * ) opaque ; trace_ps2_write_keyboard ( opaque , val ) ; switch ( s -> common . write_cmd ) { default : case - 1 : switch ( val ) { case 0x00 : ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; break ; case 0x05 : ps2_queue ( & s -> common , KBD_REPLY_RESEND ) ; break ; case KBD_CMD_GET_ID : ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; ps2_queue ( & s -> common , KBD_REPLY_ID ) ; if ( s -> translate ) ps2_queue ( & s -> common , 0x41 ) ; else ps2_queue ( & s -> common , 0x83 ) ; break ; case KBD_CMD_ECHO : ps2_queue ( & s -> common , KBD_CMD_ECHO ) ; break ; case KBD_CMD_ENABLE : s -> scan_enabled = 1 ; ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; break ; case KBD_CMD_SCANCODE : case KBD_CMD_SET_LEDS : case KBD_CMD_SET_RATE : s -> common . write_cmd = val ; ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; break ; case KBD_CMD_RESET_DISABLE : ps2_reset_keyboard ( s ) ; s -> scan_enabled = 0 ; ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; break ; case KBD_CMD_RESET_ENABLE : ps2_reset_keyboard ( s ) ; s -> scan_enabled = 1 ; ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; break ; case KBD_CMD_RESET : ps2_reset_keyboard ( s ) ; ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; ps2_queue ( & s -> common , KBD_REPLY_POR ) ; break ; default : ps2_queue ( & s -> common , KBD_REPLY_RESEND ) ; break ; } break ; case KBD_CMD_SCANCODE : if ( val == 0 ) { ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; ps2_put_keycode ( s , s -> scancode_set ) ; } else if ( val >= 1 && val <= 3 ) { s -> scancode_set = val ; ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; } else { ps2_queue ( & s -> common , KBD_REPLY_RESEND ) ; } s -> common . write_cmd = - 1 ; break ; case KBD_CMD_SET_LEDS : ps2_set_ledstate ( s , val ) ; ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; s -> common . write_cmd = - 1 ; break ; case KBD_CMD_SET_RATE : ps2_queue ( & s -> common , KBD_REPLY_ACK ) ; s -> common . write_cmd = - 1 ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new ( sk_ ## t1 ## _compfunc compare ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new ( ( OPENSSL_sk_compfunc ) compare ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ; } static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) { return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ; } static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) { return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ; } static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) { OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) { return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ; } static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) { return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) { return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ; } # define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ; typedef const char * OPENSSL_CSTRING ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char )
1True