instruction
stringclasses
1 value
input
stringlengths
31
235k
output
class label
2 classes
Categorize the following code snippet as vulnerable or not. True or False
static bool mark_as_dependent ( THD * thd , SELECT_LEX * last , SELECT_LEX * current , Item_ident * resolved_item , Item_ident * mark_item ) { DBUG_ENTER ( "mark_as_dependent" ) ; if ( mark_item && mark_item -> can_be_depended ) { DBUG_PRINT ( "info" , ( "mark_item: %p lex: %p" , mark_item , last ) ) ; mark_item -> depended_from = last ; } if ( current -> mark_as_dependent ( thd , last , mark_item ) ) DBUG_RETURN ( TRUE ) ; if ( thd -> lex -> describe & DESCRIBE_EXTENDED ) { const char * db_name = ( resolved_item -> db_name ? resolved_item -> db_name : "" ) ; const char * table_name = ( resolved_item -> table_name ? resolved_item -> table_name : "" ) ; push_warning_printf ( thd , MYSQL_ERROR : : WARN_LEVEL_NOTE , ER_WARN_FIELD_RESOLVED , ER ( ER_WARN_FIELD_RESOLVED ) , db_name , ( db_name [ 0 ] ? "." : "" ) , table_name , ( table_name [ 0 ] ? "." : "" ) , resolved_item -> field_name , current -> select_number , last -> select_number ) ; } DBUG_RETURN ( FALSE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static UBool _addExtensionToList ( ExtensionListEntry * * first , ExtensionListEntry * ext , UBool localeToBCP ) { UBool bAdded = TRUE ; if ( * first == NULL ) { ext -> next = NULL ; * first = ext ; } else { ExtensionListEntry * prev , * cur ; int32_t cmp ; prev = NULL ; cur = * first ; while ( TRUE ) { if ( cur == NULL ) { prev -> next = ext ; ext -> next = NULL ; break ; } if ( localeToBCP ) { int32_t len , curlen ; len = ( int32_t ) uprv_strlen ( ext -> key ) ; curlen = ( int32_t ) uprv_strlen ( cur -> key ) ; if ( len == 1 && curlen == 1 ) { if ( * ( ext -> key ) == * ( cur -> key ) ) { cmp = 0 ; } else if ( * ( ext -> key ) == PRIVATEUSE ) { cmp = 1 ; } else if ( * ( cur -> key ) == PRIVATEUSE ) { cmp = - 1 ; } else { cmp = * ( ext -> key ) - * ( cur -> key ) ; } } else if ( len == 1 ) { cmp = * ( ext -> key ) - LDMLEXT ; } else if ( curlen == 1 ) { cmp = LDMLEXT - * ( cur -> key ) ; } else { cmp = uprv_compareInvCharsAsAscii ( ext -> key , cur -> key ) ; if ( cmp != 0 ) { if ( uprv_strcmp ( cur -> key , LOCALE_ATTRIBUTE_KEY ) == 0 ) { cmp = 1 ; } else if ( uprv_strcmp ( ext -> key , LOCALE_ATTRIBUTE_KEY ) == 0 ) { cmp = - 1 ; } } } } else { cmp = uprv_compareInvCharsAsAscii ( ext -> key , cur -> key ) ; } if ( cmp < 0 ) { if ( prev == NULL ) { * first = ext ; } else { prev -> next = ext ; } ext -> next = cur ; break ; } if ( cmp == 0 ) { bAdded = FALSE ; break ; } prev = cur ; cur = cur -> next ; } } return bAdded ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void set_stream_dimensions ( struct stream_state * stream , unsigned int w , unsigned int h ) { if ( ! stream -> config . cfg . g_w ) { if ( ! stream -> config . cfg . g_h ) stream -> config . cfg . g_w = w ; else stream -> config . cfg . g_w = w * stream -> config . cfg . g_h / h ; } if ( ! stream -> config . cfg . g_h ) { stream -> config . cfg . g_h = h * stream -> config . cfg . g_w / w ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
char * convert_http_hdr_to_string ( TSMBuffer bufp , TSMLoc hdr_loc ) { TSIOBuffer output_buffer ; TSIOBufferReader reader ; int64_t total_avail ; TSIOBufferBlock block ; const char * block_start ; int64_t block_avail ; char * output_string ; int output_len ; output_buffer = TSIOBufferCreate ( ) ; if ( ! output_buffer ) { TSError ( "[InkAPITest] couldn't allocate IOBuffer" ) ; } reader = TSIOBufferReaderAlloc ( output_buffer ) ; TSHttpHdrPrint ( bufp , hdr_loc , output_buffer ) ; total_avail = TSIOBufferReaderAvail ( reader ) ; output_string = ( char * ) TSmalloc ( total_avail + 1 ) ; output_len = 0 ; block = TSIOBufferReaderStart ( reader ) ; while ( block ) { block_start = TSIOBufferBlockReadStart ( block , reader , & block_avail ) ; if ( block_avail == 0 ) { break ; } memcpy ( output_string + output_len , block_start , block_avail ) ; output_len += block_avail ; TSIOBufferReaderConsume ( reader , block_avail ) ; block = TSIOBufferReaderStart ( reader ) ; } output_string [ output_len ] = '\0' ; output_len ++ ; TSIOBufferReaderFree ( reader ) ; TSIOBufferDestroy ( output_buffer ) ; return output_string ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static char * make_next_duplicate_name ( const char * base , const char * suffix , int count , int max_length ) { const char * format ; char * result ; int unshortened_length ; gboolean use_count ; if ( count < 1 ) { g_warning ( "bad count %d in get_duplicate_name" , count ) ; count = 1 ; } if ( count <= 2 ) { switch ( count ) { default : { g_assert_not_reached ( ) ; } case 1 : { format = FIRST_COPY_DUPLICATE_FORMAT ; } break ; case 2 : { format = SECOND_COPY_DUPLICATE_FORMAT ; } break ; } use_count = FALSE ; } else { switch ( count % 100 ) { case 11 : { format = X11TH_COPY_DUPLICATE_FORMAT ; } break ; case 12 : { format = X12TH_COPY_DUPLICATE_FORMAT ; } break ; case 13 : { format = X13TH_COPY_DUPLICATE_FORMAT ; } break ; default : { format = NULL ; } break ; } if ( format == NULL ) { switch ( count % 10 ) { case 1 : { format = ST_COPY_DUPLICATE_FORMAT ; } break ; case 2 : { format = ND_COPY_DUPLICATE_FORMAT ; } break ; case 3 : { format = RD_COPY_DUPLICATE_FORMAT ; } break ; default : { format = TH_COPY_DUPLICATE_FORMAT ; } break ; } } use_count = TRUE ; } # pragma GCC diagnostic push # pragma GCC diagnostic ignored "-Wformat-nonliteral" if ( use_count ) { result = g_strdup_printf ( format , base , count , suffix ) ; } else { result = g_strdup_printf ( format , base , suffix ) ; } if ( max_length > 0 && ( unshortened_length = strlen ( result ) ) > max_length ) { char * new_base ; new_base = shorten_utf8_string ( base , unshortened_length - max_length ) ; if ( new_base ) { g_free ( result ) ; if ( use_count ) { result = g_strdup_printf ( format , new_base , count , suffix ) ; } else { result = g_strdup_printf ( format , new_base , suffix ) ; } g_assert ( strlen ( result ) <= max_length ) ; g_free ( new_base ) ; } } # pragma GCC diagnostic pop return result ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean fat_str_replace ( char * str , char replacement ) { gboolean success ; int i ; success = FALSE ; for ( i = 0 ; str [ i ] != '\0' ; i ++ ) { if ( strchr ( FAT_FORBIDDEN_CHARACTERS , str [ i ] ) || str [ i ] < 32 ) { success = TRUE ; str [ i ] = replacement ; } } return success ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( WebFrameSimTest , RtlInitialScrollOffsetWithViewport ) { UseAndroidSettings ( ) ; WebView ( ) . Resize ( WebSize ( 400 , 400 ) ) ; WebView ( ) . SetDefaultPageScaleLimits ( 0.25f , 2 ) ; SimRequest main_resource ( "https://example.com/test.html" , "text/html" ) ; LoadURL ( "https://example.com/test.html" ) ; main_resource . Complete ( R "HTML( < meta name = 'viewport' content = 'width=device-width, minimum-scale=1' > < body dir = 'rtl' > < div style = 'width: 3000px; height: 20px' > < / div > ) HTML "); Compositor ( ) . BeginFrame ( ) ; ScrollableArea * area = GetDocument ( ) . View ( ) -> LayoutViewport ( ) ; ASSERT_EQ ( ScrollOffset ( 0 , 0 ) , area -> GetScrollOffset ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline int loco_get_rice ( RICEContext * r ) { int v ; if ( r -> run > 0 ) { r -> run -- ; loco_update_rice_param ( r , 0 ) ; return 0 ; } v = get_ur_golomb_jpegls ( & r -> gb , loco_get_rice_param ( r ) , INT_MAX , 0 ) ; loco_update_rice_param ( r , ( v + 1 ) >> 1 ) ; if ( ! v ) { if ( r -> save >= 0 ) { r -> run = get_ur_golomb_jpegls ( & r -> gb , 2 , INT_MAX , 0 ) ; if ( r -> run > 1 ) r -> save += r -> run + 1 ; else r -> save -= 3 ; } else r -> run2 ++ ; } else { v = ( ( v >> 1 ) + r -> lossy ) ^ - ( v & 1 ) ; if ( r -> run2 > 0 ) { if ( r -> run2 > 2 ) r -> save += r -> run2 ; else r -> save -= 3 ; r -> run2 = 0 ; } } return v ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int virLogHostnameString ( char * * rawmsg , char * * msg ) { char * hoststr ; if ( ! virLogHostname ) return - 1 ; if ( virAsprintfQuiet ( & hoststr , "hostname: %s" , virLogHostname ) < 0 ) { return - 1 ; } if ( virLogFormatString ( msg , 0 , NULL , VIR_LOG_INFO , hoststr ) < 0 ) { VIR_FREE ( hoststr ) ; return - 1 ; } * rawmsg = hoststr ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void ucnv_UTF8FromUTF8 ( UConverterFromUnicodeArgs * pFromUArgs , UConverterToUnicodeArgs * pToUArgs , UErrorCode * pErrorCode ) { UConverter * utf8 ; const uint8_t * source , * sourceLimit ; uint8_t * target ; int32_t targetCapacity ; int32_t count ; int8_t oldToULength , toULength , toULimit ; UChar32 c ; uint8_t b , t1 , t2 ; utf8 = pToUArgs -> converter ; source = ( uint8_t * ) pToUArgs -> source ; sourceLimit = ( uint8_t * ) pToUArgs -> sourceLimit ; target = ( uint8_t * ) pFromUArgs -> target ; targetCapacity = ( int32_t ) ( pFromUArgs -> targetLimit - pFromUArgs -> target ) ; c = ( UChar32 ) utf8 -> toUnicodeStatus ; if ( c != 0 ) { toULength = oldToULength = utf8 -> toULength ; toULimit = ( int8_t ) utf8 -> mode ; } else { toULength = oldToULength = toULimit = 0 ; } count = ( int32_t ) ( sourceLimit - source ) + oldToULength ; if ( count < toULimit ) { } else if ( targetCapacity < toULimit ) { * pErrorCode = U_USING_DEFAULT_WARNING ; return ; } else { int32_t i ; if ( count > targetCapacity ) { count = targetCapacity ; } i = 0 ; while ( i < 3 && i < ( count - toULimit ) ) { b = source [ count - oldToULength - i - 1 ] ; if ( U8_IS_TRAIL ( b ) ) { ++ i ; } else { if ( i < U8_COUNT_TRAIL_BYTES ( b ) ) { count -= i + 1 ; } break ; } } } if ( c != 0 ) { utf8 -> toUnicodeStatus = 0 ; utf8 -> toULength = 0 ; goto moreBytes ; } while ( count > 0 ) { b = * source ++ ; if ( ( int8_t ) b >= 0 ) { * target ++ = b ; -- count ; continue ; } else { if ( b > 0xe0 ) { if ( ( t1 = source [ 0 ] ) >= 0x80 && ( ( b < 0xed && ( t1 <= 0xbf ) ) || ( b == 0xed && ( t1 <= 0x9f ) ) ) && ( t2 = source [ 1 ] ) >= 0x80 && t2 <= 0xbf ) { source += 2 ; * target ++ = b ; * target ++ = t1 ; * target ++ = t2 ; count -= 3 ; continue ; } } else if ( b < 0xe0 ) { if ( b >= 0xc2 && ( t1 = * source ) >= 0x80 && t1 <= 0xbf ) { ++ source ; * target ++ = b ; * target ++ = t1 ; count -= 2 ; continue ; } } else if ( b == 0xe0 ) { if ( ( t1 = source [ 0 ] ) >= 0xa0 && t1 <= 0xbf && ( t2 = source [ 1 ] ) >= 0x80 && t2 <= 0xbf ) { source += 2 ; * target ++ = b ; * target ++ = t1 ; * target ++ = t2 ; count -= 3 ; continue ; } } oldToULength = 0 ; toULength = 1 ; toULimit = U8_COUNT_TRAIL_BYTES ( b ) + 1 ; c = b ; moreBytes : while ( toULength < toULimit ) { if ( source < sourceLimit ) { b = * source ; if ( U8_IS_TRAIL ( b ) ) { ++ source ; ++ toULength ; c = ( c << 6 ) + b ; } else { break ; } } else { source -= ( toULength - oldToULength ) ; while ( oldToULength < toULength ) { utf8 -> toUBytes [ oldToULength ++ ] = * source ++ ; } utf8 -> toUnicodeStatus = c ; utf8 -> toULength = toULength ; utf8 -> mode = toULimit ; pToUArgs -> source = ( char * ) source ; pFromUArgs -> target = ( char * ) target ; return ; } } if ( toULength == toULimit && ( toULength == 3 || toULength == 2 ) && ( c -= utf8_offsets [ toULength ] ) >= utf8_minLegal [ toULength ] && ( c <= 0xd7ff || 0xe000 <= c ) ) { } else if ( toULength == toULimit && toULength == 4 && ( 0x10000 <= ( c -= utf8_offsets [ 4 ] ) && c <= 0x10ffff ) ) { } else { source -= ( toULength - oldToULength ) ; while ( oldToULength < toULength ) { utf8 -> toUBytes [ oldToULength ++ ] = * source ++ ; } utf8 -> toULength = toULength ; pToUArgs -> source = ( char * ) source ; pFromUArgs -> target = ( char * ) target ; * pErrorCode = U_ILLEGAL_CHAR_FOUND ; return ; } { int8_t i ; for ( i = 0 ; i < oldToULength ; ++ i ) { * target ++ = utf8 -> toUBytes [ i ] ; } source -= ( toULength - oldToULength ) ; for ( ; i < toULength ; ++ i ) { * target ++ = * source ++ ; } count -= toULength ; } } } if ( U_SUCCESS ( * pErrorCode ) && source < sourceLimit ) { if ( target == ( const uint8_t * ) pFromUArgs -> targetLimit ) { * pErrorCode = U_BUFFER_OVERFLOW_ERROR ; } else { b = * source ; toULimit = U8_COUNT_TRAIL_BYTES ( b ) + 1 ; if ( toULimit > ( sourceLimit - source ) ) { toULength = 0 ; c = b ; for ( ; ; ) { utf8 -> toUBytes [ toULength ++ ] = b ; if ( ++ source == sourceLimit ) { utf8 -> toUnicodeStatus = c ; utf8 -> toULength = toULength ; utf8 -> mode = toULimit ; break ; } else if ( ! U8_IS_TRAIL ( b = * source ) ) { utf8 -> toULength = toULength ; * pErrorCode = U_ILLEGAL_CHAR_FOUND ; break ; } c = ( c << 6 ) + b ; } } else { * pErrorCode = U_USING_DEFAULT_WARNING ; } } } pToUArgs -> source = ( char * ) source ; pFromUArgs -> target = ( char * ) target ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void exsltSaxonLineNumberFunction ( xmlXPathParserContextPtr ctxt , int nargs ) { xmlNodePtr cur = NULL ; if ( nargs == 0 ) { cur = ctxt -> context -> node ; } else if ( nargs == 1 ) { xmlXPathObjectPtr obj ; xmlNodeSetPtr nodelist ; int i ; if ( ( ctxt -> value == NULL ) || ( ctxt -> value -> type != XPATH_NODESET ) ) { xsltTransformError ( xsltXPathGetTransformContext ( ctxt ) , NULL , NULL , "saxon:line-number() : invalid arg expecting a node-set\n" ) ; ctxt -> error = XPATH_INVALID_TYPE ; return ; } obj = valuePop ( ctxt ) ; nodelist = obj -> nodesetval ; if ( ( nodelist == NULL ) || ( nodelist -> nodeNr <= 0 ) ) { xmlXPathFreeObject ( obj ) ; valuePush ( ctxt , xmlXPathNewFloat ( - 1 ) ) ; return ; } cur = nodelist -> nodeTab [ 0 ] ; for ( i = 1 ; i < nodelist -> nodeNr ; i ++ ) { int ret = xmlXPathCmpNodes ( cur , nodelist -> nodeTab [ i ] ) ; if ( ret == - 1 ) cur = nodelist -> nodeTab [ i ] ; } xmlXPathFreeObject ( obj ) ; } else { xsltTransformError ( xsltXPathGetTransformContext ( ctxt ) , NULL , NULL , "saxon:line-number() : invalid number of args %d\n" , nargs ) ; ctxt -> error = XPATH_INVALID_ARITY ; return ; } valuePush ( ctxt , xmlXPathNewFloat ( xmlGetLineNo ( cur ) ) ) ; return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline bool e1000e_ring_enabled ( E1000ECore * core , const E1000E_RingInfo * r ) { return core -> mac [ r -> dlen ] > 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void s_aes_set_padding ( stream_aes_state * state , int use_padding ) { state -> use_padding = use_padding ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_compute_qdelta ( const RATE_CONTROL * rc , double qstart , double qtarget ) { int start_index = rc -> worst_quality ; int target_index = rc -> worst_quality ; int i ; for ( i = rc -> best_quality ; i < rc -> worst_quality ; ++ i ) { start_index = i ; if ( vp9_convert_qindex_to_q ( i ) >= qstart ) break ; } for ( i = rc -> best_quality ; i < rc -> worst_quality ; ++ i ) { target_index = i ; if ( vp9_convert_qindex_to_q ( i ) >= qtarget ) break ; } return target_index - start_index ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_rsvp_detour ( proto_tree * ti , packet_info * pinfo , proto_tree * rsvp_object_tree , tvbuff_t * tvb , int offset , int obj_length , int rsvp_class _U_ , int type ) { int remaining_length , count ; int iter ; proto_item_set_text ( ti , "DETOUR: " ) ; switch ( type ) { case 7 : iter = 0 ; proto_tree_add_uint ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type ) ; for ( remaining_length = obj_length - 4 , count = 1 ; remaining_length > 0 ; remaining_length -= 8 , count ++ ) { if ( remaining_length < 8 ) { proto_tree_add_expert_format ( rsvp_object_tree , pinfo , & ei_rsvp_invalid_length , tvb , offset + remaining_length , obj_length - remaining_length , "Invalid length: cannot decode" ) ; proto_item_append_text ( ti , "Invalid length" ) ; break ; } iter ++ ; proto_tree_add_ipv4_format ( rsvp_object_tree , hf_rsvp_detour_plr_id , tvb , offset + ( 4 * iter ) , 4 , tvb_get_ntohl ( tvb , offset + ( 4 * iter ) ) , "PLR ID %d: %s" , count , tvb_ip_to_str ( tvb , offset + ( 4 * iter ) ) ) ; iter ++ ; proto_tree_add_ipv4_format ( rsvp_object_tree , hf_rsvp_detour_avoid_node_id , tvb , offset + ( 4 * iter ) , 4 , tvb_get_ntohl ( tvb , offset + ( 4 * iter ) ) , "Avoid Node ID %d: %s" , count , tvb_ip_to_str ( tvb , offset + ( 4 * iter ) ) ) ; } break ; default : proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "Unknown (%u)" , type ) ; proto_tree_add_item ( rsvp_object_tree , hf_rsvp_detour_data , tvb , offset + 4 , obj_length - 4 , ENC_NA ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
inline static bool do_cookies_prevent_caching ( int cookies_conf , HTTPHdr * request , HTTPHdr * response , HTTPHdr * cached_request = nullptr ) { enum CookiesConfig { COOKIES_CACHE_NONE = 0 , COOKIES_CACHE_ALL = 1 , COOKIES_CACHE_IMAGES = 2 , COOKIES_CACHE_ALL_BUT_TEXT = 3 , COOKIES_CACHE_ALL_BUT_TEXT_EXT = 4 } ; const char * content_type = nullptr ; int str_len ; # ifdef DEBUG ink_assert ( request -> type_get ( ) == HTTP_TYPE_REQUEST ) ; ink_assert ( response -> type_get ( ) == HTTP_TYPE_RESPONSE ) ; if ( cached_request ) { ink_assert ( cached_request -> type_get ( ) == HTTP_TYPE_REQUEST ) ; } # endif if ( ( CookiesConfig ) cookies_conf == COOKIES_CACHE_ALL ) { return false ; } if ( ! response -> presence ( MIME_PRESENCE_SET_COOKIE ) && ! request -> presence ( MIME_PRESENCE_COOKIE ) && ( cached_request == nullptr || ! cached_request -> presence ( MIME_PRESENCE_COOKIE ) ) ) { return false ; } if ( ( CookiesConfig ) cookies_conf == COOKIES_CACHE_NONE ) { return true ; } content_type = response -> value_get ( MIME_FIELD_CONTENT_TYPE , MIME_LEN_CONTENT_TYPE , & str_len ) ; if ( ( CookiesConfig ) cookies_conf == COOKIES_CACHE_IMAGES ) { if ( content_type && str_len >= 5 && memcmp ( content_type , "image" , 5 ) == 0 ) { return false ; } return true ; } if ( content_type && str_len >= 4 && memcmp ( content_type , "text" , 4 ) == 0 ) { if ( ( CookiesConfig ) cookies_conf == COOKIES_CACHE_ALL_BUT_TEXT_EXT && ( ( ! response -> presence ( MIME_PRESENCE_SET_COOKIE ) ) || response -> is_cache_control_set ( HTTP_VALUE_PUBLIC ) ) ) { return false ; } return true ; } return false ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
IN_PROC_BROWSER_TEST_F ( FastUnloadTest , MAYBE_WindowCloseAfterBeforeUnloadCrash ) { if ( base : : CommandLine : : ForCurrentProcess ( ) -> HasSwitch ( switches : : kSingleProcess ) ) return ; NavigateToDataURL ( BEFORE_UNLOAD_HTML , "beforeunload" ) ; content : : WebContents * beforeunload_contents = browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ; content : : WindowedNotificationObserver window_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , content : : NotificationService : : AllSources ( ) ) ; chrome : : CloseWindow ( browser ( ) ) ; CrashTab ( beforeunload_contents ) ; window_observer . Wait ( ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int purple_send_typing ( struct im_connection * ic , char * who , int flags ) { PurpleTypingState state = PURPLE_NOT_TYPING ; struct purple_data * pd = ic -> proto_data ; if ( flags & OPT_TYPING ) { state = PURPLE_TYPING ; } else if ( flags & OPT_THINKING ) { state = PURPLE_TYPED ; } serv_send_typing ( purple_account_get_connection ( pd -> account ) , who , state ) ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void refresh_status ( THD * thd ) { mysql_mutex_lock ( & LOCK_status ) ; add_to_status ( & global_status_var , & thd -> status_var ) ; bzero ( ( uchar * ) & thd -> status_var , sizeof ( thd -> status_var ) ) ; bzero ( ( uchar * ) & thd -> org_status_var , sizeof ( thd -> org_status_var ) ) ; thd -> start_bytes_received = 0 ; reset_status_vars ( ) ; process_key_caches ( reset_key_cache_counters , 0 ) ; flush_status_time = time ( ( time_t * ) 0 ) ; mysql_mutex_unlock ( & LOCK_status ) ; mysql_mutex_lock ( & LOCK_thread_count ) ; max_used_connections = thread_count - delayed_insert_threads ; mysql_mutex_unlock ( & LOCK_thread_count ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void tmx_pretran_unlink_safe ( int slotid ) { if ( _tmx_proc_ptran == NULL ) return ; if ( _tmx_proc_ptran -> linked == 0 ) return ; if ( _tmx_ptran_table [ slotid ] . plist == NULL ) { _tmx_proc_ptran -> prev = _tmx_proc_ptran -> next = NULL ; _tmx_proc_ptran -> linked = 0 ; return ; } if ( _tmx_proc_ptran -> prev == NULL ) { _tmx_ptran_table [ slotid ] . plist = _tmx_proc_ptran -> next ; if ( _tmx_ptran_table [ slotid ] . plist != NULL ) _tmx_ptran_table [ slotid ] . plist -> prev = NULL ; } else { _tmx_proc_ptran -> prev -> next = _tmx_proc_ptran -> next ; if ( _tmx_proc_ptran -> next ) _tmx_proc_ptran -> next -> prev = _tmx_proc_ptran -> prev ; } _tmx_proc_ptran -> prev = _tmx_proc_ptran -> next = NULL ; _tmx_proc_ptran -> linked = 0 ; return ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int i2d_X509_fp ( FILE * fp , X509 * x509 ) { return ASN1_item_i2d_fp ( ASN1_ITEM_rptr ( X509 ) , fp , x509 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static diam_avp_t * build_proto_avp ( const avp_type_t * type _U_ , guint32 code , diam_vnd_t * vendor , const char * name _U_ , const value_string * vs _U_ , void * data ) { diam_avp_t * a = ( diam_avp_t * ) g_malloc0 ( sizeof ( diam_avp_t ) ) ; proto_avp_t * t = ( proto_avp_t * ) g_malloc0 ( sizeof ( proto_avp_t ) ) ; gint * ettp = & ( a -> ett ) ; a -> code = code ; a -> vendor = vendor ; a -> dissector_v16 = proto_avp ; a -> dissector_rfc = proto_avp ; a -> ett = - 1 ; a -> hf_value = - 2 ; a -> type_data = t ; t -> name = ( char * ) data ; t -> handle = NULL ; t -> reassemble_mode = REASEMBLE_NEVER ; g_ptr_array_add ( build_dict . ett , ettp ) ; return a ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void set_offsets ( VP9_COMP * cpi , const TileInfo * const tile , int mi_row , int mi_col , BLOCK_SIZE bsize ) { MACROBLOCK * const x = & cpi -> mb ; VP9_COMMON * const cm = & cpi -> common ; MACROBLOCKD * const xd = & x -> e_mbd ; MB_MODE_INFO * mbmi ; const int mi_width = num_8x8_blocks_wide_lookup [ bsize ] ; const int mi_height = num_8x8_blocks_high_lookup [ bsize ] ; const struct segmentation * const seg = & cm -> seg ; set_skip_context ( xd , mi_row , mi_col ) ; set_modeinfo_offsets ( cm , xd , mi_row , mi_col ) ; mbmi = & xd -> mi [ 0 ] . src_mi -> mbmi ; vp9_setup_dst_planes ( xd -> plane , get_frame_new_buffer ( cm ) , mi_row , mi_col ) ; x -> mv_row_min = - ( ( ( mi_row + mi_height ) * MI_SIZE ) + VP9_INTERP_EXTEND ) ; x -> mv_col_min = - ( ( ( mi_col + mi_width ) * MI_SIZE ) + VP9_INTERP_EXTEND ) ; x -> mv_row_max = ( cm -> mi_rows - mi_row ) * MI_SIZE + VP9_INTERP_EXTEND ; x -> mv_col_max = ( cm -> mi_cols - mi_col ) * MI_SIZE + VP9_INTERP_EXTEND ; assert ( ! ( mi_col & ( mi_width - 1 ) ) && ! ( mi_row & ( mi_height - 1 ) ) ) ; set_mi_row_col ( xd , tile , mi_row , mi_height , mi_col , mi_width , cm -> mi_rows , cm -> mi_cols ) ; vp9_setup_src_planes ( x , cpi -> Source , mi_row , mi_col ) ; x -> rddiv = cpi -> rd . RDDIV ; x -> rdmult = cpi -> rd . RDMULT ; if ( seg -> enabled ) { if ( cpi -> oxcf . aq_mode != VARIANCE_AQ ) { const uint8_t * const map = seg -> update_map ? cpi -> segmentation_map : cm -> last_frame_seg_map ; mbmi -> segment_id = vp9_get_segment_id ( cm , map , bsize , mi_row , mi_col ) ; } vp9_init_plane_quantizers ( cpi , x ) ; x -> encode_breakout = cpi -> segment_encode_breakout [ mbmi -> segment_id ] ; } else { mbmi -> segment_id = 0 ; x -> encode_breakout = cpi -> encode_breakout ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_picture_header ( ProresContext * ctx , const uint8_t * buf , const int data_size , AVCodecContext * avctx ) { int i , hdr_size , pic_data_size , num_slices ; int slice_width_factor , slice_height_factor ; int remainder , num_x_slices ; const uint8_t * data_ptr , * index_ptr ; hdr_size = data_size > 0 ? buf [ 0 ] >> 3 : 0 ; if ( hdr_size < 8 || hdr_size > data_size ) { av_log ( avctx , AV_LOG_ERROR , "picture header too small\n" ) ; return AVERROR_INVALIDDATA ; } pic_data_size = AV_RB32 ( buf + 1 ) ; if ( pic_data_size > data_size ) { av_log ( avctx , AV_LOG_ERROR , "picture data too small\n" ) ; return AVERROR_INVALIDDATA ; } slice_width_factor = buf [ 7 ] >> 4 ; slice_height_factor = buf [ 7 ] & 0xF ; if ( slice_width_factor > 3 || slice_height_factor ) { av_log ( avctx , AV_LOG_ERROR , "unsupported slice dimension: %d x %d\n" , 1 << slice_width_factor , 1 << slice_height_factor ) ; return AVERROR_INVALIDDATA ; } ctx -> slice_width_factor = slice_width_factor ; ctx -> slice_height_factor = slice_height_factor ; ctx -> num_x_mbs = ( avctx -> width + 15 ) >> 4 ; ctx -> num_y_mbs = ( avctx -> height + ( 1 << ( 4 + ctx -> frame -> interlaced_frame ) ) - 1 ) >> ( 4 + ctx -> frame -> interlaced_frame ) ; remainder = ctx -> num_x_mbs & ( ( 1 << slice_width_factor ) - 1 ) ; num_x_slices = ( ctx -> num_x_mbs >> slice_width_factor ) + ( remainder & 1 ) + ( ( remainder >> 1 ) & 1 ) + ( ( remainder >> 2 ) & 1 ) ; num_slices = num_x_slices * ctx -> num_y_mbs ; if ( num_slices != AV_RB16 ( buf + 5 ) ) { av_log ( avctx , AV_LOG_ERROR , "invalid number of slices\n" ) ; return AVERROR_INVALIDDATA ; } if ( ctx -> total_slices != num_slices ) { av_freep ( & ctx -> slice_data ) ; ctx -> slice_data = av_malloc ( ( num_slices + 1 ) * sizeof ( ctx -> slice_data [ 0 ] ) ) ; if ( ! ctx -> slice_data ) return AVERROR ( ENOMEM ) ; ctx -> total_slices = num_slices ; } if ( hdr_size + num_slices * 2 > data_size ) { av_log ( avctx , AV_LOG_ERROR , "slice table too small\n" ) ; return AVERROR_INVALIDDATA ; } index_ptr = buf + hdr_size ; data_ptr = index_ptr + num_slices * 2 ; for ( i = 0 ; i < num_slices ; i ++ ) { ctx -> slice_data [ i ] . index = data_ptr ; ctx -> slice_data [ i ] . prev_slice_sf = 0 ; data_ptr += AV_RB16 ( index_ptr + i * 2 ) ; } ctx -> slice_data [ i ] . index = data_ptr ; ctx -> slice_data [ i ] . prev_slice_sf = 0 ; if ( data_ptr > buf + data_size ) { av_log ( avctx , AV_LOG_ERROR , "out of slice data\n" ) ; return - 1 ; } return pic_data_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void vga_draw_line15_le ( VGACommonState * vga , uint8_t * d , uint32_t addr , int width ) { int w ; uint32_t v , r , g , b ; w = width ; do { v = vga_read_word_le ( vga , addr ) ; r = ( v >> 7 ) & 0xf8 ; g = ( v >> 2 ) & 0xf8 ; b = ( v << 3 ) & 0xf8 ; ( ( uint32_t * ) d ) [ 0 ] = rgb_to_pixel32 ( r , g , b ) ; addr += 2 ; d += 4 ; } while ( -- w != 0 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( ExternalProtocolHandlerTest , TestGetBlockStateDefaultDontBlock ) { ExternalProtocolHandler : : BlockState block_state = ExternalProtocolHandler : : GetBlockState ( "mailto" , profile_ . get ( ) ) ; EXPECT_EQ ( ExternalProtocolHandler : : DONT_BLOCK , block_state ) ; EXPECT_TRUE ( local_state_ -> GetDictionary ( prefs : : kExcludedSchemes ) -> empty ( ) ) ; EXPECT_FALSE ( profile_ -> GetPrefs ( ) -> GetDictionary ( prefs : : kExcludedSchemes ) -> empty ( ) ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static cmsBool SynError ( cmsIT8 * it8 , const char * Txt , ... ) { char Buffer [ 256 ] , ErrMsg [ 1024 ] ; va_list args ; va_start ( args , Txt ) ; vsnprintf ( Buffer , 255 , Txt , args ) ; Buffer [ 255 ] = 0 ; va_end ( args ) ; snprintf ( ErrMsg , 1023 , "%s: Line %d, %s" , it8 -> FileStack [ it8 -> IncludeSP ] -> FileName , it8 -> lineno , Buffer ) ; ErrMsg [ 1023 ] = 0 ; it8 -> sy = SSYNERROR ; cmsSignalError ( it8 -> ContextID , cmsERROR_CORRUPTION_DETECTED , "%s" , ErrMsg ) ; return FALSE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int check_opcodes ( MMCO * mmco1 , MMCO * mmco2 , int n_mmcos ) { int i ; for ( i = 0 ; i < n_mmcos ; i ++ ) { if ( mmco1 [ i ] . opcode != mmco2 [ i ] . opcode ) return - 1 ; } return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static inline void pxa2xx_rtc_hz_tick ( void * opaque ) { PXA2xxRTCState * s = ( PXA2xxRTCState * ) opaque ; s -> rtsr |= ( 1 << 0 ) ; pxa2xx_rtc_alarm_update ( s , s -> rtsr ) ; pxa2xx_rtc_int_update ( s ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_cyclic_refresh_free ( CYCLIC_REFRESH * cr ) { vpx_free ( cr -> map ) ; vpx_free ( cr ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void rtp_dyn_payload_value_destroy ( gpointer data ) { encoding_name_and_rate_t * encoding_name_and_rate_pt = ( encoding_name_and_rate_t * ) data ; wmem_free ( wmem_file_scope ( ) , encoding_name_and_rate_pt -> encoding_name ) ; wmem_free ( wmem_file_scope ( ) , encoding_name_and_rate_pt ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void intra_pred_lp_left ( uint8_t * d , uint8_t * top , uint8_t * left , int stride ) { int x , y ; for ( y = 0 ; y < 8 ; y ++ ) for ( x = 0 ; x < 8 ; x ++ ) d [ y * stride + x ] = LOWPASS ( left , y + 1 ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gboolean logcat_text_long_dump_open ( wtap_dumper * wdh , int * err _U_ ) { struct dumper_t * dumper ; dumper = ( struct dumper_t * ) g_malloc ( sizeof ( struct dumper_t ) ) ; dumper -> type = DUMP_LONG ; wdh -> priv = dumper ; wdh -> subtype_write = logcat_dump_text ; wdh -> subtype_close = NULL ; return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Item * * find_field_in_group_list ( Item * find_item , ORDER * group_list ) { const char * db_name ; const char * table_name ; const char * field_name ; ORDER * found_group = NULL ; int found_match_degree = 0 ; char name_buff [ SAFE_NAME_LEN + 1 ] ; if ( find_item -> type ( ) == Item : : FIELD_ITEM || find_item -> type ( ) == Item : : REF_ITEM ) { db_name = ( ( Item_ident * ) find_item ) -> db_name ; table_name = ( ( Item_ident * ) find_item ) -> table_name ; field_name = ( ( Item_ident * ) find_item ) -> field_name ; } else return NULL ; if ( db_name && lower_case_table_names ) { strmake_buf ( name_buff , db_name ) ; my_casedn_str ( files_charset_info , name_buff ) ; db_name = name_buff ; } DBUG_ASSERT ( field_name != 0 ) ; for ( ORDER * cur_group = group_list ; cur_group ; cur_group = cur_group -> next ) { int cur_match_degree = 0 ; if ( ( * ( cur_group -> item ) ) -> name && ! table_name && ! ( * ( cur_group -> item ) ) -> is_autogenerated_name && ! my_strcasecmp ( system_charset_info , ( * ( cur_group -> item ) ) -> name , field_name ) ) { ++ cur_match_degree ; } else if ( ( * ( cur_group -> item ) ) -> type ( ) == Item : : FIELD_ITEM || ( * ( cur_group -> item ) ) -> type ( ) == Item : : REF_ITEM ) { Item_ident * cur_field = ( Item_ident * ) * cur_group -> item ; const char * l_db_name = cur_field -> db_name ; const char * l_table_name = cur_field -> table_name ; const char * l_field_name = cur_field -> field_name ; DBUG_ASSERT ( l_field_name != 0 ) ; if ( ! my_strcasecmp ( system_charset_info , l_field_name , field_name ) ) ++ cur_match_degree ; else continue ; if ( l_table_name && table_name ) { if ( my_strcasecmp ( table_alias_charset , l_table_name , table_name ) ) return NULL ; ++ cur_match_degree ; if ( l_db_name && db_name ) { if ( strcmp ( l_db_name , db_name ) ) return NULL ; ++ cur_match_degree ; } } } else continue ; if ( cur_match_degree > found_match_degree ) { found_match_degree = cur_match_degree ; found_group = cur_group ; } else if ( found_group && ( cur_match_degree == found_match_degree ) && ! ( * ( found_group -> item ) ) -> eq ( ( * ( cur_group -> item ) ) , 0 ) ) { my_error ( ER_NON_UNIQ_ERROR , MYF ( 0 ) , find_item -> full_name ( ) , current_thd -> where ) ; return NULL ; } } if ( found_group ) return found_group -> item ; else return NULL ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static my_bool grant_load_procs_priv ( TABLE * p_table ) { MEM_ROOT * memex_ptr ; my_bool return_val = 1 ; bool check_no_resolve = specialflag & SPECIAL_NO_RESOLVE ; MEM_ROOT * * save_mem_root_ptr = my_pthread_getspecific_ptr ( MEM_ROOT * * , THR_MALLOC ) ; DBUG_ENTER ( "grant_load_procs_priv" ) ; ( void ) hash_init ( & proc_priv_hash , & my_charset_utf8_bin , 0 , 0 , 0 , ( hash_get_key ) get_grant_table , 0 , 0 ) ; ( void ) hash_init ( & func_priv_hash , & my_charset_utf8_bin , 0 , 0 , 0 , ( hash_get_key ) get_grant_table , 0 , 0 ) ; p_table -> file -> ha_index_init ( 0 , 1 ) ; p_table -> use_all_columns ( ) ; if ( ! p_table -> file -> index_first ( p_table -> record [ 0 ] ) ) { memex_ptr = & memex ; my_pthread_setspecific_ptr ( THR_MALLOC , & memex_ptr ) ; do { GRANT_NAME * mem_check ; HASH * hash ; if ( ! ( mem_check = new ( memex_ptr ) GRANT_NAME ( p_table , TRUE ) ) ) { goto end_unlock ; } if ( check_no_resolve ) { if ( hostname_requires_resolving ( mem_check -> host . hostname ) ) { sql_print_warning ( "'procs_priv' entry '%s %s@%s' " "ignored in --skip-name-resolve mode." , mem_check -> tname , mem_check -> user , mem_check -> host . hostname ? mem_check -> host . hostname : "" ) ; continue ; } } if ( p_table -> field [ 4 ] -> val_int ( ) == TYPE_ENUM_PROCEDURE ) { hash = & proc_priv_hash ; } else if ( p_table -> field [ 4 ] -> val_int ( ) == TYPE_ENUM_FUNCTION ) { hash = & func_priv_hash ; } else { sql_print_warning ( "'procs_priv' entry '%s' " "ignored, bad routine type" , mem_check -> tname ) ; continue ; } mem_check -> privs = fix_rights_for_procedure ( mem_check -> privs ) ; if ( ! mem_check -> ok ( ) ) delete mem_check ; else if ( my_hash_insert ( hash , ( uchar * ) mem_check ) ) { delete mem_check ; goto end_unlock ; } } while ( ! p_table -> file -> index_next ( p_table -> record [ 0 ] ) ) ; } return_val = 0 ; end_unlock : p_table -> file -> ha_index_end ( ) ; my_pthread_setspecific_ptr ( THR_MALLOC , save_mem_root_ptr ) ; DBUG_RETURN ( return_val ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static cmsBool Type_UcrBg_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) { cmsUcrBg * Value = ( cmsUcrBg * ) Ptr ; cmsUInt32Number TextSize ; char * Text ; if ( ! _cmsWriteUInt32Number ( io , Value -> Ucr -> nEntries ) ) return FALSE ; if ( ! _cmsWriteUInt16Array ( io , Value -> Ucr -> nEntries , Value -> Ucr -> Table16 ) ) return FALSE ; if ( ! _cmsWriteUInt32Number ( io , Value -> Bg -> nEntries ) ) return FALSE ; if ( ! _cmsWriteUInt16Array ( io , Value -> Bg -> nEntries , Value -> Bg -> Table16 ) ) return FALSE ; TextSize = cmsMLUgetASCII ( Value -> Desc , cmsNoLanguage , cmsNoCountry , NULL , 0 ) ; Text = ( char * ) _cmsMalloc ( self -> ContextID , TextSize ) ; if ( cmsMLUgetASCII ( Value -> Desc , cmsNoLanguage , cmsNoCountry , Text , TextSize ) != TextSize ) return FALSE ; if ( ! io -> Write ( io , TextSize , Text ) ) return FALSE ; _cmsFree ( self -> ContextID , Text ) ; return TRUE ; cmsUNUSED_PARAMETER ( nItems ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static bool peek_ipv6 ( const char * str , size_t * skip ) { size_t i = 0 ; size_t colons = 0 ; if ( str [ i ++ ] != '[' ) { return FALSE ; } for ( ; ; ) { const char c = str [ i ++ ] ; if ( ISALNUM ( c ) || c == '.' || c == '%' ) { } else if ( c == ':' ) { colons ++ ; } else if ( c == ']' ) { * skip = i ; return colons >= 2 ? TRUE : FALSE ; } else { return FALSE ; } } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int opt_show_ ## section ( const char * opt , const char * arg ) { mark_section_show_entries ( SECTION_ID_ ## target_section_id , 1 , NULL ) ; return 0 ; } DEFINE_OPT_SHOW_SECTION ( chapters , CHAPTERS ) DEFINE_OPT_SHOW_SECTION ( error , ERROR ) DEFINE_OPT_SHOW_SECTION ( format , FORMAT ) DEFINE_OPT_SHOW_SECTION ( frames , FRAMES ) DEFINE_OPT_SHOW_SECTION ( library_versions , LIBRARY_VERSIONS ) DEFINE_OPT_SHOW_SECTION ( packets , PACKETS ) DEFINE_OPT_SHOW_SECTION ( pixel_formats , PIXEL_FORMATS ) DEFINE_OPT_SHOW_SECTION ( program_version , PROGRAM_VERSION ) DEFINE_OPT_SHOW_SECTION ( streams , STREAMS ) DEFINE_OPT_SHOW_SECTION ( programs , PROGRAMS )
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST_F ( NativeBackendLibsecretTest , RemoveLoginActionMismatch ) { NativeBackendLibsecret backend ( 42 ) ; VerifiedAdd ( & backend , form_google_ ) ; EXPECT_EQ ( 1u , global_mock_libsecret_items -> size ( ) ) ; if ( ! global_mock_libsecret_items -> empty ( ) ) CheckMockSecretItem ( ( * global_mock_libsecret_items ) [ 0 ] , form_google_ , "chrome-42" ) ; form_google_ . action = GURL ( "https://some.other.url.com/path" ) ; VerifiedRemove ( & backend , form_google_ ) ; EXPECT_TRUE ( global_mock_libsecret_items -> empty ( ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_EndSessionCommand ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_EndSessionCommand , EndSessionCommand_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void handle_ppp ( netdissect_options * ndo , u_int proto , const u_char * p , int length ) { if ( ( proto & 0xff00 ) == 0x7e00 ) { ppp_hdlc ( ndo , p - 1 , length ) ; return ; } switch ( proto ) { case PPP_LCP : case PPP_IPCP : case PPP_OSICP : case PPP_MPLSCP : case PPP_IPV6CP : case PPP_CCP : case PPP_BACP : handle_ctrl_proto ( ndo , proto , p , length ) ; break ; case PPP_ML : handle_mlppp ( ndo , p , length ) ; break ; case PPP_CHAP : handle_chap ( ndo , p , length ) ; break ; case PPP_PAP : handle_pap ( ndo , p , length ) ; break ; case PPP_BAP : handle_bap ( ndo , p , length ) ; break ; case ETHERTYPE_IP : case PPP_VJNC : case PPP_IP : ip_print ( ndo , p , length ) ; break ; case ETHERTYPE_IPV6 : case PPP_IPV6 : ip6_print ( ndo , p , length ) ; break ; case ETHERTYPE_IPX : case PPP_IPX : ipx_print ( ndo , p , length ) ; break ; case PPP_OSI : isoclns_print ( ndo , p , length , length ) ; break ; case PPP_MPLS_UCAST : case PPP_MPLS_MCAST : mpls_print ( ndo , p , length ) ; break ; case PPP_COMP : ND_PRINT ( ( ndo , "compressed PPP data" ) ) ; break ; default : ND_PRINT ( ( ndo , "%s " , tok2str ( ppptype2str , "unknown PPP protocol (0x%04x)" , proto ) ) ) ; print_unknown_data ( ndo , p , "\n\t" , length ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void dissect_mcast_byte ( proto_tree * tree , tvbuff_t * tvb , int offset , packet_info * pinfo _U_ ) { proto_item * mcast_item ; proto_tree * mcast_tree ; # if 0 guint8 mcast_byte ; mcast_byte = tvb_get_guint8 ( tvb , offset ) ; # endif mcast_item = proto_tree_add_item ( tree , hf_cipsafety_mcast_byte , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ; mcast_tree = proto_item_add_subtree ( mcast_item , ett_cipsafety_mcast_byte ) ; proto_tree_add_item ( mcast_tree , hf_cipsafety_mcast_byte_consumer_num , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ; proto_tree_add_item ( mcast_tree , hf_cipsafety_mcast_byte_reserved1 , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ; proto_tree_add_item ( mcast_tree , hf_cipsafety_mcast_byte_mai , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ; proto_tree_add_item ( mcast_tree , hf_cipsafety_mcast_byte_reserved2 , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ; proto_tree_add_item ( mcast_tree , hf_cipsafety_mcast_byte_parity_even , tvb , offset , 1 , ENC_LITTLE_ENDIAN ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static debugCBContext * debugCB_clone ( debugCBContext * ctx ) { debugCBContext * newCtx ; newCtx = malloc ( sizeof ( debugCBContext ) ) ; newCtx -> serial = debugCB_nextSerial ( ) ; newCtx -> magic = 0xC0FFEE ; newCtx -> subCallback = ctx -> subCallback ; newCtx -> subContext = ctx -> subContext ; # if DEBUG_TMI printf ( "debugCB_clone: %p:%d -> new context %p:%d\n" , ctx , ctx -> serial , newCtx , newCtx -> serial ) ; # endif return newCtx ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
SPL_METHOD ( FilesystemIterator , current ) { spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ; if ( zend_parse_parameters_none ( ) == FAILURE ) { return ; } if ( SPL_FILE_DIR_CURRENT ( intern , SPL_FILE_DIR_CURRENT_AS_PATHNAME ) ) { spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ; RETURN_STRINGL ( intern -> file_name , intern -> file_name_len , 1 ) ; } else if ( SPL_FILE_DIR_CURRENT ( intern , SPL_FILE_DIR_CURRENT_AS_FILEINFO ) ) { spl_filesystem_object_get_file_name ( intern TSRMLS_CC ) ; spl_filesystem_object_create_type ( 0 , intern , SPL_FS_INFO , NULL , return_value TSRMLS_CC ) ; } else { RETURN_ZVAL ( getThis ( ) , 1 , 0 ) ; } }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void cmd_server_add ( const char * data ) { cmd_server_add_modify ( data , TRUE ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void initial_reordering_symbol_cluster ( const hb_ot_shape_plan_t * plan HB_UNUSED , hb_face_t * face HB_UNUSED , hb_buffer_t * buffer HB_UNUSED , unsigned int start HB_UNUSED , unsigned int end HB_UNUSED ) { }
1True
Categorize the following code snippet as vulnerable or not. True or False
static int search_try_next ( struct request * const req ) { if ( req -> search_state ) { char * new_name ; struct request * newreq ; req -> search_index ++ ; if ( req -> search_index >= req -> search_state -> num_domains ) { if ( string_num_dots ( req -> search_origname ) < req -> search_state -> ndots ) { newreq = request_new ( req -> request_type , req -> search_origname , req -> search_flags , req -> user_callback , req -> user_pointer ) ; log ( EVDNS_LOG_DEBUG , "Search: trying raw query %s" , req -> search_origname ) ; if ( newreq ) { request_submit ( newreq ) ; return 0 ; } } return 1 ; } new_name = search_make_new ( req -> search_state , req -> search_index , req -> search_origname ) ; if ( ! new_name ) return 1 ; log ( EVDNS_LOG_DEBUG , "Search: now trying %s (%d)" , new_name , req -> search_index ) ; newreq = request_new ( req -> request_type , new_name , req -> search_flags , req -> user_callback , req -> user_pointer ) ; free ( new_name ) ; if ( ! newreq ) return 1 ; newreq -> search_origname = req -> search_origname ; req -> search_origname = NULL ; newreq -> search_state = req -> search_state ; newreq -> search_flags = req -> search_flags ; newreq -> search_index = req -> search_index ; newreq -> search_state -> refcount ++ ; request_submit ( newreq ) ; return 0 ; } return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int ipvideo_decode_block_opcode_0x6_16 ( IpvideoContext * s , AVFrame * frame ) { signed char x , y ; x = bytestream2_get_byte ( & s -> stream_ptr ) ; y = bytestream2_get_byte ( & s -> stream_ptr ) ; av_dlog ( NULL , " motion bytes = %d, %d\n" , x , y ) ; return copy_from ( s , s -> second_last_frame , frame , x , y ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_long_data_bin ( ) { MYSQL_STMT * stmt ; int rc ; char data [ 255 ] ; long length ; MYSQL_RES * result ; MYSQL_BIND my_bind [ 2 ] ; char query [ MAX_TEST_QUERY_LENGTH ] ; myheader ( "test_long_data_bin" ) ; rc = mysql_autocommit ( mysql , TRUE ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_long_data_bin" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "CREATE TABLE test_long_data_bin(id int, longbin long varbinary)" ) ; myquery ( rc ) ; strmov ( query , "INSERT INTO test_long_data_bin VALUES(?, ?)" ) ; stmt = mysql_simple_prepare ( mysql , query ) ; check_stmt ( stmt ) ; verify_param_count ( stmt , 2 ) ; memset ( my_bind , 0 , sizeof ( my_bind ) ) ; my_bind [ 0 ] . buffer = ( void * ) & length ; my_bind [ 0 ] . buffer_type = MYSQL_TYPE_LONG ; length = 0 ; my_bind [ 1 ] . buffer = data ; my_bind [ 1 ] . buffer_type = MYSQL_TYPE_LONG_BLOB ; rc = mysql_stmt_bind_param ( stmt , my_bind ) ; check_execute ( stmt , rc ) ; length = 10 ; strmov ( data , "MySQL AB" ) ; { int i ; for ( i = 0 ; i < 100 ; i ++ ) { rc = mysql_stmt_send_long_data ( stmt , 1 , ( char * ) data , 4 ) ; check_execute ( stmt , rc ) ; } } rc = mysql_stmt_execute ( stmt ) ; if ( ! opt_silent ) fprintf ( stdout , " mysql_stmt_execute() returned %d\n" , rc ) ; check_execute ( stmt , rc ) ; mysql_stmt_close ( stmt ) ; rc = mysql_commit ( mysql ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "SELECT LENGTH(longbin), longbin FROM test_long_data_bin" ) ; myquery ( rc ) ; result = mysql_store_result ( mysql ) ; mytest ( result ) ; rc = my_process_result_set ( result ) ; DIE_UNLESS ( rc == 1 ) ; mysql_free_result ( result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void test_bug27876 ( ) { int rc ; MYSQL_RES * result ; uchar utf8_func [ ] = { 0xd1 , 0x84 , 0xd1 , 0x83 , 0xd0 , 0xbd , 0xd0 , 0xba , 0xd1 , 0x86 , 0xd0 , 0xb8 , 0xd0 , 0xb9 , 0xd0 , 0xba , 0xd0 , 0xb0 , 0x00 } ; uchar utf8_param [ ] = { 0xd0 , 0xbf , 0xd0 , 0xb0 , 0xd1 , 0x80 , 0xd0 , 0xb0 , 0xd0 , 0xbc , 0xd0 , 0xb5 , 0xd1 , 0x82 , 0xd1 , 0x8a , 0xd1 , 0x80 , 0x5f , 0xd0 , 0xb2 , 0xd0 , 0xb5 , 0xd1 , 0x80 , 0xd1 , 0x81 , 0xd0 , 0xb8 , 0xd1 , 0x8f , 0x00 } ; char query [ 500 ] ; DBUG_ENTER ( "test_bug27876" ) ; myheader ( "test_bug27876" ) ; rc = mysql_query ( mysql , "set names utf8" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "select version()" ) ; myquery ( rc ) ; result = mysql_store_result ( mysql ) ; mytest ( result ) ; mysql_free_result ( result ) ; sprintf ( query , "DROP FUNCTION IF EXISTS %s" , ( char * ) utf8_func ) ; rc = mysql_query ( mysql , query ) ; myquery ( rc ) ; sprintf ( query , "CREATE FUNCTION %s( %s VARCHAR(25))" " RETURNS VARCHAR(25) DETERMINISTIC RETURN %s" , ( char * ) utf8_func , ( char * ) utf8_param , ( char * ) utf8_param ) ; rc = mysql_query ( mysql , query ) ; myquery ( rc ) ; sprintf ( query , "SELECT %s(VERSION())" , ( char * ) utf8_func ) ; rc = mysql_query ( mysql , query ) ; myquery ( rc ) ; result = mysql_store_result ( mysql ) ; mytest ( result ) ; mysql_free_result ( result ) ; sprintf ( query , "DROP FUNCTION %s" , ( char * ) utf8_func ) ; rc = mysql_query ( mysql , query ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "set names default" ) ; myquery ( rc ) ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
GType hb_gobject_ ## name ## _get_type ( void ) \ { static gsize type_id = 0 ; if ( g_once_init_enter ( & type_id ) ) { GType id = g_boxed_type_register_static ( g_intern_static_string ( "hb_" # name "_t" ) , ( GBoxedCopyFunc ) copy_func , ( GBoxedFreeFunc ) free_func ) ; g_once_init_leave ( & type_id , id ) ; } return type_id ; \ } # define HB_DEFINE_OBJECT_TYPE ( name ) HB_DEFINE_BOXED_TYPE ( name , hb_ ## name ## _reference , hb_ ## name ## _destroy ) ; HB_DEFINE_OBJECT_TYPE ( buffer ) HB_DEFINE_OBJECT_TYPE ( blob ) HB_DEFINE_OBJECT_TYPE ( face ) HB_DEFINE_OBJECT_TYPE ( font ) HB_DEFINE_OBJECT_TYPE ( font_funcs )
1True
Categorize the following code snippet as vulnerable or not. True or False
static void tokenize_init_one ( TOKENVALUE * t , const vp9_extra_bit * const e , int16_t * value_cost , int max_value ) { int i = - max_value ; int sign = 1 ; do { if ( ! i ) sign = 0 ; { const int a = sign ? - i : i ; int eb = sign ; if ( a > 4 ) { int j = 4 ; while ( ++ j < 11 && e [ j ] . base_val <= a ) { } t [ i ] . token = -- j ; eb |= ( a - e [ j ] . base_val ) << 1 ; } else { t [ i ] . token = a ; } t [ i ] . extra = eb ; } { int cost = 0 ; const vp9_extra_bit * p = & e [ t [ i ] . token ] ; if ( p -> base_val ) { const int extra = t [ i ] . extra ; const int length = p -> len ; if ( length ) cost += treed_cost ( p -> tree , p -> prob , extra >> 1 , length ) ; cost += vp9_cost_bit ( vp9_prob_half , extra & 1 ) ; value_cost [ i ] = cost ; } } } while ( ++ i < max_value ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
TEST ( DownloadPrefsTest , AutoOpenForSafeFiles ) { const base : : FilePath kSafeFilePath ( FILE_PATH_LITERAL ( "/goodothing-wrong.txt" ) ) ; const base : : FilePath kAnotherSafeFilePath ( FILE_PATH_LITERAL ( "/okot-bad.txt" ) ) ; content : : TestBrowserThreadBundle threads_are_required_for_testing_profile ; TestingProfile profile ; DownloadPrefs prefs ( & profile ) ; EXPECT_TRUE ( prefs . EnableAutoOpenBasedOnExtension ( kSafeFilePath ) ) ; EXPECT_TRUE ( prefs . IsAutoOpenEnabledBasedOnExtension ( kSafeFilePath ) ) ; EXPECT_TRUE ( prefs . IsAutoOpenEnabledBasedOnExtension ( kAnotherSafeFilePath ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void basic_avp_reginfo ( diam_avp_t * a , const char * name , enum ftenum ft , field_display_e base , value_string_ext * vs_ext ) { hf_register_info hf ; gint * ettp = & ( a -> ett ) ; hf . p_id = & ( a -> hf_value ) ; hf . hfinfo . name = NULL ; hf . hfinfo . abbrev = NULL ; hf . hfinfo . type = ft ; hf . hfinfo . display = base ; hf . hfinfo . strings = NULL ; hf . hfinfo . bitmask = 0x0 ; hf . hfinfo . blurb = a -> vendor -> code ? wmem_strdup_printf ( wmem_epan_scope ( ) , "vendor=%d code=%d" , a -> vendor -> code , a -> code ) : wmem_strdup_printf ( wmem_epan_scope ( ) , "code=%d" , a -> code ) ; HFILL_INIT ( hf ) ; hf . hfinfo . name = wmem_strdup_printf ( wmem_epan_scope ( ) , "%s" , name ) ; hf . hfinfo . abbrev = alnumerize ( wmem_strdup_printf ( wmem_epan_scope ( ) , "diameter.%s" , name ) ) ; if ( vs_ext ) { hf . hfinfo . strings = vs_ext ; } wmem_array_append ( build_dict . hf , & hf , 1 ) ; g_ptr_array_add ( build_dict . ett , ettp ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void exsltCommonRegister ( void ) { xsltRegisterExtModuleFunction ( ( const xmlChar * ) "node-set" , EXSLT_COMMON_NAMESPACE , exsltNodeSetFunction ) ; xsltRegisterExtModuleFunction ( ( const xmlChar * ) "object-type" , EXSLT_COMMON_NAMESPACE , exsltObjectTypeFunction ) ; xsltRegisterExtModuleElement ( ( const xmlChar * ) "document" , EXSLT_COMMON_NAMESPACE , ( xsltPreComputeFunction ) xsltDocumentComp , ( xsltTransformFunction ) xsltDocumentElem ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void thumbnail_done ( NautilusDirectory * directory , NautilusFile * file , GdkPixbuf * pixbuf , gboolean tried_original ) { const char * thumb_mtime_str ; time_t thumb_mtime = 0 ; file -> details -> thumbnail_is_up_to_date = TRUE ; file -> details -> thumbnail_tried_original = tried_original ; if ( file -> details -> thumbnail ) { g_object_unref ( file -> details -> thumbnail ) ; file -> details -> thumbnail = NULL ; } if ( file -> details -> scaled_thumbnail ) { g_object_unref ( file -> details -> scaled_thumbnail ) ; file -> details -> scaled_thumbnail = NULL ; } if ( pixbuf ) { if ( tried_original ) { thumb_mtime = file -> details -> mtime ; } else { thumb_mtime_str = gdk_pixbuf_get_option ( pixbuf , "tEXt::Thumb::MTime" ) ; if ( thumb_mtime_str ) { thumb_mtime = atol ( thumb_mtime_str ) ; } } if ( thumb_mtime == 0 || thumb_mtime == file -> details -> mtime ) { file -> details -> thumbnail = g_object_ref ( pixbuf ) ; file -> details -> thumbnail_mtime = thumb_mtime ; } else { g_free ( file -> details -> thumbnail_path ) ; file -> details -> thumbnail_path = NULL ; } } nautilus_directory_async_state_changed ( directory ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_Ind_aal5 ( 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_Ind_aal5 , Ind_aal5_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static const char * hf_try_val_to_str_const ( guint32 value , const header_field_info * hfinfo , const char * unknown_str ) { const char * str = hf_try_val_to_str ( value , hfinfo ) ; return ( str ) ? str : unknown_str ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
vpx_codec_err_t vpx_svc_set_quantizers ( SvcContext * svc_ctx , const char * quantizers ) { SvcInternal * const si = get_svc_internal ( svc_ctx ) ; if ( svc_ctx == NULL || quantizers == NULL || si == NULL ) { return VPX_CODEC_INVALID_PARAM ; } strncpy ( si -> quantizers , quantizers , sizeof ( si -> quantizers ) ) ; si -> quantizers [ sizeof ( si -> quantizers ) - 1 ] = '\0' ; return VPX_CODEC_OK ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static double calc_frame_boost ( const TWO_PASS * twopass , const FIRSTPASS_STATS * this_frame , double this_frame_mv_in_out ) { double frame_boost ; if ( this_frame -> intra_error > twopass -> gf_intra_err_min ) frame_boost = ( IIFACTOR * this_frame -> intra_error / DOUBLE_DIVIDE_CHECK ( this_frame -> coded_error ) ) ; else frame_boost = ( IIFACTOR * twopass -> gf_intra_err_min / DOUBLE_DIVIDE_CHECK ( this_frame -> coded_error ) ) ; if ( this_frame_mv_in_out > 0.0 ) frame_boost += frame_boost * ( this_frame_mv_in_out * 2.0 ) ; else frame_boost += frame_boost * ( this_frame_mv_in_out / 2.0 ) ; return MIN ( frame_boost , GF_RMAX ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void compress_job_on_error ( AutoarCompressor * compressor , GError * error , gpointer user_data ) { CompressJob * compress_job = user_data ; char * status ; if ( compress_job -> total_files == 1 ) { status = f ( _ ( "Error compressing “%B” into “%B”" ) , G_FILE ( compress_job -> source_files -> data ) , compress_job -> output_file ) ; } else { status = f ( ngettext ( "Error compressing %'d file into “%B”" , "Error compressing %'d files into “%B”" , compress_job -> total_files ) , compress_job -> total_files , compress_job -> output_file ) ; } nautilus_progress_info_take_status ( compress_job -> common . progress , status ) ; run_error ( ( CommonJob * ) compress_job , g_strdup ( _ ( "There was an error while compressing files." ) ) , g_strdup ( error -> message ) , NULL , FALSE , CANCEL , NULL ) ; abort_job ( ( CommonJob * ) compress_job ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
char * hb_blob_get_data_writable ( hb_blob_t * blob , unsigned int * length ) { if ( ! _try_writable ( blob ) ) { if ( length ) * length = 0 ; return NULL ; } if ( length ) * length = blob -> length ; return const_cast < char * > ( blob -> data ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static PyObject * authGSSClientUnwrap ( PyObject * self , PyObject * args ) { gss_client_state * state ; PyObject * pystate ; char * challenge = NULL ; int result = 0 ; if ( ! PyArg_ParseTuple ( args , "Os" , & pystate , & challenge ) ) return NULL ; # if PY_MAJOR_VERSION >= 3 if ( ! PyCapsule_CheckExact ( pystate ) ) { # else if ( ! PyCObject_Check ( pystate ) ) { # endif PyErr_SetString ( PyExc_TypeError , "Expected a context object" ) ; return NULL ; } # if PY_MAJOR_VERSION >= 3 state = PyCapsule_GetPointer ( pystate , NULL ) ; # else state = ( gss_client_state * ) PyCObject_AsVoidPtr ( pystate ) ; # endif if ( state == NULL ) return NULL ; result = authenticate_gss_client_unwrap ( state , challenge ) ; if ( result == AUTH_GSS_ERROR ) return NULL ; return Py_BuildValue ( "i" , result ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int qemuMonitorTextParseBlockIoThrottle ( const char * result , const char * device , virDomainBlockIoTuneInfoPtr reply ) { char * dummy = NULL ; int ret = - 1 ; const char * p , * eol ; int devnamelen = strlen ( device ) ; p = result ; while ( * p ) { if ( STRPREFIX ( p , QEMU_DRIVE_HOST_PREFIX ) ) p += strlen ( QEMU_DRIVE_HOST_PREFIX ) ; if ( STREQLEN ( p , device , devnamelen ) && p [ devnamelen ] == ':' && p [ devnamelen + 1 ] == ' ' ) { eol = strchr ( p , '\n' ) ; if ( ! eol ) eol = p + strlen ( p ) ; p += devnamelen + 2 ; while ( * p ) { if ( STRPREFIX ( p , "bps=" ) ) { p += strlen ( "bps=" ) ; if ( virStrToLong_ull ( p , & dummy , 10 , & reply -> total_bytes_sec ) == - 1 ) VIR_DEBUG ( "error reading total_bytes_sec: %s" , p ) ; } else if ( STRPREFIX ( p , "bps_rd=" ) ) { p += strlen ( "bps_rd=" ) ; if ( virStrToLong_ull ( p , & dummy , 10 , & reply -> read_bytes_sec ) == - 1 ) VIR_DEBUG ( "error reading read_bytes_sec: %s" , p ) ; } else if ( STRPREFIX ( p , "bps_wr=" ) ) { p += strlen ( "bps_wr=" ) ; if ( virStrToLong_ull ( p , & dummy , 10 , & reply -> write_bytes_sec ) == - 1 ) VIR_DEBUG ( "error reading write_bytes_sec: %s" , p ) ; } else if ( STRPREFIX ( p , "iops=" ) ) { p += strlen ( "iops=" ) ; if ( virStrToLong_ull ( p , & dummy , 10 , & reply -> total_iops_sec ) == - 1 ) VIR_DEBUG ( "error reading total_iops_sec: %s" , p ) ; } else if ( STRPREFIX ( p , "iops_rd=" ) ) { p += strlen ( "iops_rd=" ) ; if ( virStrToLong_ull ( p , & dummy , 10 , & reply -> read_iops_sec ) == - 1 ) VIR_DEBUG ( "error reading read_iops_sec: %s" , p ) ; } else if ( STRPREFIX ( p , "iops_wr=" ) ) { p += strlen ( "iops_wr=" ) ; if ( virStrToLong_ull ( p , & dummy , 10 , & reply -> write_iops_sec ) == - 1 ) VIR_DEBUG ( "error reading write_iops_sec: %s" , p ) ; } else { VIR_DEBUG ( " unknown block info %s" , p ) ; } p = strchr ( p , ' ' ) ; if ( ! p || p >= eol ) break ; p ++ ; } ret = 0 ; goto cleanup ; } p = strchr ( p , '\n' ) ; if ( ! p ) break ; p ++ ; } qemuReportError ( VIR_ERR_INVALID_ARG , _ ( "No info for device '%s'" ) , device ) ; cleanup : return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint16 de_bcc_call_state ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len _U_ , gchar * add_string _U_ , int string_len _U_ ) { proto_tree_add_item ( tree , hf_gsm_a_dtap_bcc_call_state , tvb , offset , 2 , ENC_NA ) ; return 1 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_T_h223MultiplexTableCapability ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_h223MultiplexTableCapability , T_h223MultiplexTableCapability_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void rv34_decoder_free ( RV34DecContext * r ) { av_freep ( & r -> intra_types_hist ) ; r -> intra_types = NULL ; av_freep ( & r -> tmp_b_block_base ) ; av_freep ( & r -> mb_type ) ; av_freep ( & r -> cbp_luma ) ; av_freep ( & r -> cbp_chroma ) ; av_freep ( & r -> deblock_coefs ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int get_str_sep ( char * buf , int buf_size , const char * * pp , int sep ) { const char * p , * p1 ; int len ; p = * pp ; p1 = strchr ( p , sep ) ; if ( ! p1 ) return - 1 ; len = p1 - p ; p1 ++ ; if ( buf_size > 0 ) { if ( len > buf_size - 1 ) len = buf_size - 1 ; memcpy ( buf , p , len ) ; buf [ len ] = '\0' ; } * pp = p1 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int change_frame_graph ( voip_calls_tapinfo_t * tapinfo _U_ , guint32 frame_num , const gchar * new_frame_label , const gchar * new_comment ) { seq_analysis_item_t * gai = NULL ; gchar * frame_label = NULL ; gchar * comment = NULL ; if ( NULL != tapinfo -> graph_analysis -> ht ) gai = ( seq_analysis_item_t * ) g_hash_table_lookup ( tapinfo -> graph_analysis -> ht , & frame_num ) ; if ( gai ) { frame_label = gai -> frame_label ; comment = gai -> comment ; if ( new_frame_label != NULL ) { gai -> frame_label = g_strdup ( new_frame_label ) ; g_free ( frame_label ) ; } if ( new_comment != NULL ) { gai -> comment = g_strdup ( new_comment ) ; g_free ( comment ) ; } } return gai ? 1 : 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Datum ExecEvalParamExtern ( ExprState * exprstate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { Param * expression = ( Param * ) exprstate -> expr ; int thisParamId = expression -> paramid ; ParamListInfo paramInfo = econtext -> ecxt_param_list_info ; if ( isDone ) * isDone = ExprSingleResult ; if ( paramInfo && thisParamId > 0 && thisParamId <= paramInfo -> numParams ) { ParamExternData * prm = & paramInfo -> params [ thisParamId - 1 ] ; if ( ! OidIsValid ( prm -> ptype ) && paramInfo -> paramFetch != NULL ) ( * paramInfo -> paramFetch ) ( paramInfo , thisParamId ) ; if ( OidIsValid ( prm -> ptype ) ) { if ( prm -> ptype != expression -> paramtype ) ereport ( ERROR , ( errcode ( ERRCODE_DATATYPE_MISMATCH ) , errmsg ( "type of parameter %d (%s) does not match that when preparing the plan (%s)" , thisParamId , format_type_be ( prm -> ptype ) , format_type_be ( expression -> paramtype ) ) ) ) ; * isNull = prm -> isnull ; return prm -> value ; } } ereport ( ERROR , ( errcode ( ERRCODE_UNDEFINED_OBJECT ) , errmsg ( "no value found for parameter %d" , thisParamId ) ) ) ; return ( Datum ) 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void show_error ( WriterContext * w , int err ) { char errbuf [ 128 ] ; const char * errbuf_ptr = errbuf ; if ( av_strerror ( err , errbuf , sizeof ( errbuf ) ) < 0 ) errbuf_ptr = strerror ( AVUNERROR ( err ) ) ; writer_print_section_header ( w , SECTION_ID_ERROR ) ; print_int ( "code" , err ) ; print_str ( "string" , errbuf_ptr ) ; writer_print_section_footer ( w ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void report_usage ( FILE * out , int count , size_t bytes , backtrace_t * bt , bool detailed ) { fprintf ( out , "%zu bytes total, %d allocations, %zu bytes average:\n" , bytes , count , bytes / count ) ; bt -> log ( bt , out , detailed ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static guint32 amf_get_u29 ( tvbuff_t * tvb , int offset , guint * lenp ) { guint len = 0 ; guint8 iByte ; guint32 iValue ; iByte = tvb_get_guint8 ( tvb , offset ) ; iValue = ( iByte & 0x7F ) ; offset ++ ; len ++ ; if ( ! ( iByte & 0x80 ) ) { * lenp = len ; return iValue ; } iByte = tvb_get_guint8 ( tvb , offset ) ; iValue = ( iValue << 7 ) | ( iByte & 0x7F ) ; offset ++ ; len ++ ; if ( ! ( iByte & 0x80 ) ) { * lenp = len ; return iValue ; } iByte = tvb_get_guint8 ( tvb , offset ) ; iValue = ( iValue << 7 ) | ( iByte & 0x7F ) ; offset ++ ; len ++ ; if ( ! ( iByte & 0x80 ) ) { * lenp = len ; return iValue ; } iByte = tvb_get_guint8 ( tvb , offset ) ; iValue = ( iValue << 8 ) | iByte ; len ++ ; * lenp = len ; return iValue ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static VALUE decode_null ( unsigned char * der , long length ) { ASN1_NULL * null ; const unsigned char * p ; p = der ; if ( ! ( null = d2i_ASN1_NULL ( NULL , & p , length ) ) ) ossl_raise ( eASN1Error , NULL ) ; ASN1_NULL_free ( null ) ; return Qnil ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuAssignDeviceRNGAlias ( virDomainDefPtr def , virDomainRNGDefPtr rng ) { size_t i ; int maxidx = 0 ; int idx ; for ( i = 0 ; i < def -> nrngs ; i ++ ) { if ( ( idx = qemuDomainDeviceAliasIndex ( & def -> rngs [ i ] -> info , "rng" ) ) >= maxidx ) maxidx = idx + 1 ; } if ( virAsprintf ( & rng -> info . alias , "rng%d" , maxidx ) < 0 ) return - 1 ; return 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void unlink_thd ( THD * thd ) { DBUG_ENTER ( "unlink_thd" ) ; DBUG_PRINT ( "enter" , ( "thd: 0x%lx" , ( long ) thd ) ) ; thd_cleanup ( thd ) ; dec_connection_count ( thd ) ; thd -> add_status_to_global ( ) ; mysql_mutex_lock ( & LOCK_thread_count ) ; thd -> unlink ( ) ; DBUG_EXECUTE_IF ( "sleep_after_lock_thread_count_before_delete_thd" , sleep ( 5 ) ; ) ; if ( unlikely ( abort_loop ) ) { delete thd ; thd = 0 ; } thread_count -- ; mysql_mutex_unlock ( & LOCK_thread_count ) ; delete thd ; DBUG_VOID_RETURN ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static gboolean prplcb_ev_remove ( guint id ) { b_event_remove ( ( gint ) id ) ; return TRUE ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_MultiplePayloadStream ( 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_MultiplePayloadStream , MultiplePayloadStream_sequence ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int TSHttpTxnIsCacheable ( TSHttpTxn txnp , TSMBuffer request , TSMBuffer response ) { sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ; HttpSM * sm = ( HttpSM * ) txnp ; HTTPHdr * req , * resp ; if ( request ) { sdk_assert ( sdk_sanity_check_mbuffer ( request ) == TS_SUCCESS ) ; req = reinterpret_cast < HTTPHdr * > ( request ) ; } else { req = & ( sm -> t_state . hdr_info . client_request ) ; } if ( response ) { sdk_assert ( sdk_sanity_check_mbuffer ( response ) == TS_SUCCESS ) ; resp = reinterpret_cast < HTTPHdr * > ( response ) ; } else { resp = & ( sm -> t_state . hdr_info . server_response ) ; } return ( req -> valid ( ) && resp -> valid ( ) && HttpTransact : : is_response_cacheable ( & ( sm -> t_state ) , req , resp ) ) ? 1 : 0 ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
void vp9_init_plane_quantizers ( VP9_COMP * cpi , MACROBLOCK * x ) { const VP9_COMMON * const cm = & cpi -> common ; MACROBLOCKD * const xd = & x -> e_mbd ; QUANTS * const quants = & cpi -> quants ; const int segment_id = xd -> mi [ 0 ] -> mbmi . segment_id ; const int qindex = vp9_get_qindex ( & cm -> seg , segment_id , cm -> base_qindex ) ; const int rdmult = vp9_compute_rd_mult ( cpi , qindex + cm -> y_dc_delta_q ) ; const int zbin = cpi -> zbin_mode_boost ; int i ; x -> plane [ 0 ] . quant = quants -> y_quant [ qindex ] ; x -> plane [ 0 ] . quant_fp = quants -> y_quant_fp [ qindex ] ; x -> plane [ 0 ] . round_fp = quants -> y_round_fp [ qindex ] ; x -> plane [ 0 ] . quant_shift = quants -> y_quant_shift [ qindex ] ; x -> plane [ 0 ] . zbin = quants -> y_zbin [ qindex ] ; x -> plane [ 0 ] . round = quants -> y_round [ qindex ] ; x -> plane [ 0 ] . quant_thred [ 0 ] = cm -> y_dequant [ qindex ] [ 0 ] * cm -> y_dequant [ qindex ] [ 0 ] ; x -> plane [ 0 ] . quant_thred [ 1 ] = cm -> y_dequant [ qindex ] [ 1 ] * cm -> y_dequant [ qindex ] [ 1 ] ; x -> plane [ 0 ] . zbin_extra = ( int16_t ) ( ( cm -> y_dequant [ qindex ] [ 1 ] * zbin ) >> 7 ) ; xd -> plane [ 0 ] . dequant = cm -> y_dequant [ qindex ] ; for ( i = 1 ; i < 3 ; i ++ ) { x -> plane [ i ] . quant = quants -> uv_quant [ qindex ] ; x -> plane [ i ] . quant_fp = quants -> uv_quant_fp [ qindex ] ; x -> plane [ i ] . round_fp = quants -> uv_round_fp [ qindex ] ; x -> plane [ i ] . quant_shift = quants -> uv_quant_shift [ qindex ] ; x -> plane [ i ] . zbin = quants -> uv_zbin [ qindex ] ; x -> plane [ i ] . round = quants -> uv_round [ qindex ] ; x -> plane [ i ] . quant_thred [ 0 ] = cm -> y_dequant [ qindex ] [ 0 ] * cm -> y_dequant [ qindex ] [ 0 ] ; x -> plane [ i ] . quant_thred [ 1 ] = cm -> y_dequant [ qindex ] [ 1 ] * cm -> y_dequant [ qindex ] [ 1 ] ; x -> plane [ i ] . zbin_extra = ( int16_t ) ( ( cm -> uv_dequant [ qindex ] [ 1 ] * zbin ) >> 7 ) ; xd -> plane [ i ] . dequant = cm -> uv_dequant [ qindex ] ; } x -> skip_block = vp9_segfeature_active ( & cm -> seg , segment_id , SEG_LVL_SKIP ) ; x -> q_index = qindex ; x -> errorperbit = rdmult >> 6 ; x -> errorperbit += ( x -> errorperbit == 0 ) ; vp9_initialize_me_consts ( cpi , x -> q_index ) ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void test_prepare_grant ( ) { int rc ; char query [ MAX_TEST_QUERY_LENGTH ] ; myheader ( "test_prepare_grant" ) ; mysql_autocommit ( mysql , TRUE ) ; rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_grant" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "CREATE TABLE test_grant(a tinyint primary key auto_increment)" ) ; myquery ( rc ) ; strxmov ( query , "GRANT INSERT, UPDATE, SELECT ON " , current_db , ".test_grant TO 'test_grant'@" , opt_host ? opt_host : "'localhost'" , NullS ) ; if ( mysql_query ( mysql , query ) ) { myerror ( "GRANT failed" ) ; if ( mysql_errno ( mysql ) != 1047 ) exit ( 1 ) ; } else { MYSQL * org_mysql = mysql , * lmysql ; MYSQL_STMT * stmt ; if ( ! opt_silent ) fprintf ( stdout , "\n Establishing a test connection ..." ) ; if ( ! ( lmysql = mysql_client_init ( NULL ) ) ) { myerror ( "mysql_client_init() failed" ) ; exit ( 1 ) ; } if ( ! ( mysql_real_connect ( lmysql , opt_host , "test_grant" , "" , current_db , opt_port , opt_unix_socket , 0 ) ) ) { myerror ( "connection failed" ) ; mysql_close ( lmysql ) ; exit ( 1 ) ; } lmysql -> reconnect = 1 ; if ( ! opt_silent ) fprintf ( stdout , "OK" ) ; mysql = lmysql ; rc = mysql_query ( mysql , "INSERT INTO test_grant VALUES(NULL)" ) ; myquery ( rc ) ; rc = mysql_query ( mysql , "INSERT INTO test_grant(a) VALUES(NULL)" ) ; myquery ( rc ) ; execute_prepare_query ( "INSERT INTO test_grant(a) VALUES(NULL)" , 1 ) ; execute_prepare_query ( "INSERT INTO test_grant VALUES(NULL)" , 1 ) ; execute_prepare_query ( "UPDATE test_grant SET a=9 WHERE a=1" , 1 ) ; rc = my_stmt_result ( "SELECT a FROM test_grant" ) ; DIE_UNLESS ( rc == 4 ) ; rc = mysql_query ( mysql , "DELETE FROM test_grant" ) ; myquery_r ( rc ) ; stmt = mysql_simple_prepare ( mysql , "DELETE FROM test_grant" ) ; check_stmt_r ( stmt ) ; rc = my_stmt_result ( "SELECT * FROM test_grant" ) ; DIE_UNLESS ( rc == 4 ) ; mysql_close ( lmysql ) ; mysql = org_mysql ; rc = mysql_query ( mysql , "delete from mysql.user where User='test_grant'" ) ; myquery ( rc ) ; DIE_UNLESS ( 1 == mysql_affected_rows ( mysql ) ) ; rc = mysql_query ( mysql , "delete from mysql.tables_priv where User='test_grant'" ) ; myquery ( rc ) ; DIE_UNLESS ( 1 == mysql_affected_rows ( mysql ) ) ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int eightsvx_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) { EightSvxContext * esc = avctx -> priv_data ; AVFrame * frame = data ; int buf_size ; int ch , ret ; int is_compr = ( avctx -> codec_id != AV_CODEC_ID_PCM_S8_PLANAR ) ; if ( avpkt -> data ) { int hdr_size = is_compr ? 2 : 0 ; int chan_size = ( avpkt -> size - hdr_size * avctx -> channels ) / avctx -> channels ; if ( avpkt -> size < hdr_size * avctx -> channels ) { av_log ( avctx , AV_LOG_ERROR , "packet size is too small\n" ) ; return AVERROR ( EINVAL ) ; } if ( esc -> data [ 0 ] ) { av_log ( avctx , AV_LOG_ERROR , "unexpected data after first packet\n" ) ; return AVERROR ( EINVAL ) ; } if ( is_compr ) { esc -> fib_acc [ 0 ] = avpkt -> data [ 1 ] + 128 ; if ( avctx -> channels == 2 ) esc -> fib_acc [ 1 ] = avpkt -> data [ 2 + chan_size + 1 ] + 128 ; } esc -> data_idx = 0 ; esc -> data_size = chan_size ; if ( ! ( esc -> data [ 0 ] = av_malloc ( chan_size ) ) ) return AVERROR ( ENOMEM ) ; if ( avctx -> channels == 2 ) { if ( ! ( esc -> data [ 1 ] = av_malloc ( chan_size ) ) ) { av_freep ( & esc -> data [ 0 ] ) ; return AVERROR ( ENOMEM ) ; } } memcpy ( esc -> data [ 0 ] , & avpkt -> data [ hdr_size ] , chan_size ) ; if ( avctx -> channels == 2 ) memcpy ( esc -> data [ 1 ] , & avpkt -> data [ 2 * hdr_size + chan_size ] , chan_size ) ; } if ( ! esc -> data [ 0 ] ) { av_log ( avctx , AV_LOG_ERROR , "unexpected empty packet\n" ) ; return AVERROR ( EINVAL ) ; } buf_size = FFMIN ( MAX_FRAME_SIZE , esc -> data_size - esc -> data_idx ) ; if ( buf_size <= 0 ) { * got_frame_ptr = 0 ; return avpkt -> size ; } frame -> nb_samples = buf_size * ( is_compr + 1 ) ; if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } for ( ch = 0 ; ch < avctx -> channels ; ch ++ ) { if ( is_compr ) { delta_decode ( frame -> data [ ch ] , & esc -> data [ ch ] [ esc -> data_idx ] , buf_size , & esc -> fib_acc [ ch ] , esc -> table ) ; } else { raw_decode ( frame -> data [ ch ] , & esc -> data [ ch ] [ esc -> data_idx ] , buf_size ) ; } } esc -> data_idx += buf_size ; * got_frame_ptr = 1 ; return avpkt -> size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int selinux_binder_set_context_mgr ( struct task_struct * mgr ) { u32 mysid = current_sid ( ) ; u32 mgrsid = task_sid ( mgr ) ; return avc_has_perm ( mysid , mgrsid , SECCLASS_BINDER , BINDER__SET_CONTEXT_MGR , NULL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void lag_pred_line_yuy2 ( LagarithContext * l , uint8_t * buf , int width , int stride , int line , int is_luma ) { int L , TL ; if ( ! line ) { if ( is_luma ) { buf ++ ; width -- ; } l -> dsp . add_hfyu_left_prediction ( buf + 1 , buf + 1 , width - 1 , buf [ 0 ] ) ; return ; } if ( line == 1 ) { const int HEAD = is_luma ? 4 : 2 ; int i ; L = buf [ width - stride - 1 ] ; TL = buf [ HEAD - stride - 1 ] ; for ( i = 0 ; i < HEAD ; i ++ ) { L += buf [ i ] ; buf [ i ] = L ; } buf += HEAD ; width -= HEAD ; } else { TL = buf [ width - ( 2 * stride ) - 1 ] ; L = buf [ width - stride - 1 ] ; } l -> dsp . add_hfyu_median_prediction ( buf , buf - stride , buf , width , & L , & TL ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static struct qcms_modular_transform * qcms_modular_transform_create_output ( qcms_profile * out ) { struct qcms_modular_transform * first_transform = NULL ; struct qcms_modular_transform * * next_transform = & first_transform ; if ( out -> B2A0 ) { struct qcms_modular_transform * lut_transform ; lut_transform = qcms_modular_transform_create_lut ( out -> B2A0 ) ; if ( ! lut_transform ) goto fail ; append_transform ( lut_transform , & next_transform ) ; } else if ( out -> mBA && out -> mBA -> num_in_channels == 3 && out -> mBA -> num_out_channels == 3 ) { struct qcms_modular_transform * lut_transform ; lut_transform = qcms_modular_transform_create_mAB ( out -> mBA ) ; if ( ! lut_transform ) goto fail ; append_transform ( lut_transform , & next_transform ) ; } else if ( out -> redTRC && out -> greenTRC && out -> blueTRC ) { struct qcms_modular_transform * transform ; transform = qcms_modular_transform_alloc ( ) ; if ( ! transform ) goto fail ; append_transform ( transform , & next_transform ) ; transform -> matrix = matrix_invert ( build_colorant_matrix ( out ) ) ; transform -> transform_module_fn = qcms_transform_module_matrix ; transform = qcms_modular_transform_alloc ( ) ; if ( ! transform ) goto fail ; append_transform ( transform , & next_transform ) ; transform -> matrix . m [ 0 ] [ 0 ] = 1.999969482421875f ; transform -> matrix . m [ 0 ] [ 1 ] = 0.f ; transform -> matrix . m [ 0 ] [ 2 ] = 0.f ; transform -> matrix . m [ 1 ] [ 0 ] = 0.f ; transform -> matrix . m [ 1 ] [ 1 ] = 1.999969482421875f ; transform -> matrix . m [ 1 ] [ 2 ] = 0.f ; transform -> matrix . m [ 2 ] [ 0 ] = 0.f ; transform -> matrix . m [ 2 ] [ 1 ] = 0.f ; transform -> matrix . m [ 2 ] [ 2 ] = 1.999969482421875f ; transform -> matrix . invalid = false ; transform -> transform_module_fn = qcms_transform_module_matrix ; transform = qcms_modular_transform_alloc ( ) ; if ( ! transform ) goto fail ; append_transform ( transform , & next_transform ) ; build_output_lut ( out -> redTRC , & transform -> output_gamma_lut_r , & transform -> output_gamma_lut_r_length ) ; build_output_lut ( out -> greenTRC , & transform -> output_gamma_lut_g , & transform -> output_gamma_lut_g_length ) ; build_output_lut ( out -> blueTRC , & transform -> output_gamma_lut_b , & transform -> output_gamma_lut_b_length ) ; transform -> transform_module_fn = qcms_transform_module_gamma_lut ; if ( ! transform -> output_gamma_lut_r || ! transform -> output_gamma_lut_g || ! transform -> output_gamma_lut_b ) { goto fail ; } } else { assert ( 0 && "Unsupported output profile workflow." ) ; return NULL ; } return first_transform ; fail : qcms_modular_transform_release ( first_transform ) ; return EMPTY_TRANSFORM_LIST ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void import_format ( CDXLVideoContext * c , int linesize , uint8_t * out ) { memset ( out , 0 , linesize * c -> avctx -> height ) ; switch ( c -> format ) { case BIT_PLANAR : bitplanar2chunky ( c , linesize , out ) ; break ; case BIT_LINE : bitline2chunky ( c , linesize , out ) ; break ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int parse_CRowVariantArrayInfo ( tvbuff_t * tvb , int offset , proto_tree * tree , gboolean is_64bit , struct CRowVariant * variant ) { if ( is_64bit ) { variant -> content . array_vector . i64 . count = tvb_get_letoh64 ( tvb , offset ) ; proto_tree_add_uint64 ( tree , hf_mswsp_crowvariantinfo_count64 , tvb , offset , 8 , variant -> content . array_vector . i64 . count ) ; offset += 8 ; variant -> content . array_vector . i64 . array_address = tvb_get_letoh64 ( tvb , offset ) ; proto_tree_add_uint64 ( tree , hf_mswsp_arrayvector_address64 , tvb , offset , 8 , variant -> content . array_vector . i64 . array_address ) ; offset += 8 ; } else { variant -> content . array_vector . i32 . count = tvb_get_letohl ( tvb , offset ) ; proto_tree_add_uint ( tree , hf_mswsp_crowvariantinfo_count32 , tvb , offset , 4 , variant -> content . array_vector . i32 . count ) ; offset += 4 ; variant -> content . array_vector . i32 . array_address = tvb_get_letohl ( tvb , offset ) ; proto_tree_add_uint ( tree , hf_mswsp_arrayvector_address32 , tvb , offset , 4 , variant -> content . array_vector . i32 . array_address ) ; offset += 4 ; } return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static Datum ExecEvalArrayRef ( ArrayRefExprState * astate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) { ArrayRef * arrayRef = ( ArrayRef * ) astate -> xprstate . expr ; Datum array_source ; bool isAssignment = ( arrayRef -> refassgnexpr != NULL ) ; bool eisnull ; ListCell * l ; int i = 0 , j = 0 ; IntArray upper , lower ; bool upperProvided [ MAXDIM ] , lowerProvided [ MAXDIM ] ; int * lIndex ; array_source = ExecEvalExpr ( astate -> refexpr , econtext , isNull , isDone ) ; if ( * isNull ) { if ( isDone && * isDone == ExprEndResult ) return ( Datum ) NULL ; if ( ! isAssignment ) return ( Datum ) NULL ; } foreach ( l , astate -> refupperindexpr ) { ExprState * eltstate = ( ExprState * ) lfirst ( l ) ; if ( i >= MAXDIM ) ereport ( ERROR , ( errcode ( ERRCODE_PROGRAM_LIMIT_EXCEEDED ) , errmsg ( "number of array dimensions (%d) exceeds the maximum allowed (%d)" , i + 1 , MAXDIM ) ) ) ; if ( eltstate == NULL ) { Assert ( astate -> reflowerindexpr != NIL ) ; upperProvided [ i ++ ] = false ; continue ; } upperProvided [ i ] = true ; upper . indx [ i ++ ] = DatumGetInt32 ( ExecEvalExpr ( eltstate , econtext , & eisnull , NULL ) ) ; if ( eisnull ) { if ( isAssignment ) ereport ( ERROR , ( errcode ( ERRCODE_NULL_VALUE_NOT_ALLOWED ) , errmsg ( "array subscript in assignment must not be null" ) ) ) ; * isNull = true ; return ( Datum ) NULL ; } } if ( astate -> reflowerindexpr != NIL ) { foreach ( l , astate -> reflowerindexpr ) { ExprState * eltstate = ( ExprState * ) lfirst ( l ) ; if ( j >= MAXDIM ) ereport ( ERROR , ( errcode ( ERRCODE_PROGRAM_LIMIT_EXCEEDED ) , errmsg ( "number of array dimensions (%d) exceeds the maximum allowed (%d)" , j + 1 , MAXDIM ) ) ) ; if ( eltstate == NULL ) { lowerProvided [ j ++ ] = false ; continue ; } lowerProvided [ j ] = true ; lower . indx [ j ++ ] = DatumGetInt32 ( ExecEvalExpr ( eltstate , econtext , & eisnull , NULL ) ) ; if ( eisnull ) { if ( isAssignment ) ereport ( ERROR , ( errcode ( ERRCODE_NULL_VALUE_NOT_ALLOWED ) , errmsg ( "array subscript in assignment must not be null" ) ) ) ; * isNull = true ; return ( Datum ) NULL ; } } if ( i != j ) elog ( ERROR , "upper and lower index lists are not same length" ) ; lIndex = lower . indx ; } else lIndex = NULL ; if ( isAssignment ) { Datum sourceData ; Datum save_datum ; bool save_isNull ; save_datum = econtext -> caseValue_datum ; save_isNull = econtext -> caseValue_isNull ; if ( isAssignmentIndirectionExpr ( astate -> refassgnexpr ) ) { if ( * isNull ) { econtext -> caseValue_datum = ( Datum ) 0 ; econtext -> caseValue_isNull = true ; } else if ( lIndex == NULL ) { econtext -> caseValue_datum = array_get_element ( array_source , i , upper . indx , astate -> refattrlength , astate -> refelemlength , astate -> refelembyval , astate -> refelemalign , & econtext -> caseValue_isNull ) ; } else { econtext -> caseValue_datum = array_get_slice ( array_source , i , upper . indx , lower . indx , upperProvided , lowerProvided , astate -> refattrlength , astate -> refelemlength , astate -> refelembyval , astate -> refelemalign ) ; econtext -> caseValue_isNull = false ; } } else { econtext -> caseValue_datum = ( Datum ) 0 ; econtext -> caseValue_isNull = true ; } sourceData = ExecEvalExpr ( astate -> refassgnexpr , econtext , & eisnull , NULL ) ; econtext -> caseValue_datum = save_datum ; econtext -> caseValue_isNull = save_isNull ; if ( astate -> refattrlength > 0 ) if ( eisnull || * isNull ) return array_source ; if ( * isNull ) { array_source = PointerGetDatum ( construct_empty_array ( arrayRef -> refelemtype ) ) ; * isNull = false ; } if ( lIndex == NULL ) return array_set_element ( array_source , i , upper . indx , sourceData , eisnull , astate -> refattrlength , astate -> refelemlength , astate -> refelembyval , astate -> refelemalign ) ; else return array_set_slice ( array_source , i , upper . indx , lower . indx , upperProvided , lowerProvided , sourceData , eisnull , astate -> refattrlength , astate -> refelemlength , astate -> refelembyval , astate -> refelemalign ) ; } if ( lIndex == NULL ) return array_get_element ( array_source , i , upper . indx , astate -> refattrlength , astate -> refelemlength , astate -> refelembyval , astate -> refelemalign , isNull ) ; else return array_get_slice ( array_source , i , upper . indx , lower . indx , upperProvided , lowerProvided , astate -> refattrlength , astate -> refelemlength , astate -> refelembyval , astate -> refelemalign ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) { const uint8_t * buf = avpkt -> data ; const uint8_t * buf_end = avpkt -> data + avpkt -> size ; int buf_size = avpkt -> size ; AVFrame * const p = data ; uint8_t * ptr ; unsigned int offset ; int magic_num , endian ; int x , y , ret ; int w , h , stride , bits_per_color , descriptor , elements , target_packet_size , source_packet_size ; unsigned int rgbBuffer ; if ( avpkt -> size <= 1634 ) { av_log ( avctx , AV_LOG_ERROR , "Packet too small for DPX header\n" ) ; return AVERROR_INVALIDDATA ; } magic_num = AV_RB32 ( buf ) ; buf += 4 ; if ( magic_num == AV_RL32 ( "SDPX" ) ) { endian = 0 ; } else if ( magic_num == AV_RB32 ( "SDPX" ) ) { endian = 1 ; } else { av_log ( avctx , AV_LOG_ERROR , "DPX marker not found\n" ) ; return AVERROR_INVALIDDATA ; } offset = read32 ( & buf , endian ) ; if ( avpkt -> size <= offset ) { av_log ( avctx , AV_LOG_ERROR , "Invalid data start offset\n" ) ; return AVERROR_INVALIDDATA ; } buf = avpkt -> data + 0x304 ; w = read32 ( & buf , endian ) ; h = read32 ( & buf , endian ) ; buf += 20 ; descriptor = buf [ 0 ] ; buf += 3 ; avctx -> bits_per_raw_sample = bits_per_color = buf [ 0 ] ; buf += 825 ; avctx -> sample_aspect_ratio . num = read32 ( & buf , endian ) ; avctx -> sample_aspect_ratio . den = read32 ( & buf , endian ) ; switch ( descriptor ) { case 51 : elements = 4 ; break ; case 50 : elements = 3 ; break ; default : av_log ( avctx , AV_LOG_ERROR , "Unsupported descriptor %d\n" , descriptor ) ; return AVERROR_INVALIDDATA ; } switch ( bits_per_color ) { case 8 : if ( elements == 4 ) { avctx -> pix_fmt = AV_PIX_FMT_RGBA ; } else { avctx -> pix_fmt = AV_PIX_FMT_RGB24 ; } source_packet_size = elements ; target_packet_size = elements ; break ; case 10 : avctx -> pix_fmt = AV_PIX_FMT_RGB48 ; target_packet_size = 6 ; source_packet_size = 4 ; break ; case 12 : case 16 : if ( endian ) { avctx -> pix_fmt = AV_PIX_FMT_RGB48BE ; } else { avctx -> pix_fmt = AV_PIX_FMT_RGB48LE ; } target_packet_size = 6 ; source_packet_size = elements * 2 ; break ; default : av_log ( avctx , AV_LOG_ERROR , "Unsupported color depth : %d\n" , bits_per_color ) ; return AVERROR_INVALIDDATA ; } if ( ( ret = av_image_check_size ( w , h , 0 , avctx ) ) < 0 ) return ret ; if ( w != avctx -> width || h != avctx -> height ) avcodec_set_dimensions ( avctx , w , h ) ; if ( ( ret = ff_get_buffer ( avctx , p , 0 ) ) < 0 ) { av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ; return ret ; } buf = avpkt -> data + offset ; ptr = p -> data [ 0 ] ; stride = p -> linesize [ 0 ] ; if ( source_packet_size * avctx -> width * avctx -> height > buf_end - buf ) { av_log ( avctx , AV_LOG_ERROR , "Overread buffer. Invalid header?\n" ) ; return AVERROR_INVALIDDATA ; } switch ( bits_per_color ) { case 10 : for ( x = 0 ; x < avctx -> height ; x ++ ) { uint16_t * dst = ( uint16_t * ) ptr ; for ( y = 0 ; y < avctx -> width ; y ++ ) { rgbBuffer = read32 ( & buf , endian ) ; * dst ++ = make_16bit ( rgbBuffer >> 16 ) ; * dst ++ = make_16bit ( rgbBuffer >> 6 ) ; * dst ++ = make_16bit ( rgbBuffer << 4 ) ; } ptr += stride ; } break ; case 8 : case 12 : case 16 : if ( source_packet_size == target_packet_size ) { for ( x = 0 ; x < avctx -> height ; x ++ ) { memcpy ( ptr , buf , target_packet_size * avctx -> width ) ; ptr += stride ; buf += source_packet_size * avctx -> width ; } } else { for ( x = 0 ; x < avctx -> height ; x ++ ) { uint8_t * dst = ptr ; for ( y = 0 ; y < avctx -> width ; y ++ ) { memcpy ( dst , buf , target_packet_size ) ; dst += target_packet_size ; buf += source_packet_size ; } ptr += stride ; } } break ; } * got_frame = 1 ; return buf_size ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorTextIOProcess ( qemuMonitorPtr mon ATTRIBUTE_UNUSED , const char * data , size_t len ATTRIBUTE_UNUSED , qemuMonitorMessagePtr msg ) { int used = 0 ; if ( STRPREFIX ( data , GREETING_PREFIX ) ) { const char * offset = strstr ( data , GREETING_POSTFIX ) ; if ( ! offset ) { # if DEBUG_IO VIR_DEBUG ( "Partial greeting seen, getting out & waiting for more" ) ; # endif return 0 ; } used = offset - data + strlen ( GREETING_POSTFIX ) ; # if DEBUG_IO VIR_DEBUG ( "Discarded monitor greeting" ) ; # endif } # if DEBUG_IO VIR_DEBUG ( "Process data %d byts of data" , ( int ) ( len - used ) ) ; # endif if ( msg && ! msg -> finished ) { char * start = NULL ; char * end = NULL ; char * skip ; if ( msg -> txLength > 0 ) { char * tmp ; if ( ( tmp = strchr ( msg -> txBuffer , '\r' ) ) ) { * tmp = '\0' ; } } skip = strstr ( data + used , msg -> txBuffer ) ; if ( skip ) { start = strstr ( skip + strlen ( msg -> txBuffer ) , LINE_ENDING ) ; } if ( start ) { char * passwd ; start += strlen ( LINE_ENDING ) ; passwd = strstr ( start , PASSWORD_PROMPT ) ; if ( passwd ) { # if DEBUG_IO VIR_DEBUG ( "Seen a password prompt [%s]" , data + used ) ; # endif if ( msg -> passwordHandler ) { int i ; if ( msg -> passwordHandler ( mon , msg , start , passwd - start + strlen ( PASSWORD_PROMPT ) , msg -> passwordOpaque ) < 0 ) return - 1 ; for ( i = 0 ; i < strlen ( PASSWORD_PROMPT ) ; i ++ ) start [ i ] = ' ' ; start = passwd ; } else { qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "Password request seen, but no handler available" ) ) ; return - 1 ; } } end = strstr ( start , BASIC_PROMPT ) ; } if ( start && end ) { int want = end - start ; if ( want ) { if ( VIR_REALLOC_N ( msg -> rxBuffer , msg -> rxLength + want + 1 ) < 0 ) { virReportOOMError ( ) ; return - 1 ; } memcpy ( msg -> rxBuffer + msg -> rxLength , start , want ) ; msg -> rxLength += want ; msg -> rxBuffer [ msg -> rxLength ] = '\0' ; # if DEBUG_IO VIR_DEBUG ( "Finished %d byte reply [%s]" , want , msg -> rxBuffer ) ; } else { VIR_DEBUG ( "Finished 0 byte reply" ) ; # endif } PROBE ( QEMU_MONITOR_RECV_REPLY , "mon=%p reply=%s" , mon , msg -> rxBuffer ) ; msg -> finished = 1 ; used += end - ( data + used ) ; used += strlen ( BASIC_PROMPT ) ; } } # if DEBUG_IO VIR_DEBUG ( "Total used %d" , used ) ; # endif return used ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int dissect_h245_DialingInformation ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_DialingInformation , DialingInformation_choice , NULL ) ; return offset ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int chacha20_poly1305_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) { EVP_CHACHA_AEAD_CTX * actx = aead_data ( ctx ) ; size_t rem , plen = actx -> tls_payload_length ; static const unsigned char zero [ POLY1305_BLOCK_SIZE ] = { 0 } ; if ( ! actx -> mac_inited ) { actx -> key . counter [ 0 ] = 0 ; memset ( actx -> key . buf , 0 , sizeof ( actx -> key . buf ) ) ; ChaCha20_ctr32 ( actx -> key . buf , actx -> key . buf , CHACHA_BLK_SIZE , actx -> key . key . d , actx -> key . counter ) ; Poly1305_Init ( POLY1305_ctx ( actx ) , actx -> key . buf ) ; actx -> key . counter [ 0 ] = 1 ; actx -> key . partial_len = 0 ; actx -> len . aad = actx -> len . text = 0 ; actx -> mac_inited = 1 ; } if ( in ) { if ( out == NULL ) { Poly1305_Update ( POLY1305_ctx ( actx ) , in , len ) ; actx -> len . aad += len ; actx -> aad = 1 ; return len ; } else { if ( actx -> aad ) { if ( ( rem = ( size_t ) actx -> len . aad % POLY1305_BLOCK_SIZE ) ) Poly1305_Update ( POLY1305_ctx ( actx ) , zero , POLY1305_BLOCK_SIZE - rem ) ; actx -> aad = 0 ; } actx -> tls_payload_length = NO_TLS_PAYLOAD_LENGTH ; if ( plen == NO_TLS_PAYLOAD_LENGTH ) plen = len ; else if ( len != plen + POLY1305_BLOCK_SIZE ) return - 1 ; if ( ctx -> encrypt ) { chacha_cipher ( ctx , out , in , plen ) ; Poly1305_Update ( POLY1305_ctx ( actx ) , out , plen ) ; in += plen ; out += plen ; actx -> len . text += plen ; } else { Poly1305_Update ( POLY1305_ctx ( actx ) , in , plen ) ; chacha_cipher ( ctx , out , in , plen ) ; in += plen ; out += plen ; actx -> len . text += plen ; } } } if ( in == NULL || plen != len ) { const union { long one ; char little ; } is_endian = { 1 } ; unsigned char temp [ POLY1305_BLOCK_SIZE ] ; if ( actx -> aad ) { if ( ( rem = ( size_t ) actx -> len . aad % POLY1305_BLOCK_SIZE ) ) Poly1305_Update ( POLY1305_ctx ( actx ) , zero , POLY1305_BLOCK_SIZE - rem ) ; actx -> aad = 0 ; } if ( ( rem = ( size_t ) actx -> len . text % POLY1305_BLOCK_SIZE ) ) Poly1305_Update ( POLY1305_ctx ( actx ) , zero , POLY1305_BLOCK_SIZE - rem ) ; if ( is_endian . little ) { Poly1305_Update ( POLY1305_ctx ( actx ) , ( unsigned char * ) & actx -> len , POLY1305_BLOCK_SIZE ) ; } else { temp [ 0 ] = ( unsigned char ) ( actx -> len . aad ) ; temp [ 1 ] = ( unsigned char ) ( actx -> len . aad >> 8 ) ; temp [ 2 ] = ( unsigned char ) ( actx -> len . aad >> 16 ) ; temp [ 3 ] = ( unsigned char ) ( actx -> len . aad >> 24 ) ; temp [ 4 ] = ( unsigned char ) ( actx -> len . aad >> 32 ) ; temp [ 5 ] = ( unsigned char ) ( actx -> len . aad >> 40 ) ; temp [ 6 ] = ( unsigned char ) ( actx -> len . aad >> 48 ) ; temp [ 7 ] = ( unsigned char ) ( actx -> len . aad >> 56 ) ; temp [ 8 ] = ( unsigned char ) ( actx -> len . text ) ; temp [ 9 ] = ( unsigned char ) ( actx -> len . text >> 8 ) ; temp [ 10 ] = ( unsigned char ) ( actx -> len . text >> 16 ) ; temp [ 11 ] = ( unsigned char ) ( actx -> len . text >> 24 ) ; temp [ 12 ] = ( unsigned char ) ( actx -> len . text >> 32 ) ; temp [ 13 ] = ( unsigned char ) ( actx -> len . text >> 40 ) ; temp [ 14 ] = ( unsigned char ) ( actx -> len . text >> 48 ) ; temp [ 15 ] = ( unsigned char ) ( actx -> len . text >> 56 ) ; Poly1305_Update ( POLY1305_ctx ( actx ) , temp , POLY1305_BLOCK_SIZE ) ; } Poly1305_Final ( POLY1305_ctx ( actx ) , ctx -> encrypt ? actx -> tag : temp ) ; actx -> mac_inited = 0 ; if ( in != NULL && len != plen ) { if ( ctx -> encrypt ) { memcpy ( out , actx -> tag , POLY1305_BLOCK_SIZE ) ; } else { if ( CRYPTO_memcmp ( temp , in , POLY1305_BLOCK_SIZE ) ) { memset ( out - plen , 0 , plen ) ; return - 1 ; } } } else if ( ! ctx -> encrypt ) { if ( CRYPTO_memcmp ( temp , actx -> tag , actx -> tag_len ) ) return - 1 ; } } return len ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static UBool _isExtensionSubtags ( const char * s , int32_t len ) { const char * p = s ; const char * pSubtag = NULL ; if ( len < 0 ) { len = ( int32_t ) uprv_strlen ( s ) ; } while ( ( p - s ) < len ) { if ( * p == SEP ) { if ( pSubtag == NULL ) { return FALSE ; } if ( ! _isExtensionSubtag ( pSubtag , ( int32_t ) ( p - pSubtag ) ) ) { return FALSE ; } pSubtag = NULL ; } else if ( pSubtag == NULL ) { pSubtag = p ; } p ++ ; } if ( pSubtag == NULL ) { return FALSE ; } return _isExtensionSubtag ( pSubtag , ( int32_t ) ( p - pSubtag ) ) ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static int key_pol_get_resp ( struct sock * sk , struct xfrm_policy * xp , const struct sadb_msg * hdr , int dir ) { int err ; struct sk_buff * out_skb ; struct sadb_msg * out_hdr ; err = 0 ; out_skb = pfkey_xfrm_policy2msg_prep ( xp ) ; if ( IS_ERR ( out_skb ) ) { err = PTR_ERR ( out_skb ) ; goto out ; } err = pfkey_xfrm_policy2msg ( out_skb , xp , dir ) ; if ( err < 0 ) goto out ; out_hdr = ( struct sadb_msg * ) out_skb -> data ; out_hdr -> sadb_msg_version = hdr -> sadb_msg_version ; out_hdr -> sadb_msg_type = hdr -> sadb_msg_type ; out_hdr -> sadb_msg_satype = 0 ; out_hdr -> sadb_msg_errno = 0 ; out_hdr -> sadb_msg_seq = hdr -> sadb_msg_seq ; out_hdr -> sadb_msg_pid = hdr -> sadb_msg_pid ; pfkey_broadcast ( out_skb , GFP_ATOMIC , BROADCAST_ONE , sk , xp_net ( xp ) ) ; err = 0 ; out : return err ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
gs_malloc_memory_t * gs_malloc_memory_init ( void ) { gs_malloc_memory_t * mem = ( gs_malloc_memory_t * ) Memento_label ( malloc ( sizeof ( gs_malloc_memory_t ) ) , "gs_malloc_memory_t" ) ; if ( mem == NULL ) return NULL ; mem -> stable_memory = 0 ; mem -> procs = gs_malloc_memory_procs ; mem -> allocated = 0 ; mem -> limit = max_long ; mem -> used = 0 ; mem -> max_used = 0 ; mem -> gs_lib_ctx = 0 ; mem -> non_gc_memory = ( gs_memory_t * ) mem ; mem -> thread_safe_memory = ( gs_memory_t * ) mem ; mem -> monitor = NULL ; mem -> monitor = gx_monitor_alloc ( ( gs_memory_t * ) mem ) ; return mem ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
static void jbig2_decode_mmr_init ( Jbig2MmrCtx * mmr , int width , int height , const byte * data , size_t size ) { int i ; uint32_t word = 0 ; mmr -> width = width ; mmr -> height = height ; mmr -> data = data ; mmr -> size = size ; mmr -> data_index = 0 ; mmr -> bit_index = 0 ; for ( i = 0 ; i < size && i < 4 ; i ++ ) word |= ( data [ i ] << ( ( 3 - i ) << 3 ) ) ; mmr -> word = word ; }
1True
Categorize the following code snippet as vulnerable or not. True or False
static void set_ext_overrides ( VP9_COMP * cpi ) { if ( cpi -> ext_refresh_frame_context_pending ) { cpi -> common . refresh_frame_context = cpi -> ext_refresh_frame_context ; cpi -> ext_refresh_frame_context_pending = 0 ; } if ( cpi -> ext_refresh_frame_flags_pending ) { cpi -> refresh_last_frame = cpi -> ext_refresh_last_frame ; cpi -> refresh_golden_frame = cpi -> ext_refresh_golden_frame ; cpi -> refresh_alt_ref_frame = cpi -> ext_refresh_alt_ref_frame ; cpi -> ext_refresh_frame_flags_pending = 0 ; } }
0False
Categorize the following code snippet as vulnerable or not. True or False
int vp9_get_pred_context_single_ref_p1 ( const MACROBLOCKD * xd ) { int pred_context ; const MB_MODE_INFO * const above_mbmi = get_mbmi ( get_above_mi ( xd ) ) ; const MB_MODE_INFO * const left_mbmi = get_mbmi ( get_left_mi ( xd ) ) ; const int has_above = above_mbmi != NULL ; const int has_left = left_mbmi != NULL ; if ( has_above && has_left ) { const int above_intra = ! is_inter_block ( above_mbmi ) ; const int left_intra = ! is_inter_block ( left_mbmi ) ; if ( above_intra && left_intra ) { pred_context = 2 ; } else if ( above_intra || left_intra ) { const MB_MODE_INFO * edge_mbmi = above_intra ? left_mbmi : above_mbmi ; if ( ! has_second_ref ( edge_mbmi ) ) pred_context = 4 * ( edge_mbmi -> ref_frame [ 0 ] == LAST_FRAME ) ; else pred_context = 1 + ( edge_mbmi -> ref_frame [ 0 ] == LAST_FRAME || edge_mbmi -> ref_frame [ 1 ] == LAST_FRAME ) ; } else { const int above_has_second = has_second_ref ( above_mbmi ) ; const int left_has_second = has_second_ref ( left_mbmi ) ; const MV_REFERENCE_FRAME above0 = above_mbmi -> ref_frame [ 0 ] ; const MV_REFERENCE_FRAME above1 = above_mbmi -> ref_frame [ 1 ] ; const MV_REFERENCE_FRAME left0 = left_mbmi -> ref_frame [ 0 ] ; const MV_REFERENCE_FRAME left1 = left_mbmi -> ref_frame [ 1 ] ; if ( above_has_second && left_has_second ) { pred_context = 1 + ( above0 == LAST_FRAME || above1 == LAST_FRAME || left0 == LAST_FRAME || left1 == LAST_FRAME ) ; } else if ( above_has_second || left_has_second ) { const MV_REFERENCE_FRAME rfs = ! above_has_second ? above0 : left0 ; const MV_REFERENCE_FRAME crf1 = above_has_second ? above0 : left0 ; const MV_REFERENCE_FRAME crf2 = above_has_second ? above1 : left1 ; if ( rfs == LAST_FRAME ) pred_context = 3 + ( crf1 == LAST_FRAME || crf2 == LAST_FRAME ) ; else pred_context = ( crf1 == LAST_FRAME || crf2 == LAST_FRAME ) ; } else { pred_context = 2 * ( above0 == LAST_FRAME ) + 2 * ( left0 == LAST_FRAME ) ; } } } else if ( has_above || has_left ) { const MB_MODE_INFO * edge_mbmi = has_above ? above_mbmi : left_mbmi ; if ( ! is_inter_block ( edge_mbmi ) ) { pred_context = 2 ; } else { if ( ! has_second_ref ( edge_mbmi ) ) pred_context = 4 * ( edge_mbmi -> ref_frame [ 0 ] == LAST_FRAME ) ; else pred_context = 1 + ( edge_mbmi -> ref_frame [ 0 ] == LAST_FRAME || edge_mbmi -> ref_frame [ 1 ] == LAST_FRAME ) ; } } else { pred_context = 2 ; } assert ( pred_context >= 0 && pred_context < REF_CONTEXTS ) ; return pred_context ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int qemuMonitorJSONArbitraryCommand ( qemuMonitorPtr mon , const char * cmd_str , char * * reply_str , bool hmp ) { virJSONValuePtr cmd = NULL ; virJSONValuePtr reply = NULL ; int ret = - 1 ; if ( hmp ) { if ( ! qemuMonitorCheckHMP ( mon , NULL ) ) { qemuReportError ( VIR_ERR_CONFIG_UNSUPPORTED , "%s" , _ ( "HMP passthrough is not supported by qemu" " process; only QMP commands can be used" ) ) ; return - 1 ; } return qemuMonitorJSONHumanCommandWithFd ( mon , cmd_str , - 1 , reply_str ) ; } else { if ( ! ( cmd = virJSONValueFromString ( cmd_str ) ) ) goto cleanup ; if ( qemuMonitorJSONCommand ( mon , cmd , & reply ) < 0 ) goto cleanup ; if ( ! ( * reply_str = virJSONValueToString ( reply ) ) ) goto cleanup ; } ret = 0 ; cleanup : virJSONValueFree ( cmd ) ; virJSONValueFree ( reply ) ; return ret ; }
0False
Categorize the following code snippet as vulnerable or not. True or False
int xmlListRemoveLast ( xmlListPtr l , void * data ) { xmlLinkPtr lk ; if ( l == NULL ) return ( 0 ) ; lk = xmlListLinkReverseSearch ( l , data ) ; if ( lk != NULL ) { xmlLinkDeallocator ( l , lk ) ; return 1 ; } return 0 ; }
0False