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 const char * cmd_audit_log_type ( cmd_parms * cmd , void * _dcfg , const char * p1 ) {
directory_config * dcfg = _dcfg ;
if ( strcasecmp ( p1 , "Serial" ) == 0 ) dcfg -> auditlog_type = AUDITLOG_SERIAL ;
else if ( strcasecmp ( p1 , "Concurrent" ) == 0 ) dcfg -> auditlog_type = AUDITLOG_CONCURRENT ;
else return ( const char * ) apr_psprintf ( cmd -> pool , "ModSecurity: Unrecognised parameter value for SecAuditLogType: %s" , p1 ) ;
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void put_frame ( AVFormatContext * s , ASFStream * stream , AVStream * avst , int64_t timestamp , const uint8_t * buf , int m_obj_size , int flags ) {
ASFContext * asf = s -> priv_data ;
int m_obj_offset , payload_len , frag_len1 ;
m_obj_offset = 0 ;
while ( m_obj_offset < m_obj_size ) {
payload_len = m_obj_size - m_obj_offset ;
if ( asf -> packet_timestamp_start == - 1 ) {
asf -> multi_payloads_present = ( payload_len < MULTI_PAYLOAD_CONSTANT ) ;
asf -> packet_size_left = PACKET_SIZE ;
if ( asf -> multi_payloads_present ) {
frag_len1 = MULTI_PAYLOAD_CONSTANT - 1 ;
}
else {
frag_len1 = SINGLE_PAYLOAD_DATA_LENGTH ;
}
asf -> packet_timestamp_start = timestamp ;
}
else {
frag_len1 = asf -> packet_size_left - PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS - PACKET_HEADER_MIN_SIZE - 1 ;
if ( frag_len1 < payload_len && avst -> codec -> codec_type == AVMEDIA_TYPE_AUDIO ) {
flush_packet ( s ) ;
continue ;
}
if ( asf -> packet_timestamp_start > INT64_MAX - UINT16_MAX || timestamp > asf -> packet_timestamp_start + UINT16_MAX ) {
flush_packet ( s ) ;
continue ;
}
}
if ( frag_len1 > 0 ) {
if ( payload_len > frag_len1 ) payload_len = frag_len1 ;
else if ( payload_len == ( frag_len1 - 1 ) ) payload_len = frag_len1 - 2 ;
put_payload_header ( s , stream , timestamp + PREROLL_TIME , m_obj_size , m_obj_offset , payload_len , flags ) ;
avio_write ( & asf -> pb , buf , payload_len ) ;
if ( asf -> multi_payloads_present ) asf -> packet_size_left -= ( payload_len + PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS ) ;
else asf -> packet_size_left -= ( payload_len + PAYLOAD_HEADER_SIZE_SINGLE_PAYLOAD ) ;
asf -> packet_timestamp_end = timestamp ;
asf -> packet_nb_payloads ++ ;
}
else {
payload_len = 0 ;
}
m_obj_offset += payload_len ;
buf += payload_len ;
if ( ! asf -> multi_payloads_present ) flush_packet ( s ) ;
else if ( asf -> packet_size_left <= ( PAYLOAD_HEADER_SIZE_MULTIPLE_PAYLOADS + PACKET_HEADER_MIN_SIZE + 1 ) ) flush_packet ( s ) ;
else if ( asf -> packet_nb_payloads == ASF_PAYLOADS_PER_PACKET ) flush_packet ( s ) ;
}
stream -> seq ++ ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void pk_transaction_init ( PkTransaction * transaction ) {
gboolean ret ;
g_autoptr ( GError ) error = NULL ;
transaction -> priv = PK_TRANSACTION_GET_PRIVATE ( transaction ) ;
transaction -> priv -> allow_cancel = TRUE ;
transaction -> priv -> caller_active = TRUE ;
transaction -> priv -> cached_transaction_flags = PK_TRANSACTION_FLAG_ENUM_NONE ;
transaction -> priv -> cached_filters = PK_FILTER_ENUM_NONE ;
transaction -> priv -> uid = PK_TRANSACTION_UID_INVALID ;
transaction -> priv -> role = PK_ROLE_ENUM_UNKNOWN ;
transaction -> priv -> status = PK_STATUS_ENUM_WAIT ;
transaction -> priv -> percentage = PK_BACKEND_PERCENTAGE_INVALID ;
transaction -> priv -> state = PK_TRANSACTION_STATE_UNKNOWN ;
transaction -> priv -> dbus = pk_dbus_new ( ) ;
transaction -> priv -> results = pk_results_new ( ) ;
transaction -> priv -> supported_content_types = g_ptr_array_new_with_free_func ( g_free ) ;
transaction -> priv -> authority = polkit_authority_get_sync ( NULL , & error ) ;
if ( transaction -> priv -> authority == NULL ) g_error ( "failed to get pokit authority: %s" , error -> message ) ;
transaction -> priv -> cancellable = g_cancellable_new ( ) ;
transaction -> priv -> transaction_db = pk_transaction_db_new ( ) ;
ret = pk_transaction_db_load ( transaction -> priv -> transaction_db , & error ) ;
if ( ! ret ) g_error ( "PkEngine: failed to load transaction db: %s" , error -> message ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( SyncBookmarkDataTypeControllerTest , StartDependentsReady ) {
CreateBookmarkModel ( LOAD_MODEL ) ;
SetStartExpectations ( ) ;
SetAssociateExpectations ( ) ;
EXPECT_EQ ( DataTypeController : : NOT_RUNNING , bookmark_dtc_ -> state ( ) ) ;
EXPECT_CALL ( start_callback_ , Run ( DataTypeController : : OK , _ , _ ) ) ;
Start ( ) ;
EXPECT_EQ ( DataTypeController : : RUNNING , bookmark_dtc_ -> state ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | extern int name ( int , locale_t ) __THROW __exctype_l ( isalnum_l ) ;
__exctype_l ( isalpha_l ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( TtsControllerTest , TestGetMatchingVoice ) {
std : : unique_ptr < TestableTtsController > tts_controller = std : : make_unique < TestableTtsController > ( ) ;
# if defined ( OS_CHROMEOS ) TestingPrefServiceSimple pref_service_ ;
std : : unique_ptr < base : : DictionaryValue > lang_to_voices = std : : make_unique < base : : DictionaryValue > ( ) ;
lang_to_voices -> SetKey ( "es" , base : : Value ( "{
\"name\":\"Voice8\",\"extension\":\"id8\"}
" ) ) ;
lang_to_voices -> SetKey ( "noLanguage" , base : : Value ( "{
\"name\":\"Android\",\"extension\":\"\"}
" ) ) ;
pref_service_ . registry ( ) -> RegisterDictionaryPref ( prefs : : kTextToSpeechLangToVoiceName , std : : move ( lang_to_voices ) ) ;
tts_controller -> pref_service_ = & pref_service_ ;
# endif {
Utterance utterance ( nullptr ) ;
std : : vector < VoiceData > voices ;
EXPECT_EQ ( - 1 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
}
{
Utterance utterance ( nullptr ) ;
std : : vector < VoiceData > voices ;
voices . push_back ( VoiceData ( ) ) ;
voices . push_back ( VoiceData ( ) ) ;
EXPECT_EQ ( 0 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
}
{
Utterance utterance ( nullptr ) ;
std : : vector < VoiceData > voices ;
VoiceData fr_voice ;
fr_voice . lang = "fr" ;
voices . push_back ( fr_voice ) ;
VoiceData en_voice ;
en_voice . lang = "en" ;
voices . push_back ( en_voice ) ;
VoiceData de_voice ;
de_voice . lang = "de" ;
voices . push_back ( de_voice ) ;
EXPECT_EQ ( 1 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
}
{
std : : vector < VoiceData > voices ;
VoiceData voice0 ;
voices . push_back ( voice0 ) ;
VoiceData voice1 ;
voice1 . gender = TTS_GENDER_FEMALE ;
voices . push_back ( voice1 ) ;
VoiceData voice2 ;
voice2 . events . insert ( TTS_EVENT_WORD ) ;
voices . push_back ( voice2 ) ;
VoiceData voice3 ;
voice3 . lang = "de-DE" ;
voices . push_back ( voice3 ) ;
VoiceData voice4 ;
voice4 . lang = "fr-CA" ;
voices . push_back ( voice4 ) ;
VoiceData voice5 ;
voice5 . name = "Voice5" ;
voices . push_back ( voice5 ) ;
VoiceData voice6 ;
voice6 . extension_id = "id6" ;
voices . push_back ( voice6 ) ;
VoiceData voice7 ;
voice7 . extension_id = "id7" ;
voice7 . name = "Voice7" ;
voice7 . lang = "es-es" ;
voices . push_back ( voice7 ) ;
VoiceData voice8 ;
voice8 . extension_id = "id8" ;
voice8 . name = "Voice8" ;
voice8 . lang = "es-mx" ;
voices . push_back ( voice8 ) ;
VoiceData voice9 ;
voice9 . extension_id = "" ;
voice9 . name = "Android" ;
voice9 . lang = "" ;
voice9 . native = true ;
voices . push_back ( voice9 ) ;
Utterance utterance ( nullptr ) ;
EXPECT_EQ ( 0 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
utterance . set_gender ( TTS_GENDER_FEMALE ) ;
EXPECT_EQ ( 1 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
std : : set < TtsEventType > types ;
types . insert ( TTS_EVENT_WORD ) ;
utterance . set_required_event_types ( types ) ;
EXPECT_EQ ( 2 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
utterance . set_lang ( "de-DE" ) ;
EXPECT_EQ ( 3 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
utterance . set_lang ( "fr-FR" ) ;
EXPECT_EQ ( 4 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
utterance . set_voice_name ( "Voice5" ) ;
EXPECT_EQ ( 5 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
utterance . set_voice_name ( "" ) ;
utterance . set_extension_id ( "id6" ) ;
EXPECT_EQ ( 6 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
# if defined ( OS_CHROMEOS ) utterance . set_extension_id ( "" ) ;
utterance . set_lang ( "es-es" ) ;
EXPECT_EQ ( 7 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
utterance . set_extension_id ( "" ) ;
utterance . set_lang ( "es-ar" ) ;
EXPECT_EQ ( 8 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
utterance . set_voice_name ( "Android" ) ;
utterance . set_extension_id ( "" ) ;
utterance . set_lang ( "" ) ;
EXPECT_EQ ( 9 , tts_controller -> GetMatchingVoice ( & utterance , voices ) ) ;
# endif }
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void pcnet_init ( PCNetState * s ) {
int rlen , tlen ;
uint16_t padr [ 3 ] , ladrf [ 4 ] , mode ;
uint32_t rdra , tdra ;
trace_pcnet_init ( s , PHYSADDR ( s , CSR_IADR ( s ) ) ) ;
if ( BCR_SSIZE32 ( s ) ) {
struct pcnet_initblk32 initblk ;
s -> phys_mem_read ( s -> dma_opaque , PHYSADDR ( s , CSR_IADR ( s ) ) , ( uint8_t * ) & initblk , sizeof ( initblk ) , 0 ) ;
mode = le16_to_cpu ( initblk . mode ) ;
rlen = initblk . rlen >> 4 ;
tlen = initblk . tlen >> 4 ;
ladrf [ 0 ] = le16_to_cpu ( initblk . ladrf [ 0 ] ) ;
ladrf [ 1 ] = le16_to_cpu ( initblk . ladrf [ 1 ] ) ;
ladrf [ 2 ] = le16_to_cpu ( initblk . ladrf [ 2 ] ) ;
ladrf [ 3 ] = le16_to_cpu ( initblk . ladrf [ 3 ] ) ;
padr [ 0 ] = le16_to_cpu ( initblk . padr [ 0 ] ) ;
padr [ 1 ] = le16_to_cpu ( initblk . padr [ 1 ] ) ;
padr [ 2 ] = le16_to_cpu ( initblk . padr [ 2 ] ) ;
rdra = le32_to_cpu ( initblk . rdra ) ;
tdra = le32_to_cpu ( initblk . tdra ) ;
}
else {
struct pcnet_initblk16 initblk ;
s -> phys_mem_read ( s -> dma_opaque , PHYSADDR ( s , CSR_IADR ( s ) ) , ( uint8_t * ) & initblk , sizeof ( initblk ) , 0 ) ;
mode = le16_to_cpu ( initblk . mode ) ;
ladrf [ 0 ] = le16_to_cpu ( initblk . ladrf [ 0 ] ) ;
ladrf [ 1 ] = le16_to_cpu ( initblk . ladrf [ 1 ] ) ;
ladrf [ 2 ] = le16_to_cpu ( initblk . ladrf [ 2 ] ) ;
ladrf [ 3 ] = le16_to_cpu ( initblk . ladrf [ 3 ] ) ;
padr [ 0 ] = le16_to_cpu ( initblk . padr [ 0 ] ) ;
padr [ 1 ] = le16_to_cpu ( initblk . padr [ 1 ] ) ;
padr [ 2 ] = le16_to_cpu ( initblk . padr [ 2 ] ) ;
rdra = le32_to_cpu ( initblk . rdra ) ;
tdra = le32_to_cpu ( initblk . tdra ) ;
rlen = rdra >> 29 ;
tlen = tdra >> 29 ;
rdra &= 0x00ffffff ;
tdra &= 0x00ffffff ;
}
trace_pcnet_rlen_tlen ( s , rlen , tlen ) ;
CSR_RCVRL ( s ) = ( rlen < 9 ) ? ( 1 << rlen ) : 512 ;
CSR_XMTRL ( s ) = ( tlen < 9 ) ? ( 1 << tlen ) : 512 ;
s -> csr [ 6 ] = ( tlen << 12 ) | ( rlen << 8 ) ;
s -> csr [ 15 ] = mode ;
s -> csr [ 8 ] = ladrf [ 0 ] ;
s -> csr [ 9 ] = ladrf [ 1 ] ;
s -> csr [ 10 ] = ladrf [ 2 ] ;
s -> csr [ 11 ] = ladrf [ 3 ] ;
s -> csr [ 12 ] = padr [ 0 ] ;
s -> csr [ 13 ] = padr [ 1 ] ;
s -> csr [ 14 ] = padr [ 2 ] ;
s -> rdra = PHYSADDR ( s , rdra ) ;
s -> tdra = PHYSADDR ( s , tdra ) ;
CSR_RCVRC ( s ) = CSR_RCVRL ( s ) ;
CSR_XMTRC ( s ) = CSR_XMTRL ( s ) ;
trace_pcnet_ss32_rdra_tdra ( s , BCR_SSIZE32 ( s ) , s -> rdra , CSR_RCVRL ( s ) , s -> tdra , CSR_XMTRL ( s ) ) ;
s -> csr [ 0 ] |= 0x0101 ;
s -> csr [ 0 ] &= ~ 0x0004 ;
qemu_flush_queued_packets ( qemu_get_queue ( s -> nic ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void mgcp_calls_init_tap ( void ) {
GString * error_string ;
if ( have_MGCP_tap_listener == FALSE ) {
error_string = register_tap_listener ( "mgcp" , & ( the_tapinfo_struct . mgcp_dummy ) , NULL , TL_REQUIRES_PROTO_TREE , voip_calls_dlg_reset , MGCPcalls_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_MGCP_tap_listener = TRUE ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean pk_transaction_set_hint ( PkTransaction * transaction , const gchar * key , const gchar * value , GError * * error ) {
PkTransactionPrivate * priv = transaction -> priv ;
if ( g_strcmp0 ( key , "locale" ) == 0 ) {
pk_backend_job_set_locale ( priv -> job , value ) ;
return TRUE ;
}
if ( g_strcmp0 ( key , "frontend-socket" ) == 0 ) {
if ( value == NULL || value [ 0 ] == '\0' ) {
g_set_error_literal ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "Could not set frontend-socket to nothing" ) ;
return FALSE ;
}
if ( value [ 0 ] != '/' ) {
g_set_error_literal ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "frontend-socket has to be an absolute path" ) ;
return FALSE ;
}
if ( ! g_file_test ( value , G_FILE_TEST_EXISTS ) ) {
g_set_error_literal ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "frontend-socket does not exist" ) ;
return FALSE ;
}
pk_backend_job_set_frontend_socket ( priv -> job , value ) ;
return TRUE ;
}
if ( g_strcmp0 ( key , "background" ) == 0 ) {
if ( g_strcmp0 ( value , "true" ) == 0 ) {
pk_backend_job_set_background ( priv -> job , TRUE ) ;
}
else if ( g_strcmp0 ( value , "false" ) == 0 ) {
pk_backend_job_set_background ( priv -> job , FALSE ) ;
}
else {
g_set_error ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "background hint expects true or false, not %s" , value ) ;
return FALSE ;
}
return TRUE ;
}
if ( g_strcmp0 ( key , "interactive" ) == 0 ) {
if ( g_strcmp0 ( value , "true" ) == 0 ) {
pk_backend_job_set_interactive ( priv -> job , TRUE ) ;
}
else if ( g_strcmp0 ( value , "false" ) == 0 ) {
pk_backend_job_set_interactive ( priv -> job , FALSE ) ;
}
else {
g_set_error ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "interactive hint expects true or false, not %s" , value ) ;
return FALSE ;
}
return TRUE ;
}
if ( g_strcmp0 ( key , "cache-age" ) == 0 ) {
guint cache_age ;
if ( ! pk_strtouint ( value , & cache_age ) ) {
g_set_error ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "cannot parse cache age value %s" , value ) ;
return FALSE ;
}
if ( cache_age == 0 ) {
g_set_error_literal ( error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "cannot set a cache age of zero" ) ;
return FALSE ;
}
pk_backend_job_set_cache_age ( priv -> job , cache_age ) ;
return TRUE ;
}
g_warning ( "unknown option: %s with value %s" , key , value ) ;
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
FourXContext * const f = avctx -> priv_data ;
AVFrame * picture = data ;
int i , frame_4cc , frame_size , ret ;
frame_4cc = AV_RL32 ( buf ) ;
if ( buf_size != AV_RL32 ( buf + 4 ) + 8 || buf_size < 20 ) av_log ( f -> avctx , AV_LOG_ERROR , "size mismatch %d %d\n" , buf_size , AV_RL32 ( buf + 4 ) ) ;
if ( frame_4cc == AV_RL32 ( "cfrm" ) ) {
int free_index = - 1 ;
const int data_size = buf_size - 20 ;
const int id = AV_RL32 ( buf + 12 ) ;
const int whole_size = AV_RL32 ( buf + 16 ) ;
CFrameBuffer * cfrm ;
for ( i = 0 ;
i < CFRAME_BUFFER_COUNT ;
i ++ ) if ( f -> cfrm [ i ] . id && f -> cfrm [ i ] . id < avctx -> frame_number ) av_log ( f -> avctx , AV_LOG_ERROR , "lost c frame %d\n" , f -> cfrm [ i ] . id ) ;
for ( i = 0 ;
i < CFRAME_BUFFER_COUNT ;
i ++ ) {
if ( f -> cfrm [ i ] . id == id ) break ;
if ( f -> cfrm [ i ] . size == 0 ) free_index = i ;
}
if ( i >= CFRAME_BUFFER_COUNT ) {
i = free_index ;
f -> cfrm [ i ] . id = id ;
}
cfrm = & f -> cfrm [ i ] ;
cfrm -> data = av_fast_realloc ( cfrm -> data , & cfrm -> allocated_size , cfrm -> size + data_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! cfrm -> data ) {
av_log ( f -> avctx , AV_LOG_ERROR , "realloc failure" ) ;
return AVERROR ( ENOMEM ) ;
}
memcpy ( cfrm -> data + cfrm -> size , buf + 20 , data_size ) ;
cfrm -> size += data_size ;
if ( cfrm -> size >= whole_size ) {
buf = cfrm -> data ;
frame_size = cfrm -> size ;
if ( id != avctx -> frame_number ) av_log ( f -> avctx , AV_LOG_ERROR , "cframe id mismatch %d %d\n" , id , avctx -> frame_number ) ;
cfrm -> size = cfrm -> id = 0 ;
frame_4cc = AV_RL32 ( "pfrm" ) ;
}
else return buf_size ;
}
else {
buf = buf + 12 ;
frame_size = buf_size - 12 ;
}
avctx -> flags |= CODEC_FLAG_EMU_EDGE ;
if ( ( ret = ff_get_buffer ( avctx , picture , AV_GET_BUFFER_FLAG_REF ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
if ( frame_4cc == AV_RL32 ( "ifr2" ) ) {
picture -> pict_type = AV_PICTURE_TYPE_I ;
if ( ( ret = decode_i2_frame ( f , picture , buf - 4 , frame_size + 4 ) ) < 0 ) return ret ;
}
else if ( frame_4cc == AV_RL32 ( "ifrm" ) ) {
picture -> pict_type = AV_PICTURE_TYPE_I ;
if ( ( ret = decode_i_frame ( f , picture , buf , frame_size ) ) < 0 ) return ret ;
}
else if ( frame_4cc == AV_RL32 ( "pfrm" ) || frame_4cc == AV_RL32 ( "pfr2" ) ) {
if ( ! f -> last_picture -> data [ 0 ] ) {
if ( ( ret = ff_get_buffer ( avctx , f -> last_picture , AV_GET_BUFFER_FLAG_REF ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
memset ( f -> last_picture -> data [ 0 ] , 0 , avctx -> height * FFABS ( f -> last_picture -> linesize [ 0 ] ) ) ;
}
picture -> pict_type = AV_PICTURE_TYPE_P ;
if ( ( ret = decode_p_frame ( f , picture , buf , frame_size ) ) < 0 ) return ret ;
}
else if ( frame_4cc == AV_RL32 ( "snd_" ) ) {
av_log ( avctx , AV_LOG_ERROR , "ignoring snd_ chunk length:%d\n" , buf_size ) ;
}
else {
av_log ( avctx , AV_LOG_ERROR , "ignoring unknown chunk length:%d\n" , buf_size ) ;
}
picture -> key_frame = picture -> pict_type == AV_PICTURE_TYPE_I ;
av_frame_unref ( f -> last_picture ) ;
if ( ( ret = av_frame_ref ( f -> last_picture , picture ) ) < 0 ) return ret ;
* got_frame = 1 ;
emms_c ( ) ;
return buf_size ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void cpu_get_fp80 ( uint64_t * pmant , uint16_t * pexp , floatx80 f ) {
CPU_LDoubleU temp ;
temp . d = f ;
* pmant = temp . l . lower ;
* pexp = temp . l . upper ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void par_list_remove ( TocEntry * te ) {
te -> par_prev -> par_next = te -> par_next ;
te -> par_next -> par_prev = te -> par_prev ;
te -> par_prev = NULL ;
te -> par_next = NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | afs_int32 SPR_ListElements ( struct rx_call * call , afs_int32 aid , prlist * alist , afs_int32 * over ) {
afs_int32 code ;
afs_int32 cid = ANONYMOUSID ;
code = listElements ( call , aid , alist , over , & cid ) ;
osi_auditU ( call , PTS_LstEleEvent , code , AUD_ID , aid , AUD_END ) ;
ViceLog ( 125 , ( "PTS_ListElements: code %d cid %d aid %d\n" , code , cid , aid ) ) ;
return code ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int TSHttpSsnIsInternal ( TSHttpSsn ssnp ) {
ProxyClientSession * cs = reinterpret_cast < ProxyClientSession * > ( ssnp ) ;
if ( ! cs ) {
return 0 ;
}
NetVConnection * vc = cs -> get_netvc ( ) ;
if ( ! vc ) {
return 0 ;
}
return vc -> get_is_internal_request ( ) ? 1 : 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_SEQUENCE_OF_GenericData ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_OF_GenericData , SEQUENCE_OF_GenericData_sequence_of ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static struct off_item * lookup_offset_hash_table ( OffsetHashTable tbl , u32 * kid ) {
struct off_item * k ;
for ( k = tbl [ ( kid [ 1 ] & 0x07ff ) ] ;
k ;
k = k -> next ) if ( k -> kid [ 0 ] == kid [ 0 ] && k -> kid [ 1 ] == kid [ 1 ] ) return k ;
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VALUE ossl_asn1_decode0 ( unsigned char * * pp , long length , long * offset , int depth , int yield , long * num_read ) {
unsigned char * start , * p ;
const unsigned char * p0 ;
long len = 0 , inner_read = 0 , off = * offset , hlen ;
int tag , tc , j ;
VALUE asn1data , tag_class ;
p = * pp ;
start = p ;
p0 = p ;
j = ASN1_get_object ( & p0 , & len , & tag , & tc , length ) ;
p = ( unsigned char * ) p0 ;
if ( j & 0x80 ) ossl_raise ( eASN1Error , NULL ) ;
if ( len > length ) ossl_raise ( eASN1Error , "value is too short" ) ;
if ( ( tc & V_ASN1_PRIVATE ) == V_ASN1_PRIVATE ) tag_class = sym_PRIVATE ;
else if ( ( tc & V_ASN1_CONTEXT_SPECIFIC ) == V_ASN1_CONTEXT_SPECIFIC ) tag_class = sym_CONTEXT_SPECIFIC ;
else if ( ( tc & V_ASN1_APPLICATION ) == V_ASN1_APPLICATION ) tag_class = sym_APPLICATION ;
else tag_class = sym_UNIVERSAL ;
hlen = p - start ;
if ( yield ) {
VALUE arg = rb_ary_new ( ) ;
rb_ary_push ( arg , LONG2NUM ( depth ) ) ;
rb_ary_push ( arg , LONG2NUM ( * offset ) ) ;
rb_ary_push ( arg , LONG2NUM ( hlen ) ) ;
rb_ary_push ( arg , LONG2NUM ( len ) ) ;
rb_ary_push ( arg , ( j & V_ASN1_CONSTRUCTED ) ? Qtrue : Qfalse ) ;
rb_ary_push ( arg , ossl_asn1_class2sym ( tc ) ) ;
rb_ary_push ( arg , INT2NUM ( tag ) ) ;
rb_yield ( arg ) ;
}
if ( j & V_ASN1_CONSTRUCTED ) {
* pp += hlen ;
off += hlen ;
asn1data = int_ossl_asn1_decode0_cons ( pp , length - hlen , len , & off , depth , yield , j , tag , tag_class , & inner_read ) ;
inner_read += hlen ;
}
else {
if ( ( j & 0x01 ) && ( len == 0 ) ) ossl_raise ( eASN1Error , "Infinite length for primitive value" ) ;
asn1data = int_ossl_asn1_decode0_prim ( pp , len , hlen , tag , tag_class , & inner_read ) ;
off += hlen + len ;
}
if ( num_read ) * num_read = inner_read ;
if ( len != 0 && inner_read != hlen + len ) {
ossl_raise ( eASN1Error , "Type mismatch. Bytes read: %ld Bytes available: %ld" , inner_read , hlen + len ) ;
}
* offset = off ;
return asn1data ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean dissect_rtmpt_heur ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data ) {
conversation_t * conversation ;
if ( tvb_reported_length ( tvb ) >= 12 ) {
struct tcpinfo * tcpinfo = ( struct tcpinfo * ) data ;
if ( tcpinfo -> lastackseq == RTMPT_HANDSHAKE_OFFSET_2 && tcpinfo -> seq == RTMPT_HANDSHAKE_OFFSET_1 && tvb_get_guint8 ( tvb , 0 ) == RTMPT_MAGIC ) {
conversation = find_or_create_conversation ( pinfo ) ;
conversation_set_dissector ( conversation , rtmpt_tcp_handle ) ;
dissect_rtmpt_tcp ( tvb , pinfo , tree , data ) ;
return TRUE ;
}
}
return FALSE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static VP9_REFFRAME ref_frame_to_vp9_reframe ( vpx_ref_frame_type_t frame ) {
switch ( frame ) {
case VP8_LAST_FRAME : return VP9_LAST_FLAG ;
case VP8_GOLD_FRAME : return VP9_GOLD_FLAG ;
case VP8_ALTR_FRAME : return VP9_ALT_FLAG ;
}
assert ( 0 && "Invalid Reference Frame" ) ;
return VP9_LAST_FLAG ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static unsigned char * extra_get_record ( struct isoent * isoent , int * space , int * off , int * loc ) {
struct extr_rec * rec ;
isoent = isoent -> parent ;
if ( off != NULL ) {
rec = isoent -> extr_rec_list . current ;
if ( DR_SAFETY > LOGICAL_BLOCK_SIZE - rec -> offset ) rec = rec -> next ;
}
else {
rec = extra_last_record ( isoent ) ;
if ( rec == NULL || DR_SAFETY > LOGICAL_BLOCK_SIZE - rec -> offset ) {
rec = malloc ( sizeof ( * rec ) ) ;
if ( rec == NULL ) return ( NULL ) ;
rec -> location = 0 ;
rec -> offset = 0 ;
rec -> next = NULL ;
if ( isoent -> extr_rec_list . last == NULL ) isoent -> extr_rec_list . last = & ( isoent -> extr_rec_list . first ) ;
* isoent -> extr_rec_list . last = rec ;
isoent -> extr_rec_list . last = & ( rec -> next ) ;
}
}
* space = LOGICAL_BLOCK_SIZE - rec -> offset - DR_SAFETY ;
if ( * space & 0x01 ) * space -= 1 ;
if ( off != NULL ) * off = rec -> offset ;
if ( loc != NULL ) * loc = rec -> location ;
isoent -> extr_rec_list . current = rec ;
return ( & rec -> buf [ rec -> offset ] ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static bool get_variable_range ( PlannerInfo * root , VariableStatData * vardata , Oid sortop , Datum * min , Datum * max ) {
Datum tmin = 0 ;
Datum tmax = 0 ;
bool have_data = false ;
int16 typLen ;
bool typByVal ;
Datum * values ;
int nvalues ;
int i ;
# ifdef NOT_USED if ( get_actual_variable_range ( root , vardata , sortop , min , max ) ) return true ;
# endif if ( ! HeapTupleIsValid ( vardata -> statsTuple ) ) {
return false ;
}
get_typlenbyval ( vardata -> atttype , & typLen , & typByVal ) ;
if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_HISTOGRAM , sortop , NULL , & values , & nvalues , NULL , NULL ) ) {
if ( nvalues > 0 ) {
tmin = datumCopy ( values [ 0 ] , typByVal , typLen ) ;
tmax = datumCopy ( values [ nvalues - 1 ] , typByVal , typLen ) ;
have_data = true ;
}
free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ;
}
else if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_HISTOGRAM , InvalidOid , NULL , & values , & nvalues , NULL , NULL ) ) {
free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ;
return false ;
}
if ( get_attstatsslot ( vardata -> statsTuple , vardata -> atttype , vardata -> atttypmod , STATISTIC_KIND_MCV , InvalidOid , NULL , & values , & nvalues , NULL , NULL ) ) {
bool tmin_is_mcv = false ;
bool tmax_is_mcv = false ;
FmgrInfo opproc ;
fmgr_info ( get_opcode ( sortop ) , & opproc ) ;
for ( i = 0 ;
i < nvalues ;
i ++ ) {
if ( ! have_data ) {
tmin = tmax = values [ i ] ;
tmin_is_mcv = tmax_is_mcv = have_data = true ;
continue ;
}
if ( DatumGetBool ( FunctionCall2Coll ( & opproc , DEFAULT_COLLATION_OID , values [ i ] , tmin ) ) ) {
tmin = values [ i ] ;
tmin_is_mcv = true ;
}
if ( DatumGetBool ( FunctionCall2Coll ( & opproc , DEFAULT_COLLATION_OID , tmax , values [ i ] ) ) ) {
tmax = values [ i ] ;
tmax_is_mcv = true ;
}
}
if ( tmin_is_mcv ) tmin = datumCopy ( tmin , typByVal , typLen ) ;
if ( tmax_is_mcv ) tmax = datumCopy ( tmax , typByVal , typLen ) ;
free_attstatsslot ( vardata -> atttype , values , nvalues , NULL , 0 ) ;
}
* min = tmin ;
* max = tmax ;
return have_data ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void rds_recv_rcvbuf_delta ( struct rds_sock * rs , struct sock * sk , struct rds_cong_map * map , int delta , __be16 port ) {
int now_congested ;
if ( delta == 0 ) return ;
rs -> rs_rcv_bytes += delta ;
now_congested = rs -> rs_rcv_bytes > rds_sk_rcvbuf ( rs ) ;
rdsdebug ( "rs %p (%pI4:%u) recv bytes %d buf %d " "now_cong %d delta %d\n" , rs , & rs -> rs_bound_addr , ntohs ( rs -> rs_bound_port ) , rs -> rs_rcv_bytes , rds_sk_rcvbuf ( rs ) , now_congested , delta ) ;
if ( ! rs -> rs_congested && now_congested ) {
rs -> rs_congested = 1 ;
rds_cong_set_bit ( map , port ) ;
rds_cong_queue_updates ( map ) ;
}
else if ( rs -> rs_congested && ( rs -> rs_rcv_bytes < ( rds_sk_rcvbuf ( rs ) / 2 ) ) ) {
rs -> rs_congested = 0 ;
rds_cong_clear_bit ( map , port ) ;
rds_cong_queue_updates ( map ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void ctl_putfs ( const char * tag , tstamp_t uval ) {
register char * cp ;
register const char * cq ;
char buffer [ 200 ] ;
struct tm * tm = NULL ;
time_t fstamp ;
cp = buffer ;
cq = tag ;
while ( * cq != '\0' ) * cp ++ = * cq ++ ;
* cp ++ = '=' ;
fstamp = uval - JAN_1970 ;
tm = gmtime ( & fstamp ) ;
if ( NULL == tm ) return ;
INSIST ( ( cp - buffer ) < ( int ) sizeof ( buffer ) ) ;
snprintf ( cp , sizeof ( buffer ) - ( cp - buffer ) , "%04d%02d%02d%02d%02d" , tm -> tm_year + 1900 , tm -> tm_mon + 1 , tm -> tm_mday , tm -> tm_hour , tm -> tm_min ) ;
cp += strlen ( cp ) ;
ctl_putdata ( buffer , ( unsigned ) ( cp - buffer ) , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int printHelp ( int argc , char * argv [ ] ) {
fprintf ( stderr , "Usage: %s [-options] [file_name]\n" "\n" "Read the files specified and\n" "create a binary file [package-name]_[bundle-name]." DATA_TYPE " with the StringPrep profile data\n" "\n" , argv [ 0 ] ) ;
fprintf ( stderr , "Options:\n" "\t-h or -? or --help print this usage text\n" "\t-v or --verbose verbose output\n" "\t-c or --copyright include a copyright notice\n" ) ;
fprintf ( stderr , "\t-d or --destdir destination directory, followed by the path\n" "\t-s or --sourcedir source directory of ICU data, followed by the path\n" "\t-b or --bundle-name generate the ouput data file with the name specified\n" "\t-i or --icudatadir directory for locating any needed intermediate data files,\n" "\t followed by path, defaults to %s\n" , u_getDataDirectory ( ) ) ;
fprintf ( stderr , "\t-n or --normalize turn on the option for normalization and include mappings\n" "\t from NormalizationCorrections.txt from the given path,\n" "\t e.g: /test/icu/source/data/unidata\n" ) ;
fprintf ( stderr , "\t-m or --norm-correction use NormalizationCorrections.txt from the given path\n" "\t when the input file contains a normalization directive.\n" "\t unlike -n/--normalize, this option does not force the\n" "\t normalization.\n" ) ;
fprintf ( stderr , "\t-k or --check-bidi turn on the option for checking for BiDi in the profile\n" "\t-u or --unicode version of Unicode to be used with this profile followed by the version\n" ) ;
return argc < 0 ? U_ILLEGAL_ARGUMENT_ERROR : U_ZERO_ERROR ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_usb_midi_event ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * usb_audio_tree , proto_tree * parent_tree , gint offset ) {
guint8 code ;
guint8 cable ;
gboolean save_fragmented ;
proto_tree * tree = NULL ;
col_set_str ( pinfo -> cinfo , COL_INFO , "USB-MIDI Event Packets" ) ;
code = tvb_get_guint8 ( tvb , offset ) ;
cable = ( code & 0xF0 ) >> 4 ;
code &= 0x0F ;
if ( parent_tree ) {
proto_item * ti ;
ti = proto_tree_add_protocol_format ( usb_audio_tree , proto_usb_audio , tvb , offset , 4 , "USB Midi Event Packet" ) ;
tree = proto_item_add_subtree ( ti , ett_usb_audio ) ;
proto_tree_add_item ( tree , hf_midi_cable_number , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_midi_code_index , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_midi_event , tvb , offset + 1 , 3 , ENC_BIG_ENDIAN ) ;
}
save_fragmented = pinfo -> fragmented ;
if ( is_sysex_code ( code ) ) {
tvbuff_t * new_tvb = NULL ;
fragment_head * frag_sysex_msg = NULL ;
pinfo -> fragmented = TRUE ;
if ( code == 0x04 ) {
frag_sysex_msg = fragment_add_seq_next ( & midi_data_reassembly_table , tvb , offset + 1 , pinfo , cable , NULL , 3 , TRUE ) ;
}
else {
frag_sysex_msg = fragment_add_seq_next ( & midi_data_reassembly_table , tvb , offset + 1 , pinfo , cable , NULL , ( gint ) ( code - 4 ) , FALSE ) ;
}
if ( is_last_sysex_packet_in_tvb ( tvb , offset ) ) {
new_tvb = process_reassembled_data ( tvb , offset + 1 , pinfo , "Reassembled Message" , frag_sysex_msg , & sysex_msg_frag_items , NULL , usb_audio_tree ) ;
if ( code != 0x04 ) {
col_append_str ( pinfo -> cinfo , COL_INFO , " (SysEx Reassembled)" ) ;
}
else {
col_append_str ( pinfo -> cinfo , COL_INFO , " (SysEx fragment)" ) ;
}
if ( new_tvb ) {
call_dissector ( sysex_handle , new_tvb , pinfo , parent_tree ) ;
}
}
}
pinfo -> fragmented = save_fragmented ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void read_sbr_noise ( SpectralBandReplication * sbr , GetBitContext * gb , SBRData * ch_data , int ch ) {
int i , j ;
VLC_TYPE ( * t_huff ) [ 2 ] , ( * f_huff ) [ 2 ] ;
int t_lav , f_lav ;
int delta = ( ch == 1 && sbr -> bs_coupling == 1 ) + 1 ;
if ( sbr -> bs_coupling && ch ) {
t_huff = vlc_sbr [ T_HUFFMAN_NOISE_BAL_3_0DB ] . table ;
t_lav = vlc_sbr_lav [ T_HUFFMAN_NOISE_BAL_3_0DB ] ;
f_huff = vlc_sbr [ F_HUFFMAN_ENV_BAL_3_0DB ] . table ;
f_lav = vlc_sbr_lav [ F_HUFFMAN_ENV_BAL_3_0DB ] ;
}
else {
t_huff = vlc_sbr [ T_HUFFMAN_NOISE_3_0DB ] . table ;
t_lav = vlc_sbr_lav [ T_HUFFMAN_NOISE_3_0DB ] ;
f_huff = vlc_sbr [ F_HUFFMAN_ENV_3_0DB ] . table ;
f_lav = vlc_sbr_lav [ F_HUFFMAN_ENV_3_0DB ] ;
}
for ( i = 0 ;
i < ch_data -> bs_num_noise ;
i ++ ) {
if ( ch_data -> bs_df_noise [ i ] ) {
for ( j = 0 ;
j < sbr -> n_q ;
j ++ ) ch_data -> noise_facs [ i + 1 ] [ j ] = ch_data -> noise_facs [ i ] [ j ] + delta * ( get_vlc2 ( gb , t_huff , 9 , 2 ) - t_lav ) ;
}
else {
ch_data -> noise_facs [ i + 1 ] [ 0 ] = delta * get_bits ( gb , 5 ) ;
for ( j = 1 ;
j < sbr -> n_q ;
j ++ ) ch_data -> noise_facs [ i + 1 ] [ j ] = ch_data -> noise_facs [ i + 1 ] [ j - 1 ] + delta * ( get_vlc2 ( gb , f_huff , 9 , 3 ) - f_lav ) ;
}
}
memcpy ( ch_data -> noise_facs [ 0 ] , ch_data -> noise_facs [ ch_data -> bs_num_noise ] , sizeof ( ch_data -> noise_facs [ 0 ] ) ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | SPL_METHOD ( DirectoryIterator , __construct ) {
spl_filesystem_object_construct ( INTERNAL_FUNCTION_PARAM_PASSTHRU , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | 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 ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ExtensionServiceSyncTest , IgnoreSyncChangesWhenLocalStateIsMoreRecent ) {
base : : FilePath source_install_dir = data_dir ( ) . AppendASCII ( "good" ) . AppendASCII ( "Extensions" ) ;
base : : FilePath pref_path = source_install_dir . DirName ( ) . Append ( chrome : : kPreferencesFilename ) ;
InitializeInstalledExtensionService ( pref_path , source_install_dir ) ;
browser_sync : : ProfileSyncService * sync_service = ProfileSyncServiceFactory : : GetForProfile ( profile ( ) ) ;
sync_service -> SetFirstSetupComplete ( ) ;
extension_sync_service ( ) ;
service ( ) -> Init ( ) ;
ASSERT_TRUE ( service ( ) -> is_ready ( ) ) ;
ASSERT_EQ ( 3u , loaded_ . size ( ) ) ;
ASSERT_TRUE ( service ( ) -> IsExtensionEnabled ( good0 ) ) ;
ASSERT_TRUE ( service ( ) -> IsExtensionEnabled ( good2 ) ) ;
service ( ) -> DisableExtension ( good0 , extensions : : disable_reason : : DISABLE_USER_ACTION ) ;
ASSERT_FALSE ( service ( ) -> IsExtensionEnabled ( good0 ) ) ;
service ( ) -> EnableExtension ( good0 ) ;
ASSERT_TRUE ( service ( ) -> IsExtensionEnabled ( good0 ) ) ;
service ( ) -> DisableExtension ( good2 , extensions : : disable_reason : : DISABLE_USER_ACTION ) ;
ASSERT_FALSE ( service ( ) -> IsExtensionEnabled ( good2 ) ) ;
const Extension * extension0 = service ( ) -> GetExtensionById ( good0 , true ) ;
const Extension * extension2 = service ( ) -> GetExtensionById ( good2 , true ) ;
ASSERT_TRUE ( extensions : : sync_helper : : IsSyncable ( extension0 ) ) ;
ASSERT_TRUE ( extensions : : sync_helper : : IsSyncable ( extension2 ) ) ;
ExtensionSyncData disable_good0 ( * extension0 , false , extensions : : disable_reason : : DISABLE_USER_ACTION , false , false , ExtensionSyncData : : BOOLEAN_UNSET , false ) ;
ExtensionSyncData enable_good2 ( * extension2 , true , extensions : : disable_reason : : DISABLE_NONE , false , false , ExtensionSyncData : : BOOLEAN_UNSET , false ) ;
syncer : : SyncDataList sync_data ;
sync_data . push_back ( disable_good0 . GetSyncData ( ) ) ;
sync_data . push_back ( enable_good2 . GetSyncData ( ) ) ;
extension_sync_service ( ) -> MergeDataAndStartSyncing ( syncer : : EXTENSIONS , sync_data , base : : MakeUnique < syncer : : FakeSyncChangeProcessor > ( ) , base : : MakeUnique < syncer : : SyncErrorFactoryMock > ( ) ) ;
EXPECT_TRUE ( service ( ) -> IsExtensionEnabled ( good0 ) ) ;
EXPECT_FALSE ( service ( ) -> IsExtensionEnabled ( good2 ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( CrossOriginXHR , NoFileAccess ) {
ASSERT_TRUE ( RunExtensionTestNoFileAccess ( "cross_origin_xhro_file_access" ) ) << message_ ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( PrefsFunctionalTest , TestHomepageNewTabpagePrefs ) {
EXPECT_TRUE ( browser ( ) -> profile ( ) -> GetPrefs ( ) -> GetBoolean ( prefs : : kHomePageIsNewTabPage ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int maybe_create_keyring_or_box ( char * filename , int is_box , int force_create ) {
dotlock_t lockhd = NULL ;
IOBUF iobuf ;
int rc ;
mode_t oldmask ;
char * last_slash_in_filename ;
int save_slash ;
if ( ! access ( filename , F_OK ) ) return 0 ;
if ( ! force_create ) return gpg_error ( GPG_ERR_ENOENT ) ;
last_slash_in_filename = strrchr ( filename , DIRSEP_C ) ;
# if HAVE_W32_SYSTEM {
char * p = strrchr ( filename , '/' ) ;
if ( ! last_slash_in_filename || p > last_slash_in_filename ) last_slash_in_filename = p ;
}
# endif if ( ! last_slash_in_filename ) return gpg_error ( GPG_ERR_ENOENT ) ;
save_slash = * last_slash_in_filename ;
* last_slash_in_filename = 0 ;
if ( access ( filename , F_OK ) ) {
static int tried ;
if ( ! tried ) {
tried = 1 ;
try_make_homedir ( filename ) ;
}
if ( access ( filename , F_OK ) ) {
rc = gpg_error_from_syserror ( ) ;
* last_slash_in_filename = save_slash ;
goto leave ;
}
}
* last_slash_in_filename = save_slash ;
lockhd = dotlock_create ( filename , 0 ) ;
if ( ! lockhd ) {
rc = gpg_error_from_syserror ( ) ;
if ( opt . verbose ) log_info ( "can't allocate lock for '%s': %s\n" , filename , gpg_strerror ( rc ) ) ;
if ( ! force_create ) return gpg_error ( GPG_ERR_ENOENT ) ;
else return rc ;
}
if ( dotlock_take ( lockhd , - 1 ) ) {
rc = gpg_error_from_syserror ( ) ;
log_info ( "can't lock '%s': %s\n" , filename , gpg_strerror ( rc ) ) ;
goto leave ;
}
if ( ! access ( filename , F_OK ) ) {
rc = 0 ;
goto leave ;
}
oldmask = umask ( 077 ) ;
if ( is_secured_filename ( filename ) ) {
iobuf = NULL ;
gpg_err_set_errno ( EPERM ) ;
}
else iobuf = iobuf_create ( filename , 0 ) ;
umask ( oldmask ) ;
if ( ! iobuf ) {
rc = gpg_error_from_syserror ( ) ;
if ( is_box ) log_error ( _ ( "error creating keybox '%s': %s\n" ) , filename , gpg_strerror ( rc ) ) ;
else log_error ( _ ( "error creating keyring '%s': %s\n" ) , filename , gpg_strerror ( rc ) ) ;
goto leave ;
}
iobuf_close ( iobuf ) ;
iobuf_ioctl ( NULL , IOBUF_IOCTL_INVALIDATE_CACHE , 0 , filename ) ;
if ( is_box ) {
FILE * fp = fopen ( filename , "w" ) ;
if ( ! fp ) rc = gpg_error_from_syserror ( ) ;
else {
rc = _keybox_write_header_blob ( fp , 1 ) ;
fclose ( fp ) ;
}
if ( rc ) {
if ( is_box ) log_error ( _ ( "error creating keybox '%s': %s\n" ) , filename , gpg_strerror ( rc ) ) ;
else log_error ( _ ( "error creating keyring '%s': %s\n" ) , filename , gpg_strerror ( rc ) ) ;
goto leave ;
}
}
if ( ! opt . quiet ) {
if ( is_box ) log_info ( _ ( "keybox '%s' created\n" ) , filename ) ;
else log_info ( _ ( "keyring '%s' created\n" ) , filename ) ;
}
rc = 0 ;
leave : if ( lockhd ) {
dotlock_release ( lockhd ) ;
dotlock_destroy ( lockhd ) ;
}
return rc ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void vmsvga_copy_rect ( struct vmsvga_state_s * s , int x0 , int y0 , int x1 , int y1 , int w , int h ) {
DisplaySurface * surface = qemu_console_surface ( s -> vga . con ) ;
uint8_t * vram = s -> vga . vram_ptr ;
int bypl = surface_stride ( surface ) ;
int bypp = surface_bytes_per_pixel ( surface ) ;
int width = bypp * w ;
int line = h ;
uint8_t * ptr [ 2 ] ;
if ( y1 > y0 ) {
ptr [ 0 ] = vram + bypp * x0 + bypl * ( y0 + h - 1 ) ;
ptr [ 1 ] = vram + bypp * x1 + bypl * ( y1 + h - 1 ) ;
for ( ;
line > 0 ;
line -- , ptr [ 0 ] -= bypl , ptr [ 1 ] -= bypl ) {
memmove ( ptr [ 1 ] , ptr [ 0 ] , width ) ;
}
}
else {
ptr [ 0 ] = vram + bypp * x0 + bypl * y0 ;
ptr [ 1 ] = vram + bypp * x1 + bypl * y1 ;
for ( ;
line > 0 ;
line -- , ptr [ 0 ] += bypl , ptr [ 1 ] += bypl ) {
memmove ( ptr [ 1 ] , ptr [ 0 ] , width ) ;
}
}
vmsvga_update_rect_delayed ( s , x1 , y1 , w , h ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static iax_packet_data * iax2_get_packet_data_for_minipacket ( packet_info * pinfo , guint16 scallno , gboolean video ) {
iax_packet_data * p = ( iax_packet_data * ) p_get_proto_data ( wmem_file_scope ( ) , pinfo , proto_iax2 , 0 ) ;
if ( ! p ) {
gboolean reversed ;
iax_call_data * iax_call ;
iax_call = iax_lookup_call ( pinfo , scallno , 0 , & reversed ) ;
p = iax_new_packet_data ( iax_call , reversed ) ;
p_add_proto_data ( wmem_file_scope ( ) , pinfo , proto_iax2 , 0 , p ) ;
if ( iax_call ) {
if ( video ) p -> codec = reversed ? iax_call -> dst_vformat : iax_call -> src_vformat ;
else p -> codec = reversed ? iax_call -> dst_codec : iax_call -> src_codec ;
}
}
iax2_populate_pinfo_from_packet_data ( pinfo , p ) ;
return p ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_CallModel ( 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_CallModel , CallModel_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int _zip_cdir_grow ( struct zip_cdir * cd , int nentry , struct zip_error * error ) {
struct zip_dirent * entry ;
if ( nentry < cd -> nentry ) {
_zip_error_set ( error , ZIP_ER_INTERNAL , 0 ) ;
return - 1 ;
}
if ( ( entry = ( ( struct zip_dirent * ) realloc ( cd -> entry , sizeof ( * ( cd -> entry ) ) * nentry ) ) ) == NULL ) {
_zip_error_set ( error , ZIP_ER_MEMORY , 0 ) ;
return - 1 ;
}
cd -> nentry = nentry ;
cd -> entry = entry ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void sbr_qmf_synthesis ( FFTContext * mdct , SBRDSPContext * sbrdsp , AVFloatDSPContext * dsp , float * out , float X [ 2 ] [ 38 ] [ 64 ] , float mdct_buf [ 2 ] [ 64 ] , float * v0 , int * v_off , const unsigned int div ) {
int i , n ;
const float * sbr_qmf_window = div ? sbr_qmf_window_ds : sbr_qmf_window_us ;
const int step = 128 >> div ;
float * v ;
for ( i = 0 ;
i < 32 ;
i ++ ) {
if ( * v_off < step ) {
int saved_samples = ( 1280 - 128 ) >> div ;
memcpy ( & v0 [ SBR_SYNTHESIS_BUF_SIZE - saved_samples ] , v0 , saved_samples * sizeof ( float ) ) ;
* v_off = SBR_SYNTHESIS_BUF_SIZE - saved_samples - step ;
}
else {
* v_off -= step ;
}
v = v0 + * v_off ;
if ( div ) {
for ( n = 0 ;
n < 32 ;
n ++ ) {
X [ 0 ] [ i ] [ n ] = - X [ 0 ] [ i ] [ n ] ;
X [ 0 ] [ i ] [ 32 + n ] = X [ 1 ] [ i ] [ 31 - n ] ;
}
mdct -> imdct_half ( mdct , mdct_buf [ 0 ] , X [ 0 ] [ i ] ) ;
sbrdsp -> qmf_deint_neg ( v , mdct_buf [ 0 ] ) ;
}
else {
sbrdsp -> neg_odd_64 ( X [ 1 ] [ i ] ) ;
mdct -> imdct_half ( mdct , mdct_buf [ 0 ] , X [ 0 ] [ i ] ) ;
mdct -> imdct_half ( mdct , mdct_buf [ 1 ] , X [ 1 ] [ i ] ) ;
sbrdsp -> qmf_deint_bfly ( v , mdct_buf [ 1 ] , mdct_buf [ 0 ] ) ;
}
dsp -> vector_fmul ( out , v , sbr_qmf_window , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 192 >> div ) , sbr_qmf_window + ( 64 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 256 >> div ) , sbr_qmf_window + ( 128 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 448 >> div ) , sbr_qmf_window + ( 192 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 512 >> div ) , sbr_qmf_window + ( 256 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 704 >> div ) , sbr_qmf_window + ( 320 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 768 >> div ) , sbr_qmf_window + ( 384 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 960 >> div ) , sbr_qmf_window + ( 448 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 1024 >> div ) , sbr_qmf_window + ( 512 >> div ) , out , 64 >> div ) ;
dsp -> vector_fmul_add ( out , v + ( 1216 >> div ) , sbr_qmf_window + ( 576 >> div ) , out , 64 >> div ) ;
out += 64 >> div ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static YuvPixel mp_get_yuv_from_rgb ( MotionPixelsContext * mp , int x , int y ) {
int color ;
color = * ( uint16_t * ) & mp -> frame . data [ 0 ] [ y * mp -> frame . linesize [ 0 ] + x * 2 ] ;
return mp_rgb_yuv_table [ color ] ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int virLogFindOutput ( virLogOutputPtr * outputs , size_t noutputs , virLogDestination dest , const void * opaque ) {
size_t i ;
const char * name = opaque ;
for ( i = 0 ;
i < noutputs ;
i ++ ) {
if ( dest == outputs [ i ] -> dest && ( STREQ_NULLABLE ( outputs [ i ] -> name , name ) ) ) return i ;
}
return - 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void add_opt_rr_to_tree ( proto_tree * rr_tree , tvbuff_t * tvb , int offset , const char * name , int namelen , gboolean is_mdns ) {
proto_tree * Z_tree ;
proto_item * Z_item ;
proto_tree_add_string ( rr_tree , hf_dns_rr_name , tvb , offset , namelen , name ) ;
offset += namelen ;
proto_tree_add_item ( rr_tree , hf_dns_rr_type , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset += 2 ;
if ( is_mdns ) {
proto_tree_add_item ( rr_tree , hf_dns_rr_udp_payload_size_mdns , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rr_tree , hf_dns_rr_cache_flush , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
}
else {
proto_tree_add_item ( rr_tree , hf_dns_rr_udp_payload_size , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
}
offset += 2 ;
proto_tree_add_item ( rr_tree , hf_dns_rr_ext_rcode , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( rr_tree , hf_dns_rr_edns0_version , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
Z_item = proto_tree_add_item ( rr_tree , hf_dns_rr_z , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
Z_tree = proto_item_add_subtree ( Z_item , ett_dns_rr ) ;
proto_tree_add_item ( Z_tree , hf_dns_rr_z_do , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( Z_tree , hf_dns_rr_z_reserved , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset += 2 ;
proto_tree_add_item ( rr_tree , hf_dns_rr_len , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void set_sample_rate_params ( AVCodecContext * avctx ) {
TAKDecContext * s = avctx -> priv_data ;
int shift = 3 - ( avctx -> sample_rate / 11025 ) ;
shift = FFMAX ( 0 , shift ) ;
s -> uval = FFALIGN ( avctx -> sample_rate + 511 >> 9 , 4 ) << shift ;
s -> subframe_scale = FFALIGN ( avctx -> sample_rate + 511 >> 9 , 4 ) << 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static krb5_error_code create_princ ( kadm5_principal_ent_rec * princ , long mask , int n_ks , krb5_key_salt_tuple * ks , char * pass ) {
if ( ks ) return kadm5_create_principal_3 ( handle , princ , mask , n_ks , ks , pass ) ;
else return kadm5_create_principal ( handle , princ , mask , pass ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | char * TSfgets ( TSFile filep , char * buf , size_t length ) {
FileImpl * file = ( FileImpl * ) filep ;
return file -> fgets ( buf , length ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static zval * incomplete_class_get_property ( zval * object , zval * member , int type , const zend_literal * key TSRMLS_DC ) {
incomplete_class_message ( object , E_NOTICE TSRMLS_CC ) ;
if ( type == BP_VAR_W || type == BP_VAR_RW ) {
return EG ( error_zval_ptr ) ;
}
else {
return EG ( uninitialized_zval_ptr ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int X509_REQ_sign_ctx ( X509_REQ * x , EVP_MD_CTX * ctx ) {
return ASN1_item_sign_ctx ( ASN1_ITEM_rptr ( X509_REQ_INFO ) , x -> sig_alg , NULL , x -> signature , x -> req_info , ctx ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static __inline__ void * TLV_LIST_DATA ( struct tlv_list_desc * list ) {
return TLV_DATA ( list -> tlv_ptr ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSReturnCode sdk_sanity_check_mime_parser ( TSMimeParser parser ) {
if ( parser == nullptr ) {
return TS_ERROR ;
}
return TS_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static Asn1Generic * DecodeAsn1DerSet ( const unsigned char * buffer , uint32_t max_size , uint8_t depth , uint32_t * errcode ) {
const unsigned char * d_ptr = buffer ;
uint32_t d_length , numbytes , el_max_size ;
uint8_t c ;
uint32_t seq_index ;
Asn1Generic * node ;
Asn1Generic * child ;
d_ptr ++ ;
node = Asn1GenericNew ( ) ;
if ( node == NULL ) return NULL ;
node -> type = ASN1_SET ;
node -> data = NULL ;
c = d_ptr [ 0 ] ;
if ( ( c & ( 1 << 7 ) ) >> 7 == 0 ) {
d_length = c ;
d_ptr ++ ;
}
else {
numbytes = c & 0x7f ;
d_ptr ++ ;
if ( DecodeAsn1BuildValue ( & d_ptr , & d_length , numbytes , errcode ) == - 1 ) {
SCFree ( node ) ;
return NULL ;
}
}
node -> length = d_length + ( d_ptr - buffer ) ;
if ( node -> length > max_size || node -> length < d_length ) {
if ( errcode ) * errcode = ERR_DER_ELEMENT_SIZE_TOO_BIG ;
SCFree ( node ) ;
return NULL ;
}
seq_index = 0 ;
el_max_size = max_size - ( d_ptr - buffer ) ;
child = DecodeAsn1DerGeneric ( d_ptr , el_max_size , depth , seq_index , errcode ) ;
if ( child == NULL ) {
DerFree ( node ) ;
return NULL ;
}
node -> data = child ;
return ( Asn1Generic * ) node ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( TemplateURLTest , ReplaceInputType ) {
struct TestData {
const base : : string16 search_term ;
metrics : : OmniboxInputType : : Type input_type ;
const std : : string url ;
const std : : string expected_result ;
}
test_data [ ] = {
{
ASCIIToUTF16 ( "foo" ) , metrics : : OmniboxInputType : : UNKNOWN , "{
google:baseURL}
?{
searchTerms}
&{
google:inputType}
" , "http://www.google.com/?foo&oit=1&" }
, {
ASCIIToUTF16 ( "foo" ) , metrics : : OmniboxInputType : : URL , "{
google:baseURL}
?{
searchTerms}
&{
google:inputType}
" , "http://www.google.com/?foo&oit=3&" }
, {
ASCIIToUTF16 ( "foo" ) , metrics : : OmniboxInputType : : FORCED_QUERY , "{
google:baseURL}
?{
searchTerms}
&{
google:inputType}
" , "http://www.google.com/?foo&oit=5&" }
, }
;
TemplateURLData data ;
data . input_encodings . push_back ( "UTF-8" ) ;
for ( size_t i = 0 ;
i < arraysize ( test_data ) ;
++ i ) {
data . SetURL ( test_data [ i ] . url ) ;
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 ( test_data [ i ] . search_term ) ;
search_terms_args . input_type = test_data [ i ] . input_type ;
GURL result ( url . url_ref ( ) . ReplaceSearchTerms ( search_terms_args , search_terms_data_ ) ) ;
ASSERT_TRUE ( result . is_valid ( ) ) ;
EXPECT_EQ ( test_data [ i ] . expected_result , result . spec ( ) ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void dissect_rsvp_fast_reroute ( proto_tree * ti , packet_info * pinfo , proto_tree * rsvp_object_tree , tvbuff_t * tvb , int offset , int obj_length , int rsvp_class _U_ , int type ) {
guint8 flags ;
proto_tree * ti2 , * rsvp_frr_flags_tree ;
proto_item_set_text ( ti , "FAST_REROUTE: " ) ;
switch ( type ) {
case 1 : case 7 : if ( ( ( type == 1 ) && ( obj_length != 24 ) ) || ( ( type == 7 ) && ( obj_length != 20 ) ) ) {
proto_tree_add_expert_format ( rsvp_object_tree , pinfo , & ei_rsvp_invalid_length , tvb , offset , obj_length , "Invalid length: cannot decode" ) ;
proto_item_append_text ( ti , "Invalid length" ) ;
break ;
}
proto_tree_add_uint ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_setup_priority , tvb , offset + 4 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_hold_priority , tvb , offset + 5 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_hop_limit , tvb , offset + 6 , 1 , ENC_BIG_ENDIAN ) ;
flags = tvb_get_guint8 ( tvb , offset + 7 ) ;
ti2 = proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_flags , tvb , offset + 7 , 1 , ENC_BIG_ENDIAN ) ;
rsvp_frr_flags_tree = proto_item_add_subtree ( ti2 , TREE ( TT_FAST_REROUTE_FLAGS ) ) ;
proto_tree_add_item ( rsvp_frr_flags_tree , hf_rsvp_frr_flags_one2one_backup , tvb , offset + 7 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_frr_flags_tree , hf_rsvp_frr_flags_facility_backup , tvb , offset + 7 , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_bandwidth , tvb , offset + 8 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_include_any , tvb , offset + 12 , 4 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_exclude_any , tvb , offset + 16 , 4 , ENC_BIG_ENDIAN ) ;
if ( type == 1 ) {
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_include_all , tvb , offset + 20 , 4 , ENC_BIG_ENDIAN ) ;
}
proto_item_append_text ( ti , "%s%s" , flags & 0x01 ? "One-to-One Backup, " : "" , flags & 0x02 ? "Facility Backup" : "" ) ;
break ;
default : proto_tree_add_uint_format_value ( rsvp_object_tree , hf_rsvp_ctype , tvb , offset + 3 , 1 , type , "Unknown (%u)" , type ) ;
proto_tree_add_item ( rsvp_object_tree , hf_rsvp_fast_reroute_data , tvb , offset + 4 , obj_length - 4 , ENC_NA ) ;
break ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( MessageCenterNotificationsTest , UpdateExistingNotification ) {
# if defined ( OS_WIN ) && defined ( USE_ASH ) if ( base : : CommandLine : : ForCurrentProcess ( ) -> HasSwitch ( switches : : kAshBrowserTests ) ) return ;
# endif TestDelegate * delegate ;
manager ( ) -> Add ( CreateTestNotification ( "n" , & delegate ) , profile ( ) ) ;
TestDelegate * delegate2 ;
manager ( ) -> Add ( CreateRichTestNotification ( "n" , & delegate2 ) , profile ( ) ) ;
manager ( ) -> CancelById ( "n" , NotificationUIManager : : GetProfileID ( profile ( ) ) ) ;
EXPECT_EQ ( "Display_" , delegate -> log ( ) ) ;
EXPECT_EQ ( "Close_programmatically_" , delegate2 -> log ( ) ) ;
delegate -> Release ( ) ;
delegate2 -> Release ( ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ScoredHistoryMatchTest , ScoringTLD ) {
base : : Time now = base : : Time : : NowFromSystemTime ( ) ;
std : : string url_string ( "http://fedcba.com/" ) ;
const GURL url ( url_string ) ;
history : : URLRow row ( MakeURLRow ( url_string . c_str ( ) , "" , 8 , 3 , 1 ) ) ;
RowWordStarts word_starts ;
PopulateWordStarts ( row , & word_starts ) ;
WordStarts two_words_no_offsets ( 2 , 0u ) ;
VisitInfoVector visits = CreateVisitInfoVector ( 8 , 3 , now ) ;
ScoredHistoryMatch scored ( row , visits , std : : string ( ) , ASCIIToUTF16 ( "fed com" ) , Make2Terms ( "fed" , "com" ) , two_words_no_offsets , word_starts , false , nullptr , now ) ;
EXPECT_EQ ( 0 , scored . raw_score ) ;
base : : AutoReset < bool > reset ( & ScoredHistoryMatch : : allow_tld_matches_ , true ) ;
ScoredHistoryMatch scored_with_tld ( row , visits , std : : string ( ) , ASCIIToUTF16 ( "fed com" ) , Make2Terms ( "fed" , "com" ) , two_words_no_offsets , word_starts , false , nullptr , now ) ;
EXPECT_GT ( scored_with_tld . raw_score , 0 ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static ASN1_BOOLEAN obj_to_asn1bool ( VALUE obj ) {
if ( NIL_P ( obj ) ) ossl_raise ( rb_eTypeError , "Can't convert nil into Boolean" ) ;
return RTEST ( obj ) ? 0xff : 0x0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int fz_colorspace_is_indexed ( fz_context * ctx , const fz_colorspace * cs ) {
return cs && ( cs -> type == FZ_COLORSPACE_INDEXED ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | Datum nlikejoinsel ( PG_FUNCTION_ARGS ) {
PG_RETURN_FLOAT8 ( patternjoinsel ( fcinfo , Pattern_Type_Like , true ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gcry_err_code_t sexp_to_sig ( gcry_sexp_t sexp , gcry_mpi_t * * retarray , gcry_module_t * retalgo ) {
gcry_err_code_t err = 0 ;
gcry_sexp_t list , l2 ;
char * name ;
const char * elems ;
gcry_mpi_t * array ;
gcry_module_t module ;
gcry_pk_spec_t * pubkey ;
list = gcry_sexp_find_token ( sexp , "sig-val" , 0 ) ;
if ( ! list ) return GPG_ERR_INV_OBJ ;
l2 = gcry_sexp_nth ( list , 1 ) ;
if ( ! l2 ) {
gcry_sexp_release ( list ) ;
return GPG_ERR_NO_OBJ ;
}
name = _gcry_sexp_nth_string ( l2 , 0 ) ;
if ( ! name ) {
gcry_sexp_release ( list ) ;
gcry_sexp_release ( l2 ) ;
return GPG_ERR_INV_OBJ ;
}
else if ( ! strcmp ( name , "flags" ) ) {
gcry_free ( name ) ;
gcry_sexp_release ( l2 ) ;
l2 = gcry_sexp_nth ( list , 2 ) ;
if ( ! l2 ) {
gcry_sexp_release ( list ) ;
return GPG_ERR_INV_OBJ ;
}
name = _gcry_sexp_nth_string ( l2 , 0 ) ;
}
ath_mutex_lock ( & pubkeys_registered_lock ) ;
module = gcry_pk_lookup_name ( name ) ;
ath_mutex_unlock ( & pubkeys_registered_lock ) ;
gcry_free ( name ) ;
name = NULL ;
if ( ! module ) {
gcry_sexp_release ( l2 ) ;
gcry_sexp_release ( list ) ;
return GPG_ERR_PUBKEY_ALGO ;
}
else pubkey = ( gcry_pk_spec_t * ) module -> spec ;
elems = pubkey -> elements_sig ;
array = gcry_calloc ( strlen ( elems ) + 1 , sizeof * array ) ;
if ( ! array ) err = gpg_err_code_from_syserror ( ) ;
if ( ! err ) err = sexp_elements_extract ( list , elems , array , NULL ) ;
gcry_sexp_release ( l2 ) ;
gcry_sexp_release ( list ) ;
if ( err ) {
ath_mutex_lock ( & pubkeys_registered_lock ) ;
_gcry_module_release ( module ) ;
ath_mutex_unlock ( & pubkeys_registered_lock ) ;
gcry_free ( array ) ;
}
else {
* retarray = array ;
* retalgo = module ;
}
return err ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_adapt_coef_probs ( VP9_COMMON * cm ) {
TX_SIZE t ;
unsigned int count_sat , update_factor ;
if ( frame_is_intra_only ( cm ) ) {
update_factor = COEF_MAX_UPDATE_FACTOR_KEY ;
count_sat = COEF_COUNT_SAT_KEY ;
}
else if ( cm -> last_frame_type == KEY_FRAME ) {
update_factor = COEF_MAX_UPDATE_FACTOR_AFTER_KEY ;
count_sat = COEF_COUNT_SAT_AFTER_KEY ;
}
else {
update_factor = COEF_MAX_UPDATE_FACTOR ;
count_sat = COEF_COUNT_SAT ;
}
for ( t = TX_4X4 ;
t <= TX_32X32 ;
t ++ ) adapt_coef_probs ( cm , t , count_sat , update_factor ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void writecb ( struct bufferevent * bev , void * arg ) {
if ( EVBUFFER_LENGTH ( bev -> output ) == 0 ) test_ok ++ ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_SEQUENCE_OF_AddressPattern ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_OF_AddressPattern , SEQUENCE_OF_AddressPattern_sequence_of ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int parse_video_var ( AVFormatContext * avctx , AVStream * st , const char * name , int size ) {
AVIOContext * pb = avctx -> pb ;
if ( ! strcmp ( name , "__DIR_COUNT" ) ) {
st -> nb_frames = st -> duration = var_read_int ( pb , size ) ;
}
else if ( ! strcmp ( name , "COMPRESSION" ) ) {
char * str = var_read_string ( pb , size ) ;
if ( ! str ) return AVERROR_INVALIDDATA ;
if ( ! strcmp ( str , "1" ) ) {
st -> codecpar -> codec_id = AV_CODEC_ID_MVC1 ;
}
else if ( ! strcmp ( str , "2" ) ) {
st -> codecpar -> format = AV_PIX_FMT_ABGR ;
st -> codecpar -> codec_id = AV_CODEC_ID_RAWVIDEO ;
}
else if ( ! strcmp ( str , "3" ) ) {
st -> codecpar -> codec_id = AV_CODEC_ID_SGIRLE ;
}
else if ( ! strcmp ( str , "10" ) ) {
st -> codecpar -> codec_id = AV_CODEC_ID_MJPEG ;
}
else if ( ! strcmp ( str , "MVC2" ) ) {
st -> codecpar -> codec_id = AV_CODEC_ID_MVC2 ;
}
else {
avpriv_request_sample ( avctx , "Video compression %s" , str ) ;
}
av_free ( str ) ;
}
else if ( ! strcmp ( name , "FPS" ) ) {
AVRational fps = var_read_float ( pb , size ) ;
avpriv_set_pts_info ( st , 64 , fps . den , fps . num ) ;
st -> avg_frame_rate = fps ;
}
else if ( ! strcmp ( name , "HEIGHT" ) ) {
st -> codecpar -> height = var_read_int ( pb , size ) ;
}
else if ( ! strcmp ( name , "PIXEL_ASPECT" ) ) {
st -> sample_aspect_ratio = var_read_float ( pb , size ) ;
av_reduce ( & st -> sample_aspect_ratio . num , & st -> sample_aspect_ratio . den , st -> sample_aspect_ratio . num , st -> sample_aspect_ratio . den , INT_MAX ) ;
}
else if ( ! strcmp ( name , "WIDTH" ) ) {
st -> codecpar -> width = var_read_int ( pb , size ) ;
}
else if ( ! strcmp ( name , "ORIENTATION" ) ) {
if ( var_read_int ( pb , size ) == 1101 ) {
st -> codecpar -> extradata = av_strdup ( "BottomUp" ) ;
st -> codecpar -> extradata_size = 9 ;
}
}
else if ( ! strcmp ( name , "Q_SPATIAL" ) || ! strcmp ( name , "Q_TEMPORAL" ) ) {
var_read_metadata ( avctx , name , size ) ;
}
else if ( ! strcmp ( name , "INTERLACING" ) || ! strcmp ( name , "PACKING" ) ) {
avio_skip ( pb , size ) ;
}
else return AVERROR_INVALIDDATA ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int main_waitpid_check ( pid_t pid ) {
int status ;
int ret = 0 ;
if ( waitpid ( pid , & status , 0 ) < 0 ) {
ret = get_errno ( ) ;
XPR ( NT "external compression [pid %d] wait: %s\n" , pid , xd3_mainerror ( ret ) ) ;
}
else if ( ! WIFEXITED ( status ) ) {
if ( ! WIFSIGNALED ( status ) || WTERMSIG ( status ) != SIGPIPE ) {
ret = ECHILD ;
XPR ( NT "external compression [pid %d] signal %d\n" , pid , WIFSIGNALED ( status ) ? WTERMSIG ( status ) : WSTOPSIG ( status ) ) ;
}
else if ( option_verbose ) {
XPR ( NT "external compression sigpipe\n" ) ;
}
}
else if ( WEXITSTATUS ( status ) != 0 ) {
ret = ECHILD ;
if ( option_verbose > 1 ) {
XPR ( NT "external compression [pid %d] exit %d\n" , pid , WEXITSTATUS ( status ) ) ;
}
}
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp8_mbpost_proc_across_ip_c ( unsigned char * src , int pitch , int rows , int cols , int flimit ) {
int r , c , i ;
unsigned char * s = src ;
unsigned char d [ 16 ] ;
for ( r = 0 ;
r < rows ;
r ++ ) {
int sumsq = 0 ;
int sum = 0 ;
for ( i = - 8 ;
i < 0 ;
i ++ ) s [ i ] = s [ 0 ] ;
for ( i = 0 ;
i < 17 ;
i ++ ) s [ i + cols ] = s [ cols - 1 ] ;
for ( i = - 8 ;
i <= 6 ;
i ++ ) {
sumsq += s [ i ] * s [ i ] ;
sum += s [ i ] ;
d [ i + 8 ] = 0 ;
}
for ( c = 0 ;
c < cols + 8 ;
c ++ ) {
int x = s [ c + 7 ] - s [ c - 8 ] ;
int y = s [ c + 7 ] + s [ c - 8 ] ;
sum += x ;
sumsq += x * y ;
d [ c & 15 ] = s [ c ] ;
if ( sumsq * 15 - sum * sum < flimit ) {
d [ c & 15 ] = ( 8 + sum + s [ c ] ) >> 4 ;
}
s [ c - 8 ] = d [ ( c - 8 ) & 15 ] ;
}
s += pitch ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void remoteDispatchError ( remote_error * rerr ) {
virErrorPtr verr = virGetLastError ( ) ;
if ( verr ) remoteDispatchCopyError ( rerr , verr ) ;
else remoteDispatchGenericError ( rerr ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | struct archive_string_conv * archive_string_conversion_to_charset ( struct archive * a , const char * charset , int best_effort ) {
int flag = SCONV_TO_CHARSET ;
if ( best_effort ) flag |= SCONV_BEST_EFFORT ;
return ( get_sconv_object ( a , get_current_charset ( a ) , charset , flag ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean logcat_seek_read ( wtap * wth , gint64 seek_off , struct wtap_pkthdr * phdr , Buffer * buf , int * err , gchar * * err_info ) {
if ( file_seek ( wth -> random_fh , seek_off , SEEK_SET , err ) == - 1 ) return FALSE ;
if ( ! logcat_read_packet ( ( struct logcat_phdr * ) wth -> priv , wth -> random_fh , phdr , buf , err , err_info ) ) {
if ( * err == 0 ) * err = WTAP_ERR_SHORT_READ ;
return FALSE ;
}
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int decode_coeff ( RangeCoder * c , Model * m ) {
int val , sign ;
val = rac_get_model_sym ( c , m ) ;
if ( val ) {
sign = rac_get_bit ( c ) ;
if ( val > 1 ) {
val -- ;
val = ( 1 << val ) + rac_get_bits ( c , val ) ;
}
if ( ! sign ) val = - val ;
}
return val ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void request_counter_add_request ( RequestCounter counter , Request request ) {
guint i ;
for ( i = 0 ;
i < REQUEST_TYPE_LAST ;
i ++ ) {
if ( REQUEST_WANTS_TYPE ( request , i ) ) {
counter [ i ] ++ ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int tile_worker_hook ( void * arg1 , void * arg2 ) {
TileWorkerData * const tile_data = ( TileWorkerData * ) arg1 ;
const TileInfo * const tile = ( TileInfo * ) arg2 ;
int mi_row , mi_col ;
for ( mi_row = tile -> mi_row_start ;
mi_row < tile -> mi_row_end ;
mi_row += MI_BLOCK_SIZE ) {
vp9_zero ( tile_data -> xd . left_context ) ;
vp9_zero ( tile_data -> xd . left_seg_context ) ;
for ( mi_col = tile -> mi_col_start ;
mi_col < tile -> mi_col_end ;
mi_col += MI_BLOCK_SIZE ) {
decode_partition ( tile_data -> cm , & tile_data -> xd , tile , mi_row , mi_col , & tile_data -> bit_reader , BLOCK_64X64 ) ;
}
}
return ! tile_data -> xd . corrupted ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( AccountChooserDialogAndroidTest , CheckHistogramsReportingOnceAccountViaOnAccountClick ) {
base : : HistogramTester histogram_tester ;
AccountChooserDialogAndroid * dialog = CreateDialogOneAccount ( ) ;
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.AccountChooserDialogOneAccount" , password_manager : : metrics_util : : ACCOUNT_CHOOSER_CREDENTIAL_CHOSEN , 1 ) ;
histogram_tester . ExpectTotalCount ( "PasswordManager.AccountChooserDialogMultipleAccounts" , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int PEM_write_ ## name ( FILE * fp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
# endif # define DECLARE_PEM_read_bio ( name , type ) type * PEM_read_bio_ ## name ( BIO * bp , type * * x , pem_password_cb * cb , void * u ) ;
# define DECLARE_PEM_write_bio ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , type * x ) ;
# define DECLARE_PEM_write_bio_const ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , const type * x ) ;
# define DECLARE_PEM_write_cb_bio ( name , type ) int PEM_write_bio_ ## name ( BIO * bp , type * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
# define DECLARE_PEM_write ( name , type ) DECLARE_PEM_write_bio ( name , type ) DECLARE_PEM_write_fp ( name , type ) # define DECLARE_PEM_write_const ( name , type ) DECLARE_PEM_write_bio_const ( name , type ) DECLARE_PEM_write_fp_const ( name , type ) # define DECLARE_PEM_write_cb ( name , type ) DECLARE_PEM_write_cb_bio ( name , type ) DECLARE_PEM_write_cb_fp ( name , type ) # define DECLARE_PEM_read ( name , type ) DECLARE_PEM_read_bio ( name , type ) DECLARE_PEM_read_fp ( name , type ) # define DECLARE_PEM_rw ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write ( name , type ) # define DECLARE_PEM_rw_const ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_const ( name , type ) # define DECLARE_PEM_rw_cb ( name , type ) DECLARE_PEM_read ( name , type ) DECLARE_PEM_write_cb ( name , type ) typedef int pem_password_cb ( char * buf , int size , int rwflag , void * userdata ) ;
int PEM_get_EVP_CIPHER_INFO ( char * header , EVP_CIPHER_INFO * cipher ) ;
int PEM_do_header ( EVP_CIPHER_INFO * cipher , unsigned char * data , long * len , pem_password_cb * callback , void * u ) ;
int PEM_read_bio ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len ) ;
# define PEM_FLAG_SECURE 0x1 # define PEM_FLAG_EAY_COMPATIBLE 0x2 # define PEM_FLAG_ONLY_B64 0x4 int PEM_read_bio_ex ( BIO * bp , char * * name , char * * header , unsigned char * * data , long * len , unsigned int flags ) ;
int PEM_bytes_read_bio_secmem ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
int PEM_write_bio ( BIO * bp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
int PEM_bytes_read_bio ( unsigned char * * pdata , long * plen , char * * pnm , const char * name , BIO * bp , pem_password_cb * cb , void * u ) ;
void * PEM_ASN1_read_bio ( d2i_of_void * d2i , const char * name , BIO * bp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write_bio ( i2d_of_void * i2d , const char * name , BIO * bp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cb , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read_bio ( BIO * bp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
int PEM_X509_INFO_write_bio ( BIO * bp , X509_INFO * xi , EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * cd , void * u ) ;
# ifndef OPENSSL_NO_STDIO int PEM_read ( FILE * fp , char * * name , char * * header , unsigned char * * data , long * len ) ;
int PEM_write ( FILE * fp , const char * name , const char * hdr , const unsigned char * data , long len ) ;
void * PEM_ASN1_read ( d2i_of_void * d2i , const char * name , FILE * fp , void * * x , pem_password_cb * cb , void * u ) ;
int PEM_ASN1_write ( i2d_of_void * i2d , const char * name , FILE * fp , void * x , const EVP_CIPHER * enc , unsigned char * kstr , int klen , pem_password_cb * callback , void * u ) ;
STACK_OF ( X509_INFO ) * PEM_X509_INFO_read ( FILE * fp , STACK_OF ( X509_INFO ) * sk , pem_password_cb * cb , void * u ) ;
# endif int PEM_SignInit ( EVP_MD_CTX * ctx , EVP_MD * type ) ;
int PEM_SignUpdate ( EVP_MD_CTX * ctx , unsigned char * d , unsigned int cnt ) ;
int PEM_SignFinal ( EVP_MD_CTX * ctx , unsigned char * sigret , unsigned int * siglen , EVP_PKEY * pkey ) ;
int PEM_def_callback ( char * buf , int num , int rwflag , void * userdata ) ;
void PEM_proc_type ( char * buf , int type ) ;
void PEM_dek_info ( char * buf , const char * type , int len , char * str ) ;
# include < openssl / symhacks . h > DECLARE_PEM_rw ( X509 , X509 ) DECLARE_PEM_rw ( X509_AUX , X509 ) DECLARE_PEM_rw ( X509_REQ , X509_REQ ) DECLARE_PEM_write ( X509_REQ_NEW , X509_REQ ) DECLARE_PEM_rw ( X509_CRL , X509_CRL ) DECLARE_PEM_rw ( PKCS7 , PKCS7 ) DECLARE_PEM_rw ( NETSCAPE_CERT_SEQUENCE , NETSCAPE_CERT_SEQUENCE ) DECLARE_PEM_rw ( PKCS8 , X509_SIG ) DECLARE_PEM_rw ( PKCS8_PRIV_KEY_INFO , PKCS8_PRIV_KEY_INFO ) # ifndef OPENSSL_NO_RSA DECLARE_PEM_rw_cb ( RSAPrivateKey , RSA ) DECLARE_PEM_rw_const ( RSAPublicKey , RSA ) DECLARE_PEM_rw ( RSA_PUBKEY , RSA ) # endif # ifndef OPENSSL_NO_DSA DECLARE_PEM_rw_cb ( DSAPrivateKey , DSA ) DECLARE_PEM_rw ( DSA_PUBKEY , DSA ) DECLARE_PEM_rw_const ( DSAparams , DSA ) # endif # ifndef OPENSSL_NO_EC DECLARE_PEM_rw_const ( ECPKParameters , EC_GROUP ) DECLARE_PEM_rw_cb ( ECPrivateKey , EC_KEY ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int filecopy ( MI_CHECK * param , File to , File from , my_off_t start , my_off_t length , const char * type ) {
char tmp_buff [ IO_SIZE ] , * buff ;
ulong buff_length ;
DBUG_ENTER ( "filecopy" ) ;
buff_length = ( ulong ) min ( param -> write_buffer_length , length ) ;
if ( ! ( buff = my_malloc ( buff_length , MYF ( 0 ) ) ) ) {
buff = tmp_buff ;
buff_length = IO_SIZE ;
}
mysql_file_seek ( from , start , MY_SEEK_SET , MYF ( 0 ) ) ;
while ( length > buff_length ) {
if ( mysql_file_read ( from , ( uchar * ) buff , buff_length , MYF ( MY_NABP ) ) || mysql_file_write ( to , ( uchar * ) buff , buff_length , param -> myf_rw ) ) goto err ;
length -= buff_length ;
}
if ( mysql_file_read ( from , ( uchar * ) buff , ( uint ) length , MYF ( MY_NABP ) ) || mysql_file_write ( to , ( uchar * ) buff , ( uint ) length , param -> myf_rw ) ) goto err ;
if ( buff != tmp_buff ) my_free ( buff ) ;
DBUG_RETURN ( 0 ) ;
err : if ( buff != tmp_buff ) my_free ( buff ) ;
mi_check_print_error ( param , "Can't copy %s to tempfile, error %d" , type , my_errno ) ;
DBUG_RETURN ( 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_T_frameToThreadMapping ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_frameToThreadMapping , T_frameToThreadMapping_choice , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void _becomeOwner ( ArchiveHandle * AH , TocEntry * te ) {
RestoreOptions * ropt = AH -> public . ropt ;
if ( ropt && ( ropt -> noOwner || ! ropt -> use_setsessauth ) ) return ;
_becomeUser ( AH , te -> owner ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST ( PasswordManagerUtil , TrimUsernameOnlyCredentials ) {
ScopedVector < autofill : : PasswordForm > forms , expected_forms ;
forms . push_back ( new autofill : : PasswordForm ( GetTestAndroidCredentials ( kTestAndroidRealm ) ) ) ;
expected_forms . push_back ( new autofill : : PasswordForm ( GetTestAndroidCredentials ( kTestAndroidRealm ) ) ) ;
autofill : : PasswordForm username_only ;
username_only . scheme = autofill : : PasswordForm : : SCHEME_USERNAME_ONLY ;
username_only . signon_realm = kTestAndroidRealm ;
username_only . username_value = base : : ASCIIToUTF16 ( kTestUsername2 ) ;
forms . push_back ( new autofill : : PasswordForm ( username_only ) ) ;
username_only . federation_origin = url : : Origin ( GURL ( kTestFederationURL ) ) ;
username_only . skip_zero_click = false ;
forms . push_back ( new autofill : : PasswordForm ( username_only ) ) ;
username_only . skip_zero_click = true ;
expected_forms . push_back ( new autofill : : PasswordForm ( username_only ) ) ;
password_manager_util : : TrimUsernameOnlyCredentials ( & forms ) ;
EXPECT_THAT ( forms . get ( ) , UnorderedPasswordFormElementsAre ( expected_forms . get ( ) ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int do_save_master_pos ( ) {
MYSQL_RES * res ;
MYSQL_ROW row ;
MYSQL * mysql = cur_con -> mysql ;
const char * query ;
DBUG_ENTER ( "do_save_master_pos" ) ;
# ifdef HAVE_NDB_BINLOG {
ulong have_ndbcluster ;
if ( mysql_query ( mysql , query = "show variables like 'have_ndbcluster'" ) ) die ( "'%s' failed: %d %s" , query , mysql_errno ( mysql ) , mysql_error ( mysql ) ) ;
if ( ! ( res = mysql_store_result ( mysql ) ) ) die ( "mysql_store_result() returned NULL for '%s'" , query ) ;
if ( ! ( row = mysql_fetch_row ( res ) ) ) die ( "Query '%s' returned empty result" , query ) ;
have_ndbcluster = strcmp ( "YES" , row [ 1 ] ) == 0 ;
mysql_free_result ( res ) ;
if ( have_ndbcluster ) {
ulonglong start_epoch = 0 , handled_epoch = 0 , latest_epoch = 0 , latest_trans_epoch = 0 , latest_handled_binlog_epoch = 0 , latest_received_binlog_epoch = 0 , latest_applied_binlog_epoch = 0 ;
int count = 0 ;
int do_continue = 1 ;
while ( do_continue ) {
const char binlog [ ] = "binlog" ;
const char latest_epoch_str [ ] = "latest_epoch=" ;
const char latest_trans_epoch_str [ ] = "latest_trans_epoch=" ;
const char latest_received_binlog_epoch_str [ ] = "latest_received_binlog_epoch" ;
const char latest_handled_binlog_epoch_str [ ] = "latest_handled_binlog_epoch=" ;
const char latest_applied_binlog_epoch_str [ ] = "latest_applied_binlog_epoch=" ;
if ( count ) my_sleep ( 100 * 1000 ) ;
if ( mysql_query ( mysql , query = "show engine ndb status" ) ) die ( "failed in '%s': %d %s" , query , mysql_errno ( mysql ) , mysql_error ( mysql ) ) ;
if ( ! ( res = mysql_store_result ( mysql ) ) ) die ( "mysql_store_result() returned NULL for '%s'" , query ) ;
while ( ( row = mysql_fetch_row ( res ) ) ) {
if ( strcmp ( row [ 1 ] , binlog ) == 0 ) {
const char * status = row [ 2 ] ;
while ( * status && strncmp ( status , latest_epoch_str , sizeof ( latest_epoch_str ) - 1 ) ) status ++ ;
if ( * status ) {
status += sizeof ( latest_epoch_str ) - 1 ;
latest_epoch = strtoull ( status , ( char * * ) 0 , 10 ) ;
}
else die ( "result does not contain '%s' in '%s'" , latest_epoch_str , query ) ;
while ( * status && strncmp ( status , latest_trans_epoch_str , sizeof ( latest_trans_epoch_str ) - 1 ) ) status ++ ;
if ( * status ) {
status += sizeof ( latest_trans_epoch_str ) - 1 ;
latest_trans_epoch = strtoull ( status , ( char * * ) 0 , 10 ) ;
}
else die ( "result does not contain '%s' in '%s'" , latest_trans_epoch_str , query ) ;
while ( * status && strncmp ( status , latest_received_binlog_epoch_str , sizeof ( latest_received_binlog_epoch_str ) - 1 ) ) status ++ ;
if ( * status ) {
status += sizeof ( latest_received_binlog_epoch_str ) - 1 ;
latest_received_binlog_epoch = strtoull ( status , ( char * * ) 0 , 10 ) ;
}
else die ( "result does not contain '%s' in '%s'" , latest_received_binlog_epoch_str , query ) ;
while ( * status && strncmp ( status , latest_handled_binlog_epoch_str , sizeof ( latest_handled_binlog_epoch_str ) - 1 ) ) status ++ ;
if ( * status ) {
status += sizeof ( latest_handled_binlog_epoch_str ) - 1 ;
latest_handled_binlog_epoch = strtoull ( status , ( char * * ) 0 , 10 ) ;
}
else die ( "result does not contain '%s' in '%s'" , latest_handled_binlog_epoch_str , query ) ;
while ( * status && strncmp ( status , latest_applied_binlog_epoch_str , sizeof ( latest_applied_binlog_epoch_str ) - 1 ) ) status ++ ;
if ( * status ) {
status += sizeof ( latest_applied_binlog_epoch_str ) - 1 ;
latest_applied_binlog_epoch = strtoull ( status , ( char * * ) 0 , 10 ) ;
}
else die ( "result does not contain '%s' in '%s'" , latest_applied_binlog_epoch_str , query ) ;
if ( count == 0 ) start_epoch = latest_trans_epoch ;
break ;
}
}
if ( ! row ) die ( "result does not contain '%s' in '%s'" , binlog , query ) ;
if ( latest_handled_binlog_epoch > handled_epoch ) count = 0 ;
handled_epoch = latest_handled_binlog_epoch ;
count ++ ;
if ( latest_handled_binlog_epoch >= start_epoch ) do_continue = 0 ;
else if ( count > 300 ) {
break ;
}
mysql_free_result ( res ) ;
}
}
}
# endif if ( mysql_query ( mysql , query = "show master status" ) ) die ( "failed in 'show master status': %d %s" , mysql_errno ( mysql ) , mysql_error ( mysql ) ) ;
if ( ! ( res = mysql_store_result ( mysql ) ) ) die ( "mysql_store_result() retuned NULL for '%s'" , query ) ;
if ( ! ( row = mysql_fetch_row ( res ) ) ) die ( "empty result in show master status" ) ;
strnmov ( master_pos . file , row [ 0 ] , sizeof ( master_pos . file ) - 1 ) ;
master_pos . pos = strtoul ( row [ 1 ] , ( char * * ) 0 , 10 ) ;
mysql_free_result ( res ) ;
DBUG_RETURN ( 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void free_replace ( ) {
DBUG_ENTER ( "free_replace" ) ;
my_free ( glob_replace ) ;
glob_replace = NULL ;
DBUG_VOID_RETURN ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void proto_tree_set_ax25_tvb ( field_info * fi , tvbuff_t * tvb , gint start ) {
proto_tree_set_ax25 ( fi , tvb_get_ptr ( tvb , start , 7 ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int lag_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
LagarithContext * l = avctx -> priv_data ;
ThreadFrame frame = {
. f = data }
;
AVFrame * const p = data ;
uint8_t frametype = 0 ;
uint32_t offset_gu = 0 , offset_bv = 0 , offset_ry = 9 ;
uint32_t offs [ 4 ] ;
uint8_t * srcs [ 4 ] , * dst ;
int i , j , planes = 3 ;
p -> key_frame = 1 ;
frametype = buf [ 0 ] ;
offset_gu = AV_RL32 ( buf + 1 ) ;
offset_bv = AV_RL32 ( buf + 5 ) ;
switch ( frametype ) {
case FRAME_SOLID_RGBA : avctx -> pix_fmt = AV_PIX_FMT_RGB32 ;
if ( ff_thread_get_buffer ( avctx , & frame , 0 ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return - 1 ;
}
dst = p -> data [ 0 ] ;
for ( j = 0 ;
j < avctx -> height ;
j ++ ) {
for ( i = 0 ;
i < avctx -> width ;
i ++ ) AV_WN32 ( dst + i * 4 , offset_gu ) ;
dst += p -> linesize [ 0 ] ;
}
break ;
case FRAME_ARITH_RGBA : avctx -> pix_fmt = AV_PIX_FMT_RGB32 ;
planes = 4 ;
offset_ry += 4 ;
offs [ 3 ] = AV_RL32 ( buf + 9 ) ;
case FRAME_ARITH_RGB24 : case FRAME_U_RGB24 : if ( frametype == FRAME_ARITH_RGB24 || frametype == FRAME_U_RGB24 ) avctx -> pix_fmt = AV_PIX_FMT_RGB24 ;
if ( ff_thread_get_buffer ( avctx , & frame , 0 ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return - 1 ;
}
offs [ 0 ] = offset_bv ;
offs [ 1 ] = offset_gu ;
offs [ 2 ] = offset_ry ;
if ( ! l -> rgb_planes ) {
l -> rgb_stride = FFALIGN ( avctx -> width , 16 ) ;
l -> rgb_planes = av_malloc ( l -> rgb_stride * avctx -> height * planes + 1 ) ;
if ( ! l -> rgb_planes ) {
av_log ( avctx , AV_LOG_ERROR , "cannot allocate temporary buffer\n" ) ;
return AVERROR ( ENOMEM ) ;
}
}
for ( i = 0 ;
i < planes ;
i ++ ) srcs [ i ] = l -> rgb_planes + ( i + 1 ) * l -> rgb_stride * avctx -> height - l -> rgb_stride ;
if ( offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size || ( planes == 4 && offs [ 3 ] >= buf_size ) ) {
av_log ( avctx , AV_LOG_ERROR , "Invalid frame offsets\n" ) ;
return AVERROR_INVALIDDATA ;
}
for ( i = 0 ;
i < planes ;
i ++ ) lag_decode_arith_plane ( l , srcs [ i ] , avctx -> width , avctx -> height , - l -> rgb_stride , buf + offs [ i ] , buf_size - offs [ i ] ) ;
dst = p -> data [ 0 ] ;
for ( i = 0 ;
i < planes ;
i ++ ) srcs [ i ] = l -> rgb_planes + i * l -> rgb_stride * avctx -> height ;
for ( j = 0 ;
j < avctx -> height ;
j ++ ) {
for ( i = 0 ;
i < avctx -> width ;
i ++ ) {
uint8_t r , g , b , a ;
r = srcs [ 0 ] [ i ] ;
g = srcs [ 1 ] [ i ] ;
b = srcs [ 2 ] [ i ] ;
r += g ;
b += g ;
if ( frametype == FRAME_ARITH_RGBA ) {
a = srcs [ 3 ] [ i ] ;
AV_WN32 ( dst + i * 4 , MKBETAG ( a , r , g , b ) ) ;
}
else {
dst [ i * 3 + 0 ] = r ;
dst [ i * 3 + 1 ] = g ;
dst [ i * 3 + 2 ] = b ;
}
}
dst += p -> linesize [ 0 ] ;
for ( i = 0 ;
i < planes ;
i ++ ) srcs [ i ] += l -> rgb_stride ;
}
break ;
case FRAME_ARITH_YUY2 : avctx -> pix_fmt = AV_PIX_FMT_YUV422P ;
if ( ff_thread_get_buffer ( avctx , & frame , 0 ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return - 1 ;
}
if ( offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size ) {
av_log ( avctx , AV_LOG_ERROR , "Invalid frame offsets\n" ) ;
return AVERROR_INVALIDDATA ;
}
lag_decode_arith_plane ( l , p -> data [ 0 ] , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf + offset_ry , buf_size - offset_ry ) ;
lag_decode_arith_plane ( l , p -> data [ 1 ] , avctx -> width / 2 , avctx -> height , p -> linesize [ 1 ] , buf + offset_gu , buf_size - offset_gu ) ;
lag_decode_arith_plane ( l , p -> data [ 2 ] , avctx -> width / 2 , avctx -> height , p -> linesize [ 2 ] , buf + offset_bv , buf_size - offset_bv ) ;
break ;
case FRAME_ARITH_YV12 : avctx -> pix_fmt = AV_PIX_FMT_YUV420P ;
if ( ff_thread_get_buffer ( avctx , & frame , 0 ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return - 1 ;
}
if ( offset_ry >= buf_size || offset_gu >= buf_size || offset_bv >= buf_size ) {
av_log ( avctx , AV_LOG_ERROR , "Invalid frame offsets\n" ) ;
return AVERROR_INVALIDDATA ;
}
lag_decode_arith_plane ( l , p -> data [ 0 ] , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf + offset_ry , buf_size - offset_ry ) ;
lag_decode_arith_plane ( l , p -> data [ 2 ] , avctx -> width / 2 , avctx -> height / 2 , p -> linesize [ 2 ] , buf + offset_gu , buf_size - offset_gu ) ;
lag_decode_arith_plane ( l , p -> data [ 1 ] , avctx -> width / 2 , avctx -> height / 2 , p -> linesize [ 1 ] , buf + offset_bv , buf_size - offset_bv ) ;
break ;
default : av_log ( avctx , AV_LOG_ERROR , "Unsupported Lagarith frame type: %#x\n" , frametype ) ;
return - 1 ;
}
* got_frame = 1 ;
return buf_size ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline int selinux_option ( char * option , int len ) {
return ( match_prefix ( CONTEXT_STR , sizeof ( CONTEXT_STR ) - 1 , option , len ) || match_prefix ( FSCONTEXT_STR , sizeof ( FSCONTEXT_STR ) - 1 , option , len ) || match_prefix ( DEFCONTEXT_STR , sizeof ( DEFCONTEXT_STR ) - 1 , option , len ) || match_prefix ( ROOTCONTEXT_STR , sizeof ( ROOTCONTEXT_STR ) - 1 , option , len ) || match_prefix ( LABELSUPP_STR , sizeof ( LABELSUPP_STR ) - 1 , option , len ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSReturnCode TSUrlDestroy ( TSMBuffer , TSMLoc ) {
return TS_SUCCESS ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void pdf_sort_cmap ( fz_context * ctx , pdf_cmap * cmap ) {
int counts [ 3 ] ;
if ( cmap -> tree == NULL ) return ;
counts [ 0 ] = 0 ;
counts [ 1 ] = 0 ;
counts [ 2 ] = 0 ;
walk_splay ( cmap -> tree , cmap -> ttop , count_node_types , & counts ) ;
cmap -> ranges = fz_malloc_array ( ctx , counts [ 0 ] , sizeof ( * cmap -> ranges ) ) ;
cmap -> rcap = counts [ 0 ] ;
cmap -> xranges = fz_malloc_array ( ctx , counts [ 1 ] , sizeof ( * cmap -> xranges ) ) ;
cmap -> xcap = counts [ 1 ] ;
cmap -> mranges = fz_malloc_array ( ctx , counts [ 2 ] , sizeof ( * cmap -> mranges ) ) ;
cmap -> mcap = counts [ 2 ] ;
walk_splay ( cmap -> tree , cmap -> ttop , copy_node_types , cmap ) ;
fz_free ( ctx , cmap -> tree ) ;
cmap -> tree = NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void hb_fir_filter ( float * out , const float fir_coef [ HB_FIR_SIZE + 1 ] , float mem [ HB_FIR_SIZE ] , const float * in ) {
int i , j ;
float data [ AMRWB_SFR_SIZE_16k + HB_FIR_SIZE ] ;
memcpy ( data , mem , HB_FIR_SIZE * sizeof ( float ) ) ;
memcpy ( data + HB_FIR_SIZE , in , AMRWB_SFR_SIZE_16k * sizeof ( float ) ) ;
for ( i = 0 ;
i < AMRWB_SFR_SIZE_16k ;
i ++ ) {
out [ i ] = 0.0 ;
for ( j = 0 ;
j <= HB_FIR_SIZE ;
j ++ ) out [ i ] += data [ i + j ] * fir_coef [ j ] ;
}
memcpy ( mem , data + AMRWB_SFR_SIZE_16k , HB_FIR_SIZE * sizeof ( float ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static cmsBool CheckEOLN ( cmsIT8 * it8 ) {
if ( ! Check ( it8 , SEOLN , "Expected separator" ) ) return FALSE ;
while ( it8 -> sy == SEOLN ) InSymbol ( it8 ) ;
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void http_parse_query_test ( void ) {
struct evkeyvalq headers ;
fprintf ( stdout , "Testing HTTP query parsing: " ) ;
TAILQ_INIT ( & headers ) ;
evhttp_parse_query ( "http://www.test.com/?q=test" , & headers ) ;
if ( validate_header ( & headers , "q" , "test" ) != 0 ) goto fail ;
evhttp_clear_headers ( & headers ) ;
evhttp_parse_query ( "http://www.test.com/?q=test&foo=bar" , & headers ) ;
if ( validate_header ( & headers , "q" , "test" ) != 0 ) goto fail ;
if ( validate_header ( & headers , "foo" , "bar" ) != 0 ) goto fail ;
evhttp_clear_headers ( & headers ) ;
evhttp_parse_query ( "http://www.test.com/?q=test+foo" , & headers ) ;
if ( validate_header ( & headers , "q" , "test foo" ) != 0 ) goto fail ;
evhttp_clear_headers ( & headers ) ;
evhttp_parse_query ( "http://www.test.com/?q=test%0Afoo" , & headers ) ;
if ( validate_header ( & headers , "q" , "test\nfoo" ) != 0 ) goto fail ;
evhttp_clear_headers ( & headers ) ;
evhttp_parse_query ( "http://www.test.com/?q=test%0Dfoo" , & headers ) ;
if ( validate_header ( & headers , "q" , "test\rfoo" ) != 0 ) goto fail ;
evhttp_clear_headers ( & headers ) ;
fprintf ( stdout , "OK\n" ) ;
return ;
fail : fprintf ( stdout , "FAILED\n" ) ;
exit ( 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void tcmpt_destroy ( jpc_enc_tcmpt_t * tcmpt ) {
jpc_enc_rlvl_t * rlvl ;
uint_fast16_t rlvlno ;
if ( tcmpt -> rlvls ) {
for ( rlvlno = 0 , rlvl = tcmpt -> rlvls ;
rlvlno < tcmpt -> numrlvls ;
++ rlvlno , ++ rlvl ) {
rlvl_destroy ( rlvl ) ;
}
jas_free ( tcmpt -> rlvls ) ;
tcmpt -> rlvls = NULL ;
}
if ( tcmpt -> data ) {
jas_seq2d_destroy ( tcmpt -> data ) ;
tcmpt -> data = NULL ;
}
if ( tcmpt -> tsfb ) {
jpc_tsfb_destroy ( tcmpt -> tsfb ) ;
tcmpt -> tsfb = NULL ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void proto_register_lbmpdm ( void ) {
static hf_register_info hf [ ] = {
{
& hf_lbmpdm_magic , {
"Magic" , "lbmpdm.magic" , FT_UINT32 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_encoding , {
"Encoding" , "lbmpdm.encoding" , FT_STRING , BASE_NONE , NULL , 0x0 , "encoding as determined by magic number" , HFILL }
}
, {
& hf_lbmpdm_ver , {
"Version" , "lbmpdm.ver" , FT_UINT8 , BASE_DEC , NULL , PDM_HDR_VER_TYPE_VER_MASK , NULL , HFILL }
}
, {
& hf_lbmpdm_type , {
"Type" , "lbmpdm.type" , FT_UINT8 , BASE_DEC , NULL , PDM_HDR_VER_TYPE_TYPE_MASK , NULL , HFILL }
}
, {
& hf_lbmpdm_next_hdr , {
"Next Header" , "lbmpdm.next_hdr" , FT_UINT8 , BASE_DEC_HEX , VALS ( lbmpdm_next_header ) , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_def_major_ver , {
"Definition Major Version" , "lbmpdm.def_major_ver" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_def_minor_ver , {
"Definition Minor Version" , "lbmpdm.def_minor_ver" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_def_id , {
"Definition ID" , "lbmpdm.def_id" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_len , {
"Length" , "lbmpdm.len" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segments , {
"Segments" , "lbmpdm.segments" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment , {
"Segment" , "lbmpdm.segment" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_next_hdr , {
"Next Header" , "lbmpdm.segment.next_hdr" , FT_UINT8 , BASE_DEC_HEX , VALS ( lbmpdm_next_header ) , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_flags , {
"Flags" , "lbmpdm.segment.flags" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_res , {
"Reserved" , "lbmpdm.segment.res" , FT_UINT16 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_len , {
"Length" , "lbmpdm.segment.len" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_id , {
"Definition ID" , "lbmpdm.segment_def.id" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_num_fields , {
"Number Of Fields" , "lbmpdm.segment_def.num_fields" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_names_type , {
"Field Names Type" , "lbmpdm.segment_def.field_names_type" , FT_UINT8 , BASE_HEX , VALS ( lbmpdm_field_name_type ) , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_finalized , {
"Finalized" , "lbmpdm.segment_def.finalized" , FT_UINT8 , BASE_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_msg_vers_major , {
"Definition Major Version" , "lbmpdm.segment_def.msg_vers_major" , FT_UINT8 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_msg_vers_minor , {
"Definition Minor Version" , "lbmpdm.segment_def.msg_vers_minor" , FT_UINT8 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_fixed_req_section_len , {
"Fixed Required Section Length" , "lbmpdm.segment_def.fixed_req_section_len" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_info_len , {
"Field Information Length" , "lbmpdm.segment_def.field_info_len" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field , {
"Field Definition" , "lbmpdm.segment_def.field" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_def_len , {
"Definition Length" , "lbmpdm.segment_def.field.def_len" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_id , {
"ID" , "lbmpdm.segment_def.field.id" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_len , {
"Length" , "lbmpdm.segment_def.field.len" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_fixed_str_len , {
"Fixed String Length" , "lbmpdm.segment_def.field.fixed_str_len" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_num_arr_elem , {
"Number Of Array Elements" , "lbmpdm.segment_def.field.num_arr_elem" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_req , {
"Required" , "lbmpdm.segment_def.field.req" , FT_UINT8 , BASE_HEX , VALS ( lbmpdm_field_required ) , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_fixed , {
"Fixed Length Field" , "lbmpdm.segment_def.field.fixed" , FT_UINT8 , BASE_HEX , VALS ( lbmpdm_field_fixed_length ) , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_fld_int_name , {
"Field Integer Name" , "lbmpdm.segment_def.field.fld_int_name" , FT_INT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_str_name_len , {
"String Name Length" , "lbmpdm.segment_def.field.str_name_len" , FT_INT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_str_name , {
"String Name" , "lbmpdm.segment_def.field.str_name" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_def_field_fld_type , {
"Field Type" , "lbmpdm.segment_def.field.fld_type" , FT_UINT16 , BASE_DEC_HEX , VALS ( lbmpdm_field_type ) , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_offset_entry , {
"Offset Entry" , "lbmpdm.segment_ofs.entry" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_offset_entry_id , {
"ID" , "lbmpdm.segment_ofs.entry.id" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_offset_entry_offset , {
"Offset" , "lbmpdm.segment_ofs.entry.offset" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_segment_data , {
"Data" , "lbmpdm.segment.data" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field , {
"Field" , "lbmpdm.field" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_id , {
"ID" , "lbmpdm.field.id" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_string_name , {
"String Name" , "lbmpdm.field.string_name" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_int_name , {
"Integer Name" , "lbmpdm.field.int_name" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_type , {
"Type" , "lbmpdm.field.type" , FT_UINT16 , BASE_DEC_HEX , VALS ( lbmpdm_field_type ) , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_total_length , {
"Total Length" , "lbmpdm.field.total_length" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_length , {
"Length" , "lbmpdm.field.length" , FT_UINT32 , BASE_DEC_HEX , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_boolean , {
"Boolean Value" , "lbmpdm.field.value_boolean" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_int8 , {
"INT8 Value" , "lbmpdm.field.value_int8" , FT_INT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_uint8 , {
"UINT8 Value" , "lbmpdm.field.value_uint8" , FT_UINT8 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_int16 , {
"INT16 Value" , "lbmpdm.field.value_int16" , FT_INT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_uint16 , {
"UINT16 Value" , "lbmpdm.field.value_uint16" , FT_UINT16 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_int32 , {
"INT32 Value" , "lbmpdm.field.value_int32" , FT_INT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_uint32 , {
"UINT32 Value" , "lbmpdm.field.value_uint32" , FT_UINT32 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_int64 , {
"INT64 Value" , "lbmpdm.field.value_int64" , FT_INT64 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_uint64 , {
"UINT64 Value" , "lbmpdm.field.value_uint64" , FT_UINT64 , BASE_DEC , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_float , {
"FLOAT Value" , "lbmpdm.field.value_float" , FT_FLOAT , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_double , {
"DOUBLE Value" , "lbmpdm.field.value_double" , FT_DOUBLE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_decimal , {
"DECIMAL Value" , "lbmpdm.field.value_decimal" , FT_NONE , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_timestamp , {
"TIMESTAMP Value" , "lbmpdm.field.value_timestamp" , FT_ABSOLUTE_TIME , ABSOLUTE_TIME_LOCAL , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_fixed_string , {
"FIXED STRING Value" , "lbmpdm.field.value_fixed_string" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_string , {
"STRING Value" , "lbmpdm.field.value_string" , FT_STRING , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_fixed_unicode , {
"FIXED UNICODE Value" , "lbmpdm.field.value_fixed_unicode" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_unicode , {
"UNICODE Value" , "lbmpdm.field.value_unicode" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_blob , {
"BLOB Value" , "lbmpdm.field.value_blob" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
, {
& hf_lbmpdm_field_value_message , {
"MESSAGE Value" , "lbmpdm.field.value_message" , FT_BYTES , BASE_NONE , NULL , 0x0 , NULL , HFILL }
}
}
;
static gint * ett [ ] = {
& ett_lbmpdm , & ett_lbmpdm_segments , & ett_lbmpdm_segment , & ett_lbmpdm_offset_entry , & ett_lbmpdm_segment_def_field , & ett_lbmpdm_field }
;
proto_lbmpdm = proto_register_protocol ( "LBMPDM Protocol" , "LBMPDM" , "lbmpdm" ) ;
proto_register_field_array ( proto_lbmpdm , hf , array_length ( hf ) ) ;
proto_register_subtree_array ( ett , array_length ( ett ) ) ;
lbmpdm_definition_table = wmem_tree_new_autoreset ( wmem_epan_scope ( ) , wmem_file_scope ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint64_t openpic_cpu_read ( void * opaque , hwaddr addr , unsigned len ) {
return openpic_cpu_read_internal ( opaque , addr , ( addr & 0x1f000 ) >> 12 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
AVFrame * frame = data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
LclDecContext * const c = avctx -> priv_data ;
unsigned char * encoded = ( unsigned char * ) buf ;
unsigned int pixel_ptr ;
int row , col ;
unsigned char * outptr ;
uint8_t * y_out , * u_out , * v_out ;
unsigned int width = avctx -> width ;
unsigned int height = avctx -> height ;
unsigned int mszh_dlen ;
unsigned char yq , y1q , uq , vq ;
int uqvq , ret ;
unsigned int mthread_inlen , mthread_outlen ;
unsigned int len = buf_size ;
if ( ( ret = ff_get_buffer ( avctx , frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
outptr = frame -> data [ 0 ] ;
switch ( avctx -> codec_id ) {
case AV_CODEC_ID_MSZH : switch ( c -> compression ) {
case COMP_MSZH : if ( c -> flags & FLAG_MULTITHREAD ) {
mthread_inlen = AV_RL32 ( encoded ) ;
mthread_inlen = FFMIN ( mthread_inlen , len - 8 ) ;
mthread_outlen = AV_RL32 ( encoded + 4 ) ;
mthread_outlen = FFMIN ( mthread_outlen , c -> decomp_size ) ;
mszh_dlen = mszh_decomp ( encoded + 8 , mthread_inlen , c -> decomp_buf , c -> decomp_size ) ;
if ( mthread_outlen != mszh_dlen ) {
av_log ( avctx , AV_LOG_ERROR , "Mthread1 decoded size differs (%d != %d)\n" , mthread_outlen , mszh_dlen ) ;
return AVERROR_INVALIDDATA ;
}
mszh_dlen = mszh_decomp ( encoded + 8 + mthread_inlen , len - 8 - mthread_inlen , c -> decomp_buf + mthread_outlen , c -> decomp_size - mthread_outlen ) ;
if ( mthread_outlen != mszh_dlen ) {
av_log ( avctx , AV_LOG_ERROR , "Mthread2 decoded size differs (%d != %d)\n" , mthread_outlen , mszh_dlen ) ;
return AVERROR_INVALIDDATA ;
}
encoded = c -> decomp_buf ;
len = c -> decomp_size ;
}
else {
mszh_dlen = mszh_decomp ( encoded , len , c -> decomp_buf , c -> decomp_size ) ;
if ( c -> decomp_size != mszh_dlen ) {
av_log ( avctx , AV_LOG_ERROR , "Decoded size differs (%d != %d)\n" , c -> decomp_size , mszh_dlen ) ;
return AVERROR_INVALIDDATA ;
}
encoded = c -> decomp_buf ;
len = mszh_dlen ;
}
break ;
case COMP_MSZH_NOCOMP : {
int bppx2 ;
switch ( c -> imgtype ) {
case IMGTYPE_YUV111 : case IMGTYPE_RGB24 : bppx2 = 6 ;
break ;
case IMGTYPE_YUV422 : case IMGTYPE_YUV211 : bppx2 = 4 ;
break ;
case IMGTYPE_YUV411 : case IMGTYPE_YUV420 : bppx2 = 3 ;
break ;
default : bppx2 = 0 ;
break ;
}
if ( len < ( ( width * height * bppx2 ) >> 1 ) ) return AVERROR_INVALIDDATA ;
break ;
}
default : av_log ( avctx , AV_LOG_ERROR , "BUG! Unknown MSZH compression in frame decoder.\n" ) ;
return AVERROR_INVALIDDATA ;
}
break ;
# if CONFIG_ZLIB_DECODER case AV_CODEC_ID_ZLIB : if ( c -> compression == COMP_ZLIB_NORMAL && c -> imgtype == IMGTYPE_RGB24 && len == width * height * 3 ) {
if ( c -> flags & FLAG_PNGFILTER ) {
memcpy ( c -> decomp_buf , encoded , len ) ;
encoded = c -> decomp_buf ;
}
else {
break ;
}
}
else if ( c -> flags & FLAG_MULTITHREAD ) {
mthread_inlen = AV_RL32 ( encoded ) ;
mthread_inlen = FFMIN ( mthread_inlen , len - 8 ) ;
mthread_outlen = AV_RL32 ( encoded + 4 ) ;
mthread_outlen = FFMIN ( mthread_outlen , c -> decomp_size ) ;
ret = zlib_decomp ( avctx , encoded + 8 , mthread_inlen , 0 , mthread_outlen ) ;
if ( ret < 0 ) return ret ;
ret = zlib_decomp ( avctx , encoded + 8 + mthread_inlen , len - 8 - mthread_inlen , mthread_outlen , mthread_outlen ) ;
if ( ret < 0 ) return ret ;
}
else {
int ret = zlib_decomp ( avctx , encoded , len , 0 , c -> decomp_size ) ;
if ( ret < 0 ) return ret ;
}
encoded = c -> decomp_buf ;
len = c -> decomp_size ;
break ;
# endif default : av_log ( avctx , AV_LOG_ERROR , "BUG! Unknown codec in frame decoder compression switch.\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( avctx -> codec_id == AV_CODEC_ID_ZLIB && ( c -> flags & FLAG_PNGFILTER ) ) {
switch ( c -> imgtype ) {
case IMGTYPE_YUV111 : case IMGTYPE_RGB24 : for ( row = 0 ;
row < height ;
row ++ ) {
pixel_ptr = row * width * 3 ;
yq = encoded [ pixel_ptr ++ ] ;
uqvq = AV_RL16 ( encoded + pixel_ptr ) ;
pixel_ptr += 2 ;
for ( col = 1 ;
col < width ;
col ++ ) {
encoded [ pixel_ptr ] = yq -= encoded [ pixel_ptr ] ;
uqvq -= AV_RL16 ( encoded + pixel_ptr + 1 ) ;
AV_WL16 ( encoded + pixel_ptr + 1 , uqvq ) ;
pixel_ptr += 3 ;
}
}
break ;
case IMGTYPE_YUV422 : for ( row = 0 ;
row < height ;
row ++ ) {
pixel_ptr = row * width * 2 ;
yq = uq = vq = 0 ;
for ( col = 0 ;
col < width / 4 ;
col ++ ) {
encoded [ pixel_ptr ] = yq -= encoded [ pixel_ptr ] ;
encoded [ pixel_ptr + 1 ] = yq -= encoded [ pixel_ptr + 1 ] ;
encoded [ pixel_ptr + 2 ] = yq -= encoded [ pixel_ptr + 2 ] ;
encoded [ pixel_ptr + 3 ] = yq -= encoded [ pixel_ptr + 3 ] ;
encoded [ pixel_ptr + 4 ] = uq -= encoded [ pixel_ptr + 4 ] ;
encoded [ pixel_ptr + 5 ] = uq -= encoded [ pixel_ptr + 5 ] ;
encoded [ pixel_ptr + 6 ] = vq -= encoded [ pixel_ptr + 6 ] ;
encoded [ pixel_ptr + 7 ] = vq -= encoded [ pixel_ptr + 7 ] ;
pixel_ptr += 8 ;
}
}
break ;
case IMGTYPE_YUV411 : for ( row = 0 ;
row < height ;
row ++ ) {
pixel_ptr = row * width / 2 * 3 ;
yq = uq = vq = 0 ;
for ( col = 0 ;
col < width / 4 ;
col ++ ) {
encoded [ pixel_ptr ] = yq -= encoded [ pixel_ptr ] ;
encoded [ pixel_ptr + 1 ] = yq -= encoded [ pixel_ptr + 1 ] ;
encoded [ pixel_ptr + 2 ] = yq -= encoded [ pixel_ptr + 2 ] ;
encoded [ pixel_ptr + 3 ] = yq -= encoded [ pixel_ptr + 3 ] ;
encoded [ pixel_ptr + 4 ] = uq -= encoded [ pixel_ptr + 4 ] ;
encoded [ pixel_ptr + 5 ] = vq -= encoded [ pixel_ptr + 5 ] ;
pixel_ptr += 6 ;
}
}
break ;
case IMGTYPE_YUV211 : for ( row = 0 ;
row < height ;
row ++ ) {
pixel_ptr = row * width * 2 ;
yq = uq = vq = 0 ;
for ( col = 0 ;
col < width / 2 ;
col ++ ) {
encoded [ pixel_ptr ] = yq -= encoded [ pixel_ptr ] ;
encoded [ pixel_ptr + 1 ] = yq -= encoded [ pixel_ptr + 1 ] ;
encoded [ pixel_ptr + 2 ] = uq -= encoded [ pixel_ptr + 2 ] ;
encoded [ pixel_ptr + 3 ] = vq -= encoded [ pixel_ptr + 3 ] ;
pixel_ptr += 4 ;
}
}
break ;
case IMGTYPE_YUV420 : for ( row = 0 ;
row < height / 2 ;
row ++ ) {
pixel_ptr = row * width * 3 ;
yq = y1q = uq = vq = 0 ;
for ( col = 0 ;
col < width / 2 ;
col ++ ) {
encoded [ pixel_ptr ] = yq -= encoded [ pixel_ptr ] ;
encoded [ pixel_ptr + 1 ] = yq -= encoded [ pixel_ptr + 1 ] ;
encoded [ pixel_ptr + 2 ] = y1q -= encoded [ pixel_ptr + 2 ] ;
encoded [ pixel_ptr + 3 ] = y1q -= encoded [ pixel_ptr + 3 ] ;
encoded [ pixel_ptr + 4 ] = uq -= encoded [ pixel_ptr + 4 ] ;
encoded [ pixel_ptr + 5 ] = vq -= encoded [ pixel_ptr + 5 ] ;
pixel_ptr += 6 ;
}
}
break ;
default : av_log ( avctx , AV_LOG_ERROR , "BUG! Unknown imagetype in pngfilter switch.\n" ) ;
return AVERROR_INVALIDDATA ;
}
}
y_out = frame -> data [ 0 ] + ( height - 1 ) * frame -> linesize [ 0 ] ;
u_out = frame -> data [ 1 ] + ( height - 1 ) * frame -> linesize [ 1 ] ;
v_out = frame -> data [ 2 ] + ( height - 1 ) * frame -> linesize [ 2 ] ;
switch ( c -> imgtype ) {
case IMGTYPE_YUV111 : for ( row = 0 ;
row < height ;
row ++ ) {
for ( col = 0 ;
col < width ;
col ++ ) {
y_out [ col ] = * encoded ++ ;
u_out [ col ] = * encoded ++ + 128 ;
v_out [ col ] = * encoded ++ + 128 ;
}
y_out -= frame -> linesize [ 0 ] ;
u_out -= frame -> linesize [ 1 ] ;
v_out -= frame -> linesize [ 2 ] ;
}
break ;
case IMGTYPE_YUV422 : for ( row = 0 ;
row < height ;
row ++ ) {
for ( col = 0 ;
col < width - 3 ;
col += 4 ) {
memcpy ( y_out + col , encoded , 4 ) ;
encoded += 4 ;
u_out [ col >> 1 ] = * encoded ++ + 128 ;
u_out [ ( col >> 1 ) + 1 ] = * encoded ++ + 128 ;
v_out [ col >> 1 ] = * encoded ++ + 128 ;
v_out [ ( col >> 1 ) + 1 ] = * encoded ++ + 128 ;
}
y_out -= frame -> linesize [ 0 ] ;
u_out -= frame -> linesize [ 1 ] ;
v_out -= frame -> linesize [ 2 ] ;
}
break ;
case IMGTYPE_RGB24 : for ( row = height - 1 ;
row >= 0 ;
row -- ) {
pixel_ptr = row * frame -> linesize [ 0 ] ;
memcpy ( outptr + pixel_ptr , encoded , 3 * width ) ;
encoded += 3 * width ;
}
break ;
case IMGTYPE_YUV411 : for ( row = 0 ;
row < height ;
row ++ ) {
for ( col = 0 ;
col < width - 3 ;
col += 4 ) {
memcpy ( y_out + col , encoded , 4 ) ;
encoded += 4 ;
u_out [ col >> 2 ] = * encoded ++ + 128 ;
v_out [ col >> 2 ] = * encoded ++ + 128 ;
}
y_out -= frame -> linesize [ 0 ] ;
u_out -= frame -> linesize [ 1 ] ;
v_out -= frame -> linesize [ 2 ] ;
}
break ;
case IMGTYPE_YUV211 : for ( row = 0 ;
row < height ;
row ++ ) {
for ( col = 0 ;
col < width - 1 ;
col += 2 ) {
memcpy ( y_out + col , encoded , 2 ) ;
encoded += 2 ;
u_out [ col >> 1 ] = * encoded ++ + 128 ;
v_out [ col >> 1 ] = * encoded ++ + 128 ;
}
y_out -= frame -> linesize [ 0 ] ;
u_out -= frame -> linesize [ 1 ] ;
v_out -= frame -> linesize [ 2 ] ;
}
break ;
case IMGTYPE_YUV420 : u_out = frame -> data [ 1 ] + ( ( height >> 1 ) - 1 ) * frame -> linesize [ 1 ] ;
v_out = frame -> data [ 2 ] + ( ( height >> 1 ) - 1 ) * frame -> linesize [ 2 ] ;
for ( row = 0 ;
row < height - 1 ;
row += 2 ) {
for ( col = 0 ;
col < width - 1 ;
col += 2 ) {
memcpy ( y_out + col , encoded , 2 ) ;
encoded += 2 ;
memcpy ( y_out + col - frame -> linesize [ 0 ] , encoded , 2 ) ;
encoded += 2 ;
u_out [ col >> 1 ] = * encoded ++ + 128 ;
v_out [ col >> 1 ] = * encoded ++ + 128 ;
}
y_out -= frame -> linesize [ 0 ] << 1 ;
u_out -= frame -> linesize [ 1 ] ;
v_out -= frame -> linesize [ 2 ] ;
}
break ;
default : av_log ( avctx , AV_LOG_ERROR , "BUG! Unknown imagetype in image decoder.\n" ) ;
return AVERROR_INVALIDDATA ;
}
* got_frame = 1 ;
return buf_size ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static real Blend ( real u [ MmMax ] , struct pscontext * context ) {
real sum = u [ 0 ] ;
int i ;
for ( i = 1 ;
i < context -> instance_count ;
++ i ) sum += context -> blend_values [ i ] * u [ i ] ;
return ( sum ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | jas_image_t * jas_image_chclrspc ( jas_image_t * image , jas_cmprof_t * outprof , int intent ) {
jas_image_t * inimage ;
int minhstep ;
int minvstep ;
int i ;
int j ;
int k ;
int n ;
int hstep ;
int vstep ;
int numinauxchans ;
int numoutauxchans ;
int numinclrchans ;
int numoutclrchans ;
int prec ;
jas_image_t * outimage ;
int cmpttype ;
int numoutchans ;
jas_cmprof_t * inprof ;
jas_cmprof_t * tmpprof ;
jas_image_cmptparm_t cmptparm ;
int width ;
int height ;
jas_cmxform_t * xform ;
jas_cmpixmap_t inpixmap ;
jas_cmpixmap_t outpixmap ;
jas_cmcmptfmt_t * incmptfmts ;
jas_cmcmptfmt_t * outcmptfmts ;
# if 0 jas_eprintf ( "IMAGE\n" ) ;
jas_image_dump ( image , stderr ) ;
# endif if ( ! ( inimage = jas_image_copy ( image ) ) ) goto error ;
image = 0 ;
if ( ! jas_image_ishomosamp ( inimage ) ) {
minhstep = jas_image_cmpthstep ( inimage , 0 ) ;
minvstep = jas_image_cmptvstep ( inimage , 0 ) ;
for ( i = 1 ;
i < jas_image_numcmpts ( inimage ) ;
++ i ) {
hstep = jas_image_cmpthstep ( inimage , i ) ;
vstep = jas_image_cmptvstep ( inimage , i ) ;
if ( hstep < minhstep ) minhstep = hstep ;
if ( vstep < minvstep ) minvstep = vstep ;
}
n = jas_image_numcmpts ( inimage ) ;
for ( i = 0 ;
i < n ;
++ i ) {
cmpttype = jas_image_cmpttype ( inimage , i ) ;
if ( jas_image_sampcmpt ( inimage , i , i + 1 , 0 , 0 , minhstep , minvstep , jas_image_cmptsgnd ( inimage , i ) , jas_image_cmptprec ( inimage , i ) ) ) goto error ;
jas_image_setcmpttype ( inimage , i + 1 , cmpttype ) ;
jas_image_delcmpt ( inimage , i ) ;
}
}
width = jas_image_cmptwidth ( inimage , 0 ) ;
height = jas_image_cmptheight ( inimage , 0 ) ;
hstep = jas_image_cmpthstep ( inimage , 0 ) ;
vstep = jas_image_cmptvstep ( inimage , 0 ) ;
inprof = jas_image_cmprof ( inimage ) ;
assert ( inprof ) ;
numinclrchans = jas_clrspc_numchans ( jas_cmprof_clrspc ( inprof ) ) ;
numinauxchans = jas_image_numcmpts ( inimage ) - numinclrchans ;
numoutclrchans = jas_clrspc_numchans ( jas_cmprof_clrspc ( outprof ) ) ;
numoutauxchans = 0 ;
numoutchans = numoutclrchans + numoutauxchans ;
prec = 8 ;
if ( ! ( outimage = jas_image_create0 ( ) ) ) goto error ;
for ( i = 0 ;
i < numoutclrchans ;
++ i ) {
cmptparm . tlx = 0 ;
cmptparm . tly = 0 ;
cmptparm . hstep = hstep ;
cmptparm . vstep = vstep ;
cmptparm . width = width ;
cmptparm . height = height ;
cmptparm . prec = prec ;
cmptparm . sgnd = 0 ;
if ( jas_image_addcmpt ( outimage , - 1 , & cmptparm ) ) goto error ;
jas_image_setcmpttype ( outimage , i , JAS_IMAGE_CT_COLOR ( i ) ) ;
}
# if 0 for ( i = 0 ;
i < jas_image_numcmpts ( inimage ) ;
++ i ) {
if ( ! ISCOLOR ( jas_image_cmpttype ( inimage , i ) ) ) {
jas_image_copycmpt ( outimage , - 1 , inimage , i ) ;
}
}
# endif if ( ! ( tmpprof = jas_cmprof_copy ( outprof ) ) ) goto error ;
assert ( ! jas_image_cmprof ( outimage ) ) ;
jas_image_setcmprof ( outimage , tmpprof ) ;
tmpprof = 0 ;
jas_image_setclrspc ( outimage , jas_cmprof_clrspc ( outprof ) ) ;
if ( ! ( xform = jas_cmxform_create ( inprof , outprof , 0 , JAS_CMXFORM_OP_FWD , intent , 0 ) ) ) goto error ;
inpixmap . numcmpts = numinclrchans ;
incmptfmts = malloc ( numinclrchans * sizeof ( jas_cmcmptfmt_t ) ) ;
assert ( incmptfmts ) ;
inpixmap . cmptfmts = incmptfmts ;
for ( i = 0 ;
i < numinclrchans ;
++ i ) {
j = jas_image_getcmptbytype ( inimage , JAS_IMAGE_CT_COLOR ( i ) ) ;
assert ( j >= 0 ) ;
if ( ! ( incmptfmts [ i ] . buf = malloc ( width * sizeof ( long ) ) ) ) goto error ;
incmptfmts [ i ] . prec = jas_image_cmptprec ( inimage , j ) ;
incmptfmts [ i ] . sgnd = jas_image_cmptsgnd ( inimage , j ) ;
incmptfmts [ i ] . width = width ;
incmptfmts [ i ] . height = 1 ;
}
outpixmap . numcmpts = numoutclrchans ;
outcmptfmts = malloc ( numoutclrchans * sizeof ( jas_cmcmptfmt_t ) ) ;
assert ( outcmptfmts ) ;
outpixmap . cmptfmts = outcmptfmts ;
for ( i = 0 ;
i < numoutclrchans ;
++ i ) {
j = jas_image_getcmptbytype ( outimage , JAS_IMAGE_CT_COLOR ( i ) ) ;
assert ( j >= 0 ) ;
if ( ! ( outcmptfmts [ i ] . buf = malloc ( width * sizeof ( long ) ) ) ) goto error ;
outcmptfmts [ i ] . prec = jas_image_cmptprec ( outimage , j ) ;
outcmptfmts [ i ] . sgnd = jas_image_cmptsgnd ( outimage , j ) ;
outcmptfmts [ i ] . width = width ;
outcmptfmts [ i ] . height = 1 ;
}
for ( i = 0 ;
i < height ;
++ i ) {
for ( j = 0 ;
j < numinclrchans ;
++ j ) {
k = jas_image_getcmptbytype ( inimage , JAS_IMAGE_CT_COLOR ( j ) ) ;
if ( jas_image_readcmpt2 ( inimage , k , 0 , i , width , 1 , incmptfmts [ j ] . buf ) ) goto error ;
}
jas_cmxform_apply ( xform , & inpixmap , & outpixmap ) ;
for ( j = 0 ;
j < numoutclrchans ;
++ j ) {
k = jas_image_getcmptbytype ( outimage , JAS_IMAGE_CT_COLOR ( j ) ) ;
if ( jas_image_writecmpt2 ( outimage , k , 0 , i , width , 1 , outcmptfmts [ j ] . buf ) ) goto error ;
}
}
for ( i = 0 ;
i < numoutclrchans ;
++ i ) jas_free ( outcmptfmts [ i ] . buf ) ;
jas_free ( outcmptfmts ) ;
for ( i = 0 ;
i < numinclrchans ;
++ i ) jas_free ( incmptfmts [ i ] . buf ) ;
jas_free ( incmptfmts ) ;
jas_cmxform_destroy ( xform ) ;
jas_image_destroy ( inimage ) ;
# if 0 jas_eprintf ( "INIMAGE\n" ) ;
jas_image_dump ( inimage , stderr ) ;
jas_eprintf ( "OUTIMAGE\n" ) ;
jas_image_dump ( outimage , stderr ) ;
# endif return outimage ;
error : return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int _evsignal_restore_handler ( struct event_base * base , int evsignal ) {
int ret = 0 ;
struct evsignal_info * sig = & base -> sig ;
# ifdef HAVE_SIGACTION struct sigaction * sh ;
# else ev_sighandler_t * sh ;
# endif sh = sig -> sh_old [ evsignal ] ;
sig -> sh_old [ evsignal ] = NULL ;
# ifdef HAVE_SIGACTION if ( sigaction ( evsignal , sh , NULL ) == - 1 ) {
event_warn ( "sigaction" ) ;
ret = - 1 ;
}
# else if ( signal ( evsignal , * sh ) == SIG_ERR ) {
event_warn ( "signal" ) ;
ret = - 1 ;
}
# endif free ( sh ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | bool agg_item_charsets ( DTCollation & coll , const char * fname , Item * * args , uint nargs , uint flags , int item_sep ) {
if ( agg_item_collations ( coll , fname , args , nargs , flags , item_sep ) ) return TRUE ;
return agg_item_set_converter ( coll , fname , args , nargs , flags , item_sep ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * rfc2047_decode_word ( const char * s , size_t len , enum ContentEncoding enc ) {
const char * it = s ;
const char * end = s + len ;
if ( enc == ENCQUOTEDPRINTABLE ) {
struct Buffer buf = {
0 }
;
for ( ;
it < end ;
++ it ) {
if ( * it == '_' ) {
mutt_buffer_addch ( & buf , ' ' ) ;
}
else if ( ( * it == '=' ) && ( ! ( it [ 1 ] & ~ 127 ) && hexval ( it [ 1 ] ) != - 1 ) && ( ! ( it [ 2 ] & ~ 127 ) && hexval ( it [ 2 ] ) != - 1 ) ) {
mutt_buffer_addch ( & buf , ( hexval ( it [ 1 ] ) << 4 ) | hexval ( it [ 2 ] ) ) ;
it += 2 ;
}
else {
mutt_buffer_addch ( & buf , * it ) ;
}
}
mutt_buffer_addch ( & buf , '\0' ) ;
return buf . data ;
}
else if ( enc == ENCBASE64 ) {
const int olen = 3 * len / 4 + 1 ;
char * out = mutt_mem_malloc ( olen ) ;
int dlen = mutt_b64_decode ( out , it , olen ) ;
if ( dlen == - 1 ) {
FREE ( & out ) ;
return NULL ;
}
out [ dlen ] = '\0' ;
return out ;
}
assert ( 0 ) ;
return NULL ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void qdev_set_nic_properties ( DeviceState * dev , NICInfo * nd ) {
qdev_prop_set_macaddr ( dev , "mac" , nd -> macaddr ) ;
if ( nd -> vlan ) qdev_prop_set_vlan ( dev , "vlan" , nd -> vlan ) ;
if ( nd -> netdev ) qdev_prop_set_netdev ( dev , "netdev" , nd -> netdev ) ;
if ( nd -> nvectors != NIC_NVECTORS_UNSPECIFIED && qdev_prop_exists ( dev , "vectors" ) ) {
qdev_prop_set_uint32 ( dev , "vectors" , nd -> nvectors ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int matroska_read_packet ( AVFormatContext * s , AVPacket * pkt ) {
MatroskaDemuxContext * matroska = s -> priv_data ;
int ret = 0 ;
while ( ! ret && matroska_deliver_packet ( matroska , pkt ) ) {
int64_t pos = avio_tell ( matroska -> ctx -> pb ) ;
if ( matroska -> done ) return AVERROR_EOF ;
if ( matroska_parse_cluster ( matroska ) < 0 ) ret = matroska_resync ( matroska , pos ) ;
}
if ( ret == AVERROR_INVALIDDATA && pkt -> data ) {
pkt -> flags |= AV_PKT_FLAG_CORRUPT ;
return 0 ;
}
return ret ;
} | 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 ) | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_UnregistrationRequest ( 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_UnregistrationRequest , UnregistrationRequest_sequence ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_T_samePort ( 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_samePort , T_samePort_sequence ) ;
return offset ;
} | 0False
|