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 int parse_read_intervals ( const char * intervals_spec ) { int ret , n , i ; char * p , * spec = av_strdup ( intervals_spec ) ; if ( ! spec ) return AVERROR ( ENOMEM ) ; for ( n = 0 , p = spec ; * p ; p ++ ) if ( * p == ',' ) n ++ ; n ++ ; read_intervals = av_malloc_array ( n , sizeof ( * read_intervals ) ) ; if ( ! read_intervals ) { ret = AVERROR ( ENOMEM ) ; goto end ; } read_intervals_nb = n ; p = spec ; for ( i = 0 ; p ; i ++ ) { char * next ; av_assert0 ( i < read_intervals_nb ) ; next = strchr ( p , ',' ) ; if ( next ) * next ++ = 0 ; read_intervals [ i ] . id = i ; ret = parse_read_interval ( p , & read_intervals [ i ] ) ; if ( ret < 0 ) { av_log ( NULL , AV_LOG_ERROR , "Error parsing read interval #%d '%s'\n" , i , p ) ; goto end ; } av_log ( NULL , AV_LOG_VERBOSE , "Parsed log interval " ) ; log_read_interval ( & read_intervals [ i ] , NULL , AV_LOG_VERBOSE ) ; p = next ; } av_assert0 ( i == read_intervals_nb ) ; end : av_free ( spec ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ff_vorbis_inverse_coupling ( float * mag , float * ang , intptr_t blocksize ) { int i ; for ( i = 0 ; i < blocksize ; i ++ ) { if ( mag [ i ] > 0.0 ) { if ( ang [ i ] > 0.0 ) { ang [ i ] = mag [ i ] - ang [ i ] ; } else { float temp = ang [ i ] ; ang [ i ] = mag [ i ] ; mag [ i ] += temp ; } } else { if ( ang [ i ] > 0.0 ) { ang [ i ] += mag [ i ] ; } else { float temp = ang [ i ] ; ang [ i ] = mag [ i ] ; mag [ i ] -= temp ; } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void oid_free_cb ( void * r ) { oid_user_t * u = ( oid_user_t * ) r ; g_free ( u -> oid ) ; g_free ( u -> name ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void hb_set_invert ( hb_set_t * set ) { set -> invert ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int com_pager ( String * buffer __attribute__ ( ( unused ) ) , char * line __attribute__ ( ( unused ) ) ) { char pager_name [ FN_REFLEN ] , * end , * param ; if ( status . batch ) return 0 ; while ( my_isspace ( charset_info , * line ) ) line ++ ; param = strchr ( line , ' ' ) ; while ( param && my_isspace ( charset_info , * param ) ) param ++ ; if ( ! param || ! strlen ( param ) ) { if ( ! default_pager_set ) { tee_fprintf ( stdout , "Default pager wasn't set, using stdout.\n" ) ; opt_nopager = 1 ; strmov ( pager , "stdout" ) ; PAGER = stdout ; return 0 ; } strmov ( pager , default_pager ) ; } else { end = strmake_buf ( pager_name , param ) ; while ( end > pager_name && ( my_isspace ( charset_info , end [ - 1 ] ) || my_iscntrl ( charset_info , end [ - 1 ] ) ) ) end -- ; end [ 0 ] = 0 ; strmov ( pager , pager_name ) ; strmov ( default_pager , pager_name ) ; } opt_nopager = 0 ; tee_fprintf ( stdout , "PAGER set to '%s'\n" , pager ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void sigcomp_cleanup_udvm ( void ) { g_hash_table_destroy ( state_buffer_table ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline uint8_t motion_arg ( motion_vect mot ) { uint8_t ax = 8 - ( ( uint8_t ) mot . d [ 0 ] ) ; uint8_t ay = 8 - ( ( uint8_t ) mot . d [ 1 ] ) ; return ( ( ax & 15 ) << 4 ) | ( ay & 15 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pll_delete ( struct proclistlist * pll ) { free ( pll -> proclist ) ; free ( pll ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TSVConnAbort ( TSVConn connp , int error ) { sdk_assert ( sdk_sanity_check_iocore_structure ( connp ) == TS_SUCCESS ) ; VConnection * vc = ( VConnection * ) connp ; vc -> do_io_close ( error ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean ng_read_bytes_or_eof ( wtap * wth , void * buffer , unsigned int nbytes , gboolean is_random , int * err , gchar * * err_info ) { ngsniffer_t * ngsniffer ; FILE_T infile ; ngsniffer_comp_stream_t * comp_stream ; unsigned char * outbuffer = ( unsigned char * ) buffer ; blob_info_t * blob ; unsigned int bytes_to_copy ; unsigned int bytes_left ; ngsniffer = ( ngsniffer_t * ) wth -> priv ; if ( is_random ) { infile = wth -> random_fh ; comp_stream = & ngsniffer -> rand ; } else { infile = wth -> fh ; comp_stream = & ngsniffer -> seq ; } if ( wth -> file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED ) { if ( ! wtap_read_bytes_or_eof ( infile , buffer , nbytes , err , err_info ) ) return FALSE ; comp_stream -> uncomp_offset += nbytes ; comp_stream -> comp_offset += nbytes ; return TRUE ; } if ( comp_stream -> buf == NULL ) { comp_stream -> buf = ( unsigned char * ) g_malloc ( OUTBUF_SIZE ) ; if ( is_random ) { ngsniffer -> current_blob = ngsniffer -> first_blob ; } else { if ( wth -> random_fh != NULL ) { g_assert ( ngsniffer -> first_blob == NULL ) ; blob = g_new ( blob_info_t , 1 ) ; blob -> blob_comp_offset = comp_stream -> comp_offset ; blob -> blob_uncomp_offset = comp_stream -> uncomp_offset ; ngsniffer -> first_blob = g_list_append ( ngsniffer -> first_blob , blob ) ; ngsniffer -> last_blob = ngsniffer -> first_blob ; } } if ( ! read_blob ( infile , comp_stream , err , err_info ) ) return FALSE ; } while ( nbytes > 0 ) { bytes_left = comp_stream -> nbytes - comp_stream -> nextout ; if ( bytes_left == 0 ) { if ( is_random ) { ngsniffer -> current_blob = g_list_next ( ngsniffer -> current_blob ) ; if ( ! ngsniffer -> current_blob ) { * err = WTAP_ERR_CANT_SEEK ; return FALSE ; } } else { if ( wth -> random_fh != NULL ) { blob = g_new ( blob_info_t , 1 ) ; blob -> blob_comp_offset = comp_stream -> comp_offset ; blob -> blob_uncomp_offset = comp_stream -> uncomp_offset ; ngsniffer -> last_blob = g_list_append ( ngsniffer -> last_blob , blob ) ; } } if ( ! read_blob ( infile , comp_stream , err , err_info ) ) return FALSE ; bytes_left = comp_stream -> nbytes - comp_stream -> nextout ; } bytes_to_copy = nbytes ; if ( bytes_to_copy > bytes_left ) bytes_to_copy = bytes_left ; memcpy ( outbuffer , & comp_stream -> buf [ comp_stream -> nextout ] , bytes_to_copy ) ; nbytes -= bytes_to_copy ; outbuffer += bytes_to_copy ; comp_stream -> nextout += bytes_to_copy ; comp_stream -> uncomp_offset += bytes_to_copy ; } return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void safeputs ( netdissect_options * ndo , const u_char * s , const u_int maxlen ) { u_int idx = 0 ; while ( * s && idx < maxlen ) { safeputchar ( ndo , * s ) ; idx ++ ; s ++ ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
struct key * key_lookup ( key_serial_t id ) { struct rb_node * n ; struct key * key ; spin_lock ( & key_serial_lock ) ; n = key_serial_tree . rb_node ; while ( n ) { key = rb_entry ( n , struct key , serial_node ) ; if ( id < key -> serial ) n = n -> rb_left ; else if ( id > key -> serial ) n = n -> rb_right ; else goto found ; } not_found : key = ERR_PTR ( - ENOKEY ) ; goto error ; found : if ( atomic_read ( & key -> usage ) == 0 ) goto not_found ; __key_get ( key ) ; error : spin_unlock ( & key_serial_lock ) ; return key ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void read_addr_restrictions ( struct recvbuf * rbufp ) { u_int idx ; idx = 0 ; send_restrict_list ( restrictlist4 , FALSE , & idx ) ; send_restrict_list ( restrictlist6 , TRUE , & idx ) ; ctl_flushpkt ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void jpc_ft_invlift_row ( jpc_fix_t * a , int numcols , int parity ) { register jpc_fix_t * lptr ; register jpc_fix_t * hptr ; register int n ; int llen ; llen = ( numcols + 1 - parity ) >> 1 ; if ( numcols > 1 ) { lptr = & a [ 0 ] ; hptr = & a [ llen ] ; if ( ! parity ) { lptr [ 0 ] -= jpc_fix_asr ( hptr [ 0 ] + 1 , 1 ) ; ++ lptr ; } n = llen - ( ! parity ) - ( parity != ( numcols & 1 ) ) ; while ( n -- > 0 ) { lptr [ 0 ] -= jpc_fix_asr ( hptr [ 0 ] + hptr [ 1 ] + 2 , 2 ) ; ++ lptr ; ++ hptr ; } if ( parity != ( numcols & 1 ) ) { lptr [ 0 ] -= jpc_fix_asr ( hptr [ 0 ] + 1 , 1 ) ; } lptr = & a [ 0 ] ; hptr = & a [ llen ] ; if ( parity ) { hptr [ 0 ] += lptr [ 0 ] ; ++ hptr ; } n = numcols - llen - parity - ( parity == ( numcols & 1 ) ) ; while ( n -- > 0 ) { hptr [ 0 ] += jpc_fix_asr ( lptr [ 0 ] + lptr [ 1 ] , 1 ) ; ++ hptr ; ++ lptr ; } if ( parity == ( numcols & 1 ) ) { hptr [ 0 ] += lptr [ 0 ] ; } } else { if ( parity ) { lptr = & a [ 0 ] ; lptr [ 0 ] = jpc_fix_asr ( lptr [ 0 ] , 1 ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int matroska_ebmlnum_uint ( MatroskaDemuxContext * matroska , uint8_t * data , uint32_t size , uint64_t * num ) { AVIOContext pb ; ffio_init_context ( & pb , data , size , 0 , NULL , NULL , NULL , NULL ) ; return ebml_read_num ( matroska , & pb , FFMIN ( size , 8 ) , num ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int rtp_xiph_pack_headers ( size_t room , void * p_extra , size_t i_extra , uint8_t * * p_buffer , size_t * i_buffer , uint8_t * theora_pixel_fmt ) { unsigned packet_size [ XIPH_MAX_HEADER_COUNT ] ; void * packet [ XIPH_MAX_HEADER_COUNT ] ; unsigned packet_count ; if ( xiph_SplitHeaders ( packet_size , packet , & packet_count , i_extra , p_extra ) ) return VLC_EGENERIC ; ; if ( packet_count < 3 ) return VLC_EGENERIC ; ; if ( theora_pixel_fmt != NULL ) { if ( packet_size [ 0 ] < 42 ) return VLC_EGENERIC ; * theora_pixel_fmt = ( ( ( uint8_t * ) packet [ 0 ] ) [ 41 ] >> 3 ) & 0x03 ; } unsigned length_size [ 2 ] = { 0 , 0 } ; for ( int i = 0 ; i < 2 ; i ++ ) { unsigned size = packet_size [ i ] ; while ( size > 0 ) { length_size [ i ] ++ ; size >>= 7 ; } } * i_buffer = room + 1 + length_size [ 0 ] + length_size [ 1 ] + packet_size [ 0 ] + packet_size [ 1 ] + packet_size [ 2 ] ; * p_buffer = malloc ( * i_buffer ) ; if ( * p_buffer == NULL ) return VLC_ENOMEM ; uint8_t * p = * p_buffer + room ; * p ++ = 2 ; for ( int i = 0 ; i < 2 ; i ++ ) { unsigned size = length_size [ i ] ; while ( size > 0 ) { * p = ( packet_size [ i ] >> ( 7 * ( size - 1 ) ) ) & 0x7f ; if ( -- size > 0 ) * p |= 0x80 ; p ++ ; } } for ( int i = 0 ; i < 3 ; i ++ ) { memcpy ( p , packet [ i ] , packet_size [ i ] ) ; p += packet_size [ i ] ; } return VLC_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bug47485 ( ) { MYSQL_STMT * stmt ; MYSQL_RES * res ; MYSQL_BIND bind [ 2 ] ; int rc ; const char * sql_select = "SELECT 1, 'a'" ; int int_data ; char str_data [ 16 ] ; my_bool is_null [ 2 ] ; my_bool error [ 2 ] ; unsigned long length [ 2 ] ; DBUG_ENTER ( "test_bug47485" ) ; myheader ( "test_bug47485" ) ; stmt = mysql_stmt_init ( mysql ) ; check_stmt ( stmt ) ; rc = mysql_stmt_prepare ( stmt , sql_select , strlen ( sql_select ) ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; res = mysql_store_result ( mysql ) ; DIE_UNLESS ( res == NULL ) ; mysql_stmt_reset ( stmt ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; res = mysql_use_result ( mysql ) ; DIE_UNLESS ( res == NULL ) ; mysql_stmt_reset ( stmt ) ; memset ( bind , 0 , sizeof ( bind ) ) ; bind [ 0 ] . buffer_type = MYSQL_TYPE_LONG ; bind [ 0 ] . buffer = ( char * ) & int_data ; bind [ 0 ] . is_null = & is_null [ 0 ] ; bind [ 0 ] . length = & length [ 0 ] ; bind [ 0 ] . error = & error [ 0 ] ; bind [ 1 ] . buffer_type = MYSQL_TYPE_STRING ; bind [ 1 ] . buffer = ( char * ) str_data ; bind [ 1 ] . buffer_length = sizeof ( str_data ) ; bind [ 1 ] . is_null = & is_null [ 1 ] ; bind [ 1 ] . length = & length [ 1 ] ; bind [ 1 ] . error = & error [ 1 ] ; rc = mysql_stmt_bind_result ( stmt , bind ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_store_result ( stmt ) ; check_execute ( stmt , rc ) ; while ( ! ( rc = mysql_stmt_fetch ( stmt ) ) ) ; DIE_UNLESS ( rc == MYSQL_NO_DATA ) ; mysql_stmt_reset ( stmt ) ; memset ( bind , 0 , sizeof ( bind ) ) ; bind [ 0 ] . buffer_type = MYSQL_TYPE_LONG ; bind [ 0 ] . buffer = ( char * ) & int_data ; bind [ 0 ] . is_null = & is_null [ 0 ] ; bind [ 0 ] . length = & length [ 0 ] ; bind [ 0 ] . error = & error [ 0 ] ; bind [ 1 ] . buffer_type = MYSQL_TYPE_STRING ; bind [ 1 ] . buffer = ( char * ) str_data ; bind [ 1 ] . buffer_length = sizeof ( str_data ) ; bind [ 1 ] . is_null = & is_null [ 1 ] ; bind [ 1 ] . length = & length [ 1 ] ; bind [ 1 ] . error = & error [ 1 ] ; rc = mysql_stmt_bind_result ( stmt , bind ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; while ( ! ( rc = mysql_stmt_fetch ( stmt ) ) ) ; DIE_UNLESS ( rc == MYSQL_NO_DATA ) ; mysql_stmt_close ( stmt ) ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void gx_ttfReader__set_font ( gx_ttfReader * self , gs_font_type42 * pfont ) { self -> pfont = pfont ; self -> super . get_metrics = gx_ttfReader__default_get_metrics ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
GType hb_gobject_ ## name ## _get_type ( void ) \ { static gsize type_id = 0 ; if ( g_once_init_enter ( & type_id ) ) { GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ; g_once_init_leave ( & type_id , id ) ; } return type_id ; \ } # define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ; HB_DEFINE_OBJECT_TYPE ( buffer ) HB_DEFINE_OBJECT_TYPE ( blob ) HB_DEFINE_OBJECT_TYPE ( face ) HB_DEFINE_OBJECT_TYPE ( font ) HB_DEFINE_OBJECT_TYPE ( font_funcs ) HB_DEFINE_OBJECT_TYPE ( set ) HB_DEFINE_OBJECT_TYPE ( shape_plan ) HB_DEFINE_OBJECT_TYPE ( unicode_funcs ) static hb_feature_t * feature_reference ( hb_feature_t * g ) { hb_feature_t * c = ( hb_feature_t * ) calloc ( 1 , sizeof ( hb_feature_t ) ) ; if ( unlikely ( ! c ) ) return NULL ; * c = * g ; return c ; } static void feature_destroy ( hb_feature_t * g ) { free ( g ) ; } HB_DEFINE_BOXED_TYPE ( feature , feature_reference , feature_destroy ) static hb_glyph_info_t * glyph_info_reference ( hb_glyph_info_t * g ) { hb_glyph_info_t * c = ( hb_glyph_info_t * ) calloc ( 1 , sizeof ( hb_glyph_info_t ) ) ; if ( unlikely ( ! c ) ) return NULL ; * c = * g ; return c ; } static void glyph_info_destroy ( hb_glyph_info_t * g ) { free ( g ) ; } HB_DEFINE_BOXED_TYPE ( glyph_info , glyph_info_reference , glyph_info_destroy ) static hb_glyph_position_t * glyph_position_reference ( hb_glyph_position_t * g ) { hb_glyph_position_t * c = ( hb_glyph_position_t * ) calloc ( 1 , sizeof ( hb_glyph_position_t ) ) ; if ( unlikely ( ! c ) ) return NULL ; * c = * g ; return c ; } static void glyph_position_destroy ( hb_glyph_position_t * g ) { free ( g ) ; } HB_DEFINE_BOXED_TYPE ( glyph_position , glyph_position_reference , glyph_position_destroy )
1True
Categorize the following code snippet as vulnerable or not. True or False
static int libschroedinger_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; int64_t pts = avpkt -> pts ; SchroTag * tag ; SchroDecoderParams * p_schro_params = avctx -> priv_data ; SchroDecoder * decoder = p_schro_params -> decoder ; SchroBuffer * enc_buf ; SchroFrame * frame ; int state ; int go = 1 ; int outer = 1 ; SchroParseUnitContext parse_ctx ; LibSchroFrameContext * framewithpts = NULL ; * got_frame = 0 ; parse_context_init ( & parse_ctx , buf , buf_size ) ; if ( ! buf_size ) { if ( ! p_schro_params -> eos_signalled ) { state = schro_decoder_push_end_of_stream ( decoder ) ; p_schro_params -> eos_signalled = 1 ; } } do { if ( ( enc_buf = find_next_parse_unit ( & parse_ctx ) ) ) { enc_buf -> tag = schro_tag_new ( av_malloc ( sizeof ( int64_t ) ) , av_free ) ; if ( ! enc_buf -> tag -> value ) { av_log ( avctx , AV_LOG_ERROR , "Unable to allocate SchroTag\n" ) ; return AVERROR ( ENOMEM ) ; } AV_WN ( 64 , enc_buf -> tag -> value , pts ) ; if ( SCHRO_PARSE_CODE_IS_PICTURE ( enc_buf -> data [ 4 ] ) && SCHRO_PARSE_CODE_NUM_REFS ( enc_buf -> data [ 4 ] ) > 0 ) avctx -> has_b_frames = 1 ; state = schro_decoder_push ( decoder , enc_buf ) ; if ( state == SCHRO_DECODER_FIRST_ACCESS_UNIT ) libschroedinger_handle_first_access_unit ( avctx ) ; go = 1 ; } else outer = 0 ; while ( go ) { state = schro_decoder_wait ( decoder ) ; switch ( state ) { case SCHRO_DECODER_FIRST_ACCESS_UNIT : libschroedinger_handle_first_access_unit ( avctx ) ; break ; case SCHRO_DECODER_NEED_BITS : go = 0 ; break ; case SCHRO_DECODER_NEED_FRAME : frame = ff_create_schro_frame ( avctx , p_schro_params -> frame_format ) ; schro_decoder_add_output_picture ( decoder , frame ) ; break ; case SCHRO_DECODER_OK : tag = schro_decoder_get_picture_tag ( decoder ) ; frame = schro_decoder_pull ( decoder ) ; if ( frame ) { framewithpts = av_malloc ( sizeof ( LibSchroFrameContext ) ) ; if ( ! framewithpts ) { av_log ( avctx , AV_LOG_ERROR , "Unable to allocate FrameWithPts\n" ) ; return AVERROR ( ENOMEM ) ; } framewithpts -> frame = frame ; framewithpts -> pts = AV_RN64 ( tag -> value ) ; ff_schro_queue_push_back ( & p_schro_params -> dec_frame_queue , framewithpts ) ; } break ; case SCHRO_DECODER_EOS : go = 0 ; p_schro_params -> eos_pulled = 1 ; schro_decoder_reset ( decoder ) ; outer = 0 ; break ; case SCHRO_DECODER_ERROR : return - 1 ; break ; } } } while ( outer ) ; framewithpts = ff_schro_queue_pop ( & p_schro_params -> dec_frame_queue ) ; if ( framewithpts && framewithpts -> frame ) { if ( p_schro_params -> dec_frame . data [ 0 ] ) avctx -> release_buffer ( avctx , & p_schro_params -> dec_frame ) ; if ( ff_get_buffer ( avctx , & p_schro_params -> dec_frame ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "Unable to allocate buffer\n" ) ; return AVERROR ( ENOMEM ) ; } memcpy ( p_schro_params -> dec_frame . data [ 0 ] , framewithpts -> frame -> components [ 0 ] . data , framewithpts -> frame -> components [ 0 ] . length ) ; memcpy ( p_schro_params -> dec_frame . data [ 1 ] , framewithpts -> frame -> components [ 1 ] . data , framewithpts -> frame -> components [ 1 ] . length ) ; memcpy ( p_schro_params -> dec_frame . data [ 2 ] , framewithpts -> frame -> components [ 2 ] . data , framewithpts -> frame -> components [ 2 ] . length ) ; p_schro_params -> dec_frame . format = - 1 ; p_schro_params -> dec_frame . width = framewithpts -> frame -> width ; p_schro_params -> dec_frame . height = framewithpts -> frame -> height ; p_schro_params -> dec_frame . pkt_pts = framewithpts -> pts ; p_schro_params -> dec_frame . linesize [ 0 ] = framewithpts -> frame -> components [ 0 ] . stride ; p_schro_params -> dec_frame . linesize [ 1 ] = framewithpts -> frame -> components [ 1 ] . stride ; p_schro_params -> dec_frame . linesize [ 2 ] = framewithpts -> frame -> components [ 2 ] . stride ; * ( AVFrame * ) data = p_schro_params -> dec_frame ; * got_frame = 1 ; libschroedinger_decode_frame_free ( framewithpts -> frame ) ; av_free ( framewithpts ) ; } else { data = NULL ; * got_frame = 0 ; } return buf_size ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void dca_exss_skip_mix_coeffs ( GetBitContext * gb , int channels , int out_ch ) { int i ; for ( i = 0 ; i < channels ; i ++ ) { int mix_map_mask = get_bits ( gb , out_ch ) ; int num_coeffs = av_popcount ( mix_map_mask ) ; skip_bits_long ( gb , num_coeffs * 6 ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void spl_filesystem_object_free_storage ( void * object TSRMLS_DC ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) object ; if ( intern -> oth_handler && intern -> oth_handler -> dtor ) { intern -> oth_handler -> dtor ( intern TSRMLS_CC ) ; } zend_object_std_dtor ( & intern -> std TSRMLS_CC ) ; if ( intern -> _path ) { efree ( intern -> _path ) ; } if ( intern -> file_name ) { efree ( intern -> file_name ) ; } switch ( intern -> type ) { case SPL_FS_INFO : break ; case SPL_FS_DIR : if ( intern -> u . dir . dirp ) { php_stream_close ( intern -> u . dir . dirp ) ; intern -> u . dir . dirp = NULL ; } if ( intern -> u . dir . sub_path ) { efree ( intern -> u . dir . sub_path ) ; } break ; case SPL_FS_FILE : if ( intern -> u . file . stream ) { if ( intern -> u . file . zcontext ) { } if ( ! intern -> u . file . stream -> is_persistent ) { php_stream_free ( intern -> u . file . stream , PHP_STREAM_FREE_CLOSE ) ; } else { php_stream_free ( intern -> u . file . stream , PHP_STREAM_FREE_CLOSE_PERSISTENT ) ; } if ( intern -> u . file . open_mode ) { efree ( intern -> u . file . open_mode ) ; } if ( intern -> orig_path ) { efree ( intern -> orig_path ) ; } } spl_filesystem_file_free_line ( intern TSRMLS_CC ) ; break ; } { zend_object_iterator * iterator ; iterator = ( zend_object_iterator * ) spl_filesystem_object_to_iterator ( intern ) ; if ( iterator -> data != NULL ) { iterator -> data = NULL ; iterator -> funcs -> dtor ( iterator TSRMLS_CC ) ; } } efree ( object ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dict_real_result ( i_ctx_t * i_ctx_p , ref * pdict , const char * kstr , double val ) { int code = 0 ; ref * ignore ; if ( dict_find_string ( pdict , kstr , & ignore ) > 0 ) { ref rval ; check_dict_write ( * pdict ) ; make_real ( & rval , val ) ; code = idict_put_string ( pdict , kstr , & rval ) ; } return code ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int jbig2_decode_halftone_region ( Jbig2Ctx * ctx , Jbig2Segment * segment , Jbig2HalftoneRegionParams * params , const byte * data , const size_t size , Jbig2Image * image , Jbig2ArithCx * GB_stats ) { uint32_t HBPP ; uint32_t HNUMPATS ; uint8_t * * GI ; Jbig2Image * HSKIP = NULL ; Jbig2PatternDict * HPATS ; uint32_t i ; uint32_t mg , ng ; int32_t x , y ; uint8_t gray_val ; memset ( image -> data , params -> HDEFPIXEL , image -> stride * image -> height ) ; if ( params -> HENABLESKIP == 1 ) { jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "unhandled option HENABLESKIP" ) ; } HPATS = jbig2_decode_ht_region_get_hpats ( ctx , segment ) ; if ( ! HPATS ) { jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "no pattern dictionary found, skipping halftone image" ) ; return - 1 ; } HNUMPATS = HPATS -> n_patterns ; HBPP = 0 ; while ( HNUMPATS > ( 1U << ++ HBPP ) ) ; GI = jbig2_decode_gray_scale_image ( ctx , segment , data , size , params -> HMMR , params -> HGW , params -> HGH , HBPP , params -> HENABLESKIP , HSKIP , params -> HTEMPLATE , GB_stats ) ; if ( ! GI ) { jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "unable to acquire gray-scale image, skipping halftone image" ) ; return - 1 ; } for ( mg = 0 ; mg < params -> HGH ; ++ mg ) { for ( ng = 0 ; ng < params -> HGW ; ++ ng ) { x = ( params -> HGX + mg * params -> HRY + ng * params -> HRX ) >> 8 ; y = ( params -> HGY + mg * params -> HRX - ng * params -> HRY ) >> 8 ; gray_val = GI [ ng ] [ mg ] ; if ( gray_val >= HNUMPATS ) { jbig2_error ( ctx , JBIG2_SEVERITY_WARNING , segment -> number , "gray-scale image uses value %d which larger than pattern dictionary" , gray_val ) ; gray_val = HNUMPATS - 1 ; } jbig2_image_compose ( ctx , image , HPATS -> patterns [ gray_val ] , x , y , params -> op ) ; } } for ( i = 0 ; i < params -> HGW ; ++ i ) { jbig2_free ( ctx -> allocator , GI [ i ] ) ; } jbig2_free ( ctx -> allocator , GI ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void tgq_decode_block ( TgqContext * s , int16_t block [ 64 ] , GetBitContext * gb ) { uint8_t * perm = s -> scantable . permutated ; int i , j , value ; block [ 0 ] = get_sbits ( gb , 8 ) * s -> qtable [ 0 ] ; for ( i = 1 ; i < 64 ; ) { switch ( show_bits ( gb , 3 ) ) { case 4 : block [ perm [ i ++ ] ] = 0 ; case 0 : block [ perm [ i ++ ] ] = 0 ; skip_bits ( gb , 3 ) ; break ; case 5 : case 1 : skip_bits ( gb , 2 ) ; value = get_bits ( gb , 6 ) ; for ( j = 0 ; j < value ; j ++ ) block [ perm [ i ++ ] ] = 0 ; break ; case 6 : skip_bits ( gb , 3 ) ; block [ perm [ i ] ] = - s -> qtable [ perm [ i ] ] ; i ++ ; break ; case 2 : skip_bits ( gb , 3 ) ; block [ perm [ i ] ] = s -> qtable [ perm [ i ] ] ; i ++ ; break ; case 7 : case 3 : skip_bits ( gb , 2 ) ; if ( show_bits ( gb , 6 ) == 0x3F ) { skip_bits ( gb , 6 ) ; block [ perm [ i ] ] = get_sbits ( gb , 8 ) * s -> qtable [ perm [ i ] ] ; } else { block [ perm [ i ] ] = get_sbits ( gb , 6 ) * s -> qtable [ perm [ i ] ] ; } i ++ ; break ; } } block [ 0 ] += 128 << 4 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void selinux_file_free_security ( struct file * file ) { file_free_security ( file ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void * jas_realloc2 ( void * ptr , size_t num_elements , size_t element_size ) { size_t size ; if ( ! jas_safe_size_mul ( num_elements , element_size , & size ) ) { return 0 ; } return jas_realloc ( ptr , size ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean do_run_simple_dialog ( gpointer _data ) { RunSimpleDialogData * data = _data ; const char * button_title ; GtkWidget * dialog ; int result ; int response_id ; g_mutex_lock ( & data -> mutex ) ; dialog = gtk_message_dialog_new ( * data -> parent_window , 0 , data -> message_type , GTK_BUTTONS_NONE , NULL ) ; g_object_set ( dialog , "text" , data -> primary_text , "secondary-text" , data -> secondary_text , NULL ) ; for ( response_id = 0 ; data -> button_titles [ response_id ] != NULL ; response_id ++ ) { button_title = data -> button_titles [ response_id ] ; if ( ! data -> show_all && is_all_button_text ( button_title ) ) { continue ; } gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , button_title , response_id ) ; gtk_dialog_set_default_response ( GTK_DIALOG ( dialog ) , response_id ) ; } if ( data -> details_text ) { eel_gtk_message_dialog_set_details_label ( GTK_MESSAGE_DIALOG ( dialog ) , data -> details_text ) ; } result = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ; while ( ( result == GTK_RESPONSE_NONE || result == GTK_RESPONSE_DELETE_EVENT ) && data -> ignore_close_box ) { result = gtk_dialog_run ( GTK_DIALOG ( dialog ) ) ; } gtk_widget_destroy ( dialog ) ; data -> result = result ; data -> completed = TRUE ; g_cond_signal ( & data -> cond ) ; g_mutex_unlock ( & data -> mutex ) ; return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TemplateURLTest , SessionToken ) { TemplateURLData data ; search_terms_data_ . set_google_base_url ( "http://bar/" ) ; data . SetURL ( "http://bar/search?q={ searchTerms} &{ google:sessionToken} xssi=t" ) ; TemplateURL url ( data ) ; TemplateURLRef : : SearchTermsArgs search_terms_args ( ASCIIToUTF16 ( "foo" ) ) ; search_terms_args . session_token = "SESSIONTOKENGOESHERE" ; std : : string result = url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ; EXPECT_EQ ( "http://bar/search?q=foo&psi=SESSIONTOKENGOESHERE&xssi=t" , result ) ; TemplateURL url2 ( data ) ; search_terms_args . session_token = "" ; result = url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ; EXPECT_EQ ( "http://bar/search?q=foo&xssi=t" , result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplDoublyLinkedList , unshift ) { zval * value ; spl_dllist_object * intern ; if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "z" , & value ) == FAILURE ) { return ; } SEPARATE_ARG_IF_REF ( value ) ; intern = ( spl_dllist_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; spl_ptr_llist_unshift ( intern -> llist , value TSRMLS_CC ) ; RETURN_TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_printer_attributes ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) { guint32 attributes ; static const int * hf_attributes [ ] = { & hf_printer_attributes_published , & hf_printer_attributes_raw_only , & hf_printer_attributes_enable_bidi , & hf_printer_attributes_work_offline , & hf_printer_attributes_do_complete_first , & hf_printer_attributes_keep_printed_jobs , & hf_printer_attributes_enable_devq , & hf_printer_attributes_local , & hf_printer_attributes_hidden , & hf_printer_attributes_network , & hf_printer_attributes_shared , & hf_printer_attributes_default , & hf_printer_attributes_direct , & hf_printer_attributes_queued , NULL } ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , - 1 , & attributes ) ; proto_tree_add_bitmask_value_with_flags ( tree , tvb , offset - 4 , hf_printer_attributes , ett_printer_attributes , hf_attributes , attributes , BMT_NO_APPEND ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_priorities_cb ( int fd , short what , void * arg ) { struct test_pri_event * pri = arg ; struct timeval tv ; if ( pri -> count == 3 ) { event_loopexit ( NULL ) ; return ; } pri -> count ++ ; evutil_timerclear ( & tv ) ; event_add ( & pri -> ev , & tv ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * hfinfo_format_text ( const header_field_info * hfinfo , const guchar * string ) { switch ( hfinfo -> display ) { case STR_ASCII : return format_text ( string , strlen ( string ) ) ; case STR_UNICODE : return string ; } return format_text ( string , strlen ( string ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void jpc_qmfb_join_colgrp ( jpc_fix_t * a , int numrows , int stride , int parity ) { int bufsize = JPC_CEILDIVPOW2 ( numrows , 1 ) ; jpc_fix_t joinbuf [ QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE ] ; jpc_fix_t * buf = joinbuf ; jpc_fix_t * srcptr ; jpc_fix_t * dstptr ; register jpc_fix_t * srcptr2 ; register jpc_fix_t * dstptr2 ; register int n ; register int i ; int hstartcol ; if ( bufsize > QMFB_JOINBUFSIZE ) { if ( ! ( buf = jas_alloc3 ( bufsize , JPC_QMFB_COLGRPSIZE , sizeof ( jpc_fix_t ) ) ) ) { abort ( ) ; } } hstartcol = ( numrows + 1 - parity ) >> 1 ; n = hstartcol ; srcptr = & a [ 0 ] ; dstptr = buf ; while ( n -- > 0 ) { dstptr2 = dstptr ; srcptr2 = srcptr ; for ( i = 0 ; i < JPC_QMFB_COLGRPSIZE ; ++ i ) { * dstptr2 = * srcptr2 ; ++ dstptr2 ; ++ srcptr2 ; } srcptr += stride ; dstptr += JPC_QMFB_COLGRPSIZE ; } srcptr = & a [ hstartcol * stride ] ; dstptr = & a [ ( 1 - parity ) * stride ] ; n = numrows - hstartcol ; while ( n -- > 0 ) { dstptr2 = dstptr ; srcptr2 = srcptr ; for ( i = 0 ; i < JPC_QMFB_COLGRPSIZE ; ++ i ) { * dstptr2 = * srcptr2 ; ++ dstptr2 ; ++ srcptr2 ; } dstptr += 2 * stride ; srcptr += stride ; } srcptr = buf ; dstptr = & a [ parity * stride ] ; n = hstartcol ; while ( n -- > 0 ) { dstptr2 = dstptr ; srcptr2 = srcptr ; for ( i = 0 ; i < JPC_QMFB_COLGRPSIZE ; ++ i ) { * dstptr2 = * srcptr2 ; ++ dstptr2 ; ++ srcptr2 ; } dstptr += 2 * stride ; srcptr += JPC_QMFB_COLGRPSIZE ; } if ( buf != joinbuf ) { jas_free ( buf ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int spl_filesystem_file_read_csv ( spl_filesystem_object * intern , char delimiter , char enclosure , char escape , zval * return_value TSRMLS_DC ) { int ret = SUCCESS ; do { ret = spl_filesystem_file_read ( intern , 1 TSRMLS_CC ) ; } while ( ret == SUCCESS && ! intern -> u . file . current_line_len && SPL_HAS_FLAG ( intern -> flags , SPL_FILE_OBJECT_SKIP_EMPTY ) ) ; if ( ret == SUCCESS ) { size_t buf_len = intern -> u . file . current_line_len ; char * buf = estrndup ( intern -> u . file . current_line , buf_len ) ; if ( intern -> u . file . current_zval ) { zval_ptr_dtor ( & intern -> u . file . current_zval ) ; } ALLOC_INIT_ZVAL ( intern -> u . file . current_zval ) ; php_fgetcsv ( intern -> u . file . stream , delimiter , enclosure , escape , buf_len , buf , intern -> u . file . current_zval TSRMLS_CC ) ; if ( return_value ) { if ( Z_TYPE_P ( return_value ) != IS_NULL ) { zval_dtor ( return_value ) ; ZVAL_NULL ( return_value ) ; } ZVAL_ZVAL ( return_value , intern -> u . file . current_zval , 1 , 0 ) ; } } return ret ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
tvbuff_t * tvb_uncompress ( tvbuff_t * tvb _U_ , const int offset _U_ , int comprlen _U_ ) { return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void U_CALLCONV _UTF16LEToUnicodeWithOffsets ( UConverterToUnicodeArgs * pArgs , UErrorCode * pErrorCode ) { UConverter * cnv ; const uint8_t * source ; UChar * target ; int32_t * offsets ; uint32_t targetCapacity , length , count , sourceIndex ; UChar c , trail ; if ( pArgs -> converter -> mode < 8 ) { _UTF16ToUnicodeWithOffsets ( pArgs , pErrorCode ) ; return ; } cnv = pArgs -> converter ; source = ( const uint8_t * ) pArgs -> source ; length = ( int32_t ) ( ( const uint8_t * ) pArgs -> sourceLimit - source ) ; if ( length <= 0 && cnv -> toUnicodeStatus == 0 ) { return ; } target = pArgs -> target ; if ( target >= pArgs -> targetLimit ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; return ; } targetCapacity = ( uint32_t ) ( pArgs -> targetLimit - pArgs -> target ) ; offsets = pArgs -> offsets ; sourceIndex = 0 ; c = 0 ; if ( cnv -> toUnicodeStatus != 0 ) { cnv -> toUBytes [ 0 ] = ( uint8_t ) cnv -> toUnicodeStatus ; cnv -> toULength = 1 ; cnv -> toUnicodeStatus = 0 ; } if ( ( count = cnv -> toULength ) != 0 ) { uint8_t * p = cnv -> toUBytes ; do { p [ count ++ ] = * source ++ ; ++ sourceIndex ; -- length ; if ( count == 2 ) { c = ( ( UChar ) p [ 1 ] << 8 ) | p [ 0 ] ; if ( U16_IS_SINGLE ( c ) ) { * target ++ = c ; if ( offsets != NULL ) { * offsets ++ = - 1 ; } -- targetCapacity ; count = 0 ; c = 0 ; break ; } else if ( U16_IS_SURROGATE_LEAD ( c ) ) { c = 0 ; } else { break ; } } else if ( count == 4 ) { c = ( ( UChar ) p [ 1 ] << 8 ) | p [ 0 ] ; trail = ( ( UChar ) p [ 3 ] << 8 ) | p [ 2 ] ; if ( U16_IS_TRAIL ( trail ) ) { * target ++ = c ; if ( targetCapacity >= 2 ) { * target ++ = trail ; if ( offsets != NULL ) { * offsets ++ = - 1 ; * offsets ++ = - 1 ; } targetCapacity -= 2 ; } else { targetCapacity = 0 ; cnv -> UCharErrorBuffer [ 0 ] = trail ; cnv -> UCharErrorBufferLength = 1 ; * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } count = 0 ; c = 0 ; break ; } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; if ( ( ( const uint8_t * ) pArgs -> source - source ) >= 2 ) { source -= 2 ; } else { cnv -> toUnicodeStatus = 0x100 | p [ 2 ] ; -- source ; } cnv -> toULength = 2 ; pArgs -> source = ( const char * ) source ; pArgs -> target = target ; pArgs -> offsets = offsets ; return ; } } } while ( length > 0 ) ; cnv -> toULength = ( int8_t ) count ; } count = 2 * targetCapacity ; if ( count > length ) { count = length & ~ 1 ; } if ( c == 0 && count > 0 ) { length -= count ; count >>= 1 ; targetCapacity -= count ; if ( offsets == NULL ) { do { c = ( ( UChar ) source [ 1 ] << 8 ) | source [ 0 ] ; source += 2 ; if ( U16_IS_SINGLE ( c ) ) { * target ++ = c ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = ( ( UChar ) source [ 1 ] << 8 ) | source [ 0 ] ) ) { source += 2 ; -- count ; * target ++ = c ; * target ++ = trail ; } else { break ; } } while ( -- count > 0 ) ; } else { do { c = ( ( UChar ) source [ 1 ] << 8 ) | source [ 0 ] ; source += 2 ; if ( U16_IS_SINGLE ( c ) ) { * target ++ = c ; * offsets ++ = sourceIndex ; sourceIndex += 2 ; } else if ( U16_IS_SURROGATE_LEAD ( c ) && count >= 2 && U16_IS_TRAIL ( trail = ( ( UChar ) source [ 1 ] << 8 ) | source [ 0 ] ) ) { source += 2 ; -- count ; * target ++ = c ; * target ++ = trail ; * offsets ++ = sourceIndex ; * offsets ++ = sourceIndex ; sourceIndex += 4 ; } else { break ; } } while ( -- count > 0 ) ; } if ( count == 0 ) { c = 0 ; } else { length += 2 * ( count - 1 ) ; targetCapacity += count ; } } if ( c != 0 ) { cnv -> toUBytes [ 0 ] = ( uint8_t ) c ; cnv -> toUBytes [ 1 ] = ( uint8_t ) ( c >> 8 ) ; cnv -> toULength = 2 ; if ( U16_IS_SURROGATE_LEAD ( c ) ) { if ( length >= 2 ) { if ( U16_IS_TRAIL ( trail = ( ( UChar ) source [ 1 ] << 8 ) | source [ 0 ] ) ) { source += 2 ; length -= 2 ; * target ++ = c ; if ( offsets != NULL ) { * offsets ++ = sourceIndex ; } cnv -> UCharErrorBuffer [ 0 ] = trail ; cnv -> UCharErrorBufferLength = 1 ; cnv -> toULength = 0 ; * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } } else { } } else { * pErrorCode = U_ILLEGAL_CHAR_FOUND ; } } if ( U_SUCCESS ( * pErrorCode ) ) { if ( length > 0 ) { if ( targetCapacity == 0 ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } else { cnv -> toUBytes [ cnv -> toULength ++ ] = * source ++ ; } } } pArgs -> source = ( const char * ) source ; pArgs -> target = target ; pArgs -> offsets = offsets ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dumptype42 ( FILE * type42 , struct alltabs * at , enum fontformat format ) { FILE * temp = tmpfile ( ) ; struct hexout hexout ; int i , length ; dumpttf ( temp , at ) ; rewind ( temp ) ; hexout . type42 = type42 ; hexout . bytesout = 0 ; qsort ( at -> tabdir . ordered , at -> tabdir . numtab , sizeof ( struct taboff * ) , tcomp2 ) ; dumphex ( & hexout , temp , at -> tabdir . ordered [ 0 ] -> offset ) ; for ( i = 0 ; i < at -> tabdir . numtab ; ++ i ) { if ( at -> tabdir . ordered [ i ] -> length > 65534 && at -> tabdir . ordered [ i ] -> tag == CHR ( 'g' , 'l' , 'y' , 'f' ) ) { uint32 last = 0 ; int j ; fseek ( temp , at -> tabdir . ordered [ i ] -> offset , SEEK_SET ) ; for ( j = 0 ; j < at -> maxp . numGlyphs ; ++ j ) { if ( at -> gi . loca [ j + 1 ] - last > 65534 ) { dumphex ( & hexout , temp , at -> gi . loca [ j ] - last ) ; last = at -> gi . loca [ j ] ; } } dumphex ( & hexout , temp , at -> gi . loca [ j ] - last ) ; } else { if ( i < at -> tabdir . numtab - 1 ) length = at -> tabdir . ordered [ i + 1 ] -> offset - at -> tabdir . ordered [ i ] -> offset ; else { fseek ( temp , 0 , SEEK_END ) ; length = ftell ( temp ) - at -> tabdir . ordered [ i ] -> offset ; } fseek ( temp , at -> tabdir . ordered [ i ] -> offset , SEEK_SET ) ; dumphex ( & hexout , temp , length ) ; } } fclose ( temp ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int fraps2_decode_plane ( FrapsContext * s , uint8_t * dst , int stride , int w , int h , const uint8_t * src , int size , int Uoff , const int step ) { int i , j , ret ; GetBitContext gb ; VLC vlc ; Node nodes [ 512 ] ; for ( i = 0 ; i < 256 ; i ++ ) nodes [ i ] . count = bytestream_get_le32 ( & src ) ; size -= 1024 ; if ( ( ret = ff_huff_build_tree ( s -> avctx , & vlc , 256 , nodes , huff_cmp , FF_HUFFMAN_FLAG_ZERO_COUNT ) ) < 0 ) return ret ; s -> dsp . bswap_buf ( ( uint32_t * ) s -> tmpbuf , ( const uint32_t * ) src , size >> 2 ) ; init_get_bits ( & gb , s -> tmpbuf , size * 8 ) ; for ( j = 0 ; j < h ; j ++ ) { for ( i = 0 ; i < w * step ; i += step ) { dst [ i ] = get_vlc2 ( & gb , vlc . table , 9 , 3 ) ; if ( j ) dst [ i ] += dst [ i - stride ] ; else if ( Uoff ) dst [ i ] += 0x80 ; if ( get_bits_left ( & gb ) < 0 ) { ff_free_vlc ( & vlc ) ; return AVERROR_INVALIDDATA ; } } dst += stride ; } ff_free_vlc ( & vlc ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void SetPixelIndex ( const Image * restrict image , const Quantum index , Quantum * restrict pixel ) { if ( image -> channel_map [ IndexPixelChannel ] . traits != UndefinedPixelTrait ) pixel [ image -> channel_map [ IndexPixelChannel ] . offset ] = index ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int remoteDecodeClientMessageHeader ( struct qemud_client_message * msg ) { XDR xdr ; int ret = - 1 ; msg -> bufferOffset = REMOTE_MESSAGE_HEADER_XDR_LEN ; xdrmem_create ( & xdr , msg -> buffer + msg -> bufferOffset , msg -> bufferLength - msg -> bufferOffset , XDR_DECODE ) ; if ( ! xdr_remote_message_header ( & xdr , & msg -> hdr ) ) goto cleanup ; msg -> bufferOffset += xdr_getpos ( & xdr ) ; ret = 0 ; cleanup : xdr_destroy ( & xdr ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileObject , getFlags ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; if ( zend_parse_parameters_none ( ) == FAILURE ) { return ; } RETURN_LONG ( intern -> flags & SPL_FILE_OBJECT_MASK ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void string_dealloc ( PyObject * op ) { switch ( PyString_CHECK_INTERNED ( op ) ) { case SSTATE_NOT_INTERNED : break ; case SSTATE_INTERNED_MORTAL : Py_REFCNT ( op ) = 3 ; if ( PyDict_DelItem ( interned , op ) != 0 ) Py_FatalError ( "deletion of interned string failed" ) ; break ; case SSTATE_INTERNED_IMMORTAL : Py_FatalError ( "Immortal interned string died." ) ; default : Py_FatalError ( "Inconsistent interned string state." ) ; } Py_TYPE ( op ) -> tp_free ( op ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static FILE * dumpsavedtable ( struct ttf_table * tab ) { FILE * out ; if ( tab == NULL ) return ( NULL ) ; out = tmpfile ( ) ; fwrite ( tab -> data , 1 , tab -> len , out ) ; if ( ( tab -> len & 1 ) ) putc ( '\0' , out ) ; if ( ( tab -> len + 1 ) & 2 ) putshort ( out , 0 ) ; return ( out ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void row_prop_write ( zval * object , zval * member , zval * value , const zend_literal * key TSRMLS_DC ) { php_error_docref ( NULL TSRMLS_CC , E_WARNING , "This PDORow is not from a writable result set" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void print_table_data_html ( MYSQL_RES * result ) { MYSQL_ROW cur ; MYSQL_FIELD * field ; mysql_field_seek ( result , 0 ) ; ( void ) tee_fputs ( "<TABLE BORDER=1><TR>" , PAGER ) ; if ( column_names ) { while ( ( field = mysql_fetch_field ( result ) ) ) { tee_fputs ( "<TH>" , PAGER ) ; if ( field -> name && field -> name [ 0 ] ) xmlencode_print ( field -> name , field -> name_length ) ; else tee_fputs ( field -> name ? " &nbsp; " : "NULL" , PAGER ) ; tee_fputs ( "</TH>" , PAGER ) ; } ( void ) tee_fputs ( "</TR>" , PAGER ) ; } while ( ( cur = mysql_fetch_row ( result ) ) ) { if ( interrupted_query ) break ; ulong * lengths = mysql_fetch_lengths ( result ) ; ( void ) tee_fputs ( "<TR>" , PAGER ) ; for ( uint i = 0 ; i < mysql_num_fields ( result ) ; i ++ ) { ( void ) tee_fputs ( "<TD>" , PAGER ) ; xmlencode_print ( cur [ i ] , lengths [ i ] ) ; ( void ) tee_fputs ( "</TD>" , PAGER ) ; } ( void ) tee_fputs ( "</TR>" , PAGER ) ; } ( void ) tee_fputs ( "</TABLE>" , PAGER ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int sunrast_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; const uint8_t * buf_end = avpkt -> data + avpkt -> size ; SUNRASTContext * const s = avctx -> priv_data ; AVFrame * picture = data ; AVFrame * const p = & s -> picture ; unsigned int w , h , depth , type , maptype , maplength , stride , x , y , len , alen ; uint8_t * ptr ; const uint8_t * bufstart = buf ; int ret ; if ( avpkt -> size < 32 ) return AVERROR_INVALIDDATA ; if ( AV_RB32 ( buf ) != RAS_MAGIC ) { av_log ( avctx , AV_LOG_ERROR , "this is not sunras encoded data\n" ) ; return AVERROR_INVALIDDATA ; } w = AV_RB32 ( buf + 4 ) ; h = AV_RB32 ( buf + 8 ) ; depth = AV_RB32 ( buf + 12 ) ; type = AV_RB32 ( buf + 20 ) ; maptype = AV_RB32 ( buf + 24 ) ; maplength = AV_RB32 ( buf + 28 ) ; buf += 32 ; if ( type == RT_FORMAT_TIFF || type == RT_FORMAT_IFF || type == RT_EXPERIMENTAL ) { av_log_ask_for_sample ( avctx , "unsupported (compression) type\n" ) ; return AVERROR_PATCHWELCOME ; } if ( type > RT_FORMAT_IFF ) { av_log ( avctx , AV_LOG_ERROR , "invalid (compression) type\n" ) ; return AVERROR_INVALIDDATA ; } if ( av_image_check_size ( w , h , 0 , avctx ) ) { av_log ( avctx , AV_LOG_ERROR , "invalid image size\n" ) ; return AVERROR_INVALIDDATA ; } if ( maptype == RMT_RAW ) { av_log_ask_for_sample ( avctx , "unsupported colormap type\n" ) ; return AVERROR_PATCHWELCOME ; } if ( maptype > RMT_RAW ) { av_log ( avctx , AV_LOG_ERROR , "invalid colormap type\n" ) ; return AVERROR_INVALIDDATA ; } switch ( depth ) { case 1 : avctx -> pix_fmt = AV_PIX_FMT_MONOWHITE ; break ; case 8 : avctx -> pix_fmt = maplength ? AV_PIX_FMT_PAL8 : AV_PIX_FMT_GRAY8 ; break ; case 24 : avctx -> pix_fmt = ( type == RT_FORMAT_RGB ) ? AV_PIX_FMT_RGB24 : AV_PIX_FMT_BGR24 ; break ; default : av_log ( avctx , AV_LOG_ERROR , "invalid depth\n" ) ; return AVERROR_INVALIDDATA ; } if ( p -> data [ 0 ] ) avctx -> release_buffer ( avctx , p ) ; if ( w != avctx -> width || h != avctx -> height ) avcodec_set_dimensions ( avctx , w , h ) ; if ( ( ret = ff_get_buffer ( avctx , p ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } p -> pict_type = AV_PICTURE_TYPE_I ; if ( buf_end - buf < maplength ) return AVERROR_INVALIDDATA ; if ( depth != 8 && maplength ) { av_log ( avctx , AV_LOG_WARNING , "useless colormap found or file is corrupted, trying to recover\n" ) ; } else if ( maplength ) { unsigned int len = maplength / 3 ; if ( maplength % 3 || maplength > 768 ) { av_log ( avctx , AV_LOG_WARNING , "invalid colormap length\n" ) ; return AVERROR_INVALIDDATA ; } ptr = p -> data [ 1 ] ; for ( x = 0 ; x < len ; x ++ , ptr += 4 ) * ( uint32_t * ) ptr = ( buf [ x ] << 16 ) + ( buf [ len + x ] << 8 ) + buf [ len + len + x ] ; } buf += maplength ; ptr = p -> data [ 0 ] ; stride = p -> linesize [ 0 ] ; len = ( depth * w + 7 ) >> 3 ; alen = len + ( len & 1 ) ; if ( type == RT_BYTE_ENCODED ) { int value , run ; uint8_t * end = ptr + h * stride ; x = 0 ; while ( ptr != end && buf < buf_end ) { run = 1 ; if ( buf_end - buf < 1 ) return AVERROR_INVALIDDATA ; if ( ( value = * buf ++ ) == RLE_TRIGGER ) { run = * buf ++ + 1 ; if ( run != 1 ) value = * buf ++ ; } while ( run -- ) { if ( x < len ) ptr [ x ] = value ; if ( ++ x >= alen ) { x = 0 ; ptr += stride ; if ( ptr == end ) break ; } } } } else { for ( y = 0 ; y < h ; y ++ ) { if ( buf_end - buf < len ) break ; memcpy ( ptr , buf , len ) ; ptr += stride ; buf += alen ; } } * picture = s -> picture ; * got_frame = 1 ; return buf - bufstart ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void handle_a_request ( int dns_fd , struct query * q , int fakeip ) { char buf [ 64 * 1024 ] ; int len ; if ( fakeip ) { in_addr_t ip = inet_addr ( "127.0.0.1" ) ; memcpy ( & q -> destination . s_addr , & ip , sizeof ( in_addr_t ) ) ; } else if ( ns_ip != INADDR_ANY ) { memcpy ( & q -> destination . s_addr , & ns_ip , sizeof ( in_addr_t ) ) ; } len = dns_encode_a_response ( buf , sizeof ( buf ) , q ) ; if ( len < 1 ) { warnx ( "dns_encode_a_response doesn't fit" ) ; return ; } if ( debug >= 2 ) { fprintf ( stderr , "TX: client %s, type %d, name %s, %d bytes A reply\n" , format_addr ( & q -> from , q -> fromlen ) , q -> type , q -> name , len ) ; } if ( sendto ( dns_fd , buf , len , 0 , ( struct sockaddr * ) & q -> from , q -> fromlen ) <= 0 ) { warn ( "a reply send error" ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline int __ipv6_addr_diff ( const void * token1 , const void * token2 , int addrlen ) { const __be32 * a1 = token1 , * a2 = token2 ; int i ; addrlen >>= 2 ; for ( i = 0 ; i < addrlen ; i ++ ) { __be32 xb = a1 [ i ] ^ a2 [ i ] ; if ( xb ) return i * 32 + 31 - __fls ( ntohl ( xb ) ) ; } return addrlen << 5 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void decoder_DeletePicture ( decoder_t * p_decoder , picture_t * p_picture ) { p_decoder -> pf_vout_buffer_del ( p_decoder , p_picture ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void traverse_commit_list ( struct rev_info * revs , show_commit_fn show_commit , show_object_fn show_object , void * data ) { int i ; struct commit * commit ; struct strbuf base ; strbuf_init ( & base , PATH_MAX ) ; while ( ( commit = get_revision ( revs ) ) != NULL ) { if ( commit -> tree ) add_pending_tree ( revs , commit -> tree ) ; show_commit ( commit , data ) ; } for ( i = 0 ; i < revs -> pending . nr ; i ++ ) { struct object_array_entry * pending = revs -> pending . objects + i ; struct object * obj = pending -> item ; const char * name = pending -> name ; const char * path = pending -> path ; if ( obj -> flags & ( UNINTERESTING | SEEN ) ) continue ; if ( obj -> type == OBJ_TAG ) { obj -> flags |= SEEN ; show_object ( obj , NULL , name , data ) ; continue ; } if ( ! path ) path = "" ; if ( obj -> type == OBJ_TREE ) { process_tree ( revs , ( struct tree * ) obj , show_object , NULL , & base , path , data ) ; continue ; } if ( obj -> type == OBJ_BLOB ) { process_blob ( revs , ( struct blob * ) obj , show_object , NULL , path , data ) ; continue ; } die ( "unknown pending object %s (%s)" , oid_to_hex ( & obj -> oid ) , name ) ; } object_array_clear ( & revs -> pending ) ; strbuf_release ( & base ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_rsvp_link_cap ( proto_item * ti , packet_info * pinfo , proto_tree * rsvp_object_tree , tvbuff_t * tvb , int offset , int obj_length , int rsvp_class , int type ) { proto_item_set_text ( ti , "LINK CAPABILITY: " ) ; switch ( type ) { case 1 : proto_tree_add_uint ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type ) ; dissect_rsvp_ero_rro_subobjects ( ti , pinfo , rsvp_object_tree , tvb , offset + 4 , obj_length , rsvp_class ) ; break ; default : proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "Unknown (%u)" , type ) ; proto_tree_add_item ( rsvp_object_tree , hf_rsvp_record_route_data , tvb , offset + 4 , obj_length - 4 , ENC_NA ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint64_t cirrus_linear_read ( void * opaque , hwaddr addr , unsigned size ) { CirrusVGAState * s = opaque ; uint32_t ret ; addr &= s -> cirrus_addr_mask ; if ( ( ( s -> vga . sr [ 0x17 ] & 0x44 ) == 0x44 ) && ( ( addr & s -> linear_mmio_mask ) == s -> linear_mmio_mask ) ) { ret = cirrus_mmio_blt_read ( s , addr & 0xff ) ; } else if ( 0 ) { ret = 0xff ; } else { if ( ( s -> vga . gr [ 0x0B ] & 0x14 ) == 0x14 ) { addr <<= 4 ; } else if ( s -> vga . gr [ 0x0B ] & 0x02 ) { addr <<= 3 ; } addr &= s -> cirrus_addr_mask ; ret = * ( s -> vga . vram_ptr + addr ) ; } return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_PRINTER_INFO_2 ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) { guint32 devmode_offset , secdesc_offset ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_servername , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_printername , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_sharename , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_portname , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_drivername , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_printercomment , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_printerlocation , 0 , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_offset , & devmode_offset ) ; dissect_DEVMODE ( tvb , devmode_offset - 4 , pinfo , tree , di , drep ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_sepfile , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_printprocessor , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_datatype , 0 , NULL ) ; offset = dissect_spoolss_relstr ( tvb , offset , pinfo , tree , di , drep , hf_parameters , 0 , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_offset , & secdesc_offset ) ; dissect_nt_sec_desc ( tvb , secdesc_offset , pinfo , tree , drep , FALSE , - 1 , & spoolss_printer_access_mask_info ) ; offset = dissect_printer_attributes ( tvb , offset , pinfo , tree , di , drep ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_printer_priority , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_printer_default_priority , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_start_time , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_end_time , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_printer_status , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_printer_jobs , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , NULL , di , drep , hf_printer_averageppm , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const vpx_codec_cx_pkt_t * vpx_codec_pkt_list_get ( struct vpx_codec_pkt_list * list , vpx_codec_iter_t * iter ) { const vpx_codec_cx_pkt_t * pkt ; if ( ! ( * iter ) ) { * iter = list -> pkts ; } pkt = ( const vpx_codec_cx_pkt_t * ) * iter ; if ( ( size_t ) ( pkt - list -> pkts ) < list -> cnt ) * iter = pkt + 1 ; else pkt = NULL ; return pkt ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ioescapeloop ( IO * wrapper ) { _IO * io = wrapper -> top , * iop ; int wasloop ; while ( io -> prev != NULL && ! io -> isstopped ) { iop = io -> prev ; wasloop = io -> isloop ; if ( io -> start != NULL ) free ( io -> start ) ; io -> start = NULL ; free ( io ) ; if ( wasloop ) { wrapper -> top = iop ; return ; } io = iop ; } LogError ( _ ( "Use of \"exit\" when not in a loop\n" ) ) ; wrapper -> top = io ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
lcc_network_buffer_t * lcc_network_buffer_create ( size_t size ) { lcc_network_buffer_t * nb ; if ( size == 0 ) size = LCC_NETWORK_BUFFER_SIZE_DEFAULT ; if ( size < 128 ) { errno = EINVAL ; return ( NULL ) ; } nb = malloc ( sizeof ( * nb ) ) ; if ( nb == NULL ) return ( NULL ) ; memset ( nb , 0 , sizeof ( * nb ) ) ; nb -> size = size ; nb -> buffer = malloc ( nb -> size ) ; if ( nb -> buffer == NULL ) { free ( nb ) ; return ( NULL ) ; } memset ( nb -> buffer , 0 , nb -> size ) ; nb -> ptr = nb -> buffer ; nb -> free = nb -> size ; nb -> seclevel = NONE ; nb -> username = NULL ; nb -> password = NULL ; return ( nb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void par_list_append ( TocEntry * l , TocEntry * te ) { te -> par_prev = l -> par_prev ; l -> par_prev -> par_next = te ; l -> par_prev = te ; te -> par_next = l ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
extern int name ( int , locale_t ) __THROW __exctype_l ( isalnum_l ) ; __exctype_l ( isalpha_l ) ; __exctype_l ( iscntrl_l ) ; __exctype_l ( isdigit_l ) ; __exctype_l ( islower_l ) ; __exctype_l ( isgraph_l ) ; __exctype_l ( isprint_l )
0False
Categorize the following code snippet as vulnerable or not. True or False
static uintmax_t parse_mark_ref_space ( const char * * p ) { uintmax_t mark ; char * end ; mark = parse_mark_ref ( * p , & end ) ; if ( * end ++ != ' ' ) die ( "Missing space after mark: %s" , command_buf . buf ) ; * p = end ; return mark ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { KmvcContext * const ctx = avctx -> priv_data ; uint8_t * out , * src ; int i , ret ; int header ; int blocksize ; const uint8_t * pal = av_packet_get_side_data ( avpkt , AV_PKT_DATA_PALETTE , NULL ) ; bytestream2_init ( & ctx -> g , avpkt -> data , avpkt -> size ) ; if ( ctx -> pic . data [ 0 ] ) avctx -> release_buffer ( avctx , & ctx -> pic ) ; ctx -> pic . reference = 1 ; ctx -> pic . buffer_hints = FF_BUFFER_HINTS_VALID ; if ( ( ret = ff_get_buffer ( avctx , & ctx -> pic ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } header = bytestream2_get_byte ( & ctx -> g ) ; if ( bytestream2_peek_byte ( & ctx -> g ) == 127 ) { bytestream2_skip ( & ctx -> g , 3 ) ; for ( i = 0 ; i < 127 ; i ++ ) { ctx -> pal [ i + ( header & 0x81 ) ] = bytestream2_get_be24 ( & ctx -> g ) ; bytestream2_skip ( & ctx -> g , 1 ) ; } bytestream2_seek ( & ctx -> g , - 127 * 4 - 3 , SEEK_CUR ) ; } if ( header & KMVC_KEYFRAME ) { ctx -> pic . key_frame = 1 ; ctx -> pic . pict_type = AV_PICTURE_TYPE_I ; } else { ctx -> pic . key_frame = 0 ; ctx -> pic . pict_type = AV_PICTURE_TYPE_P ; } if ( header & KMVC_PALETTE ) { ctx -> pic . palette_has_changed = 1 ; for ( i = 1 ; i <= ctx -> palsize ; i ++ ) { ctx -> pal [ i ] = bytestream2_get_be24 ( & ctx -> g ) ; } } if ( pal ) { ctx -> pic . palette_has_changed = 1 ; memcpy ( ctx -> pal , pal , AVPALETTE_SIZE ) ; } if ( ctx -> setpal ) { ctx -> setpal = 0 ; ctx -> pic . palette_has_changed = 1 ; } memcpy ( ctx -> pic . data [ 1 ] , ctx -> pal , 1024 ) ; blocksize = bytestream2_get_byte ( & ctx -> g ) ; if ( blocksize != 8 && blocksize != 127 ) { av_log ( avctx , AV_LOG_ERROR , "Block size = %i\n" , blocksize ) ; return AVERROR_INVALIDDATA ; } memset ( ctx -> cur , 0 , 320 * 200 ) ; switch ( header & KMVC_METHOD ) { case 0 : case 1 : memcpy ( ctx -> cur , ctx -> prev , 320 * 200 ) ; break ; case 3 : kmvc_decode_intra_8x8 ( ctx , avctx -> width , avctx -> height ) ; break ; case 4 : kmvc_decode_inter_8x8 ( ctx , avctx -> width , avctx -> height ) ; break ; default : av_log ( avctx , AV_LOG_ERROR , "Unknown compression method %i\n" , header & KMVC_METHOD ) ; return AVERROR_INVALIDDATA ; } out = ctx -> pic . data [ 0 ] ; src = ctx -> cur ; for ( i = 0 ; i < avctx -> height ; i ++ ) { memcpy ( out , src , avctx -> width ) ; src += 320 ; out += ctx -> pic . linesize [ 0 ] ; } if ( ctx -> cur == ctx -> frm0 ) { ctx -> cur = ctx -> frm1 ; ctx -> prev = ctx -> frm0 ; } else { ctx -> cur = ctx -> frm0 ; ctx -> prev = ctx -> frm1 ; } * got_frame = 1 ; * ( AVFrame * ) data = ctx -> pic ; return avpkt -> size ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int32_t doWriteForward ( const UChar * src , int32_t srcLength , UChar * dest , int32_t destSize , uint16_t options , UErrorCode * pErrorCode ) { switch ( options & ( UBIDI_REMOVE_BIDI_CONTROLS | UBIDI_DO_MIRRORING ) ) { case 0 : { int32_t length = srcLength ; if ( destSize < length ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; return srcLength ; } do { * dest ++ = * src ++ ; } while ( -- length > 0 ) ; return srcLength ; } case UBIDI_DO_MIRRORING : { int32_t i = 0 , j = 0 ; UChar32 c ; if ( destSize < srcLength ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; return srcLength ; } do { U16_NEXT ( src , i , srcLength , c ) ; c = u_charMirror ( c ) ; U16_APPEND_UNSAFE ( dest , j , c ) ; } while ( i < srcLength ) ; return srcLength ; } case UBIDI_REMOVE_BIDI_CONTROLS : { int32_t remaining = destSize ; UChar c ; do { c = * src ++ ; if ( ! IS_BIDI_CONTROL_CHAR ( c ) ) { if ( -- remaining < 0 ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; while ( -- srcLength > 0 ) { c = * src ++ ; if ( ! IS_BIDI_CONTROL_CHAR ( c ) ) { -- remaining ; } } return destSize - remaining ; } * dest ++ = c ; } } while ( -- srcLength > 0 ) ; return destSize - remaining ; } default : { int32_t remaining = destSize ; int32_t i , j = 0 ; UChar32 c ; do { i = 0 ; U16_NEXT ( src , i , srcLength , c ) ; src += i ; srcLength -= i ; if ( ! IS_BIDI_CONTROL_CHAR ( c ) ) { remaining -= i ; if ( remaining < 0 ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; while ( srcLength > 0 ) { c = * src ++ ; if ( ! IS_BIDI_CONTROL_CHAR ( c ) ) { -- remaining ; } -- srcLength ; } return destSize - remaining ; } c = u_charMirror ( c ) ; U16_APPEND_UNSAFE ( dest , j , c ) ; } } while ( srcLength > 0 ) ; return j ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int virLogDefineOutputs ( virLogOutputPtr * outputs , size_t noutputs ) { # if HAVE_SYSLOG_H int id ; char * tmp = NULL ; # endif if ( virLogInitialize ( ) < 0 ) return - 1 ; virLogLock ( ) ; virLogResetOutputs ( ) ; # if HAVE_SYSLOG_H if ( ( id = virLogFindOutput ( outputs , noutputs , VIR_LOG_TO_SYSLOG , current_ident ) ) != - 1 ) { if ( VIR_STRDUP_QUIET ( tmp , outputs [ id ] -> name ) < 0 ) { virLogUnlock ( ) ; return - 1 ; } VIR_FREE ( current_ident ) ; current_ident = tmp ; openlog ( current_ident , 0 , 0 ) ; } # endif virLogOutputs = outputs ; virLogNbOutputs = noutputs ; virLogUnlock ( ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void custom_time_skip ( va_list * va ) { ( void ) va_arg ( * va , int ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint16_t U_CALLCONV uprv_readSwapUInt16 ( uint16_t x ) { return ( uint16_t ) ( ( x << 8 ) | ( x >> 8 ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_reg_handoff_adb ( void ) { adb_service_handle = find_dissector_add_dependency ( "adb_service" , proto_adb ) ; dissector_add_for_decode_as ( "tcp.port" , adb_handle ) ; dissector_add_for_decode_as ( "usb.device" , adb_handle ) ; dissector_add_for_decode_as ( "usb.product" , adb_handle ) ; dissector_add_for_decode_as ( "usb.protocol" , adb_handle ) ; proto_tcp = proto_get_id_by_filter_name ( "tcp" ) ; proto_usb = proto_get_id_by_filter_name ( "usb" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static afs_int32 listEntry ( struct rx_call * call , afs_int32 aid , struct prcheckentry * aentry , afs_int32 * cid ) { afs_int32 code ; struct ubik_trans * tt ; afs_int32 temp ; struct prentry tentry ; code = Initdb ( ) ; if ( code != PRSUCCESS ) return code ; code = ubik_BeginTransReadAny ( dbase , UBIK_READTRANS , & tt ) ; if ( code ) return code ; code = ubik_SetLock ( tt , 1 , 1 , LOCKREAD ) ; if ( code ) ABORT_WITH ( tt , code ) ; code = read_DbHeader ( tt ) ; if ( code ) ABORT_WITH ( tt , code ) ; code = WhoIsThis ( call , tt , cid ) ; if ( code ) ABORT_WITH ( tt , PRPERM ) ; temp = FindByID ( tt , aid ) ; if ( ! temp ) ABORT_WITH ( tt , PRNOENT ) ; code = pr_ReadEntry ( tt , 0 , temp , & tentry ) ; if ( code != 0 ) ABORT_WITH ( tt , code ) ; if ( ! AccessOK ( tt , * cid , & tentry , PRP_STATUS_MEM , PRP_STATUS_ANY ) ) ABORT_WITH ( tt , PRPERM ) ; aentry -> flags = tentry . flags >> PRIVATE_SHIFT ; if ( aentry -> flags == 0 ) { if ( tentry . flags & PRGRP ) aentry -> flags = prp_group_default >> PRIVATE_SHIFT ; else aentry -> flags = prp_user_default >> PRIVATE_SHIFT ; } aentry -> owner = tentry . owner ; aentry -> id = tentry . id ; strncpy ( aentry -> name , tentry . name , PR_MAXNAMELEN ) ; aentry -> creator = tentry . creator ; aentry -> ngroups = tentry . ngroups ; aentry -> nusers = tentry . nusers ; aentry -> count = tentry . count ; memset ( aentry -> reserved , 0 , sizeof ( aentry -> reserved ) ) ; code = ubik_EndTrans ( tt ) ; if ( code ) return code ; return PRSUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int xsnprintf_func ( char * str , int n , const char * fmt , ... ) { va_list a ; int ret ; va_start ( a , fmt ) ; ret = vsnprintf_func ( str , n , fmt , a ) ; va_end ( a ) ; if ( ret < 0 ) { ret = n ; } return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void jpc_qmfb_join_colgrp ( jpc_fix_t * a , int numrows , int stride , int parity ) { int bufsize = JPC_CEILDIVPOW2 ( numrows , 1 ) ; jpc_fix_t joinbuf [ QMFB_JOINBUFSIZE * JPC_QMFB_COLGRPSIZE ] ; jpc_fix_t * buf = joinbuf ; jpc_fix_t * srcptr ; jpc_fix_t * dstptr ; register jpc_fix_t * srcptr2 ; register jpc_fix_t * dstptr2 ; register int n ; register int i ; int hstartcol ; if ( bufsize > QMFB_JOINBUFSIZE ) { if ( ! ( buf = jas_alloc3 ( bufsize , JPC_QMFB_COLGRPSIZE , sizeof ( jpc_fix_t ) ) ) ) { abort ( ) ; } } hstartcol = ( numrows + 1 - parity ) >> 1 ; n = hstartcol ; srcptr = & a [ 0 ] ; dstptr = buf ; while ( n -- > 0 ) { dstptr2 = dstptr ; srcptr2 = srcptr ; for ( i = 0 ; i < JPC_QMFB_COLGRPSIZE ; ++ i ) { * dstptr2 = * srcptr2 ; ++ dstptr2 ; ++ srcptr2 ; } srcptr += stride ; dstptr += JPC_QMFB_COLGRPSIZE ; } srcptr = & a [ hstartcol * stride ] ; dstptr = & a [ ( 1 - parity ) * stride ] ; n = numrows - hstartcol ; while ( n -- > 0 ) { dstptr2 = dstptr ; srcptr2 = srcptr ; for ( i = 0 ; i < JPC_QMFB_COLGRPSIZE ; ++ i ) { * dstptr2 = * srcptr2 ; ++ dstptr2 ; ++ srcptr2 ; } dstptr += 2 * stride ; srcptr += stride ; } srcptr = buf ; dstptr = & a [ parity * stride ] ; n = hstartcol ; while ( n -- > 0 ) { dstptr2 = dstptr ; srcptr2 = srcptr ; for ( i = 0 ; i < JPC_QMFB_COLGRPSIZE ; ++ i ) { * dstptr2 = * srcptr2 ; ++ dstptr2 ; ++ srcptr2 ; } dstptr += 2 * stride ; srcptr += JPC_QMFB_COLGRPSIZE ; } if ( buf != joinbuf ) { jas_free ( buf ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int check_stream_max_drift ( AVFormatContext * s ) { int64_t min_pos , pos ; int i ; int * idx = av_mallocz_array ( s -> nb_streams , sizeof ( * idx ) ) ; if ( ! idx ) return AVERROR ( ENOMEM ) ; for ( min_pos = pos = 0 ; min_pos != INT64_MAX ; pos = min_pos + 1LU ) { int64_t max_dts = INT64_MIN / 2 ; int64_t min_dts = INT64_MAX / 2 ; int64_t max_buffer = 0 ; min_pos = INT64_MAX ; for ( i = 0 ; i < s -> nb_streams ; i ++ ) { AVStream * st = s -> streams [ i ] ; AVIStream * ast = st -> priv_data ; int n = st -> nb_index_entries ; while ( idx [ i ] < n && st -> index_entries [ idx [ i ] ] . pos < pos ) idx [ i ] ++ ; if ( idx [ i ] < n ) { int64_t dts ; dts = av_rescale_q ( st -> index_entries [ idx [ i ] ] . timestamp / FFMAX ( ast -> sample_size , 1 ) , st -> time_base , AV_TIME_BASE_Q ) ; min_dts = FFMIN ( min_dts , dts ) ; min_pos = FFMIN ( min_pos , st -> index_entries [ idx [ i ] ] . pos ) ; } } for ( i = 0 ; i < s -> nb_streams ; i ++ ) { AVStream * st = s -> streams [ i ] ; AVIStream * ast = st -> priv_data ; if ( idx [ i ] && min_dts != INT64_MAX / 2 ) { int64_t dts ; dts = av_rescale_q ( st -> index_entries [ idx [ i ] - 1 ] . timestamp / FFMAX ( ast -> sample_size , 1 ) , st -> time_base , AV_TIME_BASE_Q ) ; max_dts = FFMAX ( max_dts , dts ) ; max_buffer = FFMAX ( max_buffer , av_rescale ( dts - min_dts , st -> codecpar -> bit_rate , AV_TIME_BASE ) ) ; } } if ( max_dts - min_dts > 2 * AV_TIME_BASE || max_buffer > 1024 * 1024 * 8 * 8 ) { av_free ( idx ) ; return 1 ; } } av_free ( idx ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void free_tables ( H264Context * h , int free_rbsp ) { int i ; H264Context * hx ; av_freep ( & h -> intra4x4_pred_mode ) ; av_freep ( & h -> chroma_pred_mode_table ) ; av_freep ( & h -> cbp_table ) ; av_freep ( & h -> mvd_table [ 0 ] ) ; av_freep ( & h -> mvd_table [ 1 ] ) ; av_freep ( & h -> direct_table ) ; av_freep ( & h -> non_zero_count ) ; av_freep ( & h -> slice_table_base ) ; h -> slice_table = NULL ; av_freep ( & h -> list_counts ) ; av_freep ( & h -> mb2b_xy ) ; av_freep ( & h -> mb2br_xy ) ; for ( i = 0 ; i < 3 ; i ++ ) av_freep ( & h -> visualization_buffer [ i ] ) ; av_buffer_pool_uninit ( & h -> qscale_table_pool ) ; av_buffer_pool_uninit ( & h -> mb_type_pool ) ; av_buffer_pool_uninit ( & h -> motion_val_pool ) ; av_buffer_pool_uninit ( & h -> ref_index_pool ) ; if ( free_rbsp && h -> DPB ) { for ( i = 0 ; i < MAX_PICTURE_COUNT ; i ++ ) unref_picture ( h , & h -> DPB [ i ] ) ; av_freep ( & h -> DPB ) ; } else if ( h -> DPB ) { for ( i = 0 ; i < MAX_PICTURE_COUNT ; i ++ ) h -> DPB [ i ] . needs_realloc = 1 ; } h -> cur_pic_ptr = NULL ; for ( i = 0 ; i < MAX_THREADS ; i ++ ) { hx = h -> thread_context [ i ] ; if ( ! hx ) continue ; av_freep ( & hx -> top_borders [ 1 ] ) ; av_freep ( & hx -> top_borders [ 0 ] ) ; av_freep ( & hx -> bipred_scratchpad ) ; av_freep ( & hx -> edge_emu_buffer ) ; av_freep ( & hx -> dc_val_base ) ; av_freep ( & hx -> me . scratchpad ) ; av_freep ( & hx -> er . mb_index2xy ) ; av_freep ( & hx -> er . error_status_table ) ; av_freep ( & hx -> er . er_temp_buffer ) ; av_freep ( & hx -> er . mbintra_table ) ; av_freep ( & hx -> er . mbskip_table ) ; if ( free_rbsp ) { av_freep ( & hx -> rbsp_buffer [ 1 ] ) ; av_freep ( & hx -> rbsp_buffer [ 0 ] ) ; hx -> rbsp_buffer_size [ 0 ] = 0 ; hx -> rbsp_buffer_size [ 1 ] = 0 ; } if ( i ) av_freep ( & h -> thread_context [ i ] ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int libschroedinger_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; int64_t pts = avpkt -> pts ; SchroTag * tag ; SchroDecoderParams * p_schro_params = avctx -> priv_data ; SchroDecoder * decoder = p_schro_params -> decoder ; SchroBuffer * enc_buf ; SchroFrame * frame ; AVFrame * avframe = data ; int state ; int go = 1 ; int outer = 1 ; SchroParseUnitContext parse_ctx ; LibSchroFrameContext * framewithpts = NULL ; * got_frame = 0 ; parse_context_init ( & parse_ctx , buf , buf_size ) ; if ( ! buf_size ) { if ( ! p_schro_params -> eos_signalled ) { state = schro_decoder_push_end_of_stream ( decoder ) ; p_schro_params -> eos_signalled = 1 ; } } do { if ( ( enc_buf = find_next_parse_unit ( & parse_ctx ) ) ) { enc_buf -> tag = schro_tag_new ( av_malloc ( sizeof ( int64_t ) ) , av_free ) ; if ( ! enc_buf -> tag -> value ) { av_log ( avctx , AV_LOG_ERROR , "Unable to allocate SchroTag\n" ) ; return AVERROR ( ENOMEM ) ; } AV_WN ( 64 , enc_buf -> tag -> value , pts ) ; if ( SCHRO_PARSE_CODE_IS_PICTURE ( enc_buf -> data [ 4 ] ) && SCHRO_PARSE_CODE_NUM_REFS ( enc_buf -> data [ 4 ] ) > 0 ) avctx -> has_b_frames = 1 ; state = schro_decoder_push ( decoder , enc_buf ) ; if ( state == SCHRO_DECODER_FIRST_ACCESS_UNIT ) libschroedinger_handle_first_access_unit ( avctx ) ; go = 1 ; } else outer = 0 ; while ( go ) { state = schro_decoder_wait ( decoder ) ; switch ( state ) { case SCHRO_DECODER_FIRST_ACCESS_UNIT : libschroedinger_handle_first_access_unit ( avctx ) ; break ; case SCHRO_DECODER_NEED_BITS : go = 0 ; break ; case SCHRO_DECODER_NEED_FRAME : frame = ff_create_schro_frame ( avctx , p_schro_params -> frame_format ) ; schro_decoder_add_output_picture ( decoder , frame ) ; break ; case SCHRO_DECODER_OK : tag = schro_decoder_get_picture_tag ( decoder ) ; frame = schro_decoder_pull ( decoder ) ; if ( frame ) { framewithpts = av_malloc ( sizeof ( LibSchroFrameContext ) ) ; if ( ! framewithpts ) { av_log ( avctx , AV_LOG_ERROR , "Unable to allocate FrameWithPts\n" ) ; return AVERROR ( ENOMEM ) ; } framewithpts -> frame = frame ; framewithpts -> pts = AV_RN64 ( tag -> value ) ; ff_schro_queue_push_back ( & p_schro_params -> dec_frame_queue , framewithpts ) ; } break ; case SCHRO_DECODER_EOS : go = 0 ; p_schro_params -> eos_pulled = 1 ; schro_decoder_reset ( decoder ) ; outer = 0 ; break ; case SCHRO_DECODER_ERROR : return - 1 ; break ; } } } while ( outer ) ; framewithpts = ff_schro_queue_pop ( & p_schro_params -> dec_frame_queue ) ; if ( framewithpts && framewithpts -> frame ) { if ( ff_get_buffer ( avctx , avframe , 0 ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "Unable to allocate buffer\n" ) ; return AVERROR ( ENOMEM ) ; } memcpy ( avframe -> data [ 0 ] , framewithpts -> frame -> components [ 0 ] . data , framewithpts -> frame -> components [ 0 ] . length ) ; memcpy ( avframe -> data [ 1 ] , framewithpts -> frame -> components [ 1 ] . data , framewithpts -> frame -> components [ 1 ] . length ) ; memcpy ( avframe -> data [ 2 ] , framewithpts -> frame -> components [ 2 ] . data , framewithpts -> frame -> components [ 2 ] . length ) ; avframe -> pkt_pts = framewithpts -> pts ; avframe -> linesize [ 0 ] = framewithpts -> frame -> components [ 0 ] . stride ; avframe -> linesize [ 1 ] = framewithpts -> frame -> components [ 1 ] . stride ; avframe -> linesize [ 2 ] = framewithpts -> frame -> components [ 2 ] . stride ; * got_frame = 1 ; libschroedinger_decode_frame_free ( framewithpts -> frame ) ; av_free ( framewithpts ) ; } else { data = NULL ; * got_frame = 0 ; } return buf_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void http_dispatcher_test ( void ) { short port = - 1 ; struct evhttp_connection * evcon = NULL ; struct evhttp_request * req = NULL ; test_ok = 0 ; fprintf ( stdout , "Testing HTTP Dispatcher: " ) ; http = http_setup ( & port , NULL ) ; evcon = evhttp_connection_new ( "127.0.0.1" , port ) ; if ( evcon == NULL ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } evhttp_connection_set_local_address ( evcon , "127.0.0.1" ) ; req = evhttp_request_new ( http_dispatcher_test_done , NULL ) ; if ( req == NULL ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } evhttp_add_header ( req -> output_headers , "Host" , "somehost" ) ; if ( evhttp_make_request ( evcon , req , EVHTTP_REQ_GET , "/?arg=val" ) == - 1 ) { fprintf ( stdout , "FAILED\n" ) ; exit ( 1 ) ; } event_dispatch ( ) ; evhttp_connection_free ( evcon ) ; evhttp_free ( http ) ; if ( test_ok != 1 ) { fprintf ( stdout , "FAILED: %d\n" , test_ok ) ; exit ( 1 ) ; } fprintf ( stdout , "OK\n" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * t_tob64 ( char * dst , const unsigned char * src , int size ) { int c , pos = size % 3 ; unsigned char b0 = 0 , b1 = 0 , b2 = 0 , notleading = 0 ; char * olddst = dst ; switch ( pos ) { case 1 : b2 = src [ 0 ] ; break ; case 2 : b1 = src [ 0 ] ; b2 = src [ 1 ] ; break ; } while ( 1 ) { c = ( b0 & 0xfc ) >> 2 ; if ( notleading || c != 0 ) { * dst ++ = b64table [ c ] ; notleading = 1 ; } c = ( ( b0 & 3 ) << 4 ) | ( ( b1 & 0xf0 ) >> 4 ) ; if ( notleading || c != 0 ) { * dst ++ = b64table [ c ] ; notleading = 1 ; } c = ( ( b1 & 0xf ) << 2 ) | ( ( b2 & 0xc0 ) >> 6 ) ; if ( notleading || c != 0 ) { * dst ++ = b64table [ c ] ; notleading = 1 ; } c = b2 & 0x3f ; if ( notleading || c != 0 ) { * dst ++ = b64table [ c ] ; notleading = 1 ; } if ( pos >= size ) break ; else { b0 = src [ pos ++ ] ; b1 = src [ pos ++ ] ; b2 = src [ pos ++ ] ; } } * dst ++ = '\0' ; return olddst ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static jlong Init ( JNIEnv * env , const JavaParamRef < jobject > & obj ) { PasswordUIViewAndroid * controller = new PasswordUIViewAndroid ( env , obj ) ; return reinterpret_cast < intptr_t > ( controller ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_btgatt_microbit_pin_io_config ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) { btatt_data_t * att_data = ( btatt_data_t * ) data ; proto_item * sub_item ; proto_tree * sub_tree ; if ( bluetooth_gatt_has_no_parameter ( att_data -> opcode ) ) return - 1 ; sub_item = proto_tree_add_item ( tree , hf_gatt_microbit_pin_io_config , tvb , 0 , 3 , ENC_LITTLE_ENDIAN ) ; sub_tree = proto_item_add_subtree ( sub_item , ett_btgatt_microbit_pin_io_config ) ; proto_tree_add_bitmask_list ( sub_tree , tvb , 0 , 3 , hfx_btgatt_microbit_io_pins , ENC_LITTLE_ENDIAN ) ; return tvb_captured_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int xan_wc3_decode_frame ( XanContext * s ) { int width = s -> avctx -> width ; int height = s -> avctx -> height ; int total_pixels = width * height ; unsigned char opcode ; unsigned char flag = 0 ; int size = 0 ; int motion_x , motion_y ; int x , y ; unsigned char * opcode_buffer = s -> buffer1 ; unsigned char * opcode_buffer_end = s -> buffer1 + s -> buffer1_size ; int opcode_buffer_size = s -> buffer1_size ; const unsigned char * imagedata_buffer = s -> buffer2 ; const unsigned char * huffman_segment ; const unsigned char * size_segment ; const unsigned char * vector_segment ; const unsigned char * imagedata_segment ; int huffman_offset , size_offset , vector_offset , imagedata_offset , imagedata_size ; if ( s -> size < 8 ) return AVERROR_INVALIDDATA ; huffman_offset = AV_RL16 ( & s -> buf [ 0 ] ) ; size_offset = AV_RL16 ( & s -> buf [ 2 ] ) ; vector_offset = AV_RL16 ( & s -> buf [ 4 ] ) ; imagedata_offset = AV_RL16 ( & s -> buf [ 6 ] ) ; if ( huffman_offset >= s -> size || size_offset >= s -> size || vector_offset >= s -> size || imagedata_offset >= s -> size ) return AVERROR_INVALIDDATA ; huffman_segment = s -> buf + huffman_offset ; size_segment = s -> buf + size_offset ; vector_segment = s -> buf + vector_offset ; imagedata_segment = s -> buf + imagedata_offset ; if ( xan_huffman_decode ( opcode_buffer , opcode_buffer_size , huffman_segment , s -> size - huffman_offset ) < 0 ) return AVERROR_INVALIDDATA ; if ( imagedata_segment [ 0 ] == 2 ) { xan_unpack ( s -> buffer2 , s -> buffer2_size , & imagedata_segment [ 1 ] , s -> size - imagedata_offset - 1 ) ; imagedata_size = s -> buffer2_size ; } else { imagedata_size = s -> size - imagedata_offset - 1 ; imagedata_buffer = & imagedata_segment [ 1 ] ; } x = y = 0 ; while ( total_pixels && opcode_buffer < opcode_buffer_end ) { opcode = * opcode_buffer ++ ; size = 0 ; switch ( opcode ) { case 0 : flag ^= 1 ; continue ; case 1 : case 2 : case 3 : case 4 : case 5 : case 6 : case 7 : case 8 : size = opcode ; break ; case 12 : case 13 : case 14 : case 15 : case 16 : case 17 : case 18 : size += ( opcode - 10 ) ; break ; case 9 : case 19 : size = * size_segment ++ ; break ; case 10 : case 20 : size = AV_RB16 ( & size_segment [ 0 ] ) ; size_segment += 2 ; break ; case 11 : case 21 : size = AV_RB24 ( size_segment ) ; size_segment += 3 ; break ; } if ( size > total_pixels ) break ; if ( opcode < 12 ) { flag ^= 1 ; if ( flag ) { xan_wc3_copy_pixel_run ( s , x , y , size , 0 , 0 ) ; } else { if ( imagedata_size < size ) break ; xan_wc3_output_pixel_run ( s , imagedata_buffer , x , y , size ) ; imagedata_buffer += size ; imagedata_size -= size ; } } else { motion_x = sign_extend ( * vector_segment >> 4 , 4 ) ; motion_y = sign_extend ( * vector_segment & 0xF , 4 ) ; vector_segment ++ ; xan_wc3_copy_pixel_run ( s , x , y , size , motion_x , motion_y ) ; flag = 0 ; } total_pixels -= size ; y += ( x + size ) / width ; x = ( x + size ) % width ; } return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int dissect_ber_octet_string_wcb ( gboolean implicit_tag , asn1_ctx_t * actx , proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_id , ber_callback func ) { tvbuff_t * out_tvb = NULL ; offset = dissect_ber_octet_string ( implicit_tag , actx , tree , tvb , offset , hf_id , ( func ) ? & out_tvb : NULL ) ; if ( func && out_tvb && ( tvb_reported_length ( out_tvb ) > 0 ) ) { if ( hf_id >= 0 ) tree = proto_item_add_subtree ( actx -> created_item , ett_ber_octet_string ) ; func ( FALSE , out_tvb , 0 , actx , tree , - 1 ) ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int gs_main_run_file_open ( gs_main_instance * minst , const char * file_name , ref * pfref ) { gs_main_set_lib_paths ( minst ) ; if ( gs_main_lib_open ( minst , file_name , pfref ) < 0 ) { emprintf1 ( minst -> heap , "Can't find initialization file %s.\n" , file_name ) ; return_error ( gs_error_Fatal ) ; } r_set_attrs ( pfref , a_execute + a_executable ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vmxnet_tx_pkt_build_vheader ( struct VmxnetTxPkt * pkt , bool tso_enable , bool csum_enable , uint32_t gso_size ) { struct tcp_hdr l4hdr ; assert ( pkt ) ; assert ( csum_enable || ! tso_enable ) ; pkt -> virt_hdr . gso_type = vmxnet_tx_pkt_get_gso_type ( pkt , tso_enable ) ; switch ( pkt -> virt_hdr . gso_type & ~ VIRTIO_NET_HDR_GSO_ECN ) { case VIRTIO_NET_HDR_GSO_NONE : pkt -> virt_hdr . hdr_len = 0 ; pkt -> virt_hdr . gso_size = 0 ; break ; case VIRTIO_NET_HDR_GSO_UDP : pkt -> virt_hdr . gso_size = IP_FRAG_ALIGN_SIZE ( gso_size ) ; pkt -> virt_hdr . hdr_len = pkt -> hdr_len + sizeof ( struct udp_header ) ; break ; case VIRTIO_NET_HDR_GSO_TCPV4 : case VIRTIO_NET_HDR_GSO_TCPV6 : iov_to_buf ( & pkt -> vec [ VMXNET_TX_PKT_PL_START_FRAG ] , pkt -> payload_frags , 0 , & l4hdr , sizeof ( l4hdr ) ) ; pkt -> virt_hdr . hdr_len = pkt -> hdr_len + l4hdr . th_off * sizeof ( uint32_t ) ; pkt -> virt_hdr . gso_size = IP_FRAG_ALIGN_SIZE ( gso_size ) ; break ; default : g_assert_not_reached ( ) ; } if ( csum_enable ) { switch ( pkt -> l4proto ) { case IP_PROTO_TCP : pkt -> virt_hdr . flags = VIRTIO_NET_HDR_F_NEEDS_CSUM ; pkt -> virt_hdr . csum_start = pkt -> hdr_len ; pkt -> virt_hdr . csum_offset = offsetof ( struct tcp_hdr , th_sum ) ; break ; case IP_PROTO_UDP : pkt -> virt_hdr . flags = VIRTIO_NET_HDR_F_NEEDS_CSUM ; pkt -> virt_hdr . csum_start = pkt -> hdr_len ; pkt -> virt_hdr . csum_offset = offsetof ( struct udp_hdr , uh_sum ) ; break ; default : break ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gpgme_error_t uiserver_assuan_simple_command ( assuan_context_t ctx , char * cmd , engine_status_handler_t status_fnc , void * status_fnc_value ) { gpg_error_t err ; char * line ; size_t linelen ; err = assuan_write_line ( ctx , cmd ) ; if ( err ) return err ; do { err = assuan_read_line ( ctx , & line , & linelen ) ; if ( err ) return err ; if ( * line == '#' || ! linelen ) continue ; if ( linelen >= 2 && line [ 0 ] == 'O' && line [ 1 ] == 'K' && ( line [ 2 ] == '\0' || line [ 2 ] == ' ' ) ) return 0 ; else if ( linelen >= 4 && line [ 0 ] == 'E' && line [ 1 ] == 'R' && line [ 2 ] == 'R' && line [ 3 ] == ' ' ) err = atoi ( & line [ 4 ] ) ; else if ( linelen >= 2 && line [ 0 ] == 'S' && line [ 1 ] == ' ' ) { char * rest ; gpgme_status_code_t r ; rest = strchr ( line + 2 , ' ' ) ; if ( ! rest ) rest = line + linelen ; else * ( rest ++ ) = 0 ; r = _gpgme_parse_status ( line + 2 ) ; if ( r >= 0 && status_fnc ) err = status_fnc ( status_fnc_value , r , rest ) ; else err = gpg_error ( GPG_ERR_GENERAL ) ; } else err = gpg_error ( GPG_ERR_GENERAL ) ; } while ( ! err ) ; return err ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Image * ReadARTImage ( const ImageInfo * image_info , ExceptionInfo * exception ) { const unsigned char * pixels ; Image * image ; QuantumInfo * quantum_info ; QuantumType quantum_type ; MagickBooleanType status ; size_t length ; ssize_t count , y ; assert ( image_info != ( const ImageInfo * ) NULL ) ; assert ( image_info -> signature == MagickSignature ) ; if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ; assert ( exception != ( ExceptionInfo * ) NULL ) ; assert ( exception -> signature == MagickSignature ) ; image = AcquireImage ( image_info ) ; status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ; if ( status == MagickFalse ) { image = DestroyImageList ( image ) ; return ( ( Image * ) NULL ) ; } image -> depth = 1 ; image -> endian = MSBEndian ; ( void ) ReadBlobLSBShort ( image ) ; image -> columns = ( size_t ) ReadBlobLSBShort ( image ) ; ( void ) ReadBlobLSBShort ( image ) ; image -> rows = ( size_t ) ReadBlobLSBShort ( image ) ; if ( ( image -> columns == 0 ) || ( image -> rows == 0 ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ; if ( AcquireImageColormap ( image , 2 ) == MagickFalse ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; if ( image_info -> ping != MagickFalse ) { ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; } status = SetImageExtent ( image , image -> columns , image -> rows ) ; if ( status == MagickFalse ) { InheritException ( exception , & image -> exception ) ; return ( DestroyImageList ( image ) ) ; } SetImageColorspace ( image , GRAYColorspace ) ; quantum_type = IndexQuantum ; quantum_info = AcquireQuantumInfo ( image_info , image ) ; if ( quantum_info == ( QuantumInfo * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ; length = GetQuantumExtent ( image , quantum_info , quantum_type ) ; for ( y = 0 ; y < ( ssize_t ) image -> rows ; y ++ ) { register PixelPacket * magick_restrict q ; q = QueueAuthenticPixels ( image , 0 , y , image -> columns , 1 , exception ) ; if ( q == ( PixelPacket * ) NULL ) break ; pixels = ( const unsigned char * ) ReadBlobStream ( image , length , GetQuantumPixels ( quantum_info ) , & count ) ; if ( count != ( ssize_t ) length ) { quantum_info = DestroyQuantumInfo ( quantum_info ) ; ThrowReaderException ( CorruptImageError , "UnableToReadImageData" ) ; } ( void ) ImportQuantumPixels ( image , ( CacheView * ) NULL , quantum_info , quantum_type , pixels , exception ) ; ( void ) ReadBlobStream ( image , ( size_t ) ( - ( ssize_t ) length ) & 0x01 , GetQuantumPixels ( quantum_info ) , & count ) ; if ( SyncAuthenticPixels ( image , exception ) == MagickFalse ) break ; status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) y , image -> rows ) ; if ( status == MagickFalse ) break ; } SetQuantumImageType ( image , quantum_type ) ; quantum_info = DestroyQuantumInfo ( quantum_info ) ; if ( EOFBlob ( image ) != MagickFalse ) ThrowFileException ( exception , CorruptImageError , "UnexpectedEndOfFile" , image -> filename ) ; ( void ) CloseBlob ( image ) ; return ( GetFirstImageInList ( image ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_prepare_insert_update ( ) { MYSQL_STMT * stmt ; int rc ; int i ; const char * testcase [ ] = { "CREATE TABLE t1 (a INT, b INT, c INT, UNIQUE (A), UNIQUE(B))" , "INSERT t1 VALUES (1,2,10), (3,4,20)" , "INSERT t1 VALUES (5,6,30), (7,4,40), (8,9,60) ON DUPLICATE KEY UPDATE c=c+100" , "SELECT * FROM t1" , "INSERT t1 SET a=5 ON DUPLICATE KEY UPDATE b=0" , "SELECT * FROM t1" , "INSERT t1 VALUES (2,1,11), (7,4,40) ON DUPLICATE KEY UPDATE c=c+VALUES(a)" , NULL } ; const char * * cur_query ; myheader ( "test_prepare_insert_update" ) ; for ( cur_query = testcase ; * cur_query ; cur_query ++ ) { char query [ MAX_TEST_QUERY_LENGTH ] ; printf ( "\nRunning query: %s" , * cur_query ) ; strmov ( query , * cur_query ) ; stmt = mysql_simple_prepare ( mysql , query ) ; check_stmt ( stmt ) ; verify_param_count ( stmt , 0 ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; if ( ! cur_query [ 1 ] ) { for ( i = 0 ; i < 3 ; i ++ ) { printf ( "\nExecuting last statement again" ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; rc = mysql_stmt_execute ( stmt ) ; check_execute ( stmt , rc ) ; } } mysql_stmt_close ( stmt ) ; } rc = mysql_commit ( mysql ) ; myquery ( rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void qemu_mutex_unlock_iothread ( void ) { qemu_mutex_unlock ( & qemu_global_mutex ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int main ( int argc , char * * argv ) { if ( argc > 1 && ! strcmp ( argv [ 1 ] , "--verbose" ) ) verbose = 1 ; else if ( argc > 1 && ! strcmp ( argv [ 1 ] , "--debug" ) ) verbose = debug = 1 ; if ( ! gcry_check_version ( GCRYPT_VERSION ) ) die ( "version mismatch\n" ) ; gcry_control ( GCRYCTL_DISABLE_SECMEM , 0 ) ; gcry_control ( GCRYCTL_ENABLE_QUICK_RANDOM , 0 ) ; if ( debug ) gcry_control ( GCRYCTL_SET_DEBUG_FLAGS , 1u , 0 ) ; gcry_control ( GCRYCTL_INITIALIZATION_FINISHED , 0 ) ; set_get_point ( ) ; context_alloc ( ) ; context_param ( ) ; basic_ec_math ( ) ; basic_ec_math_simplified ( ) ; twistededwards_math ( ) ; show ( "All tests completed. Errors: %d\n" , error_count ) ; return error_count ? 1 : 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) { OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ; } LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) { OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ; } LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING ) ; # ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable : 4090 ) # endif DEFINE_LHASH_OF ( OPENSSL_CSTRING )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ; DECL_PIOCTL ( PSetAcl ) ; DECL_PIOCTL ( PStoreBehind ) ; DECL_PIOCTL ( PGCPAGs ) ; DECL_PIOCTL ( PGetAcl ) ; DECL_PIOCTL ( PNoop ) ; DECL_PIOCTL ( PBogus ) ; DECL_PIOCTL ( PGetFileCell ) ; DECL_PIOCTL ( PGetWSCell ) ; DECL_PIOCTL ( PGetUserCell ) ; DECL_PIOCTL ( PSetTokens ) ; DECL_PIOCTL ( PGetVolumeStatus ) ; DECL_PIOCTL ( PSetVolumeStatus )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int cost_mv_ref ( const VP9_COMP * cpi , PREDICTION_MODE mode , int mode_context ) { assert ( is_inter_mode ( mode ) ) ; return cpi -> inter_mode_cost [ mode_context ] [ INTER_OFFSET ( mode ) ] ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_register_pkt_ccc ( void ) { static hf_register_info hf [ ] = { { & hf_pkt_ccc_id , { "PacketCable CCC Identifier" , "pkt_ccc.ccc_id" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL } } , { & hf_pkt_ccc_ts , { "PacketCable CCC Timestamp" , "pkt_ccc.ts" , FT_ABSOLUTE_TIME , ABSOLUTE_TIME_UTC , NULL , 0x0 , NULL , HFILL } } , } ; static gint * ett [ ] = { & ett_pkt_ccc , } ; module_t * pkt_ccc_module ; proto_pkt_ccc = proto_register_protocol ( "PacketCable Call Content Connection" , "PKT CCC" , "pkt_ccc" ) ; proto_register_field_array ( proto_pkt_ccc , hf , array_length ( hf ) ) ; proto_register_subtree_array ( ett , array_length ( ett ) ) ; new_register_dissector ( "pkt_ccc" , dissect_pkt_ccc , proto_pkt_ccc ) ; pkt_ccc_module = prefs_register_protocol ( proto_pkt_ccc , proto_reg_handoff_pkt_ccc ) ; prefs_register_uint_preference ( pkt_ccc_module , "udp_port" , "UDP port" , "Decode packets on this UDP port as PacketCable CCC" , 10 , & global_pkt_ccc_udp_port ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void finish_object ( struct object * obj , const struct name_path * path , const char * name , void * cb_data ) { struct rev_list_info * info = cb_data ; if ( obj -> type == OBJ_BLOB && ! has_object_file ( & obj -> oid ) ) die ( "missing blob object '%s'" , oid_to_hex ( & obj -> oid ) ) ; if ( info -> revs -> verify_objects && ! obj -> parsed && obj -> type != OBJ_COMMIT ) parse_object ( obj -> oid . hash ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int vp9_get_tx_size_context ( const MACROBLOCKD * xd ) { const int max_tx_size = max_txsize_lookup [ xd -> mi [ 0 ] . src_mi -> mbmi . sb_type ] ; const MB_MODE_INFO * const above_mbmi = get_mbmi ( get_above_mi ( xd ) ) ; const MB_MODE_INFO * const left_mbmi = get_mbmi ( get_left_mi ( xd ) ) ; const int has_above = above_mbmi != NULL ; const int has_left = left_mbmi != NULL ; int above_ctx = ( has_above && ! above_mbmi -> skip ) ? ( int ) above_mbmi -> tx_size : max_tx_size ; int left_ctx = ( has_left && ! left_mbmi -> skip ) ? ( int ) left_mbmi -> tx_size : max_tx_size ; if ( ! has_left ) left_ctx = above_ctx ; if ( ! has_above ) above_ctx = left_ctx ; return ( above_ctx + left_ctx ) > max_tx_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserCloseInfiniteUnloadAlert ) { if ( base : : CommandLine : : ForCurrentProcess ( ) -> HasSwitch ( switches : : kSingleProcess ) ) return ; LoadUrlAndQuitBrowser ( INFINITE_UNLOAD_ALERT_HTML , "infiniteunloadalert" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int VoIPcalls_packet ( void * ptr _U_ , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * VoIPinfo ) { voip_calls_tapinfo_t * tapinfo = & the_tapinfo_struct ; voip_calls_info_t * callsinfo = NULL ; voip_calls_info_t * tmp_listinfo ; GList * list = NULL ; const voip_packet_info_t * pi = ( const voip_packet_info_t * ) VoIPinfo ; if ( pi -> call_id ) list = g_list_first ( tapinfo -> callsinfo_list ) ; while ( list ) { tmp_listinfo = ( voip_calls_info_t * ) list -> data ; if ( tmp_listinfo -> protocol == VOIP_COMMON ) { if ( ! strcmp ( pi -> call_id , tmp_listinfo -> call_id ) ) { callsinfo = ( voip_calls_info_t * ) ( list -> data ) ; break ; } } list = g_list_next ( list ) ; } if ( callsinfo == NULL ) { callsinfo = ( voip_calls_info_t * ) g_malloc0 ( sizeof ( voip_calls_info_t ) ) ; callsinfo -> call_active_state = pi -> call_active_state ; callsinfo -> call_state = pi -> call_state ; callsinfo -> call_id = g_strdup ( ( pi -> call_id ) ? pi -> call_id : "" ) ; callsinfo -> from_identity = g_strdup ( ( pi -> from_identity ) ? pi -> from_identity : "" ) ; callsinfo -> to_identity = g_strdup ( ( pi -> to_identity ) ? pi -> to_identity : "" ) ; COPY_ADDRESS ( & ( callsinfo -> initial_speaker ) , & ( pinfo -> src ) ) ; callsinfo -> selected = FALSE ; callsinfo -> start_fd = pinfo -> fd ; callsinfo -> start_rel_ts = pinfo -> rel_ts ; callsinfo -> protocol = VOIP_COMMON ; callsinfo -> protocol_name = g_strdup ( ( pi -> protocol_name ) ? pi -> protocol_name : "" ) ; callsinfo -> call_comment = g_strdup ( ( pi -> call_comment ) ? pi -> call_comment : "" ) ; callsinfo -> prot_info = NULL ; callsinfo -> free_prot_info = NULL ; callsinfo -> call_num = tapinfo -> ncalls ++ ; callsinfo -> npackets = 0 ; tapinfo -> callsinfo_list = g_list_prepend ( tapinfo -> callsinfo_list , callsinfo ) ; } callsinfo -> call_active_state = pi -> call_active_state ; if ( ( callsinfo -> call_state != VOIP_COMPLETED ) && ( pi -> call_state == VOIP_COMPLETED ) ) tapinfo -> completed_calls ++ ; if ( pi -> call_state != VOIP_NO_STATE ) callsinfo -> call_state = pi -> call_state ; if ( pi -> call_comment ) { g_free ( callsinfo -> call_comment ) ; callsinfo -> call_comment = g_strdup ( pi -> call_comment ) ; } callsinfo -> stop_fd = pinfo -> fd ; callsinfo -> stop_rel_ts = pinfo -> rel_ts ; ++ ( callsinfo -> npackets ) ; ++ ( tapinfo -> npackets ) ; add_to_graph ( tapinfo , pinfo , ( pi -> frame_label ) ? pi -> frame_label : "VoIP msg" , pi -> frame_comment , callsinfo -> call_num , & ( pinfo -> src ) , & ( pinfo -> dst ) , 1 ) ; tapinfo -> redraw = TRUE ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static UBool isPNJBindiTippi ( UChar32 c ) { if ( c < 0xa00 || 0xa50 <= c ) { return FALSE ; } else { return ( UBool ) ( pnjMap [ c - 0xa00 ] >> 1 ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int SpoolssEnumPrinterDrivers_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) { dcerpc_call_value * dcv = ( dcerpc_call_value * ) di -> call_data ; guint32 level ; offset = dissect_ndr_str_pointer_item ( tvb , offset , pinfo , tree , di , drep , NDR_POINTER_UNIQUE , "Name" , hf_servername , 0 ) ; offset = dissect_ndr_str_pointer_item ( tvb , offset , pinfo , tree , di , drep , NDR_POINTER_UNIQUE , "Environment" , hf_environment , 0 ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_level , & level ) ; if ( ! pinfo -> fd -> flags . visited ) { dcv -> se_data = GUINT_TO_POINTER ( ( int ) level ) ; } col_append_fstr ( pinfo -> cinfo , COL_INFO , ", level %d" , level ) ; offset = dissect_spoolss_buffer ( tvb , offset , pinfo , tree , di , drep , NULL ) ; offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_offered , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int roq_encode_end ( AVCodecContext * avctx ) { RoqContext * enc = avctx -> priv_data ; avctx -> release_buffer ( avctx , enc -> last_frame ) ; avctx -> release_buffer ( avctx , enc -> current_frame ) ; av_free ( enc -> tmpData ) ; av_free ( enc -> this_motion4 ) ; av_free ( enc -> last_motion4 ) ; av_free ( enc -> this_motion8 ) ; av_free ( enc -> last_motion8 ) ; return 0 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int tls_construct_new_session_ticket ( SSL * s ) { unsigned char * senc = NULL ; EVP_CIPHER_CTX * ctx ; HMAC_CTX * hctx = NULL ; unsigned char * p , * macstart ; const unsigned char * const_p ; int len , slen_full , slen ; SSL_SESSION * sess ; unsigned int hlen ; SSL_CTX * tctx = s -> initial_ctx ; unsigned char iv [ EVP_MAX_IV_LENGTH ] ; unsigned char key_name [ TLSEXT_KEYNAME_LENGTH ] ; int iv_len ; slen_full = i2d_SSL_SESSION ( s -> session , NULL ) ; if ( slen_full == 0 || slen_full > 0xFF00 ) { ossl_statem_set_error ( s ) ; return 0 ; } senc = OPENSSL_malloc ( slen_full ) ; if ( senc == NULL ) { ossl_statem_set_error ( s ) ; return 0 ; } ctx = EVP_CIPHER_CTX_new ( ) ; hctx = HMAC_CTX_new ( ) ; p = senc ; if ( ! i2d_SSL_SESSION ( s -> session , & p ) ) goto err ; const_p = senc ; sess = d2i_SSL_SESSION ( NULL , & const_p , slen_full ) ; if ( sess == NULL ) goto err ; sess -> session_id_length = 0 ; slen = i2d_SSL_SESSION ( sess , NULL ) ; if ( slen == 0 || slen > slen_full ) { SSL_SESSION_free ( sess ) ; goto err ; } p = senc ; if ( ! i2d_SSL_SESSION ( sess , & p ) ) { SSL_SESSION_free ( sess ) ; goto err ; } SSL_SESSION_free ( sess ) ; if ( ! BUF_MEM_grow ( s -> init_buf , SSL_HM_HEADER_LENGTH ( s ) + 6 + sizeof ( key_name ) + EVP_MAX_IV_LENGTH + EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen ) ) goto err ; p = ssl_handshake_start ( s ) ; if ( tctx -> tlsext_ticket_key_cb ) { int ret = tctx -> tlsext_ticket_key_cb ( s , key_name , iv , ctx , hctx , 1 ) ; if ( ret == 0 ) { l2n ( 0 , p ) ; s2n ( 0 , p ) ; if ( ! ssl_set_handshake_header ( s , SSL3_MT_NEWSESSION_TICKET , p - ssl_handshake_start ( s ) ) ) goto err ; OPENSSL_free ( senc ) ; EVP_CIPHER_CTX_free ( ctx ) ; HMAC_CTX_free ( hctx ) ; return 1 ; } if ( ret < 0 ) goto err ; iv_len = EVP_CIPHER_CTX_iv_length ( ctx ) ; } else { const EVP_CIPHER * cipher = EVP_aes_256_cbc ( ) ; iv_len = EVP_CIPHER_iv_length ( cipher ) ; if ( RAND_bytes ( iv , iv_len ) <= 0 ) goto err ; if ( ! EVP_EncryptInit_ex ( ctx , cipher , NULL , tctx -> tlsext_tick_aes_key , iv ) ) goto err ; if ( ! HMAC_Init_ex ( hctx , tctx -> tlsext_tick_hmac_key , sizeof ( tctx -> tlsext_tick_hmac_key ) , EVP_sha256 ( ) , NULL ) ) goto err ; memcpy ( key_name , tctx -> tlsext_tick_key_name , sizeof ( tctx -> tlsext_tick_key_name ) ) ; } l2n ( s -> hit ? 0 : s -> session -> timeout , p ) ; p += 2 ; macstart = p ; memcpy ( p , key_name , sizeof ( key_name ) ) ; p += sizeof ( key_name ) ; memcpy ( p , iv , iv_len ) ; p += iv_len ; if ( ! EVP_EncryptUpdate ( ctx , p , & len , senc , slen ) ) goto err ; p += len ; if ( ! EVP_EncryptFinal ( ctx , p , & len ) ) goto err ; p += len ; if ( ! HMAC_Update ( hctx , macstart , p - macstart ) ) goto err ; if ( ! HMAC_Final ( hctx , p , & hlen ) ) goto err ; EVP_CIPHER_CTX_free ( ctx ) ; HMAC_CTX_free ( hctx ) ; ctx = NULL ; hctx = NULL ; p += hlen ; len = p - ssl_handshake_start ( s ) ; p = ssl_handshake_start ( s ) + 4 ; s2n ( len - 6 , p ) ; if ( ! ssl_set_handshake_header ( s , SSL3_MT_NEWSESSION_TICKET , len ) ) goto err ; OPENSSL_free ( senc ) ; return 1 ; err : OPENSSL_free ( senc ) ; EVP_CIPHER_CTX_free ( ctx ) ; HMAC_CTX_free ( hctx ) ; ossl_statem_set_error ( s ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void pk_transaction_skip_auth_checks ( PkTransaction * transaction , gboolean skip_checks ) { g_return_if_fail ( PK_IS_TRANSACTION ( transaction ) ) ; transaction -> priv -> skip_auth_check = skip_checks ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool blit_is_unsafe ( struct CirrusVGAState * s , bool dst_only ) { assert ( s -> cirrus_blt_width > 0 ) ; assert ( s -> cirrus_blt_height > 0 ) ; if ( s -> cirrus_blt_width > CIRRUS_BLTBUFSIZE ) { return true ; } if ( blit_region_is_unsafe ( s , s -> cirrus_blt_dstpitch , s -> cirrus_blt_dstaddr ) ) { return true ; } if ( dst_only ) { return false ; } if ( blit_region_is_unsafe ( s , s -> cirrus_blt_srcpitch , s -> cirrus_blt_srcaddr ) ) { return true ; } return false ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TemplateURLTest , PrefetchQueryParameters ) { TemplateURLData data ; search_terms_data_ . set_google_base_url ( "http://bar/" ) ; data . SetURL ( "http://bar/search?q={ searchTerms} &{ google:prefetchQuery} xssi=t" ) ; TemplateURL url ( data ) ; TemplateURLRef : : SearchTermsArgs search_terms_args ( ASCIIToUTF16 ( "foo" ) ) ; search_terms_args . prefetch_query = "full query text" ; search_terms_args . prefetch_query_type = "2338" ; std : : string result = url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ; EXPECT_EQ ( "http://bar/search?q=foo&pfq=full%20query%20text&qha=2338&xssi=t" , result ) ; TemplateURL url2 ( data ) ; search_terms_args . prefetch_query . clear ( ) ; search_terms_args . prefetch_query_type . clear ( ) ; result = url2 . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ; EXPECT_EQ ( "http://bar/search?q=foo&xssi=t" , result ) ; }
0False