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 VALUE cState_object_nl_set ( VALUE self , VALUE object_nl ) { unsigned long len ; GET_STATE ( self ) ; Check_Type ( object_nl , T_STRING ) ; len = RSTRING_LEN ( object_nl ) ; if ( len == 0 ) { if ( state -> object_nl ) { ruby_xfree ( state -> object_nl ) ; state -> object_nl = NULL ; } } else { if ( state -> object_nl ) ruby_xfree ( state -> object_nl ) ; state -> object_nl = fstrndup ( RSTRING_PTR ( object_nl ) , len ) ; state -> object_nl_len = len ; } return Qnil ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void fast_bgr_to_cmyk ( fz_context * ctx , fz_pixmap * dst , fz_pixmap * src , fz_colorspace * prf , const fz_default_colorspaces * default_cs , const fz_color_params * color_params , int copy_spots ) { unsigned char * s = src -> samples ; unsigned char * d = dst -> samples ; size_t w = src -> w ; int h = src -> h ; int sn = src -> n ; int ss = src -> s ; int sa = src -> alpha ; int dn = dst -> n ; int ds = dst -> s ; int da = dst -> alpha ; ptrdiff_t d_line_inc = dst -> stride - w * dn ; ptrdiff_t s_line_inc = src -> stride - w * sn ; if ( ( copy_spots && ss != ds ) || ( ! da && sa ) ) { assert ( "This should never happen" == NULL ) ; fz_throw ( ctx , FZ_ERROR_GENERIC , "Cannot convert between incompatible pixmaps" ) ; } if ( ( int ) w < 0 || h < 0 ) return ; if ( d_line_inc == 0 && s_line_inc == 0 ) { w *= h ; h = 1 ; } if ( ss == 0 && ds == 0 ) { if ( da ) { if ( sa ) { while ( h -- ) { size_t ww = w ; while ( ww -- ) { unsigned char c = s [ 2 ] ; unsigned char m = s [ 1 ] ; unsigned char y = s [ 0 ] ; unsigned char k = ( unsigned char ) fz_mini ( c , fz_mini ( m , y ) ) ; d [ 0 ] = c - k ; d [ 1 ] = m - k ; d [ 2 ] = y - k ; d [ 3 ] = k ; d [ 4 ] = s [ 3 ] ; s += 4 ; d += 5 ; } d += d_line_inc ; s += s_line_inc ; } } else { while ( h -- ) { size_t ww = w ; while ( ww -- ) { unsigned char c = s [ 2 ] ; unsigned char m = s [ 1 ] ; unsigned char y = s [ 0 ] ; unsigned char k = ( unsigned char ) fz_mini ( c , fz_mini ( m , y ) ) ; d [ 0 ] = c - k ; d [ 1 ] = m - k ; d [ 2 ] = y - k ; d [ 3 ] = k ; d [ 4 ] = 255 ; s += 3 ; d += 5 ; } d += d_line_inc ; s += s_line_inc ; } } } else { while ( h -- ) { size_t ww = w ; while ( ww -- ) { unsigned char c = s [ 2 ] ; unsigned char m = s [ 1 ] ; unsigned char y = s [ 0 ] ; unsigned char k = ( unsigned char ) fz_mini ( c , fz_mini ( m , y ) ) ; d [ 0 ] = c - k ; d [ 1 ] = m - k ; d [ 2 ] = y - k ; d [ 3 ] = k ; s += 3 ; d += 4 ; } d += d_line_inc ; s += s_line_inc ; } } } else if ( copy_spots ) { while ( h -- ) { int i ; size_t ww = w ; while ( ww -- ) { unsigned char c = s [ 2 ] ; unsigned char m = s [ 1 ] ; unsigned char y = s [ 0 ] ; unsigned char k = ( unsigned char ) fz_mini ( c , fz_mini ( m , y ) ) ; d [ 0 ] = c - k ; d [ 1 ] = m - k ; d [ 2 ] = y - k ; d [ 3 ] = k ; s += 3 ; d += 4 ; for ( i = ss ; i > 0 ; i -- ) * d ++ = * s ++ ; if ( da ) * d ++ = sa ? * s ++ : 255 ; } d += d_line_inc ; s += s_line_inc ; } } else { while ( h -- ) { size_t ww = w ; while ( ww -- ) { unsigned char c = s [ 2 ] ; unsigned char m = s [ 1 ] ; unsigned char y = s [ 0 ] ; unsigned char k = ( unsigned char ) ( 255 - fz_maxi ( c , fz_maxi ( m , y ) ) ) ; d [ 0 ] = c + k ; d [ 1 ] = m + k ; d [ 2 ] = y + k ; d [ 3 ] = 255 - k ; s += sn ; d += dn ; if ( da ) d [ - 1 ] = sa ? s [ - 1 ] : 255 ; } d += d_line_inc ; s += s_line_inc ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerBrowserTest , TestWithOffTheRecordWindowAndRegularDownload ) { Profile * otr_profile = browser ( ) -> profile ( ) -> GetOffTheRecordProfile ( ) ; Browser * otr_browser = CreateBrowser ( otr_profile ) ; ASSERT_NO_FATAL_FAILURE ( CreateStalledDownload ( browser ( ) ) ) ; content : : TestNavigationObserver navigation_observer ( otr_browser -> tab_strip_model ( ) -> GetActiveWebContents ( ) , 1 ) ; ui_test_utils : : NavigateToURL ( otr_browser , GURL ( "about:blank" ) ) ; navigation_observer . Wait ( ) ; int num_downloads_blocking = 0 ; ASSERT_EQ ( Browser : : DOWNLOAD_CLOSE_OK , otr_browser -> OkToCloseWithInProgressDownloads ( & num_downloads_blocking ) ) ; ASSERT_EQ ( 0 , num_downloads_blocking ) ; { RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 1 ) ; otr_browser -> window ( ) -> Close ( ) ; close_observer . Wait ( ) ; } ASSERT_EQ ( Browser : : DOWNLOAD_CLOSE_BROWSER_SHUTDOWN , browser ( ) -> OkToCloseWithInProgressDownloads ( & num_downloads_blocking ) ) ; ASSERT_EQ ( 1 , num_downloads_blocking ) ; { RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 2 ) ; TestBrowserCloseManager : : AttemptClose ( TestBrowserCloseManager : : USER_CHOICE_USER_ALLOWS_CLOSE ) ; close_observer . Wait ( ) ; } EXPECT_TRUE ( browser_shutdown : : IsTryingToQuit ( ) ) ; EXPECT_TRUE ( BrowserList : : GetInstance ( ) -> empty ( ) ) ; if ( browser_defaults : : kBrowserAliveWithNoWindows ) EXPECT_EQ ( 1 , DownloadCoreService : : NonMaliciousDownloadCountAllProfiles ( ) ) ; else EXPECT_EQ ( 0 , DownloadCoreService : : NonMaliciousDownloadCountAllProfiles ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void register_ber_oid_name ( const char * oid , const char * name ) { oid_add_from_string ( name , oid ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean lacks_directory_count ( NautilusFile * file ) { return ! file -> details -> directory_count_is_up_to_date && nautilus_file_should_show_directory_item_count ( file ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int amrwb_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) { AMRWBContext * ctx = avctx -> priv_data ; AVFrame * frame = data ; AMRWBFrame * cf = & ctx -> frame ; const uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; int expected_fr_size , header_size ; float * buf_out ; float spare_vector [ AMRWB_SFR_SIZE ] ; float fixed_gain_factor ; float * synth_fixed_vector ; float synth_fixed_gain ; float voice_fac , stab_fac ; float synth_exc [ AMRWB_SFR_SIZE ] ; float hb_exc [ AMRWB_SFR_SIZE_16k ] ; float hb_samples [ AMRWB_SFR_SIZE_16k ] ; float hb_gain ; int sub , i , ret ; frame -> nb_samples = 4 * AMRWB_SFR_SIZE_16k ; if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } buf_out = ( float * ) frame -> data [ 0 ] ; header_size = decode_mime_header ( ctx , buf ) ; if ( ctx -> fr_cur_mode > MODE_SID ) { av_log ( avctx , AV_LOG_ERROR , "Invalid mode %d\n" , ctx -> fr_cur_mode ) ; return AVERROR_INVALIDDATA ; } expected_fr_size = ( ( cf_sizes_wb [ ctx -> fr_cur_mode ] + 7 ) >> 3 ) + 1 ; if ( buf_size < expected_fr_size ) { av_log ( avctx , AV_LOG_ERROR , "Frame too small (%d bytes). Truncated file?\n" , buf_size ) ; * got_frame_ptr = 0 ; return AVERROR_INVALIDDATA ; } if ( ! ctx -> fr_quality || ctx -> fr_cur_mode > MODE_SID ) av_log ( avctx , AV_LOG_ERROR , "Encountered a bad or corrupted frame\n" ) ; if ( ctx -> fr_cur_mode == MODE_SID ) { av_log_missing_feature ( avctx , "SID mode" , 1 ) ; return AVERROR_PATCHWELCOME ; } ff_amr_bit_reorder ( ( uint16_t * ) & ctx -> frame , sizeof ( AMRWBFrame ) , buf + header_size , amr_bit_orderings_by_mode [ ctx -> fr_cur_mode ] ) ; if ( ctx -> fr_cur_mode == MODE_6k60 ) { decode_isf_indices_36b ( cf -> isp_id , ctx -> isf_cur ) ; } else { decode_isf_indices_46b ( cf -> isp_id , ctx -> isf_cur ) ; } isf_add_mean_and_past ( ctx -> isf_cur , ctx -> isf_q_past ) ; ff_set_min_dist_lsf ( ctx -> isf_cur , MIN_ISF_SPACING , LP_ORDER - 1 ) ; stab_fac = stability_factor ( ctx -> isf_cur , ctx -> isf_past_final ) ; ctx -> isf_cur [ LP_ORDER - 1 ] *= 2.0 ; ff_acelp_lsf2lspd ( ctx -> isp [ 3 ] , ctx -> isf_cur , LP_ORDER ) ; if ( ctx -> first_frame ) { ctx -> first_frame = 0 ; memcpy ( ctx -> isp_sub4_past , ctx -> isp [ 3 ] , LP_ORDER * sizeof ( double ) ) ; } interpolate_isp ( ctx -> isp , ctx -> isp_sub4_past ) ; for ( sub = 0 ; sub < 4 ; sub ++ ) ff_amrwb_lsp2lpc ( ctx -> isp [ sub ] , ctx -> lp_coef [ sub ] , LP_ORDER ) ; for ( sub = 0 ; sub < 4 ; sub ++ ) { const AMRWBSubFrame * cur_subframe = & cf -> subframe [ sub ] ; float * sub_buf = buf_out + sub * AMRWB_SFR_SIZE_16k ; decode_pitch_vector ( ctx , cur_subframe , sub ) ; decode_fixed_vector ( ctx -> fixed_vector , cur_subframe -> pul_ih , cur_subframe -> pul_il , ctx -> fr_cur_mode ) ; pitch_sharpening ( ctx , ctx -> fixed_vector ) ; decode_gains ( cur_subframe -> vq_gain , ctx -> fr_cur_mode , & fixed_gain_factor , & ctx -> pitch_gain [ 0 ] ) ; ctx -> fixed_gain [ 0 ] = ff_amr_set_fixed_gain ( fixed_gain_factor , avpriv_scalarproduct_float_c ( ctx -> fixed_vector , ctx -> fixed_vector , AMRWB_SFR_SIZE ) / AMRWB_SFR_SIZE , ctx -> prediction_error , ENERGY_MEAN , energy_pred_fac ) ; voice_fac = voice_factor ( ctx -> pitch_vector , ctx -> pitch_gain [ 0 ] , ctx -> fixed_vector , ctx -> fixed_gain [ 0 ] ) ; ctx -> tilt_coef = voice_fac * 0.25 + 0.25 ; for ( i = 0 ; i < AMRWB_SFR_SIZE ; i ++ ) { ctx -> excitation [ i ] *= ctx -> pitch_gain [ 0 ] ; ctx -> excitation [ i ] += ctx -> fixed_gain [ 0 ] * ctx -> fixed_vector [ i ] ; ctx -> excitation [ i ] = truncf ( ctx -> excitation [ i ] ) ; } synth_fixed_gain = noise_enhancer ( ctx -> fixed_gain [ 0 ] , & ctx -> prev_tr_gain , voice_fac , stab_fac ) ; synth_fixed_vector = anti_sparseness ( ctx , ctx -> fixed_vector , spare_vector ) ; pitch_enhancer ( synth_fixed_vector , voice_fac ) ; synthesis ( ctx , ctx -> lp_coef [ sub ] , synth_exc , synth_fixed_gain , synth_fixed_vector , & ctx -> samples_az [ LP_ORDER ] ) ; de_emphasis ( & ctx -> samples_up [ UPS_MEM_SIZE ] , & ctx -> samples_az [ LP_ORDER ] , PREEMPH_FAC , ctx -> demph_mem ) ; ff_acelp_apply_order_2_transfer_function ( & ctx -> samples_up [ UPS_MEM_SIZE ] , & ctx -> samples_up [ UPS_MEM_SIZE ] , hpf_zeros , hpf_31_poles , hpf_31_gain , ctx -> hpf_31_mem , AMRWB_SFR_SIZE ) ; upsample_5_4 ( sub_buf , & ctx -> samples_up [ UPS_FIR_SIZE ] , AMRWB_SFR_SIZE_16k ) ; ff_acelp_apply_order_2_transfer_function ( hb_samples , & ctx -> samples_up [ UPS_MEM_SIZE ] , hpf_zeros , hpf_400_poles , hpf_400_gain , ctx -> hpf_400_mem , AMRWB_SFR_SIZE ) ; hb_gain = find_hb_gain ( ctx , hb_samples , cur_subframe -> hb_gain , cf -> vad ) ; scaled_hb_excitation ( ctx , hb_exc , synth_exc , hb_gain ) ; hb_synthesis ( ctx , sub , & ctx -> samples_hb [ LP_ORDER_16k ] , hb_exc , ctx -> isf_cur , ctx -> isf_past_final ) ; hb_fir_filter ( hb_samples , bpf_6_7_coef , ctx -> bpf_6_7_mem , & ctx -> samples_hb [ LP_ORDER_16k ] ) ; if ( ctx -> fr_cur_mode == MODE_23k85 ) hb_fir_filter ( hb_samples , lpf_7_coef , ctx -> lpf_7_mem , hb_samples ) ; for ( i = 0 ; i < AMRWB_SFR_SIZE_16k ; i ++ ) sub_buf [ i ] = ( sub_buf [ i ] + hb_samples [ i ] ) * ( 1.0f / ( 1 << 15 ) ) ; update_sub_state ( ctx ) ; } memcpy ( ctx -> isp_sub4_past , ctx -> isp [ 3 ] , LP_ORDER * sizeof ( ctx -> isp [ 3 ] [ 0 ] ) ) ; memcpy ( ctx -> isf_past_final , ctx -> isf_cur , LP_ORDER * sizeof ( float ) ) ; * got_frame_ptr = 1 ; return expected_fr_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_rsvp_label_set ( proto_item * ti , proto_tree * rsvp_object_tree , tvbuff_t * tvb , int offset , int obj_length , int rsvp_class _U_ , int type ) { int offset2 = offset + 8 ; guint8 label_type ; int len , i ; len = obj_length - 8 ; proto_tree_add_uint ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type ) ; proto_tree_add_item ( rsvp_object_tree , hf_rsvp_label_set_action , tvb , offset + 4 , 1 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( ti , ": %s" , val_to_str ( tvb_get_guint8 ( tvb , offset + 4 ) , action_type_vals , "Unknown (%u)" ) ) ; label_type = tvb_get_guint8 ( tvb , offset + 7 ) ; proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_label_set_type , tvb , offset + 7 , 1 , label_type , "%s" , ( label_type == 1 ) ? "Packet Label" : "Generalized Label" ) ; proto_item_append_text ( ti , ", %s" , ( label_type == 1 ) ? "Packet Label: " : "Generalized Label: " ) ; for ( i = 0 ; i < len / 4 ; i ++ ) { guint32 subchannel = tvb_get_ntohl ( tvb , offset2 + i * 4 ) ; proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_label_set_subchannel , tvb , offset2 + i * 4 , 4 , subchannel , "Subchannel %u: %u (0x%x)" , i + 1 , subchannel , subchannel ) ; if ( i < 5 ) { if ( i != 0 ) proto_item_append_text ( ti , ", " ) ; proto_item_append_text ( ti , "%u" , tvb_get_ntohl ( tvb , offset2 + i * 4 ) ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void xps_begin_opacity ( xps_document * doc , const fz_matrix * ctm , const fz_rect * area , char * base_uri , xps_resource * dict , char * opacity_att , fz_xml * opacity_mask_tag ) { float opacity ; if ( ! opacity_att && ! opacity_mask_tag ) return ; opacity = 1 ; if ( opacity_att ) opacity = fz_atof ( opacity_att ) ; if ( opacity_mask_tag && ! strcmp ( fz_xml_tag ( opacity_mask_tag ) , "SolidColorBrush" ) ) { char * scb_opacity_att = fz_xml_att ( opacity_mask_tag , "Opacity" ) ; char * scb_color_att = fz_xml_att ( opacity_mask_tag , "Color" ) ; if ( scb_opacity_att ) opacity = opacity * fz_atof ( scb_opacity_att ) ; if ( scb_color_att ) { fz_colorspace * colorspace ; float samples [ 32 ] ; xps_parse_color ( doc , base_uri , scb_color_att , & colorspace , samples ) ; opacity = opacity * samples [ 0 ] ; } opacity_mask_tag = NULL ; } if ( doc -> opacity_top + 1 < nelem ( doc -> opacity ) ) { doc -> opacity [ doc -> opacity_top + 1 ] = doc -> opacity [ doc -> opacity_top ] * opacity ; doc -> opacity_top ++ ; } if ( opacity_mask_tag ) { fz_begin_mask ( doc -> dev , area , 0 , NULL , NULL ) ; xps_parse_brush ( doc , ctm , area , base_uri , dict , opacity_mask_tag ) ; fz_end_mask ( doc -> dev ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileObject , next ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; if ( zend_parse_parameters_none ( ) == FAILURE ) { return ; } spl_filesystem_file_free_line ( intern TSRMLS_CC ) ; if ( SPL_HAS_FLAG ( intern -> flags , SPL_FILE_OBJECT_READ_AHEAD ) ) { spl_filesystem_file_read_line ( getThis ( ) , intern , 1 TSRMLS_CC ) ; } intern -> u . file . current_line_num ++ ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static inline MagickRealType AbsolutePixelValue ( const MagickRealType x ) { return ( x < 0.0f ? - x : x ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
err_status_t srtp_kdf_init ( srtp_kdf_t * kdf , cipher_type_id_t cipher_id , const uint8_t * key , int length ) { err_status_t stat ; stat = crypto_kernel_alloc_cipher ( cipher_id , & kdf -> cipher , length , 0 ) ; if ( stat ) return stat ; stat = cipher_init ( kdf -> cipher , key ) ; if ( stat ) { cipher_dealloc ( kdf -> cipher ) ; return stat ; } return err_status_ok ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int wep_decrypt ( u_char * buf , size_t len , u_char * wkey , size_t wlen ) { RC4_KEY key ; u_char seed [ 32 ] ; struct wep_header * wep ; u_char * encbuf ; u_char decbuf [ len ] ; if ( wlen == 0 ) return - E_NOTHANDLED ; wep = ( struct wep_header * ) buf ; len -= sizeof ( struct wep_header ) ; wep -> key >>= 6 ; if ( wep -> key * 5 > ( int ) ( MAX_WKEY_LEN - wlen ) ) { return - E_NOTHANDLED ; } encbuf = ( u_char * ) ( wep + 1 ) ; memcpy ( seed , wep -> init_vector , WEP_IV_LEN ) ; memcpy ( seed + WEP_IV_LEN , & wkey [ wep -> key * 5 ] , wlen ) ; RC4_set_key ( & key , WEP_IV_LEN + wlen , seed ) ; RC4 ( & key , len + WEP_CRC_LEN , encbuf , decbuf ) ; if ( CRC_checksum ( decbuf , len + WEP_CRC_LEN , CRC_INIT ) != CRC_RESULT ) { return - E_NOTHANDLED ; } memcpy ( buf , decbuf , len ) ; memset ( buf + len , 0 , WEP_CRC_LEN ) ; return E_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_ME_finiteRepeatCount ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 116 "../../asn1/h245/h245.cnf" guint32 value ; offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 65535U , & value , FALSE ) ; h223_me -> repeat_count = value & 0xffff ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_want_only_once ( void ) { struct event ev ; struct timeval tv ; setup_test ( "Want read only once: " ) ; write ( pair [ 0 ] , TEST1 , strlen ( TEST1 ) + 1 ) ; evutil_timerclear ( & tv ) ; tv . tv_sec = 1 ; event_loopexit ( & tv ) ; event_set ( & ev , pair [ 1 ] , EV_READ , read_once_cb , & ev ) ; if ( event_add ( & ev , NULL ) == - 1 ) exit ( 1 ) ; event_dispatch ( ) ; cleanup_test ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void fz_cmm_fin_link ( fz_context * ctx , fz_icclink * link ) { if ( ctx && ctx -> colorspace && ctx -> colorspace -> cmm && ctx -> cmm_instance ) ctx -> colorspace -> cmm -> fin_link ( ctx -> cmm_instance , link ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int64_t unix_to_file_time ( int ti ) { int64_t t ; t = ti * INT64_C ( 10000000 ) ; t += INT64_C ( 116444736000000000 ) ; return t ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ogg_save ( AVFormatContext * s ) { struct ogg * ogg = s -> priv_data ; struct ogg_state * ost = av_malloc ( sizeof ( * ost ) + ( ogg -> nstreams - 1 ) * sizeof ( * ogg -> streams ) ) ; int i ; int ret = 0 ; if ( ! ost ) return AVERROR ( ENOMEM ) ; ost -> pos = avio_tell ( s -> pb ) ; ost -> curidx = ogg -> curidx ; ost -> next = ogg -> state ; ost -> nstreams = ogg -> nstreams ; memcpy ( ost -> streams , ogg -> streams , ogg -> nstreams * sizeof ( * ogg -> streams ) ) ; for ( i = 0 ; i < ogg -> nstreams ; i ++ ) { struct ogg_stream * os = ogg -> streams + i ; os -> buf = av_mallocz ( os -> bufsize + AV_INPUT_BUFFER_PADDING_SIZE ) ; if ( os -> buf ) memcpy ( os -> buf , ost -> streams [ i ] . buf , os -> bufpos ) ; else ret = AVERROR ( ENOMEM ) ; os -> new_metadata = NULL ; os -> new_metadata_size = 0 ; } ogg -> state = ost ; if ( ret < 0 ) ogg_restore ( s , 0 ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static VALUE mString_Extend_json_create ( VALUE self , VALUE o ) { VALUE ary ; Check_Type ( o , T_HASH ) ; ary = rb_hash_aref ( o , rb_str_new2 ( "raw" ) ) ; return rb_funcall ( ary , i_pack , 1 , rb_str_new2 ( "C*" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vmsvga_value_write ( void * opaque , uint32_t address , uint32_t value ) { struct vmsvga_state_s * s = opaque ; if ( s -> index >= SVGA_SCRATCH_BASE ) { trace_vmware_scratch_write ( s -> index , value ) ; } else if ( s -> index >= SVGA_PALETTE_BASE ) { trace_vmware_palette_write ( s -> index , value ) ; } else { trace_vmware_value_write ( s -> index , value ) ; } switch ( s -> index ) { case SVGA_REG_ID : if ( value == SVGA_ID_2 || value == SVGA_ID_1 || value == SVGA_ID_0 ) { s -> svgaid = value ; } break ; case SVGA_REG_ENABLE : s -> enable = ! ! value ; s -> invalidated = 1 ; s -> vga . hw_ops -> invalidate ( & s -> vga ) ; if ( s -> enable && s -> config ) { vga_dirty_log_stop ( & s -> vga ) ; } else { vga_dirty_log_start ( & s -> vga ) ; } break ; case SVGA_REG_WIDTH : if ( value <= SVGA_MAX_WIDTH ) { s -> new_width = value ; s -> invalidated = 1 ; } else { printf ( "%s: Bad width: %i\n" , __func__ , value ) ; } break ; case SVGA_REG_HEIGHT : if ( value <= SVGA_MAX_HEIGHT ) { s -> new_height = value ; s -> invalidated = 1 ; } else { printf ( "%s: Bad height: %i\n" , __func__ , value ) ; } break ; case SVGA_REG_BITS_PER_PIXEL : if ( value != 32 ) { printf ( "%s: Bad bits per pixel: %i bits\n" , __func__ , value ) ; s -> config = 0 ; s -> invalidated = 1 ; } break ; case SVGA_REG_CONFIG_DONE : if ( value ) { s -> fifo = ( uint32_t * ) s -> fifo_ptr ; if ( ( CMD ( min ) | CMD ( max ) | CMD ( next_cmd ) | CMD ( stop ) ) & 3 ) { break ; } if ( CMD ( min ) < ( uint8_t * ) s -> cmd -> fifo - ( uint8_t * ) s -> fifo ) { break ; } if ( CMD ( max ) > SVGA_FIFO_SIZE ) { break ; } if ( CMD ( max ) < CMD ( min ) + 10 * 1024 ) { break ; } vga_dirty_log_stop ( & s -> vga ) ; } s -> config = ! ! value ; break ; case SVGA_REG_SYNC : s -> syncing = 1 ; vmsvga_fifo_run ( s ) ; break ; case SVGA_REG_GUEST_ID : s -> guest = value ; # ifdef VERBOSE if ( value >= GUEST_OS_BASE && value < GUEST_OS_BASE + ARRAY_SIZE ( vmsvga_guest_id ) ) { printf ( "%s: guest runs %s.\n" , __func__ , vmsvga_guest_id [ value - GUEST_OS_BASE ] ) ; } # endif break ; case SVGA_REG_CURSOR_ID : s -> cursor . id = value ; break ; case SVGA_REG_CURSOR_X : s -> cursor . x = value ; break ; case SVGA_REG_CURSOR_Y : s -> cursor . y = value ; break ; case SVGA_REG_CURSOR_ON : s -> cursor . on |= ( value == SVGA_CURSOR_ON_SHOW ) ; s -> cursor . on &= ( value != SVGA_CURSOR_ON_HIDE ) ; # ifdef HW_MOUSE_ACCEL if ( value <= SVGA_CURSOR_ON_SHOW ) { dpy_mouse_set ( s -> vga . con , s -> cursor . x , s -> cursor . y , s -> cursor . on ) ; } # endif break ; case SVGA_REG_DEPTH : case SVGA_REG_MEM_REGS : case SVGA_REG_NUM_DISPLAYS : case SVGA_REG_PITCHLOCK : case SVGA_PALETTE_BASE ... SVGA_PALETTE_END : break ; default : if ( s -> index >= SVGA_SCRATCH_BASE && s -> index < SVGA_SCRATCH_BASE + s -> scratch_size ) { s -> scratch [ s -> index - SVGA_SCRATCH_BASE ] = value ; break ; } printf ( "%s: Bad register %02x\n" , __func__ , s -> index ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void usb_ohci_realize_pci ( PCIDevice * dev , Error * * errp ) { Error * err = NULL ; OHCIPCIState * ohci = PCI_OHCI ( dev ) ; dev -> config [ PCI_CLASS_PROG ] = 0x10 ; dev -> config [ PCI_INTERRUPT_PIN ] = 0x01 ; usb_ohci_init ( & ohci -> state , DEVICE ( dev ) , ohci -> num_ports , 0 , ohci -> masterbus , ohci -> firstport , pci_get_address_space ( dev ) , & err ) ; if ( err ) { error_propagate ( errp , err ) ; return ; } ohci -> state . irq = pci_allocate_irq ( dev ) ; pci_register_bar ( dev , 0 , 0 , & ohci -> state . mem ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static unsigned int _warc_rdver ( const char * buf , size_t bsz ) { static const char magic [ ] = "WARC/" ; const char * c ; unsigned int ver = 0U ; unsigned int end = 0U ; if ( bsz < 12 || memcmp ( buf , magic , sizeof ( magic ) - 1U ) != 0 ) { return ver ; } buf += sizeof ( magic ) - 1U ; if ( isdigit ( ( unsigned char ) buf [ 0U ] ) && ( buf [ 1U ] == '.' ) && isdigit ( ( unsigned char ) buf [ 2U ] ) ) { if ( isdigit ( ( unsigned char ) buf [ 3U ] ) ) end = 1U ; ver = ( buf [ 0U ] - '0' ) * 10000U ; if ( end == 1U ) { ver += ( buf [ 2U ] - '0' ) * 1000U ; ver += ( buf [ 3U ] - '0' ) * 100U ; } else ver += ( buf [ 2U ] - '0' ) * 100U ; c = buf + 3U + end ; if ( ver >= 1200U ) { if ( memcmp ( c , "\r\n" , 2U ) != 0 ) ver = 0U ; } else if ( ver < 1200U ) { if ( * c != ' ' && * c != '\t' ) ver = 0U ; } } return ver ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void fz_drop_colorspace_store_key ( fz_context * ctx , fz_colorspace * cs ) { fz_drop_key_storable_key ( ctx , & cs -> key_storable ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void parse_new_blob ( void ) { read_next_command ( ) ; parse_mark ( ) ; parse_and_store_blob ( & last_blob , NULL , next_mark ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint64 _tiffSeekProc ( thandle_t fd , uint64 off , int whence ) { fd_as_handle_union_t fdh ; _TIFF_off_t off_io = ( _TIFF_off_t ) off ; if ( ( uint64 ) off_io != off ) { errno = EINVAL ; return ( uint64 ) - 1 ; } fdh . h = fd ; return ( ( uint64 ) _TIFF_lseek_f ( fdh . fd , off_io , whence ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void cmd_server ( const char * data ) { if ( * data != '\0' ) return ; if ( servers == NULL && lookup_servers == NULL && reconnects == NULL ) { printformat ( NULL , NULL , MSGLEVEL_CLIENTNOTICE , TXT_NO_CONNECTED_SERVERS ) ; } else { print_servers ( ) ; print_lookup_servers ( ) ; print_reconnects ( ) ; } signal_stop ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const char * symbname ( u_short token ) { char * name ; if ( token < COUNTOF ( symb ) && symb [ token ] != NULL ) { name = symb [ token ] ; } else { LIB_GETBUF ( name ) ; snprintf ( name , LIB_BUFLENGTH , "%d" , token ) ; } return name ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_find_best_sub_pixel_tree_pruned ( const MACROBLOCK * x , MV * bestmv , const MV * ref_mv , int allow_hp , int error_per_bit , const vp9_variance_fn_ptr_t * vfp , int forced_stop , int iters_per_step , int * sad_list , int * mvjcost , int * mvcost [ 2 ] , int * distortion , unsigned int * sse1 , const uint8_t * second_pred , int w , int h ) { SETUP_SUBPEL_SEARCH ; if ( sad_list && sad_list [ 0 ] != INT_MAX && sad_list [ 1 ] != INT_MAX && sad_list [ 2 ] != INT_MAX && sad_list [ 3 ] != INT_MAX && sad_list [ 4 ] != INT_MAX ) { unsigned int left , right , up , down , diag ; whichdir = ( sad_list [ 1 ] < sad_list [ 3 ] ? 0 : 1 ) + ( sad_list [ 2 ] < sad_list [ 4 ] ? 0 : 2 ) ; switch ( whichdir ) { case 0 : CHECK_BETTER ( left , tr , tc - hstep ) ; CHECK_BETTER ( up , tr - hstep , tc ) ; CHECK_BETTER ( diag , tr - hstep , tc - hstep ) ; break ; case 1 : CHECK_BETTER ( right , tr , tc + hstep ) ; CHECK_BETTER ( up , tr - hstep , tc ) ; CHECK_BETTER ( diag , tr - hstep , tc + hstep ) ; break ; case 2 : CHECK_BETTER ( left , tr , tc - hstep ) ; CHECK_BETTER ( down , tr + hstep , tc ) ; CHECK_BETTER ( diag , tr + hstep , tc - hstep ) ; break ; case 3 : CHECK_BETTER ( right , tr , tc + hstep ) ; CHECK_BETTER ( down , tr + hstep , tc ) ; CHECK_BETTER ( diag , tr + hstep , tc + hstep ) ; break ; } } else { FIRST_LEVEL_CHECKS ; if ( halfiters > 1 ) { SECOND_LEVEL_CHECKS ; } } tr = br ; tc = bc ; if ( forced_stop != 2 ) { hstep >>= 1 ; FIRST_LEVEL_CHECKS ; if ( quarteriters > 1 ) { SECOND_LEVEL_CHECKS ; } tr = br ; tc = bc ; } if ( allow_hp && vp9_use_mv_hp ( ref_mv ) && forced_stop == 0 ) { hstep >>= 1 ; FIRST_LEVEL_CHECKS ; if ( eighthiters > 1 ) { SECOND_LEVEL_CHECKS ; } tr = br ; tc = bc ; } ( void ) tr ; ( void ) tc ; bestmv -> row = br ; bestmv -> col = bc ; if ( ( abs ( bestmv -> col - ref_mv -> col ) > ( MAX_FULL_PEL_VAL << 3 ) ) || ( abs ( bestmv -> row - ref_mv -> row ) > ( MAX_FULL_PEL_VAL << 3 ) ) ) return INT_MAX ; return besterr ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void RTP_packet_draw ( void * prs _U_ ) { voip_rtp_tapinfo_t * rtp_tapinfo = & the_tapinfo_rtp_struct ; GList * rtp_streams_list ; voip_rtp_stream_info_t * rtp_listinfo ; seq_analysis_item_t * gai ; seq_analysis_item_t * new_gai ; guint16 conv_num ; guint32 duration ; gchar time_str [ COL_MAX_LEN ] ; rtp_streams_list = g_list_first ( rtp_tapinfo -> list ) ; while ( rtp_streams_list ) { rtp_listinfo = ( voip_rtp_stream_info_t * ) rtp_streams_list -> data ; gai = ( seq_analysis_item_t * ) g_hash_table_lookup ( the_tapinfo_struct . graph_analysis -> ht , & rtp_listinfo -> setup_frame_number ) ; if ( gai != NULL ) { conv_num = gai -> conv_num ; gai = ( seq_analysis_item_t * ) g_hash_table_lookup ( the_tapinfo_struct . graph_analysis -> ht , & rtp_listinfo -> start_fd -> num ) ; if ( gai != NULL ) { duration = ( guint32 ) ( nstime_to_msec ( & rtp_listinfo -> stop_rel_ts ) - nstime_to_msec ( & rtp_listinfo -> start_rel_ts ) ) ; g_free ( gai -> comment ) ; gai -> comment = g_strdup_printf ( "%s Num packets:%u Duration:%u.%03us SSRC:0x%X" , ( rtp_listinfo -> is_srtp ) ? "SRTP" : "RTP" , rtp_listinfo -> npackets , duration / 1000 , ( duration % 1000 ) , rtp_listinfo -> ssrc ) ; } else { new_gai = ( seq_analysis_item_t * ) g_malloc ( sizeof ( seq_analysis_item_t ) ) ; new_gai -> fd = rtp_listinfo -> start_fd ; COPY_ADDRESS ( & ( new_gai -> src_addr ) , & ( rtp_listinfo -> src_addr ) ) ; COPY_ADDRESS ( & ( new_gai -> dst_addr ) , & ( rtp_listinfo -> dest_addr ) ) ; new_gai -> port_src = rtp_listinfo -> src_port ; new_gai -> port_dst = rtp_listinfo -> dest_port ; duration = ( guint32 ) ( nstime_to_msec ( & rtp_listinfo -> stop_rel_ts ) - nstime_to_msec ( & rtp_listinfo -> start_rel_ts ) ) ; new_gai -> frame_label = g_strdup_printf ( "%s (%s) %s" , ( rtp_listinfo -> is_srtp ) ? "SRTP" : "RTP" , rtp_listinfo -> pt_str , ( rtp_listinfo -> rtp_event == - 1 ) ? "" : val_to_str_ext_const ( rtp_listinfo -> rtp_event , & rtp_event_type_values_ext , "Unknown RTP Event" ) ) ; new_gai -> comment = g_strdup_printf ( "%s Num packets:%u Duration:%u.%03us SSRC:0x%X" , ( rtp_listinfo -> is_srtp ) ? "SRTP" : "RTP" , rtp_listinfo -> npackets , duration / 1000 , ( duration % 1000 ) , rtp_listinfo -> ssrc ) ; new_gai -> conv_num = conv_num ; set_fd_time ( cfile . epan , new_gai -> fd , time_str ) ; new_gai -> time_str = g_strdup ( time_str ) ; new_gai -> display = FALSE ; new_gai -> line_style = 2 ; the_tapinfo_struct . graph_analysis -> list = g_list_prepend ( the_tapinfo_struct . graph_analysis -> list , new_gai ) ; g_hash_table_insert ( the_tapinfo_struct . graph_analysis -> ht , & rtp_listinfo -> start_fd , new_gai ) ; } } rtp_streams_list = g_list_next ( rtp_streams_list ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( ExternalProtocolDialogBrowserTest , TestCancel ) { ShowDialog ( ) ; EXPECT_TRUE ( dialog_ -> Cancel ( ) ) ; EXPECT_FALSE ( called_ ) ; EXPECT_FALSE ( accept_ ) ; EXPECT_FALSE ( remember_ ) ; histogram_tester_ . ExpectBucketCount ( ExternalProtocolHandler : : kHandleStateMetric , ExternalProtocolHandler : : DONT_LAUNCH , 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void jbig2_free_segment ( Jbig2Ctx * ctx , Jbig2Segment * segment ) { if ( segment -> referred_to_segments != NULL ) { jbig2_free ( ctx -> allocator , segment -> referred_to_segments ) ; } switch ( segment -> flags & 63 ) { case 0 : if ( segment -> result != NULL ) jbig2_sd_release ( ctx , ( Jbig2SymbolDict * ) segment -> result ) ; break ; case 4 : case 40 : if ( segment -> result != NULL ) jbig2_image_release ( ctx , ( Jbig2Image * ) segment -> result ) ; break ; case 16 : if ( segment -> result != NULL ) jbig2_hd_release ( ctx , ( Jbig2PatternDict * ) segment -> result ) ; break ; case 53 : if ( segment -> result != NULL ) jbig2_table_free ( ctx , ( Jbig2HuffmanParams * ) segment -> result ) ; break ; case 62 : if ( segment -> result != NULL ) jbig2_metadata_free ( ctx , ( Jbig2Metadata * ) segment -> result ) ; break ; default : break ; } jbig2_free ( ctx -> allocator , segment ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void decode_flush ( AVCodecContext * avctx ) { RALFContext * ctx = avctx -> priv_data ; ctx -> has_pkt = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ffprobe_show_pixel_formats ( WriterContext * w ) { const AVPixFmtDescriptor * pixdesc = NULL ; int i , n ; writer_print_section_header ( w , SECTION_ID_PIXEL_FORMATS ) ; while ( pixdesc = av_pix_fmt_desc_next ( pixdesc ) ) { writer_print_section_header ( w , SECTION_ID_PIXEL_FORMAT ) ; print_str ( "name" , pixdesc -> name ) ; print_int ( "nb_components" , pixdesc -> nb_components ) ; if ( ( pixdesc -> nb_components >= 3 ) && ! ( pixdesc -> flags & AV_PIX_FMT_FLAG_RGB ) ) { print_int ( "log2_chroma_w" , pixdesc -> log2_chroma_w ) ; print_int ( "log2_chroma_h" , pixdesc -> log2_chroma_h ) ; } else { print_str_opt ( "log2_chroma_w" , "N/A" ) ; print_str_opt ( "log2_chroma_h" , "N/A" ) ; } n = av_get_bits_per_pixel ( pixdesc ) ; if ( n ) print_int ( "bits_per_pixel" , n ) ; else print_str_opt ( "bits_per_pixel" , "N/A" ) ; if ( do_show_pixel_format_flags ) { writer_print_section_header ( w , SECTION_ID_PIXEL_FORMAT_FLAGS ) ; PRINT_PIX_FMT_FLAG ( BE , "big_endian" ) ; PRINT_PIX_FMT_FLAG ( PAL , "palette" ) ; PRINT_PIX_FMT_FLAG ( BITSTREAM , "bitstream" ) ; PRINT_PIX_FMT_FLAG ( HWACCEL , "hwaccel" ) ; PRINT_PIX_FMT_FLAG ( PLANAR , "planar" ) ; PRINT_PIX_FMT_FLAG ( RGB , "rgb" ) ; PRINT_PIX_FMT_FLAG ( PSEUDOPAL , "pseudopal" ) ; PRINT_PIX_FMT_FLAG ( ALPHA , "alpha" ) ; writer_print_section_footer ( w ) ; } if ( do_show_pixel_format_components && ( pixdesc -> nb_components > 0 ) ) { writer_print_section_header ( w , SECTION_ID_PIXEL_FORMAT_COMPONENTS ) ; for ( i = 0 ; i < pixdesc -> nb_components ; i ++ ) { writer_print_section_header ( w , SECTION_ID_PIXEL_FORMAT_COMPONENT ) ; print_int ( "index" , i + 1 ) ; print_int ( "bit_depth" , pixdesc -> comp [ i ] . depth ) ; writer_print_section_footer ( w ) ; } writer_print_section_footer ( w ) ; } writer_print_section_footer ( w ) ; } writer_print_section_footer ( w ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void xmlListPopFront ( xmlListPtr l ) { if ( ! xmlListEmpty ( l ) ) xmlLinkDeallocator ( l , l -> sentinel -> next ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TSTextLogObjectRollingIntervalSecSet ( TSTextLogObject the_object , int rolling_interval_sec ) { sdk_assert ( sdk_sanity_check_iocore_structure ( the_object ) == TS_SUCCESS ) ; ( ( TextLogObject * ) the_object ) -> set_rolling_interval_sec ( rolling_interval_sec ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplDoublyLinkedList , serialize ) { spl_dllist_object * intern = ( spl_dllist_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; smart_str buf = { 0 } ; spl_ptr_llist_element * current = intern -> llist -> head , * next ; zval * flags ; php_serialize_data_t var_hash ; if ( zend_parse_parameters_none ( ) == FAILURE ) { return ; } PHP_VAR_SERIALIZE_INIT ( var_hash ) ; MAKE_STD_ZVAL ( flags ) ; ZVAL_LONG ( flags , intern -> flags ) ; php_var_serialize ( & buf , & flags , & var_hash TSRMLS_CC ) ; zval_ptr_dtor ( & flags ) ; while ( current ) { smart_str_appendc ( & buf , ':' ) ; next = current -> next ; php_var_serialize ( & buf , ( zval * * ) & current -> data , & var_hash TSRMLS_CC ) ; current = next ; } smart_str_0 ( & buf ) ; PHP_VAR_SERIALIZE_DESTROY ( var_hash ) ; if ( buf . c ) { RETURN_STRINGL ( buf . c , buf . len , 0 ) ; } else { RETURN_NULL ( ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int check_nnp_nosuid ( const struct linux_binprm * bprm , const struct task_security_struct * old_tsec , const struct task_security_struct * new_tsec ) { int nnp = ( bprm -> unsafe & LSM_UNSAFE_NO_NEW_PRIVS ) ; int nosuid = ! mnt_may_suid ( bprm -> file -> f_path . mnt ) ; int rc ; if ( ! nnp && ! nosuid ) return 0 ; if ( new_tsec -> sid == old_tsec -> sid ) return 0 ; rc = security_bounded_transition ( old_tsec -> sid , new_tsec -> sid ) ; if ( rc ) { if ( nnp ) return - EPERM ; else return - EACCES ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_btgatt_microbit_magnetometer_bearing ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) { btatt_data_t * att_data = ( btatt_data_t * ) data ; gint offset = 0 ; if ( bluetooth_gatt_has_no_parameter ( att_data -> opcode ) ) return - 1 ; proto_tree_add_item ( tree , hf_gatt_microbit_magnetometer_bearing , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ; offset += 2 ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int rc_pick_q_and_bounds_one_pass_cbr ( const VP9_COMP * cpi , int * bottom_index , int * top_index ) { const VP9_COMMON * const cm = & cpi -> common ; const RATE_CONTROL * const rc = & cpi -> rc ; int active_best_quality ; int active_worst_quality = calc_active_worst_quality_one_pass_cbr ( cpi ) ; int q ; if ( frame_is_intra_only ( cm ) ) { active_best_quality = rc -> best_quality ; if ( rc -> this_key_frame_forced ) { int qindex = rc -> last_boosted_qindex ; double last_boosted_q = vp9_convert_qindex_to_q ( qindex ) ; int delta_qindex = vp9_compute_qdelta ( rc , last_boosted_q , ( last_boosted_q * 0.75 ) ) ; active_best_quality = MAX ( qindex + delta_qindex , rc -> best_quality ) ; } else if ( cm -> current_video_frame > 0 ) { double q_adj_factor = 1.0 ; double q_val ; active_best_quality = get_kf_active_quality ( rc , rc -> avg_frame_qindex [ KEY_FRAME ] ) ; if ( ( cm -> width * cm -> height ) <= ( 352 * 288 ) ) { q_adj_factor -= 0.25 ; } q_val = vp9_convert_qindex_to_q ( active_best_quality ) ; active_best_quality += vp9_compute_qdelta ( rc , q_val , q_val * q_adj_factor ) ; } } else if ( ! rc -> is_src_frame_alt_ref && ! cpi -> use_svc && ( cpi -> refresh_golden_frame || cpi -> refresh_alt_ref_frame ) ) { if ( rc -> frames_since_key > 1 && rc -> avg_frame_qindex [ INTER_FRAME ] < active_worst_quality ) { q = rc -> avg_frame_qindex [ INTER_FRAME ] ; } else { q = active_worst_quality ; } active_best_quality = get_gf_active_quality ( rc , q ) ; } else { if ( cm -> current_video_frame > 1 ) { if ( rc -> avg_frame_qindex [ INTER_FRAME ] < active_worst_quality ) active_best_quality = rtc_minq [ rc -> avg_frame_qindex [ INTER_FRAME ] ] ; else active_best_quality = rtc_minq [ active_worst_quality ] ; } else { if ( rc -> avg_frame_qindex [ KEY_FRAME ] < active_worst_quality ) active_best_quality = rtc_minq [ rc -> avg_frame_qindex [ KEY_FRAME ] ] ; else active_best_quality = rtc_minq [ active_worst_quality ] ; } } active_best_quality = clamp ( active_best_quality , rc -> best_quality , rc -> worst_quality ) ; active_worst_quality = clamp ( active_worst_quality , active_best_quality , rc -> worst_quality ) ; * top_index = active_worst_quality ; * bottom_index = active_best_quality ; # if LIMIT_QRANGE_FOR_ALTREF_AND_KEY if ( cm -> frame_type == KEY_FRAME && ! rc -> this_key_frame_forced && ! ( cm -> current_video_frame == 0 ) ) { int qdelta = 0 ; vp9_clear_system_state ( ) ; qdelta = vp9_compute_qdelta_by_rate ( & cpi -> rc , cm -> frame_type , active_worst_quality , 2.0 ) ; * top_index = active_worst_quality + qdelta ; * top_index = ( * top_index > * bottom_index ) ? * top_index : * bottom_index ; } # endif if ( cm -> frame_type == KEY_FRAME && rc -> this_key_frame_forced ) { q = rc -> last_boosted_qindex ; } else { q = vp9_rc_regulate_q ( cpi , rc -> this_frame_target , active_best_quality , active_worst_quality ) ; if ( q > * top_index ) { if ( rc -> this_frame_target >= rc -> max_frame_bandwidth ) * top_index = q ; else q = * top_index ; } } assert ( * top_index <= rc -> worst_quality && * top_index >= rc -> best_quality ) ; assert ( * bottom_index <= rc -> worst_quality && * bottom_index >= rc -> best_quality ) ; assert ( q <= rc -> worst_quality && q >= rc -> best_quality ) ; return q ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void icount_adjust_rt ( void * opaque ) { qemu_mod_timer ( icount_rt_timer , qemu_get_clock_ms ( rt_clock ) + 1000 ) ; icount_adjust ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) { return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) { return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ; } # define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ; typedef const char * OPENSSL_CSTRING ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * passphrase_callback ( struct archive * a , void * _client_data ) { struct cpio * cpio = ( struct cpio * ) _client_data ; ( void ) a ; if ( cpio -> ppbuff == NULL ) { cpio -> ppbuff = malloc ( PPBUFF_SIZE ) ; if ( cpio -> ppbuff == NULL ) lafe_errc ( 1 , errno , "Out of memory" ) ; } return lafe_readpassphrase ( "Enter passphrase:" , cpio -> ppbuff , PPBUFF_SIZE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void option_export_pack_edges ( const char * edges ) { if ( pack_edges ) fclose ( pack_edges ) ; pack_edges = fopen ( edges , "a" ) ; if ( ! pack_edges ) die_errno ( "Cannot open '%s'" , edges ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint8 dissect_zcl_ota_field_ctrl_field ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) { guint8 field ; static const int * field_ctrl [ ] = { & hf_zbee_zcl_ota_field_ctrl_hw_ver_present , & hf_zbee_zcl_ota_field_ctrl_reserved , NULL } ; field = tvb_get_guint8 ( tvb , * offset ) ; proto_tree_add_bitmask ( tree , tvb , * offset , hf_zbee_zcl_ota_field_ctrl , ett_zbee_zcl_ota_field_ctrl , field_ctrl , ENC_BIG_ENDIAN ) ; * offset += 1 ; return field ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_CapacityReportingSpecification ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_CapacityReportingSpecification , CapacityReportingSpecification_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileInfo , __construct ) { spl_filesystem_object * intern ; char * path ; int len ; zend_error_handling error_handling ; zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ; if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "s" , & path , & len ) == FAILURE ) { zend_restore_error_handling ( & error_handling TSRMLS_CC ) ; return ; } intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; spl_filesystem_info_set_filename ( intern , path , len , 1 TSRMLS_CC ) ; zend_restore_error_handling ( & error_handling TSRMLS_CC ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
MIMEField * mime_hdr_field_get ( MIMEHdrImpl * mh , int idx ) { unsigned int index ; MIMEFieldBlockImpl * fblock ; MIMEField * field ; int got_idx ; got_idx = - 1 ; for ( fblock = & ( mh -> m_first_fblock ) ; fblock != nullptr ; fblock = fblock -> m_next ) { for ( index = 0 ; index < fblock -> m_freetop ; index ++ ) { field = & ( fblock -> m_field_slots [ index ] ) ; if ( field -> is_live ( ) ) { ++ got_idx ; } if ( got_idx == idx ) { return field ; } } } return nullptr ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( NativeBackendLibsecretTest , SomeKeyringAttributesAreMissing ) { NativeBackendLibsecret backend ( 42 ) ; VerifiedAdd ( & backend , form_google_ ) ; EXPECT_EQ ( 1u , global_mock_libsecret_items -> size ( ) ) ; ( * global_mock_libsecret_items ) [ 0 ] -> RemoveAttribute ( "avatar_url" ) ; ( * global_mock_libsecret_items ) [ 0 ] -> RemoveAttribute ( "ssl_valid" ) ; ScopedVector < autofill : : PasswordForm > form_list ; EXPECT_TRUE ( backend . GetAutofillableLogins ( & form_list ) ) ; EXPECT_EQ ( 1u , form_list . size ( ) ) ; EXPECT_EQ ( GURL ( "" ) , form_list [ 0 ] -> icon_url ) ; EXPECT_FALSE ( form_list [ 0 ] -> ssl_valid ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static CURLcode http_perhapsrewind ( struct connectdata * conn ) { struct Curl_easy * data = conn -> data ; struct HTTP * http = data -> req . protop ; curl_off_t bytessent ; curl_off_t expectsend = - 1 ; if ( ! http ) return CURLE_OK ; switch ( data -> set . httpreq ) { case HTTPREQ_GET : case HTTPREQ_HEAD : return CURLE_OK ; default : break ; } bytessent = http -> writebytecount ; if ( conn -> bits . authneg ) { expectsend = 0 ; } else if ( ! conn -> bits . protoconnstart ) { expectsend = 0 ; } else { switch ( data -> set . httpreq ) { case HTTPREQ_POST : if ( data -> state . infilesize != - 1 ) expectsend = data -> state . infilesize ; else if ( data -> set . postfields ) expectsend = ( curl_off_t ) strlen ( data -> set . postfields ) ; break ; case HTTPREQ_PUT : if ( data -> state . infilesize != - 1 ) expectsend = data -> state . infilesize ; break ; case HTTPREQ_POST_FORM : expectsend = http -> postsize ; break ; default : break ; } } conn -> bits . rewindaftersend = FALSE ; if ( ( expectsend == - 1 ) || ( expectsend > bytessent ) ) { # if defined ( USE_NTLM ) if ( ( data -> state . authproxy . picked == CURLAUTH_NTLM ) || ( data -> state . authhost . picked == CURLAUTH_NTLM ) || ( data -> state . authproxy . picked == CURLAUTH_NTLM_WB ) || ( data -> state . authhost . picked == CURLAUTH_NTLM_WB ) ) { if ( ( ( expectsend - bytessent ) < 2000 ) || ( conn -> ntlm . state != NTLMSTATE_NONE ) || ( conn -> proxyntlm . state != NTLMSTATE_NONE ) ) { if ( ! conn -> bits . authneg ) { conn -> bits . rewindaftersend = TRUE ; infof ( data , "Rewind stream after send\n" ) ; } return CURLE_OK ; } if ( conn -> bits . close ) return CURLE_OK ; infof ( data , "NTLM send, close instead of sending %" CURL_FORMAT_CURL_OFF_T " bytes\n" , ( curl_off_t ) ( expectsend - bytessent ) ) ; } # endif streamclose ( conn , "Mid-auth HTTP and much data left to send" ) ; data -> req . size = 0 ; } if ( bytessent ) return Curl_readrewind ( conn ) ; return CURLE_OK ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_zbee_zcl_color_control ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) { proto_tree * payload_tree ; zbee_zcl_packet * zcl ; guint offset = 0 ; guint8 cmd_id ; gint rem_len ; if ( data == NULL ) return 0 ; zcl = ( zbee_zcl_packet * ) data ; cmd_id = zcl -> cmd_id ; if ( zcl -> direction == ZBEE_ZCL_FCF_TO_SERVER ) { col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s, Seq: %u" , val_to_str_const ( cmd_id , zbee_zcl_color_control_srv_rx_cmd_names , "Unknown Command" ) , zcl -> tran_seqno ) ; proto_tree_add_item ( tree , hf_zbee_zcl_color_control_srv_rx_cmd_id , tvb , offset , 1 , cmd_id ) ; rem_len = tvb_reported_length_remaining ( tvb , ++ offset ) ; if ( rem_len > 0 ) { payload_tree = proto_tree_add_subtree ( tree , tvb , offset , rem_len , ett_zbee_zcl_color_control , NULL , "Payload" ) ; switch ( cmd_id ) { case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE : dissect_zcl_color_control_move_to_hue ( tvb , payload_tree , & offset , ZBEE_ZCL_NORMAL_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_HUE : dissect_zcl_color_control_move_hue_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_NORMAL_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_HUE : dissect_zcl_color_control_step_hue_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_NORMAL_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_SATURATION : dissect_zcl_color_control_move_to_saturation ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_SATURATION : dissect_zcl_color_control_move_hue_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_NORMAL_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_SATURATION : dissect_zcl_color_control_step_hue_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_NORMAL_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_HUE_AND_SATURATION : dissect_zcl_color_control_move_to_hue_and_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_NORMAL_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR : dissect_zcl_color_control_move_to_color ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR : dissect_zcl_color_control_move_color ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR : dissect_zcl_color_control_step_color ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_TO_COLOR_TEMP : dissect_zcl_color_control_move_to_color_temp ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE : dissect_zcl_color_control_move_to_hue ( tvb , payload_tree , & offset , ZBEE_ZCL_ENHANCED_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_HUE : dissect_zcl_color_control_move_hue_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_ENHANCED_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_STEP_HUE : dissect_zcl_color_control_step_hue_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_ENHANCED_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_ENHANCED_MOVE_TO_HUE_AND_SATURATION : dissect_zcl_color_control_move_to_hue_and_saturation ( tvb , payload_tree , & offset , ZBEE_ZCL_ENHANCED_HUE ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_COLOR_LOOP_SET : dissect_zcl_color_control_color_loop_set ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_MOVE_COLOR_TEMP : dissect_zcl_color_control_move_color_temp ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STEP_COLOR_TEMP : dissect_zcl_color_control_step_color_temp ( tvb , payload_tree , & offset ) ; break ; case ZBEE_ZCL_CMD_ID_COLOR_CONTROL_STOP_MOVE_STEP : default : break ; } } } return tvb_captured_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int rds_next_incoming ( struct rds_sock * rs , struct rds_incoming * * inc ) { unsigned long flags ; if ( ! * inc ) { read_lock_irqsave ( & rs -> rs_recv_lock , flags ) ; if ( ! list_empty ( & rs -> rs_recv_queue ) ) { * inc = list_entry ( rs -> rs_recv_queue . next , struct rds_incoming , i_item ) ; rds_inc_addref ( * inc ) ; } read_unlock_irqrestore ( & rs -> rs_recv_lock , flags ) ; } return * inc != NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_DialedDigits ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 321 "./asn1/h225/h225.cnf" tvbuff_t * value_tvb = NULL ; guint len = 0 ; h225_packet_info * h225_pi ; offset = dissect_per_restricted_character_string ( tvb , offset , actx , tree , hf_index , 1 , 128 , FALSE , "0123456789#*," , 13 , & value_tvb ) ; h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ; if ( h225_pi && h225_pi -> is_destinationInfo == TRUE ) { if ( value_tvb ) { len = tvb_reported_length ( value_tvb ) ; if ( len > sizeof h225_pi -> dialedDigits - 1 ) len = sizeof h225_pi -> dialedDigits - 1 ; tvb_memcpy ( value_tvb , ( guint8 * ) h225_pi -> dialedDigits , 0 , len ) ; } h225_pi -> dialedDigits [ len ] = '\0' ; h225_pi -> is_destinationInfo = FALSE ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int qcow2_probe ( const uint8_t * buf , int buf_size , const char * filename ) { const QCowHeader * cow_header = ( const void * ) buf ; if ( buf_size >= sizeof ( QCowHeader ) && be32_to_cpu ( cow_header -> magic ) == QCOW_MAGIC && be32_to_cpu ( cow_header -> version ) >= 2 ) return 100 ; else return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int xd3_selftest ( void ) { # define DO_TEST ( fn , flags , arg ) do { xd3_stream stream ; xd3_config config ; xd3_init_config ( & config , flags ) ; XPR ( NT "testing " # fn "%s..." , flags ? ( " (" # flags ")" ) : "" ) ; if ( ( ret = xd3_config_stream ( & stream , & config ) == 0 ) && ( ret = test_ ## fn ( & stream , arg ) ) == 0 ) { XPR ( NTR " success\n" ) ; } else { XPR ( NTR " failed: %s: %s\n" , xd3_errstring ( & stream ) , xd3_mainerror ( ret ) ) ; } xd3_free_stream ( & stream ) ; if ( ret != 0 ) { goto failure ; } } while ( 0 ) int ret ; DO_TEST ( random_numbers , 0 , 0 ) ; DO_TEST ( decode_integer_end_of_input , 0 , 0 ) ; DO_TEST ( decode_integer_overflow , 0 , 0 ) ; DO_TEST ( encode_decode_uint32_t , 0 , 0 ) ; DO_TEST ( encode_decode_uint64_t , 0 , 0 ) ; DO_TEST ( usize_t_overflow , 0 , 0 ) ; DO_TEST ( forward_match , 0 , 0 ) ; DO_TEST ( address_cache , 0 , 0 ) ; IF_GENCODETBL ( DO_TEST ( address_cache , XD3_ALT_CODE_TABLE , 0 ) ) ; DO_TEST ( string_matching , 0 , 0 ) ; DO_TEST ( choose_instruction , 0 , 0 ) ; DO_TEST ( identical_behavior , 0 , 0 ) ; DO_TEST ( in_memory , 0 , 0 ) ; IF_GENCODETBL ( DO_TEST ( choose_instruction , XD3_ALT_CODE_TABLE , 0 ) ) ; IF_GENCODETBL ( DO_TEST ( encode_code_table , 0 , 0 ) ) ; DO_TEST ( iopt_flush_instructions , 0 , 0 ) ; DO_TEST ( source_cksum_offset , 0 , 0 ) ; DO_TEST ( decompress_single_bit_error , 0 , 3 ) ; DO_TEST ( decompress_single_bit_error , XD3_ADLER32 , 3 ) ; IF_LZMA ( DO_TEST ( decompress_single_bit_error , XD3_SEC_LZMA , 54 ) ) ; IF_FGK ( DO_TEST ( decompress_single_bit_error , XD3_SEC_FGK , 3 ) ) ; IF_DJW ( DO_TEST ( decompress_single_bit_error , XD3_SEC_DJW , 8 ) ) ; IF_GENCODETBL ( DO_TEST ( decompress_single_bit_error , XD3_ALT_CODE_TABLE , 224 ) ) ; # if SHELL_TESTS DO_TEST ( force_behavior , 0 , 0 ) ; DO_TEST ( stdout_behavior , 0 , 0 ) ; DO_TEST ( no_output , 0 , 0 ) ; DO_TEST ( appheader , 0 , 0 ) ; DO_TEST ( command_line_arguments , 0 , 0 ) ; # if EXTERNAL_COMPRESSION DO_TEST ( source_decompression , 0 , 0 ) ; DO_TEST ( externally_compressed_io , 0 , 0 ) ; # endif DO_TEST ( recode_command , 0 , 0 ) ; # endif IF_LZMA ( DO_TEST ( secondary_lzma , 0 , 1 ) ) ; IF_DJW ( DO_TEST ( secondary_huff , 0 , DJW_MAX_GROUPS ) ) ; IF_FGK ( DO_TEST ( secondary_fgk , 0 , 1 ) ) ; DO_TEST ( compressed_stream_overflow , 0 , 0 ) ; IF_LZMA ( DO_TEST ( compressed_stream_overflow , XD3_SEC_LZMA , 0 ) ) ; failure : test_cleanup ( ) ; return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE ; # undef DO_TEST }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void cleanup_unknown_header_ext ( BlockDriverState * bs ) { BDRVQcowState * s = bs -> opaque ; Qcow2UnknownHeaderExtension * uext , * next ; QLIST_FOREACH_SAFE ( uext , & s -> unknown_header_ext , next , next ) { QLIST_REMOVE ( uext , next ) ; g_free ( uext ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_field_value ( tvbuff_t * tvb , int offset , proto_tree * tree , guint16 field_type , int field_length , int encoding ) { switch ( field_type ) { case PDM_TYPE_BOOLEAN : proto_tree_add_item ( tree , hf_lbmpdm_field_value_boolean , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_INT8 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_int8 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_UINT8 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_uint8 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_INT16 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_int16 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_UINT16 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_uint16 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_INT32 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_int32 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_UINT32 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_uint32 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_INT64 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_int64 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_UINT64 : proto_tree_add_item ( tree , hf_lbmpdm_field_value_uint64 , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_FLOAT : proto_tree_add_item ( tree , hf_lbmpdm_field_value_float , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_DOUBLE : proto_tree_add_item ( tree , hf_lbmpdm_field_value_double , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_DECIMAL : { gint64 mantissa ; gint8 exponent ; gint64 whole = 0 ; guint64 fraction = 0 ; gint8 shift_count ; exponent = ( gint8 ) tvb_get_guint8 ( tvb , offset ) ; mantissa = ( gint64 ) lbmpdm_fetch_uint64_encoded ( tvb , offset + 1 , encoding ) ; if ( exponent >= 0 ) { whole = mantissa ; shift_count = exponent ; while ( shift_count > 0 ) { whole *= 10 ; shift_count -- ; } proto_tree_add_none_format ( tree , hf_lbmpdm_field_value_decimal , tvb , offset , field_length , "DECIMAL Value: %" G_GINT64_FORMAT " (%" G_GINT64_FORMAT "e%d)" , whole , mantissa , exponent ) ; } else { guint64 divisor = 1 ; int decimal_digits = - exponent ; shift_count = decimal_digits ; while ( shift_count > 0 ) { divisor *= 10 ; shift_count -- ; } if ( mantissa < 0 ) { whole = - mantissa ; } else { whole = mantissa ; } fraction = whole % divisor ; whole /= divisor ; if ( mantissa < 0 ) { whole *= - 1 ; } proto_tree_add_none_format ( tree , hf_lbmpdm_field_value_decimal , tvb , offset , field_length , "DECIMAL Value: %" G_GINT64_FORMAT ".%0*" G_GUINT64_FORMAT " (%" G_GINT64_FORMAT "e%d)" , whole , decimal_digits , fraction , mantissa , exponent ) ; } } break ; case PDM_TYPE_TIMESTAMP : { nstime_t timestamp ; timestamp . secs = ( time_t ) lbmpdm_fetch_uint32_encoded ( tvb , offset , encoding ) ; timestamp . nsecs = ( int ) ( lbmpdm_fetch_uint32_encoded ( tvb , offset + 4 , encoding ) * 1000 ) ; proto_tree_add_time ( tree , hf_lbmpdm_field_value_timestamp , tvb , offset , field_length , & timestamp ) ; } break ; case PDM_TYPE_FIX_STRING : proto_tree_add_item ( tree , hf_lbmpdm_field_value_fixed_string , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_STRING : proto_tree_add_item ( tree , hf_lbmpdm_field_value_string , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_FIX_UNICODE : proto_tree_add_item ( tree , hf_lbmpdm_field_value_fixed_unicode , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_UNICODE : proto_tree_add_item ( tree , hf_lbmpdm_field_value_unicode , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_BLOB : proto_tree_add_item ( tree , hf_lbmpdm_field_value_blob , tvb , offset , field_length , encoding ) ; break ; case PDM_TYPE_MESSAGE : proto_tree_add_item ( tree , hf_lbmpdm_field_value_message , tvb , offset , field_length , encoding ) ; break ; default : break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int event_base_loop ( struct event_base * base , int flags ) { const struct eventop * evsel = base -> evsel ; void * evbase = base -> evbase ; struct timeval tv ; struct timeval * tv_p ; int res , done ; base -> tv_cache . tv_sec = 0 ; if ( base -> sig . ev_signal_added ) evsignal_base = base ; done = 0 ; while ( ! done ) { if ( base -> event_gotterm ) { base -> event_gotterm = 0 ; break ; } if ( base -> event_break ) { base -> event_break = 0 ; break ; } timeout_correct ( base , & tv ) ; tv_p = & tv ; if ( ! base -> event_count_active && ! ( flags & EVLOOP_NONBLOCK ) ) { timeout_next ( base , & tv_p ) ; } else { evutil_timerclear ( & tv ) ; } if ( ! event_haveevents ( base ) ) { event_debug ( ( "%s: no events registered." , __func__ ) ) ; return ( 1 ) ; } gettime ( base , & base -> event_tv ) ; base -> tv_cache . tv_sec = 0 ; res = evsel -> dispatch ( base , evbase , tv_p ) ; if ( res == - 1 ) return ( - 1 ) ; gettime ( base , & base -> tv_cache ) ; timeout_process ( base ) ; if ( base -> event_count_active ) { event_process_active ( base ) ; if ( ! base -> event_count_active && ( flags & EVLOOP_ONCE ) ) done = 1 ; } else if ( flags & EVLOOP_NONBLOCK ) done = 1 ; } base -> tv_cache . tv_sec = 0 ; event_debug ( ( "%s: asked to terminate loop." , __func__ ) ) ; return ( 0 ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
void input_DecoderStopWait ( decoder_t * p_dec ) { decoder_owner_sys_t * p_owner = p_dec -> p_owner ; vlc_mutex_lock ( & p_owner -> lock ) ; p_owner -> b_waiting = false ; vlc_cond_signal ( & p_owner -> wait_request ) ; vlc_mutex_unlock ( & p_owner -> lock ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void set_rate_control_metrics ( struct RateControlMetrics * rc , vpx_codec_enc_cfg_t * cfg ) { unsigned int i = 0 ; const double framerate = cfg -> g_timebase . den / cfg -> g_timebase . num ; rc -> layer_framerate [ 0 ] = framerate / cfg -> ts_rate_decimator [ 0 ] ; rc -> layer_pfb [ 0 ] = 1000.0 * cfg -> ts_target_bitrate [ 0 ] / rc -> layer_framerate [ 0 ] ; for ( i = 0 ; i < cfg -> ts_number_layers ; ++ i ) { if ( i > 0 ) { rc -> layer_framerate [ i ] = framerate / cfg -> ts_rate_decimator [ i ] ; rc -> layer_pfb [ i ] = 1000.0 * ( cfg -> ts_target_bitrate [ i ] - cfg -> ts_target_bitrate [ i - 1 ] ) / ( rc -> layer_framerate [ i ] - rc -> layer_framerate [ i - 1 ] ) ; } rc -> layer_input_frames [ i ] = 0 ; rc -> layer_enc_frames [ i ] = 0 ; rc -> layer_tot_enc_frames [ i ] = 0 ; rc -> layer_encoding_bitrate [ i ] = 0.0 ; rc -> layer_avg_frame_size [ i ] = 0.0 ; rc -> layer_avg_rate_mismatch [ i ] = 0.0 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void fill_label_boolean ( field_info * fi , gchar * label_str ) { char * p = label_str ; int bitfield_byte_length = 0 , bitwidth ; guint64 unshifted_value ; guint64 value ; header_field_info * hfinfo = fi -> hfinfo ; const true_false_string * tfstring = ( const true_false_string * ) & tfs_true_false ; if ( hfinfo -> strings ) { tfstring = ( const struct true_false_string * ) hfinfo -> strings ; } value = fvalue_get_uinteger64 ( & fi -> value ) ; if ( hfinfo -> bitmask ) { bitwidth = hfinfo_container_bitwidth ( hfinfo ) ; unshifted_value = value ; unshifted_value <<= hfinfo_bitshift ( hfinfo ) ; p = decode_bitfield_value ( label_str , unshifted_value , hfinfo -> bitmask , bitwidth ) ; bitfield_byte_length = ( int ) ( p - label_str ) ; } label_fill ( label_str , bitfield_byte_length , hfinfo , value ? tfstring -> true_string : tfstring -> false_string ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( FilesystemIterator , key ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; if ( zend_parse_parameters_none ( ) == FAILURE ) { return ; } if ( SPL_FILE_DIR_KEY ( intern , SPL_FILE_DIR_KEY_AS_FILENAME ) ) { RETURN_STRING ( intern -> u . dir . entry . d_name , 1 ) ; } else { spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ; RETURN_STRINGL ( intern -> file_name , intern -> file_name_len , 1 ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_DataApplicationCapability ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_DataApplicationCapability , DataApplicationCapability_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int DMA_read_memory ( int nchan , void * buf , int pos , int size ) { return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void check_new_cluster_is_empty ( void ) { int dbnum ; for ( dbnum = 0 ; dbnum < new_cluster . dbarr . ndbs ; dbnum ++ ) { int relnum ; RelInfoArr * rel_arr = & new_cluster . dbarr . dbs [ dbnum ] . rel_arr ; for ( relnum = 0 ; relnum < rel_arr -> nrels ; relnum ++ ) { if ( strcmp ( rel_arr -> rels [ relnum ] . nspname , "pg_catalog" ) != 0 ) pg_fatal ( "New cluster database \"%s\" is not empty\n" , new_cluster . dbarr . dbs [ dbnum ] . db_name ) ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_H263VideoCapability ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_H263VideoCapability , H263VideoCapability_sequence ) ; # line 363 "../../asn1/h245/h245.cnf" h245_lc_dissector = h263_handle ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void evhttp_send_reply_end ( struct evhttp_request * req ) { struct evhttp_connection * evcon = req -> evcon ; if ( req -> chunked ) { evbuffer_add ( req -> evcon -> output_buffer , "0\r\n\r\n" , 5 ) ; evhttp_write_buffer ( req -> evcon , evhttp_send_done , NULL ) ; req -> chunked = 0 ; } else if ( ! event_pending ( & evcon -> ev , EV_WRITE | EV_TIMEOUT , NULL ) ) { evhttp_send_done ( evcon , NULL ) ; } else { evcon -> cb = evhttp_send_done ; evcon -> cb_arg = NULL ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
int test_div ( BIO * bp , BN_CTX * ctx ) { BIGNUM a , b , c , d , e ; int i ; BN_init ( & a ) ; BN_init ( & b ) ; BN_init ( & c ) ; BN_init ( & d ) ; BN_init ( & e ) ; for ( i = 0 ; i < num0 + num1 ; i ++ ) { if ( i < num1 ) { BN_bntest_rand ( & a , 400 , 0 , 0 ) ; BN_copy ( & b , & a ) ; BN_lshift ( & a , & a , i ) ; BN_add_word ( & a , i ) ; } else BN_bntest_rand ( & b , 50 + 3 * ( i - num1 ) , 0 , 0 ) ; a . neg = rand_neg ( ) ; b . neg = rand_neg ( ) ; BN_div ( & d , & c , & a , & b , ctx ) ; if ( bp != NULL ) { if ( ! results ) { BN_print ( bp , & a ) ; BIO_puts ( bp , " / " ) ; BN_print ( bp , & b ) ; BIO_puts ( bp , " - " ) ; } BN_print ( bp , & d ) ; BIO_puts ( bp , "\n" ) ; if ( ! results ) { BN_print ( bp , & a ) ; BIO_puts ( bp , " % " ) ; BN_print ( bp , & b ) ; BIO_puts ( bp , " - " ) ; } BN_print ( bp , & c ) ; BIO_puts ( bp , "\n" ) ; } BN_mul ( & e , & d , & b , ctx ) ; BN_add ( & d , & e , & c ) ; BN_sub ( & d , & d , & a ) ; if ( ! BN_is_zero ( & d ) ) { fprintf ( stderr , "Division test failed!\n" ) ; return 0 ; } } BN_free ( & a ) ; BN_free ( & b ) ; BN_free ( & c ) ; BN_free ( & d ) ; BN_free ( & e ) ; return ( 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) { return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) { OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) { return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ; } static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) { return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) { return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ; } static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) { OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ; } static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) { return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ; } static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) { return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ; } static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) { return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ; } # define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ; typedef const char * OPENSSL_CSTRING ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ; DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void )
1True
Categorize the following code snippet as vulnerable or not. True or False
static void import_palette ( CDXLVideoContext * c , uint32_t * new_palette ) { int i ; for ( i = 0 ; i < c -> palette_size / 2 ; i ++ ) { unsigned rgb = AV_RB16 ( & c -> palette [ i * 2 ] ) ; unsigned r = ( ( rgb >> 8 ) & 0xF ) * 0x11 ; unsigned g = ( ( rgb >> 4 ) & 0xF ) * 0x11 ; unsigned b = ( rgb & 0xF ) * 0x11 ; AV_WN32 ( & new_palette [ i ] , ( r << 16 ) | ( g << 8 ) | b ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int index_mb ( uint8_t cluster [ ] , uint8_t cb [ ] , int numCB , int * outIndex , int dim ) { int i , lDiff = INT_MAX , pick = 0 ; for ( i = 0 ; i < numCB ; i ++ ) { int diff = squared_diff_macroblock ( cluster , cb + i * dim * dim * 3 , dim ) ; if ( diff < lDiff ) { lDiff = diff ; pick = i ; } } * outIndex = pick ; return lDiff ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
VALUE rb_dlhandle_enable_close ( VALUE self ) { struct dl_handle * dlhandle ; Data_Get_Struct ( self , struct dl_handle , dlhandle ) ; dlhandle -> enable_close = 1 ; return Qnil ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int best_effort_strncat_to_utf16be ( struct archive_string * as16 , const void * _p , size_t length , struct archive_string_conv * sc ) { return ( best_effort_strncat_to_utf16 ( as16 , _p , length , sc , 1 ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_channel_residues ( WmallDecodeCtx * s , int ch , int tile_size ) { int i = 0 ; unsigned int ave_mean ; s -> transient [ ch ] = get_bits1 ( & s -> gb ) ; if ( s -> transient [ ch ] ) { s -> transient_pos [ ch ] = get_bits ( & s -> gb , av_log2 ( tile_size ) ) ; if ( s -> transient_pos [ ch ] ) s -> transient [ ch ] = 0 ; s -> channel [ ch ] . transient_counter = FFMAX ( s -> channel [ ch ] . transient_counter , s -> samples_per_frame / 2 ) ; } else if ( s -> channel [ ch ] . transient_counter ) s -> transient [ ch ] = 1 ; if ( s -> seekable_tile ) { ave_mean = get_bits ( & s -> gb , s -> bits_per_sample ) ; s -> ave_sum [ ch ] = ave_mean << ( s -> movave_scaling + 1 ) ; } if ( s -> seekable_tile ) { if ( s -> do_inter_ch_decorr ) s -> channel_residues [ ch ] [ 0 ] = get_sbits ( & s -> gb , s -> bits_per_sample + 1 ) ; else s -> channel_residues [ ch ] [ 0 ] = get_sbits ( & s -> gb , s -> bits_per_sample ) ; i ++ ; } for ( ; i < tile_size ; i ++ ) { int quo = 0 , rem , rem_bits , residue ; while ( get_bits1 ( & s -> gb ) ) { quo ++ ; if ( get_bits_left ( & s -> gb ) <= 0 ) return - 1 ; } if ( quo >= 32 ) quo += get_bits_long ( & s -> gb , get_bits ( & s -> gb , 5 ) + 1 ) ; ave_mean = ( s -> ave_sum [ ch ] + ( 1 << s -> movave_scaling ) ) >> ( s -> movave_scaling + 1 ) ; if ( ave_mean <= 1 ) residue = quo ; else { rem_bits = av_ceil_log2 ( ave_mean ) ; rem = rem_bits ? get_bits_long ( & s -> gb , rem_bits ) : 0 ; residue = ( quo << rem_bits ) + rem ; } s -> ave_sum [ ch ] = residue + s -> ave_sum [ ch ] - ( s -> ave_sum [ ch ] >> s -> movave_scaling ) ; if ( residue & 1 ) residue = - ( residue >> 1 ) - 1 ; else residue = residue >> 1 ; s -> channel_residues [ ch ] [ i ] = residue ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void ufile_fill_uchar_buffer ( UFILE * f ) { UErrorCode status ; const char * mySource ; const char * mySourceEnd ; UChar * myTarget ; int32_t bufferSize ; int32_t maxCPBytes ; int32_t bytesRead ; int32_t availLength ; int32_t dataSize ; char charBuffer [ UFILE_CHARBUFFER_SIZE ] ; u_localized_string * str ; if ( f -> fFile == NULL ) { return ; } str = & f -> str ; dataSize = ( int32_t ) ( str -> fLimit - str -> fPos ) ; if ( f -> fFileno == 0 && dataSize > 0 ) { return ; } if ( dataSize != 0 ) { u_memmove ( f -> fUCBuffer , str -> fPos , dataSize ) ; } availLength = UFILE_UCHARBUFFER_SIZE - dataSize ; maxCPBytes = availLength / ( f -> fConverter != NULL ? ( 2 * ucnv_getMinCharSize ( f -> fConverter ) ) : 1 ) ; if ( f -> fFileno == 0 ) { char * retStr = fgets ( charBuffer , ufmt_min ( maxCPBytes , UFILE_CHARBUFFER_SIZE ) , f -> fFile ) ; bytesRead = ( int32_t ) ( retStr ? uprv_strlen ( charBuffer ) : 0 ) ; } else { bytesRead = ( int32_t ) fread ( charBuffer , sizeof ( char ) , ufmt_min ( maxCPBytes , UFILE_CHARBUFFER_SIZE ) , f -> fFile ) ; } status = U_ZERO_ERROR ; mySource = charBuffer ; mySourceEnd = charBuffer + bytesRead ; myTarget = f -> fUCBuffer + dataSize ; bufferSize = UFILE_UCHARBUFFER_SIZE ; if ( f -> fConverter != NULL ) { ucnv_toUnicode ( f -> fConverter , & myTarget , f -> fUCBuffer + bufferSize , & mySource , mySourceEnd , NULL , ( UBool ) ( feof ( f -> fFile ) != 0 ) , & status ) ; } else { u_charsToUChars ( mySource , myTarget , bytesRead ) ; myTarget += bytesRead ; } str -> fPos = str -> fBuffer ; str -> fLimit = myTarget ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _setWithOids ( ArchiveHandle * AH , TocEntry * te ) { if ( AH -> currWithOids != te -> withOids ) { _doSetWithOids ( AH , te -> withOids ) ; AH -> currWithOids = te -> withOids ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_H263Options ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_H263Options , H263Options_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ImportBGRQuantum ( const Image * image , QuantumInfo * quantum_info , const MagickSizeType number_pixels , const unsigned char * magick_restrict p , Quantum * magick_restrict q , ExceptionInfo * exception ) { QuantumAny range ; register ssize_t x ; ssize_t bit ; unsigned int pixel ; assert ( image != ( Image * ) NULL ) ; assert ( image -> signature == MagickCoreSignature ) ; switch ( quantum_info -> depth ) { case 8 : { unsigned char pixel ; for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushCharPixel ( p , & pixel ) ; SetPixelBlue ( image , ScaleCharToQuantum ( pixel ) , q ) ; p = PushCharPixel ( p , & pixel ) ; SetPixelGreen ( image , ScaleCharToQuantum ( pixel ) , q ) ; p = PushCharPixel ( p , & pixel ) ; SetPixelRed ( image , ScaleCharToQuantum ( pixel ) , q ) ; SetPixelAlpha ( image , OpaqueAlpha , q ) ; p += quantum_info -> pad ; q += GetPixelChannels ( image ) ; } break ; } case 10 : { range = GetQuantumRange ( quantum_info -> depth ) ; if ( quantum_info -> pack == MagickFalse ) { for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushLongPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelRed ( image , ScaleAnyToQuantum ( ( pixel >> 22 ) & 0x3ff , range ) , q ) ; SetPixelGreen ( image , ScaleAnyToQuantum ( ( pixel >> 12 ) & 0x3ff , range ) , q ) ; SetPixelBlue ( image , ScaleAnyToQuantum ( ( pixel >> 2 ) & 0x3ff , range ) , q ) ; p += quantum_info -> pad ; q += GetPixelChannels ( image ) ; } break ; } if ( quantum_info -> quantum == 32U ) { for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushQuantumLongPixel ( quantum_info , p , & pixel ) ; SetPixelBlue ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumLongPixel ( quantum_info , p , & pixel ) ; SetPixelGreen ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumLongPixel ( quantum_info , p , & pixel ) ; SetPixelRed ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; q += GetPixelChannels ( image ) ; } break ; } for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelBlue ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelGreen ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelRed ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; q += GetPixelChannels ( image ) ; } break ; } case 12 : { range = GetQuantumRange ( quantum_info -> depth ) ; if ( quantum_info -> pack == MagickFalse ) { unsigned short pixel ; for ( x = 0 ; x < ( ssize_t ) ( 3 * number_pixels - 1 ) ; x += 2 ) { p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; switch ( x % 3 ) { default : case 0 : { SetPixelRed ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; break ; } case 1 : { SetPixelGreen ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; break ; } case 2 : { SetPixelBlue ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; q += GetPixelChannels ( image ) ; break ; } } p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; switch ( ( x + 1 ) % 3 ) { default : case 0 : { SetPixelRed ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; break ; } case 1 : { SetPixelGreen ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; break ; } case 2 : { SetPixelBlue ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; q += GetPixelChannels ( image ) ; break ; } } p += quantum_info -> pad ; } for ( bit = 0 ; bit < ( ssize_t ) ( 3 * number_pixels % 2 ) ; bit ++ ) { p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; switch ( ( x + bit ) % 3 ) { default : case 0 : { SetPixelRed ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; break ; } case 1 : { SetPixelGreen ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; break ; } case 2 : { SetPixelBlue ( image , ScaleAnyToQuantum ( ( QuantumAny ) ( pixel >> 4 ) , range ) , q ) ; q += GetPixelChannels ( image ) ; break ; } } p += quantum_info -> pad ; } if ( bit != 0 ) p ++ ; break ; } if ( quantum_info -> quantum == 32U ) { for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushQuantumLongPixel ( quantum_info , p , & pixel ) ; SetPixelBlue ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumLongPixel ( quantum_info , p , & pixel ) ; SetPixelGreen ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumLongPixel ( quantum_info , p , & pixel ) ; SetPixelRed ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; q += GetPixelChannels ( image ) ; } break ; } for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelBlue ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelGreen ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelRed ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; q += GetPixelChannels ( image ) ; } break ; } case 16 : { unsigned short pixel ; if ( quantum_info -> format == FloatingPointQuantumFormat ) { for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelRed ( image , ClampToQuantum ( QuantumRange * HalfToSinglePrecision ( pixel ) ) , q ) ; p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelGreen ( image , ClampToQuantum ( QuantumRange * HalfToSinglePrecision ( pixel ) ) , q ) ; p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelBlue ( image , ClampToQuantum ( QuantumRange * HalfToSinglePrecision ( pixel ) ) , q ) ; p += quantum_info -> pad ; q += GetPixelChannels ( image ) ; } break ; } for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelBlue ( image , ScaleShortToQuantum ( pixel ) , q ) ; p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelGreen ( image , ScaleShortToQuantum ( pixel ) , q ) ; p = PushShortPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelRed ( image , ScaleShortToQuantum ( pixel ) , q ) ; p += quantum_info -> pad ; q += GetPixelChannels ( image ) ; } break ; } case 32 : { unsigned int pixel ; if ( quantum_info -> format == FloatingPointQuantumFormat ) { float pixel ; for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushFloatPixel ( quantum_info , p , & pixel ) ; SetPixelRed ( image , ClampToQuantum ( pixel ) , q ) ; p = PushFloatPixel ( quantum_info , p , & pixel ) ; SetPixelGreen ( image , ClampToQuantum ( pixel ) , q ) ; p = PushFloatPixel ( quantum_info , p , & pixel ) ; SetPixelBlue ( image , ClampToQuantum ( pixel ) , q ) ; p += quantum_info -> pad ; q += GetPixelChannels ( image ) ; } break ; } for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushLongPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelBlue ( image , ScaleLongToQuantum ( pixel ) , q ) ; p = PushLongPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelGreen ( image , ScaleLongToQuantum ( pixel ) , q ) ; p = PushLongPixel ( quantum_info -> endian , p , & pixel ) ; SetPixelRed ( image , ScaleLongToQuantum ( pixel ) , q ) ; p += quantum_info -> pad ; q += GetPixelChannels ( image ) ; } break ; } case 64 : { if ( quantum_info -> format == FloatingPointQuantumFormat ) { double pixel ; for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushDoublePixel ( quantum_info , p , & pixel ) ; SetPixelRed ( image , ClampToQuantum ( pixel ) , q ) ; p = PushDoublePixel ( quantum_info , p , & pixel ) ; SetPixelGreen ( image , ClampToQuantum ( pixel ) , q ) ; p = PushDoublePixel ( quantum_info , p , & pixel ) ; SetPixelBlue ( image , ClampToQuantum ( pixel ) , q ) ; p += quantum_info -> pad ; q += GetPixelChannels ( image ) ; } break ; } } default : { range = GetQuantumRange ( quantum_info -> depth ) ; for ( x = 0 ; x < ( ssize_t ) number_pixels ; x ++ ) { p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelBlue ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelGreen ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; p = PushQuantumPixel ( quantum_info , p , & pixel ) ; SetPixelRed ( image , ScaleAnyToQuantum ( pixel , range ) , q ) ; q += GetPixelChannels ( image ) ; } break ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
METHOD ( x509_t , get_flags , x509_flag_t , private_x509_cert_t * this ) { return this -> flags ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int restore_toc_entry ( ArchiveHandle * AH , TocEntry * te , bool is_parallel ) { RestoreOptions * ropt = AH -> public . ropt ; int status = WORKER_OK ; teReqs reqs ; bool defnDumped ; AH -> currentTE = te ; if ( _tocEntryIsACL ( te ) ) reqs = 0 ; else reqs = te -> reqs ; if ( ! ropt -> createDB && strcmp ( te -> desc , "DATABASE" ) == 0 ) reqs = 0 ; if ( ! ropt -> suppressDumpWarnings && strcmp ( te -> desc , "WARNING" ) == 0 ) { if ( ! ropt -> dataOnly && te -> defn != NULL && strlen ( te -> defn ) != 0 ) write_msg ( modulename , "warning from original dump file: %s\n" , te -> defn ) ; else if ( te -> copyStmt != NULL && strlen ( te -> copyStmt ) != 0 ) write_msg ( modulename , "warning from original dump file: %s\n" , te -> copyStmt ) ; } defnDumped = false ; if ( ( reqs & REQ_SCHEMA ) != 0 ) { if ( te -> namespace ) ahlog ( AH , 1 , "creating %s \"%s.%s\"\n" , te -> desc , te -> namespace , te -> tag ) ; else ahlog ( AH , 1 , "creating %s \"%s\"\n" , te -> desc , te -> tag ) ; _printTocEntry ( AH , te , false , false ) ; defnDumped = true ; if ( strcmp ( te -> desc , "TABLE" ) == 0 ) { if ( AH -> lastErrorTE == te ) { if ( ropt -> noDataForFailedTables ) { if ( is_parallel ) status = WORKER_INHIBIT_DATA ; else inhibit_data_for_failed_table ( AH , te ) ; } } else { if ( is_parallel ) status = WORKER_CREATE_DONE ; else mark_create_done ( AH , te ) ; } } if ( strcmp ( te -> desc , "DATABASE" ) == 0 ) { PQExpBufferData connstr ; initPQExpBuffer ( & connstr ) ; appendPQExpBufferStr ( & connstr , "dbname=" ) ; appendConnStrVal ( & connstr , te -> tag ) ; ahlog ( AH , 1 , "connecting to new database \"%s\"\n" , te -> tag ) ; _reconnectToDB ( AH , te -> tag ) ; ropt -> dbname = connstr . data ; } } if ( ( reqs & REQ_DATA ) != 0 ) { if ( te -> hadDumper ) { if ( AH -> PrintTocDataPtr != NULL ) { _printTocEntry ( AH , te , true , false ) ; if ( strcmp ( te -> desc , "BLOBS" ) == 0 || strcmp ( te -> desc , "BLOB COMMENTS" ) == 0 ) { ahlog ( AH , 1 , "processing %s\n" , te -> desc ) ; _selectOutputSchema ( AH , "pg_catalog" ) ; if ( strcmp ( te -> desc , "BLOB COMMENTS" ) == 0 ) AH -> outputKind = OUTPUT_OTHERDATA ; ( * AH -> PrintTocDataPtr ) ( AH , te ) ; AH -> outputKind = OUTPUT_SQLCMDS ; } else { _disableTriggersIfNecessary ( AH , te ) ; _becomeOwner ( AH , te ) ; _selectOutputSchema ( AH , te -> namespace ) ; ahlog ( AH , 1 , "processing data for table \"%s.%s\"\n" , te -> namespace , te -> tag ) ; if ( is_parallel && te -> created ) { StartTransaction ( & AH -> public ) ; ahprintf ( AH , "TRUNCATE TABLE %s%s; \n\n" , ( PQserverVersion ( AH -> connection ) >= 80400 ? "ONLY " : "" ) , fmtId ( te -> tag ) ) ; } if ( te -> copyStmt && strlen ( te -> copyStmt ) > 0 ) { ahprintf ( AH , "%s" , te -> copyStmt ) ; AH -> outputKind = OUTPUT_COPYDATA ; } else AH -> outputKind = OUTPUT_OTHERDATA ; ( * AH -> PrintTocDataPtr ) ( AH , te ) ; if ( AH -> outputKind == OUTPUT_COPYDATA && RestoringToDB ( AH ) ) EndDBCopyMode ( & AH -> public , te -> tag ) ; AH -> outputKind = OUTPUT_SQLCMDS ; if ( is_parallel && te -> created ) CommitTransaction ( & AH -> public ) ; _enableTriggersIfNecessary ( AH , te ) ; } } } else if ( ! defnDumped ) { ahlog ( AH , 1 , "executing %s %s\n" , te -> desc , te -> tag ) ; _printTocEntry ( AH , te , false , false ) ; } } if ( AH -> public . n_errors > 0 && status == WORKER_OK ) status = WORKER_IGNORED_ERRORS ; return status ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_H323_UserInformation_PDU ( tvbuff_t * tvb _U_ , packet_info * pinfo _U_ , proto_tree * tree _U_ , void * data _U_ ) { int offset = 0 ; asn1_ctx_t asn1_ctx ; asn1_ctx_init ( & asn1_ctx , ASN1_ENC_PER , TRUE , pinfo ) ; offset = dissect_h225_H323_UserInformation ( tvb , offset , & asn1_ctx , tree , hf_h225_H323_UserInformation_PDU ) ; offset += 7 ; offset >>= 3 ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void dissect_geographical_description ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree ) { proto_item * lat_item , * long_item , * major_item , * minor_item , * alt_item , * uncer_item ; guint8 type_of_shape ; int offset = 0 ; int length ; guint8 value ; guint32 uvalue32 ; gint32 svalue32 ; length = tvb_reported_length_remaining ( tvb , 0 ) ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_type_of_shape , tvb , 0 , 1 , ENC_BIG_ENDIAN ) ; if ( length < 2 ) return ; type_of_shape = tvb_get_guint8 ( tvb , offset ) >> 4 ; switch ( type_of_shape ) { case ELLIPSOID_POINT : case ELLIPSOID_POINT_WITH_UNCERT_CIRC : case ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE : case ELLIPSOID_POINT_WITH_ALT : case ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID : case ELLIPSOID_ARC : offset ++ ; if ( length < 4 ) return ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_sign_of_lat , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; uvalue32 = tvb_get_ntoh24 ( tvb , offset ) ; lat_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_deg_of_lat , tvb , offset , 3 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( lat_item , " (%s%.5f degrees)" , ( uvalue32 & 0x00800000 ) ? "-" : "" , ( ( double ) ( uvalue32 & 0x7fffff ) / 8388607.0 ) * 90 ) ; if ( length < 7 ) return ; offset = offset + 3 ; svalue32 = tvb_get_ntoh24 ( tvb , offset ) ; svalue32 |= ( svalue32 & 0x800000 ) ? 0xff000000 : 0x00000000 ; long_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_deg_of_long , tvb , offset , 3 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( long_item , " (%.5f degrees)" , ( ( double ) svalue32 / 16777215.0 ) * 360 ) ; offset = offset + 3 ; if ( type_of_shape == ELLIPSOID_POINT_WITH_UNCERT_CIRC ) { if ( length < 8 ) return ; value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; uncer_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_uncertainty_code , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( uncer_item , " (%.1f m)" , 10 * ( pow ( 1.1 , ( double ) value ) - 1 ) ) ; } else if ( type_of_shape == ELLIPSOID_POINT_WITH_UNCERT_ELLIPSE ) { value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; major_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_uncertainty_semi_major , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( major_item , " (%.1f m)" , 10 * ( pow ( 1.1 , ( double ) value ) - 1 ) ) ; offset ++ ; value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; minor_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_uncertainty_semi_minor , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( minor_item , " (%.1f m)" , 10 * ( pow ( 1.1 , ( double ) value ) - 1 ) ) ; offset ++ ; value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; proto_tree_add_uint ( tree , hf_gsm_a_geo_loc_orientation_of_major_axis , tvb , offset , 1 , value * 2 ) ; offset ++ ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_confidence , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; } else if ( type_of_shape == ELLIPSOID_POINT_WITH_ALT ) { proto_tree_add_item ( tree , hf_gsm_a_geo_loc_D , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_altitude , tvb , offset , 2 , ENC_BIG_ENDIAN ) ; } else if ( type_of_shape == ELLIPSOID_POINT_WITH_ALT_AND_UNCERT_ELLIPSOID ) { proto_tree_add_item ( tree , hf_gsm_a_geo_loc_D , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_altitude , tvb , offset , 2 , ENC_BIG_ENDIAN ) ; offset = offset + 2 ; value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; major_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_uncertainty_semi_major , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( major_item , " (%.1f m)" , 10 * ( pow ( 1.1 , ( double ) value ) - 1 ) ) ; offset ++ ; value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; minor_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_uncertainty_semi_minor , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( minor_item , " (%.1f m)" , 10 * ( pow ( 1.1 , ( double ) value ) - 1 ) ) ; offset ++ ; value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; proto_tree_add_uint ( tree , hf_gsm_a_geo_loc_orientation_of_major_axis , tvb , offset , 1 , value * 2 ) ; offset ++ ; value = tvb_get_guint8 ( tvb , offset ) & 0x7f ; alt_item = proto_tree_add_item ( tree , hf_gsm_a_geo_loc_uncertainty_altitude , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_item_append_text ( alt_item , " (%.1f m)" , 45 * ( pow ( 1.025 , ( double ) value ) - 1 ) ) ; offset ++ ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_confidence , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; } else if ( type_of_shape == ELLIPSOID_ARC ) { proto_tree_add_item ( tree , hf_gsm_a_geo_loc_inner_radius , tvb , offset , 2 , ENC_BIG_ENDIAN ) ; offset = offset + 2 ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_uncertainty_radius , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_offset_angle , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_included_angle , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; proto_tree_add_item ( tree , hf_gsm_a_geo_loc_confidence , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; } break ; case POLYGON : proto_tree_add_item ( tree , hf_gsm_a_geo_loc_no_of_points , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; # if 0 no_of_points = tvb_get_guint8 ( tvb , offset ) & 0x0f ; while ( no_of_points > 0 ) { offset ++ ; no_of_points -- ; } # endif break ; default : break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void selinux_tun_dev_free_security ( void * security ) { kfree ( security ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TSReturnCode TSHttpTxnOutgoingTransparencySet ( TSHttpTxn txnp , int flag ) { if ( TS_SUCCESS != sdk_sanity_check_txn ( txnp ) ) { return TS_ERROR ; } HttpSM * sm = reinterpret_cast < HttpSM * > ( txnp ) ; if ( nullptr == sm || nullptr == sm -> ua_session ) { return TS_ERROR ; } sm -> ua_session -> set_outbound_transparent ( flag ) ; return TS_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static cmsBool WriteOneElem ( cmsIOHANDLER * io , _cmsDICelem * e , cmsUInt32Number i ) { if ( ! _cmsWriteUInt32Number ( io , e -> Offsets [ i ] ) ) return FALSE ; if ( ! _cmsWriteUInt32Number ( io , e -> Sizes [ i ] ) ) return FALSE ; return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void T_UConverter_fromUnicode_UTF32_LE_OFFSET_LOGIC ( UConverterFromUnicodeArgs * args , UErrorCode * err ) { const UChar * mySource = args -> source ; unsigned char * myTarget ; int32_t * myOffsets ; const UChar * sourceLimit = args -> sourceLimit ; const unsigned char * targetLimit = ( unsigned char * ) args -> targetLimit ; UChar32 ch , ch2 ; unsigned int indexToWrite ; unsigned char temp [ sizeof ( uint32_t ) ] ; int32_t offsetNum = 0 ; if ( mySource >= sourceLimit ) { return ; } if ( args -> converter -> fromUnicodeStatus == UCNV_NEED_TO_WRITE_BOM ) { static const char bom [ ] = { ( char ) 0xff , ( char ) 0xfe , 0 , 0 } ; ucnv_fromUWriteBytes ( args -> converter , bom , 4 , & args -> target , args -> targetLimit , & args -> offsets , - 1 , err ) ; args -> converter -> fromUnicodeStatus = 0 ; } myTarget = ( unsigned char * ) args -> target ; myOffsets = args -> offsets ; temp [ 3 ] = 0 ; if ( args -> converter -> fromUChar32 ) { ch = args -> converter -> fromUChar32 ; args -> converter -> fromUChar32 = 0 ; goto lowsurogate ; } while ( mySource < sourceLimit && myTarget < targetLimit ) { ch = * ( mySource ++ ) ; if ( U16_IS_SURROGATE ( ch ) ) { if ( U16_IS_LEAD ( ch ) ) { lowsurogate : if ( mySource < sourceLimit ) { ch2 = * mySource ; if ( U16_IS_TRAIL ( ch2 ) ) { ch = ( ( ch - SURROGATE_HIGH_START ) << HALF_SHIFT ) + ch2 + SURROGATE_LOW_BASE ; mySource ++ ; } else { args -> converter -> fromUChar32 = ch ; * err = U_ILLEGAL_CHAR_FOUND ; break ; } } else { args -> converter -> fromUChar32 = ch ; if ( args -> flush ) { * err = U_ILLEGAL_CHAR_FOUND ; } break ; } } else { args -> converter -> fromUChar32 = ch ; * err = U_ILLEGAL_CHAR_FOUND ; break ; } } temp [ 2 ] = ( uint8_t ) ( ch >> 16 & 0x1F ) ; temp [ 1 ] = ( uint8_t ) ( ch >> 8 ) ; temp [ 0 ] = ( uint8_t ) ( ch ) ; for ( indexToWrite = 0 ; indexToWrite <= sizeof ( uint32_t ) - 1 ; indexToWrite ++ ) { if ( myTarget < targetLimit ) { * ( myTarget ++ ) = temp [ indexToWrite ] ; * ( myOffsets ++ ) = offsetNum ; } else { args -> converter -> charErrorBuffer [ args -> converter -> charErrorBufferLength ++ ] = temp [ indexToWrite ] ; * err = U_BUFFER_OVERFLOW_ERROR ; } } offsetNum = offsetNum + 1 + ( temp [ 2 ] != 0 ) ; } if ( mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS ( * err ) ) { * err = U_BUFFER_OVERFLOW_ERROR ; } args -> target = ( char * ) myTarget ; args -> source = mySource ; args -> offsets = myOffsets ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int32_t mime_parse_int ( const char * buf , const char * end ) { int32_t num ; bool negative ; if ( ! buf || ( buf == end ) ) { return 0 ; } if ( is_digit ( * buf ) ) { num = * buf ++ - '0' ; while ( ( buf != end ) && is_digit ( * buf ) ) { num = ( num * 10 ) + ( * buf ++ - '0' ) ; } return num ; } else { num = 0 ; negative = false ; while ( ( buf != end ) && ParseRules : : is_space ( * buf ) ) { buf += 1 ; } if ( ( buf != end ) && ( * buf == '-' ) ) { negative = true ; buf += 1 ; } while ( ( buf != end ) && is_digit ( * buf ) ) { num = ( num * 10 ) - ( * buf ++ - '0' ) ; } if ( ! negative ) { num = - num ; } return num ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void vga_draw_glyph_line ( uint8_t * d , uint32_t font_data , uint32_t xorcol , uint32_t bgcol ) { ( ( uint32_t * ) d ) [ 0 ] = ( - ( ( font_data >> 7 ) ) & xorcol ) ^ bgcol ; ( ( uint32_t * ) d ) [ 1 ] = ( - ( ( font_data >> 6 ) & 1 ) & xorcol ) ^ bgcol ; ( ( uint32_t * ) d ) [ 2 ] = ( - ( ( font_data >> 5 ) & 1 ) & xorcol ) ^ bgcol ; ( ( uint32_t * ) d ) [ 3 ] = ( - ( ( font_data >> 4 ) & 1 ) & xorcol ) ^ bgcol ; ( ( uint32_t * ) d ) [ 4 ] = ( - ( ( font_data >> 3 ) & 1 ) & xorcol ) ^ bgcol ; ( ( uint32_t * ) d ) [ 5 ] = ( - ( ( font_data >> 2 ) & 1 ) & xorcol ) ^ bgcol ; ( ( uint32_t * ) d ) [ 6 ] = ( - ( ( font_data >> 1 ) & 1 ) & xorcol ) ^ bgcol ; ( ( uint32_t * ) d ) [ 7 ] = ( - ( ( font_data >> 0 ) & 1 ) & xorcol ) ^ bgcol ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void keydb_disable_caching ( KEYDB_HANDLE hd ) { if ( hd ) hd -> no_caching = 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int astream_part_finish ( struct attachment_istream * astream , const char * * error_r ) { struct attachment_istream_part * part = & astream -> part ; struct istream_attachment_info info ; struct istream * input ; struct ostream * output ; string_t * digest_str ; const unsigned char * data ; size_t size ; int ret = 0 ; if ( o_stream_nfinish ( part -> temp_output ) < 0 ) { * error_r = t_strdup_printf ( "write(%s) failed: %s" , o_stream_get_name ( part -> temp_output ) , o_stream_get_error ( part -> temp_output ) ) ; return - 1 ; } i_zero ( & info ) ; info . start_offset = astream -> part . start_offset ; info . encoded_size = part -> base64_bytes ; digest_str = t_str_new ( 128 ) ; hash_format_write ( astream -> set . hash_format , digest_str ) ; info . hash = str_c ( digest_str ) ; if ( ! part -> base64_failed ) { if ( part -> base64_state == BASE64_STATE_0 && part -> base64_bytes > 0 ) { part -> base64_state = BASE64_STATE_EOM ; } if ( part -> base64_state == BASE64_STATE_EOM ) { if ( astream_decode_base64 ( astream ) < 0 ) part -> base64_failed = TRUE ; } else { part -> base64_failed = TRUE ; } } info . part = astream -> cur_part ; if ( ! part -> base64_failed ) { info . base64_blocks_per_line = part -> base64_line_blocks ; info . base64_have_crlf = part -> base64_have_crlf ; str_truncate ( digest_str , 0 ) ; hash_format_write ( astream -> set . hash_format , digest_str ) ; info . hash = str_c ( digest_str ) ; } else { info . encoded_size = part -> temp_output -> offset ; } if ( astream -> set . open_attachment_ostream ( & info , & output , error_r , astream -> context ) < 0 ) return - 1 ; input = i_stream_create_fd ( part -> temp_fd , IO_BLOCK_SIZE , FALSE ) ; while ( i_stream_read_data ( input , & data , & size , 0 ) > 0 ) { o_stream_nsend ( output , data , size ) ; i_stream_skip ( input , size ) ; } if ( input -> stream_errno != 0 ) { * error_r = t_strdup_printf ( "read(%s) failed: %s" , i_stream_get_name ( input ) , i_stream_get_error ( input ) ) ; ret = - 1 ; } i_stream_destroy ( & input ) ; if ( astream -> set . close_attachment_ostream ( output , ret == 0 , error_r , astream -> context ) < 0 ) ret = - 1 ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * i_alloc_struct_immovable ( gs_memory_t * mem , gs_memory_type_ptr_t pstype , client_name_t cname ) { gs_ref_memory_t * const imem = ( gs_ref_memory_t * ) mem ; uint size = pstype -> ssize ; obj_header_t * obj ; # ifdef MEMENTO if ( Memento_failThisEvent ( ) ) return NULL ; # endif ALLOC_CHECK_SIZE ( mem , pstype ) ; obj = alloc_obj ( imem , size , pstype , ALLOC_IMMOVABLE | ALLOC_DIRECT , cname ) ; alloc_trace ( "|+<." , imem , cname , pstype , size , obj ) ; return obj ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * parseState ( const char * s , int32_t state [ 256 ] , uint32_t * pFlags ) { const char * t ; uint32_t start , end , i ; int32_t entry ; for ( i = 0 ; i < 256 ; ++ i ) { state [ i ] = MBCS_ENTRY_FINAL ( 0 , MBCS_STATE_ILLEGAL , 0xffff ) ; } s = u_skipWhitespace ( s ) ; if ( uprv_strncmp ( "initial" , s , 7 ) == 0 ) { * pFlags = MBCS_STATE_FLAG_DIRECT ; s = u_skipWhitespace ( s + 7 ) ; if ( * s ++ != ',' ) { return s - 1 ; } } else if ( * pFlags == 0 && uprv_strncmp ( "surrogates" , s , 10 ) == 0 ) { * pFlags = MBCS_STATE_FLAG_SURROGATES ; s = u_skipWhitespace ( s + 10 ) ; if ( * s ++ != ',' ) { return s - 1 ; } } else if ( * s == 0 ) { return NULL ; } for ( ; ; ) { s = u_skipWhitespace ( s ) ; start = uprv_strtoul ( s , ( char * * ) & t , 16 ) ; if ( s == t || 0xff < start ) { return s ; } s = u_skipWhitespace ( t ) ; if ( * s == '-' ) { s = u_skipWhitespace ( s + 1 ) ; end = uprv_strtoul ( s , ( char * * ) & t , 16 ) ; if ( s == t || end < start || 0xff < end ) { return s ; } s = u_skipWhitespace ( t ) ; } else { end = start ; } if ( * s != ':' && * s != '.' ) { entry = MBCS_ENTRY_FINAL ( 0 , MBCS_STATE_VALID_16 , 0 ) ; } else { entry = MBCS_ENTRY_TRANSITION ( 0 , 0 ) ; if ( * s == ':' ) { s = u_skipWhitespace ( s + 1 ) ; i = uprv_strtoul ( s , ( char * * ) & t , 16 ) ; if ( s != t ) { if ( 0x7f < i ) { return s ; } s = u_skipWhitespace ( t ) ; entry = MBCS_ENTRY_SET_STATE ( entry , i ) ; } } if ( * s == '.' ) { entry = MBCS_ENTRY_SET_FINAL ( entry ) ; s = u_skipWhitespace ( s + 1 ) ; if ( * s == 'u' ) { entry = MBCS_ENTRY_FINAL_SET_ACTION_VALUE ( entry , MBCS_STATE_UNASSIGNED , 0xfffe ) ; s = u_skipWhitespace ( s + 1 ) ; } else if ( * s == 'p' ) { if ( * pFlags != MBCS_STATE_FLAG_DIRECT ) { entry = MBCS_ENTRY_FINAL_SET_ACTION ( entry , MBCS_STATE_VALID_16_PAIR ) ; } else { entry = MBCS_ENTRY_FINAL_SET_ACTION ( entry , MBCS_STATE_VALID_16 ) ; } s = u_skipWhitespace ( s + 1 ) ; } else if ( * s == 's' ) { entry = MBCS_ENTRY_FINAL_SET_ACTION ( entry , MBCS_STATE_CHANGE_ONLY ) ; s = u_skipWhitespace ( s + 1 ) ; } else if ( * s == 'i' ) { entry = MBCS_ENTRY_FINAL_SET_ACTION_VALUE ( entry , MBCS_STATE_ILLEGAL , 0xffff ) ; s = u_skipWhitespace ( s + 1 ) ; } else { entry = MBCS_ENTRY_FINAL_SET_ACTION ( entry , MBCS_STATE_VALID_16 ) ; } } else { } } if ( MBCS_ENTRY_FINAL_ACTION ( entry ) == MBCS_STATE_VALID_16 ) { switch ( * pFlags ) { case 0 : break ; case MBCS_STATE_FLAG_DIRECT : entry = MBCS_ENTRY_FINAL_SET_ACTION_VALUE ( entry , MBCS_STATE_VALID_DIRECT_16 , 0xfffe ) ; break ; case MBCS_STATE_FLAG_SURROGATES : entry = MBCS_ENTRY_FINAL_SET_ACTION_VALUE ( entry , MBCS_STATE_VALID_16_PAIR , 0 ) ; break ; default : break ; } } for ( i = start ; i <= end ; ++ i ) { state [ i ] = entry ; } if ( * s == ',' ) { ++ s ; } else { return * s == 0 ? NULL : s ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gpgme_error_t status_handler ( void * opaque , int fd ) { struct io_cb_data * data = ( struct io_cb_data * ) opaque ; engine_gpgsm_t gpgsm = ( engine_gpgsm_t ) data -> handler_value ; gpgme_error_t err = 0 ; char * line ; size_t linelen ; do { err = assuan_read_line ( gpgsm -> assuan_ctx , & line , & linelen ) ; if ( err ) { TRACE3 ( DEBUG_CTX , "gpgme:status_handler" , gpgsm , "fd 0x%x: error from assuan (%d) getting status line : %s" , fd , err , gpg_strerror ( err ) ) ; } else if ( linelen >= 3 && line [ 0 ] == 'E' && line [ 1 ] == 'R' && line [ 2 ] == 'R' && ( line [ 3 ] == '\0' || line [ 3 ] == ' ' ) ) { if ( line [ 3 ] == ' ' ) err = atoi ( & line [ 4 ] ) ; if ( ! err ) err = gpg_error ( GPG_ERR_GENERAL ) ; TRACE2 ( DEBUG_CTX , "gpgme:status_handler" , gpgsm , "fd 0x%x: ERR line - mapped to: %s" , fd , err ? gpg_strerror ( err ) : "ok" ) ; } else if ( linelen >= 2 && line [ 0 ] == 'O' && line [ 1 ] == 'K' && ( line [ 2 ] == '\0' || line [ 2 ] == ' ' ) ) { if ( gpgsm -> status . fnc ) err = gpgsm -> status . fnc ( gpgsm -> status . fnc_value , GPGME_STATUS_EOF , "" ) ; if ( ! err && gpgsm -> colon . fnc && gpgsm -> colon . any ) { gpgsm -> colon . any = 0 ; err = gpgsm -> colon . fnc ( gpgsm -> colon . fnc_value , NULL ) ; } TRACE2 ( DEBUG_CTX , "gpgme:status_handler" , gpgsm , "fd 0x%x: OK line - final status: %s" , fd , err ? gpg_strerror ( err ) : "ok" ) ; _gpgme_io_close ( gpgsm -> status_cb . fd ) ; return err ; } else if ( linelen > 2 && line [ 0 ] == 'D' && line [ 1 ] == ' ' && gpgsm -> colon . fnc ) { char * src = line + 2 ; char * end = line + linelen ; char * dst ; char * * aline = & gpgsm -> colon . attic . line ; int * alinelen = & gpgsm -> colon . attic . linelen ; if ( gpgsm -> colon . attic . linesize < * alinelen + linelen + 1 ) { char * newline = realloc ( * aline , * alinelen + linelen + 1 ) ; if ( ! newline ) err = gpg_error_from_syserror ( ) ; else { * aline = newline ; gpgsm -> colon . attic . linesize = * alinelen + linelen + 1 ; } } if ( ! err ) { dst = * aline + * alinelen ; while ( ! err && src < end ) { if ( * src == '%' && src + 2 < end ) { ++ src ; * dst = _gpgme_hextobyte ( src ) ; ( * alinelen ) ++ ; src += 2 ; } else { * dst = * src ++ ; ( * alinelen ) ++ ; } if ( * dst == '\n' ) { gpgsm -> colon . any = 1 ; if ( * alinelen > 1 && * ( dst - 1 ) == '\r' ) dst -- ; * dst = '\0' ; err = gpgsm -> colon . fnc ( gpgsm -> colon . fnc_value , * aline ) ; if ( ! err ) { dst = * aline ; * alinelen = 0 ; } } else dst ++ ; } } TRACE2 ( DEBUG_CTX , "gpgme:status_handler" , gpgsm , "fd 0x%x: D line; final status: %s" , fd , err ? gpg_strerror ( err ) : "ok" ) ; } else if ( linelen > 2 && line [ 0 ] == 'D' && line [ 1 ] == ' ' && gpgsm -> inline_data ) { char * src = line + 2 ; char * end = line + linelen ; char * dst = src ; gpgme_ssize_t nwritten ; linelen = 0 ; while ( src < end ) { if ( * src == '%' && src + 2 < end ) { ++ src ; * dst ++ = _gpgme_hextobyte ( src ) ; src += 2 ; } else * dst ++ = * src ++ ; linelen ++ ; } src = line + 2 ; while ( linelen > 0 ) { nwritten = gpgme_data_write ( gpgsm -> inline_data , src , linelen ) ; if ( ! nwritten || ( nwritten < 0 && errno != EINTR ) || nwritten > linelen ) { err = gpg_error_from_syserror ( ) ; break ; } src += nwritten ; linelen -= nwritten ; } TRACE2 ( DEBUG_CTX , "gpgme:status_handler" , gpgsm , "fd 0x%x: D inlinedata; final status: %s" , fd , err ? gpg_strerror ( err ) : "ok" ) ; } 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 ) { if ( gpgsm -> status . fnc ) err = gpgsm -> status . fnc ( gpgsm -> status . fnc_value , r , rest ) ; } else fprintf ( stderr , "[UNKNOWN STATUS]%s %s" , line + 2 , rest ) ; TRACE3 ( DEBUG_CTX , "gpgme:status_handler" , gpgsm , "fd 0x%x: S line (%s) - final status: %s" , fd , line + 2 , err ? gpg_strerror ( err ) : "ok" ) ; } else if ( linelen >= 7 && line [ 0 ] == 'I' && line [ 1 ] == 'N' && line [ 2 ] == 'Q' && line [ 3 ] == 'U' && line [ 4 ] == 'I' && line [ 5 ] == 'R' && line [ 6 ] == 'E' && ( line [ 7 ] == '\0' || line [ 7 ] == ' ' ) ) { char * keyword = line + 7 ; while ( * keyword == ' ' ) keyword ++ ; ; default_inq_cb ( gpgsm , keyword ) ; assuan_write_line ( gpgsm -> assuan_ctx , "END" ) ; } } while ( ! err && assuan_pending_line ( gpgsm -> assuan_ctx ) ) ; return err ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void e1000e_set_ctrlext ( E1000ECore * core , int index , uint32_t val ) { trace_e1000e_link_set_ext_params ( ! ! ( val & E1000_CTRL_EXT_ASDCHK ) , ! ! ( val & E1000_CTRL_EXT_SPD_BYPS ) ) ; val &= ~ ( E1000_CTRL_EXT_ASDCHK | E1000_CTRL_EXT_EE_RST ) ; core -> mac [ CTRL_EXT ] = val ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int str_replace ( char * * text , const char * s , const char * d ) { size_t slen = strlen ( s ) ; size_t dlen = strlen ( d ) ; int diff = dlen - slen ; char * p , * q = * text ; size_t size ; if ( strstr ( * text , s ) == NULL ) return - E_NOTFOUND ; while ( ( p = strstr ( q , s ) ) != NULL ) { if ( diff > 0 ) size = strlen ( q ) + diff + 1 ; else size = strlen ( q ) + 1 ; SAFE_REALLOC ( * text , size ) ; q = * text ; p = strstr ( q , s ) ; if ( p == NULL ) continue ; memmove ( p + dlen , p + slen , strlen ( p + slen ) + 1 ) ; memcpy ( p , d , dlen ) ; q = p + dlen ; } return E_SUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void iadst16 ( const int16_t * input , int16_t * output ) { int s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 , s8 , s9 , s10 , s11 , s12 , s13 , s14 , s15 ; int x0 = input [ 15 ] ; int x1 = input [ 0 ] ; int x2 = input [ 13 ] ; int x3 = input [ 2 ] ; int x4 = input [ 11 ] ; int x5 = input [ 4 ] ; int x6 = input [ 9 ] ; int x7 = input [ 6 ] ; int x8 = input [ 7 ] ; int x9 = input [ 8 ] ; int x10 = input [ 5 ] ; int x11 = input [ 10 ] ; int x12 = input [ 3 ] ; int x13 = input [ 12 ] ; int x14 = input [ 1 ] ; int x15 = input [ 14 ] ; if ( ! ( x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 | x8 | x9 | x10 | x11 | x12 | x13 | x14 | x15 ) ) { output [ 0 ] = output [ 1 ] = output [ 2 ] = output [ 3 ] = output [ 4 ] = output [ 5 ] = output [ 6 ] = output [ 7 ] = output [ 8 ] = output [ 9 ] = output [ 10 ] = output [ 11 ] = output [ 12 ] = output [ 13 ] = output [ 14 ] = output [ 15 ] = 0 ; return ; } s0 = x0 * cospi_1_64 + x1 * cospi_31_64 ; s1 = x0 * cospi_31_64 - x1 * cospi_1_64 ; s2 = x2 * cospi_5_64 + x3 * cospi_27_64 ; s3 = x2 * cospi_27_64 - x3 * cospi_5_64 ; s4 = x4 * cospi_9_64 + x5 * cospi_23_64 ; s5 = x4 * cospi_23_64 - x5 * cospi_9_64 ; s6 = x6 * cospi_13_64 + x7 * cospi_19_64 ; s7 = x6 * cospi_19_64 - x7 * cospi_13_64 ; s8 = x8 * cospi_17_64 + x9 * cospi_15_64 ; s9 = x8 * cospi_15_64 - x9 * cospi_17_64 ; s10 = x10 * cospi_21_64 + x11 * cospi_11_64 ; s11 = x10 * cospi_11_64 - x11 * cospi_21_64 ; s12 = x12 * cospi_25_64 + x13 * cospi_7_64 ; s13 = x12 * cospi_7_64 - x13 * cospi_25_64 ; s14 = x14 * cospi_29_64 + x15 * cospi_3_64 ; s15 = x14 * cospi_3_64 - x15 * cospi_29_64 ; x0 = dct_const_round_shift ( s0 + s8 ) ; x1 = dct_const_round_shift ( s1 + s9 ) ; x2 = dct_const_round_shift ( s2 + s10 ) ; x3 = dct_const_round_shift ( s3 + s11 ) ; x4 = dct_const_round_shift ( s4 + s12 ) ; x5 = dct_const_round_shift ( s5 + s13 ) ; x6 = dct_const_round_shift ( s6 + s14 ) ; x7 = dct_const_round_shift ( s7 + s15 ) ; x8 = dct_const_round_shift ( s0 - s8 ) ; x9 = dct_const_round_shift ( s1 - s9 ) ; x10 = dct_const_round_shift ( s2 - s10 ) ; x11 = dct_const_round_shift ( s3 - s11 ) ; x12 = dct_const_round_shift ( s4 - s12 ) ; x13 = dct_const_round_shift ( s5 - s13 ) ; x14 = dct_const_round_shift ( s6 - s14 ) ; x15 = dct_const_round_shift ( s7 - s15 ) ; s0 = x0 ; s1 = x1 ; s2 = x2 ; s3 = x3 ; s4 = x4 ; s5 = x5 ; s6 = x6 ; s7 = x7 ; s8 = x8 * cospi_4_64 + x9 * cospi_28_64 ; s9 = x8 * cospi_28_64 - x9 * cospi_4_64 ; s10 = x10 * cospi_20_64 + x11 * cospi_12_64 ; s11 = x10 * cospi_12_64 - x11 * cospi_20_64 ; s12 = - x12 * cospi_28_64 + x13 * cospi_4_64 ; s13 = x12 * cospi_4_64 + x13 * cospi_28_64 ; s14 = - x14 * cospi_12_64 + x15 * cospi_20_64 ; s15 = x14 * cospi_20_64 + x15 * cospi_12_64 ; x0 = s0 + s4 ; x1 = s1 + s5 ; x2 = s2 + s6 ; x3 = s3 + s7 ; x4 = s0 - s4 ; x5 = s1 - s5 ; x6 = s2 - s6 ; x7 = s3 - s7 ; x8 = dct_const_round_shift ( s8 + s12 ) ; x9 = dct_const_round_shift ( s9 + s13 ) ; x10 = dct_const_round_shift ( s10 + s14 ) ; x11 = dct_const_round_shift ( s11 + s15 ) ; x12 = dct_const_round_shift ( s8 - s12 ) ; x13 = dct_const_round_shift ( s9 - s13 ) ; x14 = dct_const_round_shift ( s10 - s14 ) ; x15 = dct_const_round_shift ( s11 - s15 ) ; s0 = x0 ; s1 = x1 ; s2 = x2 ; s3 = x3 ; s4 = x4 * cospi_8_64 + x5 * cospi_24_64 ; s5 = x4 * cospi_24_64 - x5 * cospi_8_64 ; s6 = - x6 * cospi_24_64 + x7 * cospi_8_64 ; s7 = x6 * cospi_8_64 + x7 * cospi_24_64 ; s8 = x8 ; s9 = x9 ; s10 = x10 ; s11 = x11 ; s12 = x12 * cospi_8_64 + x13 * cospi_24_64 ; s13 = x12 * cospi_24_64 - x13 * cospi_8_64 ; s14 = - x14 * cospi_24_64 + x15 * cospi_8_64 ; s15 = x14 * cospi_8_64 + x15 * cospi_24_64 ; x0 = s0 + s2 ; x1 = s1 + s3 ; x2 = s0 - s2 ; x3 = s1 - s3 ; x4 = dct_const_round_shift ( s4 + s6 ) ; x5 = dct_const_round_shift ( s5 + s7 ) ; x6 = dct_const_round_shift ( s4 - s6 ) ; x7 = dct_const_round_shift ( s5 - s7 ) ; x8 = s8 + s10 ; x9 = s9 + s11 ; x10 = s8 - s10 ; x11 = s9 - s11 ; x12 = dct_const_round_shift ( s12 + s14 ) ; x13 = dct_const_round_shift ( s13 + s15 ) ; x14 = dct_const_round_shift ( s12 - s14 ) ; x15 = dct_const_round_shift ( s13 - s15 ) ; s2 = ( - cospi_16_64 ) * ( x2 + x3 ) ; s3 = cospi_16_64 * ( x2 - x3 ) ; s6 = cospi_16_64 * ( x6 + x7 ) ; s7 = cospi_16_64 * ( - x6 + x7 ) ; s10 = cospi_16_64 * ( x10 + x11 ) ; s11 = cospi_16_64 * ( - x10 + x11 ) ; s14 = ( - cospi_16_64 ) * ( x14 + x15 ) ; s15 = cospi_16_64 * ( x14 - x15 ) ; x2 = dct_const_round_shift ( s2 ) ; x3 = dct_const_round_shift ( s3 ) ; x6 = dct_const_round_shift ( s6 ) ; x7 = dct_const_round_shift ( s7 ) ; x10 = dct_const_round_shift ( s10 ) ; x11 = dct_const_round_shift ( s11 ) ; x14 = dct_const_round_shift ( s14 ) ; x15 = dct_const_round_shift ( s15 ) ; output [ 0 ] = x0 ; output [ 1 ] = - x8 ; output [ 2 ] = x12 ; output [ 3 ] = - x4 ; output [ 4 ] = x6 ; output [ 5 ] = x14 ; output [ 6 ] = x10 ; output [ 7 ] = x2 ; output [ 8 ] = x3 ; output [ 9 ] = x11 ; output [ 10 ] = x15 ; output [ 11 ] = x7 ; output [ 12 ] = x5 ; output [ 13 ] = - x13 ; output [ 14 ] = x9 ; output [ 15 ] = - x1 ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int dumpcff ( struct alltabs * at , SplineFont * sf , enum fontformat format , FILE * cff ) { int ret ; if ( format == ff_cff ) { AssignTTFGlyph ( & at -> gi , sf , at -> map , true ) ; ret = dumptype2glyphs ( sf , at ) ; } else { SFDummyUpCIDs ( & at -> gi , sf ) ; ret = dumpcidglyphs ( sf , at ) ; free ( sf -> glyphs ) ; sf -> glyphs = NULL ; sf -> glyphcnt = sf -> glyphmax = 0 ; } free ( at -> gi . bygid ) ; if ( ! ret ) at -> error = true ; else if ( at -> gi . flags & ps_flag_nocffsugar ) { if ( ! ttfcopyfile ( cff , at -> cfff , 0 , "CFF" ) ) at -> error = true ; } else { long len ; char buffer [ 80 ] ; fprintf ( cff , "%%!PS-Adobe-3.0 Resource-FontSet\n" ) ; fprintf ( cff , "%%%%DocumentNeedResources:ProcSet (FontSetInit)\n" ) ; fprintf ( cff , "%%%%Title: (FontSet/%s)\n" , sf -> fontname ) ; fprintf ( cff , "%%%%EndComments\n" ) ; fprintf ( cff , "%%%%IncludeResource: ProcSet(FontSetInit)\n" ) ; fprintf ( cff , "%%%%BeginResource: FontSet(%s)\n" , sf -> fontname ) ; fprintf ( cff , "/FontSetInit /ProcSet findresource begin\n" ) ; fseek ( at -> cfff , 0 , SEEK_END ) ; len = ftell ( at -> cfff ) ; rewind ( at -> cfff ) ; sprintf ( buffer , "/%s %ld StartData\n" , sf -> fontname , len ) ; fprintf ( cff , "%%%%BeginData: %ld Binary Bytes\n" , ( long ) ( len + strlen ( buffer ) ) ) ; fputs ( buffer , cff ) ; if ( ! ttfcopyfile ( cff , at -> cfff , ftell ( cff ) , "CFF" ) ) at -> error = true ; fprintf ( cff , "\n%%%%EndData\n" ) ; fprintf ( cff , "%%%%EndResource\n" ) ; fprintf ( cff , "%%%%EOF\n" ) ; } return ( ! at -> error ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void * qemu_dummy_cpu_thread_fn ( void * arg ) { # ifdef _WIN32 fprintf ( stderr , "qtest is not supported under Windows\n" ) ; exit ( 1 ) ; # else CPUState * cpu = arg ; sigset_t waitset ; int r ; qemu_mutex_lock_iothread ( ) ; qemu_thread_get_self ( cpu -> thread ) ; cpu -> thread_id = qemu_get_thread_id ( ) ; sigemptyset ( & waitset ) ; sigaddset ( & waitset , SIG_IPI ) ; cpu -> created = true ; qemu_cond_signal ( & qemu_cpu_cond ) ; cpu_single_env = cpu -> env_ptr ; while ( 1 ) { cpu_single_env = NULL ; qemu_mutex_unlock_iothread ( ) ; do { int sig ; r = sigwait ( & waitset , & sig ) ; } while ( r == - 1 && ( errno == EAGAIN || errno == EINTR ) ) ; if ( r == - 1 ) { perror ( "sigwait" ) ; exit ( 1 ) ; } qemu_mutex_lock_iothread ( ) ; cpu_single_env = cpu -> env_ptr ; qemu_wait_io_event_common ( cpu ) ; } return NULL ; # endif }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void tm2_free_codes ( TM2Codes * code ) { av_free ( code -> recode ) ; if ( code -> vlc . table ) ff_free_vlc ( & code -> vlc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , SameOrigin_Http ) { StartHttpServer ( ) ; NavigateTwiceInTabAndClose ( http_test_server_ -> GetURL ( "/simple.html" ) , http_test_server_ -> GetURL ( "/empty.html" ) ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 2 ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 0 ) ; FakeUserMetricsUpload ( ) ; histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementSessionPercentage , 1 ) ; int32_t ratio_bucket = histogram_tester_ . GetAllSamples ( internal : : kHttpsEngagementSessionPercentage ) [ 0 ] . min ; EXPECT_EQ ( 0 , ratio_bucket ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int dtls_get_message ( SSL * s , int * mt , unsigned long * len ) { struct hm_header_st * msg_hdr ; unsigned char * p ; unsigned long msg_len ; int ok ; long tmplen ; msg_hdr = & s -> d1 -> r_msg_hdr ; memset ( msg_hdr , 0 , sizeof ( * msg_hdr ) ) ; again : ok = dtls_get_reassembled_message ( s , & tmplen ) ; if ( tmplen == DTLS1_HM_BAD_FRAGMENT || tmplen == DTLS1_HM_FRAGMENT_RETRY ) { goto again ; } else if ( tmplen <= 0 && ! ok ) { return 0 ; } * mt = s -> s3 -> tmp . message_type ; p = ( unsigned char * ) s -> init_buf -> data ; if ( * mt == SSL3_MT_CHANGE_CIPHER_SPEC ) { if ( s -> msg_callback ) { s -> msg_callback ( 0 , s -> version , SSL3_RT_CHANGE_CIPHER_SPEC , p , 1 , s , s -> msg_callback_arg ) ; } * len = ( unsigned long ) tmplen ; return 1 ; } msg_len = msg_hdr -> msg_len ; * ( p ++ ) = msg_hdr -> type ; l2n3 ( msg_len , p ) ; s2n ( msg_hdr -> seq , p ) ; l2n3 ( 0 , p ) ; l2n3 ( msg_len , p ) ; if ( s -> version != DTLS1_BAD_VER ) { p -= DTLS1_HM_HEADER_LENGTH ; msg_len += DTLS1_HM_HEADER_LENGTH ; } if ( ! ssl3_finish_mac ( s , p , msg_len ) ) return 0 ; if ( s -> msg_callback ) s -> msg_callback ( 0 , s -> version , SSL3_RT_HANDSHAKE , p , msg_len , s , s -> msg_callback_arg ) ; memset ( msg_hdr , 0 , sizeof ( * msg_hdr ) ) ; s -> d1 -> handshake_read_seq ++ ; s -> init_msg = s -> init_buf -> data + DTLS1_HM_HEADER_LENGTH ; * len = s -> init_num ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ; DECL_PIOCTL ( PSetAcl ) ; DECL_PIOCTL ( PStoreBehind ) ; DECL_PIOCTL ( PGCPAGs ) ; DECL_PIOCTL ( PGetAcl ) ; DECL_PIOCTL ( PNoop ) ; DECL_PIOCTL ( PBogus ) ; DECL_PIOCTL ( PGetFileCell ) ; DECL_PIOCTL ( PGetWSCell ) ; DECL_PIOCTL ( PGetUserCell ) ; DECL_PIOCTL ( PSetTokens ) ; DECL_PIOCTL ( PGetVolumeStatus ) ; DECL_PIOCTL ( PSetVolumeStatus ) ; DECL_PIOCTL ( PFlush ) ; DECL_PIOCTL ( PNewStatMount ) ; DECL_PIOCTL ( PGetTokens ) ; DECL_PIOCTL ( PUnlog ) ; DECL_PIOCTL ( PMariner ) ; DECL_PIOCTL ( PCheckServers ) ; DECL_PIOCTL ( PCheckVolNames ) ; DECL_PIOCTL ( PCheckAuth ) ; DECL_PIOCTL ( PFindVolume ) ; DECL_PIOCTL ( PViceAccess ) ; DECL_PIOCTL ( PSetCacheSize ) ; DECL_PIOCTL ( PGetCacheSize ) ; DECL_PIOCTL ( PRemoveCallBack )
0False