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
void proto_tree_prime_hfid ( proto_tree * tree _U_ , const gint hfid ) { header_field_info * hfinfo ; PROTO_REGISTRAR_GET_NTH ( hfid , hfinfo ) ; hfinfo -> ref_type = HF_REF_TYPE_DIRECT ; if ( hfinfo -> parent != - 1 ) { header_field_info * parent_hfinfo ; PROTO_REGISTRAR_GET_NTH ( hfinfo -> parent , parent_hfinfo ) ; if ( parent_hfinfo -> ref_type != HF_REF_TYPE_DIRECT ) parent_hfinfo -> ref_type = HF_REF_TYPE_INDIRECT ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int mpeg4_decode_partition_a ( MpegEncContext * s ) { int mb_num ; static const int8_t quant_tab [ 4 ] = { - 1 , - 2 , 1 , 2 } ; mb_num = 0 ; s -> first_slice_line = 1 ; for ( ; s -> mb_y < s -> mb_height ; s -> mb_y ++ ) { ff_init_block_index ( s ) ; for ( ; s -> mb_x < s -> mb_width ; s -> mb_x ++ ) { const int xy = s -> mb_x + s -> mb_y * s -> mb_stride ; int cbpc ; int dir = 0 ; mb_num ++ ; ff_update_block_index ( s ) ; if ( s -> mb_x == s -> resync_mb_x && s -> mb_y == s -> resync_mb_y + 1 ) s -> first_slice_line = 0 ; if ( s -> pict_type == AV_PICTURE_TYPE_I ) { int i ; do { if ( show_bits_long ( & s -> gb , 19 ) == DC_MARKER ) { return mb_num - 1 ; } cbpc = get_vlc2 ( & s -> gb , ff_h263_intra_MCBPC_vlc . table , INTRA_MCBPC_VLC_BITS , 2 ) ; if ( cbpc < 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "cbpc corrupted at %d %d\n" , s -> mb_x , s -> mb_y ) ; return - 1 ; } } while ( cbpc == 8 ) ; s -> cbp_table [ xy ] = cbpc & 3 ; s -> current_picture . mb_type [ xy ] = MB_TYPE_INTRA ; s -> mb_intra = 1 ; if ( cbpc & 4 ) { ff_set_qscale ( s , s -> qscale + quant_tab [ get_bits ( & s -> gb , 2 ) ] ) ; } s -> current_picture . qscale_table [ xy ] = s -> qscale ; s -> mbintra_table [ xy ] = 1 ; for ( i = 0 ; i < 6 ; i ++ ) { int dc_pred_dir ; int dc = mpeg4_decode_dc ( s , i , & dc_pred_dir ) ; if ( dc < 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "DC corrupted at %d %d\n" , s -> mb_x , s -> mb_y ) ; return - 1 ; } dir <<= 1 ; if ( dc_pred_dir ) dir |= 1 ; } s -> pred_dir_table [ xy ] = dir ; } else { int mx , my , pred_x , pred_y , bits ; int16_t * const mot_val = s -> current_picture . motion_val [ 0 ] [ s -> block_index [ 0 ] ] ; const int stride = s -> b8_stride * 2 ; try_again : bits = show_bits ( & s -> gb , 17 ) ; if ( bits == MOTION_MARKER ) { return mb_num - 1 ; } skip_bits1 ( & s -> gb ) ; if ( bits & 0x10000 ) { if ( s -> pict_type == AV_PICTURE_TYPE_S && s -> vol_sprite_usage == GMC_SPRITE ) { s -> current_picture . mb_type [ xy ] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0 ; mx = get_amv ( s , 0 ) ; my = get_amv ( s , 1 ) ; } else { s -> current_picture . mb_type [ xy ] = MB_TYPE_SKIP | MB_TYPE_16x16 | MB_TYPE_L0 ; mx = my = 0 ; } mot_val [ 0 ] = mot_val [ 2 ] = mot_val [ 0 + stride ] = mot_val [ 2 + stride ] = mx ; mot_val [ 1 ] = mot_val [ 3 ] = mot_val [ 1 + stride ] = mot_val [ 3 + stride ] = my ; if ( s -> mbintra_table [ xy ] ) ff_clean_intra_table_entries ( s ) ; continue ; } cbpc = get_vlc2 ( & s -> gb , ff_h263_inter_MCBPC_vlc . table , INTER_MCBPC_VLC_BITS , 2 ) ; if ( cbpc < 0 ) { av_log ( s -> avctx , AV_LOG_ERROR , "cbpc corrupted at %d %d\n" , s -> mb_x , s -> mb_y ) ; return - 1 ; } if ( cbpc == 20 ) goto try_again ; s -> cbp_table [ xy ] = cbpc & ( 8 + 3 ) ; s -> mb_intra = ( ( cbpc & 4 ) != 0 ) ; if ( s -> mb_intra ) { s -> current_picture . mb_type [ xy ] = MB_TYPE_INTRA ; s -> mbintra_table [ xy ] = 1 ; mot_val [ 0 ] = mot_val [ 2 ] = mot_val [ 0 + stride ] = mot_val [ 2 + stride ] = 0 ; mot_val [ 1 ] = mot_val [ 3 ] = mot_val [ 1 + stride ] = mot_val [ 3 + stride ] = 0 ; } else { if ( s -> mbintra_table [ xy ] ) ff_clean_intra_table_entries ( s ) ; if ( s -> pict_type == AV_PICTURE_TYPE_S && s -> vol_sprite_usage == GMC_SPRITE && ( cbpc & 16 ) == 0 ) s -> mcsel = get_bits1 ( & s -> gb ) ; else s -> mcsel = 0 ; if ( ( cbpc & 16 ) == 0 ) { ff_h263_pred_motion ( s , 0 , 0 , & pred_x , & pred_y ) ; if ( ! s -> mcsel ) { mx = ff_h263_decode_motion ( s , pred_x , s -> f_code ) ; if ( mx >= 0xffff ) return - 1 ; my = ff_h263_decode_motion ( s , pred_y , s -> f_code ) ; if ( my >= 0xffff ) return - 1 ; s -> current_picture . mb_type [ xy ] = MB_TYPE_16x16 | MB_TYPE_L0 ; } else { mx = get_amv ( s , 0 ) ; my = get_amv ( s , 1 ) ; s -> current_picture . mb_type [ xy ] = MB_TYPE_16x16 | MB_TYPE_GMC | MB_TYPE_L0 ; } mot_val [ 0 ] = mot_val [ 2 ] = mot_val [ 0 + stride ] = mot_val [ 2 + stride ] = mx ; mot_val [ 1 ] = mot_val [ 3 ] = mot_val [ 1 + stride ] = mot_val [ 3 + stride ] = my ; } else { int i ; s -> current_picture . mb_type [ xy ] = MB_TYPE_8x8 | MB_TYPE_L0 ; for ( i = 0 ; i < 4 ; i ++ ) { int16_t * mot_val = ff_h263_pred_motion ( s , i , 0 , & pred_x , & pred_y ) ; mx = ff_h263_decode_motion ( s , pred_x , s -> f_code ) ; if ( mx >= 0xffff ) return - 1 ; my = ff_h263_decode_motion ( s , pred_y , s -> f_code ) ; if ( my >= 0xffff ) return - 1 ; mot_val [ 0 ] = mx ; mot_val [ 1 ] = my ; } } } } } s -> mb_x = 0 ; } return mb_num ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int virLogVersionString ( const char * * rawmsg , char * * msg ) { * rawmsg = VIR_LOG_VERSION_STRING ; return virLogFormatString ( msg , 0 , NULL , VIR_LOG_INFO , VIR_LOG_VERSION_STRING ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_H261VideoCapability ( 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_H261VideoCapability , H261VideoCapability_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void pdf_run_c ( fz_context * ctx , pdf_processor * proc , float x1 , float y1 , float x2 , float y2 , float x3 , float y3 ) { pdf_run_processor * pr = ( pdf_run_processor * ) proc ; fz_curveto ( ctx , pr -> path , x1 , y1 , x2 , y2 , x3 , y3 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int TSUrlLengthGet ( TSMBuffer bufp , TSMLoc obj ) { sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ; sdk_assert ( sdk_sanity_check_url_handle ( obj ) == TS_SUCCESS ) ; URLImpl * url_impl = ( URLImpl * ) obj ; return url_length_get ( url_impl ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void hashglyphadd ( SplineChar * sc , UHash * uhash , NHash * nhash ) { int hash ; struct splinecharlist * test ; struct altuni * alt ; if ( sc -> unicodeenc == - 1 && sc -> altuni == NULL ) { hash = hashname ( sc -> name ) ; test = chunkalloc ( sizeof ( struct splinecharlist ) ) ; test -> sc = sc ; test -> next = ( * nhash ) [ hash ] ; ( * nhash ) [ hash ] = test ; } else if ( sc -> unicodeenc != - 1 ) { hash = sc -> unicodeenc & 0xffff ; test = chunkalloc ( sizeof ( struct splinecharlist ) ) ; test -> sc = sc ; test -> next = ( * uhash ) [ hash ] ; ( * uhash ) [ hash ] = test ; } for ( alt = sc -> altuni ; alt != NULL ; alt = alt -> next ) { hash = alt -> unienc & 0xffff ; test = chunkalloc ( sizeof ( struct splinecharlist ) ) ; test -> sc = sc ; test -> next = ( * uhash ) [ hash ] ; ( * uhash ) [ hash ] = test ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void TestFramePrinting ( WebLocalFrameImpl * frame ) { WebPrintParams print_params ; WebSize page_size ( 500 , 500 ) ; print_params . print_content_area . width = page_size . width ; print_params . print_content_area . height = page_size . height ; EXPECT_EQ ( 1 , frame -> PrintBegin ( print_params , WebNode ( ) ) ) ; PaintRecorder recorder ; frame -> PrintPagesForTesting ( recorder . beginRecording ( IntRect ( ) ) , page_size ) ; frame -> PrintEnd ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void InitDumpOptions ( DumpOptions * opts ) { memset ( opts , 0 , sizeof ( DumpOptions ) ) ; opts -> include_everything = true ; opts -> dumpSections = DUMP_UNSECTIONED ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_rsl_ie_cause ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) { proto_item * ti ; proto_tree * ie_tree ; guint length ; guint8 octet ; int ie_offset ; guint8 ie_id ; if ( is_mandatory == FALSE ) { ie_id = tvb_get_guint8 ( tvb , offset ) ; if ( ie_id != RSL_IE_CAUSE ) return offset ; } ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_ie_cause , & ti , "Cause IE" ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; length = tvb_get_guint8 ( tvb , offset ) ; proto_item_set_len ( ti , length + 2 ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_length , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; ie_offset = offset ; octet = tvb_get_guint8 ( tvb , offset ) ; proto_tree_add_item ( tree , hf_rsl_extension_bit , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( tree , hf_rsl_class , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; if ( ( octet & 0x80 ) == 0x80 ) offset ++ ; return ie_offset + length ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gint dissect_AllJoyn_message ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gint offset ) { proto_item * message_item ; proto_tree * message_tree ; gint last_offset = - 1 ; gint packet_length ; gboolean is_ardp = FALSE ; if ( offset != 0 ) { is_ardp = TRUE ; } pinfo -> desegment_len = 0 ; packet_length = tvb_reported_length ( tvb ) ; col_clear ( pinfo -> cinfo , COL_INFO ) ; col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "ALLJOYN" ) ; message_item = proto_tree_add_item ( tree , proto_AllJoyn_mess , tvb , offset , - 1 , ENC_NA ) ; message_tree = proto_item_add_subtree ( message_item , ett_alljoyn_mess ) ; while ( offset < packet_length && offset > last_offset ) { last_offset = offset ; if ( ! is_ardp ) { offset = handle_message_connect ( tvb , pinfo , offset , message_tree ) ; if ( offset >= packet_length ) { break ; } offset = handle_message_sasl ( tvb , pinfo , offset , message_tree ) ; if ( offset >= packet_length ) { break ; } } offset = handle_message_header_body ( tvb , pinfo , offset , message_tree , is_ardp ) ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct object_list * * add_one_object ( struct object * obj , struct object_list * * p ) { struct object_list * entry = xmalloc ( sizeof ( struct object_list ) ) ; entry -> item = obj ; entry -> next = * p ; * p = entry ; return & entry -> next ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void fill_64 ( uint8_t * dst , const uint64_t pix , int32_t n , int32_t row_offset ) { for ( ; n > 0 ; dst += row_offset , n -- ) AV_WN64A ( dst , pix ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( OmniboxEditTest , AdjustTextForCopy ) { struct Data { const char * perm_text ; const int sel_start ; const bool is_all_selected ; const char * input ; const char * expected_output ; const bool write_url ; const char * expected_url ; } input [ ] = { { "a.de/b" , 0 , true , "a.de/b" , "http://a.de/b" , true , "http://a.de/b" , } , { "a.de/b" , 0 , false , "a.de/" , "http://a.de/" , true , "http://a.de/" } , { "a.de/b" , 0 , false , "a.de/c" , "http://a.de/c" , true , "http://a.de/c" } , { "a.de/b" , 0 , false , "a.com/b" , "a.com/b" , false , "" } , { "a.de/b" , 1 , false , "a.de/b" , "a.de/b" , false , "" } , { "a.de/" , 0 , false , "a.d" , "a.d" , false , "" } , { "https://a.com/" , 0 , false , "a.com/" , "a.com/" , false , "" } , { "a.de/" , 0 , false , "a.de.com/" , "a.de.com/" , false , "" } , { "a.de/" , 0 , false , "http://a.de/" , "http://a.de/" , true , "http://a.de/" } , { "b/foo" , 0 , true , "b/foo" , "http://b/foo" , true , "http://b/foo" } , { "www.google.com/search?" , 0 , false , "foo" , "foo" , false , "" } , } ; for ( size_t i = 0 ; i < arraysize ( input ) ; ++ i ) { toolbar_model ( ) -> set_text ( base : : ASCIIToUTF16 ( input [ i ] . perm_text ) ) ; model ( ) -> UpdatePermanentText ( ) ; base : : string16 result = base : : ASCIIToUTF16 ( input [ i ] . input ) ; GURL url ; bool write_url ; model ( ) -> AdjustTextForCopy ( input [ i ] . sel_start , input [ i ] . is_all_selected , & result , & url , & write_url ) ; EXPECT_EQ ( base : : ASCIIToUTF16 ( input [ i ] . expected_output ) , result ) << "@: " << i ; EXPECT_EQ ( input [ i ] . write_url , write_url ) << " @" << i ; if ( write_url ) EXPECT_EQ ( input [ i ] . expected_url , url . spec ( ) ) << " @" << i ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int archive_string_normalize_D ( struct archive_string * as , const void * _p , size_t len , struct archive_string_conv * sc ) { const char * s = ( const char * ) _p ; char * p , * endp ; uint32_t uc , uc2 ; size_t w ; int always_replace , n , n2 , ret = 0 , spair , ts , tm ; int ( * parse ) ( uint32_t * , const char * , size_t ) ; size_t ( * unparse ) ( char * , size_t , uint32_t ) ; always_replace = 1 ; ts = 1 ; if ( sc -> flag & SCONV_TO_UTF16BE ) { unparse = unicode_to_utf16be ; ts = 2 ; if ( sc -> flag & SCONV_FROM_UTF16BE ) always_replace = 0 ; } else if ( sc -> flag & SCONV_TO_UTF16LE ) { unparse = unicode_to_utf16le ; ts = 2 ; if ( sc -> flag & SCONV_FROM_UTF16LE ) always_replace = 0 ; } else if ( sc -> flag & SCONV_TO_UTF8 ) { unparse = unicode_to_utf8 ; if ( sc -> flag & SCONV_FROM_UTF8 ) always_replace = 0 ; } else { always_replace = 0 ; if ( sc -> flag & SCONV_FROM_UTF16BE ) { unparse = unicode_to_utf16be ; ts = 2 ; } else if ( sc -> flag & SCONV_FROM_UTF16LE ) { unparse = unicode_to_utf16le ; ts = 2 ; } else { unparse = unicode_to_utf8 ; } } if ( sc -> flag & SCONV_FROM_UTF16BE ) { parse = utf16be_to_unicode ; tm = 1 ; spair = 4 ; } else if ( sc -> flag & SCONV_FROM_UTF16LE ) { parse = utf16le_to_unicode ; tm = 1 ; spair = 4 ; } else { parse = cesu8_to_unicode ; tm = ts ; spair = 6 ; } if ( archive_string_ensure ( as , as -> length + len * tm + ts ) == NULL ) return ( - 1 ) ; p = as -> s + as -> length ; endp = as -> s + as -> buffer_length - ts ; while ( ( n = parse ( & uc , s , len ) ) != 0 ) { const char * ucptr ; uint32_t cp1 , cp2 ; int SIndex ; struct { uint32_t uc ; int ccc ; } fdc [ FDC_MAX ] ; int fdi , fdj ; int ccc ; check_first_code : if ( n < 0 ) { UNPARSE ( p , endp , uc ) ; s += n * - 1 ; len -= n * - 1 ; ret = - 1 ; continue ; } else if ( n == spair || always_replace ) ucptr = NULL ; else ucptr = s ; s += n ; len -= n ; if ( ( SIndex = uc - HC_SBASE ) >= 0 && SIndex < HC_SCOUNT ) { int L = HC_LBASE + SIndex / HC_NCOUNT ; int V = HC_VBASE + ( SIndex % HC_NCOUNT ) / HC_TCOUNT ; int T = HC_TBASE + SIndex % HC_TCOUNT ; REPLACE_UC_WITH ( L ) ; WRITE_UC ( ) ; REPLACE_UC_WITH ( V ) ; WRITE_UC ( ) ; if ( T != HC_TBASE ) { REPLACE_UC_WITH ( T ) ; WRITE_UC ( ) ; } continue ; } if ( IS_DECOMPOSABLE_BLOCK ( uc ) && CCC ( uc ) != 0 ) { WRITE_UC ( ) ; continue ; } fdi = 0 ; while ( get_nfd ( & cp1 , & cp2 , uc ) && fdi < FDC_MAX ) { int k ; for ( k = fdi ; k > 0 ; k -- ) fdc [ k ] = fdc [ k - 1 ] ; fdc [ 0 ] . ccc = CCC ( cp2 ) ; fdc [ 0 ] . uc = cp2 ; fdi ++ ; REPLACE_UC_WITH ( cp1 ) ; } while ( ( n2 = parse ( & uc2 , s , len ) ) > 0 && ( ccc = CCC ( uc2 ) ) != 0 && fdi < FDC_MAX ) { int j , k ; s += n2 ; len -= n2 ; for ( j = 0 ; j < fdi ; j ++ ) { if ( fdc [ j ] . ccc > ccc ) break ; } if ( j < fdi ) { for ( k = fdi ; k > j ; k -- ) fdc [ k ] = fdc [ k - 1 ] ; fdc [ j ] . ccc = ccc ; fdc [ j ] . uc = uc2 ; } else { fdc [ fdi ] . ccc = ccc ; fdc [ fdi ] . uc = uc2 ; } fdi ++ ; } WRITE_UC ( ) ; for ( fdj = 0 ; fdj < fdi ; fdj ++ ) { REPLACE_UC_WITH ( fdc [ fdj ] . uc ) ; WRITE_UC ( ) ; } if ( n2 == 0 ) break ; REPLACE_UC_WITH ( uc2 ) ; n = n2 ; goto check_first_code ; } as -> length = p - as -> s ; as -> s [ as -> length ] = '\0' ; if ( ts == 2 ) as -> s [ as -> length + 1 ] = '\0' ; return ( ret ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int for_real_continue ( i_ctx_t * i_ctx_p ) { os_ptr op = osp ; es_ptr ep = esp ; float var = ep [ - 3 ] . value . realval ; float incr = ep [ - 2 ] . value . realval ; if ( incr >= 0 ? ( var > ep [ - 1 ] . value . realval ) : ( var < ep [ - 1 ] . value . realval ) ) { esp -= 5 ; return o_pop_estack ; } push ( 1 ) ; ref_assign ( op , ep - 3 ) ; ep [ - 3 ] . value . realval = var + incr ; esp = ep + 2 ; ref_assign ( ep + 2 , ep ) ; return o_push_estack ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( BluetoothChooserBrowserTest , InvokeDialog_ScanningBubble ) { set_status ( FakeBluetoothChooserController : : BluetoothStatus : : SCANNING ) ; RunDialog ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Datum ExecEvalScalarVarFast ( ExprState * exprstate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { Var * variable = ( Var * ) exprstate -> expr ; TupleTableSlot * slot ; AttrNumber attnum ; if ( isDone ) * isDone = ExprSingleResult ; switch ( variable -> varno ) { case INNER_VAR : slot = econtext -> ecxt_innertuple ; break ; case OUTER_VAR : slot = econtext -> ecxt_outertuple ; break ; default : slot = econtext -> ecxt_scantuple ; break ; } attnum = variable -> varattno ; return slot_getattr ( slot , attnum , isNull ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TIFFCvtNativeToIEEEDouble ( TIFF * tif , u_int n , double * f ) { double_t * fp = ( double_t * ) f ; while ( n -- > 0 ) { NATIVE2IEEEDOUBLE ( fp ) ; fp ++ ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void multiple_write_cb ( int fd , short event , void * arg ) { struct event * ev = arg ; int len ; len = 128 ; if ( woff + len >= sizeof ( wbuf ) ) len = sizeof ( wbuf ) - woff ; len = write ( fd , wbuf + woff , len ) ; if ( len == - 1 ) { fprintf ( stderr , "%s: write\n" , __func__ ) ; if ( usepersist ) event_del ( ev ) ; return ; } woff += len ; if ( woff >= sizeof ( wbuf ) ) { shutdown ( fd , SHUT_WR ) ; if ( usepersist ) event_del ( ev ) ; return ; } if ( ! usepersist ) { if ( event_add ( ev , NULL ) == - 1 ) exit ( 1 ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint16 de_tp_epc_ue_tl_a_lb_setup ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) { guint32 curr_offset ; guint32 count , nb_lb ; guint8 drb ; proto_tree * lb_setup_tree = NULL ; proto_item * ti ; curr_offset = offset ; count = 0 ; nb_lb = len / 3 ; ti = proto_tree_add_uint ( tree , hf_gsm_a_dtap_num_lb_entities , tvb , curr_offset , 1 , nb_lb ) ; proto_item_set_len ( ti , len ) ; while ( ( count < nb_lb ) && ( count < 8 ) ) { lb_setup_tree = proto_tree_add_subtree_format ( tree , tvb , curr_offset , 3 , ett_epc_ue_tl_a_lb_setup , NULL , "LB entity %d" , count ) ; proto_tree_add_bits_item ( lb_setup_tree , hf_gsm_a_dtap_epc_ue_tl_a_ul_sdu_size , tvb , curr_offset << 3 , 16 , ENC_BIG_ENDIAN ) ; curr_offset += 2 ; drb = tvb_get_guint8 ( tvb , curr_offset ) & 0x1f ; proto_tree_add_uint_format_value ( lb_setup_tree , hf_gsm_a_dtap_epc_ue_tl_a_drb , tvb , curr_offset , 1 , drb , "%d (%d)" , drb + 1 , drb ) ; curr_offset ++ ; count ++ ; } EXTRANEOUS_DATA_CHECK ( len , curr_offset - offset , pinfo , & ei_gsm_a_dtap_extraneous_data ) ; return ( len ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_CPMGetQueryStatus ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * parent_tree , gboolean in , void * data _U_ ) { gint offset = 16 ; proto_item * item ; proto_tree * tree ; item = proto_tree_add_item ( parent_tree , hf_mswsp_msg , tvb , offset , - 1 , ENC_NA ) ; tree = proto_item_add_subtree ( item , ett_mswsp_msg ) ; proto_item_set_text ( item , "GetQueryStatus%s" , in ? "In" : "Out" ) ; col_append_str ( pinfo -> cinfo , COL_INFO , "GetQueryStatus" ) ; if ( in ) { proto_tree_add_item ( tree , hf_mswsp_msg_cpmgetquerystatus_hcursor , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; } else { proto_tree_add_item ( tree , hf_mswsp_msg_cpmgetquerystatus_qstatus , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ; } return tvb_reported_length ( tvb ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int log_test_handler ( TSCont contp , TSEvent event , void * ) { TSFile filep ; char buf [ 1024 ] ; bool str_found ; int retVal = 0 ; TSAssert ( event == TS_EVENT_TIMEOUT ) ; LogTestData * data = ( LogTestData * ) TSContDataGet ( contp ) ; TSAssert ( data -> magic == MAGIC_ALIVE ) ; if ( ( filep = TSfopen ( data -> fullpath_logname , "r" ) ) == nullptr ) { SDK_RPRINT ( data -> test , "TSTextLogObject" , "TestCase1" , TC_FAIL , "can not open log file %s" , data -> fullpath_logname ) ; * ( data -> pstatus ) = REGRESSION_TEST_FAILED ; return - 1 ; } else { str_found = false ; while ( TSfgets ( filep , buf , 1024 ) != nullptr ) { if ( strstr ( buf , LOG_TEST_PATTERN ) != nullptr ) { str_found = true ; break ; } } TSfclose ( filep ) ; if ( str_found == false ) { SDK_RPRINT ( data -> test , "TSTextLogObject" , "TestCase1" , TC_FAIL , "can not find pattern %s in log file" , LOG_TEST_PATTERN ) ; * ( data -> pstatus ) = REGRESSION_TEST_FAILED ; return - 1 ; } } retVal = TSTextLogObjectDestroy ( data -> log ) ; if ( retVal != TS_SUCCESS ) { SDK_RPRINT ( data -> test , "TSTextLogObjectDestroy" , "TestCase1" , TC_FAIL , "can not destroy log object" ) ; * ( data -> pstatus ) = REGRESSION_TEST_FAILED ; return - 1 ; } else { SDK_RPRINT ( data -> test , "TSTextLogObjectDestroy" , "TestCase1" , TC_PASS , "ok" ) ; } * ( data -> pstatus ) = REGRESSION_TEST_PASSED ; SDK_RPRINT ( data -> test , "TSTextLogObject" , "TestCase1" , TC_PASS , "ok" ) ; int i = - 1 , l = 0 ; char c ; while ( c = data -> fullpath_logname [ l ] , c != 0 ) { if ( c == '/' ) { i = l ; } ++ l ; } char * meta_filename = ( char * ) ats_malloc ( l + 7 ) ; if ( i < 0 ) { ink_string_concatenate_strings ( meta_filename , "." , data -> fullpath_logname , ".meta" , NULL ) ; } else { memcpy ( meta_filename , data -> fullpath_logname , i + 1 ) ; ink_string_concatenate_strings ( & meta_filename [ i + 1 ] , "." , & data -> fullpath_logname [ i + 1 ] , ".meta" , NULL ) ; } unlink ( data -> fullpath_logname ) ; unlink ( meta_filename ) ; TSfree ( data -> fullpath_logname ) ; TSfree ( meta_filename ) ; meta_filename = nullptr ; data -> magic = MAGIC_DEAD ; TSfree ( data ) ; data = nullptr ; return - 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * get_actual_table_name ( const char * old_table_name , MEM_ROOT * root ) { char * name = 0 ; MYSQL_RES * table_res ; MYSQL_ROW row ; char query [ 50 + 2 * NAME_LEN ] ; char show_name_buff [ FN_REFLEN ] ; DBUG_ENTER ( "get_actual_table_name" ) ; DBUG_ASSERT ( 2 * sizeof ( old_table_name ) < sizeof ( show_name_buff ) ) ; my_snprintf ( query , sizeof ( query ) , "SHOW TABLES LIKE %s" , quote_for_like ( old_table_name , show_name_buff ) ) ; if ( mysql_query_with_error_report ( mysql , 0 , query ) ) return NullS ; if ( ( table_res = mysql_store_result ( mysql ) ) ) { my_ulonglong num_rows = mysql_num_rows ( table_res ) ; if ( num_rows > 0 ) { ulong * lengths ; row = mysql_fetch_row ( table_res ) ; lengths = mysql_fetch_lengths ( table_res ) ; name = strmake_root ( root , row [ 0 ] , lengths [ 0 ] ) ; } mysql_free_result ( table_res ) ; } DBUG_PRINT ( "exit" , ( "new_table_name: %s" , name ) ) ; DBUG_RETURN ( name ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_inode_follow_link ( struct dentry * dentry , struct inode * inode , bool rcu ) { const struct cred * cred = current_cred ( ) ; struct common_audit_data ad ; struct inode_security_struct * isec ; u32 sid ; validate_creds ( cred ) ; ad . type = LSM_AUDIT_DATA_DENTRY ; ad . u . dentry = dentry ; sid = cred_sid ( cred ) ; isec = inode_security_rcu ( inode , rcu ) ; if ( IS_ERR ( isec ) ) return PTR_ERR ( isec ) ; return avc_has_perm_flags ( sid , isec -> sid , isec -> sclass , FILE__READ , & ad , rcu ? MAY_NOT_BLOCK : 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileInfo , func_name ) \ { \ spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; \ zend_error_handling error_handling ; \ if ( zend_parse_parameters_none ( ) == FAILURE ) { \ return ; \ } \ \ zend_replace_error_handling ( EH_THROW , spl_ce_RuntimeException , & error_handling TSRMLS_CC ) ; \ spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ; \ php_stat ( intern -> file_name , intern -> file_name_len , func_num , return_value TSRMLS_CC ) ; \ zend_restore_error_handling ( & error_handling TSRMLS_CC ) ; \ } FileInfoFunction ( getPerms , FS_PERMS ) FileInfoFunction ( getInode , FS_INODE ) FileInfoFunction ( getSize , FS_SIZE ) FileInfoFunction ( getOwner , FS_OWNER ) FileInfoFunction ( getGroup , FS_GROUP ) FileInfoFunction ( getATime , FS_ATIME ) FileInfoFunction ( getMTime , FS_MTIME ) FileInfoFunction ( getCTime , FS_CTIME ) FileInfoFunction ( getType , FS_TYPE ) FileInfoFunction ( isWritable , FS_IS_W ) FileInfoFunction ( isReadable , FS_IS_R ) FileInfoFunction ( isExecutable , FS_IS_X )
0False
Categorize the following code snippet as vulnerable or not. True or False
static int tree_content_set ( struct tree_entry * root , const char * p , const unsigned char * sha1 , const uint16_t mode , struct tree_content * subtree ) { struct tree_content * t ; const char * slash1 ; unsigned int i , n ; struct tree_entry * e ; slash1 = strchrnul ( p , '/' ) ; n = slash1 - p ; if ( ! n ) die ( "Empty path component found in input" ) ; if ( ! * slash1 && ! S_ISDIR ( mode ) && subtree ) die ( "Non-directories cannot have subtrees" ) ; if ( ! root -> tree ) load_tree ( root ) ; t = root -> tree ; for ( i = 0 ; i < t -> entry_count ; i ++ ) { e = t -> entries [ i ] ; if ( e -> name -> str_len == n && ! strncmp_icase ( p , e -> name -> str_dat , n ) ) { if ( ! * slash1 ) { if ( ! S_ISDIR ( mode ) && e -> versions [ 1 ] . mode == mode && ! hashcmp ( e -> versions [ 1 ] . sha1 , sha1 ) ) return 0 ; e -> versions [ 1 ] . mode = mode ; hashcpy ( e -> versions [ 1 ] . sha1 , sha1 ) ; if ( e -> tree ) release_tree_content_recursive ( e -> tree ) ; e -> tree = subtree ; if ( S_ISDIR ( e -> versions [ 0 ] . mode ) ) e -> versions [ 0 ] . mode |= NO_DELTA ; hashclr ( root -> versions [ 1 ] . sha1 ) ; return 1 ; } if ( ! S_ISDIR ( e -> versions [ 1 ] . mode ) ) { e -> tree = new_tree_content ( 8 ) ; e -> versions [ 1 ] . mode = S_IFDIR ; } if ( ! e -> tree ) load_tree ( e ) ; if ( tree_content_set ( e , slash1 + 1 , sha1 , mode , subtree ) ) { hashclr ( root -> versions [ 1 ] . sha1 ) ; return 1 ; } return 0 ; } } if ( t -> entry_count == t -> entry_capacity ) root -> tree = t = grow_tree_content ( t , t -> entry_count ) ; e = new_tree_entry ( ) ; e -> name = to_atom ( p , n ) ; e -> versions [ 0 ] . mode = 0 ; hashclr ( e -> versions [ 0 ] . sha1 ) ; t -> entries [ t -> entry_count ++ ] = e ; if ( * slash1 ) { e -> tree = new_tree_content ( 8 ) ; e -> versions [ 1 ] . mode = S_IFDIR ; tree_content_set ( e , slash1 + 1 , sha1 , mode , subtree ) ; } else { e -> tree = subtree ; e -> versions [ 1 ] . mode = mode ; hashcpy ( e -> versions [ 1 ] . sha1 , sha1 ) ; } hashclr ( root -> versions [ 1 ] . sha1 ) ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int asf_write_packet ( AVFormatContext * s , AVPacket * pkt ) { ASFContext * asf = s -> priv_data ; AVIOContext * pb = s -> pb ; ASFStream * stream ; AVCodecContext * codec ; uint32_t packet_number ; int64_t pts ; int start_sec ; int flags = pkt -> flags ; int ret ; uint64_t offset = avio_tell ( pb ) ; codec = s -> streams [ pkt -> stream_index ] -> codec ; stream = & asf -> streams [ pkt -> stream_index ] ; if ( codec -> codec_type == AVMEDIA_TYPE_AUDIO ) flags &= ~ AV_PKT_FLAG_KEY ; pts = ( pkt -> pts != AV_NOPTS_VALUE ) ? pkt -> pts : pkt -> dts ; av_assert0 ( pts != AV_NOPTS_VALUE ) ; if ( pts < - PREROLL_TIME || pts > ( INT_MAX - 3 ) / 10000LL * ASF_INDEXED_INTERVAL - PREROLL_TIME ) { av_log ( s , AV_LOG_ERROR , "input pts %" PRId64 " is invalid\n" , pts ) ; return AVERROR ( EINVAL ) ; } pts *= 10000 ; asf -> duration = FFMAX ( asf -> duration , pts + pkt -> duration * 10000 ) ; packet_number = asf -> nb_packets ; put_frame ( s , stream , s -> streams [ pkt -> stream_index ] , pkt -> dts , pkt -> data , pkt -> size , flags ) ; start_sec = ( int ) ( ( PREROLL_TIME * 10000 + pts + ASF_INDEXED_INTERVAL - 1 ) / ASF_INDEXED_INTERVAL ) ; if ( ( ! asf -> is_streamed ) && ( flags & AV_PKT_FLAG_KEY ) ) { uint16_t packet_count = asf -> nb_packets - packet_number ; ret = update_index ( s , start_sec , packet_number , packet_count , offset ) ; if ( ret < 0 ) return ret ; } asf -> end_sec = start_sec ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uchar * get_key_column ( GRANT_COLUMN * buff , size_t * length , my_bool not_used __attribute__ ( ( unused ) ) ) { * length = buff -> key_length ; return ( uchar * ) buff -> column ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int * __xmlSaveNoEmptyTags ( void ) { if ( IS_MAIN_THREAD ) return ( & xmlSaveNoEmptyTags ) ; else return ( & xmlGetGlobalState ( ) -> xmlSaveNoEmptyTags ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void finish_object ( struct object * obj , const char * name , void * cb_data ) { struct rev_list_info * info = cb_data ; if ( obj -> type == OBJ_BLOB && ! has_object_file ( & obj -> oid ) ) die ( "missing blob object '%s'" , oid_to_hex ( & obj -> oid ) ) ; if ( info -> revs -> verify_objects && ! obj -> parsed && obj -> type != OBJ_COMMIT ) parse_object ( obj -> oid . hash ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void make_sets_invisible ( REP_SETS * sets ) { sets -> invisible = sets -> count ; sets -> set += sets -> count ; sets -> count = 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint16_t * invert_lut ( uint16_t * table , int length , size_t out_length ) { int NumZeroes ; int NumPoles ; int i ; uint16_t * output = malloc ( sizeof ( uint16_t ) * out_length ) ; if ( ! output ) return NULL ; count_zeroes_and_poles ( table , length , & NumZeroes , & NumPoles ) ; for ( i = 0 ; i < out_length ; i ++ ) { double x = ( ( double ) i * 65535. ) / ( double ) ( out_length - 1 ) ; uint16_fract_t input = floor ( x + .5 ) ; output [ i ] = lut_inverse_interp16 ( input , table , length , NumZeroes , NumPoles ) ; } return output ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void print_servers ( void ) { GSList * tmp ; for ( tmp = servers ; tmp != NULL ; tmp = tmp -> next ) { SERVER_REC * rec = tmp -> data ; printformat ( NULL , NULL , MSGLEVEL_CRAP , TXT_SERVER_LIST , rec -> tag , rec -> connrec -> address , rec -> connrec -> port , rec -> connrec -> chatnet == NULL ? "" : rec -> connrec -> chatnet , rec -> connrec -> nick ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_inode_create ( struct inode * dir , struct dentry * dentry , umode_t mode ) { return may_create ( dir , dentry , SECCLASS_FILE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void e1000e_fix_icr_asserted ( E1000ECore * core ) { core -> mac [ ICR ] &= ~ E1000_ICR_ASSERTED ; if ( core -> mac [ ICR ] ) { core -> mac [ ICR ] |= E1000_ICR_ASSERTED ; } trace_e1000e_irq_fix_icr_asserted ( core -> mac [ ICR ] ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int i2d_ ## name ( type * a , unsigned char * * out ) ; DECLARE_ASN1_ITEM ( itname ) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const ( type , name ) type * d2i_ ## name ( type * * a , const unsigned char * * in , long len ) ; int i2d_ ## name ( const type * a , unsigned char * * out ) ; DECLARE_ASN1_ITEM ( name ) # define DECLARE_ASN1_NDEF_FUNCTION ( name ) int i2d_ ## name ## _NDEF ( name * a , unsigned char * * out ) ; # define DECLARE_ASN1_FUNCTIONS_const ( name ) DECLARE_ASN1_ALLOC_FUNCTIONS ( name ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( name , name ) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name ( type , name ) type * name ## _new ( void ) ; void name ## _free ( type * a ) ; # define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ; # define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ; TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ; # ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ; # define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ; # else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ; # define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ; # endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st { int type ; union { char * ptr ; ASN1_BOOLEAN boolean ; ASN1_STRING * asn1_string ; ASN1_OBJECT * object ; ASN1_INTEGER * integer ; ASN1_ENUMERATED * enumerated ; ASN1_BIT_STRING * bit_string ; ASN1_OCTET_STRING * octet_string ; ASN1_PRINTABLESTRING * printablestring ; ASN1_T61STRING * t61string ; ASN1_IA5STRING * ia5string ; ASN1_GENERALSTRING * generalstring ; ASN1_BMPSTRING * bmpstring ; ASN1_UNIVERSALSTRING * universalstring ; ASN1_UTCTIME * utctime ; ASN1_GENERALIZEDTIME * generalizedtime ; ASN1_VISIBLESTRING * visiblestring ; ASN1_UTF8STRING * utf8string ; ASN1_STRING * set ; ASN1_STRING * sequence ; ASN1_VALUE * asn1_value ; } value ; } ASN1_TYPE ; DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ; DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st { int bitnum ; const char * lname ; const char * sname ; } BIT_STRING_BITNAME ; # define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ; void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ; int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ; int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ; ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ; void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ; ASN1_OBJECT * ASN1_OBJECT_new ( void ) ; void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ; int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ; ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ; DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ; void ASN1_STRING_free ( ASN1_STRING * a ) ; void ASN1_STRING_clear_free ( ASN1_STRING * a ) ; int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ; ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ; ASN1_STRING * ASN1_STRING_type_new ( int type ) ; int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ; int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ; void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ; int ASN1_STRING_length ( const ASN1_STRING * x ) ; void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ; int ASN1_STRING_type ( const ASN1_STRING * x ) ; DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ; DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING )
0False
Categorize the following code snippet as vulnerable or not. True or False
void proto_reg_handoff_zbee_zcl_pwr_prof ( void ) { dissector_handle_t pwr_prof_handle ; pwr_prof_handle = find_dissector ( ZBEE_PROTOABBREV_ZCL_PWRPROF ) ; dissector_add_uint ( "zbee.zcl.cluster" , ZBEE_ZCL_CID_POWER_PROFILE , pwr_prof_handle ) ; zbee_zcl_init_cluster ( proto_zbee_zcl_pwr_prof , ett_zbee_zcl_pwr_prof , ZBEE_ZCL_CID_POWER_PROFILE , hf_zbee_zcl_pwr_prof_attr_id , hf_zbee_zcl_pwr_prof_srv_rx_cmd_id , hf_zbee_zcl_pwr_prof_srv_tx_cmd_id , ( zbee_zcl_fn_attr_data ) dissect_zcl_pwr_prof_attr_data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_rsl_ie_cmd_ind ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) { proto_tree * ie_tree ; guint8 ie_id ; guint8 octet ; if ( is_mandatory == FALSE ) { ie_id = tvb_get_guint8 ( tvb , offset ) ; if ( ie_id != RSL_IE_CMD_IND ) return offset ; } ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 2 , ett_ie_cmd_ind , NULL , "Command indicator IE" ) ; proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; proto_tree_add_item ( ie_tree , hf_rsl_extension_bit , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; octet = tvb_get_guint8 ( tvb , offset ) ; if ( ( octet & 0x80 ) == 0x80 ) { proto_tree_add_item ( ie_tree , hf_rsl_command , tvb , offset , 2 , ENC_BIG_ENDIAN ) ; offset = offset + 2 ; } else { proto_tree_add_item ( ie_tree , hf_rsl_command , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST ( BuildTime , DateLooksValid ) { char build_date [ ] = BUILD_DATE ; EXPECT_EQ ( 11u , strlen ( build_date ) ) ; EXPECT_EQ ( ' ' , build_date [ 3 ] ) ; EXPECT_EQ ( ' ' , build_date [ 6 ] ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int libgsm_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) { int i , ret ; LibGSMDecodeContext * s = avctx -> priv_data ; AVFrame * frame = data ; uint8_t * buf = avpkt -> data ; int buf_size = avpkt -> size ; int16_t * samples ; if ( buf_size < avctx -> block_align ) { av_log ( avctx , AV_LOG_ERROR , "Packet is too small\n" ) ; return AVERROR_INVALIDDATA ; } frame -> nb_samples = avctx -> frame_size ; if ( ( ret = ff_get_buffer ( avctx , frame ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } samples = ( int16_t * ) frame -> data [ 0 ] ; for ( i = 0 ; i < avctx -> frame_size / GSM_FRAME_SIZE ; i ++ ) { if ( ( ret = gsm_decode ( s -> state , buf , samples ) ) < 0 ) return - 1 ; buf += GSM_BLOCK_SIZE ; samples += GSM_FRAME_SIZE ; } * got_frame_ptr = 1 ; return avctx -> block_align ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorTextCommandWithFd ( qemuMonitorPtr mon , const char * cmd , int scm_fd , char * * reply ) { return qemuMonitorTextCommandWithHandler ( mon , cmd , NULL , NULL , scm_fd , reply ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int load_bitmap_entries_v1 ( struct bitmap_index * index ) { uint32_t i ; struct stored_bitmap * recent_bitmaps [ MAX_XOR_OFFSET ] = { NULL } ; for ( i = 0 ; i < index -> entry_count ; ++ i ) { int xor_offset , flags ; struct ewah_bitmap * bitmap = NULL ; struct stored_bitmap * xor_bitmap = NULL ; uint32_t commit_idx_pos ; const unsigned char * sha1 ; commit_idx_pos = read_be32 ( index -> map , & index -> map_pos ) ; xor_offset = read_u8 ( index -> map , & index -> map_pos ) ; flags = read_u8 ( index -> map , & index -> map_pos ) ; sha1 = nth_packed_object_sha1 ( index -> pack , commit_idx_pos ) ; bitmap = read_bitmap_1 ( index ) ; if ( ! bitmap ) return - 1 ; if ( xor_offset > MAX_XOR_OFFSET || xor_offset > i ) return error ( "Corrupted bitmap pack index" ) ; if ( xor_offset > 0 ) { xor_bitmap = recent_bitmaps [ ( i - xor_offset ) % MAX_XOR_OFFSET ] ; if ( xor_bitmap == NULL ) return error ( "Invalid XOR offset in bitmap pack index" ) ; } recent_bitmaps [ i % MAX_XOR_OFFSET ] = store_bitmap ( index , bitmap , sha1 , xor_bitmap , flags ) ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void die ( const char * format , ... ) { va_list arg_ptr ; va_start ( arg_ptr , format ) ; vfprintf ( stderr , format , arg_ptr ) ; va_end ( arg_ptr ) ; exit ( 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int SIPcalls_packet ( void * ptr _U_ , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * SIPinfo ) { voip_calls_tapinfo_t * tapinfo = & the_tapinfo_struct ; voip_calls_info_t * callsinfo = NULL ; sip_calls_info_t * tmp_sipinfo = NULL ; address tmp_src , tmp_dst ; gchar * frame_label = NULL ; gchar * comment = NULL ; gchar * key = NULL ; const sip_info_value_t * pi = ( const sip_info_value_t * ) SIPinfo ; if ( pi -> tap_call_id == NULL ) { return 0 ; } key = pi -> tap_call_id ; if ( NULL == tapinfo -> callsinfo_hashtable [ SIP_HASH ] ) { tapinfo -> callsinfo_hashtable [ SIP_HASH ] = g_hash_table_new_full ( g_str_hash , g_str_equal , NULL , NULL ) ; } callsinfo = ( voip_calls_info_t * ) g_hash_table_lookup ( tapinfo -> callsinfo_hashtable [ SIP_HASH ] , key ) ; if ( ( callsinfo == NULL ) && ( pi -> request_method != NULL ) ) { if ( strcmp ( pi -> request_method , "INVITE" ) == 0 ) { callsinfo = ( voip_calls_info_t * ) g_malloc0 ( sizeof ( voip_calls_info_t ) ) ; callsinfo -> call_active_state = VOIP_ACTIVE ; callsinfo -> call_state = VOIP_CALL_SETUP ; callsinfo -> from_identity = g_strdup ( pi -> tap_from_addr ) ; callsinfo -> to_identity = g_strdup ( pi -> tap_to_addr ) ; COPY_ADDRESS ( & ( callsinfo -> initial_speaker ) , & ( pinfo -> src ) ) ; callsinfo -> selected = FALSE ; callsinfo -> start_fd = pinfo -> fd ; callsinfo -> start_rel_ts = pinfo -> rel_ts ; callsinfo -> protocol = VOIP_SIP ; callsinfo -> prot_info = g_malloc ( sizeof ( sip_calls_info_t ) ) ; callsinfo -> free_prot_info = free_sip_info ; tmp_sipinfo = ( sip_calls_info_t * ) callsinfo -> prot_info ; tmp_sipinfo -> call_identifier = g_strdup ( pi -> tap_call_id ) ; tmp_sipinfo -> sip_state = SIP_INVITE_SENT ; tmp_sipinfo -> invite_cseq = pi -> tap_cseq_number ; callsinfo -> npackets = 0 ; callsinfo -> call_num = tapinfo -> ncalls ++ ; tapinfo -> callsinfo_list = g_list_prepend ( tapinfo -> callsinfo_list , callsinfo ) ; g_hash_table_insert ( tapinfo -> callsinfo_hashtable [ SIP_HASH ] , tmp_sipinfo -> call_identifier , callsinfo ) ; } } if ( callsinfo != NULL ) { tmp_sipinfo = ( sip_calls_info_t * ) callsinfo -> prot_info ; COPY_ADDRESS ( & ( tmp_src ) , & ( pinfo -> src ) ) ; COPY_ADDRESS ( & ( tmp_dst ) , & ( pinfo -> dst ) ) ; if ( pi -> request_method == NULL ) { frame_label = g_strdup_printf ( "%u %s" , pi -> response_code , pi -> reason_phrase ) ; comment = g_strdup ( "SIP Status" ) ; if ( ( tmp_sipinfo && pi -> tap_cseq_number == tmp_sipinfo -> invite_cseq ) && ( ADDRESSES_EQUAL ( & tmp_dst , & ( callsinfo -> initial_speaker ) ) ) ) { if ( ( pi -> response_code > 199 ) && ( pi -> response_code < 300 ) && ( tmp_sipinfo -> sip_state == SIP_INVITE_SENT ) ) { tmp_sipinfo -> sip_state = SIP_200_REC ; } else if ( ( pi -> response_code > 299 ) && ( tmp_sipinfo -> sip_state == SIP_INVITE_SENT ) ) { callsinfo -> call_state = VOIP_REJECTED ; tapinfo -> rejected_calls ++ ; } } } else { frame_label = g_strdup ( pi -> request_method ) ; if ( ( strcmp ( pi -> request_method , "INVITE" ) == 0 ) && ( ADDRESSES_EQUAL ( & tmp_src , & ( callsinfo -> initial_speaker ) ) ) ) { tmp_sipinfo -> invite_cseq = pi -> tap_cseq_number ; callsinfo -> call_state = VOIP_CALL_SETUP ; comment = g_strdup_printf ( "SIP From: %s To:%s" , callsinfo -> from_identity , callsinfo -> to_identity ) ; } else if ( ( strcmp ( pi -> request_method , "ACK" ) == 0 ) && ( pi -> tap_cseq_number == tmp_sipinfo -> invite_cseq ) && ( ADDRESSES_EQUAL ( & tmp_src , & ( callsinfo -> initial_speaker ) ) ) && ( tmp_sipinfo -> sip_state == SIP_200_REC ) && ( callsinfo -> call_state == VOIP_CALL_SETUP ) ) { callsinfo -> call_state = VOIP_IN_CALL ; comment = g_strdup ( "SIP Request" ) ; } else if ( strcmp ( pi -> request_method , "BYE" ) == 0 ) { callsinfo -> call_state = VOIP_COMPLETED ; tapinfo -> completed_calls ++ ; comment = g_strdup ( "SIP Request" ) ; } else if ( ( strcmp ( pi -> request_method , "CANCEL" ) == 0 ) && ( pi -> tap_cseq_number == tmp_sipinfo -> invite_cseq ) && ( ADDRESSES_EQUAL ( & tmp_src , & ( callsinfo -> initial_speaker ) ) ) && ( callsinfo -> call_state == VOIP_CALL_SETUP ) ) { callsinfo -> call_state = VOIP_CANCELLED ; tmp_sipinfo -> sip_state = SIP_CANCEL_SENT ; comment = g_strdup ( "SIP Request" ) ; } else { comment = g_strdup ( "SIP Request" ) ; } } callsinfo -> stop_fd = pinfo -> fd ; callsinfo -> stop_rel_ts = pinfo -> rel_ts ; ++ ( callsinfo -> npackets ) ; ++ ( tapinfo -> npackets ) ; add_to_graph ( tapinfo , pinfo , frame_label , comment , callsinfo -> call_num , & ( pinfo -> src ) , & ( pinfo -> dst ) , 1 ) ; g_free ( comment ) ; g_free ( frame_label ) ; g_free ( ( void * ) tmp_src . data ) ; g_free ( ( void * ) tmp_dst . data ) ; if ( ( sdp_summary != NULL ) && ( sdp_frame_num == pinfo -> fd -> num ) ) { append_to_frame_graph ( tapinfo , pinfo -> fd -> num , sdp_summary , NULL ) ; g_free ( sdp_summary ) ; sdp_summary = NULL ; } } tapinfo -> redraw = TRUE ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool ExecTargetList ( List * targetlist , TupleDesc tupdesc , ExprContext * econtext , Datum * values , bool * isnull , ExprDoneCond * itemIsDone , ExprDoneCond * isDone ) { Form_pg_attribute * att = tupdesc -> attrs ; MemoryContext oldContext ; ListCell * tl ; bool haveDoneSets ; oldContext = MemoryContextSwitchTo ( econtext -> ecxt_per_tuple_memory ) ; haveDoneSets = false ; foreach ( tl , targetlist ) { GenericExprState * gstate = ( GenericExprState * ) lfirst ( tl ) ; TargetEntry * tle = ( TargetEntry * ) gstate -> xprstate . expr ; AttrNumber resind = tle -> resno - 1 ; values [ resind ] = ExecEvalExpr ( gstate -> arg , econtext , & isnull [ resind ] , & itemIsDone [ resind ] ) ; values [ resind ] = MakeExpandedObjectReadOnly ( values [ resind ] , isnull [ resind ] , att [ resind ] -> attlen ) ; if ( itemIsDone [ resind ] != ExprSingleResult ) { if ( isDone == NULL ) ereport ( ERROR , ( errcode ( ERRCODE_FEATURE_NOT_SUPPORTED ) , errmsg ( "set-valued function called in context that cannot accept a set" ) ) ) ; if ( itemIsDone [ resind ] == ExprMultipleResult ) { * isDone = ExprMultipleResult ; } else { haveDoneSets = true ; } } } if ( haveDoneSets ) { if ( * isDone == ExprSingleResult ) { * isDone = ExprEndResult ; MemoryContextSwitchTo ( oldContext ) ; return false ; } else { foreach ( tl , targetlist ) { GenericExprState * gstate = ( GenericExprState * ) lfirst ( tl ) ; TargetEntry * tle = ( TargetEntry * ) gstate -> xprstate . expr ; AttrNumber resind = tle -> resno - 1 ; if ( itemIsDone [ resind ] == ExprEndResult ) { values [ resind ] = ExecEvalExpr ( gstate -> arg , econtext , & isnull [ resind ] , & itemIsDone [ resind ] ) ; values [ resind ] = MakeExpandedObjectReadOnly ( values [ resind ] , isnull [ resind ] , att [ resind ] -> attlen ) ; if ( itemIsDone [ resind ] == ExprEndResult ) { * isDone = ExprEndResult ; break ; } } } if ( * isDone == ExprEndResult ) { foreach ( tl , targetlist ) { GenericExprState * gstate = ( GenericExprState * ) lfirst ( tl ) ; TargetEntry * tle = ( TargetEntry * ) gstate -> xprstate . expr ; AttrNumber resind = tle -> resno - 1 ; while ( itemIsDone [ resind ] == ExprMultipleResult ) { values [ resind ] = ExecEvalExpr ( gstate -> arg , econtext , & isnull [ resind ] , & itemIsDone [ resind ] ) ; } } MemoryContextSwitchTo ( oldContext ) ; return false ; } } } MemoryContextSwitchTo ( oldContext ) ; return true ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void proto_tree_free_node ( proto_node * node , gpointer data _U_ ) { field_info * finfo = PNODE_FINFO ( node ) ; proto_tree_children_foreach ( node , proto_tree_free_node , NULL ) ; FVALUE_CLEANUP ( & finfo -> value ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuAssignDeviceChrAlias ( virDomainDefPtr def , virDomainChrDefPtr chr , ssize_t idx ) { const char * prefix = NULL ; switch ( ( virDomainChrDeviceType ) chr -> deviceType ) { case VIR_DOMAIN_CHR_DEVICE_TYPE_PARALLEL : prefix = "parallel" ; break ; case VIR_DOMAIN_CHR_DEVICE_TYPE_SERIAL : prefix = "serial" ; break ; case VIR_DOMAIN_CHR_DEVICE_TYPE_CONSOLE : prefix = "console" ; break ; case VIR_DOMAIN_CHR_DEVICE_TYPE_CHANNEL : prefix = "channel" ; break ; case VIR_DOMAIN_CHR_DEVICE_TYPE_LAST : return - 1 ; } if ( idx == - 1 && ( idx = qemuGetNextChrDevIndex ( def , chr , prefix ) ) < 0 ) return - 1 ; return virAsprintf ( & chr -> info . alias , "%s%zd" , prefix , idx ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( WebFrameTest , NavigatorPluginsClearedWhenPluginsDisabled ) { ScopedFakePluginRegistry fake_plugins ; FrameTestHelpers : : WebViewHelper web_view_helper ; web_view_helper . Initialize ( ) ; v8 : : HandleScope scope ( v8 : : Isolate : : GetCurrent ( ) ) ; v8 : : Local < v8 : : Value > result = web_view_helper . LocalMainFrame ( ) -> ExecuteScriptAndReturnValue ( WebScriptSource ( "navigator.plugins.length" ) ) ; EXPECT_NE ( 0 , result -> Int32Value ( ) ) ; web_view_helper . GetWebView ( ) -> GetPage ( ) -> GetSettings ( ) . SetPluginsEnabled ( false ) ; result = web_view_helper . LocalMainFrame ( ) -> ExecuteScriptAndReturnValue ( WebScriptSource ( "navigator.plugins.length" ) ) ; EXPECT_EQ ( 0 , result -> Int32Value ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( ExternalProtocolDialogBrowserTest , TestAcceptWithChecked ) { ShowDialog ( ) ; SetChecked ( true ) ; EXPECT_TRUE ( dialog_ -> Accept ( ) ) ; EXPECT_TRUE ( called_ ) ; EXPECT_TRUE ( accept_ ) ; EXPECT_TRUE ( remember_ ) ; histogram_tester_ . ExpectBucketCount ( ExternalProtocolHandler : : kHandleStateMetric , ExternalProtocolHandler : : CHECKED_LAUNCH , 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * search_make_new ( const struct search_state * const state , int n , const char * const base_name ) { const int base_len = strlen ( base_name ) ; const char need_to_append_dot = base_name [ base_len - 1 ] == '.' ? 0 : 1 ; struct search_domain * dom ; for ( dom = state -> head ; dom ; dom = dom -> next ) { if ( ! n -- ) { const u8 * const postfix = ( ( u8 * ) dom ) + sizeof ( struct search_domain ) ; const int postfix_len = dom -> len ; char * const newname = ( char * ) malloc ( base_len + need_to_append_dot + postfix_len + 1 ) ; if ( ! newname ) return NULL ; memcpy ( newname , base_name , base_len ) ; if ( need_to_append_dot ) newname [ base_len ] = '.' ; memcpy ( newname + base_len + need_to_append_dot , postfix , postfix_len ) ; newname [ base_len + need_to_append_dot + postfix_len ] = 0 ; return newname ; } } abort ( ) ; return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_s_supervisor_exception_detail ( proto_tree * tree , proto_item * item , tvbuff_t * tvb , int offset , int hf_size , int hf_data ) { int size ; proto_tree_add_item ( tree , hf_size , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ; size = tvb_get_guint8 ( tvb , offset ) ; proto_tree_add_item ( tree , hf_data , tvb , offset + 1 , size , ENC_NA ) ; proto_item_set_len ( item , size + 1 ) ; return size + 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_dtap ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) { static gsm_a_tap_rec_t tap_rec [ 4 ] ; static gsm_a_tap_rec_t * tap_p ; static guint tap_current = 0 ; void ( * dtap_msg_fcn ) ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len ) ; guint8 oct ; guint8 pd ; guint32 offset ; guint32 len ; guint32 oct_1 ; gint idx ; proto_item * dtap_item = NULL ; proto_tree * dtap_tree = NULL ; proto_item * oct_1_item = NULL ; proto_tree * pd_tree = NULL ; const gchar * msg_str ; gint ett_tree ; gint ti ; int hf_idx ; gboolean nsd ; sccp_msg_info_t * sccp_msg = ( sccp_msg_info_t * ) data ; len = tvb_reported_length ( tvb ) ; if ( len < 2 ) { call_data_dissector ( tvb , pinfo , tree ) ; return len ; } col_append_str ( pinfo -> cinfo , COL_INFO , "(DTAP) " ) ; tap_current ++ ; if ( tap_current >= 4 ) { tap_current = 0 ; } tap_p = & tap_rec [ tap_current ] ; offset = 0 ; g_tree = tree ; oct_1 = tvb_get_guint8 ( tvb , offset ++ ) ; if ( ( ( ( oct_1 & DTAP_TI_MASK ) >> 4 ) & DTAP_TIE_PRES_MASK ) == DTAP_TIE_PRES_MASK ) { offset ++ ; } oct = tvb_get_guint8 ( tvb , offset ) ; pd = oct_1 & DTAP_PD_MASK ; ti = - 1 ; msg_str = NULL ; ett_tree = - 1 ; hf_idx = - 1 ; dtap_msg_fcn = NULL ; nsd = FALSE ; col_append_fstr ( pinfo -> cinfo , COL_INFO , "(%s) " , val_to_str_const ( pd , gsm_a_pd_short_str_vals , "unknown" ) ) ; switch ( pd ) { case 0 : msg_str = try_val_to_str_idx ( ( guint32 ) ( oct & DTAP_GCC_IEI_MASK ) , gsm_a_dtap_msg_gcc_strings , & idx ) ; if ( msg_str != NULL ) { ett_tree = ett_gsm_dtap_msg_gcc [ idx ] ; dtap_msg_fcn = dtap_msg_gcc [ idx ] ; } hf_idx = hf_gsm_a_dtap_msg_gcc_type ; ti = ( oct_1 & DTAP_TI_MASK ) >> 4 ; nsd = TRUE ; break ; case 1 : msg_str = try_val_to_str_idx ( ( guint32 ) ( oct & DTAP_BCC_IEI_MASK ) , gsm_a_dtap_msg_bcc_strings , & idx ) ; if ( msg_str != NULL ) { ett_tree = ett_gsm_dtap_msg_bcc [ idx ] ; dtap_msg_fcn = dtap_msg_bcc [ idx ] ; } hf_idx = hf_gsm_a_dtap_msg_bcc_type ; ti = ( oct_1 & DTAP_TI_MASK ) >> 4 ; nsd = TRUE ; break ; case 3 : msg_str = try_val_to_str_idx ( ( guint32 ) ( oct & DTAP_CC_IEI_MASK ) , gsm_a_dtap_msg_cc_strings , & idx ) ; if ( msg_str != NULL ) { ett_tree = ett_gsm_dtap_msg_cc [ idx ] ; dtap_msg_fcn = dtap_msg_cc_fcn [ idx ] ; } hf_idx = hf_gsm_a_dtap_msg_cc_type ; ti = ( oct_1 & DTAP_TI_MASK ) >> 4 ; nsd = TRUE ; break ; case 5 : msg_str = try_val_to_str_idx ( ( guint32 ) ( oct & DTAP_MM_IEI_MASK ) , gsm_a_dtap_msg_mm_strings , & idx ) ; if ( msg_str != NULL ) { ett_tree = ett_gsm_dtap_msg_mm [ idx ] ; dtap_msg_fcn = dtap_msg_mm_fcn [ idx ] ; } hf_idx = hf_gsm_a_dtap_msg_mm_type ; nsd = TRUE ; break ; case 6 : get_rr_msg_params ( oct , & msg_str , & ett_tree , & hf_idx , & dtap_msg_fcn ) ; break ; case 8 : get_gmm_msg_params ( oct , & msg_str , & ett_tree , & hf_idx , & dtap_msg_fcn ) ; break ; case 9 : msg_str = try_val_to_str_idx ( ( guint32 ) ( oct & DTAP_SMS_IEI_MASK ) , gsm_a_dtap_msg_sms_strings , & idx ) ; hf_idx = hf_gsm_a_dtap_msg_sms_type ; if ( msg_str != NULL ) { ett_tree = ett_gsm_dtap_msg_sms [ idx ] ; dtap_msg_fcn = dtap_msg_sms_fcn [ idx ] ; } ti = ( oct_1 & DTAP_TI_MASK ) >> 4 ; break ; case 10 : get_sm_msg_params ( oct , & msg_str , & ett_tree , & hf_idx , & dtap_msg_fcn ) ; ti = ( oct_1 & DTAP_TI_MASK ) >> 4 ; break ; case 11 : msg_str = try_val_to_str_idx ( ( guint32 ) ( oct & DTAP_SS_IEI_MASK ) , gsm_a_dtap_msg_ss_strings , & idx ) ; hf_idx = hf_gsm_a_dtap_msg_ss_type ; if ( msg_str != NULL ) { ett_tree = ett_gsm_dtap_msg_ss [ idx ] ; dtap_msg_fcn = dtap_msg_ss_fcn [ idx ] ; } ti = ( oct_1 & DTAP_TI_MASK ) >> 4 ; nsd = TRUE ; break ; case 15 : msg_str = try_val_to_str_idx ( ( guint32 ) ( oct & DTAP_TP_IEI_MASK ) , gsm_a_dtap_msg_tp_strings , & idx ) ; hf_idx = hf_gsm_a_dtap_msg_tp_type ; if ( msg_str != NULL ) { ett_tree = ett_gsm_dtap_msg_tp [ idx ] ; dtap_msg_fcn = dtap_msg_tp_fcn [ idx ] ; } nsd = TRUE ; break ; default : return len ; } if ( sccp_msg && sccp_msg -> data . co . assoc ) { sccp_assoc = sccp_msg -> data . co . assoc ; } else { sccp_assoc = NULL ; sccp_msg = NULL ; } if ( msg_str == NULL ) { dtap_item = proto_tree_add_protocol_format ( tree , proto_a_dtap , tvb , 0 , len , "GSM A-I/F DTAP - Unknown DTAP Message Type (0x%02x)" , oct ) ; dtap_tree = proto_item_add_subtree ( dtap_item , ett_dtap_msg ) ; if ( sccp_msg && ! sccp_msg -> data . co . label ) { sccp_msg -> data . co . label = wmem_strdup_printf ( wmem_file_scope ( ) , "DTAP (0x%02x)" , oct ) ; } } else { dtap_item = proto_tree_add_protocol_format ( tree , proto_a_dtap , tvb , 0 , - 1 , "GSM A-I/F DTAP - %s" , msg_str ) ; dtap_tree = proto_item_add_subtree ( dtap_item , ett_tree ) ; if ( sccp_msg && ! sccp_msg -> data . co . label ) { sccp_msg -> data . co . label = wmem_strdup ( wmem_file_scope ( ) , msg_str ) ; } col_append_fstr ( pinfo -> cinfo , COL_INFO , "%s " , msg_str ) ; col_set_fence ( pinfo -> cinfo , COL_INFO ) ; } oct_1_item = proto_tree_add_uint ( dtap_tree , hf_gsm_a_dtap_protocol_discriminator , tvb , 0 , 1 , pd ) ; pd_tree = proto_item_add_subtree ( oct_1_item , ett_dtap_oct_1 ) ; proto_tree_add_item ( pd_tree , hf_gsm_a_L3_protocol_discriminator , tvb , 0 , 1 , ENC_BIG_ENDIAN ) ; if ( ti == - 1 ) { proto_tree_add_item ( pd_tree , hf_gsm_a_skip_ind , tvb , 0 , 1 , ENC_BIG_ENDIAN ) ; } else { proto_tree_add_item ( pd_tree , hf_gsm_a_dtap_ti_flag , tvb , 0 , 1 , ENC_NA ) ; if ( ( ti & DTAP_TIE_PRES_MASK ) == DTAP_TIE_PRES_MASK ) { proto_tree_add_uint_format_value ( pd_tree , hf_gsm_a_dtap_tio , tvb , 0 , 1 , oct_1 , "The TI value is given by the TIE in octet 2" ) ; } else { proto_tree_add_item ( pd_tree , hf_gsm_a_dtap_tio , tvb , 0 , 1 , ENC_BIG_ENDIAN ) ; } } if ( ( ti != - 1 ) && ( ti & DTAP_TIE_PRES_MASK ) == DTAP_TIE_PRES_MASK ) { proto_tree_add_item ( tree , hf_gsm_a_extension , tvb , 1 , 1 , ENC_BIG_ENDIAN ) ; proto_tree_add_item ( pd_tree , hf_gsm_a_dtap_tie , tvb , 1 , 1 , ENC_BIG_ENDIAN ) ; } if ( ( pinfo -> p2p_dir == P2P_DIR_RECV ) && nsd ) { } if ( ( pd == 5 ) || ( pd == 3 ) || ( pd == 10 ) || ( pd == 11 ) ) { proto_tree_add_item ( dtap_tree , hf_gsm_a_seq_no , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; } proto_tree_add_item ( dtap_tree , hf_idx , tvb , offset , 1 , ENC_BIG_ENDIAN ) ; offset ++ ; tap_p -> pdu_type = GSM_A_PDU_TYPE_DTAP ; tap_p -> message_type = ( nsd ? ( oct & 0x3f ) : oct ) ; tap_p -> protocol_disc = ( gsm_a_pd_str_e ) pd ; tap_queue_packet ( gsm_a_tap , pinfo , tap_p ) ; if ( msg_str == NULL ) return len ; if ( offset >= len ) return len ; if ( dtap_msg_fcn == NULL ) { proto_tree_add_item ( dtap_tree , hf_gsm_a_dtap_message_elements , tvb , offset , len - offset , ENC_NA ) ; } else { ( * dtap_msg_fcn ) ( tvb , dtap_tree , pinfo , offset , len - offset ) ; } return len ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int main ( int argc , char * argv [ ] ) { static struct option long_options [ ] = { { "data-only" , no_argument , NULL , 'a' } , { "clean" , no_argument , NULL , 'c' } , { "file" , required_argument , NULL , 'f' } , { "globals-only" , no_argument , NULL , 'g' } , { "host" , required_argument , NULL , 'h' } , { "dbname" , required_argument , NULL , 'd' } , { "database" , required_argument , NULL , 'l' } , { "oids" , no_argument , NULL , 'o' } , { "no-owner" , no_argument , NULL , 'O' } , { "port" , required_argument , NULL , 'p' } , { "roles-only" , no_argument , NULL , 'r' } , { "schema-only" , no_argument , NULL , 's' } , { "superuser" , required_argument , NULL , 'S' } , { "tablespaces-only" , no_argument , NULL , 't' } , { "username" , required_argument , NULL , 'U' } , { "verbose" , no_argument , NULL , 'v' } , { "no-password" , no_argument , NULL , 'w' } , { "password" , no_argument , NULL , 'W' } , { "no-privileges" , no_argument , NULL , 'x' } , { "no-acl" , no_argument , NULL , 'x' } , { "attribute-inserts" , no_argument , & column_inserts , 1 } , { "binary-upgrade" , no_argument , & binary_upgrade , 1 } , { "column-inserts" , no_argument , & column_inserts , 1 } , { "disable-dollar-quoting" , no_argument , & disable_dollar_quoting , 1 } , { "disable-triggers" , no_argument , & disable_triggers , 1 } , { "if-exists" , no_argument , & if_exists , 1 } , { "inserts" , no_argument , & inserts , 1 } , { "lock-wait-timeout" , required_argument , NULL , 2 } , { "no-tablespaces" , no_argument , & no_tablespaces , 1 } , { "quote-all-identifiers" , no_argument , & quote_all_identifiers , 1 } , { "role" , required_argument , NULL , 3 } , { "use-set-session-authorization" , no_argument , & use_setsessauth , 1 } , { "no-security-labels" , no_argument , & no_security_labels , 1 } , { "no-unlogged-table-data" , no_argument , & no_unlogged_table_data , 1 } , { NULL , 0 , NULL , 0 } } ; char * pghost = NULL ; char * pgport = NULL ; char * pguser = NULL ; char * pgdb = NULL ; char * use_role = NULL ; trivalue prompt_password = TRI_DEFAULT ; bool data_only = false ; bool globals_only = false ; bool output_clean = false ; bool roles_only = false ; bool tablespaces_only = false ; PGconn * conn ; int encoding ; const char * std_strings ; int c , ret ; int optindex ; set_pglocale_pgservice ( argv [ 0 ] , PG_TEXTDOMAIN ( "pg_dump" ) ) ; progname = get_progname ( argv [ 0 ] ) ; if ( argc > 1 ) { if ( strcmp ( argv [ 1 ] , "--help" ) == 0 || strcmp ( argv [ 1 ] , "-?" ) == 0 ) { help ( ) ; exit_nicely ( 0 ) ; } if ( strcmp ( argv [ 1 ] , "--version" ) == 0 || strcmp ( argv [ 1 ] , "-V" ) == 0 ) { puts ( "pg_dumpall (PostgreSQL) " PG_VERSION ) ; exit_nicely ( 0 ) ; } } if ( ( ret = find_other_exec ( argv [ 0 ] , "pg_dump" , PGDUMP_VERSIONSTR , pg_dump_bin ) ) < 0 ) { char full_path [ MAXPGPATH ] ; if ( find_my_exec ( argv [ 0 ] , full_path ) < 0 ) strlcpy ( full_path , progname , sizeof ( full_path ) ) ; if ( ret == - 1 ) fprintf ( stderr , _ ( "The program \"pg_dump\" is needed by %s " "but was not found in the\n" "same directory as \"%s\".\n" "Check your installation.\n" ) , progname , full_path ) ; else fprintf ( stderr , _ ( "The program \"pg_dump\" was found by \"%s\"\n" "but was not the same version as %s.\n" "Check your installation.\n" ) , full_path , progname ) ; exit_nicely ( 1 ) ; } pgdumpopts = createPQExpBuffer ( ) ; while ( ( c = getopt_long ( argc , argv , "acd:f:gh:l:oOp:rsS:tU:vwWx" , long_options , & optindex ) ) != - 1 ) { switch ( c ) { case 'a' : data_only = true ; appendPQExpBufferStr ( pgdumpopts , " -a" ) ; break ; case 'c' : output_clean = true ; break ; case 'd' : connstr = pg_strdup ( optarg ) ; break ; case 'f' : filename = pg_strdup ( optarg ) ; appendPQExpBufferStr ( pgdumpopts , " -f " ) ; appendShellString ( pgdumpopts , filename ) ; break ; case 'g' : globals_only = true ; break ; case 'h' : pghost = pg_strdup ( optarg ) ; break ; case 'l' : pgdb = pg_strdup ( optarg ) ; break ; case 'o' : appendPQExpBufferStr ( pgdumpopts , " -o" ) ; break ; case 'O' : appendPQExpBufferStr ( pgdumpopts , " -O" ) ; break ; case 'p' : pgport = pg_strdup ( optarg ) ; break ; case 'r' : roles_only = true ; break ; case 's' : appendPQExpBufferStr ( pgdumpopts , " -s" ) ; break ; case 'S' : appendPQExpBufferStr ( pgdumpopts , " -S " ) ; appendShellString ( pgdumpopts , optarg ) ; break ; case 't' : tablespaces_only = true ; break ; case 'U' : pguser = pg_strdup ( optarg ) ; break ; case 'v' : verbose = true ; appendPQExpBufferStr ( pgdumpopts , " -v" ) ; break ; case 'w' : prompt_password = TRI_NO ; appendPQExpBufferStr ( pgdumpopts , " -w" ) ; break ; case 'W' : prompt_password = TRI_YES ; appendPQExpBufferStr ( pgdumpopts , " -W" ) ; break ; case 'x' : skip_acls = true ; appendPQExpBufferStr ( pgdumpopts , " -x" ) ; break ; case 0 : break ; case 2 : appendPQExpBufferStr ( pgdumpopts , " --lock-wait-timeout " ) ; appendShellString ( pgdumpopts , optarg ) ; break ; case 3 : use_role = pg_strdup ( optarg ) ; appendPQExpBufferStr ( pgdumpopts , " --role " ) ; appendShellString ( pgdumpopts , use_role ) ; break ; default : fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ; exit_nicely ( 1 ) ; } } if ( optind < argc ) { fprintf ( stderr , _ ( "%s: too many command-line arguments (first is \"%s\")\n" ) , progname , argv [ optind ] ) ; fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ; exit_nicely ( 1 ) ; } if ( globals_only && roles_only ) { fprintf ( stderr , _ ( "%s: options -g/--globals-only and -r/--roles-only cannot be used together\n" ) , progname ) ; fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ; exit_nicely ( 1 ) ; } if ( globals_only && tablespaces_only ) { fprintf ( stderr , _ ( "%s: options -g/--globals-only and -t/--tablespaces-only cannot be used together\n" ) , progname ) ; fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ; exit_nicely ( 1 ) ; } if ( if_exists && ! output_clean ) { fprintf ( stderr , _ ( "%s: option --if-exists requires option -c/--clean\n" ) , progname ) ; exit_nicely ( 1 ) ; } if ( roles_only && tablespaces_only ) { fprintf ( stderr , _ ( "%s: options -r/--roles-only and -t/--tablespaces-only cannot be used together\n" ) , progname ) ; fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ; exit_nicely ( 1 ) ; } if ( binary_upgrade ) appendPQExpBufferStr ( pgdumpopts , " --binary-upgrade" ) ; if ( column_inserts ) appendPQExpBufferStr ( pgdumpopts , " --column-inserts" ) ; if ( disable_dollar_quoting ) appendPQExpBufferStr ( pgdumpopts , " --disable-dollar-quoting" ) ; if ( disable_triggers ) appendPQExpBufferStr ( pgdumpopts , " --disable-triggers" ) ; if ( inserts ) appendPQExpBufferStr ( pgdumpopts , " --inserts" ) ; if ( no_tablespaces ) appendPQExpBufferStr ( pgdumpopts , " --no-tablespaces" ) ; if ( quote_all_identifiers ) appendPQExpBufferStr ( pgdumpopts , " --quote-all-identifiers" ) ; if ( use_setsessauth ) appendPQExpBufferStr ( pgdumpopts , " --use-set-session-authorization" ) ; if ( no_security_labels ) appendPQExpBufferStr ( pgdumpopts , " --no-security-labels" ) ; if ( no_unlogged_table_data ) appendPQExpBufferStr ( pgdumpopts , " --no-unlogged-table-data" ) ; if ( pgdb ) { conn = connectDatabase ( pgdb , connstr , pghost , pgport , pguser , prompt_password , false ) ; if ( ! conn ) { fprintf ( stderr , _ ( "%s: could not connect to database \"%s\"\n" ) , progname , pgdb ) ; exit_nicely ( 1 ) ; } } else { conn = connectDatabase ( "postgres" , connstr , pghost , pgport , pguser , prompt_password , false ) ; if ( ! conn ) conn = connectDatabase ( "template1" , connstr , pghost , pgport , pguser , prompt_password , true ) ; if ( ! conn ) { fprintf ( stderr , _ ( "%s: could not connect to databases \"postgres\" or \"template1\"\n" "Please specify an alternative database.\n" ) , progname ) ; fprintf ( stderr , _ ( "Try \"%s --help\" for more information.\n" ) , progname ) ; exit_nicely ( 1 ) ; } } if ( filename ) { OPF = fopen ( filename , PG_BINARY_W ) ; if ( ! OPF ) { fprintf ( stderr , _ ( "%s: could not open the output file \"%s\": %s\n" ) , progname , filename , strerror ( errno ) ) ; exit_nicely ( 1 ) ; } } else OPF = stdout ; encoding = PQclientEncoding ( conn ) ; std_strings = PQparameterStatus ( conn , "standard_conforming_strings" ) ; if ( ! std_strings ) std_strings = "off" ; if ( use_role && server_version >= 80100 ) { PQExpBuffer query = createPQExpBuffer ( ) ; appendPQExpBuffer ( query , "SET ROLE %s" , fmtId ( use_role ) ) ; executeCommand ( conn , query -> data ) ; destroyPQExpBuffer ( query ) ; } if ( quote_all_identifiers && server_version >= 90100 ) executeCommand ( conn , "SET quote_all_identifiers = true" ) ; fprintf ( OPF , "--\n-- PostgreSQL database cluster dump\n--\n\n" ) ; if ( verbose ) dumpTimestamp ( "Started on" ) ; fprintf ( OPF , "SET default_transaction_read_only = off; \n\n" ) ; fprintf ( OPF , "SET client_encoding = '%s'; \n" , pg_encoding_to_char ( encoding ) ) ; fprintf ( OPF , "SET standard_conforming_strings = %s; \n" , std_strings ) ; if ( strcmp ( std_strings , "off" ) == 0 ) fprintf ( OPF , "SET escape_string_warning = off; \n" ) ; fprintf ( OPF , "\n" ) ; if ( ! data_only ) { if ( output_clean ) { if ( ! globals_only && ! roles_only && ! tablespaces_only ) dropDBs ( conn ) ; if ( ! roles_only && ! no_tablespaces ) { if ( server_version >= 80000 ) dropTablespaces ( conn ) ; } if ( ! tablespaces_only ) dropRoles ( conn ) ; } if ( ! tablespaces_only ) { dumpRoles ( conn ) ; if ( server_version >= 80100 ) dumpRoleMembership ( conn ) ; else dumpGroups ( conn ) ; } if ( ! roles_only && ! no_tablespaces ) { if ( server_version >= 80000 ) dumpTablespaces ( conn ) ; } if ( binary_upgrade || ( ! globals_only && ! roles_only && ! tablespaces_only ) ) dumpCreateDB ( conn ) ; if ( ! tablespaces_only && ! roles_only ) { if ( server_version >= 90000 ) dumpDbRoleConfig ( conn ) ; } } if ( ! globals_only && ! roles_only && ! tablespaces_only ) dumpDatabases ( conn ) ; PQfinish ( conn ) ; if ( verbose ) dumpTimestamp ( "Completed on" ) ; fprintf ( OPF , "--\n-- PostgreSQL database cluster dump complete\n--\n\n" ) ; if ( filename ) fclose ( OPF ) ; exit_nicely ( 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int calc_iframe_target_size_one_pass_cbr ( const VP9_COMP * cpi ) { const RATE_CONTROL * rc = & cpi -> rc ; const VP9EncoderConfig * oxcf = & cpi -> oxcf ; const SVC * const svc = & cpi -> svc ; int target ; if ( cpi -> common . current_video_frame == 0 ) { target = ( ( rc -> starting_buffer_level / 2 ) > INT_MAX ) ? INT_MAX : ( int ) ( rc -> starting_buffer_level / 2 ) ; } else { int kf_boost = 32 ; double framerate = cpi -> framerate ; if ( svc -> number_temporal_layers > 1 && oxcf -> rc_mode == VPX_CBR ) { const LAYER_CONTEXT * lc = & svc -> layer_context [ svc -> temporal_layer_id ] ; framerate = lc -> framerate ; } kf_boost = MAX ( kf_boost , ( int ) ( 2 * framerate - 16 ) ) ; if ( rc -> frames_since_key < framerate / 2 ) { kf_boost = ( int ) ( kf_boost * rc -> frames_since_key / ( framerate / 2 ) ) ; } target = ( ( 16 + kf_boost ) * rc -> avg_frame_bandwidth ) >> 4 ; } return vp9_rc_clamp_iframe_target_size ( cpi , target ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int opt_input_file_i ( void * optctx , const char * opt , const char * arg ) { opt_input_file ( optctx , arg ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void info_provider_callback ( NautilusInfoProvider * provider , NautilusOperationHandle * handle , NautilusOperationResult result , gpointer user_data ) { InfoProviderResponse * response ; response = g_new0 ( InfoProviderResponse , 1 ) ; response -> provider = provider ; response -> handle = handle ; response -> result = result ; response -> directory = NAUTILUS_DIRECTORY ( user_data ) ; response -> directory -> details -> extension_info_idle = g_idle_add_full ( G_PRIORITY_DEFAULT_IDLE , info_provider_idle_callback , response , g_free ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int tls_construct_certificate_request ( SSL * s ) { unsigned char * p , * d ; int i , j , nl , off , n ; STACK_OF ( X509_NAME ) * sk = NULL ; X509_NAME * name ; BUF_MEM * buf ; buf = s -> init_buf ; d = p = ssl_handshake_start ( s ) ; p ++ ; n = ssl3_get_req_cert_type ( s , p ) ; d [ 0 ] = n ; p += n ; n ++ ; if ( SSL_USE_SIGALGS ( s ) ) { const unsigned char * psigs ; unsigned char * etmp = p ; nl = tls12_get_psigalgs ( s , & psigs ) ; p += 2 ; nl = tls12_copy_sigalgs ( s , p , psigs , nl ) ; s2n ( nl , etmp ) ; p += nl ; n += nl + 2 ; } off = n ; p += 2 ; n += 2 ; sk = SSL_get_client_CA_list ( s ) ; nl = 0 ; if ( sk != NULL ) { for ( i = 0 ; i < sk_X509_NAME_num ( sk ) ; i ++ ) { name = sk_X509_NAME_value ( sk , i ) ; j = i2d_X509_NAME ( name , NULL ) ; if ( ! BUF_MEM_grow_clean ( buf , SSL_HM_HEADER_LENGTH ( s ) + n + j + 2 ) ) { SSLerr ( SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST , ERR_R_BUF_LIB ) ; goto err ; } p = ssl_handshake_start ( s ) + n ; s2n ( j , p ) ; i2d_X509_NAME ( name , & p ) ; n += 2 + j ; nl += 2 + j ; } } p = ssl_handshake_start ( s ) + off ; s2n ( nl , p ) ; if ( ! ssl_set_handshake_header ( s , SSL3_MT_CERTIFICATE_REQUEST , n ) ) { SSLerr ( SSL_F_TLS_CONSTRUCT_CERTIFICATE_REQUEST , ERR_R_INTERNAL_ERROR ) ; goto err ; } s -> s3 -> tmp . cert_request = 1 ; return 1 ; err : ossl_statem_set_error ( s ) ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
err_status_t crypto_policy_set_from_profile_for_rtp ( crypto_policy_t * policy , srtp_profile_t profile ) { switch ( profile ) { case srtp_profile_aes128_cm_sha1_80 : crypto_policy_set_aes_cm_128_hmac_sha1_80 ( policy ) ; break ; case srtp_profile_aes128_cm_sha1_32 : crypto_policy_set_aes_cm_128_hmac_sha1_32 ( policy ) ; break ; case srtp_profile_null_sha1_80 : crypto_policy_set_null_cipher_hmac_sha1_80 ( policy ) ; break ; case srtp_profile_aes256_cm_sha1_80 : crypto_policy_set_aes_cm_256_hmac_sha1_80 ( policy ) ; break ; case srtp_profile_aes256_cm_sha1_32 : crypto_policy_set_aes_cm_256_hmac_sha1_32 ( policy ) ; break ; case srtp_profile_null_sha1_32 : default : return err_status_bad_param ; } return err_status_ok ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dtls_get_reassembled_message ( SSL * s , long * len ) { unsigned char wire [ DTLS1_HM_HEADER_LENGTH ] ; unsigned long mlen , frag_off , frag_len ; int i , al , recvd_type ; struct hm_header_st msg_hdr ; int ok ; redo : if ( ( frag_len = dtls1_retrieve_buffered_fragment ( s , & ok ) ) || ok ) { if ( ok ) s -> init_num = frag_len ; * len = frag_len ; return ok ; } i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , & recvd_type , wire , DTLS1_HM_HEADER_LENGTH , 0 ) ; if ( i <= 0 ) { s -> rwstate = SSL_READING ; * len = i ; return 0 ; } if ( recvd_type == SSL3_RT_CHANGE_CIPHER_SPEC ) { if ( wire [ 0 ] != SSL3_MT_CCS ) { al = SSL_AD_UNEXPECTED_MESSAGE ; SSLerr ( SSL_F_DTLS_GET_REASSEMBLED_MESSAGE , SSL_R_BAD_CHANGE_CIPHER_SPEC ) ; goto f_err ; } memcpy ( s -> init_buf -> data , wire , i ) ; s -> init_num = i - 1 ; s -> init_msg = s -> init_buf -> data + 1 ; s -> s3 -> tmp . message_type = SSL3_MT_CHANGE_CIPHER_SPEC ; s -> s3 -> tmp . message_size = i - 1 ; * len = i - 1 ; return 1 ; } if ( i != DTLS1_HM_HEADER_LENGTH ) { al = SSL_AD_UNEXPECTED_MESSAGE ; SSLerr ( SSL_F_DTLS_GET_REASSEMBLED_MESSAGE , SSL_R_UNEXPECTED_MESSAGE ) ; goto f_err ; } dtls1_get_message_header ( wire , & msg_hdr ) ; mlen = msg_hdr . msg_len ; frag_off = msg_hdr . frag_off ; frag_len = msg_hdr . frag_len ; if ( frag_len > RECORD_LAYER_get_rrec_length ( & s -> rlayer ) ) { al = SSL3_AD_ILLEGAL_PARAMETER ; SSLerr ( SSL_F_DTLS_GET_REASSEMBLED_MESSAGE , SSL_R_BAD_LENGTH ) ; goto f_err ; } if ( msg_hdr . seq != s -> d1 -> handshake_read_seq ) { * len = dtls1_process_out_of_seq_message ( s , & msg_hdr , & ok ) ; return ok ; } if ( frag_len && frag_len < mlen ) { * len = dtls1_reassemble_fragment ( s , & msg_hdr , & ok ) ; return ok ; } if ( ! s -> server && s -> d1 -> r_msg_hdr . frag_off == 0 && wire [ 0 ] == SSL3_MT_HELLO_REQUEST ) { if ( wire [ 1 ] == 0 && wire [ 2 ] == 0 && wire [ 3 ] == 0 ) { if ( s -> msg_callback ) s -> msg_callback ( 0 , s -> version , SSL3_RT_HANDSHAKE , wire , DTLS1_HM_HEADER_LENGTH , s , s -> msg_callback_arg ) ; s -> init_num = 0 ; goto redo ; } else { al = SSL_AD_UNEXPECTED_MESSAGE ; SSLerr ( SSL_F_DTLS_GET_REASSEMBLED_MESSAGE , SSL_R_UNEXPECTED_MESSAGE ) ; goto f_err ; } } if ( ( al = dtls1_preprocess_fragment ( s , & msg_hdr ) ) ) goto f_err ; if ( frag_len > 0 ) { unsigned char * p = ( unsigned char * ) s -> init_buf -> data + DTLS1_HM_HEADER_LENGTH ; i = s -> method -> ssl_read_bytes ( s , SSL3_RT_HANDSHAKE , NULL , & p [ frag_off ] , frag_len , 0 ) ; if ( i <= 0 ) { s -> rwstate = SSL_READING ; * len = i ; return 0 ; } } else i = 0 ; if ( i != ( int ) frag_len ) { al = SSL3_AD_ILLEGAL_PARAMETER ; SSLerr ( SSL_F_DTLS_GET_REASSEMBLED_MESSAGE , SSL3_AD_ILLEGAL_PARAMETER ) ; goto f_err ; } * len = s -> init_num = frag_len ; return 1 ; f_err : ssl3_send_alert ( s , SSL3_AL_FATAL , al ) ; s -> init_num = 0 ; * len = - 1 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h225_T_h245IpPort ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 65535U , & ip_port , FALSE ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int read_rle_sgi ( uint8_t * out_buf , SgiState * s ) { uint8_t * dest_row ; unsigned int len = s -> height * s -> depth * 4 ; GetByteContext g_table = s -> g ; unsigned int y , z ; unsigned int start_offset ; if ( len * 2 > bytestream2_get_bytes_left ( & s -> g ) ) { return AVERROR_INVALIDDATA ; } for ( z = 0 ; z < s -> depth ; z ++ ) { dest_row = out_buf ; for ( y = 0 ; y < s -> height ; y ++ ) { dest_row -= s -> linesize ; start_offset = bytestream2_get_be32 ( & g_table ) ; bytestream2_seek ( & s -> g , start_offset , SEEK_SET ) ; if ( expand_rle_row ( s , dest_row + z , dest_row + FFABS ( s -> linesize ) , s -> depth ) != s -> width ) { return AVERROR_INVALIDDATA ; } } } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void _TIFFmemset ( void * p , int v , tmsize_t c ) { memset ( p , v , ( size_t ) c ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int write_pair ( PyObject * self , buffer_t buffer , const char * name , Py_ssize_t name_length , PyObject * value , unsigned char check_keys , unsigned char uuid_subtype , unsigned char allow_id ) { int type_byte ; if ( ! allow_id && strcmp ( name , "_id" ) == 0 ) { return 1 ; } type_byte = buffer_save_space ( buffer , 1 ) ; if ( type_byte == - 1 ) { PyErr_NoMemory ( ) ; return 0 ; } if ( check_keys && ! check_key_name ( name , name_length ) ) { return 0 ; } if ( ! buffer_write_bytes ( buffer , name , name_length + 1 ) ) { return 0 ; } if ( ! write_element_to_buffer ( self , buffer , type_byte , value , check_keys , uuid_subtype , 1 ) ) { return 0 ; } return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void RecordsConfigIterate ( RecordElementCallback callback , void * data ) { for ( unsigned i = 0 ; i < countof ( RecordsConfig ) ; ++ i ) { callback ( & RecordsConfig [ i ] , data ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void encode_transform_params ( VC2EncContext * s ) { put_vc2_ue_uint ( & s -> pb , s -> wavelet_idx ) ; put_vc2_ue_uint ( & s -> pb , s -> wavelet_depth ) ; encode_slice_params ( s ) ; encode_quant_matrix ( s ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline uint16_t cirrus_src16 ( CirrusVGAState * s , uint32_t srcaddr ) { uint16_t * src ; if ( s -> cirrus_srccounter ) { src = ( void * ) & s -> cirrus_bltbuf [ srcaddr & ( CIRRUS_BLTBUFSIZE - 1 ) & ~ 1 ] ; } else { src = ( void * ) & s -> vga . vram_ptr [ srcaddr & s -> cirrus_addr_mask & ~ 1 ] ; } return * src ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
const char * mgs_hook_http_scheme ( const request_rec * r ) { mgs_srvconf_rec * sc ; if ( r == NULL ) return NULL ; sc = ( mgs_srvconf_rec * ) ap_get_module_config ( r -> server -> module_config , & gnutls_module ) ; _gnutls_log ( debug_log_fp , "%s: %d\n" , __func__ , __LINE__ ) ; if ( sc -> enabled == GNUTLS_ENABLED_FALSE ) { return NULL ; } return "https" ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void rv34_pred_b_vector ( int A [ 2 ] , int B [ 2 ] , int C [ 2 ] , int A_avail , int B_avail , int C_avail , int * mx , int * my ) { if ( A_avail + B_avail + C_avail != 3 ) { * mx = A [ 0 ] + B [ 0 ] + C [ 0 ] ; * my = A [ 1 ] + B [ 1 ] + C [ 1 ] ; if ( A_avail + B_avail + C_avail == 2 ) { * mx /= 2 ; * my /= 2 ; } } else { * mx = mid_pred ( A [ 0 ] , B [ 0 ] , C [ 0 ] ) ; * my = mid_pred ( A [ 1 ] , B [ 1 ] , C [ 1 ] ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static uint64_t openpic_tmr_read ( void * opaque , hwaddr addr , unsigned len ) { OpenPICState * opp = opaque ; uint32_t retval = - 1 ; int idx ; DPRINTF ( "%s: addr %#" HWADDR_PRIx "\n" , __func__ , addr ) ; if ( addr & 0xF ) { goto out ; } idx = ( addr >> 6 ) & 0x3 ; if ( addr == 0x0 ) { retval = opp -> tfrr ; goto out ; } switch ( addr & 0x30 ) { case 0x00 : retval = opp -> timers [ idx ] . tccr ; break ; case 0x10 : retval = opp -> timers [ idx ] . tbcr ; break ; case 0x20 : retval = read_IRQreg_ivpr ( opp , opp -> irq_tim0 + idx ) ; break ; case 0x30 : retval = read_IRQreg_idr ( opp , opp -> irq_tim0 + idx ) ; break ; } out : DPRINTF ( "%s: => 0x%08x\n" , __func__ , retval ) ; return retval ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_slice_header ( H264Context * h , H264Context * h0 ) { unsigned int first_mb_in_slice ; unsigned int pps_id ; int ret ; unsigned int slice_type , tmp , i , j ; int last_pic_structure , last_pic_droppable ; int must_reinit ; int needs_reinit = 0 ; int field_pic_flag , bottom_field_flag ; h -> me . qpel_put = h -> h264qpel . put_h264_qpel_pixels_tab ; h -> me . qpel_avg = h -> h264qpel . avg_h264_qpel_pixels_tab ; first_mb_in_slice = get_ue_golomb_long ( & h -> gb ) ; if ( first_mb_in_slice == 0 ) { if ( h0 -> current_slice && FIELD_PICTURE ( h ) ) { field_end ( h , 1 ) ; } h0 -> current_slice = 0 ; if ( ! h0 -> first_field ) { if ( h -> cur_pic_ptr && ! h -> droppable ) { ff_thread_report_progress ( & h -> cur_pic_ptr -> tf , INT_MAX , h -> picture_structure == PICT_BOTTOM_FIELD ) ; } h -> cur_pic_ptr = NULL ; } } slice_type = get_ue_golomb_31 ( & h -> gb ) ; if ( slice_type > 9 ) { av_log ( h -> avctx , AV_LOG_ERROR , "slice type too large (%d) at %d %d\n" , slice_type , h -> mb_x , h -> mb_y ) ; return AVERROR_INVALIDDATA ; } if ( slice_type > 4 ) { slice_type -= 5 ; h -> slice_type_fixed = 1 ; } else h -> slice_type_fixed = 0 ; slice_type = golomb_to_pict_type [ slice_type ] ; h -> slice_type = slice_type ; h -> slice_type_nos = slice_type & 3 ; h -> pict_type = h -> slice_type ; pps_id = get_ue_golomb ( & h -> gb ) ; if ( pps_id >= MAX_PPS_COUNT ) { av_log ( h -> avctx , AV_LOG_ERROR , "pps_id %d out of range\n" , pps_id ) ; return AVERROR_INVALIDDATA ; } if ( ! h0 -> pps_buffers [ pps_id ] ) { av_log ( h -> avctx , AV_LOG_ERROR , "non-existing PPS %u referenced\n" , pps_id ) ; return AVERROR_INVALIDDATA ; } h -> pps = * h0 -> pps_buffers [ pps_id ] ; if ( ! h0 -> sps_buffers [ h -> pps . sps_id ] ) { av_log ( h -> avctx , AV_LOG_ERROR , "non-existing SPS %u referenced\n" , h -> pps . sps_id ) ; return AVERROR_INVALIDDATA ; } if ( h -> pps . sps_id != h -> current_sps_id || h0 -> sps_buffers [ h -> pps . sps_id ] -> new ) { h0 -> sps_buffers [ h -> pps . sps_id ] -> new = 0 ; h -> current_sps_id = h -> pps . sps_id ; h -> sps = * h0 -> sps_buffers [ h -> pps . sps_id ] ; if ( h -> mb_width != h -> sps . mb_width || h -> mb_height != h -> sps . mb_height * ( 2 - h -> sps . frame_mbs_only_flag ) || h -> avctx -> bits_per_raw_sample != h -> sps . bit_depth_luma || h -> cur_chroma_format_idc != h -> sps . chroma_format_idc ) needs_reinit = 1 ; if ( h -> bit_depth_luma != h -> sps . bit_depth_luma || h -> chroma_format_idc != h -> sps . chroma_format_idc ) { h -> bit_depth_luma = h -> sps . bit_depth_luma ; h -> chroma_format_idc = h -> sps . chroma_format_idc ; needs_reinit = 1 ; } if ( ( ret = h264_set_parameter_from_sps ( h ) ) < 0 ) return ret ; } h -> avctx -> profile = ff_h264_get_profile ( & h -> sps ) ; h -> avctx -> level = h -> sps . level_idc ; h -> avctx -> refs = h -> sps . ref_frame_count ; must_reinit = ( h -> context_initialized && ( 16 * h -> sps . mb_width != h -> avctx -> coded_width || 16 * h -> sps . mb_height * ( 2 - h -> sps . frame_mbs_only_flag ) != h -> avctx -> coded_height || h -> avctx -> bits_per_raw_sample != h -> sps . bit_depth_luma || h -> cur_chroma_format_idc != h -> sps . chroma_format_idc || av_cmp_q ( h -> sps . sar , h -> avctx -> sample_aspect_ratio ) || h -> mb_width != h -> sps . mb_width || h -> mb_height != h -> sps . mb_height * ( 2 - h -> sps . frame_mbs_only_flag ) ) ) ; if ( h0 -> avctx -> pix_fmt != get_pixel_format ( h0 , 0 ) ) must_reinit = 1 ; h -> mb_width = h -> sps . mb_width ; h -> mb_height = h -> sps . mb_height * ( 2 - h -> sps . frame_mbs_only_flag ) ; h -> mb_num = h -> mb_width * h -> mb_height ; h -> mb_stride = h -> mb_width + 1 ; h -> b_stride = h -> mb_width * 4 ; h -> chroma_y_shift = h -> sps . chroma_format_idc <= 1 ; h -> width = 16 * h -> mb_width ; h -> height = 16 * h -> mb_height ; ret = init_dimensions ( h ) ; if ( ret < 0 ) return ret ; if ( h -> sps . video_signal_type_present_flag ) { h -> avctx -> color_range = h -> sps . full_range > 0 ? AVCOL_RANGE_JPEG : AVCOL_RANGE_MPEG ; if ( h -> sps . colour_description_present_flag ) { if ( h -> avctx -> colorspace != h -> sps . colorspace ) needs_reinit = 1 ; h -> avctx -> color_primaries = h -> sps . color_primaries ; h -> avctx -> color_trc = h -> sps . color_trc ; h -> avctx -> colorspace = h -> sps . colorspace ; } } if ( h -> context_initialized && ( h -> width != h -> avctx -> coded_width || h -> height != h -> avctx -> coded_height || must_reinit || needs_reinit ) ) { if ( h != h0 ) { av_log ( h -> avctx , AV_LOG_ERROR , "changing width/height on " "slice %d\n" , h0 -> current_slice + 1 ) ; return AVERROR_INVALIDDATA ; } flush_change ( h ) ; if ( ( ret = get_pixel_format ( h , 1 ) ) < 0 ) return ret ; h -> avctx -> pix_fmt = ret ; av_log ( h -> avctx , AV_LOG_INFO , "Reinit context to %dx%d, " "pix_fmt: %s\n" , h -> width , h -> height , av_get_pix_fmt_name ( h -> avctx -> pix_fmt ) ) ; if ( ( ret = h264_slice_header_init ( h , 1 ) ) < 0 ) { av_log ( h -> avctx , AV_LOG_ERROR , "h264_slice_header_init() failed\n" ) ; return ret ; } } if ( ! h -> context_initialized ) { if ( h != h0 ) { av_log ( h -> avctx , AV_LOG_ERROR , "Cannot (re-)initialize context during parallel decoding.\n" ) ; return AVERROR_PATCHWELCOME ; } if ( ( ret = get_pixel_format ( h , 1 ) ) < 0 ) return ret ; h -> avctx -> pix_fmt = ret ; if ( ( ret = h264_slice_header_init ( h , 0 ) ) < 0 ) { av_log ( h -> avctx , AV_LOG_ERROR , "h264_slice_header_init() failed\n" ) ; return ret ; } } if ( h == h0 && h -> dequant_coeff_pps != pps_id ) { h -> dequant_coeff_pps = pps_id ; init_dequant_tables ( h ) ; } h -> frame_num = get_bits ( & h -> gb , h -> sps . log2_max_frame_num ) ; h -> mb_mbaff = 0 ; h -> mb_aff_frame = 0 ; last_pic_structure = h0 -> picture_structure ; last_pic_droppable = h0 -> droppable ; h -> droppable = h -> nal_ref_idc == 0 ; if ( h -> sps . frame_mbs_only_flag ) { h -> picture_structure = PICT_FRAME ; } else { if ( ! h -> sps . direct_8x8_inference_flag && slice_type == AV_PICTURE_TYPE_B ) { av_log ( h -> avctx , AV_LOG_ERROR , "This stream was generated by a broken encoder, invalid 8x8 inference\n" ) ; return - 1 ; } field_pic_flag = get_bits1 ( & h -> gb ) ; if ( field_pic_flag ) { bottom_field_flag = get_bits1 ( & h -> gb ) ; h -> picture_structure = PICT_TOP_FIELD + bottom_field_flag ; } else { h -> picture_structure = PICT_FRAME ; h -> mb_aff_frame = h -> sps . mb_aff ; } } h -> mb_field_decoding_flag = h -> picture_structure != PICT_FRAME ; if ( h0 -> current_slice != 0 ) { if ( last_pic_structure != h -> picture_structure || last_pic_droppable != h -> droppable ) { av_log ( h -> avctx , AV_LOG_ERROR , "Changing field mode (%d -> %d) between slices is not allowed\n" , last_pic_structure , h -> picture_structure ) ; h -> picture_structure = last_pic_structure ; h -> droppable = last_pic_droppable ; return AVERROR_INVALIDDATA ; } else if ( ! h0 -> cur_pic_ptr ) { av_log ( h -> avctx , AV_LOG_ERROR , "unset cur_pic_ptr on %d. slice\n" , h0 -> current_slice + 1 ) ; return AVERROR_INVALIDDATA ; } } else { if ( h -> frame_num != h -> prev_frame_num ) { int unwrap_prev_frame_num = h -> prev_frame_num ; int max_frame_num = 1 << h -> sps . log2_max_frame_num ; if ( unwrap_prev_frame_num > h -> frame_num ) unwrap_prev_frame_num -= max_frame_num ; if ( ( h -> frame_num - unwrap_prev_frame_num ) > h -> sps . ref_frame_count ) { unwrap_prev_frame_num = ( h -> frame_num - h -> sps . ref_frame_count ) - 1 ; if ( unwrap_prev_frame_num < 0 ) unwrap_prev_frame_num += max_frame_num ; h -> prev_frame_num = unwrap_prev_frame_num ; } } if ( h0 -> first_field ) { assert ( h0 -> cur_pic_ptr ) ; assert ( h0 -> cur_pic_ptr -> f . buf [ 0 ] ) ; assert ( h0 -> cur_pic_ptr -> reference != DELAYED_PIC_REF ) ; if ( h0 -> cur_pic_ptr -> tf . owner == h0 -> avctx ) { ff_thread_report_progress ( & h0 -> cur_pic_ptr -> tf , INT_MAX , last_pic_structure == PICT_BOTTOM_FIELD ) ; } if ( ! FIELD_PICTURE ( h ) || h -> picture_structure == last_pic_structure ) { if ( last_pic_structure != PICT_FRAME ) { ff_thread_report_progress ( & h0 -> cur_pic_ptr -> tf , INT_MAX , last_pic_structure == PICT_TOP_FIELD ) ; } } else { if ( h0 -> cur_pic_ptr -> frame_num != h -> frame_num ) { if ( last_pic_structure != PICT_FRAME ) { ff_thread_report_progress ( & h0 -> cur_pic_ptr -> tf , INT_MAX , last_pic_structure == PICT_TOP_FIELD ) ; } } else { if ( ! ( ( last_pic_structure == PICT_TOP_FIELD && h -> picture_structure == PICT_BOTTOM_FIELD ) || ( last_pic_structure == PICT_BOTTOM_FIELD && h -> picture_structure == PICT_TOP_FIELD ) ) ) { av_log ( h -> avctx , AV_LOG_ERROR , "Invalid field mode combination %d/%d\n" , last_pic_structure , h -> picture_structure ) ; h -> picture_structure = last_pic_structure ; h -> droppable = last_pic_droppable ; return AVERROR_INVALIDDATA ; } else if ( last_pic_droppable != h -> droppable ) { avpriv_request_sample ( h -> avctx , "Found reference and non-reference fields in the same frame, which" ) ; h -> picture_structure = last_pic_structure ; h -> droppable = last_pic_droppable ; return AVERROR_PATCHWELCOME ; } } } } while ( h -> frame_num != h -> prev_frame_num && ! h0 -> first_field && h -> frame_num != ( h -> prev_frame_num + 1 ) % ( 1 << h -> sps . log2_max_frame_num ) ) { Picture * prev = h -> short_ref_count ? h -> short_ref [ 0 ] : NULL ; av_log ( h -> avctx , AV_LOG_DEBUG , "Frame num gap %d %d\n" , h -> frame_num , h -> prev_frame_num ) ; if ( ! h -> sps . gaps_in_frame_num_allowed_flag ) for ( i = 0 ; i < FF_ARRAY_ELEMS ( h -> last_pocs ) ; i ++ ) h -> last_pocs [ i ] = INT_MIN ; ret = h264_frame_start ( h ) ; if ( ret < 0 ) return ret ; h -> prev_frame_num ++ ; h -> prev_frame_num %= 1 << h -> sps . log2_max_frame_num ; h -> cur_pic_ptr -> frame_num = h -> prev_frame_num ; ff_thread_report_progress ( & h -> cur_pic_ptr -> tf , INT_MAX , 0 ) ; ff_thread_report_progress ( & h -> cur_pic_ptr -> tf , INT_MAX , 1 ) ; ret = ff_generate_sliding_window_mmcos ( h , 1 ) ; if ( ret < 0 && ( h -> avctx -> err_recognition & AV_EF_EXPLODE ) ) return ret ; ret = ff_h264_execute_ref_pic_marking ( h , h -> mmco , h -> mmco_index ) ; if ( ret < 0 && ( h -> avctx -> err_recognition & AV_EF_EXPLODE ) ) return ret ; if ( h -> short_ref_count ) { if ( prev ) { av_image_copy ( h -> short_ref [ 0 ] -> f . data , h -> short_ref [ 0 ] -> f . linesize , ( const uint8_t * * ) prev -> f . data , prev -> f . linesize , h -> avctx -> pix_fmt , h -> mb_width * 16 , h -> mb_height * 16 ) ; h -> short_ref [ 0 ] -> poc = prev -> poc + 2 ; } h -> short_ref [ 0 ] -> frame_num = h -> prev_frame_num ; } } if ( h0 -> first_field ) { assert ( h0 -> cur_pic_ptr ) ; assert ( h0 -> cur_pic_ptr -> f . buf [ 0 ] ) ; assert ( h0 -> cur_pic_ptr -> reference != DELAYED_PIC_REF ) ; if ( ! FIELD_PICTURE ( h ) || h -> picture_structure == last_pic_structure ) { h0 -> cur_pic_ptr = NULL ; h0 -> first_field = FIELD_PICTURE ( h ) ; } else { if ( h0 -> cur_pic_ptr -> frame_num != h -> frame_num ) { ff_thread_report_progress ( & h0 -> cur_pic_ptr -> tf , INT_MAX , h0 -> picture_structure == PICT_BOTTOM_FIELD ) ; h0 -> first_field = 1 ; h0 -> cur_pic_ptr = NULL ; } else { h0 -> first_field = 0 ; } } } else { h0 -> first_field = FIELD_PICTURE ( h ) ; } if ( ! FIELD_PICTURE ( h ) || h0 -> first_field ) { if ( h264_frame_start ( h ) < 0 ) { h0 -> first_field = 0 ; return AVERROR_INVALIDDATA ; } } else { release_unused_pictures ( h , 0 ) ; } if ( FIELD_PICTURE ( h ) ) { for ( i = ( h -> picture_structure == PICT_BOTTOM_FIELD ) ; i < h -> mb_height ; i ++ ) memset ( h -> slice_table + i * h -> mb_stride , - 1 , ( h -> mb_stride - ( i + 1 == h -> mb_height ) ) * sizeof ( * h -> slice_table ) ) ; } else { memset ( h -> slice_table , - 1 , ( h -> mb_height * h -> mb_stride - 1 ) * sizeof ( * h -> slice_table ) ) ; } h0 -> last_slice_type = - 1 ; } if ( h != h0 && ( ret = clone_slice ( h , h0 ) ) < 0 ) return ret ; for ( i = 0 ; i < h -> slice_context_count ; i ++ ) if ( h -> thread_context [ i ] ) { ret = alloc_scratch_buffers ( h -> thread_context [ i ] , h -> linesize ) ; if ( ret < 0 ) return ret ; } h -> cur_pic_ptr -> frame_num = h -> frame_num ; av_assert1 ( h -> mb_num == h -> mb_width * h -> mb_height ) ; if ( first_mb_in_slice << FIELD_OR_MBAFF_PICTURE ( h ) >= h -> mb_num || first_mb_in_slice >= h -> mb_num ) { av_log ( h -> avctx , AV_LOG_ERROR , "first_mb_in_slice overflow\n" ) ; return AVERROR_INVALIDDATA ; } h -> resync_mb_x = h -> mb_x = first_mb_in_slice % h -> mb_width ; h -> resync_mb_y = h -> mb_y = ( first_mb_in_slice / h -> mb_width ) << FIELD_OR_MBAFF_PICTURE ( h ) ; if ( h -> picture_structure == PICT_BOTTOM_FIELD ) h -> resync_mb_y = h -> mb_y = h -> mb_y + 1 ; av_assert1 ( h -> mb_y < h -> mb_height ) ; if ( h -> picture_structure == PICT_FRAME ) { h -> curr_pic_num = h -> frame_num ; h -> max_pic_num = 1 << h -> sps . log2_max_frame_num ; } else { h -> curr_pic_num = 2 * h -> frame_num + 1 ; h -> max_pic_num = 1 << ( h -> sps . log2_max_frame_num + 1 ) ; } if ( h -> nal_unit_type == NAL_IDR_SLICE ) get_ue_golomb ( & h -> gb ) ; if ( h -> sps . poc_type == 0 ) { h -> poc_lsb = get_bits ( & h -> gb , h -> sps . log2_max_poc_lsb ) ; if ( h -> pps . pic_order_present == 1 && h -> picture_structure == PICT_FRAME ) h -> delta_poc_bottom = get_se_golomb ( & h -> gb ) ; } if ( h -> sps . poc_type == 1 && ! h -> sps . delta_pic_order_always_zero_flag ) { h -> delta_poc [ 0 ] = get_se_golomb ( & h -> gb ) ; if ( h -> pps . pic_order_present == 1 && h -> picture_structure == PICT_FRAME ) h -> delta_poc [ 1 ] = get_se_golomb ( & h -> gb ) ; } ff_init_poc ( h , h -> cur_pic_ptr -> field_poc , & h -> cur_pic_ptr -> poc ) ; if ( h -> pps . redundant_pic_cnt_present ) h -> redundant_pic_count = get_ue_golomb ( & h -> gb ) ; ret = ff_set_ref_count ( h ) ; if ( ret < 0 ) return ret ; if ( slice_type != AV_PICTURE_TYPE_I && ( h0 -> current_slice == 0 || slice_type != h0 -> last_slice_type || memcmp ( h0 -> last_ref_count , h0 -> ref_count , sizeof ( h0 -> ref_count ) ) ) ) { ff_h264_fill_default_ref_list ( h ) ; } if ( h -> slice_type_nos != AV_PICTURE_TYPE_I ) { ret = ff_h264_decode_ref_pic_list_reordering ( h ) ; if ( ret < 0 ) { h -> ref_count [ 1 ] = h -> ref_count [ 0 ] = 0 ; return ret ; } } if ( ( h -> pps . weighted_pred && h -> slice_type_nos == AV_PICTURE_TYPE_P ) || ( h -> pps . weighted_bipred_idc == 1 && h -> slice_type_nos == AV_PICTURE_TYPE_B ) ) ff_pred_weight_table ( h ) ; else if ( h -> pps . weighted_bipred_idc == 2 && h -> slice_type_nos == AV_PICTURE_TYPE_B ) { implicit_weight_table ( h , - 1 ) ; } else { h -> use_weight = 0 ; for ( i = 0 ; i < 2 ; i ++ ) { h -> luma_weight_flag [ i ] = 0 ; h -> chroma_weight_flag [ i ] = 0 ; } } if ( h -> nal_ref_idc ) { ret = ff_h264_decode_ref_pic_marking ( h0 , & h -> gb , ! ( h -> avctx -> active_thread_type & FF_THREAD_FRAME ) || h0 -> current_slice == 0 ) ; if ( ret < 0 && ( h -> avctx -> err_recognition & AV_EF_EXPLODE ) ) return AVERROR_INVALIDDATA ; } if ( FRAME_MBAFF ( h ) ) { ff_h264_fill_mbaff_ref_list ( h ) ; if ( h -> pps . weighted_bipred_idc == 2 && h -> slice_type_nos == AV_PICTURE_TYPE_B ) { implicit_weight_table ( h , 0 ) ; implicit_weight_table ( h , 1 ) ; } } if ( h -> slice_type_nos == AV_PICTURE_TYPE_B && ! h -> direct_spatial_mv_pred ) ff_h264_direct_dist_scale_factor ( h ) ; ff_h264_direct_ref_list_init ( h ) ; if ( h -> slice_type_nos != AV_PICTURE_TYPE_I && h -> pps . cabac ) { tmp = get_ue_golomb_31 ( & h -> gb ) ; if ( tmp > 2 ) { av_log ( h -> avctx , AV_LOG_ERROR , "cabac_init_idc overflow\n" ) ; return AVERROR_INVALIDDATA ; } h -> cabac_init_idc = tmp ; } h -> last_qscale_diff = 0 ; tmp = h -> pps . init_qp + get_se_golomb ( & h -> gb ) ; if ( tmp > 51 + 6 * ( h -> sps . bit_depth_luma - 8 ) ) { av_log ( h -> avctx , AV_LOG_ERROR , "QP %u out of range\n" , tmp ) ; return AVERROR_INVALIDDATA ; } h -> qscale = tmp ; h -> chroma_qp [ 0 ] = get_chroma_qp ( h , 0 , h -> qscale ) ; h -> chroma_qp [ 1 ] = get_chroma_qp ( h , 1 , h -> qscale ) ; if ( h -> slice_type == AV_PICTURE_TYPE_SP ) get_bits1 ( & h -> gb ) ; if ( h -> slice_type == AV_PICTURE_TYPE_SP || h -> slice_type == AV_PICTURE_TYPE_SI ) get_se_golomb ( & h -> gb ) ; h -> deblocking_filter = 1 ; h -> slice_alpha_c0_offset = 52 ; h -> slice_beta_offset = 52 ; if ( h -> pps . deblocking_filter_parameters_present ) { tmp = get_ue_golomb_31 ( & h -> gb ) ; if ( tmp > 2 ) { av_log ( h -> avctx , AV_LOG_ERROR , "deblocking_filter_idc %u out of range\n" , tmp ) ; return AVERROR_INVALIDDATA ; } h -> deblocking_filter = tmp ; if ( h -> deblocking_filter < 2 ) h -> deblocking_filter ^= 1 ; if ( h -> deblocking_filter ) { h -> slice_alpha_c0_offset += get_se_golomb ( & h -> gb ) << 1 ; h -> slice_beta_offset += get_se_golomb ( & h -> gb ) << 1 ; if ( h -> slice_alpha_c0_offset > 104U || h -> slice_beta_offset > 104U ) { av_log ( h -> avctx , AV_LOG_ERROR , "deblocking filter parameters %d %d out of range\n" , h -> slice_alpha_c0_offset , h -> slice_beta_offset ) ; return AVERROR_INVALIDDATA ; } } } if ( h -> avctx -> skip_loop_filter >= AVDISCARD_ALL || ( h -> avctx -> skip_loop_filter >= AVDISCARD_NONKEY && h -> slice_type_nos != AV_PICTURE_TYPE_I ) || ( h -> avctx -> skip_loop_filter >= AVDISCARD_BIDIR && h -> slice_type_nos == AV_PICTURE_TYPE_B ) || ( h -> avctx -> skip_loop_filter >= AVDISCARD_NONREF && h -> nal_ref_idc == 0 ) ) h -> deblocking_filter = 0 ; if ( h -> deblocking_filter == 1 && h0 -> max_contexts > 1 ) { if ( h -> avctx -> flags2 & CODEC_FLAG2_FAST ) { h -> deblocking_filter = 2 ; } else { h0 -> max_contexts = 1 ; if ( ! h0 -> single_decode_warning ) { av_log ( h -> avctx , AV_LOG_INFO , "Cannot parallelize deblocking type 1, decoding such frames in sequential order\n" ) ; h0 -> single_decode_warning = 1 ; } if ( h != h0 ) { av_log ( h -> avctx , AV_LOG_ERROR , "Deblocking switched inside frame.\n" ) ; return 1 ; } } } h -> qp_thresh = 15 + 52 - FFMIN ( h -> slice_alpha_c0_offset , h -> slice_beta_offset ) - FFMAX3 ( 0 , h -> pps . chroma_qp_index_offset [ 0 ] , h -> pps . chroma_qp_index_offset [ 1 ] ) + * ( h -> sps . bit_depth_luma - 8 ) ; h0 -> last_slice_type = slice_type ; memcpy ( h0 -> last_ref_count , h0 -> ref_count , sizeof ( h0 -> last_ref_count ) ) ; h -> slice_num = ++ h0 -> current_slice ; if ( h -> slice_num ) h0 -> slice_row [ ( h -> slice_num - 1 ) & ( MAX_SLICES - 1 ) ] = h -> resync_mb_y ; if ( h0 -> slice_row [ h -> slice_num & ( MAX_SLICES - 1 ) ] + 3 >= h -> resync_mb_y && h0 -> slice_row [ h -> slice_num & ( MAX_SLICES - 1 ) ] <= h -> resync_mb_y && h -> slice_num >= MAX_SLICES ) { av_log ( h -> avctx , AV_LOG_WARNING , "Possibly too many slices (%d >= %d), increase MAX_SLICES and recompile if there are artifacts\n" , h -> slice_num , MAX_SLICES ) ; } for ( j = 0 ; j < 2 ; j ++ ) { int id_list [ 16 ] ; int * ref2frm = h -> ref2frm [ h -> slice_num & ( MAX_SLICES - 1 ) ] [ j ] ; for ( i = 0 ; i < 16 ; i ++ ) { id_list [ i ] = 60 ; if ( j < h -> list_count && i < h -> ref_count [ j ] && h -> ref_list [ j ] [ i ] . f . buf [ 0 ] ) { int k ; AVBuffer * buf = h -> ref_list [ j ] [ i ] . f . buf [ 0 ] -> buffer ; for ( k = 0 ; k < h -> short_ref_count ; k ++ ) if ( h -> short_ref [ k ] -> f . buf [ 0 ] -> buffer == buf ) { id_list [ i ] = k ; break ; } for ( k = 0 ; k < h -> long_ref_count ; k ++ ) if ( h -> long_ref [ k ] && h -> long_ref [ k ] -> f . buf [ 0 ] -> buffer == buf ) { id_list [ i ] = h -> short_ref_count + k ; break ; } } } ref2frm [ 0 ] = ref2frm [ 1 ] = - 1 ; for ( i = 0 ; i < 16 ; i ++ ) ref2frm [ i + 2 ] = 4 * id_list [ i ] + ( h -> ref_list [ j ] [ i ] . reference & 3 ) ; ref2frm [ 18 + 0 ] = ref2frm [ 18 + 1 ] = - 1 ; for ( i = 16 ; i < 48 ; i ++ ) ref2frm [ i + 4 ] = 4 * id_list [ ( i - 16 ) >> 1 ] + ( h -> ref_list [ j ] [ i ] . reference & 3 ) ; } if ( h -> ref_count [ 0 ] ) h -> er . last_pic = & h -> ref_list [ 0 ] [ 0 ] ; if ( h -> ref_count [ 1 ] ) h -> er . next_pic = & h -> ref_list [ 1 ] [ 0 ] ; h -> er . ref_count = h -> ref_count [ 0 ] ; if ( h -> avctx -> debug & FF_DEBUG_PICT_INFO ) { av_log ( h -> avctx , AV_LOG_DEBUG , "slice:%d %s mb:%d %c%s%s pps:%u frame:%d poc:%d/%d ref:%d/%d qp:%d loop:%d:%d:%d weight:%d%s %s\n" , h -> slice_num , ( h -> picture_structure == PICT_FRAME ? "F" : h -> picture_structure == PICT_TOP_FIELD ? "T" : "B" ) , first_mb_in_slice , av_get_picture_type_char ( h -> slice_type ) , h -> slice_type_fixed ? " fix" : "" , h -> nal_unit_type == NAL_IDR_SLICE ? " IDR" : "" , pps_id , h -> frame_num , h -> cur_pic_ptr -> field_poc [ 0 ] , h -> cur_pic_ptr -> field_poc [ 1 ] , h -> ref_count [ 0 ] , h -> ref_count [ 1 ] , h -> qscale , h -> deblocking_filter , h -> slice_alpha_c0_offset / 2 - 26 , h -> slice_beta_offset / 2 - 26 , h -> use_weight , h -> use_weight == 1 && h -> use_weight_chroma ? "c" : "" , h -> slice_type == AV_PICTURE_TYPE_B ? ( h -> direct_spatial_mv_pred ? "SPAT" : "TEMP" ) : "" ) ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void _slurm_rpc_comp_msg_list ( composite_msg_t * comp_msg , bool * run_scheduler , List msg_list_in , struct timeval * start_tv , int timeout ) { ListIterator itr ; slurm_msg_t * next_msg ; composite_msg_t * ncomp_msg ; composite_msg_t * comp_resp_msg ; slurmctld_lock_t job_write_lock = { READ_LOCK , WRITE_LOCK , WRITE_LOCK , NO_LOCK , READ_LOCK } ; DEF_TIMERS ; START_TIMER ; itr = list_iterator_create ( comp_msg -> msg_list ) ; while ( ( next_msg = list_next ( itr ) ) ) { if ( slurm_delta_tv ( start_tv ) >= timeout ) { END_TIMER ; if ( slurmctld_conf . debug_flags & DEBUG_FLAG_ROUTE ) info ( "composite message processing " "yielding locks after running for %s" , TIME_STR ) ; unlock_slurmctld ( job_write_lock ) ; usleep ( 10 ) ; lock_slurmctld ( job_write_lock ) ; gettimeofday ( start_tv , NULL ) ; START_TIMER ; } FREE_NULL_LIST ( next_msg -> ret_list ) ; next_msg -> ret_list = msg_list_in ; switch ( next_msg -> msg_type ) { case MESSAGE_COMPOSITE : comp_resp_msg = xmalloc ( sizeof ( composite_msg_t ) ) ; comp_resp_msg -> msg_list = list_create ( _slurmctld_free_comp_msg_list ) ; ncomp_msg = ( composite_msg_t * ) next_msg -> data ; if ( slurmctld_conf . debug_flags & DEBUG_FLAG_ROUTE ) info ( "Processing embedded MESSAGE_COMPOSITE " "msg with %d direct " "messages" , ncomp_msg -> msg_list ? list_count ( ncomp_msg -> msg_list ) : 0 ) ; _slurm_rpc_comp_msg_list ( ncomp_msg , run_scheduler , comp_resp_msg -> msg_list , start_tv , timeout ) ; if ( list_count ( comp_resp_msg -> msg_list ) ) { slurm_msg_t * resp_msg = xmalloc_nz ( sizeof ( slurm_msg_t ) ) ; slurm_msg_t_init ( resp_msg ) ; resp_msg -> msg_index = next_msg -> msg_index ; resp_msg -> flags = next_msg -> flags ; resp_msg -> protocol_version = next_msg -> protocol_version ; resp_msg -> msg_type = RESPONSE_MESSAGE_COMPOSITE ; memcpy ( & comp_resp_msg -> sender , & ncomp_msg -> sender , sizeof ( slurm_addr_t ) ) ; resp_msg -> data = comp_resp_msg ; list_append ( msg_list_in , resp_msg ) ; } else slurm_free_composite_msg ( comp_resp_msg ) ; break ; case REQUEST_COMPLETE_BATCH_SCRIPT : case REQUEST_COMPLETE_BATCH_JOB : _slurm_rpc_complete_batch_script ( next_msg , run_scheduler , 1 ) ; break ; case REQUEST_STEP_COMPLETE : _slurm_rpc_step_complete ( next_msg , 1 ) ; break ; case MESSAGE_EPILOG_COMPLETE : _slurm_rpc_epilog_complete ( next_msg , run_scheduler , 1 ) ; break ; case MESSAGE_NODE_REGISTRATION_STATUS : _slurm_rpc_node_registration ( next_msg , 1 ) ; break ; default : error ( "_slurm_rpc_comp_msg_list: invalid msg type" ) ; break ; } next_msg -> ret_list = NULL ; } list_iterator_destroy ( itr ) ; END_TIMER ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
decNumber * decLnOp ( decNumber * res , const decNumber * rhs , decContext * set , uInt * status ) { uInt ignore = 0 ; uInt needbytes ; Int residue ; Int r ; Int p ; Int pp ; Int t ; decNumber bufa [ D2N ( DECBUFFER + 12 ) ] ; decNumber * allocbufa = NULL ; decNumber * a = bufa ; decNumber bufb [ D2N ( DECBUFFER * 2 + 2 ) ] ; decNumber * allocbufb = NULL ; decNumber * b = bufb ; decNumber numone ; decNumber cmp ; decContext aset , bset ; # if DECCHECK Int iterations = 0 ; if ( decCheckOperands ( res , DECUNUSED , rhs , set ) ) return res ; # endif do { if ( SPECIALARG ) { if ( decNumberIsInfinite ( rhs ) ) { if ( decNumberIsNegative ( rhs ) ) * status |= DEC_Invalid_operation ; else uprv_decNumberCopy ( res , rhs ) ; } else decNaNs ( res , rhs , NULL , set , status ) ; break ; } if ( ISZERO ( rhs ) ) { uprv_decNumberZero ( res ) ; res -> bits = DECINF | DECNEG ; break ; } if ( decNumberIsNegative ( rhs ) ) { * status |= DEC_Invalid_operation ; break ; } if ( rhs -> exponent == 0 && set -> digits <= 40 ) { # if DECDPUN == 1 if ( rhs -> lsu [ 0 ] == 0 && rhs -> lsu [ 1 ] == 1 && rhs -> digits == 2 ) { # else if ( rhs -> lsu [ 0 ] == 10 && rhs -> digits == 2 ) { # endif aset = * set ; aset . round = DEC_ROUND_HALF_EVEN ; # define LN10 "2.302585092994045684017991454684364207601" uprv_decNumberFromString ( res , LN10 , & aset ) ; * status |= ( DEC_Inexact | DEC_Rounded ) ; break ; } if ( rhs -> lsu [ 0 ] == 2 && rhs -> digits == 1 ) { aset = * set ; aset . round = DEC_ROUND_HALF_EVEN ; # define LN2 "0.6931471805599453094172321214581765680755" uprv_decNumberFromString ( res , LN2 , & aset ) ; * status |= ( DEC_Inexact | DEC_Rounded ) ; break ; } } p = MAXI ( rhs -> digits , MAXI ( set -> digits , 7 ) ) + 2 ; needbytes = sizeof ( decNumber ) + ( D2U ( MAXI ( p , 16 ) ) - 1 ) * sizeof ( Unit ) ; if ( needbytes > sizeof ( bufa ) ) { allocbufa = ( decNumber * ) malloc ( needbytes ) ; if ( allocbufa == NULL ) { * status |= DEC_Insufficient_storage ; break ; } a = allocbufa ; } pp = p + rhs -> digits ; needbytes = sizeof ( decNumber ) + ( D2U ( MAXI ( pp , 16 ) ) - 1 ) * sizeof ( Unit ) ; if ( needbytes > sizeof ( bufb ) ) { allocbufb = ( decNumber * ) malloc ( needbytes ) ; if ( allocbufb == NULL ) { * status |= DEC_Insufficient_storage ; break ; } b = allocbufb ; } uprv_decContextDefault ( & aset , DEC_INIT_DECIMAL64 ) ; r = rhs -> exponent + rhs -> digits ; uprv_decNumberFromInt32 ( a , r ) ; uprv_decNumberFromInt32 ( b , 2302585 ) ; b -> exponent = - 6 ; decMultiplyOp ( a , a , b , & aset , & ignore ) ; residue = 0 ; aset . digits = 2 ; aset . round = DEC_ROUND_DOWN ; decCopyFit ( b , rhs , & aset , & residue , & ignore ) ; b -> exponent = 0 ; t = decGetInt ( b ) ; if ( t < 10 ) t = X10 ( t ) ; t = LNnn [ t - 10 ] ; uprv_decNumberFromInt32 ( b , t >> 2 ) ; b -> exponent = - ( t & 3 ) - 3 ; b -> bits = DECNEG ; aset . digits = 16 ; aset . round = DEC_ROUND_HALF_EVEN ; decAddOp ( a , a , b , & aset , 0 , & ignore ) ; uprv_decNumberZero ( & numone ) ; * numone . lsu = 1 ; aset . emax = set -> emax ; aset . emin = set -> emin ; aset . clamp = 0 ; bset = aset ; bset . emax = DEC_MAX_MATH * 2 ; bset . emin = - DEC_MAX_MATH * 2 ; pp = 9 ; aset . digits = pp ; bset . digits = pp + rhs -> digits ; for ( ; ; ) { # if DECCHECK iterations ++ ; if ( iterations > 24 ) break ; # endif a -> bits ^= DECNEG ; decExpOp ( b , a , & bset , & ignore ) ; a -> bits ^= DECNEG ; decMultiplyOp ( b , b , rhs , & bset , & ignore ) ; decAddOp ( b , b , & numone , & bset , DECNEG , & ignore ) ; if ( decNumberIsZero ( b ) || ( a -> digits + a -> exponent ) >= ( b -> digits + b -> exponent + set -> digits + 1 ) ) { if ( a -> digits == p ) break ; if ( decNumberIsZero ( a ) ) { decCompareOp ( & cmp , rhs , & numone , & aset , COMPARE , & ignore ) ; if ( cmp . lsu [ 0 ] == 0 ) a -> exponent = 0 ; else * status |= ( DEC_Inexact | DEC_Rounded ) ; break ; } if ( decNumberIsZero ( b ) ) b -> exponent = a -> exponent - p ; } decAddOp ( a , a , b , & aset , 0 , & ignore ) ; if ( pp == p ) continue ; pp = pp * 2 ; if ( pp > p ) pp = p ; aset . digits = pp ; bset . digits = pp + rhs -> digits ; } # if DECCHECK if ( iterations > 24 ) printf ( "Ln iterations=%ld, status=%08lx, p=%ld, d=%ld\n" , ( LI ) iterations , ( LI ) * status , ( LI ) p , ( LI ) rhs -> digits ) ; # endif residue = 1 ; if ( ISZERO ( a ) ) residue = 0 ; aset . digits = set -> digits ; decCopyFit ( res , a , & aset , & residue , status ) ; decFinish ( res , set , & residue , status ) ; } while ( 0 ) ; if ( allocbufa != NULL ) free ( allocbufa ) ; if ( allocbufb != NULL ) free ( allocbufb ) ; return res ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vb_decode_palette ( VBDecContext * c , int data_size ) { int start , size , i ; start = bytestream2_get_byte ( & c -> stream ) ; size = ( bytestream2_get_byte ( & c -> stream ) - 1 ) & 0xFF ; if ( start + size > 255 ) { av_log ( c -> avctx , AV_LOG_ERROR , "Palette change runs beyond entry 256\n" ) ; return ; } if ( size * 3 + 2 > data_size ) { av_log ( c -> avctx , AV_LOG_ERROR , "Palette data runs beyond chunk size\n" ) ; return ; } for ( i = start ; i <= start + size ; i ++ ) c -> pal [ i ] = bytestream2_get_be24 ( & c -> stream ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp8cx_mb_init_quantizer ( VP8_COMP * cpi , MACROBLOCK * x , int ok_to_skip ) { int i ; int QIndex ; MACROBLOCKD * xd = & x -> e_mbd ; int zbin_extra ; if ( xd -> segmentation_enabled ) { if ( xd -> mb_segement_abs_delta == SEGMENT_ABSDATA ) QIndex = xd -> segment_feature_data [ MB_LVL_ALT_Q ] [ xd -> mode_info_context -> mbmi . segment_id ] ; else { QIndex = cpi -> common . base_qindex + xd -> segment_feature_data [ MB_LVL_ALT_Q ] [ xd -> mode_info_context -> mbmi . segment_id ] ; QIndex = ( QIndex >= 0 ) ? ( ( QIndex <= MAXQ ) ? QIndex : MAXQ ) : 0 ; } } else QIndex = cpi -> common . base_qindex ; if ( ! ok_to_skip || QIndex != x -> q_index ) { xd -> dequant_y1_dc [ 0 ] = 1 ; xd -> dequant_y1 [ 0 ] = cpi -> common . Y1dequant [ QIndex ] [ 0 ] ; xd -> dequant_y2 [ 0 ] = cpi -> common . Y2dequant [ QIndex ] [ 0 ] ; xd -> dequant_uv [ 0 ] = cpi -> common . UVdequant [ QIndex ] [ 0 ] ; for ( i = 1 ; i < 16 ; i ++ ) { xd -> dequant_y1_dc [ i ] = xd -> dequant_y1 [ i ] = cpi -> common . Y1dequant [ QIndex ] [ 1 ] ; xd -> dequant_y2 [ i ] = cpi -> common . Y2dequant [ QIndex ] [ 1 ] ; xd -> dequant_uv [ i ] = cpi -> common . UVdequant [ QIndex ] [ 1 ] ; } # if 1 for ( i = 0 ; i < 16 ; i ++ ) x -> e_mbd . block [ i ] . dequant = xd -> dequant_y1 ; for ( i = 16 ; i < 24 ; i ++ ) x -> e_mbd . block [ i ] . dequant = xd -> dequant_uv ; x -> e_mbd . block [ 24 ] . dequant = xd -> dequant_y2 ; # endif zbin_extra = ZBIN_EXTRA_Y ; for ( i = 0 ; i < 16 ; i ++ ) { x -> block [ i ] . quant = cpi -> Y1quant [ QIndex ] ; x -> block [ i ] . quant_fast = cpi -> Y1quant_fast [ QIndex ] ; x -> block [ i ] . quant_shift = cpi -> Y1quant_shift [ QIndex ] ; x -> block [ i ] . zbin = cpi -> Y1zbin [ QIndex ] ; x -> block [ i ] . round = cpi -> Y1round [ QIndex ] ; x -> block [ i ] . zrun_zbin_boost = cpi -> zrun_zbin_boost_y1 [ QIndex ] ; x -> block [ i ] . zbin_extra = ( short ) zbin_extra ; } zbin_extra = ZBIN_EXTRA_UV ; for ( i = 16 ; i < 24 ; i ++ ) { x -> block [ i ] . quant = cpi -> UVquant [ QIndex ] ; x -> block [ i ] . quant_fast = cpi -> UVquant_fast [ QIndex ] ; x -> block [ i ] . quant_shift = cpi -> UVquant_shift [ QIndex ] ; x -> block [ i ] . zbin = cpi -> UVzbin [ QIndex ] ; x -> block [ i ] . round = cpi -> UVround [ QIndex ] ; x -> block [ i ] . zrun_zbin_boost = cpi -> zrun_zbin_boost_uv [ QIndex ] ; x -> block [ i ] . zbin_extra = ( short ) zbin_extra ; } zbin_extra = ZBIN_EXTRA_Y2 ; x -> block [ 24 ] . quant_fast = cpi -> Y2quant_fast [ QIndex ] ; x -> block [ 24 ] . quant = cpi -> Y2quant [ QIndex ] ; x -> block [ 24 ] . quant_shift = cpi -> Y2quant_shift [ QIndex ] ; x -> block [ 24 ] . zbin = cpi -> Y2zbin [ QIndex ] ; x -> block [ 24 ] . round = cpi -> Y2round [ QIndex ] ; x -> block [ 24 ] . zrun_zbin_boost = cpi -> zrun_zbin_boost_y2 [ QIndex ] ; x -> block [ 24 ] . zbin_extra = ( short ) zbin_extra ; x -> q_index = QIndex ; x -> last_zbin_over_quant = x -> zbin_over_quant ; x -> last_zbin_mode_boost = x -> zbin_mode_boost ; x -> last_act_zbin_adj = x -> act_zbin_adj ; } else if ( x -> last_zbin_over_quant != x -> zbin_over_quant || x -> last_zbin_mode_boost != x -> zbin_mode_boost || x -> last_act_zbin_adj != x -> act_zbin_adj ) { zbin_extra = ZBIN_EXTRA_Y ; for ( i = 0 ; i < 16 ; i ++ ) x -> block [ i ] . zbin_extra = ( short ) zbin_extra ; zbin_extra = ZBIN_EXTRA_UV ; for ( i = 16 ; i < 24 ; i ++ ) x -> block [ i ] . zbin_extra = ( short ) zbin_extra ; zbin_extra = ZBIN_EXTRA_Y2 ; x -> block [ 24 ] . zbin_extra = ( short ) zbin_extra ; x -> last_zbin_over_quant = x -> zbin_over_quant ; x -> last_zbin_mode_boost = x -> zbin_mode_boost ; x -> last_act_zbin_adj = x -> act_zbin_adj ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( AvatarMenuButtonTest , MAYBE_HideOnSecondClick ) { # if defined ( OS_WIN ) && defined ( USE_ASH ) if ( base : : CommandLine : : ForCurrentProcess ( ) -> HasSwitch ( switches : : kAshBrowserTests ) ) return ; # endif if ( ! profiles : : IsMultipleProfilesEnabled ( ) ) return ; CreateTestingProfile ( ) ; ASSERT_NO_FATAL_FAILURE ( StartAvatarMenu ( ) ) ; AvatarMenuButton * button = GetAvatarMenuButton ( ) ; static_cast < views : : MenuButtonListener * > ( button ) -> OnMenuButtonClicked ( NULL , gfx : : Point ( ) ) ; AvatarMenuBubbleView : : Hide ( ) ; base : : MessageLoop : : current ( ) -> RunUntilIdle ( ) ; EXPECT_FALSE ( AvatarMenuBubbleView : : IsShowing ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bug8330 ( ) { const char * stmt_text ; MYSQL_STMT * stmt [ 2 ] ; int i , rc ; const char * query = "select a,b from t1 where a=?" ; MYSQL_BIND my_bind [ 2 ] ; long lval [ 2 ] ; myheader ( "test_bug8330" ) ; stmt_text = "drop table if exists t1" ; rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ; myquery ( rc ) ; stmt_text = "create table t1 (a int, b int)" ; rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ; myquery ( rc ) ; memset ( my_bind , 0 , sizeof ( my_bind ) ) ; for ( i = 0 ; i < 2 ; i ++ ) { stmt [ i ] = mysql_stmt_init ( mysql ) ; rc = mysql_stmt_prepare ( stmt [ i ] , query , strlen ( query ) ) ; check_execute ( stmt [ i ] , rc ) ; my_bind [ i ] . buffer_type = MYSQL_TYPE_LONG ; my_bind [ i ] . buffer = ( void * ) & lval [ i ] ; my_bind [ i ] . is_null = 0 ; mysql_stmt_bind_param ( stmt [ i ] , & my_bind [ i ] ) ; } rc = mysql_stmt_execute ( stmt [ 0 ] ) ; check_execute ( stmt [ 0 ] , rc ) ; rc = mysql_stmt_execute ( stmt [ 1 ] ) ; DIE_UNLESS ( rc && mysql_stmt_errno ( stmt [ 1 ] ) == CR_COMMANDS_OUT_OF_SYNC ) ; rc = mysql_stmt_execute ( stmt [ 0 ] ) ; check_execute ( stmt [ 0 ] , rc ) ; mysql_stmt_close ( stmt [ 0 ] ) ; mysql_stmt_close ( stmt [ 1 ] ) ; stmt_text = "drop table t1" ; rc = mysql_real_query ( mysql , stmt_text , strlen ( stmt_text ) ) ; myquery ( rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_CapabilityIdentifier ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { # line 714 "../../asn1/h245/h245.cnf" gef_ctx_t * gefx ; offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_CapabilityIdentifier , CapabilityIdentifier_choice , NULL ) ; # line 716 "../../asn1/h245/h245.cnf" gef_ctx_update_key ( gef_ctx_get ( actx -> private_data ) ) ; gefx = gef_ctx_get ( actx -> private_data ) ; if ( gefx ) { dissector_try_string ( gef_name_dissector_table , gefx -> key , tvb_new_subset ( tvb , offset >> 3 , 0 , 0 ) , actx -> pinfo , tree , actx ) ; } actx -> private_data = gefx ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorTextAddNetdev ( qemuMonitorPtr mon , const char * netdevstr ) { char * cmd ; char * reply = NULL ; int ret = - 1 ; if ( virAsprintf ( & cmd , "netdev_add %s" , netdevstr ) < 0 ) { virReportOOMError ( ) ; return - 1 ; } if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) < 0 ) { qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "failed to add netdev with '%s'" ) , cmd ) ; goto cleanup ; } ret = 0 ; cleanup : VIR_FREE ( cmd ) ; VIR_FREE ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void nautilus_directory_cancel_loading_file_attributes ( NautilusDirectory * directory , NautilusFile * file , NautilusFileAttributes file_attributes ) { Request request ; nautilus_directory_remove_file_from_work_queue ( directory , file ) ; request = nautilus_directory_set_up_request ( file_attributes ) ; if ( REQUEST_WANTS_TYPE ( request , REQUEST_DIRECTORY_COUNT ) ) { cancel_directory_count_for_file ( directory , file ) ; } if ( REQUEST_WANTS_TYPE ( request , REQUEST_DEEP_COUNT ) ) { cancel_deep_counts_for_file ( directory , file ) ; } if ( REQUEST_WANTS_TYPE ( request , REQUEST_MIME_LIST ) ) { cancel_mime_list_for_file ( directory , file ) ; } if ( REQUEST_WANTS_TYPE ( request , REQUEST_FILE_INFO ) ) { cancel_file_info_for_file ( directory , file ) ; } if ( REQUEST_WANTS_TYPE ( request , REQUEST_FILESYSTEM_INFO ) ) { cancel_filesystem_info_for_file ( directory , file ) ; } if ( REQUEST_WANTS_TYPE ( request , REQUEST_LINK_INFO ) ) { cancel_link_info_for_file ( directory , file ) ; } if ( REQUEST_WANTS_TYPE ( request , REQUEST_THUMBNAIL ) ) { cancel_thumbnail_for_file ( directory , file ) ; } if ( REQUEST_WANTS_TYPE ( request , REQUEST_MOUNT ) ) { cancel_mount_for_file ( directory , file ) ; } nautilus_directory_async_state_changed ( directory ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static float noise_enhancer ( float fixed_gain , float * prev_tr_gain , float voice_fac , float stab_fac ) { float sm_fac = 0.5 * ( 1 - voice_fac ) * stab_fac ; float g0 ; if ( fixed_gain < * prev_tr_gain ) { g0 = FFMIN ( * prev_tr_gain , fixed_gain + fixed_gain * ( 6226 * ( 1.0f / ( 1 << 15 ) ) ) ) ; } else g0 = FFMAX ( * prev_tr_gain , fixed_gain * ( 27536 * ( 1.0f / ( 1 << 15 ) ) ) ) ; * prev_tr_gain = g0 ; return sm_fac * g0 + ( 1 - sm_fac ) * fixed_gain ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void add_pending_tree ( struct rev_info * revs , struct tree * tree ) { add_pending_object ( revs , & tree -> object , "" ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void e1000e_intrmgr_pci_unint ( E1000ECore * core ) { int i ; timer_del ( core -> radv . timer ) ; timer_free ( core -> radv . timer ) ; timer_del ( core -> rdtr . timer ) ; timer_free ( core -> rdtr . timer ) ; timer_del ( core -> raid . timer ) ; timer_free ( core -> raid . timer ) ; timer_del ( core -> tadv . timer ) ; timer_free ( core -> tadv . timer ) ; timer_del ( core -> tidv . timer ) ; timer_free ( core -> tidv . timer ) ; timer_del ( core -> itr . timer ) ; timer_free ( core -> itr . timer ) ; for ( i = 0 ; i < E1000E_MSIX_VEC_NUM ; i ++ ) { timer_del ( core -> eitr [ i ] . timer ) ; timer_free ( core -> eitr [ i ] . timer ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( WebFrameTest , ExecuteCommandProducesUserGesture ) { FrameTestHelpers : : WebViewHelper web_view_helper ; web_view_helper . InitializeAndLoad ( "about:blank" ) ; WebLocalFrameImpl * frame = web_view_helper . LocalMainFrame ( ) ; EXPECT_FALSE ( frame -> GetFrame ( ) -> HasBeenActivated ( ) ) ; frame -> ExecuteScript ( WebScriptSource ( WebString ( "document.execCommand('copy'); " ) ) ) ; EXPECT_FALSE ( frame -> GetFrame ( ) -> HasBeenActivated ( ) ) ; frame -> ExecuteCommand ( WebString : : FromUTF8 ( "Paste" ) ) ; EXPECT_TRUE ( frame -> GetFrame ( ) -> HasBeenActivated ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void k12_close ( wtap * wth ) { k12_t * k12 = ( k12_t * ) wth -> priv ; destroy_k12_file_data ( k12 ) ; wth -> priv = NULL ; # ifdef DEBUG_K12 K12_DBG ( 5 , ( "k12_close: CLOSED" ) ) ; if ( env_file ) fclose ( dbg_out ) ; # endif }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean ng_file_seek_rand ( wtap * wth , gint64 offset , int * err , gchar * * err_info ) { ngsniffer_t * ngsniffer ; gint64 delta ; GList * new_list , * next_list ; blob_info_t * next_blob , * new_blob ; ngsniffer = ( ngsniffer_t * ) wth -> priv ; if ( wth -> file_type_subtype == WTAP_FILE_TYPE_SUBTYPE_NGSNIFFER_UNCOMPRESSED ) { if ( file_seek ( wth -> random_fh , offset , SEEK_SET , err ) == - 1 ) return FALSE ; return TRUE ; } delta = offset - ngsniffer -> rand . uncomp_offset ; new_list = NULL ; if ( delta > 0 ) { if ( ( size_t ) ( ngsniffer -> rand . nextout + delta ) >= ngsniffer -> rand . nbytes ) { if ( ngsniffer -> current_blob == NULL ) { new_list = ngsniffer -> first_blob ; } else { new_list = g_list_next ( ngsniffer -> current_blob ) ; } while ( new_list ) { next_list = g_list_next ( new_list ) ; if ( next_list == NULL ) { break ; } next_blob = ( blob_info_t * ) next_list -> data ; if ( next_blob -> blob_uncomp_offset > offset ) break ; new_list = next_list ; } if ( new_list == NULL ) { * err = WTAP_ERR_CANT_SEEK ; return FALSE ; } } } else if ( delta < 0 ) { if ( ngsniffer -> rand . nextout + delta < 0 ) { if ( ngsniffer -> current_blob == NULL ) { new_list = ngsniffer -> last_blob ; } else { new_list = g_list_previous ( ngsniffer -> current_blob ) ; } while ( new_list ) { new_blob = ( blob_info_t * ) new_list -> data ; if ( new_blob -> blob_uncomp_offset <= offset ) break ; new_list = g_list_previous ( new_list ) ; } if ( new_list == NULL ) { * err = WTAP_ERR_CANT_SEEK ; return FALSE ; } } } if ( new_list != NULL ) { new_blob = ( blob_info_t * ) new_list -> data ; if ( file_seek ( wth -> random_fh , new_blob -> blob_comp_offset , SEEK_SET , err ) == - 1 ) return FALSE ; if ( ngsniffer -> rand . buf == NULL ) { ngsniffer -> rand . buf = ( unsigned char * ) g_malloc ( OUTBUF_SIZE ) ; } ngsniffer -> current_blob = new_list ; ngsniffer -> rand . uncomp_offset = new_blob -> blob_uncomp_offset ; ngsniffer -> rand . comp_offset = new_blob -> blob_comp_offset ; if ( ! read_blob ( wth -> random_fh , & ngsniffer -> rand , err , err_info ) ) return FALSE ; delta = offset - ngsniffer -> rand . uncomp_offset ; g_assert ( delta >= 0 && ( unsigned long ) delta < ngsniffer -> rand . nbytes ) ; } ngsniffer -> rand . nextout += ( int ) delta ; ngsniffer -> rand . uncomp_offset += delta ; return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( SplFileInfo , getPathname ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; char * path ; int path_len ; if ( zend_parse_parameters_none ( ) == FAILURE ) { return ; } path = spl_filesystem_object_get_pathname ( intern , & path_len TSRMLS_CC ) ; if ( path != NULL ) { RETURN_STRINGL ( path , path_len , 1 ) ; } else { RETURN_FALSE ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void config_tinker ( config_tree * ptree ) { attr_val * tinker ; int item ; item = - 1 ; tinker = HEAD_PFIFO ( ptree -> tinker ) ; for ( ; tinker != NULL ; tinker = tinker -> link ) { switch ( tinker -> attr ) { default : NTP_INSIST ( 0 ) ; break ; case T_Allan : item = LOOP_ALLAN ; break ; case T_Dispersion : item = LOOP_PHI ; break ; case T_Freq : item = LOOP_FREQ ; break ; case T_Huffpuff : item = LOOP_HUFFPUFF ; break ; case T_Panic : item = LOOP_PANIC ; break ; case T_Step : item = LOOP_MAX ; break ; case T_Stepout : item = LOOP_MINSTEP ; break ; } loop_config ( item , tinker -> value . d ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
gcry_error_t gcry_pk_encrypt ( gcry_sexp_t * r_ciph , gcry_sexp_t s_data , gcry_sexp_t s_pkey ) { gcry_mpi_t * pkey = NULL , data = NULL , * ciph = NULL ; const char * algo_name , * algo_elems ; struct pk_encoding_ctx ctx ; gcry_err_code_t rc ; gcry_pk_spec_t * pubkey = NULL ; gcry_module_t module = NULL ; * r_ciph = NULL ; REGISTER_DEFAULT_PUBKEYS ; rc = sexp_to_key ( s_pkey , 0 , GCRY_PK_USAGE_ENCR , NULL , & pkey , & module , NULL ) ; if ( rc ) goto leave ; gcry_assert ( module ) ; pubkey = ( gcry_pk_spec_t * ) module -> spec ; algo_name = pubkey -> aliases ? * pubkey -> aliases : NULL ; if ( ! algo_name || ! * algo_name ) algo_name = pubkey -> name ; algo_elems = pubkey -> elements_enc ; init_encoding_ctx ( & ctx , PUBKEY_OP_ENCRYPT , gcry_pk_get_nbits ( s_pkey ) ) ; rc = sexp_data_to_mpi ( s_data , & data , & ctx ) ; if ( rc ) goto leave ; ciph = gcry_calloc ( strlen ( algo_elems ) + 1 , sizeof ( * ciph ) ) ; if ( ! ciph ) { rc = gpg_err_code_from_syserror ( ) ; goto leave ; } rc = pubkey_encrypt ( module -> mod_id , ciph , data , pkey , ctx . flags ) ; mpi_free ( data ) ; data = NULL ; if ( rc ) goto leave ; if ( ctx . encoding == PUBKEY_ENC_OAEP || ctx . encoding == PUBKEY_ENC_PKCS1 ) { unsigned char * em ; size_t emlen = ( ctx . nbits + 7 ) / 8 ; rc = octet_string_from_mpi ( & em , NULL , ciph [ 0 ] , emlen ) ; if ( rc ) goto leave ; rc = gcry_err_code ( gcry_sexp_build ( r_ciph , NULL , "(enc-val(%s(a%b)))" , algo_name , ( int ) emlen , em ) ) ; gcry_free ( em ) ; if ( rc ) goto leave ; } else { char * string , * p ; int i ; size_t nelem = strlen ( algo_elems ) ; size_t needed = 19 + strlen ( algo_name ) + ( nelem * 5 ) ; void * * arg_list ; string = p = gcry_malloc ( needed ) ; if ( ! string ) { rc = gpg_err_code_from_syserror ( ) ; goto leave ; } p = stpcpy ( p , "(enc-val(" ) ; p = stpcpy ( p , algo_name ) ; for ( i = 0 ; algo_elems [ i ] ; i ++ ) { * p ++ = '(' ; * p ++ = algo_elems [ i ] ; p = stpcpy ( p , "%m)" ) ; } strcpy ( p , "))" ) ; arg_list = malloc ( nelem * sizeof * arg_list ) ; if ( ! arg_list ) { rc = gpg_err_code_from_syserror ( ) ; goto leave ; } for ( i = 0 ; i < nelem ; i ++ ) arg_list [ i ] = ciph + i ; rc = gcry_sexp_build_array ( r_ciph , NULL , string , arg_list ) ; free ( arg_list ) ; if ( rc ) BUG ( ) ; gcry_free ( string ) ; } leave : if ( pkey ) { release_mpi_array ( pkey ) ; gcry_free ( pkey ) ; } if ( ciph ) { release_mpi_array ( ciph ) ; gcry_free ( ciph ) ; } if ( module ) { ath_mutex_lock ( & pubkeys_registered_lock ) ; _gcry_module_release ( module ) ; ath_mutex_unlock ( & pubkeys_registered_lock ) ; } gcry_free ( ctx . label ) ; return gcry_error ( rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void evhttp_connection_set_local_port ( struct evhttp_connection * evcon , unsigned short port ) { assert ( evcon -> state == EVCON_DISCONNECTED ) ; evcon -> bind_port = port ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
afs_int32 listMax ( struct rx_call * call , afs_int32 * uid , afs_int32 * gid ) { afs_int32 code ; struct ubik_trans * tt ; code = Initdb ( ) ; if ( code != PRSUCCESS ) return code ; code = ubik_BeginTransReadAny ( dbase , UBIK_READTRANS , & tt ) ; if ( code ) return code ; code = ubik_SetLock ( tt , 1 , 1 , LOCKREAD ) ; if ( code ) ABORT_WITH ( tt , code ) ; code = read_DbHeader ( tt ) ; if ( code ) ABORT_WITH ( tt , code ) ; code = GetMax ( tt , uid , gid ) ; if ( code != PRSUCCESS ) ABORT_WITH ( tt , code ) ; code = ubik_EndTrans ( tt ) ; if ( code ) return code ; return PRSUCCESS ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
inline static void _slurm_rpc_trigger_pull ( slurm_msg_t * msg ) { int rc ; uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ; trigger_info_msg_t * trigger_ptr = ( trigger_info_msg_t * ) msg -> data ; DEF_TIMERS ; START_TIMER ; debug ( "Processing RPC: REQUEST_TRIGGER_PULL from uid=%u" , ( unsigned int ) uid ) ; if ( ! validate_slurm_user ( uid ) ) { rc = ESLURM_USER_ID_MISSING ; error ( "Security violation, REQUEST_TRIGGER_PULL RPC " "from uid=%d" , uid ) ; } else rc = trigger_pull ( trigger_ptr ) ; END_TIMER2 ( "_slurm_rpc_trigger_pull" ) ; slurm_send_rc_msg ( msg , rc ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int old_dsa_priv_encode ( const EVP_PKEY * pkey , unsigned char * * pder ) { return i2d_DSAPrivateKey ( pkey -> pkey . dsa , pder ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void await_references ( H264Context * h ) { const int mb_xy = h -> mb_xy ; const int mb_type = h -> cur_pic . mb_type [ mb_xy ] ; int refs [ 2 ] [ 48 ] ; int nrefs [ 2 ] = { 0 } ; int ref , list ; memset ( refs , - 1 , sizeof ( refs ) ) ; if ( IS_16X16 ( mb_type ) ) { get_lowest_part_y ( h , refs , 0 , 16 , 0 , IS_DIR ( mb_type , 0 , 0 ) , IS_DIR ( mb_type , 0 , 1 ) , nrefs ) ; } else if ( IS_16X8 ( mb_type ) ) { get_lowest_part_y ( h , refs , 0 , 8 , 0 , IS_DIR ( mb_type , 0 , 0 ) , IS_DIR ( mb_type , 0 , 1 ) , nrefs ) ; get_lowest_part_y ( h , refs , 8 , 8 , 8 , IS_DIR ( mb_type , 1 , 0 ) , IS_DIR ( mb_type , 1 , 1 ) , nrefs ) ; } else if ( IS_8X16 ( mb_type ) ) { get_lowest_part_y ( h , refs , 0 , 16 , 0 , IS_DIR ( mb_type , 0 , 0 ) , IS_DIR ( mb_type , 0 , 1 ) , nrefs ) ; get_lowest_part_y ( h , refs , 4 , 16 , 0 , IS_DIR ( mb_type , 1 , 0 ) , IS_DIR ( mb_type , 1 , 1 ) , nrefs ) ; } else { int i ; av_assert2 ( IS_8X8 ( mb_type ) ) ; for ( i = 0 ; i < 4 ; i ++ ) { const int sub_mb_type = h -> sub_mb_type [ i ] ; const int n = 4 * i ; int y_offset = ( i & 2 ) << 2 ; if ( IS_SUB_8X8 ( sub_mb_type ) ) { get_lowest_part_y ( h , refs , n , 8 , y_offset , IS_DIR ( sub_mb_type , 0 , 0 ) , IS_DIR ( sub_mb_type , 0 , 1 ) , nrefs ) ; } else if ( IS_SUB_8X4 ( sub_mb_type ) ) { get_lowest_part_y ( h , refs , n , 4 , y_offset , IS_DIR ( sub_mb_type , 0 , 0 ) , IS_DIR ( sub_mb_type , 0 , 1 ) , nrefs ) ; get_lowest_part_y ( h , refs , n + 2 , 4 , y_offset + 4 , IS_DIR ( sub_mb_type , 0 , 0 ) , IS_DIR ( sub_mb_type , 0 , 1 ) , nrefs ) ; } else if ( IS_SUB_4X8 ( sub_mb_type ) ) { get_lowest_part_y ( h , refs , n , 8 , y_offset , IS_DIR ( sub_mb_type , 0 , 0 ) , IS_DIR ( sub_mb_type , 0 , 1 ) , nrefs ) ; get_lowest_part_y ( h , refs , n + 1 , 8 , y_offset , IS_DIR ( sub_mb_type , 0 , 0 ) , IS_DIR ( sub_mb_type , 0 , 1 ) , nrefs ) ; } else { int j ; av_assert2 ( IS_SUB_4X4 ( sub_mb_type ) ) ; for ( j = 0 ; j < 4 ; j ++ ) { int sub_y_offset = y_offset + 2 * ( j & 2 ) ; get_lowest_part_y ( h , refs , n + j , 4 , sub_y_offset , IS_DIR ( sub_mb_type , 0 , 0 ) , IS_DIR ( sub_mb_type , 0 , 1 ) , nrefs ) ; } } } } for ( list = h -> list_count - 1 ; list >= 0 ; list -- ) for ( ref = 0 ; ref < 48 && nrefs [ list ] ; ref ++ ) { int row = refs [ list ] [ ref ] ; if ( row >= 0 ) { Picture * ref_pic = & h -> ref_list [ list ] [ ref ] ; int ref_field = ref_pic -> reference - 1 ; int ref_field_picture = ref_pic -> field_picture ; int pic_height = 16 * h -> mb_height >> ref_field_picture ; row <<= MB_MBAFF ( h ) ; nrefs [ list ] -- ; if ( ! FIELD_PICTURE ( h ) && ref_field_picture ) { ff_thread_await_progress ( & ref_pic -> tf , FFMIN ( ( row >> 1 ) - ! ( row & 1 ) , pic_height - 1 ) , 1 ) ; ff_thread_await_progress ( & ref_pic -> tf , FFMIN ( ( row >> 1 ) , pic_height - 1 ) , 0 ) ; } else if ( FIELD_PICTURE ( h ) && ! ref_field_picture ) { ff_thread_await_progress ( & ref_pic -> tf , FFMIN ( row * 2 + ref_field , pic_height - 1 ) , 0 ) ; } else if ( FIELD_PICTURE ( h ) ) { ff_thread_await_progress ( & ref_pic -> tf , FFMIN ( row , pic_height - 1 ) , ref_field ) ; } else { ff_thread_await_progress ( & ref_pic -> tf , FFMIN ( row , pic_height - 1 ) , 0 ) ; } } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
void TSHttpTxnActiveTimeoutSet ( TSHttpTxn txnp , int timeout ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; HttpTransact : : State * s = & ( ( ( HttpSM * ) txnp ) -> t_state ) ; s -> api_txn_active_timeout_value = timeout ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( TemplateURLParserTest , TestFirefoxEbay ) { ParamFilterImpl filter ( "ebay" , "ebay" ) ; ASSERT_NO_FATAL_FAILURE ( ParseFile ( "firefox_ebay.xml" , & filter ) ) ; ASSERT_TRUE ( template_url_ ) ; EXPECT_EQ ( ASCIIToUTF16 ( "eBay" ) , template_url_ -> short_name ( ) ) ; EXPECT_TRUE ( template_url_ -> url_ref ( ) . SupportsReplacement ( SearchTermsData ( ) ) ) ; EXPECT_EQ ( "http://search.ebay.com/search/search.dll?query={ searchTerms} &" "MfcISAPICommand=GetResult&ht=1&srchdesc=n&maxRecordsReturned=300&" "maxRecordsPerPage=50&SortProperty=MetaEndSort" , template_url_ -> url ( ) ) ; ASSERT_EQ ( 1U , template_url_ -> input_encodings ( ) . size ( ) ) ; EXPECT_EQ ( "ISO-8859-1" , template_url_ -> input_encodings ( ) [ 0 ] ) ; EXPECT_EQ ( GURL ( "http://search.ebay.com/favicon.ico" ) , template_url_ -> favicon_url ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ProtocolHandlerRegistryTest , RemovingHandlerMeansItCanBeAddedAgain ) { registry ( ) -> OnAcceptRegisterProtocolHandler ( test_protocol_handler ( ) ) ; ASSERT_TRUE ( registry ( ) -> CanSchemeBeOverridden ( "test" ) ) ; registry ( ) -> RemoveHandler ( test_protocol_handler ( ) ) ; ASSERT_TRUE ( registry ( ) -> CanSchemeBeOverridden ( "test" ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ossl_asn1_default_tag ( VALUE obj ) { VALUE tmp_class , tag ; tmp_class = CLASS_OF ( obj ) ; while ( ! NIL_P ( tmp_class ) ) { tag = rb_hash_lookup ( class_tag_map , tmp_class ) ; if ( tag != Qnil ) return NUM2INT ( tag ) ; tmp_class = rb_class_superclass ( tmp_class ) ; } ossl_raise ( eASN1Error , "universal tag for %" PRIsVALUE " not found" , rb_obj_class ( obj ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void gic_dist_writel ( void * opaque , hwaddr offset , uint32_t value ) { GICState * s = ( GICState * ) opaque ; if ( offset == 0xf00 ) { int cpu ; int irq ; int mask ; cpu = gic_get_current_cpu ( s ) ; irq = value & 0x3ff ; switch ( ( value >> 24 ) & 3 ) { case 0 : mask = ( value >> 16 ) & ALL_CPU_MASK ; break ; case 1 : mask = ALL_CPU_MASK ^ ( 1 << cpu ) ; break ; case 2 : mask = 1 << cpu ; break ; default : DPRINTF ( "Bad Soft Int target filter\n" ) ; mask = ALL_CPU_MASK ; break ; } GIC_SET_PENDING ( irq , mask ) ; gic_update ( s ) ; return ; } gic_dist_writew ( opaque , offset , value & 0xffff ) ; gic_dist_writew ( opaque , offset + 2 , value >> 16 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void override_features_hangul ( hb_ot_shape_planner_t * plan ) { plan -> map . add_feature ( HB_TAG ( 'c' , 'a' , 'l' , 't' ) , 0 , F_GLOBAL ) ; }
0False