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 Image * ReadLABELImage ( const ImageInfo * image_info , ExceptionInfo * exception ) {
char geometry [ MaxTextExtent ] , * property ;
const char * label ;
DrawInfo * draw_info ;
Image * image ;
MagickBooleanType status ;
TypeMetric metrics ;
size_t height , width ;
assert ( image_info != ( const ImageInfo * ) NULL ) ;
assert ( image_info -> signature == MagickSignature ) ;
if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ;
assert ( exception != ( ExceptionInfo * ) NULL ) ;
assert ( exception -> signature == MagickSignature ) ;
image = AcquireImage ( image_info ) ;
( void ) ResetImagePage ( image , "0x0+0+0" ) ;
property = InterpretImageProperties ( image_info , image , image_info -> filename ) ;
( void ) SetImageProperty ( image , "label" , property ) ;
property = DestroyString ( property ) ;
label = GetImageProperty ( image , "label" ) ;
draw_info = CloneDrawInfo ( image_info , ( DrawInfo * ) NULL ) ;
draw_info -> text = ConstantString ( label ) ;
metrics . width = 0 ;
metrics . ascent = 0.0 ;
status = GetMultilineTypeMetrics ( image , draw_info , & metrics ) ;
if ( ( image -> columns == 0 ) && ( image -> rows == 0 ) ) {
image -> columns = ( size_t ) floor ( metrics . width + draw_info -> stroke_width + 0.5 ) ;
image -> rows = ( size_t ) floor ( metrics . height + draw_info -> stroke_width + 0.5 ) ;
}
else if ( ( strlen ( label ) > 0 ) && ( ( ( image -> columns == 0 ) || ( image -> rows == 0 ) ) || ( fabs ( image_info -> pointsize ) < MagickEpsilon ) ) ) {
double high , low ;
for ( ;
;
draw_info -> pointsize *= 2.0 ) {
( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , - metrics . bounds . x1 , metrics . ascent ) ;
if ( draw_info -> gravity == UndefinedGravity ) ( void ) CloneString ( & draw_info -> geometry , geometry ) ;
( void ) GetMultilineTypeMetrics ( image , draw_info , & metrics ) ;
width = ( size_t ) floor ( metrics . width + draw_info -> stroke_width + 0.5 ) ;
height = ( size_t ) floor ( metrics . height + draw_info -> stroke_width + 0.5 ) ;
if ( ( image -> columns != 0 ) && ( image -> rows != 0 ) ) {
if ( ( width >= image -> columns ) && ( height >= image -> rows ) ) break ;
}
else if ( ( ( image -> columns != 0 ) && ( width >= image -> columns ) ) || ( ( image -> rows != 0 ) && ( height >= image -> rows ) ) ) break ;
}
high = draw_info -> pointsize ;
for ( low = 1.0 ;
( high - low ) > 0.5 ;
) {
draw_info -> pointsize = ( low + high ) / 2.0 ;
( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , - metrics . bounds . x1 , metrics . ascent ) ;
if ( draw_info -> gravity == UndefinedGravity ) ( void ) CloneString ( & draw_info -> geometry , geometry ) ;
( void ) GetMultilineTypeMetrics ( image , draw_info , & metrics ) ;
width = ( size_t ) floor ( metrics . width + draw_info -> stroke_width + 0.5 ) ;
height = ( size_t ) floor ( metrics . height + draw_info -> stroke_width + 0.5 ) ;
if ( ( image -> columns != 0 ) && ( image -> rows != 0 ) ) {
if ( ( width < image -> columns ) && ( height < image -> rows ) ) low = draw_info -> pointsize + 0.5 ;
else high = draw_info -> pointsize - 0.5 ;
}
else if ( ( ( image -> columns != 0 ) && ( width < image -> columns ) ) || ( ( image -> rows != 0 ) && ( height < image -> rows ) ) ) low = draw_info -> pointsize + 0.5 ;
else high = draw_info -> pointsize - 0.5 ;
}
draw_info -> pointsize = ( low + high ) / 2.0 - 0.5 ;
}
status = GetMultilineTypeMetrics ( image , draw_info , & metrics ) ;
if ( status == MagickFalse ) {
draw_info = DestroyDrawInfo ( draw_info ) ;
InheritException ( exception , & image -> exception ) ;
image = DestroyImageList ( image ) ;
return ( ( Image * ) NULL ) ;
}
if ( image -> columns == 0 ) image -> columns = ( size_t ) floor ( metrics . width + draw_info -> stroke_width + 0.5 ) ;
if ( image -> columns == 0 ) image -> columns = ( size_t ) floor ( draw_info -> pointsize + draw_info -> stroke_width + 0.5 ) ;
if ( image -> rows == 0 ) image -> rows = ( size_t ) floor ( metrics . ascent - metrics . descent + draw_info -> stroke_width + 0.5 ) ;
if ( image -> rows == 0 ) image -> rows = ( size_t ) floor ( draw_info -> pointsize + draw_info -> stroke_width + 0.5 ) ;
status = SetImageExtent ( image , image -> columns , image -> rows ) ;
if ( status == MagickFalse ) {
draw_info = DestroyDrawInfo ( draw_info ) ;
InheritException ( exception , & image -> exception ) ;
return ( DestroyImageList ( image ) ) ;
}
if ( SetImageBackgroundColor ( image ) == MagickFalse ) {
draw_info = DestroyDrawInfo ( draw_info ) ;
InheritException ( exception , & image -> exception ) ;
image = DestroyImageList ( image ) ;
return ( ( Image * ) NULL ) ;
}
( void ) FormatLocaleString ( geometry , MaxTextExtent , "%+g%+g" , draw_info -> direction == RightToLeftDirection ? image -> columns - metrics . bounds . x2 : 0.0 , draw_info -> gravity == UndefinedGravity ? metrics . ascent : 0.0 ) ;
draw_info -> geometry = AcquireString ( geometry ) ;
status = AnnotateImage ( image , draw_info ) ;
if ( image_info -> pointsize == 0.0 ) {
char pointsize [ MaxTextExtent ] ;
( void ) FormatLocaleString ( pointsize , MaxTextExtent , "%.20g" , draw_info -> pointsize ) ;
( void ) SetImageProperty ( image , "label:pointsize" , pointsize ) ;
}
draw_info = DestroyDrawInfo ( draw_info ) ;
if ( status == MagickFalse ) {
image = DestroyImageList ( image ) ;
return ( ( Image * ) NULL ) ;
}
return ( GetFirstImageInList ( image ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void fill_label_bitfield64 ( field_info * fi , gchar * label_str , gboolean is_signed ) {
char * p ;
int bitfield_byte_length , bitwidth ;
guint64 unshifted_value ;
guint64 value ;
char buf [ 48 ] ;
const char * out ;
header_field_info * hfinfo = fi -> hfinfo ;
bitwidth = hfinfo_container_bitwidth ( hfinfo ) ;
if ( is_signed ) value = fvalue_get_sinteger64 ( & fi -> value ) ;
else value = fvalue_get_uinteger64 ( & fi -> value ) ;
unshifted_value = value ;
if ( hfinfo -> bitmask ) {
unshifted_value <<= hfinfo_bitshift ( hfinfo ) ;
}
p = decode_bitfield_value ( label_str , unshifted_value , hfinfo -> bitmask , bitwidth ) ;
bitfield_byte_length = ( int ) ( p - label_str ) ;
if ( hfinfo -> display == BASE_CUSTOM ) {
gchar tmp [ ITEM_LABEL_LENGTH ] ;
const custom_fmt_func_64_t fmtfunc64 = ( const custom_fmt_func_64_t ) hfinfo -> strings ;
DISSECTOR_ASSERT ( fmtfunc64 ) ;
fmtfunc64 ( tmp , value ) ;
label_fill ( label_str , bitfield_byte_length , hfinfo , tmp ) ;
}
else if ( hfinfo -> strings ) {
const char * val_str = hf_try_val64_to_str_const ( value , hfinfo , "Unknown" ) ;
out = hfinfo_number_vals_format64 ( hfinfo , buf , value ) ;
if ( out == NULL ) label_fill ( label_str , bitfield_byte_length , hfinfo , val_str ) ;
else label_fill_descr ( label_str , bitfield_byte_length , hfinfo , val_str , out ) ;
}
else {
out = hfinfo_number_value_format64 ( hfinfo , buf , value ) ;
label_fill ( label_str , bitfield_byte_length , hfinfo , out ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_h225_ReleaseCompleteReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 701 "./asn1/h225/h225.cnf" gint32 value ;
h225_packet_info * h225_pi ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_ReleaseCompleteReason , ReleaseCompleteReason_choice , & value ) ;
if ( h225_pi != NULL ) {
h225_pi -> reason = value ;
}
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool have_changed_settings ( const struct config_filter_parser * parser , const char * const * modules ) {
const unsigned char * changes ;
unsigned int i , j , size ;
for ( i = 0 ;
parser -> parsers [ i ] . root != NULL ;
i ++ ) {
if ( ! config_module_want_parser ( config_module_parsers , modules , parser -> parsers [ i ] . root ) ) continue ;
changes = settings_parser_get_changes ( parser -> parsers [ i ] . parser ) ;
size = parser -> parsers [ i ] . root -> struct_size ;
for ( j = 0 ;
j < size ;
j ++ ) {
if ( changes [ j ] != 0 ) return TRUE ;
}
}
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline Quantum GetPixelCr ( const Image * restrict image , const Quantum * restrict pixel ) {
return ( pixel [ image -> channel_map [ CrPixelChannel ] . offset ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_mswsp ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , gboolean in , void * data ) {
proto_tree * mswsp_tree = NULL ;
proto_tree * hdr_tree ;
proto_item * ti , * hti ;
guint32 msg ;
guint32 status ;
if ( tvb_reported_length ( tvb ) < 16 ) {
return 0 ;
}
col_append_str ( pinfo -> cinfo , COL_PROTOCOL , " WSP" ) ;
col_set_str ( pinfo -> cinfo , COL_INFO , "WSP " ) ;
col_append_str ( pinfo -> cinfo , COL_INFO , in ? "Request: " : "Response: " ) ;
ti = proto_tree_add_item ( tree , proto_mswsp , tvb , 0 , - 1 , ENC_NA ) ;
mswsp_tree = proto_item_add_subtree ( ti , ett_mswsp ) ;
hti = proto_tree_add_item ( mswsp_tree , hf_mswsp_hdr , tvb , 0 , 16 , ENC_NA ) ;
hdr_tree = proto_item_add_subtree ( hti , ett_mswsp_hdr ) ;
proto_tree_add_item_ret_uint ( hdr_tree , hf_mswsp_hdr_msg , tvb , 0 , 4 , ENC_LITTLE_ENDIAN , & msg ) ;
proto_item_append_text ( hti , " %s" , val_to_str ( msg , VALS ( msg_ids ) , "(Unknown: 0x%x)" ) ) ;
proto_tree_add_item_ret_uint ( hdr_tree , hf_mswsp_hdr_status , tvb , 4 , 4 , ENC_LITTLE_ENDIAN , & status ) ;
if ( ! in || status != 0 ) {
proto_item_append_text ( hti , " %s" , val_to_str ( status , VALS ( dcom_hresult_vals ) , "(Unknown: 0x%x)" ) ) ;
}
proto_tree_add_checksum ( hdr_tree , tvb , 8 , hf_mswsp_hdr_checksum , - 1 , NULL , pinfo , 0 , ENC_LITTLE_ENDIAN , PROTO_CHECKSUM_NO_FLAGS ) ;
proto_tree_add_item ( hdr_tree , hf_mswsp_hdr_reserved , tvb , 12 , 4 , ENC_LITTLE_ENDIAN ) ;
switch ( msg ) {
case 0xC8 : dissect_CPMConnect ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xC9 : dissect_CPMDisconnect ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xCA : dissect_CPMCreateQuery ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xCB : dissect_CPMFreeCursor ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xCC : dissect_CPMGetRows ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xCD : dissect_CPMRatioFinished ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xCE : dissect_CPMCompareBmk ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xCF : dissect_CPMGetApproximatePosition ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xD0 : dissect_CPMSetBindings ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xD1 : dissect_CPMGetNotify ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xD2 : dissect_CPMSendNotifyOut ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xD7 : dissect_CPMGetQueryStatus ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xD9 : dissect_CPMCiState ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xE4 : dissect_CPMFetchValue ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xE7 : dissect_CPMGetQueryStatusEx ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xE8 : dissect_CPMRestartPosition ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xEC : dissect_CPMSetCatState ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xF1 : dissect_CPMGetRowsetNotify ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xF2 : dissect_CPMFindIndices ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xF3 : dissect_CPMSetScopePrioritization ( tvb , pinfo , tree , in , data ) ;
break ;
case 0xF4 : dissect_CPMGetScopeStatistics ( tvb , pinfo , tree , in , data ) ;
break ;
default : return 0 ;
}
return tvb_reported_length ( tvb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int isup_calls_packet ( void * ptr _U_ , packet_info * pinfo , epan_dissect_t * edt _U_ , const void * isup_info _U_ ) {
voip_calls_tapinfo_t * tapinfo = & the_tapinfo_struct ;
voip_calls_info_t * tmp_listinfo ;
voip_calls_info_t * callsinfo = NULL ;
isup_calls_info_t * tmp_isupinfo ;
gboolean found = FALSE ;
gboolean forward = FALSE ;
gboolean right_pair ;
GList * list ;
gchar * frame_label = NULL ;
gchar * comment = NULL ;
const isup_tap_rec_t * pi = ( const isup_tap_rec_t * ) isup_info ;
if ( mtp3_frame_num != pinfo -> fd -> num ) return 0 ;
list = g_list_first ( tapinfo -> callsinfo_list ) ;
while ( list ) {
right_pair = TRUE ;
tmp_listinfo = ( voip_calls_info_t * ) list -> data ;
if ( ( tmp_listinfo -> protocol == VOIP_ISUP ) && ( tmp_listinfo -> call_active_state == VOIP_ACTIVE ) ) {
tmp_isupinfo = ( isup_calls_info_t * ) tmp_listinfo -> prot_info ;
if ( ( tmp_isupinfo -> cic == pinfo -> circuit_id ) && ( tmp_isupinfo -> ni == mtp3_ni ) ) {
if ( ( tmp_isupinfo -> opc == mtp3_opc ) && ( tmp_isupinfo -> dpc == mtp3_dpc ) ) {
forward = TRUE ;
}
else if ( ( tmp_isupinfo -> dpc == mtp3_opc ) && ( tmp_isupinfo -> opc == mtp3_dpc ) ) {
forward = FALSE ;
}
else {
right_pair = FALSE ;
}
if ( right_pair ) {
if ( tmp_listinfo -> call_state == VOIP_CALL_SETUP ) {
found = TRUE ;
}
else if ( pi -> message_type != 1 ) {
found = TRUE ;
}
else {
tmp_listinfo -> call_active_state = VOIP_INACTIVE ;
}
}
if ( found ) {
callsinfo = ( voip_calls_info_t * ) ( list -> data ) ;
break ;
}
}
}
list = g_list_next ( list ) ;
}
if ( ( callsinfo == NULL ) && ( pi -> message_type == 1 ) ) {
callsinfo = ( voip_calls_info_t * ) g_malloc0 ( sizeof ( voip_calls_info_t ) ) ;
callsinfo -> call_active_state = VOIP_ACTIVE ;
callsinfo -> call_state = VOIP_UNKNOWN ;
COPY_ADDRESS ( & ( callsinfo -> initial_speaker ) , & ( pinfo -> src ) ) ;
callsinfo -> selected = FALSE ;
callsinfo -> start_fd = pinfo -> fd ;
callsinfo -> start_rel_ts = pinfo -> rel_ts ;
callsinfo -> protocol = VOIP_ISUP ;
if ( pi -> calling_number != NULL ) {
callsinfo -> from_identity = g_strdup ( pi -> calling_number ) ;
}
if ( pi -> called_number != NULL ) {
callsinfo -> to_identity = g_strdup ( pi -> called_number ) ;
}
callsinfo -> prot_info = g_malloc ( sizeof ( isup_calls_info_t ) ) ;
callsinfo -> free_prot_info = g_free ;
tmp_isupinfo = ( isup_calls_info_t * ) callsinfo -> prot_info ;
tmp_isupinfo -> opc = mtp3_opc ;
tmp_isupinfo -> dpc = mtp3_dpc ;
tmp_isupinfo -> ni = mtp3_ni ;
tmp_isupinfo -> cic = pinfo -> circuit_id ;
callsinfo -> npackets = 0 ;
callsinfo -> call_num = tapinfo -> ncalls ++ ;
tapinfo -> callsinfo_list = g_list_prepend ( tapinfo -> callsinfo_list , callsinfo ) ;
}
if ( callsinfo != NULL ) {
callsinfo -> stop_fd = pinfo -> fd ;
callsinfo -> stop_rel_ts = pinfo -> rel_ts ;
++ ( callsinfo -> npackets ) ;
frame_label = g_strdup ( val_to_str_ext_const ( pi -> message_type , & isup_message_type_value_acro_ext , "Unknown" ) ) ;
if ( callsinfo -> npackets == 1 ) {
if ( ( pi -> calling_number != NULL ) && ( pi -> called_number != NULL ) ) {
comment = g_strdup_printf ( "Call from %s to %s" , pi -> calling_number , pi -> called_number ) ;
}
}
else if ( callsinfo -> npackets == 2 ) {
if ( forward ) {
comment = g_strdup_printf ( "%i-%i -> %i-%i. Cic:%i" , mtp3_ni , mtp3_opc , mtp3_ni , mtp3_dpc , pinfo -> circuit_id ) ;
}
else {
comment = g_strdup_printf ( "%i-%i -> %i-%i. Cic:%i" , mtp3_ni , mtp3_dpc , mtp3_ni , mtp3_opc , pinfo -> circuit_id ) ;
}
}
switch ( pi -> message_type ) {
case 1 : callsinfo -> call_state = VOIP_CALL_SETUP ;
break ;
case 7 : case 9 : callsinfo -> call_state = VOIP_IN_CALL ;
break ;
case 12 : if ( callsinfo -> call_state == VOIP_CALL_SETUP ) {
if ( forward ) {
callsinfo -> call_state = VOIP_CANCELLED ;
}
else {
callsinfo -> call_state = VOIP_REJECTED ;
tapinfo -> rejected_calls ++ ;
}
}
else if ( callsinfo -> call_state == VOIP_IN_CALL ) {
callsinfo -> call_state = VOIP_COMPLETED ;
tapinfo -> completed_calls ++ ;
}
comment = g_strdup_printf ( "Cause %i - %s" , pi -> cause_value , val_to_str_ext_const ( pi -> cause_value , & q931_cause_code_vals_ext , "(Unknown)" ) ) ;
break ;
}
++ ( tapinfo -> npackets ) ;
add_to_graph ( tapinfo , pinfo , frame_label , comment , callsinfo -> call_num , & ( pinfo -> src ) , & ( pinfo -> dst ) , 1 ) ;
g_free ( comment ) ;
g_free ( frame_label ) ;
}
tapinfo -> redraw = TRUE ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void bitmap_writer_reuse_bitmaps ( struct packing_data * to_pack ) {
if ( prepare_bitmap_git ( ) < 0 ) return ;
writer . reused = kh_init_sha1 ( ) ;
rebuild_existing_bitmaps ( to_pack , writer . reused , writer . show_progress ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * adb_send_and_receive ( socket_handle_t sock , const char * adb_service , char * buffer , int buffer_length , gssize * data_length ) {
gssize used_buffer_length ;
gssize length ;
gssize result ;
char status [ 4 ] ;
char tmp_buffer ;
size_t adb_service_length ;
adb_service_length = strlen ( adb_service ) ;
result = send ( sock , adb_service , ( int ) adb_service_length , 0 ) ;
if ( result != ( gssize ) adb_service_length ) {
errmsg_print ( "ERROR: Error while sending <%s> to ADB daemon" , adb_service ) ;
if ( data_length ) * data_length = 0 ;
return NULL ;
}
used_buffer_length = 0 ;
while ( used_buffer_length < 8 ) {
result = recv ( sock , buffer + used_buffer_length , ( int ) ( buffer_length - used_buffer_length ) , 0 ) ;
if ( result <= 0 ) {
errmsg_print ( "ERROR: Broken socket connection while fetching reply status for <%s>" , adb_service ) ;
return NULL ;
}
used_buffer_length += result ;
}
memcpy ( status , buffer , 4 ) ;
tmp_buffer = buffer [ 8 ] ;
buffer [ 8 ] = '\0' ;
length = ( gssize ) g_ascii_strtoll ( buffer + 4 , NULL , 16 ) ;
buffer [ 8 ] = tmp_buffer ;
while ( used_buffer_length < length + 8 ) {
result = recv ( sock , buffer + used_buffer_length , ( int ) ( buffer_length - used_buffer_length ) , 0 ) ;
if ( result <= 0 ) {
errmsg_print ( "ERROR: Broken socket connection while reading reply for <%s>" , adb_service ) ;
return NULL ;
}
used_buffer_length += result ;
}
if ( data_length ) * data_length = used_buffer_length - 8 ;
if ( memcmp ( status , "OKAY" , 4 ) ) {
errmsg_print ( "ERROR: Error while receiving by ADB for <%s>" , adb_service ) ;
if ( data_length ) * data_length = 0 ;
return NULL ;
}
return buffer + 8 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_zcl_scenes_add_remove_store_scene_response ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
proto_tree_add_item ( tree , hf_zbee_zcl_scenes_status , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
proto_tree_add_item ( tree , hf_zbee_zcl_scenes_group_id , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
proto_tree_add_item ( tree , hf_zbee_zcl_scenes_scene_id , tvb , * offset , 1 , ENC_LITTLE_ENDIAN ) ;
* offset += 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool is_strict_saop ( ScalarArrayOpExpr * expr , bool falseOK ) {
Node * rightop ;
set_sa_opfuncid ( expr ) ;
if ( ! func_strict ( expr -> opfuncid ) ) return false ;
if ( expr -> useOr && falseOK ) return true ;
Assert ( list_length ( expr -> args ) == 2 ) ;
rightop = ( Node * ) lsecond ( expr -> args ) ;
if ( rightop && IsA ( rightop , Const ) ) {
Datum arraydatum = ( ( Const * ) rightop ) -> constvalue ;
bool arrayisnull = ( ( Const * ) rightop ) -> constisnull ;
ArrayType * arrayval ;
int nitems ;
if ( arrayisnull ) return false ;
arrayval = DatumGetArrayTypeP ( arraydatum ) ;
nitems = ArrayGetNItems ( ARR_NDIM ( arrayval ) , ARR_DIMS ( arrayval ) ) ;
if ( nitems > 0 ) return true ;
}
else if ( rightop && IsA ( rightop , ArrayExpr ) ) {
ArrayExpr * arrayexpr = ( ArrayExpr * ) rightop ;
if ( arrayexpr -> elements != NIL && ! arrayexpr -> multidims ) return true ;
}
return false ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_INTEGER_1_64 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 64U , NULL , FALSE ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSVConn TSTransformCreate ( TSEventFunc event_funcp , TSHttpTxn txnp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
return TSVConnCreate ( event_funcp , TSContMutexGet ( reinterpret_cast < TSCont > ( txnp ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * wv_csp13_opaque_literal_tag ( tvbuff_t * tvb , guint32 offset , const char * token , guint8 codepage _U_ , guint32 * length ) {
guint32 data_len = tvb_get_guintvar ( tvb , offset , length ) ;
char * str = NULL ;
if ( token && ( ( strcmp ( token , "Code" ) == 0 ) || ( strcmp ( token , "ContentSize" ) == 0 ) || ( strcmp ( token , "MessageCount" ) == 0 ) || ( strcmp ( token , "Validity" ) == 0 ) || ( strcmp ( token , "KeepAliveTime" ) == 0 ) || ( strcmp ( token , "TimeToLive" ) == 0 ) || ( strcmp ( token , "AcceptedContentLength" ) == 0 ) || ( strcmp ( token , "MultiTrans" ) == 0 ) || ( strcmp ( token , "ParserSize" ) == 0 ) || ( strcmp ( token , "ServerPollMin" ) == 0 ) || ( strcmp ( token , "TCPPort" ) == 0 ) || ( strcmp ( token , "UDPPort" ) == 0 ) || ( strcmp ( token , "HistoryPeriod" ) == 0 ) || ( strcmp ( token , "MaxWatcherList" ) == 0 ) || ( strcmp ( token , "SearchFindings" ) == 0 ) || ( strcmp ( token , "SearchID" ) == 0 ) || ( strcmp ( token , "SearchIndex" ) == 0 ) || ( strcmp ( token , "SearchLimit" ) == 0 ) || ( strcmp ( token , "AcceptedPullLength" ) == 0 ) || ( strcmp ( token , "AcceptedPushLength" ) == 0 ) || ( strcmp ( token , "AcceptedRichContentLength" ) == 0 ) || ( strcmp ( token , "AcceptedTextContentLength" ) == 0 ) || ( strcmp ( token , "SessionPriority" ) == 0 ) || ( strcmp ( token , "UserSessionLimit" ) == 0 ) || ( strcmp ( token , "MultiTransPerMessage" ) == 0 ) || ( strcmp ( token , "ContentPolicyLimit" ) == 0 ) || ( strcmp ( token , "AnswerOptionID" ) == 0 ) || ( strcmp ( token , "SegmentCount" ) == 0 ) || ( strcmp ( token , "SegmentReference" ) == 0 ) || ( strcmp ( token , "TryAgainTimeout" ) == 0 ) || ( strcmp ( token , "GroupContentLimit" ) == 0 ) || ( strcmp ( token , "MessageTotalCount" ) == 0 ) || ( strcmp ( token , "PairID" ) == 0 ) ) ) {
str = wv_integer_from_opaque ( tvb , offset + * length , data_len ) ;
}
else if ( token && ( ( strcmp ( token , "DateTime" ) == 0 ) || ( strcmp ( token , "DeliveryTime" ) == 0 ) ) ) {
str = wv_datetime_from_opaque ( tvb , offset + * length , data_len ) ;
}
if ( str == NULL ) {
str = wmem_strdup_printf ( wmem_packet_scope ( ) , "(%d bytes of unparsed opaque data)" , data_len ) ;
}
* length += data_len ;
return str ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int evdns_server_request_get_requesting_addr ( struct evdns_server_request * _req , struct sockaddr * sa , int addr_len ) {
struct server_request * req = TO_SERVER_REQUEST ( _req ) ;
if ( addr_len < ( int ) req -> addrlen ) return - 1 ;
memcpy ( sa , & ( req -> addr ) , req -> addrlen ) ;
return req -> addrlen ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
size_t vmxnet_tx_pkt_get_total_len ( struct VmxnetTxPkt * pkt ) {
assert ( pkt ) ;
return pkt -> hdr_len + pkt -> payload_len ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_StimulusControl ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_StimulusControl , StimulusControl_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ppc_prep_reset ( void * opaque ) {
PowerPCCPU * cpu = opaque ;
cpu_reset ( CPU ( cpu ) ) ;
cpu -> env . nip = 0xfffffffc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t e1000e_mac_readreg ( E1000ECore * core , int index ) {
return core -> mac [ index ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dump_headers ( AVCodecContext * avctx , FLACStreaminfo * s ) {
av_log ( avctx , AV_LOG_DEBUG , " Max Blocksize: %d\n" , s -> max_blocksize ) ;
av_log ( avctx , AV_LOG_DEBUG , " Max Framesize: %d\n" , s -> max_framesize ) ;
av_log ( avctx , AV_LOG_DEBUG , " Samplerate: %d\n" , s -> samplerate ) ;
av_log ( avctx , AV_LOG_DEBUG , " Channels: %d\n" , s -> channels ) ;
av_log ( avctx , AV_LOG_DEBUG , " Bits: %d\n" , s -> bps ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int pss_verify_cmp ( void * opaque , gcry_mpi_t tmp ) {
struct pk_encoding_ctx * ctx = opaque ;
gcry_mpi_t hash = ctx -> verify_arg ;
return pss_verify ( hash , tmp , ctx -> nbits - 1 , ctx -> hash_algo , ctx -> saltlen ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static long string_hash ( PyStringObject * a ) {
register Py_ssize_t len ;
register unsigned char * p ;
register long x ;
# ifdef Py_DEBUG assert ( _Py_HashSecret_Initialized ) ;
# endif if ( a -> ob_shash != - 1 ) return a -> ob_shash ;
len = Py_SIZE ( a ) ;
if ( len == 0 ) {
a -> ob_shash = 0 ;
return 0 ;
}
p = ( unsigned char * ) a -> ob_sval ;
x = _Py_HashSecret . prefix ;
x ^= * p << 7 ;
while ( -- len >= 0 ) x = ( 1000003 * x ) ^ * p ++ ;
x ^= Py_SIZE ( a ) ;
x ^= _Py_HashSecret . suffix ;
if ( x == - 1 ) x = - 2 ;
a -> ob_shash = x ;
return x ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void get_tile_buffers ( VP9Decoder * pbi , const uint8_t * data , const uint8_t * data_end , int tile_cols , int tile_rows , TileBuffer ( * tile_buffers ) [ 1 << 6 ] ) {
int r , c ;
for ( r = 0 ;
r < tile_rows ;
++ r ) {
for ( c = 0 ;
c < tile_cols ;
++ c ) {
const int is_last = ( r == tile_rows - 1 ) && ( c == tile_cols - 1 ) ;
TileBuffer * const buf = & tile_buffers [ r ] [ c ] ;
buf -> col = c ;
get_tile_buffer ( data_end , is_last , & pbi -> common . error , & data , pbi -> decrypt_cb , pbi -> decrypt_state , buf ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
PHP_FUNCTION ( uwsgi_cache_update ) {
char * key = NULL ;
int keylen ;
char * value = NULL ;
int vallen ;
uint64_t expires = 0 ;
char * cache = NULL ;
int cachelen = 0 ;
if ( ! uwsgi . caches ) RETURN_NULL ( ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "ss|ls" , & key , & keylen , & value , & vallen , & expires , & cache , & cachelen ) == FAILURE ) {
RETURN_NULL ( ) ;
}
if ( ! uwsgi_cache_magic_set ( key , keylen , value , vallen , expires , UWSGI_CACHE_FLAG_UPDATE , cache ) ) {
RETURN_TRUE ;
}
RETURN_NULL ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int get_delta ( struct rev_info * revs , struct remote_lock * lock ) {
int i ;
struct commit * commit ;
struct object_list * * p = & objects ;
int count = 0 ;
while ( ( commit = get_revision ( revs ) ) != NULL ) {
p = process_tree ( commit -> tree , p ) ;
commit -> object . flags |= LOCAL ;
if ( ! ( commit -> object . flags & UNINTERESTING ) ) count += add_send_request ( & commit -> object , lock ) ;
}
for ( i = 0 ;
i < revs -> pending . nr ;
i ++ ) {
struct object_array_entry * entry = revs -> pending . objects + i ;
struct object * obj = entry -> item ;
const char * name = entry -> name ;
if ( obj -> flags & ( UNINTERESTING | SEEN ) ) continue ;
if ( obj -> type == OBJ_TAG ) {
obj -> flags |= SEEN ;
p = add_one_object ( obj , p ) ;
continue ;
}
if ( obj -> type == OBJ_TREE ) {
p = process_tree ( ( struct tree * ) obj , p ) ;
continue ;
}
if ( obj -> type == OBJ_BLOB ) {
p = process_blob ( ( struct blob * ) obj , p ) ;
continue ;
}
die ( "unknown pending object %s (%s)" , oid_to_hex ( & obj -> oid ) , name ) ;
}
while ( objects ) {
if ( ! ( objects -> item -> flags & UNINTERESTING ) ) count += add_send_request ( objects -> item , lock ) ;
objects = objects -> next ;
}
return count ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
inline bool is_delimiter_command ( char * name , ulong len ) {
return ( len >= DELIMITER_NAME_LEN && ! my_strnncoll ( charset_info , ( uchar * ) name , DELIMITER_NAME_LEN , ( uchar * ) DELIMITER_NAME , DELIMITER_NAME_LEN ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int qemuMonitorJSONExtractPtyPaths ( virJSONValuePtr reply , virHashTablePtr paths ) {
virJSONValuePtr data ;
int ret = - 1 ;
int i ;
if ( ! ( data = virJSONValueObjectGet ( reply , "return" ) ) ) {
qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "character device reply was missing return data" ) ) ;
goto cleanup ;
}
if ( data -> type != VIR_JSON_TYPE_ARRAY ) {
qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "character device information was not an array" ) ) ;
goto cleanup ;
}
for ( i = 0 ;
i < virJSONValueArraySize ( data ) ;
i ++ ) {
virJSONValuePtr entry = virJSONValueArrayGet ( data , i ) ;
const char * type ;
const char * id ;
if ( ! entry ) {
qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "character device information was missing array element" ) ) ;
goto cleanup ;
}
if ( ! ( type = virJSONValueObjectGetString ( entry , "filename" ) ) ) {
qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "character device information was missing filename" ) ) ;
goto cleanup ;
}
if ( ! ( id = virJSONValueObjectGetString ( entry , "label" ) ) ) {
qemuReportError ( VIR_ERR_INTERNAL_ERROR , "%s" , _ ( "character device information was missing filename" ) ) ;
goto cleanup ;
}
if ( STRPREFIX ( type , "pty:" ) ) {
char * path = strdup ( type + strlen ( "pty:" ) ) ;
if ( ! path ) {
virReportOOMError ( ) ;
goto cleanup ;
}
if ( virHashAddEntry ( paths , id , path ) < 0 ) {
qemuReportError ( VIR_ERR_OPERATION_FAILED , _ ( "failed to save chardev path '%s'" ) , path ) ;
VIR_FREE ( path ) ;
goto cleanup ;
}
}
}
ret = 0 ;
cleanup : return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char func_parallel ( Oid funcid ) {
HeapTuple tp ;
char result ;
tp = SearchSysCache1 ( PROCOID , ObjectIdGetDatum ( funcid ) ) ;
if ( ! HeapTupleIsValid ( tp ) ) elog ( ERROR , "cache lookup failed for function %u" , funcid ) ;
result = ( ( Form_pg_proc ) GETSTRUCT ( tp ) ) -> proparallel ;
ReleaseSysCache ( tp ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct sk_buff * __pfkey_xfrm_state2msg ( const struct xfrm_state * x , int add_keys , int hsc ) {
struct sk_buff * skb ;
struct sadb_msg * hdr ;
struct sadb_sa * sa ;
struct sadb_lifetime * lifetime ;
struct sadb_address * addr ;
struct sadb_key * key ;
struct sadb_x_sa2 * sa2 ;
struct sadb_x_sec_ctx * sec_ctx ;
struct xfrm_sec_ctx * xfrm_ctx ;
int ctx_size = 0 ;
int size ;
int auth_key_size = 0 ;
int encrypt_key_size = 0 ;
int sockaddr_size ;
struct xfrm_encap_tmpl * natt = NULL ;
int mode ;
sockaddr_size = pfkey_sockaddr_size ( x -> props . family ) ;
if ( ! sockaddr_size ) return ERR_PTR ( - EINVAL ) ;
size = sizeof ( struct sadb_msg ) + sizeof ( struct sadb_sa ) + sizeof ( struct sadb_lifetime ) + ( ( hsc & 1 ) ? sizeof ( struct sadb_lifetime ) : 0 ) + ( ( hsc & 2 ) ? sizeof ( struct sadb_lifetime ) : 0 ) + sizeof ( struct sadb_address ) * 2 + sockaddr_size * 2 + sizeof ( struct sadb_x_sa2 ) ;
if ( ( xfrm_ctx = x -> security ) ) {
ctx_size = PFKEY_ALIGN8 ( xfrm_ctx -> ctx_len ) ;
size += sizeof ( struct sadb_x_sec_ctx ) + ctx_size ;
}
if ( ! xfrm_addr_equal ( & x -> sel . saddr , & x -> props . saddr , x -> props . family ) ) size += sizeof ( struct sadb_address ) + sockaddr_size ;
if ( add_keys ) {
if ( x -> aalg && x -> aalg -> alg_key_len ) {
auth_key_size = PFKEY_ALIGN8 ( ( x -> aalg -> alg_key_len + 7 ) / 8 ) ;
size += sizeof ( struct sadb_key ) + auth_key_size ;
}
if ( x -> ealg && x -> ealg -> alg_key_len ) {
encrypt_key_size = PFKEY_ALIGN8 ( ( x -> ealg -> alg_key_len + 7 ) / 8 ) ;
size += sizeof ( struct sadb_key ) + encrypt_key_size ;
}
}
if ( x -> encap ) natt = x -> encap ;
if ( natt && natt -> encap_type ) {
size += sizeof ( struct sadb_x_nat_t_type ) ;
size += sizeof ( struct sadb_x_nat_t_port ) ;
size += sizeof ( struct sadb_x_nat_t_port ) ;
}
skb = alloc_skb ( size + 16 , GFP_ATOMIC ) ;
if ( skb == NULL ) return ERR_PTR ( - ENOBUFS ) ;
hdr = ( struct sadb_msg * ) skb_put ( skb , sizeof ( struct sadb_msg ) ) ;
memset ( hdr , 0 , size ) ;
hdr -> sadb_msg_len = size / sizeof ( uint64_t ) ;
sa = ( struct sadb_sa * ) skb_put ( skb , sizeof ( struct sadb_sa ) ) ;
sa -> sadb_sa_len = sizeof ( struct sadb_sa ) / sizeof ( uint64_t ) ;
sa -> sadb_sa_exttype = SADB_EXT_SA ;
sa -> sadb_sa_spi = x -> id . spi ;
sa -> sadb_sa_replay = x -> props . replay_window ;
switch ( x -> km . state ) {
case XFRM_STATE_VALID : sa -> sadb_sa_state = x -> km . dying ? SADB_SASTATE_DYING : SADB_SASTATE_MATURE ;
break ;
case XFRM_STATE_ACQ : sa -> sadb_sa_state = SADB_SASTATE_LARVAL ;
break ;
default : sa -> sadb_sa_state = SADB_SASTATE_DEAD ;
break ;
}
sa -> sadb_sa_auth = 0 ;
if ( x -> aalg ) {
struct xfrm_algo_desc * a = xfrm_aalg_get_byname ( x -> aalg -> alg_name , 0 ) ;
sa -> sadb_sa_auth = ( a && a -> pfkey_supported ) ? a -> desc . sadb_alg_id : 0 ;
}
sa -> sadb_sa_encrypt = 0 ;
BUG_ON ( x -> ealg && x -> calg ) ;
if ( x -> ealg ) {
struct xfrm_algo_desc * a = xfrm_ealg_get_byname ( x -> ealg -> alg_name , 0 ) ;
sa -> sadb_sa_encrypt = ( a && a -> pfkey_supported ) ? a -> desc . sadb_alg_id : 0 ;
}
if ( x -> calg ) {
struct xfrm_algo_desc * a = xfrm_calg_get_byname ( x -> calg -> alg_name , 0 ) ;
sa -> sadb_sa_encrypt = ( a && a -> pfkey_supported ) ? a -> desc . sadb_alg_id : 0 ;
}
sa -> sadb_sa_flags = 0 ;
if ( x -> props . flags & XFRM_STATE_NOECN ) sa -> sadb_sa_flags |= SADB_SAFLAGS_NOECN ;
if ( x -> props . flags & XFRM_STATE_DECAP_DSCP ) sa -> sadb_sa_flags |= SADB_SAFLAGS_DECAP_DSCP ;
if ( x -> props . flags & XFRM_STATE_NOPMTUDISC ) sa -> sadb_sa_flags |= SADB_SAFLAGS_NOPMTUDISC ;
if ( hsc & 2 ) {
lifetime = ( struct sadb_lifetime * ) skb_put ( skb , sizeof ( struct sadb_lifetime ) ) ;
lifetime -> sadb_lifetime_len = sizeof ( struct sadb_lifetime ) / sizeof ( uint64_t ) ;
lifetime -> sadb_lifetime_exttype = SADB_EXT_LIFETIME_HARD ;
lifetime -> sadb_lifetime_allocations = _X2KEY ( x -> lft . hard_packet_limit ) ;
lifetime -> sadb_lifetime_bytes = _X2KEY ( x -> lft . hard_byte_limit ) ;
lifetime -> sadb_lifetime_addtime = x -> lft . hard_add_expires_seconds ;
lifetime -> sadb_lifetime_usetime = x -> lft . hard_use_expires_seconds ;
}
if ( hsc & 1 ) {
lifetime = ( struct sadb_lifetime * ) skb_put ( skb , sizeof ( struct sadb_lifetime ) ) ;
lifetime -> sadb_lifetime_len = sizeof ( struct sadb_lifetime ) / sizeof ( uint64_t ) ;
lifetime -> sadb_lifetime_exttype = SADB_EXT_LIFETIME_SOFT ;
lifetime -> sadb_lifetime_allocations = _X2KEY ( x -> lft . soft_packet_limit ) ;
lifetime -> sadb_lifetime_bytes = _X2KEY ( x -> lft . soft_byte_limit ) ;
lifetime -> sadb_lifetime_addtime = x -> lft . soft_add_expires_seconds ;
lifetime -> sadb_lifetime_usetime = x -> lft . soft_use_expires_seconds ;
}
lifetime = ( struct sadb_lifetime * ) skb_put ( skb , sizeof ( struct sadb_lifetime ) ) ;
lifetime -> sadb_lifetime_len = sizeof ( struct sadb_lifetime ) / sizeof ( uint64_t ) ;
lifetime -> sadb_lifetime_exttype = SADB_EXT_LIFETIME_CURRENT ;
lifetime -> sadb_lifetime_allocations = x -> curlft . packets ;
lifetime -> sadb_lifetime_bytes = x -> curlft . bytes ;
lifetime -> sadb_lifetime_addtime = x -> curlft . add_time ;
lifetime -> sadb_lifetime_usetime = x -> curlft . use_time ;
addr = ( struct sadb_address * ) skb_put ( skb , sizeof ( struct sadb_address ) + sockaddr_size ) ;
addr -> sadb_address_len = ( sizeof ( struct sadb_address ) + sockaddr_size ) / sizeof ( uint64_t ) ;
addr -> sadb_address_exttype = SADB_EXT_ADDRESS_SRC ;
addr -> sadb_address_proto = 0 ;
addr -> sadb_address_reserved = 0 ;
addr -> sadb_address_prefixlen = pfkey_sockaddr_fill ( & x -> props . saddr , 0 , ( struct sockaddr * ) ( addr + 1 ) , x -> props . family ) ;
if ( ! addr -> sadb_address_prefixlen ) BUG ( ) ;
addr = ( struct sadb_address * ) skb_put ( skb , sizeof ( struct sadb_address ) + sockaddr_size ) ;
addr -> sadb_address_len = ( sizeof ( struct sadb_address ) + sockaddr_size ) / sizeof ( uint64_t ) ;
addr -> sadb_address_exttype = SADB_EXT_ADDRESS_DST ;
addr -> sadb_address_proto = 0 ;
addr -> sadb_address_reserved = 0 ;
addr -> sadb_address_prefixlen = pfkey_sockaddr_fill ( & x -> id . daddr , 0 , ( struct sockaddr * ) ( addr + 1 ) , x -> props . family ) ;
if ( ! addr -> sadb_address_prefixlen ) BUG ( ) ;
if ( ! xfrm_addr_equal ( & x -> sel . saddr , & x -> props . saddr , x -> props . family ) ) {
addr = ( struct sadb_address * ) skb_put ( skb , sizeof ( struct sadb_address ) + sockaddr_size ) ;
addr -> sadb_address_len = ( sizeof ( struct sadb_address ) + sockaddr_size ) / sizeof ( uint64_t ) ;
addr -> sadb_address_exttype = SADB_EXT_ADDRESS_PROXY ;
addr -> sadb_address_proto = pfkey_proto_from_xfrm ( x -> sel . proto ) ;
addr -> sadb_address_prefixlen = x -> sel . prefixlen_s ;
addr -> sadb_address_reserved = 0 ;
pfkey_sockaddr_fill ( & x -> sel . saddr , x -> sel . sport , ( struct sockaddr * ) ( addr + 1 ) , x -> props . family ) ;
}
if ( add_keys && auth_key_size ) {
key = ( struct sadb_key * ) skb_put ( skb , sizeof ( struct sadb_key ) + auth_key_size ) ;
key -> sadb_key_len = ( sizeof ( struct sadb_key ) + auth_key_size ) / sizeof ( uint64_t ) ;
key -> sadb_key_exttype = SADB_EXT_KEY_AUTH ;
key -> sadb_key_bits = x -> aalg -> alg_key_len ;
key -> sadb_key_reserved = 0 ;
memcpy ( key + 1 , x -> aalg -> alg_key , ( x -> aalg -> alg_key_len + 7 ) / 8 ) ;
}
if ( add_keys && encrypt_key_size ) {
key = ( struct sadb_key * ) skb_put ( skb , sizeof ( struct sadb_key ) + encrypt_key_size ) ;
key -> sadb_key_len = ( sizeof ( struct sadb_key ) + encrypt_key_size ) / sizeof ( uint64_t ) ;
key -> sadb_key_exttype = SADB_EXT_KEY_ENCRYPT ;
key -> sadb_key_bits = x -> ealg -> alg_key_len ;
key -> sadb_key_reserved = 0 ;
memcpy ( key + 1 , x -> ealg -> alg_key , ( x -> ealg -> alg_key_len + 7 ) / 8 ) ;
}
sa2 = ( struct sadb_x_sa2 * ) skb_put ( skb , sizeof ( struct sadb_x_sa2 ) ) ;
sa2 -> sadb_x_sa2_len = sizeof ( struct sadb_x_sa2 ) / sizeof ( uint64_t ) ;
sa2 -> sadb_x_sa2_exttype = SADB_X_EXT_SA2 ;
if ( ( mode = pfkey_mode_from_xfrm ( x -> props . mode ) ) < 0 ) {
kfree_skb ( skb ) ;
return ERR_PTR ( - EINVAL ) ;
}
sa2 -> sadb_x_sa2_mode = mode ;
sa2 -> sadb_x_sa2_reserved1 = 0 ;
sa2 -> sadb_x_sa2_reserved2 = 0 ;
sa2 -> sadb_x_sa2_sequence = 0 ;
sa2 -> sadb_x_sa2_reqid = x -> props . reqid ;
if ( natt && natt -> encap_type ) {
struct sadb_x_nat_t_type * n_type ;
struct sadb_x_nat_t_port * n_port ;
n_type = ( struct sadb_x_nat_t_type * ) skb_put ( skb , sizeof ( * n_type ) ) ;
n_type -> sadb_x_nat_t_type_len = sizeof ( * n_type ) / sizeof ( uint64_t ) ;
n_type -> sadb_x_nat_t_type_exttype = SADB_X_EXT_NAT_T_TYPE ;
n_type -> sadb_x_nat_t_type_type = natt -> encap_type ;
n_type -> sadb_x_nat_t_type_reserved [ 0 ] = 0 ;
n_type -> sadb_x_nat_t_type_reserved [ 1 ] = 0 ;
n_type -> sadb_x_nat_t_type_reserved [ 2 ] = 0 ;
n_port = ( struct sadb_x_nat_t_port * ) skb_put ( skb , sizeof ( * n_port ) ) ;
n_port -> sadb_x_nat_t_port_len = sizeof ( * n_port ) / sizeof ( uint64_t ) ;
n_port -> sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_SPORT ;
n_port -> sadb_x_nat_t_port_port = natt -> encap_sport ;
n_port -> sadb_x_nat_t_port_reserved = 0 ;
n_port = ( struct sadb_x_nat_t_port * ) skb_put ( skb , sizeof ( * n_port ) ) ;
n_port -> sadb_x_nat_t_port_len = sizeof ( * n_port ) / sizeof ( uint64_t ) ;
n_port -> sadb_x_nat_t_port_exttype = SADB_X_EXT_NAT_T_DPORT ;
n_port -> sadb_x_nat_t_port_port = natt -> encap_dport ;
n_port -> sadb_x_nat_t_port_reserved = 0 ;
}
if ( xfrm_ctx ) {
sec_ctx = ( struct sadb_x_sec_ctx * ) skb_put ( skb , sizeof ( struct sadb_x_sec_ctx ) + ctx_size ) ;
sec_ctx -> sadb_x_sec_len = ( sizeof ( struct sadb_x_sec_ctx ) + ctx_size ) / sizeof ( uint64_t ) ;
sec_ctx -> sadb_x_sec_exttype = SADB_X_EXT_SEC_CTX ;
sec_ctx -> sadb_x_ctx_doi = xfrm_ctx -> ctx_doi ;
sec_ctx -> sadb_x_ctx_alg = xfrm_ctx -> ctx_alg ;
sec_ctx -> sadb_x_ctx_len = xfrm_ctx -> ctx_len ;
memcpy ( sec_ctx + 1 , xfrm_ctx -> ctx_str , xfrm_ctx -> ctx_len ) ;
}
return skb ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void free_replace_regex ( ) {
if ( glob_replace_regex ) {
delete_dynamic ( & glob_replace_regex -> regex_arr ) ;
my_free ( glob_replace_regex -> even_buf ) ;
my_free ( glob_replace_regex -> odd_buf ) ;
my_free ( glob_replace_regex ) ;
glob_replace_regex = 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ProfileInfoCacheTest , DownloadHighResAvatarTest ) {
switches : : EnableNewAvatarMenuForTesting ( base : : CommandLine : : ForCurrentProcess ( ) ) ;
EXPECT_EQ ( 0U , GetCache ( ) -> GetNumberOfProfiles ( ) ) ;
base : : FilePath path_1 = GetProfilePath ( "path_1" ) ;
GetCache ( ) -> AddProfileToCache ( path_1 , ASCIIToUTF16 ( "name_1" ) , base : : string16 ( ) , 0 , std : : string ( ) ) ;
EXPECT_EQ ( 1U , GetCache ( ) -> GetNumberOfProfiles ( ) ) ;
base : : RunLoop ( ) . RunUntilIdle ( ) ;
EXPECT_EQ ( 0U , GetCache ( ) -> cached_avatar_images_ . size ( ) ) ;
EXPECT_EQ ( 1U , GetCache ( ) -> avatar_images_downloads_in_progress_ . size ( ) ) ;
EXPECT_FALSE ( GetCache ( ) -> GetHighResAvatarOfProfileAtIndex ( 0 ) ) ;
const size_t kIconIndex = 0 ;
ProfileAvatarDownloader avatar_downloader ( kIconIndex , GetCache ( ) -> GetPathOfProfileAtIndex ( 0 ) , GetCache ( ) ) ;
SkBitmap bitmap ;
bitmap . allocN32Pixels ( 2 , 2 ) ;
bitmap . eraseColor ( SK_ColorGREEN ) ;
avatar_downloader . OnFetchComplete ( GURL ( "http://www.google.com/avatar.png" ) , & bitmap ) ;
EXPECT_EQ ( 0U , GetCache ( ) -> avatar_images_downloads_in_progress_ . size ( ) ) ;
std : : string file_name = profiles : : GetDefaultAvatarIconFileNameAtIndex ( kIconIndex ) ;
EXPECT_EQ ( 1U , GetCache ( ) -> cached_avatar_images_ . size ( ) ) ;
EXPECT_TRUE ( GetCache ( ) -> GetHighResAvatarOfProfileAtIndex ( 0 ) ) ;
EXPECT_EQ ( GetCache ( ) -> cached_avatar_images_ [ file_name ] , GetCache ( ) -> GetHighResAvatarOfProfileAtIndex ( 0 ) ) ;
base : : RunLoop ( ) . RunUntilIdle ( ) ;
base : : FilePath icon_path = profiles : : GetPathOfHighResAvatarAtIndex ( kIconIndex ) ;
EXPECT_NE ( std : : string : : npos , icon_path . MaybeAsASCII ( ) . find ( file_name ) ) ;
EXPECT_TRUE ( base : : PathExists ( icon_path ) ) ;
EXPECT_TRUE ( base : : DeleteFile ( icon_path , true ) ) ;
EXPECT_FALSE ( base : : PathExists ( icon_path ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void update_layer_contexts ( VP8_COMP * cpi ) {
VP8_CONFIG * oxcf = & cpi -> oxcf ;
if ( oxcf -> number_of_layers > 1 ) {
unsigned int i ;
double prev_layer_framerate = 0 ;
assert ( oxcf -> number_of_layers <= VPX_TS_MAX_LAYERS ) ;
for ( i = 0 ;
i < oxcf -> number_of_layers && i < VPX_TS_MAX_LAYERS ;
++ i ) {
LAYER_CONTEXT * lc = & cpi -> layer_context [ i ] ;
lc -> framerate = cpi -> ref_framerate / oxcf -> rate_decimator [ i ] ;
lc -> target_bandwidth = oxcf -> target_bitrate [ i ] * 1000 ;
lc -> starting_buffer_level = rescale ( ( int ) oxcf -> starting_buffer_level_in_ms , lc -> target_bandwidth , 1000 ) ;
if ( oxcf -> optimal_buffer_level == 0 ) lc -> optimal_buffer_level = lc -> target_bandwidth / 8 ;
else lc -> optimal_buffer_level = rescale ( ( int ) oxcf -> optimal_buffer_level_in_ms , lc -> target_bandwidth , 1000 ) ;
if ( oxcf -> maximum_buffer_size == 0 ) lc -> maximum_buffer_size = lc -> target_bandwidth / 8 ;
else lc -> maximum_buffer_size = rescale ( ( int ) oxcf -> maximum_buffer_size_in_ms , lc -> target_bandwidth , 1000 ) ;
if ( i > 0 ) lc -> avg_frame_size_for_layer = ( int ) ( ( oxcf -> target_bitrate [ i ] - oxcf -> target_bitrate [ i - 1 ] ) * 1000 / ( lc -> framerate - prev_layer_framerate ) ) ;
prev_layer_framerate = lc -> framerate ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void simplestring_addn ( simplestring * target , const char * source , size_t add_len ) {
size_t newsize = target -> size , incr = 0 ;
if ( target && source ) {
if ( ! target -> str ) {
simplestring_init_str ( target ) ;
}
if ( ( SIZE_MAX - add_len ) < target -> len || ( SIZE_MAX - add_len - 1 ) < target -> len ) {
return ;
}
if ( target -> len + add_len + 1 > target -> size ) {
newsize = target -> len + add_len + 1 ;
incr = target -> size * 2 ;
if ( incr ) {
newsize = newsize - ( newsize % incr ) + incr ;
}
if ( newsize < ( target -> len + add_len + 1 ) ) {
return ;
}
target -> str = ( char * ) realloc ( target -> str , newsize ) ;
target -> size = target -> str ? newsize : 0 ;
}
if ( target -> str ) {
if ( add_len ) {
memcpy ( target -> str + target -> len , source , add_len ) ;
}
target -> len += add_len ;
target -> str [ target -> len ] = 0 ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_register_adb ( void ) {
module_t * module ;
expert_module_t * expert_module ;
static hf_register_info hf [ ] = {
{
& hf_command , {
"Command" , "adb.command" , FT_UINT32 , BASE_HEX , VALS ( command_vals ) , 0x00 , NULL , HFILL }
}
, {
& hf_argument_0 , {
"Argument 0" , "adb.argument.0" , FT_UINT32 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_argument_1 , {
"Argument 0" , "adb.argument.1" , FT_UINT32 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_data_length , {
"Data Length" , "adb.data_length" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_data_crc32 , {
"Data CRC32" , "adb.data_crc32" , FT_UINT32 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_magic , {
"Magic" , "adb.magic" , FT_UINT32 , BASE_HEX , VALS ( magic_vals ) , 0x00 , NULL , HFILL }
}
, {
& hf_version , {
"Version" , "adb.version" , FT_UINT32 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_max_data , {
"Max Data" , "adb.max_data" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_auth_type , {
"Type" , "adb.auth_type" , FT_UINT32 , BASE_HEX , VALS ( auth_type_vals ) , 0x00 , NULL , HFILL }
}
, {
& hf_online , {
"Online" , "adb.online" , FT_BOOLEAN , 32 , TFS ( & tfs_no_yes ) , 0x00 , NULL , HFILL }
}
, {
& hf_sequence , {
"Sequence" , "adb.sequence" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_zero , {
"Zero" , "adb.zero" , FT_UINT32 , BASE_HEX , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_local_id , {
"Local ID" , "adb.local_id" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_remote_id , {
"Remote ID" , "adb.remote_id" , FT_UINT32 , BASE_DEC , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_data , {
"Data" , "adb.data" , FT_NONE , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_service , {
"Service" , "adb.service" , FT_STRING , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_data_fragment , {
"Data Fragment" , "adb.data_fragment" , FT_NONE , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_service_start_in_frame , {
"Service Start in Frame" , "adb.service_start_in_frame" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_close_local_in_frame , {
"Local Service Close in Frame" , "adb.close_local_in_frame" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_close_remote_in_frame , {
"Remote Service Close in Frame" , "adb.close_remote_in_frame" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_command_in_frame , {
"Command in Frame" , "adb.command_in_frame" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_completed_in_frame , {
"Completed in Frame" , "adb.completed_in_frame" , FT_FRAMENUM , BASE_NONE , NULL , 0x00 , NULL , HFILL }
}
, {
& hf_connection_info , {
"Info" , "adb.connection_info" , FT_STRINGZ , STR_ASCII , NULL , 0x00 , NULL , HFILL }
}
}
;
static gint * ett [ ] = {
& ett_adb , & ett_adb_arg0 , & ett_adb_arg1 , & ett_adb_crc , & ett_adb_magic }
;
static ei_register_info ei [ ] = {
{
& ei_invalid_magic , {
"adb.expert.invalid_magic" , PI_PROTOCOL , PI_WARN , "Invalid Magic" , EXPFILL }
}
, {
& ei_invalid_crc , {
"adb.expert.crc_error" , PI_PROTOCOL , PI_ERROR , "CRC32 Error" , EXPFILL }
}
, {
& ei_invalid_data , {
"adb.expert.data_error" , PI_PROTOCOL , PI_ERROR , "Mismatch between message payload size and data length" , EXPFILL }
}
, }
;
command_info = wmem_tree_new_autoreset ( wmem_epan_scope ( ) , wmem_file_scope ( ) ) ;
service_info = wmem_tree_new_autoreset ( wmem_epan_scope ( ) , wmem_file_scope ( ) ) ;
proto_adb = proto_register_protocol ( "Android Debug Bridge" , "ADB" , "adb" ) ;
adb_handle = register_dissector ( "adb" , dissect_adb , proto_adb ) ;
proto_register_field_array ( proto_adb , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
expert_module = expert_register_protocol ( proto_adb ) ;
expert_register_field_array ( expert_module , ei , array_length ( ei ) ) ;
module = prefs_register_protocol ( proto_adb , NULL ) ;
prefs_register_static_text_preference ( module , "version" , "ADB protocol version is compatible prior to: adb 1.0.31" , "Version of protocol supported by this dissector." ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_SEQUENCE_SIZE_1_256_OF_QOSCapability ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_SIZE_1_256_OF_QOSCapability , SEQUENCE_SIZE_1_256_OF_QOSCapability_sequence_of , 1 , 256 , FALSE ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void h263_encode_block ( MpegEncContext * s , int16_t * block , int n ) {
int level , run , last , i , j , last_index , last_non_zero , sign , slevel , code ;
RLTable * rl ;
rl = & ff_h263_rl_inter ;
if ( s -> mb_intra && ! s -> h263_aic ) {
level = block [ 0 ] ;
if ( level > 254 ) {
level = 254 ;
block [ 0 ] = 254 ;
}
else if ( level < 1 ) {
level = 1 ;
block [ 0 ] = 1 ;
}
if ( level == 128 ) put_bits ( & s -> pb , 8 , 0xff ) ;
else put_bits ( & s -> pb , 8 , level ) ;
i = 1 ;
}
else {
i = 0 ;
if ( s -> h263_aic && s -> mb_intra ) rl = & ff_rl_intra_aic ;
if ( s -> alt_inter_vlc && ! s -> mb_intra ) {
int aic_vlc_bits = 0 ;
int inter_vlc_bits = 0 ;
int wrong_pos = - 1 ;
int aic_code ;
last_index = s -> block_last_index [ n ] ;
last_non_zero = i - 1 ;
for ( ;
i <= last_index ;
i ++ ) {
j = s -> intra_scantable . permutated [ i ] ;
level = block [ j ] ;
if ( level ) {
run = i - last_non_zero - 1 ;
last = ( i == last_index ) ;
if ( level < 0 ) level = - level ;
code = get_rl_index ( rl , last , run , level ) ;
aic_code = get_rl_index ( & ff_rl_intra_aic , last , run , level ) ;
inter_vlc_bits += rl -> table_vlc [ code ] [ 1 ] + 1 ;
aic_vlc_bits += ff_rl_intra_aic . table_vlc [ aic_code ] [ 1 ] + 1 ;
if ( code == rl -> n ) {
inter_vlc_bits += 1 + 6 + 8 - 1 ;
}
if ( aic_code == ff_rl_intra_aic . n ) {
aic_vlc_bits += 1 + 6 + 8 - 1 ;
wrong_pos += run + 1 ;
}
else wrong_pos += wrong_run [ aic_code ] ;
last_non_zero = i ;
}
}
i = 0 ;
if ( aic_vlc_bits < inter_vlc_bits && wrong_pos > 63 ) rl = & ff_rl_intra_aic ;
}
}
last_index = s -> block_last_index [ n ] ;
last_non_zero = i - 1 ;
for ( ;
i <= last_index ;
i ++ ) {
j = s -> intra_scantable . permutated [ i ] ;
level = block [ j ] ;
if ( level ) {
run = i - last_non_zero - 1 ;
last = ( i == last_index ) ;
sign = 0 ;
slevel = level ;
if ( level < 0 ) {
sign = 1 ;
level = - level ;
}
code = get_rl_index ( rl , last , run , level ) ;
put_bits ( & s -> pb , rl -> table_vlc [ code ] [ 1 ] , rl -> table_vlc [ code ] [ 0 ] ) ;
if ( code == rl -> n ) {
if ( ! CONFIG_FLV_ENCODER || s -> h263_flv <= 1 ) {
put_bits ( & s -> pb , 1 , last ) ;
put_bits ( & s -> pb , 6 , run ) ;
assert ( slevel != 0 ) ;
if ( level < 128 ) put_sbits ( & s -> pb , 8 , slevel ) ;
else {
put_bits ( & s -> pb , 8 , 128 ) ;
put_sbits ( & s -> pb , 5 , slevel ) ;
put_sbits ( & s -> pb , 6 , slevel >> 5 ) ;
}
}
else {
ff_flv2_encode_ac_esc ( & s -> pb , slevel , level , run , last ) ;
}
}
else {
put_bits ( & s -> pb , 1 , sign ) ;
}
last_non_zero = i ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_idct16x16_add ( const tran_low_t * input , uint8_t * dest , int stride , int eob ) {
if ( eob == 1 ) vp9_idct16x16_1_add ( input , dest , stride ) ;
else if ( eob <= 10 ) vp9_idct16x16_10_add ( input , dest , stride ) ;
else vp9_idct16x16_256_add ( input , dest , stride ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
jas_stream_t * jas_stream_freopen ( const char * path , const char * mode , FILE * fp ) {
jas_stream_t * stream ;
int openflags ;
path = 0 ;
if ( ! ( stream = jas_stream_create ( ) ) ) {
return 0 ;
}
stream -> openmode_ = jas_strtoopenmode ( mode ) ;
if ( ( stream -> openmode_ & JAS_STREAM_READ ) && ( stream -> openmode_ & JAS_STREAM_WRITE ) ) {
openflags = O_RDWR ;
}
else if ( stream -> openmode_ & JAS_STREAM_READ ) {
openflags = O_RDONLY ;
}
else if ( stream -> openmode_ & JAS_STREAM_WRITE ) {
openflags = O_WRONLY ;
}
else {
openflags = 0 ;
}
if ( stream -> openmode_ & JAS_STREAM_APPEND ) {
openflags |= O_APPEND ;
}
if ( stream -> openmode_ & JAS_STREAM_BINARY ) {
openflags |= O_BINARY ;
}
if ( stream -> openmode_ & JAS_STREAM_CREATE ) {
openflags |= O_CREAT | O_TRUNC ;
}
stream -> obj_ = JAS_CAST ( void * , fp ) ;
stream -> ops_ = & jas_stream_sfileops ;
jas_stream_initbuf ( stream , JAS_STREAM_FULLBUF , 0 , 0 ) ;
return stream ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ;
return * sse ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int i2d_ ## name ( type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( itname ) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const ( type , name ) type * d2i_ ## name ( type * * a , const unsigned char * * in , long len ) ;
int i2d_ ## name ( const type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( name ) # define DECLARE_ASN1_NDEF_FUNCTION ( name ) int i2d_ ## name ## _NDEF ( name * a , unsigned char * * out ) ;
# define DECLARE_ASN1_FUNCTIONS_const ( name ) DECLARE_ASN1_ALLOC_FUNCTIONS ( name ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( name , name ) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name ( type , name ) type * name ## _new ( void ) ;
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ;
int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ;
int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void add_sconv_object ( struct archive * a , struct archive_string_conv * sc ) {
struct archive_string_conv * * psc ;
psc = & ( a -> sconv ) ;
while ( * psc != NULL ) psc = & ( ( * psc ) -> next ) ;
* psc = sc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int evhttp_parse_response_line ( struct evhttp_request * req , char * line ) {
char * protocol ;
char * number ;
char * readable ;
protocol = strsep ( & line , " " ) ;
if ( line == NULL ) return ( - 1 ) ;
number = strsep ( & line , " " ) ;
if ( line == NULL ) return ( - 1 ) ;
readable = line ;
if ( strcmp ( protocol , "HTTP/1.0" ) == 0 ) {
req -> major = 1 ;
req -> minor = 0 ;
}
else if ( strcmp ( protocol , "HTTP/1.1" ) == 0 ) {
req -> major = 1 ;
req -> minor = 1 ;
}
else {
event_debug ( ( "%s: bad protocol \"%s\"" , __func__ , protocol ) ) ;
return ( - 1 ) ;
}
req -> response_code = atoi ( number ) ;
if ( ! evhttp_valid_response_code ( req -> response_code ) ) {
event_debug ( ( "%s: bad response code \"%s\"" , __func__ , number ) ) ;
return ( - 1 ) ;
}
if ( ( req -> response_code_line = strdup ( readable ) ) == NULL ) event_err ( 1 , "%s: strdup" , __func__ ) ;
return ( 0 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( AccountChooserDialogAndroidTest , CheckHistogramsReportingManyAccounts ) {
base : : HistogramTester histogram_tester ;
AccountChooserDialogAndroid * dialog = CreateDialogManyAccounts ( ) ;
dialog -> OnCredentialClicked ( base : : android : : AttachCurrentThread ( ) , nullptr , , static_cast < int > ( password_manager : : CredentialType : : CREDENTIAL_TYPE_PASSWORD ) , false ) ;
dialog -> Destroy ( base : : android : : AttachCurrentThread ( ) , nullptr ) ;
histogram_tester . ExpectUniqueSample ( "PasswordManager.AccountChooserDialog" , password_manager : : metrics_util : : ACCOUNT_CHOOSER_CREDENTIAL_CHOSEN , 1 ) ;
histogram_tester . ExpectUniqueSample ( "PasswordManager.AccountChooserDialogMultipleAccounts" , password_manager : : metrics_util : : ACCOUNT_CHOOSER_CREDENTIAL_CHOSEN , 1 ) ;
histogram_tester . ExpectTotalCount ( "PasswordManager.AccountChooserDialogOneAccount" , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( FullscreenControllerInteractiveTest , DISABLED_BrowserFullscreenAfterTabFSExit ) {
ASSERT_NO_FATAL_FAILURE ( ToggleBrowserFullscreen ( true ) ) ;
AddTabAtIndex ( 0 , GURL ( url : : kAboutBlankURL ) , PAGE_TRANSITION_TYPED ) ;
ASSERT_NO_FATAL_FAILURE ( ToggleTabFullscreen ( true ) ) ;
ASSERT_NO_FATAL_FAILURE ( ToggleTabFullscreen ( false ) ) ;
ASSERT_TRUE ( IsFullscreenForBrowser ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int zstop ( i_ctx_t * i_ctx_p ) {
os_ptr op = osp ;
uint count = count_to_stopped ( i_ctx_p , 1L ) ;
if ( count ) {
check_ostack ( 2 ) ;
pop_estack ( i_ctx_p , count ) ;
op = osp ;
push ( 1 ) ;
make_true ( op ) ;
return o_pop_estack ;
}
push ( 2 ) ;
return unmatched_exit ( op , zstop ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_wbxml ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree ) {
dissect_wbxml_common ( tvb , pinfo , tree , NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void set_date_time ( unsigned char * p , time_t t ) {
struct tm tm ;
get_tmfromtime ( & tm , & t ) ;
set_digit ( p , 4 , tm . tm_year + 1900 ) ;
set_digit ( p + 4 , 2 , tm . tm_mon + 1 ) ;
set_digit ( p + 6 , 2 , tm . tm_mday ) ;
set_digit ( p + 8 , 2 , tm . tm_hour ) ;
set_digit ( p + 10 , 2 , tm . tm_min ) ;
set_digit ( p + 12 , 2 , tm . tm_sec ) ;
set_digit ( p + 14 , 2 , 0 ) ;
set_num_712 ( p + 16 , ( char ) ( get_gmoffset ( & tm ) / ( 60 * 15 ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static vpx_codec_err_t ctrl_set_svc_parameters ( vpx_codec_alg_priv_t * ctx , va_list args ) {
VP9_COMP * const cpi = ctx -> cpi ;
vpx_svc_extra_cfg_t * const params = va_arg ( args , vpx_svc_extra_cfg_t * ) ;
int i ;
for ( i = 0 ;
i < cpi -> svc . number_spatial_layers ;
++ i ) {
LAYER_CONTEXT * lc = & cpi -> svc . layer_context [ i ] ;
lc -> max_q = params -> max_quantizers [ i ] ;
lc -> min_q = params -> min_quantizers [ i ] ;
lc -> scaling_factor_num = params -> scaling_factor_num [ i ] ;
lc -> scaling_factor_den = params -> scaling_factor_den [ i ] ;
}
return VPX_CODEC_OK ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int zxcheck ( i_ctx_t * i_ctx_p ) {
os_ptr op = osp ;
check_op ( 1 ) ;
make_bool ( op , ( r_has_attr ( ACCESS_REF ( op ) , a_executable ) ? 1 : 0 ) ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void set_svc_parameters ( SvcContext * svc_ctx , vpx_codec_ctx_t * codec_ctx ) {
int layer , layer_index ;
vpx_svc_parameters_t svc_params ;
SvcInternal * const si = get_svc_internal ( svc_ctx ) ;
memset ( & svc_params , 0 , sizeof ( svc_params ) ) ;
svc_params . temporal_layer = 0 ;
svc_params . spatial_layer = si -> layer ;
layer = si -> layer ;
if ( VPX_CODEC_OK != vpx_svc_get_layer_resolution ( svc_ctx , layer , & svc_params . width , & svc_params . height ) ) {
svc_log ( svc_ctx , SVC_LOG_ERROR , "vpx_svc_get_layer_resolution failed\n" ) ;
}
layer_index = layer + VPX_SS_MAX_LAYERS - si -> layers ;
if ( codec_ctx -> config . enc -> g_pass == VPX_RC_ONE_PASS ) {
svc_params . min_quantizer = si -> quantizer [ layer_index ] ;
svc_params . max_quantizer = si -> quantizer [ layer_index ] ;
}
else {
svc_params . min_quantizer = codec_ctx -> config . enc -> rc_min_quantizer ;
svc_params . max_quantizer = codec_ctx -> config . enc -> rc_max_quantizer ;
}
svc_params . distance_from_i_frame = si -> frame_within_gop ;
vpx_codec_control ( codec_ctx , VP9E_SET_SVC_PARAMETERS , & svc_params ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_dct_quantize_c ( MpegEncContext * s , int16_t * block , int n , int qscale , int * overflow ) {
int i , j , level , last_non_zero , q , start_i ;
const int * qmat ;
const uint8_t * scantable = s -> intra_scantable . scantable ;
int bias ;
int max = 0 ;
unsigned int threshold1 , threshold2 ;
s -> dsp . fdct ( block ) ;
if ( s -> dct_error_sum ) s -> denoise_dct ( s , block ) ;
if ( s -> mb_intra ) {
if ( ! s -> h263_aic ) {
if ( n < 4 ) q = s -> y_dc_scale ;
else q = s -> c_dc_scale ;
q = q << 3 ;
}
else q = 1 << 3 ;
block [ 0 ] = ( block [ 0 ] + ( q >> 1 ) ) / q ;
start_i = 1 ;
last_non_zero = 0 ;
qmat = s -> q_intra_matrix [ qscale ] ;
bias = s -> intra_quant_bias << ( QMAT_SHIFT - QUANT_BIAS_SHIFT ) ;
}
else {
start_i = 0 ;
last_non_zero = - 1 ;
qmat = s -> q_inter_matrix [ qscale ] ;
bias = s -> inter_quant_bias << ( QMAT_SHIFT - QUANT_BIAS_SHIFT ) ;
}
threshold1 = ( 1 << QMAT_SHIFT ) - bias - 1 ;
threshold2 = ( threshold1 << 1 ) ;
for ( i = 63 ;
i >= start_i ;
i -- ) {
j = scantable [ i ] ;
level = block [ j ] * qmat [ j ] ;
if ( ( ( unsigned ) ( level + threshold1 ) ) > threshold2 ) {
last_non_zero = i ;
break ;
}
else {
block [ j ] = 0 ;
}
}
for ( i = start_i ;
i <= last_non_zero ;
i ++ ) {
j = scantable [ i ] ;
level = block [ j ] * qmat [ j ] ;
if ( ( ( unsigned ) ( level + threshold1 ) ) > threshold2 ) {
if ( level > 0 ) {
level = ( bias + level ) >> QMAT_SHIFT ;
block [ j ] = level ;
}
else {
level = ( bias - level ) >> QMAT_SHIFT ;
block [ j ] = - level ;
}
max |= level ;
}
else {
block [ j ] = 0 ;
}
}
* overflow = s -> max_qcoeff < max ;
if ( s -> dsp . idct_permutation_type != FF_NO_IDCT_PERM ) ff_block_permute ( block , s -> dsp . idct_permutation , scantable , last_non_zero ) ;
return last_non_zero ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dumpcomposite ( SplineChar * sc , struct glyphinfo * gi ) {
struct glyphhead gh ;
DBounds bb ;
int i , ptcnt , ctcnt , flags , sptcnt , rd ;
SplineSet * ss ;
RefChar * ref ;
SplineChar * isc = sc -> ttf_instrs == NULL && sc -> parent -> mm != NULL && sc -> parent -> mm -> apple ? sc -> parent -> mm -> normal -> glyphs [ sc -> orig_pos ] : sc ;
int arg1 , arg2 ;
if ( gi -> next_glyph != sc -> ttf_glyph ) IError ( "Glyph count wrong in ttf output" ) ;
if ( gi -> next_glyph >= gi -> maxp -> numGlyphs ) IError ( "max glyph count wrong in ttf output" ) ;
gi -> loca [ gi -> next_glyph ] = ftell ( gi -> glyphs ) ;
SplineCharLayerQuickBounds ( sc , gi -> layer , & bb ) ;
gh . numContours = - 1 ;
gh . xmin = floor ( bb . minx ) ;
gh . ymin = floor ( bb . miny ) ;
gh . xmax = ceil ( bb . maxx ) ;
gh . ymax = ceil ( bb . maxy ) ;
dumpghstruct ( gi , & gh ) ;
i = ptcnt = ctcnt = 0 ;
for ( ref = sc -> layers [ gi -> layer ] . refs ;
ref != NULL ;
ref = ref -> next , ++ i ) {
if ( ref -> sc -> ttf_glyph == - 1 ) {
continue ;
}
flags = 0 ;
if ( ref -> round_translation_to_grid ) flags |= _ROUND ;
if ( ref -> use_my_metrics ) flags |= _USE_MY_METRICS ;
if ( ref -> next != NULL ) flags |= _MORE ;
else if ( isc -> ttf_instrs_len != 0 ) flags |= _INSTR ;
if ( ref -> transform [ 1 ] != 0 || ref -> transform [ 2 ] != 0 ) flags |= _MATRIX ;
else if ( ref -> transform [ 0 ] != ref -> transform [ 3 ] ) flags |= _XY_SCALE ;
else if ( ref -> transform [ 0 ] != 1. ) flags |= _SCALE ;
if ( ref -> point_match ) {
arg1 = ref -> match_pt_base ;
arg2 = ref -> match_pt_ref ;
}
else {
arg1 = rint ( ref -> transform [ 4 ] ) ;
arg2 = rint ( ref -> transform [ 5 ] ) ;
flags |= _ARGS_ARE_XY | _UNSCALED_OFFSETS ;
}
if ( arg1 < - 128 || arg1 > 127 || arg2 < - 128 || arg2 > 127 ) flags |= _ARGS_ARE_WORDS ;
putshort ( gi -> glyphs , flags ) ;
putshort ( gi -> glyphs , ref -> sc -> ttf_glyph == - 1 ? 0 : ref -> sc -> ttf_glyph ) ;
if ( flags & _ARGS_ARE_WORDS ) {
putshort ( gi -> glyphs , ( short ) arg1 ) ;
putshort ( gi -> glyphs , ( short ) arg2 ) ;
}
else {
putc ( ( char ) arg1 , gi -> glyphs ) ;
putc ( ( char ) arg2 , gi -> glyphs ) ;
}
if ( flags & _MATRIX ) {
put2d14 ( gi -> glyphs , ref -> transform [ 0 ] ) ;
put2d14 ( gi -> glyphs , ref -> transform [ 1 ] ) ;
put2d14 ( gi -> glyphs , ref -> transform [ 2 ] ) ;
put2d14 ( gi -> glyphs , ref -> transform [ 3 ] ) ;
}
else if ( flags & _XY_SCALE ) {
put2d14 ( gi -> glyphs , ref -> transform [ 0 ] ) ;
put2d14 ( gi -> glyphs , ref -> transform [ 3 ] ) ;
}
else if ( flags & _SCALE ) {
put2d14 ( gi -> glyphs , ref -> transform [ 0 ] ) ;
}
sptcnt = SSTtfNumberPoints ( ref -> layers [ 0 ] . splines ) ;
for ( ss = ref -> layers [ 0 ] . splines ;
ss != NULL ;
ss = ss -> next ) {
++ ctcnt ;
}
if ( sc -> layers [ gi -> layer ] . order2 ) ptcnt += sptcnt ;
else if ( ptcnt >= 0 && gi -> pointcounts [ ref -> sc -> ttf_glyph == - 1 ? 0 : ref -> sc -> ttf_glyph ] >= 0 ) ptcnt += gi -> pointcounts [ ref -> sc -> ttf_glyph == - 1 ? 0 : ref -> sc -> ttf_glyph ] ;
else ptcnt = - 1 ;
rd = RefDepth ( ref , gi -> layer ) ;
if ( rd > gi -> maxp -> maxcomponentdepth ) gi -> maxp -> maxcomponentdepth = rd ;
}
if ( isc -> ttf_instrs_len != 0 ) dumpinstrs ( gi , isc -> ttf_instrs , isc -> ttf_instrs_len ) ;
gi -> pointcounts [ gi -> next_glyph ++ ] = ptcnt ;
if ( gi -> maxp -> maxnumcomponents < i ) gi -> maxp -> maxnumcomponents = i ;
if ( gi -> maxp -> maxCompositPts < ptcnt ) gi -> maxp -> maxCompositPts = ptcnt ;
if ( gi -> maxp -> maxCompositCtrs < ctcnt ) gi -> maxp -> maxCompositCtrs = ctcnt ;
ttfdumpmetrics ( sc , gi , & bb ) ;
if ( ftell ( gi -> glyphs ) & 1 ) putc ( '\0' , gi -> glyphs ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileInfo , getBasename ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
char * fname , * suffix = 0 ;
size_t flen ;
int slen = 0 , path_len ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|s" , & suffix , & slen ) == FAILURE ) {
return ;
}
spl_filesystem_object_get_path ( intern , & path_len TSRMLS_CC ) ;
if ( path_len && path_len < intern -> file_name_len ) {
fname = intern -> file_name + path_len + 1 ;
flen = intern -> file_name_len - ( path_len + 1 ) ;
}
else {
fname = intern -> file_name ;
flen = intern -> file_name_len ;
}
php_basename ( fname , flen , suffix , slen , & fname , & flen TSRMLS_CC ) ;
RETURN_STRINGL ( fname , flen , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , ReplacePageClassification ) {
TemplateURLData data ;
data . input_encodings . push_back ( "UTF-8" ) ;
data . SetURL ( "{
google:baseURL}
?{
google:pageClassification}
q={
searchTerms}
" ) ;
TemplateURL url ( data ) ;
EXPECT_TRUE ( url . url_ref ( ) . IsValid ( search_terms_data_ ) ) ;
ASSERT_TRUE ( url . url_ref ( ) . SupportsReplacement ( search_terms_data_ ) ) ;
TemplateURLRef : : SearchTermsArgs search_terms_args ( ASCIIToUTF16 ( "foo" ) ) ;
std : : string result = url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ;
EXPECT_EQ ( "http://www.google.com/?q=foo" , result ) ;
search_terms_args . page_classification = metrics : : OmniboxEventProto : : NTP ;
result = url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ;
EXPECT_EQ ( "http://www.google.com/?pgcl=1&q=foo" , result ) ;
search_terms_args . page_classification = metrics : : OmniboxEventProto : : HOME_PAGE ;
result = url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ;
EXPECT_EQ ( "http://www.google.com/?pgcl=3&q=foo" , result ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_h225_SupportedProtocols ( 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_h225_SupportedProtocols , SupportedProtocols_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , NewPage ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
GURL url = embedded_test_server ( ) -> GetURL ( "/title1.html" ) ;
auto waiter = CreatePageLoadMetricsWaiter ( ) ;
waiter -> AddPageExpectation ( TimingField : : FIRST_PAINT ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , url ) ;
waiter -> Wait ( ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramDomContentLoaded , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramLoad , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramFirstLayout , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramFirstPaint , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramParseDuration , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramParseBlockedOnScriptLoad , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramParseBlockedOnScriptExecution , 1 ) ;
NavigateToUntrackedUrl ( ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramPageLoadTotalBytes , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHistogramPageTimingForegroundDuration , 1 ) ;
const auto & entries = test_ukm_recorder_ -> GetMergedEntriesByName ( internal : : kUkmPageLoadEventName ) ;
EXPECT_EQ ( 1u , entries . size ( ) ) ;
for ( const auto & kv : entries ) {
test_ukm_recorder_ -> ExpectEntrySourceHasUrl ( kv . second . get ( ) , url ) ;
EXPECT_TRUE ( test_ukm_recorder_ -> EntryHasMetric ( kv . second . get ( ) , internal : : kUkmDomContentLoadedName ) ) ;
EXPECT_TRUE ( test_ukm_recorder_ -> EntryHasMetric ( kv . second . get ( ) , internal : : kUkmLoadEventName ) ) ;
EXPECT_TRUE ( test_ukm_recorder_ -> EntryHasMetric ( kv . second . get ( ) , internal : : kUkmFirstPaintName ) ) ;
EXPECT_TRUE ( test_ukm_recorder_ -> EntryHasMetric ( kv . second . get ( ) , internal : : kUkmFirstContentfulPaintName ) ) ;
}
EXPECT_FALSE ( NoPageLoadMetricsRecorded ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_dns_query ( tvbuff_t * tvb , int offset , int dns_data_offset , column_info * cinfo , proto_tree * dns_tree , gboolean is_mdns ) {
int len ;
const guchar * name ;
gchar * name_out ;
int name_len ;
int type ;
int dns_class ;
int qu ;
const char * type_name ;
int data_start ;
guint16 labels ;
proto_tree * q_tree ;
proto_item * tq ;
data_start = offset ;
len = get_dns_name_type_class ( tvb , offset , dns_data_offset , & name , & name_len , & type , & dns_class ) ;
if ( is_mdns ) {
qu = dns_class & C_QU ;
dns_class &= ~ C_QU ;
}
else {
qu = 0 ;
}
type_name = val_to_str_ext ( type , & dns_types_vals_ext , "Unknown (%d)" ) ;
name_out = format_text ( name , strlen ( name ) ) ;
if ( cinfo != NULL ) {
col_append_fstr ( cinfo , COL_INFO , "%s %s" , type_name , name_out ) ;
if ( is_mdns ) {
col_append_fstr ( cinfo , COL_INFO , ", \"%s\" question" , qu ? "QU" : "QM" ) ;
}
}
if ( dns_tree != NULL ) {
q_tree = proto_tree_add_subtree_format ( dns_tree , tvb , offset , len , ett_dns_qd , & tq , "%s: type %s, class %s" , name_out , type_name , val_to_str_const ( dns_class , dns_classes , "Unknown" ) ) ;
if ( is_mdns ) {
proto_item_append_text ( tq , ", \"%s\" question" , qu ? "QU" : "QM" ) ;
}
proto_tree_add_string ( q_tree , hf_dns_qry_name , tvb , offset , name_len , name ) ;
tq = proto_tree_add_uint ( q_tree , hf_dns_qry_name_len , tvb , offset , name_len , name_len > 1 ? ( guint32 ) strlen ( name ) : 0 ) ;
PROTO_ITEM_SET_GENERATED ( tq ) ;
labels = qname_labels_count ( name , name_len ) ;
tq = proto_tree_add_uint ( q_tree , hf_dns_count_labels , tvb , offset , name_len , labels ) ;
PROTO_ITEM_SET_GENERATED ( tq ) ;
offset += name_len ;
proto_tree_add_item ( q_tree , hf_dns_qry_type , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset += 2 ;
if ( is_mdns ) {
proto_tree_add_uint ( q_tree , hf_dns_qry_class_mdns , tvb , offset , 2 , dns_class ) ;
proto_tree_add_boolean ( q_tree , hf_dns_qry_qu , tvb , offset , 2 , qu ) ;
}
else {
proto_tree_add_uint ( q_tree , hf_dns_qry_class , tvb , offset , 2 , dns_class ) ;
}
offset += 2 ;
}
if ( data_start + len != offset ) {
}
return len ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
ParseResult mime_parser_parse ( MIMEParser * parser , HdrHeap * heap , MIMEHdrImpl * mh , const char * * real_s , const char * real_e , bool must_copy_strings , bool eof ) {
ParseResult err ;
bool line_is_real ;
const char * colon ;
const char * line_c ;
const char * line_s = nullptr ;
const char * line_e = nullptr ;
const char * field_name_first ;
const char * field_name_last ;
const char * field_value_first ;
const char * field_value_last ;
const char * field_line_first ;
const char * field_line_last ;
int field_name_length , field_value_length ;
MIMEScanner * scanner = & parser -> m_scanner ;
while ( true ) {
err = mime_scanner_get ( scanner , real_s , real_e , & line_s , & line_e , & line_is_real , eof , MIME_SCANNER_TYPE_FIELD ) ;
if ( err != PARSE_RESULT_OK ) {
return err ;
}
line_c = line_s ;
if ( ( line_e - line_c >= 2 ) && ( line_c [ 0 ] == ParseRules : : CHAR_CR ) && ( line_c [ 1 ] == ParseRules : : CHAR_LF ) ) {
return PARSE_RESULT_DONE ;
}
if ( ( line_e - line_c >= 1 ) && ( line_c [ 0 ] == ParseRules : : CHAR_LF ) ) {
return PARSE_RESULT_DONE ;
}
field_line_first = line_c ;
field_line_last = line_e - 1 ;
field_name_first = line_c ;
if ( ( ! ParseRules : : is_token ( * field_name_first ) ) && ( * field_name_first != '@' ) ) {
continue ;
}
colon = ( char * ) memchr ( line_c , ':' , ( line_e - line_c ) ) ;
if ( ! colon ) {
continue ;
}
field_name_last = colon - 1 ;
while ( ( field_name_last >= field_name_first ) && is_ws ( * field_name_last ) ) {
-- field_name_last ;
}
field_value_first = colon + 1 ;
while ( ( field_value_first < line_e ) && is_ws ( * field_value_first ) ) {
++ field_value_first ;
}
field_value_last = line_e - 1 ;
while ( ( field_value_last >= field_value_first ) && ParseRules : : is_wslfcr ( * field_value_last ) ) {
-- field_value_last ;
}
field_name_length = ( int ) ( field_name_last - field_name_first + 1 ) ;
field_value_length = ( int ) ( field_value_last - field_value_first + 1 ) ;
if ( field_name_length >= UINT16_MAX || field_value_length >= UINT16_MAX ) {
return PARSE_RESULT_ERROR ;
}
int total_line_length = ( int ) ( field_line_last - field_line_first + 1 ) ;
if ( must_copy_strings || ( ! line_is_real ) ) {
int length = total_line_length ;
char * dup = heap -> duplicate_str ( field_name_first , length ) ;
intptr_t delta = dup - field_name_first ;
field_name_first += delta ;
field_value_first += delta ;
}
int field_name_wks_idx = hdrtoken_tokenize ( field_name_first , field_name_length ) ;
MIMEField * field = mime_field_create ( heap , mh ) ;
mime_field_name_value_set ( heap , mh , field , field_name_wks_idx , field_name_first , field_name_length , field_value_first , field_value_length , true , total_line_length , false ) ;
mime_hdr_field_attach ( mh , field , 1 , nullptr ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BrowsingDataRemoverImplTest , ClearHttpAuthCache_RemoveCookies ) {
net : : HttpNetworkSession * http_session = content : : BrowserContext : : GetDefaultStoragePartition ( GetBrowserContext ( ) ) -> GetURLRequestContext ( ) -> GetURLRequestContext ( ) -> http_transaction_factory ( ) -> GetSession ( ) ;
DCHECK ( http_session ) ;
net : : HttpAuthCache * http_auth_cache = http_session -> http_auth_cache ( ) ;
http_auth_cache -> Add ( kOrigin1 , kTestRealm , net : : HttpAuth : : AUTH_SCHEME_BASIC , "test challenge" , net : : AuthCredentials ( base : : ASCIIToUTF16 ( "foo" ) , base : : ASCIIToUTF16 ( "bar" ) ) , "/" ) ;
CHECK ( http_auth_cache -> Lookup ( kOrigin1 , kTestRealm , net : : HttpAuth : : AUTH_SCHEME_BASIC ) ) ;
BlockUntilBrowsingDataRemoved ( base : : Time ( ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_COOKIES , false ) ;
EXPECT_EQ ( nullptr , http_auth_cache -> Lookup ( kOrigin1 , kTestRealm , net : : HttpAuth : : AUTH_SCHEME_BASIC ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_item_set_text ( proto_item * pi , const char * format , ... ) {
field_info * fi = NULL ;
va_list ap ;
TRY_TO_FAKE_THIS_REPR_VOID ( pi ) ;
fi = PITEM_FINFO ( pi ) ;
if ( fi == NULL ) return ;
if ( fi -> rep ) {
ITEM_LABEL_FREE ( PNODE_POOL ( pi ) , fi -> rep ) ;
fi -> rep = NULL ;
}
va_start ( ap , format ) ;
proto_tree_set_representation ( pi , format , ap ) ;
va_end ( ap ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void h223_lc_init ( void ) {
h223_lc_init_dir ( P2P_DIR_SENT ) ;
h223_lc_init_dir ( P2P_DIR_RECV ) ;
h223_lc_params_temp = NULL ;
h245_lc_dissector = NULL ;
h223_fw_lc_num = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int zfor_samples ( i_ctx_t * i_ctx_p ) {
os_ptr op = osp ;
es_ptr ep ;
check_type ( op [ - 3 ] , t_real ) ;
check_type ( op [ - 2 ] , t_integer ) ;
check_type ( op [ - 1 ] , t_real ) ;
check_proc ( * op ) ;
check_estack ( 8 ) ;
ep = esp + 7 ;
make_mark_estack ( ep - 6 , es_for , no_cleanup ) ;
make_int ( ep - 5 , 0 ) ;
memcpy ( ep - 4 , op - 3 , 3 * sizeof ( ref ) ) ;
ref_assign ( ep - 1 , op ) ;
make_op_estack ( ep , for_samples_continue ) ;
esp = ep ;
pop ( 4 ) ;
return o_push_estack ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ;
return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ;
\ }
void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ;
}
void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ;
}
unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ;
return * sse ;
}
VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) SUBPIX_AVG_VAR ( 8 , 16 ) VAR ( 16 , 8 ) SUBPIX_VAR ( 16 , 8 ) SUBPIX_AVG_VAR ( 16 , 8 ) VAR ( 16 , 16 ) SUBPIX_VAR ( 16 , 16 ) SUBPIX_AVG_VAR ( 16 , 16 ) VAR ( 16 , 32 ) SUBPIX_VAR ( 16 , 32 ) SUBPIX_AVG_VAR ( 16 , 32 ) VAR ( 32 , 16 ) SUBPIX_VAR ( 32 , 16 ) SUBPIX_AVG_VAR ( 32 , 16 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , HasSearchTermsReplacementKey ) {
TemplateURLData data ;
data . SetURL ( "http://google.com/?q={
searchTerms}
" ) ;
data . instant_url = "http://google.com/instant#q={
searchTerms}
" ;
data . alternate_urls . push_back ( "http://google.com/alt/#q={
searchTerms}
" ) ;
data . alternate_urls . push_back ( "http://google.com/alt/?ext=foo&q={
searchTerms}
#ref=bar" ) ;
data . search_terms_replacement_key = "espv" ;
TemplateURL url ( data ) ;
EXPECT_FALSE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?espv" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/#espv" ) ) ) ;
EXPECT_FALSE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?q=something&espv" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?q=something&espv=1" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?q=something&espv=0" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?espv&q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?espv=1&q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?espv=0&q=something" ) ) ) ;
EXPECT_FALSE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/alt/#q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/alt/#q=something&espv" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/alt/#q=something&espv=1" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/alt/#q=something&espv=0" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/alt/#espv&q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/alt/#espv=1&q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/alt/#espv=0&q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?espv#q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?espv=1#q=something" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?q=something#espv" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://google.com/?q=something#espv=1" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://bing.com/?espv" ) ) ) ;
EXPECT_TRUE ( url . HasSearchTermsReplacementKey ( GURL ( "http://bing.com/#espv" ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_rtpRedundancyEncoding ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_T_rtpRedundancyEncoding , T_rtpRedundancyEncoding_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void h225_calls_init_tap ( void ) {
GString * error_string ;
if ( have_H225_tap_listener == FALSE ) {
error_string = register_tap_listener ( "h225" , & ( the_tapinfo_struct . h225_dummy ) , NULL , 0 , voip_calls_dlg_reset , H225calls_packet , voip_calls_dlg_draw ) ;
if ( error_string != NULL ) {
simple_dialog ( ESD_TYPE_ERROR , ESD_BTN_OK , "%s" , error_string -> str ) ;
g_string_free ( error_string , TRUE ) ;
exit ( 1 ) ;
}
have_H225_tap_listener = TRUE ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE ossl_x509name_initialize ( int argc , VALUE * argv , VALUE self ) {
X509_NAME * name ;
VALUE arg , template ;
GetX509Name ( self , name ) ;
if ( rb_scan_args ( argc , argv , "02" , & arg , & template ) == 0 ) {
return self ;
}
else {
VALUE tmp = rb_check_array_type ( arg ) ;
if ( ! NIL_P ( tmp ) ) {
VALUE args ;
if ( NIL_P ( template ) ) template = OBJECT_TYPE_TEMPLATE ;
args = rb_ary_new3 ( 2 , self , template ) ;
rb_block_call ( tmp , rb_intern ( "each" ) , 0 , 0 , ossl_x509name_init_i , args ) ;
}
else {
const unsigned char * p ;
VALUE str = ossl_to_der_if_possible ( arg ) ;
X509_NAME * x ;
StringValue ( str ) ;
p = ( unsigned char * ) RSTRING_PTR ( str ) ;
x = d2i_X509_NAME ( & name , & p , RSTRING_LEN ( str ) ) ;
DATA_PTR ( self ) = name ;
if ( ! x ) {
ossl_raise ( eX509NameError , NULL ) ;
}
}
}
return self ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void stroke_route ( private_stroke_socket_t * this , stroke_msg_t * msg , FILE * out ) {
pop_string ( msg , & msg -> route . name ) ;
DBG1 ( DBG_CFG , "received stroke: route '%s'" , msg -> route . name ) ;
this -> control -> route ( this -> control , msg , out ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST ( IdlCompiler , PropertyValues ) {
EXPECT_EQ ( 42 , test : : api : : idl_properties : : first ) ;
EXPECT_EQ ( 42.1 , test : : api : : idl_properties : : second ) ;
EXPECT_STREQ ( "hello world" , test : : api : : idl_properties : : third ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dumpmissingglyph ( SplineFont * sf , struct glyphinfo * gi , int fixedwidth ) {
struct glyphhead gh ;
BasePoint bp [ 10 ] ;
uint8 instrs [ 50 ] ;
int stemcvt , stem ;
char * stempt ;
stem = 0 ;
if ( sf -> private != NULL && ( stempt = PSDictHasEntry ( sf -> private , "StdVW" ) ) != NULL ) stem = strtod ( stempt , NULL ) ;
else if ( sf -> private != NULL && ( stempt = PSDictHasEntry ( sf -> private , "StdHW" ) ) != NULL ) stem = strtod ( stempt , NULL ) ;
if ( stem <= 0 ) stem = ( sf -> ascent + sf -> descent ) / 30 ;
gi -> pointcounts [ gi -> next_glyph ] = 8 ;
gi -> loca [ gi -> next_glyph ++ ] = ftell ( gi -> glyphs ) ;
gi -> maxp -> maxContours = 2 ;
gh . numContours = 2 ;
gh . ymin = 0 ;
gh . ymax = 2 * ( sf -> ascent + sf -> descent ) / 3 ;
gh . xmax = 5 * stem + ( sf -> ascent + sf -> descent ) / 10 ;
gh . xmin = stem ;
gh . xmax += stem ;
if ( gh . ymax > sf -> ascent ) gh . ymax = sf -> ascent ;
dumpghstruct ( gi , & gh ) ;
bp [ 0 ] . x = stem ;
bp [ 0 ] . y = 0 ;
bp [ 1 ] . x = stem ;
bp [ 1 ] . y = gh . ymax ;
bp [ 2 ] . x = gh . xmax ;
bp [ 2 ] . y = gh . ymax ;
bp [ 3 ] . x = gh . xmax ;
bp [ 3 ] . y = 0 ;
bp [ 4 ] . x = 2 * stem ;
bp [ 4 ] . y = stem ;
bp [ 5 ] . x = gh . xmax - stem ;
bp [ 5 ] . y = stem ;
bp [ 6 ] . x = gh . xmax - stem ;
bp [ 6 ] . y = gh . ymax - stem ;
bp [ 7 ] . x = 2 * stem ;
bp [ 7 ] . y = gh . ymax - stem ;
if ( ! gi -> ttc_composite_font ) {
stemcvt = TTF_getcvtval ( gi -> sf , stem ) ;
instrs [ 0 ] = 0xb1 ;
instrs [ 1 ] = 1 ;
instrs [ 2 ] = 0 ;
instrs [ 3 ] = 0x2f ;
instrs [ 4 ] = 0x3c ;
instrs [ 5 ] = 0xb2 ;
instrs [ 6 ] = 7 ;
instrs [ 7 ] = 4 ;
instrs [ 8 ] = stemcvt ;
instrs [ 9 ] = 0xe0 + 0x0d ;
instrs [ 10 ] = 0x32 ;
instrs [ 11 ] = 0xb1 ;
instrs [ 12 ] = 6 ;
instrs [ 13 ] = 5 ;
instrs [ 14 ] = 0xc0 + 0x1c ;
instrs [ 15 ] = 0x3c ;
instrs [ 16 ] = 0xb2 ;
instrs [ 17 ] = 3 ;
instrs [ 18 ] = 2 ;
instrs [ 19 ] = stemcvt ;
instrs [ 20 ] = 0xe0 + 0x0d ;
instrs [ 21 ] = 0x32 ;
instrs [ 22 ] = 0x00 ;
instrs [ 23 ] = 0xb1 ;
instrs [ 24 ] = 3 ;
instrs [ 25 ] = 0 ;
instrs [ 26 ] = 0x2f ;
instrs [ 27 ] = 0x3c ;
instrs [ 28 ] = 0xb2 ;
instrs [ 29 ] = 5 ;
instrs [ 30 ] = 4 ;
instrs [ 31 ] = stemcvt ;
instrs [ 32 ] = 0xe0 + 0x0d ;
instrs [ 33 ] = 0x32 ;
instrs [ 34 ] = 0xb2 ;
instrs [ 35 ] = 7 ;
instrs [ 36 ] = 6 ;
instrs [ 37 ] = TTF_getcvtval ( gi -> sf , bp [ 6 ] . y ) ;
instrs [ 38 ] = 0xe0 + 0x1c ;
instrs [ 39 ] = 0x3c ;
instrs [ 40 ] = 0xb2 ;
instrs [ 41 ] = 1 ;
instrs [ 42 ] = 2 ;
instrs [ 43 ] = stemcvt ;
instrs [ 44 ] = 0xe0 + 0x0d ;
instrs [ 45 ] = 0x32 ;
}
putshort ( gi -> glyphs , 4 - 1 ) ;
putshort ( gi -> glyphs , 8 - 1 ) ;
if ( ! gi -> ttc_composite_font ) dumpinstrs ( gi , instrs , 46 ) ;
else dumpinstrs ( gi , NULL , 0 ) ;
dumppointarrays ( gi , bp , NULL , 8 ) ;
if ( fixedwidth <= 0 ) putshort ( gi -> hmtx , gh . xmax + 2 * stem ) ;
else putshort ( gi -> hmtx , fixedwidth ) ;
putshort ( gi -> hmtx , stem ) ;
if ( sf -> hasvmetrics ) {
putshort ( gi -> vmtx , sf -> ascent + sf -> descent ) ;
putshort ( gi -> vmtx , gh . ymax ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , hasChildren ) {
if ( zend_parse_parameters_none ( ) == FAILURE ) {
return ;
}
RETURN_FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void xsltFreeDocuments ( xsltTransformContextPtr ctxt ) {
xsltDocumentPtr doc , cur ;
cur = ctxt -> docList ;
while ( cur != NULL ) {
doc = cur ;
cur = cur -> next ;
xsltFreeDocumentKeys ( doc ) ;
if ( ! doc -> main ) xmlFreeDoc ( doc -> doc ) ;
xmlFree ( doc ) ;
}
cur = ctxt -> styleList ;
while ( cur != NULL ) {
doc = cur ;
cur = cur -> next ;
xsltFreeDocumentKeys ( doc ) ;
if ( ! doc -> main ) xmlFreeDoc ( doc -> doc ) ;
xmlFree ( doc ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSHttpTxnClientProtocolStackGet ( TSHttpTxn txnp , int n , const char * * result , int * actual ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
sdk_assert ( n == 0 || result != nullptr ) ;
HttpSM * sm = reinterpret_cast < HttpSM * > ( txnp ) ;
int count = 0 ;
if ( sm && n > 0 ) {
auto mem = static_cast < ts : : StringView * > ( alloca ( sizeof ( ts : : StringView ) * n ) ) ;
count = sm -> populate_client_protocol ( mem , n ) ;
for ( int i = 0 ;
i < count ;
++ i ) result [ i ] = mem [ i ] . ptr ( ) ;
}
if ( actual ) {
* actual = count ;
}
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp8_subtract_mby_c ( short * diff , unsigned char * src , int src_stride , unsigned char * pred , int pred_stride ) {
int r , c ;
for ( r = 0 ;
r < 16 ;
r ++ ) {
for ( c = 0 ;
c < 16 ;
c ++ ) {
diff [ c ] = src [ c ] - pred [ c ] ;
}
diff += 16 ;
pred += pred_stride ;
src += src_stride ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug8880 ( ) {
MYSQL_STMT * stmt_list [ 2 ] , * * stmt ;
MYSQL_STMT * * stmt_list_end = ( MYSQL_STMT * * ) stmt_list + 2 ;
int rc ;
myheader ( "test_bug8880" ) ;
mysql_query ( mysql , "drop table if exists t1" ) ;
mysql_query ( mysql , "create table t1 (a int not null primary key, b int)" ) ;
rc = mysql_query ( mysql , "insert into t1 values (1,1)" ) ;
myquery ( rc ) ;
for ( stmt = stmt_list ;
stmt < stmt_list_end ;
stmt ++ ) * stmt = open_cursor ( "select a from t1" ) ;
for ( stmt = stmt_list ;
stmt < stmt_list_end ;
stmt ++ ) {
rc = mysql_stmt_execute ( * stmt ) ;
check_execute ( * stmt , rc ) ;
}
for ( stmt = stmt_list ;
stmt < stmt_list_end ;
stmt ++ ) mysql_stmt_close ( * stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
chunk_t x509_build_crlDistributionPoints ( linked_list_t * list , int extn ) {
chunk_t crlDistributionPoints = chunk_empty ;
enumerator_t * enumerator ;
x509_cdp_t * cdp ;
if ( list -> get_count ( list ) == 0 ) {
return chunk_empty ;
}
enumerator = list -> create_enumerator ( list ) ;
while ( enumerator -> enumerate ( enumerator , & cdp ) ) {
chunk_t distributionPoint , crlIssuer = chunk_empty ;
if ( cdp -> issuer ) {
crlIssuer = asn1_wrap ( ASN1_CONTEXT_C_2 , "m" , build_generalName ( cdp -> issuer ) ) ;
}
distributionPoint = asn1_wrap ( ASN1_SEQUENCE , "mm" , asn1_wrap ( ASN1_CONTEXT_C_0 , "m" , asn1_wrap ( ASN1_CONTEXT_C_0 , "m" , asn1_wrap ( ASN1_CONTEXT_S_6 , "c" , chunk_create ( cdp -> uri , strlen ( cdp -> uri ) ) ) ) ) , crlIssuer ) ;
crlDistributionPoints = chunk_cat ( "mm" , crlDistributionPoints , distributionPoint ) ;
}
enumerator -> destroy ( enumerator ) ;
return asn1_wrap ( ASN1_SEQUENCE , "mm" , asn1_build_known_oid ( extn ) , asn1_wrap ( ASN1_OCTET_STRING , "m" , asn1_wrap ( ASN1_SEQUENCE , "m" , crlDistributionPoints ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rv40_loop_filter ( RV34DecContext * r , int row ) {
MpegEncContext * s = & r -> s ;
int mb_pos , mb_x ;
int i , j , k ;
uint8_t * Y , * C ;
int alpha , beta , betaY , betaC ;
int q ;
int mbtype [ 4 ] ;
int mb_strong [ 4 ] ;
int clip [ 4 ] ;
int cbp [ 4 ] ;
int uvcbp [ 4 ] [ 2 ] ;
unsigned mvmasks [ 4 ] ;
mb_pos = row * s -> mb_stride ;
for ( mb_x = 0 ;
mb_x < s -> mb_width ;
mb_x ++ , mb_pos ++ ) {
int mbtype = s -> current_picture_ptr -> mb_type [ mb_pos ] ;
if ( IS_INTRA ( mbtype ) || IS_SEPARATE_DC ( mbtype ) ) r -> cbp_luma [ mb_pos ] = r -> deblock_coefs [ mb_pos ] = 0xFFFF ;
if ( IS_INTRA ( mbtype ) ) r -> cbp_chroma [ mb_pos ] = 0xFF ;
}
mb_pos = row * s -> mb_stride ;
for ( mb_x = 0 ;
mb_x < s -> mb_width ;
mb_x ++ , mb_pos ++ ) {
int y_h_deblock , y_v_deblock ;
int c_v_deblock [ 2 ] , c_h_deblock [ 2 ] ;
int clip_left ;
int avail [ 4 ] ;
unsigned y_to_deblock ;
int c_to_deblock [ 2 ] ;
q = s -> current_picture_ptr -> qscale_table [ mb_pos ] ;
alpha = rv40_alpha_tab [ q ] ;
beta = rv40_beta_tab [ q ] ;
betaY = betaC = beta * 3 ;
if ( s -> width * s -> height <= 176 * 144 ) betaY += beta ;
avail [ 0 ] = 1 ;
avail [ 1 ] = row ;
avail [ 2 ] = mb_x ;
avail [ 3 ] = row < s -> mb_height - 1 ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
if ( avail [ i ] ) {
int pos = mb_pos + neighbour_offs_x [ i ] + neighbour_offs_y [ i ] * s -> mb_stride ;
mvmasks [ i ] = r -> deblock_coefs [ pos ] ;
mbtype [ i ] = s -> current_picture_ptr -> mb_type [ pos ] ;
cbp [ i ] = r -> cbp_luma [ pos ] ;
uvcbp [ i ] [ 0 ] = r -> cbp_chroma [ pos ] & 0xF ;
uvcbp [ i ] [ 1 ] = r -> cbp_chroma [ pos ] >> 4 ;
}
else {
mvmasks [ i ] = 0 ;
mbtype [ i ] = mbtype [ 0 ] ;
cbp [ i ] = 0 ;
uvcbp [ i ] [ 0 ] = uvcbp [ i ] [ 1 ] = 0 ;
}
mb_strong [ i ] = IS_INTRA ( mbtype [ i ] ) || IS_SEPARATE_DC ( mbtype [ i ] ) ;
clip [ i ] = rv40_filter_clip_tbl [ mb_strong [ i ] + 1 ] [ q ] ;
}
y_to_deblock = mvmasks [ POS_CUR ] | ( mvmasks [ POS_BOTTOM ] << 16 ) ;
y_h_deblock = y_to_deblock | ( ( cbp [ POS_CUR ] << 4 ) & ~ MASK_Y_TOP_ROW ) | ( ( cbp [ POS_TOP ] & MASK_Y_LAST_ROW ) >> 12 ) ;
y_v_deblock = y_to_deblock | ( ( cbp [ POS_CUR ] << 1 ) & ~ MASK_Y_LEFT_COL ) | ( ( cbp [ POS_LEFT ] & MASK_Y_RIGHT_COL ) >> 3 ) ;
if ( ! mb_x ) y_v_deblock &= ~ MASK_Y_LEFT_COL ;
if ( ! row ) y_h_deblock &= ~ MASK_Y_TOP_ROW ;
if ( row == s -> mb_height - 1 || ( mb_strong [ POS_CUR ] | mb_strong [ POS_BOTTOM ] ) ) y_h_deblock &= ~ ( MASK_Y_TOP_ROW << 16 ) ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
c_to_deblock [ i ] = ( uvcbp [ POS_BOTTOM ] [ i ] << 4 ) | uvcbp [ POS_CUR ] [ i ] ;
c_v_deblock [ i ] = c_to_deblock [ i ] | ( ( uvcbp [ POS_CUR ] [ i ] << 1 ) & ~ MASK_C_LEFT_COL ) | ( ( uvcbp [ POS_LEFT ] [ i ] & MASK_C_RIGHT_COL ) >> 1 ) ;
c_h_deblock [ i ] = c_to_deblock [ i ] | ( ( uvcbp [ POS_TOP ] [ i ] & MASK_C_LAST_ROW ) >> 2 ) | ( uvcbp [ POS_CUR ] [ i ] << 2 ) ;
if ( ! mb_x ) c_v_deblock [ i ] &= ~ MASK_C_LEFT_COL ;
if ( ! row ) c_h_deblock [ i ] &= ~ MASK_C_TOP_ROW ;
if ( row == s -> mb_height - 1 || ( mb_strong [ POS_CUR ] | mb_strong [ POS_BOTTOM ] ) ) c_h_deblock [ i ] &= ~ ( MASK_C_TOP_ROW << 4 ) ;
}
for ( j = 0 ;
j < 16 ;
j += 4 ) {
Y = s -> current_picture_ptr -> f . data [ 0 ] + mb_x * 16 + ( row * 16 + j ) * s -> linesize ;
for ( i = 0 ;
i < 4 ;
i ++ , Y += 4 ) {
int ij = i + j ;
int clip_cur = y_to_deblock & ( MASK_CUR << ij ) ? clip [ POS_CUR ] : 0 ;
int dither = j ? ij : i * 4 ;
if ( y_h_deblock & ( MASK_BOTTOM << ij ) ) {
rv40_adaptive_loop_filter ( & r -> rdsp , Y + 4 * s -> linesize , s -> linesize , dither , y_to_deblock & ( MASK_BOTTOM << ij ) ? clip [ POS_CUR ] : 0 , clip_cur , alpha , beta , betaY , 0 , 0 , 0 ) ;
}
if ( y_v_deblock & ( MASK_CUR << ij ) && ( i || ! ( mb_strong [ POS_CUR ] | mb_strong [ POS_LEFT ] ) ) ) {
if ( ! i ) clip_left = mvmasks [ POS_LEFT ] & ( MASK_RIGHT << j ) ? clip [ POS_LEFT ] : 0 ;
else clip_left = y_to_deblock & ( MASK_CUR << ( ij - 1 ) ) ? clip [ POS_CUR ] : 0 ;
rv40_adaptive_loop_filter ( & r -> rdsp , Y , s -> linesize , dither , clip_cur , clip_left , alpha , beta , betaY , 0 , 0 , 1 ) ;
}
if ( ! j && y_h_deblock & ( MASK_CUR << i ) && ( mb_strong [ POS_CUR ] | mb_strong [ POS_TOP ] ) ) {
rv40_adaptive_loop_filter ( & r -> rdsp , Y , s -> linesize , dither , clip_cur , mvmasks [ POS_TOP ] & ( MASK_TOP << i ) ? clip [ POS_TOP ] : 0 , alpha , beta , betaY , 0 , 1 , 0 ) ;
}
if ( y_v_deblock & ( MASK_CUR << ij ) && ! i && ( mb_strong [ POS_CUR ] | mb_strong [ POS_LEFT ] ) ) {
clip_left = mvmasks [ POS_LEFT ] & ( MASK_RIGHT << j ) ? clip [ POS_LEFT ] : 0 ;
rv40_adaptive_loop_filter ( & r -> rdsp , Y , s -> linesize , dither , clip_cur , clip_left , alpha , beta , betaY , 0 , 1 , 1 ) ;
}
}
}
for ( k = 0 ;
k < 2 ;
k ++ ) {
for ( j = 0 ;
j < 2 ;
j ++ ) {
C = s -> current_picture_ptr -> f . data [ k + 1 ] + mb_x * 8 + ( row * 8 + j * 4 ) * s -> uvlinesize ;
for ( i = 0 ;
i < 2 ;
i ++ , C += 4 ) {
int ij = i + j * 2 ;
int clip_cur = c_to_deblock [ k ] & ( MASK_CUR << ij ) ? clip [ POS_CUR ] : 0 ;
if ( c_h_deblock [ k ] & ( MASK_CUR << ( ij + 2 ) ) ) {
int clip_bot = c_to_deblock [ k ] & ( MASK_CUR << ( ij + 2 ) ) ? clip [ POS_CUR ] : 0 ;
rv40_adaptive_loop_filter ( & r -> rdsp , C + 4 * s -> uvlinesize , s -> uvlinesize , i * 8 , clip_bot , clip_cur , alpha , beta , betaC , 1 , 0 , 0 ) ;
}
if ( ( c_v_deblock [ k ] & ( MASK_CUR << ij ) ) && ( i || ! ( mb_strong [ POS_CUR ] | mb_strong [ POS_LEFT ] ) ) ) {
if ( ! i ) clip_left = uvcbp [ POS_LEFT ] [ k ] & ( MASK_CUR << ( 2 * j + 1 ) ) ? clip [ POS_LEFT ] : 0 ;
else clip_left = c_to_deblock [ k ] & ( MASK_CUR << ( ij - 1 ) ) ? clip [ POS_CUR ] : 0 ;
rv40_adaptive_loop_filter ( & r -> rdsp , C , s -> uvlinesize , j * 8 , clip_cur , clip_left , alpha , beta , betaC , 1 , 0 , 1 ) ;
}
if ( ! j && c_h_deblock [ k ] & ( MASK_CUR << ij ) && ( mb_strong [ POS_CUR ] | mb_strong [ POS_TOP ] ) ) {
int clip_top = uvcbp [ POS_TOP ] [ k ] & ( MASK_CUR << ( ij + 2 ) ) ? clip [ POS_TOP ] : 0 ;
rv40_adaptive_loop_filter ( & r -> rdsp , C , s -> uvlinesize , i * 8 , clip_cur , clip_top , alpha , beta , betaC , 1 , 1 , 0 ) ;
}
if ( c_v_deblock [ k ] & ( MASK_CUR << ij ) && ! i && ( mb_strong [ POS_CUR ] | mb_strong [ POS_LEFT ] ) ) {
clip_left = uvcbp [ POS_LEFT ] [ k ] & ( MASK_CUR << ( 2 * j + 1 ) ) ? clip [ POS_LEFT ] : 0 ;
rv40_adaptive_loop_filter ( & r -> rdsp , C , s -> uvlinesize , j * 8 , clip_cur , clip_left , alpha , beta , betaC , 1 , 1 , 1 ) ;
}
}
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * nbd_client_thread ( void * arg ) {
char * device = arg ;
off_t size ;
uint16_t nbdflags ;
QIOChannelSocket * sioc ;
int fd ;
int ret ;
pthread_t show_parts_thread ;
Error * local_error = NULL ;
sioc = qio_channel_socket_new ( ) ;
if ( qio_channel_socket_connect_sync ( sioc , saddr , & local_error ) < 0 ) {
error_report_err ( local_error ) ;
goto out ;
}
ret = nbd_receive_negotiate ( QIO_CHANNEL ( sioc ) , NULL , & nbdflags , NULL , NULL , NULL , & size , & local_error ) ;
if ( ret < 0 ) {
if ( local_error ) {
error_report_err ( local_error ) ;
}
goto out_socket ;
}
fd = open ( device , O_RDWR ) ;
if ( fd < 0 ) {
error_report ( "Failed to open %s: %m" , device ) ;
goto out_socket ;
}
ret = nbd_init ( fd , sioc , nbdflags , size , & local_error ) ;
if ( ret < 0 ) {
error_report_err ( local_error ) ;
goto out_fd ;
}
pthread_create ( & show_parts_thread , NULL , show_parts , device ) ;
if ( verbose ) {
fprintf ( stderr , "NBD device %s is now connected to %s\n" , device , srcpath ) ;
}
else {
dup2 ( STDOUT_FILENO , STDERR_FILENO ) ;
}
ret = nbd_client ( fd ) ;
if ( ret ) {
goto out_fd ;
}
close ( fd ) ;
object_unref ( OBJECT ( sioc ) ) ;
kill ( getpid ( ) , SIGTERM ) ;
return ( void * ) EXIT_SUCCESS ;
out_fd : close ( fd ) ;
out_socket : object_unref ( OBJECT ( sioc ) ) ;
out : kill ( getpid ( ) , SIGTERM ) ;
return ( void * ) EXIT_FAILURE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void alias_grab ( struct xml_alias_t * alias ) {
ithread_mutex_lock ( & gWebMutex ) ;
assert ( is_valid_alias ( & gAliasDoc ) ) ;
memcpy ( alias , & gAliasDoc , sizeof ( struct xml_alias_t ) ) ;
* alias -> ct = * alias -> ct + 1 ;
ithread_mutex_unlock ( & gWebMutex ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t get_send_time ( ASFContext * asf , int64_t pres_time , uint64_t * offset ) {
int i ;
int32_t send_time = 0 ;
* offset = asf -> data_offset + DATA_HEADER_SIZE ;
for ( i = 0 ;
i < asf -> next_start_sec ;
i ++ ) {
if ( pres_time <= asf -> index_ptr [ i ] . send_time ) break ;
send_time = asf -> index_ptr [ i ] . send_time ;
* offset = asf -> index_ptr [ i ] . offset ;
}
return send_time / 10000 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_q931_ie_cs7 ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
dissect_q931_IEs ( tvb , pinfo , NULL , tree , FALSE , 0 , 7 ) ;
return tvb_captured_length ( tvb ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSVConnTunnel ( TSVConn sslp ) {
NetVConnection * vc = reinterpret_cast < NetVConnection * > ( sslp ) ;
SSLNetVConnection * ssl_vc = dynamic_cast < SSLNetVConnection * > ( vc ) ;
TSReturnCode zret = TS_SUCCESS ;
if ( nullptr != ssl_vc ) {
ssl_vc -> hookOpRequested = SSL_HOOK_OP_TUNNEL ;
}
else {
zret = TS_ERROR ;
}
return zret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
extern rtype gnu_dev_ ## name proto __THROW __attribute_const__ ;
# define __SYSMACROS_IMPL_TEMPL ( rtype , name , proto ) __extension__ __extern_inline __attribute_const__ rtype __NTH ( gnu_dev_ ## name proto ) __BEGIN_DECLS __SYSMACROS_DECLARE_MAJOR ( __SYSMACROS_DECL_TEMPL )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void warnf ( struct GlobalConfig * config , const char * fmt , ... ) {
va_list ap ;
va_start ( ap , fmt ) ;
voutf ( config , WARN_PREFIX , fmt , ap ) ;
va_end ( ap ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void encode_mb_hq ( MpegEncContext * s , MpegEncContext * backup , MpegEncContext * best , int type , PutBitContext pb [ 2 ] , PutBitContext pb2 [ 2 ] , PutBitContext tex_pb [ 2 ] , int * dmin , int * next_block , int motion_x , int motion_y ) {
int score ;
uint8_t * dest_backup [ 3 ] ;
copy_context_before_encode ( s , backup , type ) ;
s -> block = s -> blocks [ * next_block ] ;
s -> pb = pb [ * next_block ] ;
if ( s -> data_partitioning ) {
s -> pb2 = pb2 [ * next_block ] ;
s -> tex_pb = tex_pb [ * next_block ] ;
}
if ( * next_block ) {
memcpy ( dest_backup , s -> dest , sizeof ( s -> dest ) ) ;
s -> dest [ 0 ] = s -> rd_scratchpad ;
s -> dest [ 1 ] = s -> rd_scratchpad + 16 * s -> linesize ;
s -> dest [ 2 ] = s -> rd_scratchpad + 16 * s -> linesize + 8 ;
assert ( s -> linesize >= 32 ) ;
}
encode_mb ( s , motion_x , motion_y ) ;
score = put_bits_count ( & s -> pb ) ;
if ( s -> data_partitioning ) {
score += put_bits_count ( & s -> pb2 ) ;
score += put_bits_count ( & s -> tex_pb ) ;
}
if ( s -> avctx -> mb_decision == FF_MB_DECISION_RD ) {
ff_MPV_decode_mb ( s , s -> block ) ;
score *= s -> lambda2 ;
score += sse_mb ( s ) << FF_LAMBDA_SHIFT ;
}
if ( * next_block ) {
memcpy ( s -> dest , dest_backup , sizeof ( s -> dest ) ) ;
}
if ( score < * dmin ) {
* dmin = score ;
* next_block ^= 1 ;
copy_context_after_encode ( best , s , type ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static Dwarf_Endianness dwarf_elf_object_access_get_byte_order ( void * obj_in ) {
dwarf_elf_object_access_internals_t * obj = ( dwarf_elf_object_access_internals_t * ) obj_in ;
return obj -> endianness ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_block_energy ( VP9_COMP * cpi , MACROBLOCK * x , BLOCK_SIZE bs ) {
double energy ;
unsigned int var = block_variance ( cpi , x , bs ) ;
vp9_clear_system_state ( ) ;
energy = 0.9 * ( log ( var + 1.0 ) - 10.0 ) ;
return clamp ( ( int ) round ( energy ) , ENERGY_MIN , ENERGY_MAX ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int strtoint_clipped ( const char * const str , int min , int max ) {
int r = strtoint ( str ) ;
if ( r == - 1 ) return r ;
else if ( r < min ) return min ;
else if ( r > max ) return max ;
else return r ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void copy_sbr_grid ( SBRData * dst , const SBRData * src ) {
dst -> bs_freq_res [ 0 ] = dst -> bs_freq_res [ dst -> bs_num_env ] ;
dst -> t_env_num_env_old = dst -> t_env [ dst -> bs_num_env ] ;
dst -> e_a [ 0 ] = - ( dst -> e_a [ 1 ] != dst -> bs_num_env ) ;
memcpy ( dst -> bs_freq_res + 1 , src -> bs_freq_res + 1 , sizeof ( dst -> bs_freq_res ) - sizeof ( * dst -> bs_freq_res ) ) ;
memcpy ( dst -> t_env , src -> t_env , sizeof ( dst -> t_env ) ) ;
memcpy ( dst -> t_q , src -> t_q , sizeof ( dst -> t_q ) ) ;
dst -> bs_num_env = src -> bs_num_env ;
dst -> bs_amp_res = src -> bs_amp_res ;
dst -> bs_num_noise = src -> bs_num_noise ;
dst -> bs_frame_class = src -> bs_frame_class ;
dst -> e_a [ 1 ] = src -> e_a [ 1 ] ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static u_short count_var ( const struct ctl_var * k ) {
u_int c ;
if ( NULL == k ) return 0 ;
c = 0 ;
while ( ! ( EOV & ( k ++ ) -> flags ) ) c ++ ;
ENSURE ( c <= USHRT_MAX ) ;
return ( u_short ) c ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t xhci_nec_challenge ( uint32_t hi , uint32_t lo ) {
uint32_t val ;
val = rotl ( lo - 0x49434878 , 32 - ( ( hi >> 8 ) & 0x1F ) ) ;
val += rotl ( lo + 0x49434878 , hi & 0x1F ) ;
val -= rotl ( hi ^ 0x49434878 , ( lo >> 16 ) & 0x1F ) ;
return ~ val ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ztoken_scanner_options ( const ref * upref , int old_options ) {
int options = old_options ;
int i ;
for ( i = 0 ;
i < countof ( named_options ) ;
++ i ) {
const named_scanner_option_t * pnso = & named_options [ i ] ;
ref * ppcproc ;
int code = dict_find_string ( upref , pnso -> pname , & ppcproc ) ;
if ( code >= 0 ) {
if ( r_has_type ( ppcproc , t_null ) ) options &= ~ pnso -> option ;
else options |= pnso -> option ;
}
}
return options ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ;
}
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) {
return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ;
}
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_DisengageReason ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 636 "./asn1/h225/h225.cnf" gint32 value ;
h225_packet_info * h225_pi ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_DisengageReason , DisengageReason_choice , & value ) ;
if ( h225_pi != NULL ) {
h225_pi -> reason = value ;
}
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int xsltSetSecurityPrefs ( xsltSecurityPrefsPtr sec , xsltSecurityOption option , xsltSecurityCheck func ) {
xsltInitGlobals ( ) ;
if ( sec == NULL ) return ( - 1 ) ;
switch ( option ) {
case XSLT_SECPREF_READ_FILE : sec -> readFile = func ;
return ( 0 ) ;
case XSLT_SECPREF_WRITE_FILE : sec -> createFile = func ;
return ( 0 ) ;
case XSLT_SECPREF_CREATE_DIRECTORY : sec -> createDir = func ;
return ( 0 ) ;
case XSLT_SECPREF_READ_NETWORK : sec -> readNet = func ;
return ( 0 ) ;
case XSLT_SECPREF_WRITE_NETWORK : sec -> writeNet = func ;
return ( 0 ) ;
}
return ( - 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void decode_mb_p ( AVSContext * h , enum cavs_mb mb_type ) {
GetBitContext * gb = & h -> gb ;
int ref [ 4 ] ;
ff_cavs_init_mb ( h ) ;
switch ( mb_type ) {
case P_SKIP : ff_cavs_mv ( h , MV_FWD_X0 , MV_FWD_C2 , MV_PRED_PSKIP , BLK_16X16 , 0 ) ;
break ;
case P_16X16 : ref [ 0 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ff_cavs_mv ( h , MV_FWD_X0 , MV_FWD_C2 , MV_PRED_MEDIAN , BLK_16X16 , ref [ 0 ] ) ;
break ;
case P_16X8 : ref [ 0 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ref [ 2 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ff_cavs_mv ( h , MV_FWD_X0 , MV_FWD_C2 , MV_PRED_TOP , BLK_16X8 , ref [ 0 ] ) ;
ff_cavs_mv ( h , MV_FWD_X2 , MV_FWD_A1 , MV_PRED_LEFT , BLK_16X8 , ref [ 2 ] ) ;
break ;
case P_8X16 : ref [ 0 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ref [ 1 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ff_cavs_mv ( h , MV_FWD_X0 , MV_FWD_B3 , MV_PRED_LEFT , BLK_8X16 , ref [ 0 ] ) ;
ff_cavs_mv ( h , MV_FWD_X1 , MV_FWD_C2 , MV_PRED_TOPRIGHT , BLK_8X16 , ref [ 1 ] ) ;
break ;
case P_8X8 : ref [ 0 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ref [ 1 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ref [ 2 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ref [ 3 ] = h -> ref_flag ? 0 : get_bits1 ( gb ) ;
ff_cavs_mv ( h , MV_FWD_X0 , MV_FWD_B3 , MV_PRED_MEDIAN , BLK_8X8 , ref [ 0 ] ) ;
ff_cavs_mv ( h , MV_FWD_X1 , MV_FWD_C2 , MV_PRED_MEDIAN , BLK_8X8 , ref [ 1 ] ) ;
ff_cavs_mv ( h , MV_FWD_X2 , MV_FWD_X1 , MV_PRED_MEDIAN , BLK_8X8 , ref [ 2 ] ) ;
ff_cavs_mv ( h , MV_FWD_X3 , MV_FWD_X0 , MV_PRED_MEDIAN , BLK_8X8 , ref [ 3 ] ) ;
}
ff_cavs_inter ( h , mb_type ) ;
set_intra_mode_default ( h ) ;
store_mvs ( h ) ;
if ( mb_type != P_SKIP ) decode_residual_inter ( h ) ;
ff_cavs_filter ( h , mb_type ) ;
h -> col_type_base [ h -> mbidx ] = mb_type ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static unsigned int block_variance ( VP9_COMP * cpi , MACROBLOCK * x , BLOCK_SIZE bs ) {
MACROBLOCKD * xd = & x -> e_mbd ;
unsigned int var , sse ;
int right_overflow = ( xd -> mb_to_right_edge < 0 ) ? ( ( - xd -> mb_to_right_edge ) >> 3 ) : 0 ;
int bottom_overflow = ( xd -> mb_to_bottom_edge < 0 ) ? ( ( - xd -> mb_to_bottom_edge ) >> 3 ) : 0 ;
if ( right_overflow || bottom_overflow ) {
const int bw = 8 * num_8x8_blocks_wide_lookup [ bs ] - right_overflow ;
const int bh = 8 * num_8x8_blocks_high_lookup [ bs ] - bottom_overflow ;
int avg ;
variance ( x -> plane [ 0 ] . src . buf , x -> plane [ 0 ] . src . stride , vp9_64_zeros , 0 , bw , bh , & sse , & avg ) ;
var = sse - ( ( ( int64_t ) avg * avg ) / ( bw * bh ) ) ;
return ( 256 * var ) / ( bw * bh ) ;
}
else {
var = cpi -> fn_ptr [ bs ] . vf ( x -> plane [ 0 ] . src . buf , x -> plane [ 0 ] . src . stride , vp9_64_zeros , 0 , & sse ) ;
return ( 256 * var ) >> num_pels_log2_lookup [ bs ] ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_T_standard ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 862 "./asn1/h225/h225.cnf" guint32 value_int = ( guint32 ) - 1 ;
gef_ctx_t * gefx ;
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 16383U , & value_int , TRUE ) ;
gefx = gef_ctx_get ( actx -> private_data ) ;
if ( gefx ) gefx -> id = wmem_strdup_printf ( wmem_packet_scope ( ) , "%u" , value_int ) ;
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void evhttp_send_reply_start ( struct evhttp_request * req , int code , const char * reason ) {
evhttp_response_code ( req , code , reason ) ;
if ( req -> major == 1 && req -> minor == 1 ) {
evhttp_add_header ( req -> output_headers , "Transfer-Encoding" , "chunked" ) ;
req -> chunked = 1 ;
}
evhttp_make_header ( req -> evcon , req ) ;
evhttp_write_buffer ( req -> evcon , NULL , NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_cc_progress ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
is_uplink = IS_UPLINK_FALSE ;
ELEM_MAND_LV ( GSM_A_PDU_TYPE_DTAP , DE_PROG_IND , NULL ) ;
ELEM_OPT_TLV ( 0x7e , GSM_A_PDU_TYPE_DTAP , DE_USER_USER , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.