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 void skip_optional_lf ( void ) {
int term_char = fgetc ( stdin ) ;
if ( term_char != '\n' && term_char != EOF ) ungetc ( term_char , stdin ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cmd_window_grow ( const char * data ) {
MAIN_WINDOW_REC * window ;
int count ;
count = * data == '\0' ? 1 : atoi ( data ) ;
window = WINDOW_MAIN ( active_win ) ;
if ( ! mainwindow_grow ( window , count , FALSE ) ) {
printformat_window ( active_win , MSGLEVEL_CLIENTNOTICE , TXT_WINDOW_TOO_SMALL ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int web_server_init ( ) {
int ret = 0 ;
if ( bWebServerState == WEB_SERVER_DISABLED ) {
media_list_init ( ) ;
membuffer_init ( & gDocumentRootDir ) ;
glob_alias_init ( ) ;
pVirtualDirList = NULL ;
virtualDirCallback . get_info = NULL ;
virtualDirCallback . open = NULL ;
virtualDirCallback . read = NULL ;
virtualDirCallback . write = NULL ;
virtualDirCallback . seek = NULL ;
virtualDirCallback . close = NULL ;
if ( ithread_mutex_init ( & gWebMutex , NULL ) == - 1 ) ret = UPNP_E_OUTOF_MEMORY ;
else bWebServerState = WEB_SERVER_ENABLED ;
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
byte * _gcry_mpi_get_secure_buffer ( gcry_mpi_t a , unsigned int fill_le , unsigned int * r_nbytes , int * sign ) {
return do_get_buffer ( a , fill_le , r_nbytes , sign , 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void restore_fix_stack ( i_ctx_t * i_ctx_p , ref_stack_t * pstack , const alloc_save_t * asave , bool is_estack ) {
ref_stack_enum_t rsenum ;
ref_stack_enum_begin ( & rsenum , pstack ) ;
do {
ref * stkp = rsenum . ptr ;
uint size = rsenum . size ;
for ( ;
size ;
stkp ++ , size -- ) {
r_clear_attrs ( stkp , l_new ) ;
if ( is_estack ) {
ref ofile ;
ref_assign ( & ofile , stkp ) ;
switch ( r_type ( stkp ) ) {
case t_string : if ( r_size ( stkp ) == 0 && alloc_is_since_save ( stkp -> value . bytes , asave ) ) {
make_empty_const_string ( stkp , avm_foreign ) ;
break ;
}
continue ;
case t_file : if ( alloc_is_since_save ( stkp -> value . pfile , asave ) ) {
make_invalid_file ( i_ctx_p , stkp ) ;
break ;
}
continue ;
default : continue ;
}
r_copy_attrs ( stkp , a_all | a_executable , & ofile ) ;
}
}
}
while ( ref_stack_enum_next ( & rsenum ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_GatekeeperConfirm ( 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_GatekeeperConfirm , GatekeeperConfirm_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void fz_cmm_transform_pixmap ( fz_context * ctx , fz_icclink * link , fz_pixmap * dst , fz_pixmap * src ) {
if ( ctx && ctx -> colorspace && ctx -> colorspace -> cmm && ctx -> cmm_instance ) ctx -> colorspace -> cmm -> transform_pixmap ( ctx -> cmm_instance , link , dst , src ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void iax_init_protocol ( void ) {
iax_circuit_hashtab = g_hash_table_new ( iax_circuit_hash , iax_circuit_equal ) ;
circuitcount = 0 ;
iax_fid_table = g_hash_table_new ( g_direct_hash , g_direct_equal ) ;
reassembly_table_init ( & iax_reassembly_table , & addresses_reassembly_table_functions ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_T_h323_message_body ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 241 "./asn1/h225/h225.cnf" gint32 message_body_val ;
h225_packet_info * h225_pi ;
contains_faststart = FALSE ;
call_id_guid = NULL ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_T_h323_message_body , T_h323_message_body_choice , & message_body_val ) ;
col_append_fstr ( actx -> pinfo -> cinfo , COL_INFO , "CS: %s " , val_to_str ( message_body_val , T_h323_message_body_vals , "<unknown>" ) ) ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
if ( h225_pi -> msg_type == H225_CS ) {
h225_pi -> msg_tag = message_body_val ;
}
if ( call_id_guid ) {
h225_pi -> guid = * call_id_guid ;
}
}
if ( contains_faststart == TRUE ) {
col_append_str ( actx -> pinfo -> cinfo , COL_INFO , "OpenLogicalChannel " ) ;
}
col_set_fence ( actx -> pinfo -> cinfo , COL_INFO ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) {
OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ;
}
static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) {
OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ;
}
LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) {
OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ;
}
LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING ) ;
# ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable : 4090 ) # endif DEFINE_LHASH_OF ( OPENSSL_CSTRING )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static Image * ReadGIFImage ( const ImageInfo * image_info , ExceptionInfo * exception ) {
# define BitSet ( byte , bit ) ( ( ( byte ) & ( bit ) ) == ( bit ) ) # define LSBFirstOrder ( x , y ) ( ( ( y ) << 8 ) | ( x ) ) Image * image , * meta_image ;
int number_extensionss = 0 ;
MagickBooleanType status ;
RectangleInfo page ;
register ssize_t i ;
register unsigned char * p ;
size_t delay , dispose , duration , global_colors , image_count , iterations , one ;
ssize_t count , opacity ;
unsigned char background , c , flag , * global_colormap , header [ MaxTextExtent ] , magick [ 12 ] ;
assert ( image_info != ( const ImageInfo * ) NULL ) ;
assert ( image_info -> signature == MagickSignature ) ;
if ( image_info -> debug != MagickFalse ) ( void ) LogMagickEvent ( TraceEvent , GetMagickModule ( ) , "%s" , image_info -> filename ) ;
assert ( exception != ( ExceptionInfo * ) NULL ) ;
assert ( exception -> signature == MagickSignature ) ;
image = AcquireImage ( image_info ) ;
status = OpenBlob ( image_info , image , ReadBinaryBlobMode , exception ) ;
if ( status == MagickFalse ) {
image = DestroyImageList ( image ) ;
return ( ( Image * ) NULL ) ;
}
count = ReadBlob ( image , 6 , magick ) ;
if ( ( count != 6 ) || ( ( LocaleNCompare ( ( char * ) magick , "GIF87" , 5 ) != 0 ) && ( LocaleNCompare ( ( char * ) magick , "GIF89" , 5 ) != 0 ) ) ) ThrowReaderException ( CorruptImageError , "ImproperImageHeader" ) ;
page . width = ReadBlobLSBShort ( image ) ;
page . height = ReadBlobLSBShort ( image ) ;
flag = ( unsigned char ) ReadBlobByte ( image ) ;
background = ( unsigned char ) ReadBlobByte ( image ) ;
c = ( unsigned char ) ReadBlobByte ( image ) ;
one = 1 ;
global_colors = one << ( ( ( size_t ) flag & 0x07 ) + 1 ) ;
global_colormap = ( unsigned char * ) AcquireQuantumMemory ( ( size_t ) MagickMax ( global_colors , 256 ) , 3UL * sizeof ( * global_colormap ) ) ;
if ( global_colormap == ( unsigned char * ) NULL ) ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ;
if ( BitSet ( ( int ) flag , 0x80 ) != 0 ) {
count = ReadBlob ( image , ( size_t ) ( 3 * global_colors ) , global_colormap ) ;
if ( count != ( ssize_t ) ( 3 * global_colors ) ) {
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile" ) ;
}
}
delay = 0 ;
dispose = 0 ;
duration = 0 ;
iterations = 1 ;
opacity = ( - 1 ) ;
image_count = 0 ;
meta_image = AcquireImage ( image_info ) ;
for ( ;
;
) {
count = ReadBlob ( image , 1 , & c ) ;
if ( count != 1 ) break ;
if ( c == ( unsigned char ) ';
' ) break ;
if ( c == ( unsigned char ) '!' ) {
count = ReadBlob ( image , 1 , & c ) ;
if ( count != 1 ) {
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( CorruptImageError , "UnableToReadExtensionBlock" ) ;
}
switch ( c ) {
case 0xf9 : {
while ( ReadBlobBlock ( image , header ) != 0 ) ;
dispose = ( size_t ) ( header [ 0 ] >> 2 ) ;
delay = ( size_t ) ( ( header [ 2 ] << 8 ) | header [ 1 ] ) ;
if ( ( ssize_t ) ( header [ 0 ] & 0x01 ) == 0x01 ) opacity = ( ssize_t ) header [ 3 ] ;
break ;
}
case 0xfe : {
char * comments ;
size_t length ;
comments = AcquireString ( ( char * ) NULL ) ;
for ( length = 0 ;
;
length += count ) {
count = ReadBlobBlock ( image , header ) ;
if ( count == 0 ) break ;
header [ count ] = '\0' ;
( void ) ConcatenateString ( & comments , ( const char * ) header ) ;
}
( void ) SetImageProperty ( meta_image , "comment" , comments ) ;
comments = DestroyString ( comments ) ;
break ;
}
case 0xff : {
MagickBooleanType loop ;
loop = MagickFalse ;
if ( ReadBlobBlock ( image , header ) != 0 ) loop = LocaleNCompare ( ( char * ) header , "NETSCAPE2.0" , 11 ) == 0 ? MagickTrue : MagickFalse ;
if ( loop != MagickFalse ) {
while ( ReadBlobBlock ( image , header ) != 0 ) iterations = ( size_t ) ( ( header [ 2 ] << 8 ) | header [ 1 ] ) ;
break ;
}
else {
char name [ MaxTextExtent ] ;
int block_length , info_length , reserved_length ;
MagickBooleanType i8bim , icc , iptc , magick ;
StringInfo * profile ;
unsigned char * info ;
icc = LocaleNCompare ( ( char * ) header , "ICCRGBG1012" , 11 ) == 0 ? MagickTrue : MagickFalse ;
magick = LocaleNCompare ( ( char * ) header , "ImageMagick" , 11 ) == 0 ? MagickTrue : MagickFalse ;
i8bim = LocaleNCompare ( ( char * ) header , "MGK8BIM0000" , 11 ) == 0 ? MagickTrue : MagickFalse ;
iptc = LocaleNCompare ( ( char * ) header , "MGKIPTC0000" , 11 ) == 0 ? MagickTrue : MagickFalse ;
number_extensionss ++ ;
( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , " Reading GIF application extension" ) ;
info = ( unsigned char * ) AcquireQuantumMemory ( 255UL , sizeof ( * info ) ) ;
if ( info == ( unsigned char * ) NULL ) {
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ;
}
reserved_length = 255 ;
for ( info_length = 0 ;
;
) {
block_length = ( int ) ReadBlobBlock ( image , & info [ info_length ] ) ;
if ( block_length == 0 ) break ;
info_length += block_length ;
if ( info_length > ( reserved_length - 255 ) ) {
reserved_length += 4096 ;
info = ( unsigned char * ) ResizeQuantumMemory ( info , ( size_t ) reserved_length , sizeof ( * info ) ) ;
if ( info == ( unsigned char * ) NULL ) {
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ;
}
}
}
profile = BlobToStringInfo ( info , ( size_t ) info_length ) ;
if ( profile == ( StringInfo * ) NULL ) {
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ;
}
if ( i8bim != MagickFalse ) ( void ) CopyMagickString ( name , "8bim" , sizeof ( name ) ) ;
else if ( icc != MagickFalse ) ( void ) CopyMagickString ( name , "icc" , sizeof ( name ) ) ;
else if ( iptc != MagickFalse ) ( void ) CopyMagickString ( name , "iptc" , sizeof ( name ) ) ;
else if ( magick != MagickFalse ) {
( void ) CopyMagickString ( name , "magick" , sizeof ( name ) ) ;
meta_image -> gamma = StringToDouble ( ( char * ) info + 6 , ( char * * ) NULL ) ;
}
else ( void ) FormatLocaleString ( name , sizeof ( name ) , "gif:%.11s" , header ) ;
info = ( unsigned char * ) RelinquishMagickMemory ( info ) ;
if ( magick == MagickFalse ) ( void ) SetImageProfile ( meta_image , name , profile ) ;
profile = DestroyStringInfo ( profile ) ;
( void ) LogMagickEvent ( CoderEvent , GetMagickModule ( ) , " profile name=%s" , name ) ;
}
break ;
}
default : {
while ( ReadBlobBlock ( image , header ) != 0 ) ;
break ;
}
}
}
if ( c != ( unsigned char ) ',' ) continue ;
if ( image_count != 0 ) {
AcquireNextImage ( image_info , image ) ;
if ( GetNextImageInList ( image ) == ( Image * ) NULL ) {
image = DestroyImageList ( image ) ;
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
return ( ( Image * ) NULL ) ;
}
image = SyncNextImageInList ( image ) ;
}
image_count ++ ;
meta_image -> scene = image -> scene ;
( void ) CloneImageProperties ( image , meta_image ) ;
DestroyImageProperties ( meta_image ) ;
( void ) CloneImageProfiles ( image , meta_image ) ;
DestroyImageProfiles ( meta_image ) ;
image -> storage_class = PseudoClass ;
image -> compression = LZWCompression ;
page . x = ( ssize_t ) ReadBlobLSBShort ( image ) ;
page . y = ( ssize_t ) ReadBlobLSBShort ( image ) ;
image -> columns = ReadBlobLSBShort ( image ) ;
image -> rows = ReadBlobLSBShort ( image ) ;
image -> depth = 8 ;
flag = ( unsigned char ) ReadBlobByte ( image ) ;
image -> interlace = BitSet ( ( int ) flag , 0x40 ) != 0 ? GIFInterlace : NoInterlace ;
image -> colors = BitSet ( ( int ) flag , 0x80 ) == 0 ? global_colors : one << ( ( size_t ) ( flag & 0x07 ) + 1 ) ;
if ( opacity >= ( ssize_t ) image -> colors ) opacity = ( - 1 ) ;
image -> page . width = page . width ;
image -> page . height = page . height ;
image -> page . y = page . y ;
image -> page . x = page . x ;
image -> delay = delay ;
image -> iterations = iterations ;
image -> ticks_per_second = 100 ;
image -> dispose = ( DisposeType ) dispose ;
image -> matte = opacity >= 0 ? MagickTrue : MagickFalse ;
delay = 0 ;
dispose = 0 ;
if ( ( image -> columns == 0 ) || ( image -> rows == 0 ) ) {
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ;
}
if ( AcquireImageColormap ( image , image -> colors ) == MagickFalse ) {
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ;
}
if ( BitSet ( ( int ) flag , 0x80 ) == 0 ) {
p = global_colormap ;
for ( i = 0 ;
i < ( ssize_t ) image -> colors ;
i ++ ) {
image -> colormap [ i ] . red = ScaleCharToQuantum ( * p ++ ) ;
image -> colormap [ i ] . green = ScaleCharToQuantum ( * p ++ ) ;
image -> colormap [ i ] . blue = ScaleCharToQuantum ( * p ++ ) ;
if ( i == opacity ) {
image -> colormap [ i ] . opacity = ( Quantum ) TransparentOpacity ;
image -> transparent_color = image -> colormap [ opacity ] ;
}
}
image -> background_color = image -> colormap [ MagickMin ( ( ssize_t ) background , ( ssize_t ) image -> colors - 1 ) ] ;
}
else {
unsigned char * colormap ;
colormap = ( unsigned char * ) AcquireQuantumMemory ( image -> colors , 3 * sizeof ( * colormap ) ) ;
if ( colormap == ( unsigned char * ) NULL ) {
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( ResourceLimitError , "MemoryAllocationFailed" ) ;
}
count = ReadBlob ( image , ( 3 * image -> colors ) * sizeof ( * colormap ) , colormap ) ;
if ( count != ( ssize_t ) ( 3 * image -> colors ) ) {
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
colormap = ( unsigned char * ) RelinquishMagickMemory ( colormap ) ;
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( CorruptImageError , "InsufficientImageDataInFile" ) ;
}
p = colormap ;
for ( i = 0 ;
i < ( ssize_t ) image -> colors ;
i ++ ) {
image -> colormap [ i ] . red = ScaleCharToQuantum ( * p ++ ) ;
image -> colormap [ i ] . green = ScaleCharToQuantum ( * p ++ ) ;
image -> colormap [ i ] . blue = ScaleCharToQuantum ( * p ++ ) ;
if ( i == opacity ) image -> colormap [ i ] . opacity = ( Quantum ) TransparentOpacity ;
}
colormap = ( unsigned char * ) RelinquishMagickMemory ( colormap ) ;
}
if ( image -> gamma == 1.0 ) {
for ( i = 0 ;
i < ( ssize_t ) image -> colors ;
i ++ ) if ( IsGrayPixel ( image -> colormap + i ) == MagickFalse ) break ;
( void ) SetImageColorspace ( image , i == ( ssize_t ) image -> colors ? GRAYColorspace : RGBColorspace ) ;
}
if ( ( image_info -> ping != MagickFalse ) && ( image_info -> number_scenes != 0 ) ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ;
status = SetImageExtent ( image , image -> columns , image -> rows ) ;
if ( status == MagickFalse ) {
InheritException ( exception , & image -> exception ) ;
return ( DestroyImageList ( image ) ) ;
}
if ( image_info -> ping != MagickFalse ) status = PingGIFImage ( image ) ;
else status = DecodeImage ( image , opacity ) ;
if ( ( image_info -> ping == MagickFalse ) && ( status == MagickFalse ) ) {
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
meta_image = DestroyImage ( meta_image ) ;
ThrowReaderException ( CorruptImageError , "CorruptImage" ) ;
}
duration += image -> delay * image -> iterations ;
if ( image_info -> number_scenes != 0 ) if ( image -> scene >= ( image_info -> scene + image_info -> number_scenes - 1 ) ) break ;
opacity = ( - 1 ) ;
status = SetImageProgress ( image , LoadImageTag , ( MagickOffsetType ) image -> scene - 1 , image -> scene ) ;
if ( status == MagickFalse ) break ;
}
image -> duration = duration ;
meta_image = DestroyImage ( meta_image ) ;
global_colormap = ( unsigned char * ) RelinquishMagickMemory ( global_colormap ) ;
if ( ( image -> columns == 0 ) || ( image -> rows == 0 ) ) ThrowReaderException ( CorruptImageError , "NegativeOrZeroImageSize" ) ;
( void ) CloseBlob ( image ) ;
return ( GetFirstImageInList ( image ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static GList * completion_channel_nicks ( CHANNEL_REC * channel , const char * nick , const char * suffix ) {
GSList * nicks , * tmp ;
GList * list ;
char * str ;
int len , match_case ;
g_return_val_if_fail ( channel != NULL , NULL ) ;
g_return_val_if_fail ( nick != NULL , NULL ) ;
if ( * nick == '\0' ) return NULL ;
if ( suffix != NULL && * suffix == '\0' ) suffix = NULL ;
match_case = completion_match_case == COMPLETE_MCASE_ALWAYS || ( completion_match_case == COMPLETE_MCASE_AUTO && contains_uppercase ( nick ) ) ;
list = NULL ;
complete_from_nicklist ( & list , channel , nick , suffix , match_case ) ;
len = strlen ( nick ) ;
nicks = nicklist_getnicks ( channel ) ;
for ( tmp = nicks ;
tmp != NULL ;
tmp = tmp -> next ) {
NICK_REC * rec = tmp -> data ;
if ( ( match_case ? strncmp ( rec -> nick , nick , len ) : g_ascii_strncasecmp ( rec -> nick , nick , len ) ) == 0 && rec != channel -> ownnick ) {
str = g_strconcat ( rec -> nick , suffix , NULL ) ;
if ( completion_lowercase ) ascii_strdown ( str ) ;
if ( glist_find_icase_string ( list , str ) == NULL ) list = g_list_append ( list , str ) ;
else g_free ( str ) ;
}
}
g_slist_free ( nicks ) ;
if ( ! completion_strict ) list = g_list_concat ( list , completion_nicks_nonstrict ( channel , nick , suffix , match_case ) ) ;
return list ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void mclms_predict ( WmallDecodeCtx * s , int icoef , int * pred ) {
int ich , i ;
int order = s -> mclms_order ;
int num_channels = s -> num_channels ;
for ( ich = 0 ;
ich < num_channels ;
ich ++ ) {
pred [ ich ] = 0 ;
if ( ! s -> is_channel_coded [ ich ] ) continue ;
for ( i = 0 ;
i < order * num_channels ;
i ++ ) pred [ ich ] += s -> mclms_prevvalues [ i + s -> mclms_recent ] * s -> mclms_coeffs [ i + order * num_channels * ich ] ;
for ( i = 0 ;
i < ich ;
i ++ ) pred [ ich ] += s -> channel_residues [ i ] [ icoef ] * s -> mclms_coeffs_cur [ i + num_channels * ich ] ;
pred [ ich ] += 1 << s -> mclms_scaling - 1 ;
pred [ ich ] >>= s -> mclms_scaling ;
s -> channel_residues [ ich ] [ icoef ] += pred [ ich ] ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int rawv6_rcv_skb ( struct sock * sk , struct sk_buff * skb ) {
if ( ( raw6_sk ( sk ) -> checksum || sk -> sk_filter ) && skb_checksum_complete ( skb ) ) {
atomic_inc ( & sk -> sk_drops ) ;
kfree_skb ( skb ) ;
return NET_RX_DROP ;
}
if ( sock_queue_rcv_skb ( sk , skb ) < 0 ) {
kfree_skb ( skb ) ;
return NET_RX_DROP ;
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_chunks ( AVCodecContext * avctx , AVFrame * picture , int * got_output , const uint8_t * buf , int buf_size ) {
Mpeg1Context * s = avctx -> priv_data ;
MpegEncContext * s2 = & s -> mpeg_enc_ctx ;
const uint8_t * buf_ptr = buf ;
const uint8_t * buf_end = buf + buf_size ;
int ret , input_size ;
int last_code = 0 ;
for ( ;
;
) {
uint32_t start_code = - 1 ;
buf_ptr = avpriv_mpv_find_start_code ( buf_ptr , buf_end , & start_code ) ;
if ( start_code > 0x1ff ) {
if ( s2 -> pict_type != AV_PICTURE_TYPE_B || avctx -> skip_frame <= AVDISCARD_DEFAULT ) {
if ( HAVE_THREADS && ( avctx -> active_thread_type & FF_THREAD_SLICE ) ) {
int i ;
avctx -> execute ( avctx , slice_decode_thread , & s2 -> thread_context [ 0 ] , NULL , s -> slice_count , sizeof ( void * ) ) ;
for ( i = 0 ;
i < s -> slice_count ;
i ++ ) s2 -> er . error_count += s2 -> thread_context [ i ] -> er . error_count ;
}
if ( CONFIG_MPEG_VDPAU_DECODER && avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) ff_vdpau_mpeg_picture_complete ( s2 , buf , buf_size , s -> slice_count ) ;
if ( slice_end ( avctx , picture ) ) {
if ( s2 -> last_picture_ptr || s2 -> low_delay ) * got_output = 1 ;
}
}
s2 -> pict_type = 0 ;
return FFMAX ( 0 , buf_ptr - buf - s2 -> parse_context . last_index ) ;
}
input_size = buf_end - buf_ptr ;
if ( avctx -> debug & FF_DEBUG_STARTCODE ) {
av_log ( avctx , AV_LOG_DEBUG , "%3X at %td left %d\n" , start_code , buf_ptr - buf , input_size ) ;
}
switch ( start_code ) {
case SEQ_START_CODE : if ( last_code == 0 ) {
mpeg1_decode_sequence ( avctx , buf_ptr , input_size ) ;
s -> sync = 1 ;
}
else {
av_log ( avctx , AV_LOG_ERROR , "ignoring SEQ_START_CODE after %X\n" , last_code ) ;
if ( avctx -> err_recognition & AV_EF_EXPLODE ) return AVERROR_INVALIDDATA ;
}
break ;
case PICTURE_START_CODE : if ( HAVE_THREADS && ( avctx -> active_thread_type & FF_THREAD_SLICE ) && s -> slice_count ) {
int i ;
avctx -> execute ( avctx , slice_decode_thread , s2 -> thread_context , NULL , s -> slice_count , sizeof ( void * ) ) ;
for ( i = 0 ;
i < s -> slice_count ;
i ++ ) s2 -> er . error_count += s2 -> thread_context [ i ] -> er . error_count ;
s -> slice_count = 0 ;
}
if ( last_code == 0 || last_code == SLICE_MIN_START_CODE ) {
ret = mpeg_decode_postinit ( avctx ) ;
if ( ret < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "mpeg_decode_postinit() failure\n" ) ;
return ret ;
}
if ( mpeg1_decode_picture ( avctx , buf_ptr , input_size ) < 0 ) s2 -> pict_type = 0 ;
s2 -> first_slice = 1 ;
last_code = PICTURE_START_CODE ;
}
else {
av_log ( avctx , AV_LOG_ERROR , "ignoring pic after %X\n" , last_code ) ;
if ( avctx -> err_recognition & AV_EF_EXPLODE ) return AVERROR_INVALIDDATA ;
}
break ;
case EXT_START_CODE : init_get_bits ( & s2 -> gb , buf_ptr , input_size * 8 ) ;
switch ( get_bits ( & s2 -> gb , 4 ) ) {
case 0x1 : if ( last_code == 0 ) {
mpeg_decode_sequence_extension ( s ) ;
}
else {
av_log ( avctx , AV_LOG_ERROR , "ignoring seq ext after %X\n" , last_code ) ;
if ( avctx -> err_recognition & AV_EF_EXPLODE ) return AVERROR_INVALIDDATA ;
}
break ;
case 0x2 : mpeg_decode_sequence_display_extension ( s ) ;
break ;
case 0x3 : mpeg_decode_quant_matrix_extension ( s2 ) ;
break ;
case 0x7 : mpeg_decode_picture_display_extension ( s ) ;
break ;
case 0x8 : if ( last_code == PICTURE_START_CODE ) {
mpeg_decode_picture_coding_extension ( s ) ;
}
else {
av_log ( avctx , AV_LOG_ERROR , "ignoring pic cod ext after %X\n" , last_code ) ;
if ( avctx -> err_recognition & AV_EF_EXPLODE ) return AVERROR_INVALIDDATA ;
}
break ;
}
break ;
case USER_START_CODE : mpeg_decode_user_data ( avctx , buf_ptr , input_size ) ;
break ;
case GOP_START_CODE : if ( last_code == 0 ) {
s2 -> first_field = 0 ;
mpeg_decode_gop ( avctx , buf_ptr , input_size ) ;
s -> sync = 1 ;
}
else {
av_log ( avctx , AV_LOG_ERROR , "ignoring GOP_START_CODE after %X\n" , last_code ) ;
if ( avctx -> err_recognition & AV_EF_EXPLODE ) return AVERROR_INVALIDDATA ;
}
break ;
default : if ( start_code >= SLICE_MIN_START_CODE && start_code <= SLICE_MAX_START_CODE && last_code != 0 ) {
const int field_pic = s2 -> picture_structure != PICT_FRAME ;
int mb_y = ( start_code - SLICE_MIN_START_CODE ) << field_pic ;
last_code = SLICE_MIN_START_CODE ;
if ( s2 -> picture_structure == PICT_BOTTOM_FIELD ) mb_y ++ ;
if ( mb_y >= s2 -> mb_height ) {
av_log ( s2 -> avctx , AV_LOG_ERROR , "slice below image (%d >= %d)\n" , mb_y , s2 -> mb_height ) ;
return - 1 ;
}
if ( s2 -> last_picture_ptr == NULL ) {
if ( s2 -> pict_type == AV_PICTURE_TYPE_B ) {
if ( ! s -> closed_gop ) break ;
}
}
if ( s2 -> pict_type == AV_PICTURE_TYPE_I ) s -> sync = 1 ;
if ( s2 -> next_picture_ptr == NULL ) {
if ( s2 -> pict_type == AV_PICTURE_TYPE_P && ! s -> sync ) break ;
}
if ( ( avctx -> skip_frame >= AVDISCARD_NONREF && s2 -> pict_type == AV_PICTURE_TYPE_B ) || ( avctx -> skip_frame >= AVDISCARD_NONKEY && s2 -> pict_type != AV_PICTURE_TYPE_I ) || avctx -> skip_frame >= AVDISCARD_ALL ) break ;
if ( ! s -> mpeg_enc_ctx_allocated ) break ;
if ( s2 -> codec_id == AV_CODEC_ID_MPEG2VIDEO ) {
if ( mb_y < avctx -> skip_top || mb_y >= s2 -> mb_height - avctx -> skip_bottom ) break ;
}
if ( ! s2 -> pict_type ) {
av_log ( avctx , AV_LOG_ERROR , "Missing picture start code\n" ) ;
if ( avctx -> err_recognition & AV_EF_EXPLODE ) return AVERROR_INVALIDDATA ;
break ;
}
if ( s2 -> first_slice ) {
s2 -> first_slice = 0 ;
if ( mpeg_field_start ( s2 , buf , buf_size ) < 0 ) return - 1 ;
}
if ( ! s2 -> current_picture_ptr ) {
av_log ( avctx , AV_LOG_ERROR , "current_picture not initialized\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) {
s -> slice_count ++ ;
break ;
}
if ( HAVE_THREADS && ( avctx -> active_thread_type & FF_THREAD_SLICE ) ) {
int threshold = ( s2 -> mb_height * s -> slice_count + s2 -> slice_context_count / 2 ) / s2 -> slice_context_count ;
if ( threshold <= mb_y ) {
MpegEncContext * thread_context = s2 -> thread_context [ s -> slice_count ] ;
thread_context -> start_mb_y = mb_y ;
thread_context -> end_mb_y = s2 -> mb_height ;
if ( s -> slice_count ) {
s2 -> thread_context [ s -> slice_count - 1 ] -> end_mb_y = mb_y ;
ret = ff_update_duplicate_context ( thread_context , s2 ) ;
if ( ret < 0 ) return ret ;
}
init_get_bits ( & thread_context -> gb , buf_ptr , input_size * 8 ) ;
s -> slice_count ++ ;
}
buf_ptr += 2 ;
}
else {
ret = mpeg_decode_slice ( s2 , mb_y , & buf_ptr , input_size ) ;
emms_c ( ) ;
if ( ret < 0 ) {
if ( avctx -> err_recognition & AV_EF_EXPLODE ) return ret ;
if ( s2 -> resync_mb_x >= 0 && s2 -> resync_mb_y >= 0 ) ff_er_add_slice ( & s2 -> er , s2 -> resync_mb_x , s2 -> resync_mb_y , s2 -> mb_x , s2 -> mb_y , ER_AC_ERROR | ER_DC_ERROR | ER_MV_ERROR ) ;
}
else {
ff_er_add_slice ( & s2 -> er , s2 -> resync_mb_x , s2 -> resync_mb_y , s2 -> mb_x - 1 , s2 -> mb_y , ER_AC_END | ER_DC_END | ER_MV_END ) ;
}
}
}
break ;
}
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ofscmp ( const void * a_ , const void * b_ ) {
struct in_pack_object * a = ( struct in_pack_object * ) a_ ;
struct in_pack_object * b = ( struct in_pack_object * ) b_ ;
if ( a -> offset < b -> offset ) return - 1 ;
else if ( a -> offset > b -> offset ) return 1 ;
else return oidcmp ( & a -> object -> oid , & b -> object -> oid ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * data_create_hangul ( const hb_ot_shape_plan_t * plan ) {
hangul_shape_plan_t * hangul_plan = ( hangul_shape_plan_t * ) calloc ( 1 , sizeof ( hangul_shape_plan_t ) ) ;
if ( unlikely ( ! hangul_plan ) ) return NULL ;
for ( unsigned int i = 0 ;
i < HANGUL_FEATURE_COUNT ;
i ++ ) hangul_plan -> mask_array [ i ] = plan -> map . get_1_mask ( hangul_features [ i ] ) ;
return hangul_plan ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline type * lh_ ## type ## _retrieve ( LHASH_OF ( type ) * lh , const type * d ) {
return ( type * ) OPENSSL_LH_retrieve ( ( OPENSSL_LHASH * ) lh , d ) ;
}
static ossl_inline int lh_ ## type ## _error ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_error ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline unsigned long lh_ ## type ## _num_items ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_num_items ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline void lh_ ## type ## _node_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_node_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline void lh_ ## type ## _node_usage_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_node_usage_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) {
OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ;
}
static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) {
OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ;
}
LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) {
OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ;
}
LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING ) ;
# ifdef _MSC_VER # pragma warning ( push ) # pragma warning ( disable : 4090 ) # endif DEFINE_LHASH_OF ( OPENSSL_CSTRING )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void e1000e_msix_clear_one ( E1000ECore * core , uint32_t cause , uint32_t int_cfg ) {
if ( E1000_IVAR_ENTRY_VALID ( int_cfg ) ) {
uint32_t vec = E1000_IVAR_ENTRY_VEC ( int_cfg ) ;
if ( vec < E1000E_MSIX_VEC_NUM ) {
trace_e1000e_irq_msix_pending_clearing ( cause , int_cfg , vec ) ;
msix_clr_pending ( core -> owner , vec ) ;
}
else {
trace_e1000e_wrn_msix_vec_wrong ( cause , int_cfg ) ;
}
}
else {
trace_e1000e_wrn_msix_invalid ( cause , int_cfg ) ;
}
}
| 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 ) {
LOCOContext * const l = avctx -> priv_data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
AVFrame * const p = & l -> pic ;
int decoded , ret ;
if ( p -> data [ 0 ] ) avctx -> release_buffer ( avctx , p ) ;
p -> reference = 0 ;
if ( ( ret = ff_get_buffer ( avctx , p ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
p -> key_frame = 1 ;
switch ( l -> mode ) {
case LOCO_CYUY2 : case LOCO_YUY2 : case LOCO_UYVY : decoded = loco_decode_plane ( l , p -> data [ 0 ] , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf , buf_size , 1 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 1 ] , avctx -> width / 2 , avctx -> height , p -> linesize [ 1 ] , buf , buf_size , 1 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 2 ] , avctx -> width / 2 , avctx -> height , p -> linesize [ 2 ] , buf , buf_size , 1 ) ;
break ;
case LOCO_CYV12 : case LOCO_YV12 : decoded = loco_decode_plane ( l , p -> data [ 0 ] , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf , buf_size , 1 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 2 ] , avctx -> width / 2 , avctx -> height / 2 , p -> linesize [ 2 ] , buf , buf_size , 1 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 1 ] , avctx -> width / 2 , avctx -> height / 2 , p -> linesize [ 1 ] , buf , buf_size , 1 ) ;
break ;
case LOCO_CRGB : case LOCO_RGB : decoded = loco_decode_plane ( l , p -> data [ 0 ] + p -> linesize [ 0 ] * ( avctx -> height - 1 ) , avctx -> width , avctx -> height , - p -> linesize [ 0 ] , buf , buf_size , 3 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 0 ] + p -> linesize [ 0 ] * ( avctx -> height - 1 ) + 1 , avctx -> width , avctx -> height , - p -> linesize [ 0 ] , buf , buf_size , 3 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 0 ] + p -> linesize [ 0 ] * ( avctx -> height - 1 ) + 2 , avctx -> width , avctx -> height , - p -> linesize [ 0 ] , buf , buf_size , 3 ) ;
break ;
case LOCO_RGBA : decoded = loco_decode_plane ( l , p -> data [ 0 ] , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf , buf_size , 4 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 0 ] + 1 , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf , buf_size , 4 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 0 ] + 2 , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf , buf_size , 4 ) ;
if ( decoded >= buf_size ) goto buf_too_small ;
buf += decoded ;
buf_size -= decoded ;
decoded = loco_decode_plane ( l , p -> data [ 0 ] + 3 , avctx -> width , avctx -> height , p -> linesize [ 0 ] , buf , buf_size , 4 ) ;
break ;
}
* got_frame = 1 ;
* ( AVFrame * ) data = l -> pic ;
return buf_size ;
buf_too_small : av_log ( avctx , AV_LOG_ERROR , "Input data too small.\n" ) ;
return AVERROR ( EINVAL ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorTextExpirePassword ( qemuMonitorPtr mon , const char * protocol , const char * expire_time ) {
char * cmd = NULL ;
char * reply = NULL ;
int ret = - 1 ;
if ( virAsprintf ( & cmd , "expire_password %s %s" , protocol , expire_time ) < 0 ) {
virReportOOMError ( ) ;
goto cleanup ;
}
if ( qemuMonitorHMPCommand ( mon , cmd , & reply ) < 0 ) {
qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , _ ( "expiring password failed" ) ) ;
goto cleanup ;
}
if ( strstr ( reply , "unknown command:" ) ) {
ret = - 2 ;
goto cleanup ;
}
ret = 0 ;
cleanup : VIR_FREE ( reply ) ;
VIR_FREE ( cmd ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rv30_loop_filter ( RV34DecContext * r , int row ) {
MpegEncContext * s = & r -> s ;
int mb_pos , mb_x ;
int i , j , k ;
uint8_t * Y , * C ;
int loc_lim , cur_lim , left_lim = 0 , top_lim = 0 ;
mb_pos = row * s -> mb_stride ;
for ( mb_x = 0 ;
mb_x < s -> mb_width ;
mb_x ++ , mb_pos ++ ) {
int mbtype = s -> current_picture_ptr -> f . mb_type [ mb_pos ] ;
if ( IS_INTRA ( mbtype ) || IS_SEPARATE_DC ( mbtype ) ) r -> deblock_coefs [ mb_pos ] = 0xFFFF ;
if ( IS_INTRA ( mbtype ) ) r -> cbp_chroma [ mb_pos ] = 0xFF ;
}
mb_pos = row * s -> mb_stride ;
for ( mb_x = 0 ;
mb_x < s -> mb_width ;
mb_x ++ , mb_pos ++ ) {
cur_lim = rv30_loop_filt_lim [ s -> current_picture_ptr -> f . qscale_table [ mb_pos ] ] ;
if ( mb_x ) left_lim = rv30_loop_filt_lim [ s -> current_picture_ptr -> f . qscale_table [ mb_pos - 1 ] ] ;
for ( j = 0 ;
j < 16 ;
j += 4 ) {
Y = s -> current_picture_ptr -> f . data [ 0 ] + mb_x * 16 + ( row * 16 + j ) * s -> linesize + 4 * ! mb_x ;
for ( i = ! mb_x ;
i < 4 ;
i ++ , Y += 4 ) {
int ij = i + j ;
loc_lim = 0 ;
if ( r -> deblock_coefs [ mb_pos ] & ( 1 << ij ) ) loc_lim = cur_lim ;
else if ( ! i && r -> deblock_coefs [ mb_pos - 1 ] & ( 1 << ( ij + 3 ) ) ) loc_lim = left_lim ;
else if ( i && r -> deblock_coefs [ mb_pos ] & ( 1 << ( ij - 1 ) ) ) loc_lim = cur_lim ;
if ( loc_lim ) rv30_weak_loop_filter ( Y , 1 , s -> linesize , loc_lim ) ;
}
}
for ( k = 0 ;
k < 2 ;
k ++ ) {
int cur_cbp , left_cbp = 0 ;
cur_cbp = ( r -> cbp_chroma [ mb_pos ] >> ( k * 4 ) ) & 0xF ;
if ( mb_x ) left_cbp = ( r -> cbp_chroma [ mb_pos - 1 ] >> ( k * 4 ) ) & 0xF ;
for ( j = 0 ;
j < 8 ;
j += 4 ) {
C = s -> current_picture_ptr -> f . data [ k + 1 ] + mb_x * 8 + ( row * 8 + j ) * s -> uvlinesize + 4 * ! mb_x ;
for ( i = ! mb_x ;
i < 2 ;
i ++ , C += 4 ) {
int ij = i + ( j >> 1 ) ;
loc_lim = 0 ;
if ( cur_cbp & ( 1 << ij ) ) loc_lim = cur_lim ;
else if ( ! i && left_cbp & ( 1 << ( ij + 1 ) ) ) loc_lim = left_lim ;
else if ( i && cur_cbp & ( 1 << ( ij - 1 ) ) ) loc_lim = cur_lim ;
if ( loc_lim ) rv30_weak_loop_filter ( C , 1 , s -> uvlinesize , loc_lim ) ;
}
}
}
}
mb_pos = row * s -> mb_stride ;
for ( mb_x = 0 ;
mb_x < s -> mb_width ;
mb_x ++ , mb_pos ++ ) {
cur_lim = rv30_loop_filt_lim [ s -> current_picture_ptr -> f . qscale_table [ mb_pos ] ] ;
if ( row ) top_lim = rv30_loop_filt_lim [ s -> current_picture_ptr -> f . qscale_table [ mb_pos - s -> mb_stride ] ] ;
for ( j = 4 * ! row ;
j < 16 ;
j += 4 ) {
Y = s -> current_picture_ptr -> f . data [ 0 ] + mb_x * 16 + ( row * 16 + j ) * s -> linesize ;
for ( i = 0 ;
i < 4 ;
i ++ , Y += 4 ) {
int ij = i + j ;
loc_lim = 0 ;
if ( r -> deblock_coefs [ mb_pos ] & ( 1 << ij ) ) loc_lim = cur_lim ;
else if ( ! j && r -> deblock_coefs [ mb_pos - s -> mb_stride ] & ( 1 << ( ij + 12 ) ) ) loc_lim = top_lim ;
else if ( j && r -> deblock_coefs [ mb_pos ] & ( 1 << ( ij - 4 ) ) ) loc_lim = cur_lim ;
if ( loc_lim ) rv30_weak_loop_filter ( Y , s -> linesize , 1 , loc_lim ) ;
}
}
for ( k = 0 ;
k < 2 ;
k ++ ) {
int cur_cbp , top_cbp = 0 ;
cur_cbp = ( r -> cbp_chroma [ mb_pos ] >> ( k * 4 ) ) & 0xF ;
if ( row ) top_cbp = ( r -> cbp_chroma [ mb_pos - s -> mb_stride ] >> ( k * 4 ) ) & 0xF ;
for ( j = 4 * ! row ;
j < 8 ;
j += 4 ) {
C = s -> current_picture_ptr -> f . data [ k + 1 ] + mb_x * 8 + ( row * 8 + j ) * s -> uvlinesize ;
for ( i = 0 ;
i < 2 ;
i ++ , C += 4 ) {
int ij = i + ( j >> 1 ) ;
loc_lim = 0 ;
if ( r -> cbp_chroma [ mb_pos ] & ( 1 << ij ) ) loc_lim = cur_lim ;
else if ( ! j && top_cbp & ( 1 << ( ij + 2 ) ) ) loc_lim = top_lim ;
else if ( j && cur_cbp & ( 1 << ( ij - 2 ) ) ) loc_lim = cur_lim ;
if ( loc_lim ) rv30_weak_loop_filter ( C , s -> uvlinesize , 1 , loc_lim ) ;
}
}
}
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ContentSettingBubbleDialogTest , InvokeDialog_mediastream_camera ) {
RunDialog ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( NativeBackendLibsecretTest , PSLMatchingDisabledForNonHTMLForms ) {
CheckMatchingWithScheme ( PasswordForm : : SCHEME_BASIC ) ;
CheckMatchingWithScheme ( PasswordForm : : SCHEME_DIGEST ) ;
CheckMatchingWithScheme ( PasswordForm : : SCHEME_OTHER ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_iP6Address ( 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_iP6Address , T_iP6Address_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE cState_partial_generate ( VALUE self , VALUE obj ) {
FBuffer * buffer = cState_prepare_buffer ( self ) ;
GET_STATE ( self ) ;
generate_json ( buffer , self , state , obj ) ;
return fbuffer_to_s ( buffer ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void usage_exit ( ) {
fprintf ( stderr , "Usage: %s <width> <height> <infile> <outfile(s)> <output psnr?>\n" , exec_name ) ;
exit ( EXIT_FAILURE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 get_message_header_endianness ( tvbuff_t * tvb , gint offset ) {
guint8 endianness ;
guint encoding ;
endianness = tvb_get_guint8 ( tvb , offset + ENDIANNESS_OFFSET ) ;
switch ( endianness ) {
case 'l' : encoding = ENC_LITTLE_ENDIAN ;
break ;
case 'B' : encoding = ENC_BIG_ENDIAN ;
break ;
default : encoding = ENC_ALLJOYN_BAD_ENCODING ;
break ;
}
return encoding ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void crypto_policy_set_aes_cm_128_null_auth ( crypto_policy_t * p ) {
p -> cipher_type = AES_ICM ;
p -> cipher_key_len = 30 ;
p -> auth_type = NULL_AUTH ;
p -> auth_key_len = 0 ;
p -> auth_tag_len = 0 ;
p -> sec_serv = sec_serv_conf ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int set_vt_partitioning ( VP9_COMP * cpi , void * data , BLOCK_SIZE bsize , int mi_row , int mi_col ) {
VP9_COMMON * const cm = & cpi -> common ;
variance_node vt ;
const int block_width = num_8x8_blocks_wide_lookup [ bsize ] ;
const int block_height = num_8x8_blocks_high_lookup [ bsize ] ;
const int64_t threshold_multiplier = 25 ;
int64_t threshold = threshold_multiplier * cpi -> common . base_qindex ;
assert ( block_height == block_width ) ;
tree_to_node ( data , bsize , & vt ) ;
if ( mi_col + block_width / 2 < cm -> mi_cols && mi_row + block_height / 2 < cm -> mi_rows && vt . part_variances -> none . variance < threshold ) {
set_block_size ( cpi , mi_row , mi_col , bsize ) ;
return 1 ;
}
if ( mi_row + block_height / 2 < cm -> mi_rows && vt . part_variances -> vert [ 0 ] . variance < threshold && vt . part_variances -> vert [ 1 ] . variance < threshold ) {
BLOCK_SIZE subsize = get_subsize ( bsize , PARTITION_VERT ) ;
set_block_size ( cpi , mi_row , mi_col , subsize ) ;
set_block_size ( cpi , mi_row , mi_col + block_width / 2 , subsize ) ;
return 1 ;
}
if ( mi_col + block_width / 2 < cm -> mi_cols && vt . part_variances -> horz [ 0 ] . variance < threshold && vt . part_variances -> horz [ 1 ] . variance < threshold ) {
BLOCK_SIZE subsize = get_subsize ( bsize , PARTITION_HORZ ) ;
set_block_size ( cpi , mi_row , mi_col , subsize ) ;
set_block_size ( cpi , mi_row + block_height / 2 , mi_col , subsize ) ;
return 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp8_plane_add_noise_c ( unsigned char * Start , char * noise , char blackclamp [ 16 ] , char whiteclamp [ 16 ] , char bothclamp [ 16 ] , unsigned int Width , unsigned int Height , int Pitch ) {
unsigned int i , j ;
for ( i = 0 ;
i < Height ;
i ++ ) {
unsigned char * Pos = Start + i * Pitch ;
char * Ref = ( char * ) ( noise + ( rand ( ) & 0xff ) ) ;
for ( j = 0 ;
j < Width ;
j ++ ) {
if ( Pos [ j ] < blackclamp [ 0 ] ) Pos [ j ] = blackclamp [ 0 ] ;
if ( Pos [ j ] > 255 + whiteclamp [ 0 ] ) Pos [ j ] = 255 + whiteclamp [ 0 ] ;
Pos [ j ] += Ref [ j ] ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void nonword ( struct vars * v , int dir , struct state * lp , struct state * rp ) {
int anchor = ( dir == AHEAD ) ? '$' : '^' ;
assert ( dir == AHEAD || dir == BEHIND ) ;
newarc ( v -> nfa , anchor , 1 , lp , rp ) ;
newarc ( v -> nfa , anchor , 0 , lp , rp ) ;
colorcomplement ( v -> nfa , v -> cm , dir , v -> wordchrs , lp , rp ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int testit ( struct test_case_struct * tc ) {
int retval ;
wordexp_t we , sav_we ;
char * dummy ;
int bzzzt = 0 ;
int start_offs = 0 ;
int i ;
if ( tc -> env ) setenv ( "var" , tc -> env , 1 ) ;
else unsetenv ( "var" ) ;
if ( tc -> ifs ) setenv ( "IFS" , tc -> ifs , 1 ) ;
else unsetenv ( "IFS" ) ;
sav_we . we_wordc = 99 ;
sav_we . we_wordv = & dummy ;
sav_we . we_offs = 3 ;
we = sav_we ;
printf ( "Test %d (%s): " , ++ tests , tc -> words ) ;
if ( tc -> flags & WRDE_NOCMD ) registered_forks = 0 ;
if ( tc -> flags & WRDE_APPEND ) {
if ( wordexp ( "pre1 pre2" , & we , tc -> flags & ~ WRDE_APPEND ) != 0 ) {
printf ( "FAILED setup\n" ) ;
return 1 ;
}
}
retval = wordexp ( tc -> words , & we , tc -> flags ) ;
if ( ( tc -> flags & WRDE_NOCMD ) && ( registered_forks > 0 ) ) {
printf ( "FAILED fork called for WRDE_NOCMD\n" ) ;
return 1 ;
}
if ( tc -> flags & WRDE_DOOFFS ) start_offs = sav_we . we_offs ;
if ( retval != tc -> retval || ( retval == 0 && we . we_wordc != tc -> wordc ) ) bzzzt = 1 ;
else if ( retval == 0 ) {
for ( i = 0 ;
i < start_offs ;
++ i ) if ( we . we_wordv [ i ] != NULL ) {
bzzzt = 1 ;
break ;
}
for ( i = 0 ;
i < we . we_wordc ;
++ i ) if ( we . we_wordv [ i + start_offs ] == NULL || strcmp ( tc -> wordv [ i ] , we . we_wordv [ i + start_offs ] ) != 0 ) {
bzzzt = 1 ;
break ;
}
}
if ( bzzzt ) {
printf ( "FAILED\n" ) ;
printf ( "Test words: <%s>, need retval %d, wordc %Zd\n" , tc -> words , tc -> retval , tc -> wordc ) ;
if ( start_offs != 0 ) printf ( "(preceded by %d NULLs)\n" , start_offs ) ;
printf ( "Got retval %d, wordc %Zd: " , retval , we . we_wordc ) ;
if ( retval == 0 || retval == WRDE_NOSPACE ) {
for ( i = 0 ;
i < we . we_wordc + start_offs ;
++ i ) if ( we . we_wordv [ i ] == NULL ) printf ( "NULL " ) ;
else printf ( "<%s> " , we . we_wordv [ i ] ) ;
}
printf ( "\n" ) ;
}
else if ( retval != 0 && retval != WRDE_NOSPACE && ( we . we_wordc != sav_we . we_wordc || we . we_wordv != sav_we . we_wordv || we . we_offs != sav_we . we_offs ) ) {
bzzzt = 1 ;
printf ( "FAILED to restore wordexp_t members\n" ) ;
}
else printf ( "OK\n" ) ;
if ( retval == 0 || retval == WRDE_NOSPACE ) wordfree ( & we ) ;
return bzzzt ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void _mime_parser_init ( MIMEParser * parser ) {
parser -> m_field = 0 ;
parser -> m_field_flags = 0 ;
parser -> m_value = - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int gdev_mem_bits_size ( const gx_device_memory * dev , int width , int height , ulong * psize ) {
int num_planes = dev -> is_planar ? dev -> color_info . num_components : 0 ;
gx_render_plane_t plane1 ;
const gx_render_plane_t * planes ;
ulong size ;
int pi ;
if ( num_planes ) planes = dev -> planes ;
else planes = & plane1 , plane1 . depth = dev -> color_info . depth , num_planes = 1 ;
for ( size = 0 , pi = 0 ;
pi < num_planes ;
++ pi ) size += bitmap_raster_pad_align ( width * planes [ pi ] . depth , dev -> pad , dev -> log2_align_mod ) ;
if ( height != 0 ) if ( size > ( max_ulong - ARCH_ALIGN_PTR_MOD ) / ( ulong ) height ) return_error ( gs_error_VMerror ) ;
size = ROUND_UP ( size * height , ARCH_ALIGN_PTR_MOD ) ;
if ( dev -> log2_align_mod > log2_align_bitmap_mod ) size += 1 << dev -> log2_align_mod ;
* psize = size ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void qemu_put_be16s ( QEMUFile * f , const uint16_t * pv ) {
qemu_put_be16 ( f , * pv ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int checkHttpTxnClientProtocolStackGet ( SocketTest * test , void * data ) {
TSHttpTxn txnp = ( TSHttpTxn ) data ;
const char * results [ 10 ] ;
int count = 0 ;
TSHttpTxnClientProtocolStackGet ( txnp , 10 , results , & count ) ;
test -> test_client_protocol_stack_get = true ;
if ( count != 3 ) {
test -> test_client_protocol_stack_get = false ;
SDK_RPRINT ( test -> regtest , "TSHttpTxnClientProtocolStackGet" , "TestCase1" , TC_FAIL , "count should be 3 is %d" , count ) ;
}
else if ( strcmp ( results [ 0 ] , "http/1.0" ) != 0 ) {
test -> test_client_protocol_stack_get = false ;
SDK_RPRINT ( test -> regtest , "TSHttpTxnClientProtocolStackGet" , "TestCase1" , TC_FAIL , "results[0] should be http/1.0 is %s" , results [ 0 ] ) ;
}
else if ( strcmp ( results [ 1 ] , "tcp" ) != 0 ) {
test -> test_client_protocol_stack_get = false ;
SDK_RPRINT ( test -> regtest , "TSHttpTxnClientProtocolStackGet" , "TestCase1" , TC_FAIL , "results[1] should be tcp is %s" , results [ 1 ] ) ;
}
else if ( strcmp ( results [ 2 ] , "ipv4" ) != 0 ) {
test -> test_client_protocol_stack_get = false ;
SDK_RPRINT ( test -> regtest , "TSHttpTxnClientProtocolStackGet" , "TestCase1" , TC_FAIL , "results[2] should be ipv4 is %s" , results [ 2 ] ) ;
}
else {
SDK_RPRINT ( test -> regtest , "TSHttpTxnClientProtocolStackGet" , "TestCase1" , TC_PASS , "ok stack_size=%d" , count ) ;
}
return TS_EVENT_CONTINUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ff_estimate_motion_b ( MpegEncContext * s , int mb_x , int mb_y , int16_t ( * mv_table ) [ 2 ] , int ref_index , int f_code ) {
MotionEstContext * const c = & s -> me ;
int mx , my , dmin ;
int P [ 10 ] [ 2 ] ;
const int shift = 1 + s -> quarter_sample ;
const int mot_stride = s -> mb_stride ;
const int mot_xy = mb_y * mot_stride + mb_x ;
uint8_t * const mv_penalty = c -> mv_penalty [ f_code ] + MAX_MV ;
int mv_scale ;
c -> penalty_factor = get_penalty_factor ( s -> lambda , s -> lambda2 , c -> avctx -> me_cmp ) ;
c -> sub_penalty_factor = get_penalty_factor ( s -> lambda , s -> lambda2 , c -> avctx -> me_sub_cmp ) ;
c -> mb_penalty_factor = get_penalty_factor ( s -> lambda , s -> lambda2 , c -> avctx -> mb_cmp ) ;
c -> current_mv_penalty = mv_penalty ;
get_limits ( s , 16 * mb_x , 16 * mb_y ) ;
switch ( s -> me_method ) {
case ME_ZERO : default : mx = 0 ;
my = 0 ;
dmin = 0 ;
break ;
case ME_X1 : case ME_EPZS : P_LEFT [ 0 ] = mv_table [ mot_xy - 1 ] [ 0 ] ;
P_LEFT [ 1 ] = mv_table [ mot_xy - 1 ] [ 1 ] ;
if ( P_LEFT [ 0 ] > ( c -> xmax << shift ) ) P_LEFT [ 0 ] = ( c -> xmax << shift ) ;
if ( ! s -> first_slice_line ) {
P_TOP [ 0 ] = mv_table [ mot_xy - mot_stride ] [ 0 ] ;
P_TOP [ 1 ] = mv_table [ mot_xy - mot_stride ] [ 1 ] ;
P_TOPRIGHT [ 0 ] = mv_table [ mot_xy - mot_stride + 1 ] [ 0 ] ;
P_TOPRIGHT [ 1 ] = mv_table [ mot_xy - mot_stride + 1 ] [ 1 ] ;
if ( P_TOP [ 1 ] > ( c -> ymax << shift ) ) P_TOP [ 1 ] = ( c -> ymax << shift ) ;
if ( P_TOPRIGHT [ 0 ] < ( c -> xmin << shift ) ) P_TOPRIGHT [ 0 ] = ( c -> xmin << shift ) ;
if ( P_TOPRIGHT [ 1 ] > ( c -> ymax << shift ) ) P_TOPRIGHT [ 1 ] = ( c -> ymax << shift ) ;
P_MEDIAN [ 0 ] = mid_pred ( P_LEFT [ 0 ] , P_TOP [ 0 ] , P_TOPRIGHT [ 0 ] ) ;
P_MEDIAN [ 1 ] = mid_pred ( P_LEFT [ 1 ] , P_TOP [ 1 ] , P_TOPRIGHT [ 1 ] ) ;
}
c -> pred_x = P_LEFT [ 0 ] ;
c -> pred_y = P_LEFT [ 1 ] ;
if ( mv_table == s -> b_forw_mv_table ) {
mv_scale = ( s -> pb_time << 16 ) / ( s -> pp_time << shift ) ;
}
else {
mv_scale = ( ( s -> pb_time - s -> pp_time ) << 16 ) / ( s -> pp_time << shift ) ;
}
dmin = ff_epzs_motion_search ( s , & mx , & my , P , 0 , ref_index , s -> p_mv_table , mv_scale , 0 , 16 ) ;
break ;
}
dmin = c -> sub_motion_search ( s , & mx , & my , dmin , 0 , ref_index , 0 , 16 ) ;
if ( c -> avctx -> me_sub_cmp != c -> avctx -> mb_cmp && ! c -> skip ) dmin = get_mb_score ( s , mx , my , 0 , ref_index , 0 , 16 , 1 ) ;
mv_table [ mot_xy ] [ 0 ] = mx ;
mv_table [ mot_xy ] [ 1 ] = my ;
return dmin ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerWithDownloadsBrowserTest , TestWithDangerousUrlDownload ) {
SetDownloadPathForProfile ( browser ( ) -> profile ( ) ) ;
std : : unique_ptr < TestDownloadManagerDelegate > test_delegate ( new TestDownloadManagerDelegate ( browser ( ) -> profile ( ) ) ) ;
DownloadCoreServiceFactory : : GetForBrowserContext ( browser ( ) -> profile ( ) ) -> SetDownloadManagerDelegateForTesting ( std : : move ( test_delegate ) ) ;
GURL download_url ( embedded_test_server ( ) -> GetURL ( "/downloads/dangerous/dangerous.swf" ) ) ;
content : : DownloadTestObserverInterrupted observer ( content : : BrowserContext : : GetDownloadManager ( browser ( ) -> profile ( ) ) , 1 , content : : DownloadTestObserver : : ON_DANGEROUS_DOWNLOAD_QUIT ) ;
ui_test_utils : : NavigateToURLWithDisposition ( browser ( ) , GURL ( download_url ) , WindowOpenDisposition : : NEW_BACKGROUND_TAB , ui_test_utils : : BROWSER_TEST_NONE ) ;
observer . WaitForFinished ( ) ;
EXPECT_EQ ( 1 , content : : BrowserContext : : GetDownloadManager ( browser ( ) -> profile ( ) ) -> InProgressCount ( ) ) ;
EXPECT_EQ ( 0 , content : : BrowserContext : : GetDownloadManager ( browser ( ) -> profile ( ) ) -> NonMaliciousInProgressCount ( ) ) ;
RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 1 ) ;
TestBrowserCloseManager : : AttemptClose ( TestBrowserCloseManager : : NO_USER_CHOICE ) ;
close_observer . Wait ( ) ;
EXPECT_TRUE ( browser_shutdown : : IsTryingToQuit ( ) ) ;
EXPECT_TRUE ( BrowserList : : GetInstance ( ) -> empty ( ) ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
GList * completion_get_servertags ( const char * word ) {
GList * list ;
GSList * tmp ;
int len ;
g_return_val_if_fail ( word != NULL , NULL ) ;
len = strlen ( word ) ;
list = NULL ;
for ( tmp = servers ;
tmp != NULL ;
tmp = tmp -> next ) {
SERVER_REC * rec = tmp -> data ;
if ( g_ascii_strncasecmp ( rec -> tag , word , len ) == 0 ) {
if ( rec == active_win -> active_server ) list = g_list_prepend ( list , g_strdup ( rec -> tag ) ) ;
else list = g_list_append ( list , g_strdup ( rec -> tag ) ) ;
}
}
return list ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * TSUrlHostGet ( TSMBuffer bufp , TSMLoc obj , int * length ) {
return URLPartGet ( bufp , obj , length , & URL : : host_get ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void mime_list_start ( NautilusDirectory * directory , NautilusFile * file , gboolean * doing_io ) {
MimeListState * state ;
GFile * location ;
mime_list_stop ( directory ) ;
if ( directory -> details -> mime_list_in_progress != NULL ) {
* doing_io = TRUE ;
return ;
}
if ( ! is_needy ( file , should_get_mime_list , REQUEST_MIME_LIST ) ) {
return ;
}
* doing_io = TRUE ;
if ( ! nautilus_file_is_directory ( file ) ) {
g_list_free ( file -> details -> mime_list ) ;
file -> details -> mime_list_failed = FALSE ;
file -> details -> got_mime_list = FALSE ;
file -> details -> mime_list_is_up_to_date = TRUE ;
nautilus_directory_async_state_changed ( directory ) ;
return ;
}
if ( ! async_job_start ( directory , "MIME list" ) ) {
return ;
}
state = g_new0 ( MimeListState , 1 ) ;
state -> mime_list_file = file ;
state -> directory = nautilus_directory_ref ( directory ) ;
state -> cancellable = g_cancellable_new ( ) ;
state -> mime_list_hash = istr_set_new ( ) ;
directory -> details -> mime_list_in_progress = state ;
location = nautilus_file_get_location ( file ) ;
# ifdef DEBUG_LOAD_DIRECTORY {
char * uri ;
uri = g_file_get_uri ( location ) ;
g_message ( "load_directory called to get MIME list of %s" , uri ) ;
g_free ( uri ) ;
}
# endif g_file_enumerate_children_async ( location , G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE , 0 , G_PRIORITY_LOW , state -> cancellable , list_mime_enum_callback , state ) ;
g_object_unref ( location ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void TSUuidDestroy ( TSUuid uuid ) {
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) uuid ) == TS_SUCCESS ) ;
delete ( ATSUuid * ) uuid ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void pcnet_h_reset ( void * opaque ) {
PCNetState * s = opaque ;
s -> bcr [ BCR_MSRDA ] = 0x0005 ;
s -> bcr [ BCR_MSWRA ] = 0x0005 ;
s -> bcr [ BCR_MC ] = 0x0002 ;
s -> bcr [ BCR_LNKST ] = 0x00c0 ;
s -> bcr [ BCR_LED1 ] = 0x0084 ;
s -> bcr [ BCR_LED2 ] = 0x0088 ;
s -> bcr [ BCR_LED3 ] = 0x0090 ;
s -> bcr [ BCR_FDC ] = 0x0000 ;
s -> bcr [ BCR_BSBC ] = 0x9001 ;
s -> bcr [ BCR_EECAS ] = 0x0002 ;
s -> bcr [ BCR_SWS ] = 0x0200 ;
s -> bcr [ BCR_PLAT ] = 0xff06 ;
pcnet_s_reset ( s ) ;
pcnet_update_irq ( s ) ;
pcnet_poll_timer ( s ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int pimv2_addr_print ( netdissect_options * ndo , const u_char * bp , enum pimv2_addrtype at , int silent ) {
int af ;
int len , hdrlen ;
ND_TCHECK ( bp [ 0 ] ) ;
if ( pimv2_addr_len == 0 ) {
ND_TCHECK ( bp [ 1 ] ) ;
switch ( bp [ 0 ] ) {
case 1 : af = AF_INET ;
len = sizeof ( struct in_addr ) ;
break ;
case 2 : af = AF_INET6 ;
len = sizeof ( struct in6_addr ) ;
break ;
default : return - 1 ;
}
if ( bp [ 1 ] != 0 ) return - 1 ;
hdrlen = 2 ;
}
else {
switch ( pimv2_addr_len ) {
case sizeof ( struct in_addr ) : af = AF_INET ;
break ;
case sizeof ( struct in6_addr ) : af = AF_INET6 ;
break ;
default : return - 1 ;
break ;
}
len = pimv2_addr_len ;
hdrlen = 0 ;
}
bp += hdrlen ;
switch ( at ) {
case pimv2_unicast : ND_TCHECK2 ( bp [ 0 ] , len ) ;
if ( af == AF_INET ) {
if ( ! silent ) ND_PRINT ( ( ndo , "%s" , ipaddr_string ( ndo , bp ) ) ) ;
}
else if ( af == AF_INET6 ) {
if ( ! silent ) ND_PRINT ( ( ndo , "%s" , ip6addr_string ( ndo , bp ) ) ) ;
}
return hdrlen + len ;
case pimv2_group : case pimv2_source : ND_TCHECK2 ( bp [ 0 ] , len + 2 ) ;
if ( af == AF_INET ) {
if ( ! silent ) {
ND_PRINT ( ( ndo , "%s" , ipaddr_string ( ndo , bp + 2 ) ) ) ;
if ( bp [ 1 ] != 32 ) ND_PRINT ( ( ndo , "/%u" , bp [ 1 ] ) ) ;
}
}
else if ( af == AF_INET6 ) {
if ( ! silent ) {
ND_PRINT ( ( ndo , "%s" , ip6addr_string ( ndo , bp + 2 ) ) ) ;
if ( bp [ 1 ] != 128 ) ND_PRINT ( ( ndo , "/%u" , bp [ 1 ] ) ) ;
}
}
if ( bp [ 0 ] && ! silent ) {
if ( at == pimv2_group ) {
ND_PRINT ( ( ndo , "(0x%02x)" , bp [ 0 ] ) ) ;
}
else {
ND_PRINT ( ( ndo , "(%s%s%s" , bp [ 0 ] & 0x04 ? "S" : "" , bp [ 0 ] & 0x02 ? "W" : "" , bp [ 0 ] & 0x01 ? "R" : "" ) ) ;
if ( bp [ 0 ] & 0xf8 ) {
ND_PRINT ( ( ndo , "+0x%02x" , bp [ 0 ] & 0xf8 ) ) ;
}
ND_PRINT ( ( ndo , ")" ) ) ;
}
}
return hdrlen + 2 + len ;
default : return - 1 ;
}
trunc : return - 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug1946 ( ) {
MYSQL_STMT * stmt ;
int rc ;
const char * query = "INSERT INTO prepare_command VALUES (?)" ;
myheader ( "test_bug1946" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS prepare_command" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE prepare_command(ID INT)" ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt ) ;
rc = mysql_real_query ( mysql , query , strlen ( query ) ) ;
DIE_UNLESS ( rc != 0 ) ;
if ( ! opt_silent ) fprintf ( stdout , "Got error (as expected):\n" ) ;
myerror ( NULL ) ;
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "DROP TABLE prepare_command" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool cpu_thread_is_idle ( CPUState * cpu ) {
if ( cpu -> stop || cpu -> queued_work_first ) {
return false ;
}
if ( cpu -> stopped || ! runstate_is_running ( ) ) {
return true ;
}
if ( ! cpu -> halted || qemu_cpu_has_work ( cpu ) || kvm_halt_in_kernel ( ) ) {
return false ;
}
return true ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void spl_filesystem_dir_it_current_key ( zend_object_iterator * iter , zval * key TSRMLS_DC ) {
spl_filesystem_object * object = spl_filesystem_iterator_to_object ( ( spl_filesystem_iterator * ) iter ) ;
ZVAL_LONG ( key , object -> u . dir . index ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void SSL3_RECORD_release ( SSL3_RECORD * r , unsigned int num_recs ) {
unsigned int i ;
for ( i = 0 ;
i < num_recs ;
i ++ ) {
OPENSSL_free ( r [ i ] . comp ) ;
r [ i ] . comp = NULL ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mimic_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
int swap_buf_size = buf_size - MIMIC_HEADER_SIZE ;
MimicContext * ctx = avctx -> priv_data ;
GetByteContext gb ;
int is_pframe ;
int width , height ;
int quality , num_coeffs ;
int res ;
if ( buf_size <= MIMIC_HEADER_SIZE ) {
av_log ( avctx , AV_LOG_ERROR , "insufficient data\n" ) ;
return AVERROR_INVALIDDATA ;
}
bytestream2_init ( & gb , buf , MIMIC_HEADER_SIZE ) ;
bytestream2_skip ( & gb , 2 ) ;
quality = bytestream2_get_le16u ( & gb ) ;
width = bytestream2_get_le16u ( & gb ) ;
height = bytestream2_get_le16u ( & gb ) ;
bytestream2_skip ( & gb , 4 ) ;
is_pframe = bytestream2_get_le32u ( & gb ) ;
num_coeffs = bytestream2_get_byteu ( & gb ) ;
bytestream2_skip ( & gb , 3 ) ;
if ( ! ctx -> avctx ) {
int i ;
if ( ! ( width == 160 && height == 120 ) && ! ( width == 320 && height == 240 ) ) {
av_log ( avctx , AV_LOG_ERROR , "invalid width/height!\n" ) ;
return AVERROR_INVALIDDATA ;
}
ctx -> avctx = avctx ;
avctx -> width = width ;
avctx -> height = height ;
avctx -> pix_fmt = AV_PIX_FMT_YUV420P ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
ctx -> num_vblocks [ i ] = - ( ( - height ) >> ( 3 + ! ! i ) ) ;
ctx -> num_hblocks [ i ] = width >> ( 3 + ! ! i ) ;
}
}
else if ( width != ctx -> avctx -> width || height != ctx -> avctx -> height ) {
av_log_missing_feature ( avctx , "resolution changing" , 1 ) ;
return AVERROR_PATCHWELCOME ;
}
if ( is_pframe && ! ctx -> frames [ ctx -> prev_index ] . f -> data [ 0 ] ) {
av_log ( avctx , AV_LOG_ERROR , "decoding must start with keyframe\n" ) ;
return AVERROR_INVALIDDATA ;
}
ff_thread_release_buffer ( avctx , & ctx -> frames [ ctx -> cur_index ] ) ;
ctx -> frames [ ctx -> cur_index ] . f -> pict_type = is_pframe ? AV_PICTURE_TYPE_P : AV_PICTURE_TYPE_I ;
if ( ( res = ff_thread_get_buffer ( avctx , & ctx -> frames [ ctx -> cur_index ] , AV_GET_BUFFER_FLAG_REF ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return res ;
}
ctx -> next_prev_index = ctx -> cur_index ;
ctx -> next_cur_index = ( ctx -> cur_index - 1 ) & 15 ;
prepare_avpic ( ctx , & ctx -> flipped_ptrs [ ctx -> cur_index ] , ctx -> frames [ ctx -> cur_index ] . f ) ;
ff_thread_finish_setup ( avctx ) ;
av_fast_padded_malloc ( & ctx -> swap_buf , & ctx -> swap_buf_size , swap_buf_size ) ;
if ( ! ctx -> swap_buf ) return AVERROR ( ENOMEM ) ;
ctx -> dsp . bswap_buf ( ctx -> swap_buf , ( const uint32_t * ) ( buf + MIMIC_HEADER_SIZE ) , swap_buf_size >> 2 ) ;
init_get_bits ( & ctx -> gb , ctx -> swap_buf , swap_buf_size << 3 ) ;
res = decode ( ctx , quality , num_coeffs , ! is_pframe ) ;
ff_thread_report_progress ( & ctx -> frames [ ctx -> cur_index ] , INT_MAX , 0 ) ;
if ( res < 0 ) {
if ( ! ( avctx -> active_thread_type & FF_THREAD_FRAME ) ) {
ff_thread_release_buffer ( avctx , & ctx -> frames [ ctx -> cur_index ] ) ;
return res ;
}
}
if ( ( res = av_frame_ref ( data , ctx -> frames [ ctx -> cur_index ] . f ) ) < 0 ) return res ;
* got_frame = 1 ;
ctx -> prev_index = ctx -> next_prev_index ;
ctx -> cur_index = ctx -> next_cur_index ;
ff_thread_release_buffer ( avctx , & ctx -> frames [ ctx -> cur_index ] ) ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_get_mvpred_var ( const MACROBLOCK * x , const MV * best_mv , const MV * center_mv , const vp9_variance_fn_ptr_t * vfp , int use_mvcost ) {
const MACROBLOCKD * const xd = & x -> e_mbd ;
const struct buf_2d * const what = & x -> plane [ 0 ] . src ;
const struct buf_2d * const in_what = & xd -> plane [ 0 ] . pre [ 0 ] ;
const MV mv = {
best_mv -> row * 8 , best_mv -> col * 8 }
;
unsigned int unused ;
return vfp -> vf ( what -> buf , what -> stride , get_buf_from_mv ( in_what , best_mv ) , in_what -> stride , & unused ) + ( use_mvcost ? mv_err_cost ( & mv , center_mv , x -> nmvjointcost , x -> mvcost , x -> errorperbit ) : 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSHttpTxnServerPacketDscpSet ( TSHttpTxn txnp , int dscp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * sm = ( HttpSM * ) txnp ;
if ( nullptr != sm -> ua_session ) {
HttpServerSession * ssn = sm -> ua_session -> get_server_session ( ) ;
if ( nullptr != ssn ) {
NetVConnection * vc = ssn -> get_netvc ( ) ;
if ( vc != nullptr ) {
vc -> options . packet_tos = ( uint32_t ) dscp << 2 ;
vc -> apply_options ( ) ;
}
}
}
TSHttpTxnConfigIntSet ( txnp , TS_CONFIG_NET_SOCK_PACKET_TOS_OUT , dscp << 2 ) ;
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool acl_getroot_no_password ( Security_context * sctx , char * user , char * host , char * ip , char * db ) {
int res = 1 ;
uint i ;
ACL_USER * acl_user = 0 ;
DBUG_ENTER ( "acl_getroot_no_password" ) ;
DBUG_PRINT ( "enter" , ( "Host: '%s', Ip: '%s', User: '%s', db: '%s'" , ( host ? host : "(NULL)" ) , ( ip ? ip : "(NULL)" ) , user , ( db ? db : "(NULL)" ) ) ) ;
sctx -> user = user ;
sctx -> host = host ;
sctx -> ip = ip ;
sctx -> host_or_ip = host ? host : ( ip ? ip : "" ) ;
if ( ! initialized ) {
sctx -> skip_grants ( ) ;
DBUG_RETURN ( FALSE ) ;
}
VOID ( pthread_mutex_lock ( & acl_cache -> lock ) ) ;
sctx -> master_access = 0 ;
sctx -> db_access = 0 ;
sctx -> priv_user = ( char * ) "" ;
* sctx -> priv_host = 0 ;
for ( i = 0 ;
i < acl_users . elements ;
i ++ ) {
ACL_USER * acl_user_tmp = dynamic_element ( & acl_users , i , ACL_USER * ) ;
if ( ( ! acl_user_tmp -> user && ! user [ 0 ] ) || ( acl_user_tmp -> user && strcmp ( user , acl_user_tmp -> user ) == 0 ) ) {
if ( compare_hostname ( & acl_user_tmp -> host , host , ip ) ) {
acl_user = acl_user_tmp ;
res = 0 ;
break ;
}
}
}
if ( acl_user ) {
for ( i = 0 ;
i < acl_dbs . elements ;
i ++ ) {
ACL_DB * acl_db = dynamic_element ( & acl_dbs , i , ACL_DB * ) ;
if ( ! acl_db -> user || ( user && user [ 0 ] && ! strcmp ( user , acl_db -> user ) ) ) {
if ( compare_hostname ( & acl_db -> host , host , ip ) ) {
if ( ! acl_db -> db || ( db && ! wild_compare ( db , acl_db -> db , 0 ) ) ) {
sctx -> db_access = acl_db -> access ;
break ;
}
}
}
}
sctx -> master_access = acl_user -> access ;
sctx -> priv_user = acl_user -> user ? user : ( char * ) "" ;
if ( acl_user -> host . hostname ) strmake ( sctx -> priv_host , acl_user -> host . hostname , MAX_HOSTNAME - 1 ) ;
else * sctx -> priv_host = 0 ;
}
VOID ( pthread_mutex_unlock ( & acl_cache -> lock ) ) ;
DBUG_RETURN ( res ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
PHP_FUNCTION ( locale_filter_matches ) {
char * lang_tag = NULL ;
int lang_tag_len = 0 ;
const char * loc_range = NULL ;
int loc_range_len = 0 ;
int result = 0 ;
char * token = 0 ;
char * chrcheck = NULL ;
char * can_lang_tag = NULL ;
char * can_loc_range = NULL ;
char * cur_lang_tag = NULL ;
char * cur_loc_range = NULL ;
zend_bool boolCanonical = 0 ;
UErrorCode status = U_ZERO_ERROR ;
intl_error_reset ( NULL TSRMLS_CC ) ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "ss|b" , & lang_tag , & lang_tag_len , & loc_range , & loc_range_len , & boolCanonical ) == FAILURE ) {
intl_error_set ( NULL , U_ILLEGAL_ARGUMENT_ERROR , "locale_filter_matches: unable to parse input params" , 0 TSRMLS_CC ) ;
RETURN_FALSE ;
}
if ( loc_range_len == 0 ) {
loc_range = intl_locale_get_default ( TSRMLS_C ) ;
}
if ( strcmp ( loc_range , "*" ) == 0 ) {
RETURN_TRUE ;
}
if ( boolCanonical ) {
can_loc_range = get_icu_value_internal ( loc_range , LOC_CANONICALIZE_TAG , & result , 0 ) ;
if ( result == 0 ) {
intl_error_set ( NULL , status , "locale_filter_matches : unable to canonicalize loc_range" , 0 TSRMLS_CC ) ;
RETURN_FALSE ;
}
can_lang_tag = get_icu_value_internal ( lang_tag , LOC_CANONICALIZE_TAG , & result , 0 ) ;
if ( result == 0 ) {
intl_error_set ( NULL , status , "locale_filter_matches : unable to canonicalize lang_tag" , 0 TSRMLS_CC ) ;
RETURN_FALSE ;
}
cur_lang_tag = ecalloc ( 1 , strlen ( can_lang_tag ) + 1 ) ;
result = strToMatch ( can_lang_tag , cur_lang_tag ) ;
if ( result == 0 ) {
efree ( cur_lang_tag ) ;
efree ( can_lang_tag ) ;
RETURN_FALSE ;
}
cur_loc_range = ecalloc ( 1 , strlen ( can_loc_range ) + 1 ) ;
result = strToMatch ( can_loc_range , cur_loc_range ) ;
if ( result == 0 ) {
efree ( cur_lang_tag ) ;
efree ( can_lang_tag ) ;
efree ( cur_loc_range ) ;
efree ( can_loc_range ) ;
RETURN_FALSE ;
}
token = strstr ( cur_lang_tag , cur_loc_range ) ;
if ( token && ( token == cur_lang_tag ) ) {
chrcheck = token + ( strlen ( cur_loc_range ) ) ;
if ( isIDSeparator ( * chrcheck ) || isEndOfTag ( * chrcheck ) ) {
if ( cur_lang_tag ) {
efree ( cur_lang_tag ) ;
}
if ( cur_loc_range ) {
efree ( cur_loc_range ) ;
}
if ( can_lang_tag ) {
efree ( can_lang_tag ) ;
}
if ( can_loc_range ) {
efree ( can_loc_range ) ;
}
RETURN_TRUE ;
}
}
if ( cur_lang_tag ) {
efree ( cur_lang_tag ) ;
}
if ( cur_loc_range ) {
efree ( cur_loc_range ) ;
}
if ( can_lang_tag ) {
efree ( can_lang_tag ) ;
}
if ( can_loc_range ) {
efree ( can_loc_range ) ;
}
RETURN_FALSE ;
}
else {
cur_lang_tag = ecalloc ( 1 , strlen ( lang_tag ) + 1 ) ;
result = strToMatch ( lang_tag , cur_lang_tag ) ;
if ( result == 0 ) {
efree ( cur_lang_tag ) ;
RETURN_FALSE ;
}
cur_loc_range = ecalloc ( 1 , strlen ( loc_range ) + 1 ) ;
result = strToMatch ( loc_range , cur_loc_range ) ;
if ( result == 0 ) {
efree ( cur_lang_tag ) ;
efree ( cur_loc_range ) ;
RETURN_FALSE ;
}
token = strstr ( cur_lang_tag , cur_loc_range ) ;
if ( token && ( token == cur_lang_tag ) ) {
chrcheck = token + ( strlen ( cur_loc_range ) ) ;
if ( isIDSeparator ( * chrcheck ) || isEndOfTag ( * chrcheck ) ) {
if ( cur_lang_tag ) {
efree ( cur_lang_tag ) ;
}
if ( cur_loc_range ) {
efree ( cur_loc_range ) ;
}
RETURN_TRUE ;
}
}
if ( cur_lang_tag ) {
efree ( cur_lang_tag ) ;
}
if ( cur_loc_range ) {
efree ( cur_loc_range ) ;
}
RETURN_FALSE ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int read_len_table ( uint8_t * dst , GetBitContext * gb ) {
int i , val , repeat ;
for ( i = 0 ;
i < 256 ;
) {
repeat = get_bits ( gb , 3 ) ;
val = get_bits ( gb , 5 ) ;
if ( repeat == 0 ) repeat = get_bits ( gb , 8 ) ;
if ( i + repeat > 256 || get_bits_left ( gb ) < 0 ) {
av_log ( NULL , AV_LOG_ERROR , "Error reading huffman table\n" ) ;
return - 1 ;
}
while ( repeat -- ) dst [ i ++ ] = val ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const float * anti_sparseness ( AMRContext * p , AMRFixed * fixed_sparse , const float * fixed_vector , float fixed_gain , float * out ) {
int ir_filter_nr ;
if ( p -> pitch_gain [ 4 ] < 0.6 ) {
ir_filter_nr = 0 ;
}
else if ( p -> pitch_gain [ 4 ] < 0.9 ) {
ir_filter_nr = 1 ;
}
else ir_filter_nr = 2 ;
if ( fixed_gain > 2.0 * p -> prev_sparse_fixed_gain ) {
p -> ir_filter_onset = 2 ;
}
else if ( p -> ir_filter_onset ) p -> ir_filter_onset -- ;
if ( ! p -> ir_filter_onset ) {
int i , count = 0 ;
for ( i = 0 ;
i < 5 ;
i ++ ) if ( p -> pitch_gain [ i ] < 0.6 ) count ++ ;
if ( count > 2 ) ir_filter_nr = 0 ;
if ( ir_filter_nr > p -> prev_ir_filter_nr + 1 ) ir_filter_nr -- ;
}
else if ( ir_filter_nr < 2 ) ir_filter_nr ++ ;
if ( fixed_gain < 5.0 ) ir_filter_nr = 2 ;
if ( p -> cur_frame_mode != MODE_7k4 && p -> cur_frame_mode < MODE_10k2 && ir_filter_nr < 2 ) {
apply_ir_filter ( out , fixed_sparse , ( p -> cur_frame_mode == MODE_7k95 ? ir_filters_lookup_MODE_7k95 : ir_filters_lookup ) [ ir_filter_nr ] ) ;
fixed_vector = out ;
}
p -> prev_ir_filter_nr = ir_filter_nr ;
p -> prev_sparse_fixed_gain = fixed_gain ;
return fixed_vector ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vpx_svc_set_keyframe ( SvcContext * svc_ctx ) {
SvcInternal * const si = get_svc_internal ( svc_ctx ) ;
if ( svc_ctx == NULL || si == NULL ) return ;
si -> frame_within_gop = 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int main_set_secondary_flags ( xd3_config * config ) {
int ret ;
if ( option_use_secondary ) {
if ( option_secondary == NULL ) {
if ( SECONDARY_DJW ) {
config -> flags |= XD3_SEC_DJW ;
}
}
else {
if ( strcmp ( option_secondary , "fgk" ) == 0 && SECONDARY_FGK ) {
config -> flags |= XD3_SEC_FGK ;
}
else if ( strcmp ( option_secondary , "lzma" ) == 0 && SECONDARY_LZMA ) {
config -> flags |= XD3_SEC_LZMA ;
}
else if ( strncmp ( option_secondary , "djw" , 3 ) == 0 && SECONDARY_DJW ) {
usize_t level = XD3_DEFAULT_SECONDARY_LEVEL ;
config -> flags |= XD3_SEC_DJW ;
if ( strlen ( option_secondary ) > 3 && ( ret = main_atou ( option_secondary + 3 , & level , 0 , 9 , 'S' ) ) != 0 && ! option_quiet ) {
return XD3_INVALID ;
}
if ( level < 1 ) {
config -> flags |= XD3_SEC_NODATA ;
}
if ( level < 7 ) {
config -> sec_data . ngroups = 1 ;
}
else {
config -> sec_data . ngroups = 0 ;
}
if ( level < 3 ) {
config -> flags |= XD3_SEC_NOINST ;
}
if ( level < 8 ) {
config -> sec_inst . ngroups = 1 ;
}
else {
config -> sec_inst . ngroups = 0 ;
}
if ( level < 5 ) {
config -> flags |= XD3_SEC_NOADDR ;
}
if ( level < 9 ) {
config -> sec_addr . ngroups = 1 ;
}
else {
config -> sec_addr . ngroups = 0 ;
}
}
else if ( strcmp ( option_secondary , "none" ) == 0 && SECONDARY_DJW ) {
}
else {
if ( ! option_quiet ) {
XPR ( NT "unrecognized secondary compressor type: %s\n" , option_secondary ) ;
return XD3_INVALID ;
}
}
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void unregister_key_type ( struct key_type * ktype ) {
down_write ( & key_types_sem ) ;
list_del_init ( & ktype -> link ) ;
downgrade_write ( & key_types_sem ) ;
key_gc_keytype ( ktype ) ;
pr_notice ( "Key type %s unregistered\n" , ktype -> name ) ;
up_read ( & key_types_sem ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void SchroFrameFree ( SchroFrame * frame , void * priv ) {
struct picture_free_t * p_free = priv ;
if ( ! p_free ) return ;
picture_Release ( p_free -> p_pic ) ;
free ( p_free ) ;
( void ) frame ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void compute_antialias ( MPADecodeContext * s , GranuleDef * g ) {
INTFLOAT * ptr ;
int n , i ;
if ( g -> block_type == 2 ) {
if ( ! g -> switch_point ) return ;
n = 1 ;
}
else {
n = SBLIMIT - 1 ;
}
ptr = g -> sb_hybrid + 18 ;
for ( i = n ;
i > 0 ;
i -- ) {
AA ( 0 ) ;
AA ( 1 ) ;
AA ( 2 ) ;
AA ( 3 ) ;
AA ( 4 ) ;
AA ( 5 ) ;
AA ( 6 ) ;
AA ( 7 ) ;
ptr += 18 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE ossl_asn1_ ## klass ( int argc , VALUE * argv , VALUE self ) \ {
return rb_funcall3 ( cASN1 ## klass , rb_intern ( "new" ) , argc , argv ) ;
}
OSSL_ASN1_IMPL_FACTORY_METHOD ( Boolean ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Integer ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Enumerated ) OSSL_ASN1_IMPL_FACTORY_METHOD ( BitString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( OctetString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( UTF8String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( NumericString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( PrintableString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( T61String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( VideotexString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( IA5String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( GraphicString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( ISO64String ) OSSL_ASN1_IMPL_FACTORY_METHOD ( GeneralString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( UniversalString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( BMPString ) OSSL_ASN1_IMPL_FACTORY_METHOD ( Null ) OSSL_ASN1_IMPL_FACTORY_METHOD ( ObjectId ) OSSL_ASN1_IMPL_FACTORY_METHOD ( UTCTime )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_query_records ( tvbuff_t * tvb , int cur_off , int dns_data_offset , int count , column_info * cinfo , proto_tree * dns_tree , gboolean isupdate , gboolean is_mdns ) {
int start_off , add_off ;
proto_tree * qatree ;
proto_item * ti ;
const char * s = ( isupdate ? "Zone" : "Queries" ) ;
start_off = cur_off ;
qatree = proto_tree_add_subtree ( dns_tree , tvb , start_off , - 1 , ett_dns_qry , & ti , s ) ;
while ( count -- > 0 ) {
add_off = dissect_dns_query ( tvb , cur_off , dns_data_offset , cinfo , qatree , is_mdns ) ;
cur_off += add_off ;
}
if ( ti ) {
proto_item_set_len ( ti , cur_off - start_off ) ;
}
return cur_off - start_off ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int __ipv6_addr_src_scope ( int type ) {
return ( type == IPV6_ADDR_ANY ) ? __IPV6_ADDR_SCOPE_INVALID : ( type >> 16 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void qio_channel_websock_set_delay ( QIOChannel * ioc , bool enabled ) {
QIOChannelWebsock * tioc = QIO_CHANNEL_WEBSOCK ( ioc ) ;
qio_channel_set_delay ( tioc -> master , enabled ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void GenerateHash ( const std : : string & input , std : : string * output ) {
if ( input . empty ( ) ) {
* output = "" ;
return ;
}
uint8_t hash [ 4 ] ;
crypto : : SHA256HashString ( input , hash , sizeof ( hash ) ) ;
* output = base : : ToLowerASCII ( base : : HexEncode ( hash , sizeof ( hash ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void kq_dealloc ( struct event_base * base , void * arg ) {
struct kqop * kqop = arg ;
if ( kqop -> changes ) free ( kqop -> changes ) ;
if ( kqop -> events ) free ( kqop -> events ) ;
if ( kqop -> kq >= 0 && kqop -> pid == getpid ( ) ) close ( kqop -> kq ) ;
memset ( kqop , 0 , sizeof ( struct kqop ) ) ;
free ( kqop ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_SEQUENCE_OF_MultiplePayloadStreamElement ( 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_h245_SEQUENCE_OF_MultiplePayloadStreamElement , SEQUENCE_OF_MultiplePayloadStreamElement_sequence_of ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_MultiplexEntryRejectionDescriptionsCause ( 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_MultiplexEntryRejectionDescriptionsCause , MultiplexEntryRejectionDescriptionsCause_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline MagickRealType GetPixelLuma ( const Image * restrict image , const Quantum * restrict pixel ) {
if ( image -> colorspace == GRAYColorspace ) return ( ( MagickRealType ) pixel [ image -> channel_map [ GrayPixelChannel ] . offset ] ) ;
return ( 0.212656f * pixel [ image -> channel_map [ RedPixelChannel ] . offset ] + 0.715158f * pixel [ image -> channel_map [ GreenPixelChannel ] . offset ] + 0.072186f * pixel [ image -> channel_map [ BluePixelChannel ] . offset ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
afs_int32 SPR_IsAMemberOf ( struct rx_call * call , afs_int32 uid , afs_int32 gid , afs_int32 * flag ) {
afs_int32 code ;
afs_int32 cid = ANONYMOUSID ;
code = isAMemberOf ( call , uid , gid , flag , & cid ) ;
osi_auditU ( call , PTS_IsMemOfEvent , code , AUD_LONG , uid , AUD_LONG , gid , AUD_END ) ;
ViceLog ( 125 , ( "PTS_IsAMemberOf: code %d cid %d uid %d gid %d\n" , code , cid , uid , gid ) ) ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorTextSetMigrationSpeed ( qemuMonitorPtr mon , unsigned long bandwidth ) {
char * cmd = NULL ;
char * info = NULL ;
int ret = - 1 ;
if ( virAsprintf ( & cmd , "migrate_set_speed %lum" , bandwidth ) < 0 ) {
virReportOOMError ( ) ;
goto cleanup ;
}
if ( qemuMonitorHMPCommand ( mon , cmd , & info ) < 0 ) {
qemuReportError ( VIR_ERR_OPERATION_FAILED , "%s" , _ ( "could not restrict migration speed" ) ) ;
goto cleanup ;
}
ret = 0 ;
cleanup : VIR_FREE ( info ) ;
VIR_FREE ( cmd ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BudgetManagerTest , TestUniqueOrigin ) {
const blink : : mojom : : BudgetOperationType type = blink : : mojom : : BudgetOperationType : : SILENT_PUSH ;
SetOrigin ( url : : Origin ( GURL ( "file://example.com:443/etc/passwd" ) ) ) ;
ASSERT_FALSE ( ReserveBudget ( type ) ) ;
ASSERT_EQ ( blink : : mojom : : BudgetServiceErrorType : : NOT_SUPPORTED , error_ ) ;
ASSERT_FALSE ( ConsumeBudget ( type ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void rsvp_cleanup_protocol ( void ) {
g_hash_table_destroy ( rsvp_request_hash ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_zcl_ota_imageblockreq ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
guint8 field_ctrl ;
field_ctrl = dissect_zcl_ota_field_ctrl_field ( tvb , tree , offset ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_manufacturer_code , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_image_type , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
dissect_zcl_ota_file_version_field ( tvb , tree , offset ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_file_offset , tvb , * offset , 4 , ENC_LITTLE_ENDIAN ) ;
* offset += 4 ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_max_data_size , tvb , * offset , 1 , ENC_NA ) ;
* offset += 1 ;
if ( field_ctrl & ZBEE_ZCL_OTA_FIELD_CTRL_IEEE_ADDR_PRESENT ) {
proto_tree_add_item ( tree , hf_zbee_zcl_ota_req_node_addr , tvb , * offset , 8 , ENC_LITTLE_ENDIAN ) ;
* offset += 8 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_select ( ) {
MYSQL_STMT * stmt ;
int rc ;
char szData [ 25 ] ;
int nData = 1 ;
MYSQL_BIND my_bind [ 2 ] ;
ulong length [ 2 ] ;
char query [ MAX_TEST_QUERY_LENGTH ] ;
myheader ( "test_select" ) ;
rc = mysql_autocommit ( mysql , TRUE ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS test_select" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "CREATE TABLE test_select(id int, name varchar(50))" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO test_select VALUES(10, 'venu')" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "INSERT INTO test_select VALUES(20, 'mysql')" ) ;
myquery ( rc ) ;
rc = mysql_commit ( mysql ) ;
myquery ( rc ) ;
strmov ( query , "SELECT * FROM test_select WHERE id= ? " "AND CONVERT(name USING utf8) =?" ) ;
stmt = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt ) ;
verify_param_count ( stmt , 2 ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
nData = 10 ;
strmov ( szData , ( char * ) "venu" ) ;
my_bind [ 1 ] . buffer_type = MYSQL_TYPE_STRING ;
my_bind [ 1 ] . buffer = ( void * ) szData ;
my_bind [ 1 ] . buffer_length = 4 ;
my_bind [ 1 ] . length = & length [ 1 ] ;
length [ 1 ] = 4 ;
my_bind [ 0 ] . buffer = ( void * ) & nData ;
my_bind [ 0 ] . buffer_type = MYSQL_TYPE_LONG ;
rc = mysql_stmt_bind_param ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = my_process_stmt_result ( stmt ) ;
DIE_UNLESS ( rc == 1 ) ;
mysql_stmt_close ( stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_estimate_b_frame_motion ( MpegEncContext * s , int mb_x , int mb_y ) {
MotionEstContext * const c = & s -> me ;
const int penalty_factor = c -> mb_penalty_factor ;
int fmin , bmin , dmin , fbmin , bimin , fimin ;
int type = 0 ;
const int xy = mb_y * s -> mb_stride + mb_x ;
init_ref ( c , s -> new_picture . f . data , s -> last_picture . f . data , s -> next_picture . f . data , 16 * mb_x , 16 * mb_y , 2 ) ;
get_limits ( s , 16 * mb_x , 16 * mb_y ) ;
c -> skip = 0 ;
if ( s -> codec_id == AV_CODEC_ID_MPEG4 && s -> next_picture . f . mbskip_table [ xy ] ) {
int score = direct_search ( s , mb_x , mb_y ) ;
score = ( ( unsigned ) ( score * score + 128 * 256 ) ) >> 16 ;
c -> mc_mb_var_sum_temp += score ;
s -> current_picture . mc_mb_var [ mb_y * s -> mb_stride + mb_x ] = score ;
s -> mb_type [ mb_y * s -> mb_stride + mb_x ] = CANDIDATE_MB_TYPE_DIRECT0 ;
return ;
}
if ( s -> codec_id == AV_CODEC_ID_MPEG4 ) dmin = direct_search ( s , mb_x , mb_y ) ;
else dmin = INT_MAX ;
c -> skip = 0 ;
fmin = ff_estimate_motion_b ( s , mb_x , mb_y , s -> b_forw_mv_table , 0 , s -> f_code ) + 3 * penalty_factor ;
c -> skip = 0 ;
bmin = ff_estimate_motion_b ( s , mb_x , mb_y , s -> b_back_mv_table , 2 , s -> b_code ) + 2 * penalty_factor ;
av_dlog ( s , " %d %d " , s -> b_forw_mv_table [ xy ] [ 0 ] , s -> b_forw_mv_table [ xy ] [ 1 ] ) ;
c -> skip = 0 ;
fbmin = bidir_refine ( s , mb_x , mb_y ) + penalty_factor ;
av_dlog ( s , "%d %d %d %d\n" , dmin , fmin , bmin , fbmin ) ;
if ( s -> flags & CODEC_FLAG_INTERLACED_ME ) {
c -> skip = 0 ;
c -> current_mv_penalty = c -> mv_penalty [ s -> f_code ] + MAX_MV ;
fimin = interlaced_search ( s , 0 , s -> b_field_mv_table [ 0 ] , s -> b_field_select_table [ 0 ] , s -> b_forw_mv_table [ xy ] [ 0 ] , s -> b_forw_mv_table [ xy ] [ 1 ] , 0 ) ;
c -> current_mv_penalty = c -> mv_penalty [ s -> b_code ] + MAX_MV ;
bimin = interlaced_search ( s , 2 , s -> b_field_mv_table [ 1 ] , s -> b_field_select_table [ 1 ] , s -> b_back_mv_table [ xy ] [ 0 ] , s -> b_back_mv_table [ xy ] [ 1 ] , 0 ) ;
}
else fimin = bimin = INT_MAX ;
{
int score = fmin ;
type = CANDIDATE_MB_TYPE_FORWARD ;
if ( dmin <= score ) {
score = dmin ;
type = CANDIDATE_MB_TYPE_DIRECT ;
}
if ( bmin < score ) {
score = bmin ;
type = CANDIDATE_MB_TYPE_BACKWARD ;
}
if ( fbmin < score ) {
score = fbmin ;
type = CANDIDATE_MB_TYPE_BIDIR ;
}
if ( fimin < score ) {
score = fimin ;
type = CANDIDATE_MB_TYPE_FORWARD_I ;
}
if ( bimin < score ) {
score = bimin ;
type = CANDIDATE_MB_TYPE_BACKWARD_I ;
}
score = ( ( unsigned ) ( score * score + 128 * 256 ) ) >> 16 ;
c -> mc_mb_var_sum_temp += score ;
s -> current_picture . mc_mb_var [ mb_y * s -> mb_stride + mb_x ] = score ;
}
if ( c -> avctx -> mb_decision > FF_MB_DECISION_SIMPLE ) {
type = CANDIDATE_MB_TYPE_FORWARD | CANDIDATE_MB_TYPE_BACKWARD | CANDIDATE_MB_TYPE_BIDIR | CANDIDATE_MB_TYPE_DIRECT ;
if ( fimin < INT_MAX ) type |= CANDIDATE_MB_TYPE_FORWARD_I ;
if ( bimin < INT_MAX ) type |= CANDIDATE_MB_TYPE_BACKWARD_I ;
if ( fimin < INT_MAX && bimin < INT_MAX ) {
type |= CANDIDATE_MB_TYPE_BIDIR_I ;
}
if ( dmin > 256 * 256 * 16 ) type &= ~ CANDIDATE_MB_TYPE_DIRECT ;
if ( s -> codec_id == AV_CODEC_ID_MPEG4 && type & CANDIDATE_MB_TYPE_DIRECT && s -> flags & CODEC_FLAG_MV0 && * ( uint32_t * ) s -> b_direct_mv_table [ xy ] ) type |= CANDIDATE_MB_TYPE_DIRECT0 ;
}
s -> mb_type [ mb_y * s -> mb_stride + mb_x ] = type ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int tls1_cbc_remove_padding ( const SSL * s , SSL3_RECORD * rec , unsigned block_size , unsigned mac_size ) {
unsigned padding_length , good , to_check , i ;
const unsigned overhead = 1 + mac_size ;
if ( SSL_USE_EXPLICIT_IV ( s ) ) {
if ( overhead + block_size > rec -> length ) return 0 ;
rec -> data += block_size ;
rec -> input += block_size ;
rec -> length -= block_size ;
rec -> orig_len -= block_size ;
}
else if ( overhead > rec -> length ) return 0 ;
padding_length = rec -> data [ rec -> length - 1 ] ;
if ( EVP_CIPHER_flags ( EVP_CIPHER_CTX_cipher ( s -> enc_read_ctx ) ) & EVP_CIPH_FLAG_AEAD_CIPHER ) {
rec -> length -= padding_length + 1 ;
return 1 ;
}
good = constant_time_ge ( rec -> length , overhead + padding_length ) ;
to_check = 256 ;
if ( to_check > rec -> length ) to_check = rec -> length ;
for ( i = 0 ;
i < to_check ;
i ++ ) {
unsigned char mask = constant_time_ge_8 ( padding_length , i ) ;
unsigned char b = rec -> data [ rec -> length - 1 - i ] ;
good &= ~ ( mask & ( padding_length ^ b ) ) ;
}
good = constant_time_eq ( 0xff , good & 0xff ) ;
rec -> length -= good & ( padding_length + 1 ) ;
return constant_time_select_int ( good , 1 , - 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_ConferenceCapability ( 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_ConferenceCapability , ConferenceCapability_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , URLRefTestCount2 ) {
TemplateURLData data ;
data . SetURL ( "http://foo{
searchTerms}
{
count}
" ) ;
TemplateURL url ( data ) ;
EXPECT_TRUE ( url . url_ref ( ) . IsValid ( search_terms_data_ ) ) ;
ASSERT_TRUE ( url . url_ref ( ) . SupportsReplacement ( search_terms_data_ ) ) ;
GURL result ( url . url_ref ( ) . ReplaceSearchTerms ( TemplateURLRef : : SearchTermsArgs ( ASCIIToUTF16 ( "X" ) ) , search_terms_data_ ) ) ;
ASSERT_TRUE ( result . is_valid ( ) ) ;
EXPECT_EQ ( "http://foox10/" , result . spec ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const uint8_t * read_huffman_tables ( FourXContext * f , const uint8_t * const buf ) {
int frequency [ 512 ] = {
0 }
;
uint8_t flag [ 512 ] ;
int up [ 512 ] ;
uint8_t len_tab [ 257 ] ;
int bits_tab [ 257 ] ;
int start , end ;
const uint8_t * ptr = buf ;
int j ;
memset ( up , - 1 , sizeof ( up ) ) ;
start = * ptr ++ ;
end = * ptr ++ ;
for ( ;
;
) {
int i ;
for ( i = start ;
i <= end ;
i ++ ) frequency [ i ] = * ptr ++ ;
start = * ptr ++ ;
if ( start == 0 ) break ;
end = * ptr ++ ;
}
frequency [ 256 ] = 1 ;
while ( ( ptr - buf ) & 3 ) ptr ++ ;
for ( j = 257 ;
j < 512 ;
j ++ ) {
int min_freq [ 2 ] = {
256 * 256 , 256 * 256 }
;
int smallest [ 2 ] = {
0 , 0 }
;
int i ;
for ( i = 0 ;
i < j ;
i ++ ) {
if ( frequency [ i ] == 0 ) continue ;
if ( frequency [ i ] < min_freq [ 1 ] ) {
if ( frequency [ i ] < min_freq [ 0 ] ) {
min_freq [ 1 ] = min_freq [ 0 ] ;
smallest [ 1 ] = smallest [ 0 ] ;
min_freq [ 0 ] = frequency [ i ] ;
smallest [ 0 ] = i ;
}
else {
min_freq [ 1 ] = frequency [ i ] ;
smallest [ 1 ] = i ;
}
}
}
if ( min_freq [ 1 ] == 256 * 256 ) break ;
frequency [ j ] = min_freq [ 0 ] + min_freq [ 1 ] ;
flag [ smallest [ 0 ] ] = 0 ;
flag [ smallest [ 1 ] ] = 1 ;
up [ smallest [ 0 ] ] = up [ smallest [ 1 ] ] = j ;
frequency [ smallest [ 0 ] ] = frequency [ smallest [ 1 ] ] = 0 ;
}
for ( j = 0 ;
j < 257 ;
j ++ ) {
int node , len = 0 , bits = 0 ;
for ( node = j ;
up [ node ] != - 1 ;
node = up [ node ] ) {
bits += flag [ node ] << len ;
len ++ ;
if ( len > 31 ) av_log ( f -> avctx , AV_LOG_ERROR , "vlc length overflow\n" ) ;
}
bits_tab [ j ] = bits ;
len_tab [ j ] = len ;
}
if ( init_vlc ( & f -> pre_vlc , ACDC_VLC_BITS , 257 , len_tab , 1 , 1 , bits_tab , 4 , 4 , 0 ) ) return NULL ;
return ptr ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void gsm_a_stat_reset ( new_stat_tap_table * table ) {
guint element ;
stat_tap_table_item_type * item_data ;
for ( element = 0 ;
element < table -> num_elements ;
element ++ ) {
item_data = new_stat_tap_get_field_data ( table , element , COUNT_COLUMN ) ;
item_data -> value . uint_value = 0 ;
new_stat_tap_set_field_data ( table , element , COUNT_COLUMN , item_data ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int _is_prolog_finished ( uint32_t job_id ) {
int is_running = 0 ;
struct job_record * job_ptr ;
slurmctld_lock_t job_read_lock = {
NO_LOCK , READ_LOCK , NO_LOCK , NO_LOCK , NO_LOCK }
;
lock_slurmctld ( job_read_lock ) ;
job_ptr = find_job_record ( job_id ) ;
if ( job_ptr ) {
is_running = ( job_ptr -> state_reason != WAIT_PROLOG ) ;
}
unlock_slurmctld ( job_read_lock ) ;
return is_running ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool send_ans_key ( node_t * to ) {
to -> incipher = myself -> incipher ;
to -> inkeylength = myself -> inkeylength ;
to -> indigest = myself -> indigest ;
to -> inmaclength = myself -> inmaclength ;
to -> incompression = myself -> incompression ;
to -> inkey = xrealloc ( to -> inkey , to -> inkeylength ) ;
if ( 1 != RAND_bytes ( ( unsigned char * ) to -> inkey , to -> inkeylength ) ) {
int err = ERR_get_error ( ) ;
logger ( LOG_ERR , "Failed to generate random for key (%s)" , ERR_error_string ( err , NULL ) ) ;
return false ;
}
if ( to -> incipher ) {
EVP_DecryptInit_ex ( to -> inctx , to -> incipher , NULL , ( unsigned char * ) to -> inkey , ( unsigned char * ) to -> inkey + EVP_CIPHER_key_length ( to -> incipher ) ) ;
}
mykeyused = true ;
to -> received_seqno = 0 ;
if ( replaywin ) {
memset ( to -> late , 0 , replaywin ) ;
}
char key [ 2 * to -> inkeylength + 1 ] ;
bin2hex ( to -> inkey , key , to -> inkeylength ) ;
key [ to -> inkeylength * 2 ] = '\0' ;
return send_request ( to -> nexthop -> connection , "%d %s %s %s %d %d %d %d" , ANS_KEY , myself -> name , to -> name , key , to -> incipher ? EVP_CIPHER_nid ( to -> incipher ) : 0 , to -> indigest ? EVP_MD_type ( to -> indigest ) : 0 , to -> inmaclength , to -> incompression ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new ( sk_ ## t1 ## _compfunc compare ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new ( ( OPENSSL_sk_compfunc ) compare ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ;
}
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) {
return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ;
}
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_INTEGER_1_72 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 1U , 72U , NULL , FALSE ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cid_init_loader ( CID_Loader * loader , CID_Face face ) {
FT_UNUSED ( face ) ;
FT_MEM_ZERO ( loader , sizeof ( * loader ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
HTTPHdrImpl * http_hdr_clone ( HTTPHdrImpl * s_hh , HdrHeap * s_heap , HdrHeap * d_heap ) {
HTTPHdrImpl * d_hh ;
d_hh = http_hdr_create ( d_heap , s_hh -> m_polarity ) ;
http_hdr_copy_onto ( s_hh , s_heap , d_hh , d_heap , ( ( s_heap != d_heap ) ? true : false ) ) ;
return ( d_hh ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static UChar32 U_CALLCONV lenient8IteratorCurrent ( UCharIterator * iter ) {
if ( iter -> reservedField != 0 ) {
return U16_TRAIL ( iter -> reservedField ) ;
}
else if ( iter -> start < iter -> limit ) {
const uint8_t * s = ( const uint8_t * ) iter -> context ;
UChar32 c ;
int32_t i = iter -> start ;
L8_NEXT ( s , i , iter -> limit , c ) ;
if ( c < 0 ) {
return 0xfffd ;
}
else if ( c <= 0xffff ) {
return c ;
}
else {
return U16_LEAD ( c ) ;
}
}
else {
return U_SENTINEL ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int mbfl_buffer_converter_illegal_substchar ( mbfl_buffer_converter * convd , int substchar ) {
if ( convd != NULL ) {
if ( convd -> filter2 != NULL ) {
convd -> filter2 -> illegal_substchar = substchar ;
}
else if ( convd -> filter1 != NULL ) {
convd -> filter1 -> illegal_substchar = substchar ;
}
else {
return 0 ;
}
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void write_profile ( BITSTREAM_PROFILE profile , struct vp9_write_bit_buffer * wb ) {
switch ( profile ) {
case PROFILE_0 : vp9_wb_write_literal ( wb , 0 , 2 ) ;
break ;
case PROFILE_1 : vp9_wb_write_literal ( wb , 2 , 2 ) ;
break ;
case PROFILE_2 : vp9_wb_write_literal ( wb , 1 , 2 ) ;
break ;
case PROFILE_3 : vp9_wb_write_literal ( wb , 6 , 3 ) ;
break ;
default : assert ( 0 ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ebml_free ( EbmlSyntax * syntax , void * data ) {
int i , j ;
for ( i = 0 ;
syntax [ i ] . id ;
i ++ ) {
void * data_off = ( char * ) data + syntax [ i ] . data_offset ;
switch ( syntax [ i ] . type ) {
case EBML_STR : case EBML_UTF8 : av_freep ( data_off ) ;
break ;
case EBML_BIN : av_freep ( & ( ( EbmlBin * ) data_off ) -> data ) ;
break ;
case EBML_NEST : if ( syntax [ i ] . list_elem_size ) {
EbmlList * list = data_off ;
char * ptr = list -> elem ;
for ( j = 0 ;
j < list -> nb_elem ;
j ++ , ptr += syntax [ i ] . list_elem_size ) ebml_free ( syntax [ i ] . def . n , ptr ) ;
av_free ( list -> elem ) ;
}
else ebml_free ( syntax [ i ] . def . n , data_off ) ;
default : break ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int sgn ( int value ) {
return ( value < 0 ) ? - 1 : 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_setprocattr ( struct task_struct * p , char * name , void * value , size_t size ) {
struct task_security_struct * tsec ;
struct cred * new ;
u32 sid = 0 , ptsid ;
int error ;
char * str = value ;
if ( current != p ) {
return - EACCES ;
}
if ( ! strcmp ( name , "exec" ) ) error = current_has_perm ( p , PROCESS__SETEXEC ) ;
else if ( ! strcmp ( name , "fscreate" ) ) error = current_has_perm ( p , PROCESS__SETFSCREATE ) ;
else if ( ! strcmp ( name , "keycreate" ) ) error = current_has_perm ( p , PROCESS__SETKEYCREATE ) ;
else if ( ! strcmp ( name , "sockcreate" ) ) error = current_has_perm ( p , PROCESS__SETSOCKCREATE ) ;
else if ( ! strcmp ( name , "current" ) ) error = current_has_perm ( p , PROCESS__SETCURRENT ) ;
else error = - EINVAL ;
if ( error ) return error ;
if ( size && str [ 0 ] && str [ 0 ] != '\n' ) {
if ( str [ size - 1 ] == '\n' ) {
str [ size - 1 ] = 0 ;
size -- ;
}
error = security_context_to_sid ( value , size , & sid , GFP_KERNEL ) ;
if ( error == - EINVAL && ! strcmp ( name , "fscreate" ) ) {
if ( ! capable ( CAP_MAC_ADMIN ) ) {
struct audit_buffer * ab ;
size_t audit_size ;
if ( str [ size - 1 ] == '\0' ) audit_size = size - 1 ;
else audit_size = size ;
ab = audit_log_start ( current -> audit_context , GFP_ATOMIC , AUDIT_SELINUX_ERR ) ;
audit_log_format ( ab , "op=fscreate invalid_context=" ) ;
audit_log_n_untrustedstring ( ab , value , audit_size ) ;
audit_log_end ( ab ) ;
return error ;
}
error = security_context_to_sid_force ( value , size , & sid ) ;
}
if ( error ) return error ;
}
new = prepare_creds ( ) ;
if ( ! new ) return - ENOMEM ;
tsec = new -> security ;
if ( ! strcmp ( name , "exec" ) ) {
tsec -> exec_sid = sid ;
}
else if ( ! strcmp ( name , "fscreate" ) ) {
tsec -> create_sid = sid ;
}
else if ( ! strcmp ( name , "keycreate" ) ) {
error = may_create_key ( sid , p ) ;
if ( error ) goto abort_change ;
tsec -> keycreate_sid = sid ;
}
else if ( ! strcmp ( name , "sockcreate" ) ) {
tsec -> sockcreate_sid = sid ;
}
else if ( ! strcmp ( name , "current" ) ) {
error = - EINVAL ;
if ( sid == 0 ) goto abort_change ;
error = - EPERM ;
if ( ! current_is_single_threaded ( ) ) {
error = security_bounded_transition ( tsec -> sid , sid ) ;
if ( error ) goto abort_change ;
}
error = avc_has_perm ( tsec -> sid , sid , SECCLASS_PROCESS , PROCESS__DYNTRANSITION , NULL ) ;
if ( error ) goto abort_change ;
ptsid = ptrace_parent_sid ( p ) ;
if ( ptsid != 0 ) {
error = avc_has_perm ( ptsid , sid , SECCLASS_PROCESS , PROCESS__PTRACE , NULL ) ;
if ( error ) goto abort_change ;
}
tsec -> sid = sid ;
}
else {
error = - EINVAL ;
goto abort_change ;
}
commit_creds ( new ) ;
return size ;
abort_change : abort_creds ( new ) ;
return error ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mpeg_decode_postinit ( AVCodecContext * avctx ) {
Mpeg1Context * s1 = avctx -> priv_data ;
MpegEncContext * s = & s1 -> mpeg_enc_ctx ;
uint8_t old_permutation [ 64 ] ;
if ( ( s1 -> mpeg_enc_ctx_allocated == 0 ) || avctx -> coded_width != s -> width || avctx -> coded_height != s -> height || s1 -> save_width != s -> width || s1 -> save_height != s -> height || s1 -> save_aspect_info != s -> aspect_ratio_info || s1 -> save_progressive_seq != s -> progressive_sequence || 0 ) {
if ( s1 -> mpeg_enc_ctx_allocated ) {
ParseContext pc = s -> parse_context ;
s -> parse_context . buffer = 0 ;
ff_MPV_common_end ( s ) ;
s -> parse_context = pc ;
}
if ( ( s -> width == 0 ) || ( s -> height == 0 ) ) return - 2 ;
avcodec_set_dimensions ( avctx , s -> width , s -> height ) ;
avctx -> bit_rate = s -> bit_rate ;
s1 -> save_aspect_info = s -> aspect_ratio_info ;
s1 -> save_width = s -> width ;
s1 -> save_height = s -> height ;
s1 -> save_progressive_seq = s -> progressive_sequence ;
avctx -> has_b_frames = ! s -> low_delay ;
if ( avctx -> codec_id == AV_CODEC_ID_MPEG1VIDEO ) {
avctx -> time_base . den = ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . num ;
avctx -> time_base . num = ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . den ;
avctx -> sample_aspect_ratio = av_d2q ( 1.0 / ff_mpeg1_aspect [ s -> aspect_ratio_info ] , 255 ) ;
avctx -> ticks_per_frame = 1 ;
}
else {
av_reduce ( & s -> avctx -> time_base . den , & s -> avctx -> time_base . num , ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . num * s1 -> frame_rate_ext . num * 2 , ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . den * s1 -> frame_rate_ext . den , 1 << 30 ) ;
avctx -> ticks_per_frame = 2 ;
if ( s -> aspect_ratio_info > 1 ) {
AVRational dar = av_mul_q ( av_div_q ( ff_mpeg2_aspect [ s -> aspect_ratio_info ] , ( AVRational ) {
s1 -> pan_scan . width , s1 -> pan_scan . height }
) , ( AVRational ) {
s -> width , s -> height }
) ;
if ( ( s1 -> pan_scan . width == 0 ) || ( s1 -> pan_scan . height == 0 ) || ( av_cmp_q ( dar , ( AVRational ) {
4 , 3 }
) && av_cmp_q ( dar , ( AVRational ) {
16 , 9 }
) ) ) {
s -> avctx -> sample_aspect_ratio = av_div_q ( ff_mpeg2_aspect [ s -> aspect_ratio_info ] , ( AVRational ) {
s -> width , s -> height }
) ;
}
else {
s -> avctx -> sample_aspect_ratio = av_div_q ( ff_mpeg2_aspect [ s -> aspect_ratio_info ] , ( AVRational ) {
s1 -> pan_scan . width , s1 -> pan_scan . height }
) ;
av_dlog ( avctx , "A %d/%d\n" , ff_mpeg2_aspect [ s -> aspect_ratio_info ] . num , ff_mpeg2_aspect [ s -> aspect_ratio_info ] . den ) ;
av_dlog ( avctx , "B %d/%d\n" , s -> avctx -> sample_aspect_ratio . num , s -> avctx -> sample_aspect_ratio . den ) ;
}
}
else {
s -> avctx -> sample_aspect_ratio = ff_mpeg2_aspect [ s -> aspect_ratio_info ] ;
}
}
avctx -> pix_fmt = mpeg_get_pixelformat ( avctx ) ;
avctx -> hwaccel = ff_find_hwaccel ( avctx -> codec -> id , avctx -> pix_fmt ) ;
if ( avctx -> pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx -> hwaccel || s -> avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) if ( avctx -> idct_algo == FF_IDCT_AUTO ) avctx -> idct_algo = FF_IDCT_SIMPLE ;
memcpy ( old_permutation , s -> dsp . idct_permutation , 64 * sizeof ( uint8_t ) ) ;
if ( ff_MPV_common_init ( s ) < 0 ) return - 2 ;
quant_matrix_rebuild ( s -> intra_matrix , old_permutation , s -> dsp . idct_permutation ) ;
quant_matrix_rebuild ( s -> inter_matrix , old_permutation , s -> dsp . idct_permutation ) ;
quant_matrix_rebuild ( s -> chroma_intra_matrix , old_permutation , s -> dsp . idct_permutation ) ;
quant_matrix_rebuild ( s -> chroma_inter_matrix , old_permutation , s -> dsp . idct_permutation ) ;
s1 -> mpeg_enc_ctx_allocated = 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BrowsingDataRemoverImplTest , RemoveQuotaManagedUnprotectedOrigins ) {
# if BUILDFLAG ( ENABLE_EXTENSIONS ) MockExtensionSpecialStoragePolicy * policy = CreateMockPolicy ( ) ;
policy -> AddProtected ( kOrigin1 . GetOrigin ( ) ) ;
# endif BlockUntilBrowsingDataRemoved ( base : : Time ( ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , false ) ;
EXPECT_EQ ( BrowsingDataRemover : : REMOVE_FILE_SYSTEMS | BrowsingDataRemover : : REMOVE_WEBSQL | BrowsingDataRemover : : REMOVE_APPCACHE | BrowsingDataRemover : : REMOVE_SERVICE_WORKERS | BrowsingDataRemover : : REMOVE_CACHE_STORAGE | BrowsingDataRemover : : REMOVE_INDEXEDDB , GetRemovalMask ( ) ) ;
EXPECT_EQ ( BrowsingDataHelper : : UNPROTECTED_WEB , GetOriginTypeMask ( ) ) ;
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData ( ) ;
EXPECT_EQ ( removal_data . remove_mask , StoragePartition : : REMOVE_DATA_MASK_FILE_SYSTEMS | StoragePartition : : REMOVE_DATA_MASK_WEBSQL | StoragePartition : : REMOVE_DATA_MASK_APPCACHE | StoragePartition : : REMOVE_DATA_MASK_SERVICE_WORKERS | StoragePartition : : REMOVE_DATA_MASK_CACHE_STORAGE | StoragePartition : : REMOVE_DATA_MASK_INDEXEDDB ) ;
EXPECT_EQ ( removal_data . quota_storage_remove_mask , StoragePartition : : QUOTA_MANAGED_STORAGE_MASK_ALL ) ;
EXPECT_EQ ( ShouldRemoveForProtectedOriginOne ( ) , removal_data . origin_matcher . Run ( kOrigin1 , mock_policy ( ) ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin2 , mock_policy ( ) ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin3 , mock_policy ( ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
PGresult * ExecuteSqlQueryForSingleRow ( Archive * fout , char * query ) {
PGresult * res ;
int ntups ;
res = ExecuteSqlQuery ( fout , query , PGRES_TUPLES_OK ) ;
ntups = PQntuples ( res ) ;
if ( ntups != 1 ) exit_horribly ( NULL , ngettext ( "query returned %d row instead of one: %s\n" , "query returned %d rows instead of one: %s\n" , ntups ) , ntups , query ) ;
return res ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug19671 ( ) {
MYSQL_RES * result ;
int rc ;
myheader ( "test_bug19671" ) ;
mysql_query ( mysql , "set sql_mode=''" ) ;
rc = mysql_query ( mysql , "drop table if exists t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "drop view if exists v1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "create table t1(f1 int)" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "create view v1 as select va.* from t1 va" ) ;
myquery ( rc ) ;
result = mysql_list_fields ( mysql , "v1" , NULL ) ;
mytest ( result ) ;
rc = my_process_result_set ( result ) ;
DIE_UNLESS ( rc == 0 ) ;
verify_prepare_field ( result , 0 , "f1" , "f1" , MYSQL_TYPE_LONG , "v1" , "v1" , current_db , 11 , "0" ) ;
mysql_free_result ( result ) ;
myquery ( mysql_query ( mysql , "drop view v1" ) ) ;
myquery ( mysql_query ( mysql , "drop table t1" ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gcry_err_code_t sexp_to_key ( gcry_sexp_t sexp , int want_private , int use , const char * override_elems , gcry_mpi_t * * retarray , gcry_module_t * retalgo , int * r_is_ecc ) {
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 ;
pk_extra_spec_t * extraspec ;
int is_ecc ;
list = gcry_sexp_find_token ( sexp , want_private ? "private-key" : "public-key" , 0 ) ;
if ( ! list && ! want_private ) list = gcry_sexp_find_token ( sexp , "private-key" , 0 ) ;
if ( ! list ) return GPG_ERR_INV_OBJ ;
l2 = gcry_sexp_cadr ( list ) ;
gcry_sexp_release ( list ) ;
list = l2 ;
name = _gcry_sexp_nth_string ( list , 0 ) ;
if ( ! name ) {
gcry_sexp_release ( list ) ;
return GPG_ERR_INV_OBJ ;
}
if ( ! strcmp ( name , "ecc" ) ) is_ecc = 2 ;
else if ( ! strcmp ( name , "ecdsa" ) || ! strcmp ( name , "ecdh" ) ) is_ecc = 1 ;
else is_ecc = 0 ;
ath_mutex_lock ( & pubkeys_registered_lock ) ;
if ( is_ecc == 2 && ( use & GCRY_PK_USAGE_SIGN ) ) module = gcry_pk_lookup_name ( "ecdsa" ) ;
else if ( is_ecc == 2 && ( use & GCRY_PK_USAGE_ENCR ) ) module = gcry_pk_lookup_name ( "ecdh" ) ;
else module = gcry_pk_lookup_name ( name ) ;
ath_mutex_unlock ( & pubkeys_registered_lock ) ;
gcry_free ( name ) ;
if ( ! module ) {
gcry_sexp_release ( list ) ;
return GPG_ERR_PUBKEY_ALGO ;
}
else {
pubkey = ( gcry_pk_spec_t * ) module -> spec ;
extraspec = module -> extraspec ;
}
if ( override_elems ) elems = override_elems ;
else if ( want_private ) elems = pubkey -> elements_skey ;
else elems = pubkey -> elements_pkey ;
array = gcry_calloc ( strlen ( elems ) + 1 , sizeof ( * array ) ) ;
if ( ! array ) err = gpg_err_code_from_syserror ( ) ;
if ( ! err ) {
if ( is_ecc ) err = sexp_elements_extract_ecc ( list , elems , array , extraspec , want_private ) ;
else err = sexp_elements_extract ( list , elems , array , pubkey -> name ) ;
}
gcry_sexp_release ( list ) ;
if ( err ) {
gcry_free ( array ) ;
ath_mutex_lock ( & pubkeys_registered_lock ) ;
_gcry_module_release ( module ) ;
ath_mutex_unlock ( & pubkeys_registered_lock ) ;
}
else {
* retarray = array ;
* retalgo = module ;
if ( r_is_ecc ) * r_is_ecc = is_ecc ;
}
return err ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ReadReal ( cmsIT8 * it8 , cmsInt32Number inum ) {
it8 -> dnum = ( cmsFloat64Number ) inum ;
while ( isdigit ( it8 -> ch ) ) {
it8 -> dnum = ( cmsFloat64Number ) it8 -> dnum * 10.0 + ( cmsFloat64Number ) ( it8 -> ch - '0' ) ;
NextCh ( it8 ) ;
}
if ( it8 -> ch == '.' ) {
cmsFloat64Number frac = 0.0 ;
int prec = 0 ;
NextCh ( it8 ) ;
while ( isdigit ( it8 -> ch ) ) {
frac = frac * 10.0 + ( cmsFloat64Number ) ( it8 -> ch - '0' ) ;
prec ++ ;
NextCh ( it8 ) ;
}
it8 -> dnum = it8 -> dnum + ( frac / xpow10 ( prec ) ) ;
}
if ( toupper ( it8 -> ch ) == 'E' ) {
cmsInt32Number e ;
cmsInt32Number sgn ;
NextCh ( it8 ) ;
sgn = 1 ;
if ( it8 -> ch == '-' ) {
sgn = - 1 ;
NextCh ( it8 ) ;
}
else if ( it8 -> ch == '+' ) {
sgn = + 1 ;
NextCh ( it8 ) ;
}
e = 0 ;
while ( isdigit ( it8 -> ch ) ) {
cmsInt32Number digit = ( it8 -> ch - '0' ) ;
if ( ( cmsFloat64Number ) e * 10.0 + ( cmsFloat64Number ) digit < ( cmsFloat64Number ) + 2147483647.0 ) e = e * 10 + digit ;
NextCh ( it8 ) ;
}
e = sgn * e ;
it8 -> dnum = it8 -> dnum * xpow10 ( e ) ;
}
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.