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 DecoderPlaySpu ( decoder_t * p_dec , subpicture_t * p_subpic ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
vout_thread_t * p_vout = p_owner -> p_spu_vout ;
if ( p_subpic -> i_start <= VLC_TS_INVALID ) {
msg_Warn ( p_dec , "non-dated spu buffer received" ) ;
subpicture_Delete ( p_subpic ) ;
return ;
}
vlc_mutex_lock ( & p_owner -> lock ) ;
if ( p_owner -> b_waiting ) {
p_owner -> b_has_data = true ;
vlc_cond_signal ( & p_owner -> wait_acknowledge ) ;
}
bool b_reject = DecoderWaitUnblock ( p_dec ) ;
DecoderFixTs ( p_dec , & p_subpic -> i_start , & p_subpic -> i_stop , NULL , NULL , INT64_MAX ) ;
if ( p_subpic -> i_start <= VLC_TS_INVALID ) b_reject = true ;
DecoderWaitDate ( p_dec , & b_reject , p_subpic -> i_start - SPU_MAX_PREPARE_TIME ) ;
vlc_mutex_unlock ( & p_owner -> lock ) ;
if ( ! b_reject ) vout_PutSubpicture ( p_vout , p_subpic ) ;
else subpicture_Delete ( p_subpic ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerBrowserTest , TestCloseWindowDuringShutdown ) {
ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browsers_ [ 0 ] , embedded_test_server ( ) -> GetURL ( "/beforeunload.html" ) ) ) ;
browsers_ . push_back ( CreateBrowser ( browser ( ) -> profile ( ) ) ) ;
ASSERT_NO_FATAL_FAILURE ( ui_test_utils : : NavigateToURL ( browsers_ [ 1 ] , embedded_test_server ( ) -> GetURL ( "/beforeunload.html" ) ) ) ;
PrepareForDialog ( browsers_ [ 0 ] ) ;
PrepareForDialog ( browsers_ [ 1 ] ) ;
RepeatedNotificationObserver cancel_observer ( chrome : : NOTIFICATION_BROWSER_CLOSE_CANCELLED , 1 ) ;
chrome : : CloseAllBrowsersAndQuit ( ) ;
ASSERT_FALSE ( browsers_ [ 0 ] -> ShouldCloseWindow ( ) ) ;
ASSERT_NO_FATAL_FAILURE ( CancelClose ( ) ) ;
cancel_observer . Wait ( ) ;
EXPECT_FALSE ( browser_shutdown : : IsTryingToQuit ( ) ) ;
EXPECT_EQ ( 1 , browsers_ [ 0 ] -> tab_strip_model ( ) -> count ( ) ) ;
EXPECT_EQ ( 1 , browsers_ [ 1 ] -> tab_strip_model ( ) -> count ( ) ) ;
RepeatedNotificationObserver close_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , 2 ) ;
chrome : : CloseAllBrowsersAndQuit ( ) ;
ASSERT_FALSE ( browsers_ [ 0 ] -> ShouldCloseWindow ( ) ) ;
ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ;
ASSERT_NO_FATAL_FAILURE ( AcceptClose ( ) ) ;
close_observer . Wait ( ) ;
EXPECT_TRUE ( browser_shutdown : : IsTryingToQuit ( ) ) ;
EXPECT_TRUE ( BrowserList : : GetInstance ( ) -> empty ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_f ( fz_context * ctx , pdf_processor * proc ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pdf_show_path ( ctx , pr , 0 , 1 , 0 , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static hb_feature_t * feature_reference ( hb_feature_t * g ) {
hb_feature_t * c = ( hb_feature_t * ) calloc ( 1 , sizeof ( hb_feature_t ) ) ;
if ( unlikely ( ! c ) ) return NULL ;
* c = * g ;
return c ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSMimeHdrCopy ( TSMBuffer dest_bufp , TSMLoc dest_obj , TSMBuffer src_bufp , TSMLoc src_obj ) {
sdk_assert ( sdk_sanity_check_mbuffer ( src_bufp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_mbuffer ( dest_bufp ) == TS_SUCCESS ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( src_obj ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( src_obj ) == TS_SUCCESS ) ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( dest_obj ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( dest_obj ) == TS_SUCCESS ) ) ;
if ( ! isWriteable ( dest_bufp ) ) {
return TS_ERROR ;
}
HdrHeap * s_heap , * d_heap ;
MIMEHdrImpl * s_mh , * d_mh ;
s_heap = ( ( HdrHeapSDKHandle * ) src_bufp ) -> m_heap ;
d_heap = ( ( HdrHeapSDKHandle * ) dest_bufp ) -> m_heap ;
s_mh = _hdr_mloc_to_mime_hdr_impl ( src_obj ) ;
d_mh = _hdr_mloc_to_mime_hdr_impl ( dest_obj ) ;
mime_hdr_fields_clear ( d_heap , d_mh ) ;
mime_hdr_copy_onto ( s_mh , s_heap , d_mh , d_heap , ( s_heap != d_heap ) ) ;
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug6081 ( ) {
int rc ;
myheader ( "test_bug6081" ) ;
rc = simple_command ( mysql , COM_DROP_DB , ( uchar * ) current_db , ( ulong ) strlen ( current_db ) , 0 ) ;
if ( rc == 0 && mysql_errno ( mysql ) != ER_UNKNOWN_COM_ERROR ) {
myerror ( NULL ) ;
die ( __FILE__ , __LINE__ , "COM_DROP_DB failed" ) ;
}
rc = simple_command ( mysql , COM_DROP_DB , ( uchar * ) current_db , ( ulong ) strlen ( current_db ) , 0 ) ;
myquery_r ( rc ) ;
rc = simple_command ( mysql , COM_CREATE_DB , ( uchar * ) current_db , ( ulong ) strlen ( current_db ) , 0 ) ;
if ( rc == 0 && mysql_errno ( mysql ) != ER_UNKNOWN_COM_ERROR ) {
myerror ( NULL ) ;
die ( __FILE__ , __LINE__ , "COM_CREATE_DB failed" ) ;
}
rc = simple_command ( mysql , COM_CREATE_DB , ( uchar * ) current_db , ( ulong ) strlen ( current_db ) , 0 ) ;
myquery_r ( rc ) ;
rc = mysql_select_db ( mysql , current_db ) ;
myquery ( rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int vp9_square_search ( const MACROBLOCK * x , MV * ref_mv , int search_param , int sad_per_bit , int do_init_search , int * sad_list , const vp9_variance_fn_ptr_t * vfp , int use_mvcost , const MV * center_mv , MV * best_mv ) {
static const int square_num_candidates [ MAX_PATTERN_SCALES ] = {
8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , 8 , }
;
static const MV square_candidates [ MAX_PATTERN_SCALES ] [ MAX_PATTERN_CANDIDATES ] = {
{
{
- 1 , - 1 }
, {
0 , - 1 }
, {
1 , - 1 }
, {
1 , 0 }
, {
1 , 1 }
, {
0 , 1 }
, {
- 1 , 1 }
, {
- 1 , 0 }
}
, {
{
- 2 , - 2 }
, {
0 , - 2 }
, {
2 , - 2 }
, {
2 , 0 }
, {
2 , 2 }
, {
0 , 2 }
, {
- 2 , 2 }
, {
- 2 , 0 }
}
, {
{
- 4 , - 4 }
, {
0 , - 4 }
, {
4 , - 4 }
, {
4 , 0 }
, {
4 , 4 }
, {
0 , 4 }
, {
- 4 , 4 }
, {
- 4 , 0 }
}
, {
{
- 8 , - 8 }
, {
0 , - 8 }
, {
8 , - 8 }
, {
8 , 0 }
, {
8 , 8 }
, {
0 , 8 }
, {
- 8 , 8 }
, {
- 8 , 0 }
}
, {
{
- 16 , - 16 }
, {
0 , - 16 }
, {
16 , - 16 }
, {
16 , 0 }
, {
16 , 16 }
, {
0 , 16 }
, {
- 16 , 16 }
, {
- 16 , 0 }
}
, {
{
- 32 , - 32 }
, {
0 , - 32 }
, {
32 , - 32 }
, {
32 , 0 }
, {
32 , 32 }
, {
0 , 32 }
, {
- 32 , 32 }
, {
- 32 , 0 }
}
, {
{
- 64 , - 64 }
, {
0 , - 64 }
, {
64 , - 64 }
, {
64 , 0 }
, {
64 , 64 }
, {
0 , 64 }
, {
- 64 , 64 }
, {
- 64 , 0 }
}
, {
{
- 128 , - 128 }
, {
0 , - 128 }
, {
128 , - 128 }
, {
128 , 0 }
, {
128 , 128 }
, {
0 , 128 }
, {
- 128 , 128 }
, {
- 128 , 0 }
}
, {
{
- 256 , - 256 }
, {
0 , - 256 }
, {
256 , - 256 }
, {
256 , 0 }
, {
256 , 256 }
, {
0 , 256 }
, {
- 256 , 256 }
, {
- 256 , 0 }
}
, {
{
- 512 , - 512 }
, {
0 , - 512 }
, {
512 , - 512 }
, {
512 , 0 }
, {
512 , 512 }
, {
0 , 512 }
, {
- 512 , 512 }
, {
- 512 , 0 }
}
, {
{
- 1024 , - 1024 }
, {
0 , - 1024 }
, {
1024 , - 1024 }
, {
1024 , 0 }
, {
1024 , 1024 }
, {
0 , 1024 }
, {
- 1024 , 1024 }
, {
- 1024 , 0 }
}
, }
;
return vp9_pattern_search ( x , ref_mv , search_param , sad_per_bit , do_init_search , sad_list , vfp , use_mvcost , center_mv , best_mv , square_num_candidates , square_candidates ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int X509_CRL_sign_ctx ( X509_CRL * x , EVP_MD_CTX * ctx ) {
x -> crl -> enc . modified = 1 ;
return ASN1_item_sign_ctx ( ASN1_ITEM_rptr ( X509_CRL_INFO ) , x -> crl -> sig_alg , x -> sig_alg , x -> signature , x -> crl , ctx ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ProtocolHandlerRegistryTest , TestGetHandlersFor ) {
ProtocolHandler ph1 = CreateProtocolHandler ( "test" , "test1" ) ;
ProtocolHandler ph2 = CreateProtocolHandler ( "test" , "test2" ) ;
ProtocolHandler ph3 = CreateProtocolHandler ( "test" , "test3" ) ;
registry ( ) -> OnAcceptRegisterProtocolHandler ( ph1 ) ;
registry ( ) -> OnAcceptRegisterProtocolHandler ( ph2 ) ;
registry ( ) -> OnAcceptRegisterProtocolHandler ( ph3 ) ;
ProtocolHandlerRegistry : : ProtocolHandlerList handlers = registry ( ) -> GetHandlersFor ( "test" ) ;
ASSERT_EQ ( static_cast < size_t > ( 3 ) , handlers . size ( ) ) ;
ASSERT_EQ ( ph3 , handlers [ 0 ] ) ;
ASSERT_EQ ( ph2 , handlers [ 1 ] ) ;
ASSERT_EQ ( ph1 , handlers [ 2 ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void show_edge ( struct commit * commit ) {
add_preferred_base ( commit -> object . oid . hash ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gpg_err_code_t point_from_keyparam ( gcry_mpi_point_t * r_a , gcry_sexp_t keyparam , const char * name ) {
gcry_err_code_t ec ;
gcry_mpi_t a = NULL ;
gcry_mpi_point_t point ;
ec = mpi_from_keyparam ( & a , keyparam , name ) ;
if ( ec ) return ec ;
if ( a ) {
point = gcry_mpi_point_new ( 0 ) ;
ec = _gcry_ecc_os2ec ( point , a ) ;
mpi_free ( a ) ;
if ( ec ) {
gcry_mpi_point_release ( point ) ;
return ec ;
}
}
else {
char * tmpname ;
gcry_mpi_t x = NULL ;
gcry_mpi_t y = NULL ;
gcry_mpi_t z = NULL ;
tmpname = gcry_malloc ( strlen ( name ) + 2 + 1 ) ;
if ( ! tmpname ) return gpg_err_code_from_syserror ( ) ;
strcpy ( stpcpy ( tmpname , name ) , ".x" ) ;
ec = mpi_from_keyparam ( & x , keyparam , tmpname ) ;
if ( ec ) {
gcry_free ( tmpname ) ;
return ec ;
}
strcpy ( stpcpy ( tmpname , name ) , ".y" ) ;
ec = mpi_from_keyparam ( & y , keyparam , tmpname ) ;
if ( ec ) {
mpi_free ( x ) ;
gcry_free ( tmpname ) ;
return ec ;
}
strcpy ( stpcpy ( tmpname , name ) , ".z" ) ;
ec = mpi_from_keyparam ( & z , keyparam , tmpname ) ;
if ( ec ) {
mpi_free ( y ) ;
mpi_free ( x ) ;
gcry_free ( tmpname ) ;
return ec ;
}
if ( ! z ) z = mpi_set_ui ( NULL , 1 ) ;
if ( x && y ) point = gcry_mpi_point_snatch_set ( NULL , x , y , z ) ;
else {
mpi_free ( x ) ;
mpi_free ( y ) ;
mpi_free ( z ) ;
point = NULL ;
}
gcry_free ( tmpname ) ;
}
if ( point ) * r_a = point ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
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 ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ;
int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ;
int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) DECLARE_ASN1_FUNCTIONS ( ASN1_BMPSTRING ) int UTF8_getc ( const unsigned char * str , int len , unsigned long * val ) ;
int UTF8_putc ( unsigned char * str , int len , unsigned long value ) ;
DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , ASN1_PRINTABLE ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DIRECTORYSTRING ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DISPLAYTEXT ) DECLARE_ASN1_FUNCTIONS ( ASN1_PRINTABLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_T61STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_IA5STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_GENERALSTRING )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void jbig2_word_stream_buf_free ( Jbig2Ctx * ctx , Jbig2WordStream * ws ) {
jbig2_free ( ctx -> allocator , ws ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void default_set_param_func ( Item_param * param , uchar * * pos __attribute__ ( ( unused ) ) , ulong len __attribute__ ( ( unused ) ) ) {
param -> set_null ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int sort_get_next_record ( MI_SORT_PARAM * sort_param ) {
int searching ;
int parallel_flag ;
uint found_record , b_type , left_length ;
my_off_t pos ;
uchar * UNINIT_VAR ( to ) ;
MI_BLOCK_INFO block_info ;
SORT_INFO * sort_info = sort_param -> sort_info ;
MI_CHECK * param = sort_info -> param ;
MI_INFO * info = sort_info -> info ;
MYISAM_SHARE * share = info -> s ;
char llbuff [ 22 ] , llbuff2 [ 22 ] ;
DBUG_ENTER ( "sort_get_next_record" ) ;
if ( * killed_ptr ( param ) ) DBUG_RETURN ( 1 ) ;
switch ( share -> data_file_type ) {
case STATIC_RECORD : for ( ;
;
) {
if ( my_b_read ( & sort_param -> read_cache , sort_param -> record , share -> base . pack_reclength ) ) {
if ( sort_param -> read_cache . error ) param -> out_flag |= O_DATA_LOST ;
param -> retry_repair = 1 ;
param -> testflag |= T_RETRY_WITHOUT_QUICK ;
DBUG_RETURN ( - 1 ) ;
}
sort_param -> start_recpos = sort_param -> pos ;
if ( ! sort_param -> fix_datafile ) {
sort_param -> filepos = sort_param -> pos ;
if ( sort_param -> master ) share -> state . split ++ ;
}
sort_param -> max_pos = ( sort_param -> pos += share -> base . pack_reclength ) ;
if ( * sort_param -> record ) {
if ( sort_param -> calc_checksum ) param -> glob_crc += ( info -> checksum = mi_static_checksum ( info , sort_param -> record ) ) ;
DBUG_RETURN ( 0 ) ;
}
if ( ! sort_param -> fix_datafile && sort_param -> master ) {
info -> state -> del ++ ;
info -> state -> empty += share -> base . pack_reclength ;
}
}
case DYNAMIC_RECORD : LINT_INIT ( to ) ;
pos = sort_param -> pos ;
searching = ( sort_param -> fix_datafile && ( param -> testflag & T_EXTEND ) ) ;
parallel_flag = ( sort_param -> read_cache . file < 0 ) ? READING_NEXT : 0 ;
for ( ;
;
) {
found_record = block_info . second_read = 0 ;
left_length = 1 ;
if ( searching ) {
pos = MY_ALIGN ( pos , MI_DYN_ALIGN_SIZE ) ;
param -> testflag |= T_RETRY_WITHOUT_QUICK ;
sort_param -> start_recpos = pos ;
}
do {
if ( pos > sort_param -> max_pos ) sort_param -> max_pos = pos ;
if ( pos & ( MI_DYN_ALIGN_SIZE - 1 ) ) {
if ( ( param -> testflag & T_VERBOSE ) || searching == 0 ) mi_check_print_info ( param , "Wrong aligned block at %s" , llstr ( pos , llbuff ) ) ;
if ( searching ) goto try_next ;
}
if ( found_record && pos == param -> search_after_block ) mi_check_print_info ( param , "Block: %s used by record at %s" , llstr ( param -> search_after_block , llbuff ) , llstr ( sort_param -> start_recpos , llbuff2 ) ) ;
if ( _mi_read_cache ( & sort_param -> read_cache , ( uchar * ) block_info . header , pos , MI_BLOCK_INFO_HEADER_LENGTH , ( ! found_record ? READING_NEXT : 0 ) | parallel_flag | READING_HEADER ) ) {
if ( found_record ) {
mi_check_print_info ( param , "Can't read whole record at %s (errno: %d)" , llstr ( sort_param -> start_recpos , llbuff ) , errno ) ;
goto try_next ;
}
DBUG_RETURN ( - 1 ) ;
}
if ( searching && ! sort_param -> fix_datafile ) {
param -> error_printed = 1 ;
param -> retry_repair = 1 ;
param -> testflag |= T_RETRY_WITHOUT_QUICK ;
DBUG_RETURN ( 1 ) ;
}
b_type = _mi_get_block_info ( & block_info , - 1 , pos ) ;
if ( ( b_type & ( BLOCK_ERROR | BLOCK_FATAL_ERROR ) ) || ( ( b_type & BLOCK_FIRST ) && ( block_info . rec_len < ( uint ) share -> base . min_pack_length || block_info . rec_len > ( uint ) share -> base . max_pack_length ) ) ) {
uint i ;
if ( param -> testflag & T_VERBOSE || searching == 0 ) mi_check_print_info ( param , "Wrong bytesec: %3d-%3d-%3d at %10s;
Skipped" , block_info . header [ 0 ] , block_info . header [ 1 ] , block_info . header [ 2 ] , llstr ( pos , llbuff ) ) ;
if ( found_record ) goto try_next ;
block_info . second_read = 0 ;
searching = 1 ;
for ( i = MI_DYN_ALIGN_SIZE ;
i < MI_BLOCK_INFO_HEADER_LENGTH ;
i += MI_DYN_ALIGN_SIZE ) if ( block_info . header [ i ] >= 1 && block_info . header [ i ] <= MI_MAX_DYN_HEADER_BYTE ) break ;
pos += ( ulong ) i ;
sort_param -> start_recpos = pos ;
continue ;
}
if ( b_type & BLOCK_DELETED ) {
my_bool error = 0 ;
if ( block_info . block_len + ( uint ) ( block_info . filepos - pos ) < share -> base . min_block_length ) {
if ( ! searching ) mi_check_print_info ( param , "Deleted block with impossible length %u at %s" , block_info . block_len , llstr ( pos , llbuff ) ) ;
error = 1 ;
}
else {
if ( ( block_info . next_filepos != HA_OFFSET_ERROR && block_info . next_filepos >= info -> state -> data_file_length ) || ( block_info . prev_filepos != HA_OFFSET_ERROR && block_info . prev_filepos >= info -> state -> data_file_length ) ) {
if ( ! searching ) mi_check_print_info ( param , "Delete link points outside datafile at %s" , llstr ( pos , llbuff ) ) ;
error = 1 ;
}
}
if ( error ) {
if ( found_record ) goto try_next ;
searching = 1 ;
pos += MI_DYN_ALIGN_SIZE ;
sort_param -> start_recpos = pos ;
block_info . second_read = 0 ;
continue ;
}
}
else {
if ( block_info . block_len + ( uint ) ( block_info . filepos - pos ) < share -> base . min_block_length || block_info . block_len > ( uint ) share -> base . max_pack_length + MI_SPLIT_LENGTH ) {
if ( ! searching ) mi_check_print_info ( param , "Found block with impossible length %u at %s;
Skipped" , block_info . block_len + ( uint ) ( block_info . filepos - pos ) , llstr ( pos , llbuff ) ) ;
if ( found_record ) goto try_next ;
searching = 1 ;
pos += MI_DYN_ALIGN_SIZE ;
sort_param -> start_recpos = pos ;
block_info . second_read = 0 ;
continue ;
}
}
if ( b_type & ( BLOCK_DELETED | BLOCK_SYNC_ERROR ) ) {
if ( ! sort_param -> fix_datafile && sort_param -> master && ( b_type & BLOCK_DELETED ) ) {
info -> state -> empty += block_info . block_len ;
info -> state -> del ++ ;
share -> state . split ++ ;
}
if ( found_record ) goto try_next ;
if ( searching ) {
pos += MI_DYN_ALIGN_SIZE ;
sort_param -> start_recpos = pos ;
}
else pos = block_info . filepos + block_info . block_len ;
block_info . second_read = 0 ;
continue ;
}
if ( ! sort_param -> fix_datafile && sort_param -> master ) share -> state . split ++ ;
if ( ! found_record ++ ) {
sort_param -> find_length = left_length = block_info . rec_len ;
sort_param -> start_recpos = pos ;
if ( ! sort_param -> fix_datafile ) sort_param -> filepos = sort_param -> start_recpos ;
if ( sort_param -> fix_datafile && ( param -> testflag & T_EXTEND ) ) sort_param -> pos = block_info . filepos + 1 ;
else sort_param -> pos = block_info . filepos + block_info . block_len ;
if ( share -> base . blobs ) {
if ( ! ( to = mi_alloc_rec_buff ( info , block_info . rec_len , & ( sort_param -> rec_buff ) ) ) ) {
if ( param -> max_record_length >= block_info . rec_len ) {
mi_check_print_error ( param , "Not enough memory for blob at %s (need %lu)" , llstr ( sort_param -> start_recpos , llbuff ) , ( ulong ) block_info . rec_len ) ;
DBUG_RETURN ( 1 ) ;
}
else {
mi_check_print_info ( param , "Not enough memory for blob at %s (need %lu);
Row skipped" , llstr ( sort_param -> start_recpos , llbuff ) , ( ulong ) block_info . rec_len ) ;
goto try_next ;
}
}
}
else to = sort_param -> rec_buff ;
}
if ( left_length < block_info . data_len || ! block_info . data_len ) {
mi_check_print_info ( param , "Found block with too small length at %s;
Skipped" , llstr ( sort_param -> start_recpos , llbuff ) ) ;
goto try_next ;
}
if ( block_info . filepos + block_info . data_len > sort_param -> read_cache . end_of_file ) {
mi_check_print_info ( param , "Found block that points outside data file at %s" , llstr ( sort_param -> start_recpos , llbuff ) ) ;
goto try_next ;
}
{
uint header_len = ( uint ) ( block_info . filepos - pos ) ;
uint prefetch_len = ( MI_BLOCK_INFO_HEADER_LENGTH - header_len ) ;
if ( prefetch_len > block_info . data_len ) prefetch_len = block_info . data_len ;
if ( prefetch_len ) {
memcpy ( to , block_info . header + header_len , prefetch_len ) ;
block_info . filepos += prefetch_len ;
block_info . data_len -= prefetch_len ;
left_length -= prefetch_len ;
to += prefetch_len ;
}
}
if ( block_info . data_len && _mi_read_cache ( & sort_param -> read_cache , to , block_info . filepos , block_info . data_len , ( found_record == 1 ? READING_NEXT : 0 ) | parallel_flag ) ) {
mi_check_print_info ( param , "Read error for block at: %s (error: %d);
Skipped" , llstr ( block_info . filepos , llbuff ) , my_errno ) ;
goto try_next ;
}
left_length -= block_info . data_len ;
to += block_info . data_len ;
pos = block_info . next_filepos ;
if ( pos == HA_OFFSET_ERROR && left_length ) {
mi_check_print_info ( param , "Wrong block with wrong total length starting at %s" , llstr ( sort_param -> start_recpos , llbuff ) ) ;
goto try_next ;
}
if ( pos + MI_BLOCK_INFO_HEADER_LENGTH > sort_param -> read_cache . end_of_file ) {
mi_check_print_info ( param , "Found link that points at %s (outside data file) at %s" , llstr ( pos , llbuff2 ) , llstr ( sort_param -> start_recpos , llbuff ) ) ;
goto try_next ;
}
}
while ( left_length ) ;
if ( _mi_rec_unpack ( info , sort_param -> record , sort_param -> rec_buff , sort_param -> find_length ) != MY_FILE_ERROR ) {
if ( sort_param -> read_cache . error < 0 ) DBUG_RETURN ( 1 ) ;
if ( sort_param -> calc_checksum ) info -> checksum = mi_checksum ( info , sort_param -> record ) ;
if ( ( param -> testflag & ( T_EXTEND | T_REP ) ) || searching ) {
if ( _mi_rec_check ( info , sort_param -> record , sort_param -> rec_buff , sort_param -> find_length , ( param -> testflag & T_QUICK ) && sort_param -> calc_checksum && test ( info -> s -> calc_checksum ) ) ) {
mi_check_print_info ( param , "Found wrong packed record at %s" , llstr ( sort_param -> start_recpos , llbuff ) ) ;
goto try_next ;
}
}
if ( sort_param -> calc_checksum ) param -> glob_crc += info -> checksum ;
DBUG_RETURN ( 0 ) ;
}
if ( ! searching ) mi_check_print_info ( param , "Key %d - Found wrong stored record at %s" , sort_param -> key + 1 , llstr ( sort_param -> start_recpos , llbuff ) ) ;
try_next : pos = ( sort_param -> start_recpos += MI_DYN_ALIGN_SIZE ) ;
searching = 1 ;
}
case COMPRESSED_RECORD : for ( searching = 0 ;
;
searching = 1 , sort_param -> pos ++ ) {
if ( _mi_read_cache ( & sort_param -> read_cache , ( uchar * ) block_info . header , sort_param -> pos , share -> pack . ref_length , READING_NEXT ) ) DBUG_RETURN ( - 1 ) ;
if ( searching && ! sort_param -> fix_datafile ) {
param -> error_printed = 1 ;
param -> retry_repair = 1 ;
param -> testflag |= T_RETRY_WITHOUT_QUICK ;
DBUG_RETURN ( 1 ) ;
}
sort_param -> start_recpos = sort_param -> pos ;
if ( _mi_pack_get_block_info ( info , & sort_param -> bit_buff , & block_info , & sort_param -> rec_buff , - 1 , sort_param -> pos ) ) DBUG_RETURN ( - 1 ) ;
if ( ! block_info . rec_len && sort_param -> pos + MEMMAP_EXTRA_MARGIN == sort_param -> read_cache . end_of_file ) DBUG_RETURN ( - 1 ) ;
if ( block_info . rec_len < ( uint ) share -> min_pack_length || block_info . rec_len > ( uint ) share -> max_pack_length ) {
if ( ! searching ) mi_check_print_info ( param , "Found block with wrong recordlength: %d at %s\n" , block_info . rec_len , llstr ( sort_param -> pos , llbuff ) ) ;
continue ;
}
if ( _mi_read_cache ( & sort_param -> read_cache , ( uchar * ) sort_param -> rec_buff , block_info . filepos , block_info . rec_len , READING_NEXT ) ) {
if ( ! searching ) mi_check_print_info ( param , "Couldn't read whole record from %s" , llstr ( sort_param -> pos , llbuff ) ) ;
continue ;
}
if ( _mi_pack_rec_unpack ( info , & sort_param -> bit_buff , sort_param -> record , sort_param -> rec_buff , block_info . rec_len ) ) {
if ( ! searching ) mi_check_print_info ( param , "Found wrong record at %s" , llstr ( sort_param -> pos , llbuff ) ) ;
continue ;
}
if ( ! sort_param -> fix_datafile ) {
sort_param -> filepos = sort_param -> pos ;
if ( sort_param -> master ) share -> state . split ++ ;
}
sort_param -> max_pos = ( sort_param -> pos = block_info . filepos + block_info . rec_len ) ;
info -> packed_length = block_info . rec_len ;
if ( sort_param -> calc_checksum ) param -> glob_crc += ( info -> checksum = mi_checksum ( info , sort_param -> record ) ) ;
DBUG_RETURN ( 0 ) ;
}
case BLOCK_RECORD : assert ( 0 ) ;
}
DBUG_RETURN ( 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int add_recent_loose ( const unsigned char * sha1 , const char * path , void * data ) {
struct stat st ;
struct object * obj = lookup_object ( sha1 ) ;
if ( obj && obj -> flags & SEEN ) return 0 ;
if ( stat ( path , & st ) < 0 ) {
if ( errno == ENOENT ) return 0 ;
return error ( "unable to stat %s: %s" , sha1_to_hex ( sha1 ) , strerror ( errno ) ) ;
}
add_recent_object ( sha1 , st . st_mtime , data ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_rv34_decode_frame ( AVCodecContext * avctx , void * data , int * got_picture_ptr , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
RV34DecContext * r = avctx -> priv_data ;
MpegEncContext * s = & r -> s ;
AVFrame * pict = data ;
SliceInfo si ;
int i ;
int slice_count ;
const uint8_t * slices_hdr = NULL ;
int last = 0 ;
if ( buf_size == 0 ) {
if ( s -> low_delay == 0 && s -> next_picture_ptr ) {
* pict = s -> next_picture_ptr -> f ;
s -> next_picture_ptr = NULL ;
* got_picture_ptr = 1 ;
}
return 0 ;
}
if ( ! avctx -> slice_count ) {
slice_count = ( * buf ++ ) + 1 ;
slices_hdr = buf + 4 ;
buf += 8 * slice_count ;
buf_size -= 1 + 8 * slice_count ;
}
else slice_count = avctx -> slice_count ;
if ( get_slice_offset ( avctx , slices_hdr , 0 ) < 0 || get_slice_offset ( avctx , slices_hdr , 0 ) > buf_size ) {
av_log ( avctx , AV_LOG_ERROR , "Slice offset is invalid\n" ) ;
return AVERROR_INVALIDDATA ;
}
init_get_bits ( & s -> gb , buf + get_slice_offset ( avctx , slices_hdr , 0 ) , ( buf_size - get_slice_offset ( avctx , slices_hdr , 0 ) ) * 8 ) ;
if ( r -> parse_slice_header ( r , & r -> s . gb , & si ) < 0 || si . start ) {
av_log ( avctx , AV_LOG_ERROR , "First slice header is incorrect\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( ( ! s -> last_picture_ptr || ! s -> last_picture_ptr -> f . data [ 0 ] ) && si . type == AV_PICTURE_TYPE_B ) {
av_log ( avctx , AV_LOG_ERROR , "Invalid decoder state: B-frame without " "reference data.\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( ( avctx -> skip_frame >= AVDISCARD_NONREF && si . type == AV_PICTURE_TYPE_B ) || ( avctx -> skip_frame >= AVDISCARD_NONKEY && si . type != AV_PICTURE_TYPE_I ) || avctx -> skip_frame >= AVDISCARD_ALL ) return avpkt -> size ;
if ( si . start == 0 ) {
if ( s -> mb_num_left > 0 ) {
av_log ( avctx , AV_LOG_ERROR , "New frame but still %d MB left." , s -> mb_num_left ) ;
ff_er_frame_end ( & s -> er ) ;
ff_MPV_frame_end ( s ) ;
}
if ( s -> width != si . width || s -> height != si . height ) {
int err ;
av_log ( s -> avctx , AV_LOG_WARNING , "Changing dimensions to %dx%d\n" , si . width , si . height ) ;
s -> width = si . width ;
s -> height = si . height ;
avcodec_set_dimensions ( s -> avctx , s -> width , s -> height ) ;
if ( ( err = ff_MPV_common_frame_size_change ( s ) ) < 0 ) return err ;
if ( ( err = rv34_decoder_realloc ( r ) ) < 0 ) return err ;
}
s -> pict_type = si . type ? si . type : AV_PICTURE_TYPE_I ;
if ( ff_MPV_frame_start ( s , s -> avctx ) < 0 ) return - 1 ;
ff_mpeg_er_frame_start ( s ) ;
if ( ! r -> tmp_b_block_base ) {
int i ;
r -> tmp_b_block_base = av_malloc ( s -> linesize * 48 ) ;
for ( i = 0 ;
i < 2 ;
i ++ ) r -> tmp_b_block_y [ i ] = r -> tmp_b_block_base + i * 16 * s -> linesize ;
for ( i = 0 ;
i < 4 ;
i ++ ) r -> tmp_b_block_uv [ i ] = r -> tmp_b_block_base + 32 * s -> linesize + ( i >> 1 ) * 8 * s -> uvlinesize + ( i & 1 ) * 16 ;
}
r -> cur_pts = si . pts ;
if ( s -> pict_type != AV_PICTURE_TYPE_B ) {
r -> last_pts = r -> next_pts ;
r -> next_pts = r -> cur_pts ;
}
else {
int refdist = GET_PTS_DIFF ( r -> next_pts , r -> last_pts ) ;
int dist0 = GET_PTS_DIFF ( r -> cur_pts , r -> last_pts ) ;
int dist1 = GET_PTS_DIFF ( r -> next_pts , r -> cur_pts ) ;
if ( ! refdist ) {
r -> mv_weight1 = r -> mv_weight2 = r -> weight1 = r -> weight2 = 8192 ;
r -> scaled_weight = 0 ;
}
else {
r -> mv_weight1 = ( dist0 << 14 ) / refdist ;
r -> mv_weight2 = ( dist1 << 14 ) / refdist ;
if ( ( r -> mv_weight1 | r -> mv_weight2 ) & 511 ) {
r -> weight1 = r -> mv_weight1 ;
r -> weight2 = r -> mv_weight2 ;
r -> scaled_weight = 0 ;
}
else {
r -> weight1 = r -> mv_weight1 >> 9 ;
r -> weight2 = r -> mv_weight2 >> 9 ;
r -> scaled_weight = 1 ;
}
}
}
s -> mb_x = s -> mb_y = 0 ;
ff_thread_finish_setup ( s -> avctx ) ;
}
else if ( HAVE_THREADS && ( s -> avctx -> active_thread_type & FF_THREAD_FRAME ) ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Decoder needs full frames in frame " "multithreading mode (start MB is %d).\n" , si . start ) ;
return AVERROR_INVALIDDATA ;
}
for ( i = 0 ;
i < slice_count ;
i ++ ) {
int offset = get_slice_offset ( avctx , slices_hdr , i ) ;
int size ;
if ( i + 1 == slice_count ) size = buf_size - offset ;
else size = get_slice_offset ( avctx , slices_hdr , i + 1 ) - offset ;
if ( offset < 0 || offset > buf_size ) {
av_log ( avctx , AV_LOG_ERROR , "Slice offset is invalid\n" ) ;
break ;
}
r -> si . end = s -> mb_width * s -> mb_height ;
s -> mb_num_left = r -> s . mb_x + r -> s . mb_y * r -> s . mb_width - r -> si . start ;
if ( i + 1 < slice_count ) {
if ( get_slice_offset ( avctx , slices_hdr , i + 1 ) < 0 || get_slice_offset ( avctx , slices_hdr , i + 1 ) > buf_size ) {
av_log ( avctx , AV_LOG_ERROR , "Slice offset is invalid\n" ) ;
break ;
}
init_get_bits ( & s -> gb , buf + get_slice_offset ( avctx , slices_hdr , i + 1 ) , ( buf_size - get_slice_offset ( avctx , slices_hdr , i + 1 ) ) * 8 ) ;
if ( r -> parse_slice_header ( r , & r -> s . gb , & si ) < 0 ) {
if ( i + 2 < slice_count ) size = get_slice_offset ( avctx , slices_hdr , i + 2 ) - offset ;
else size = buf_size - offset ;
}
else r -> si . end = si . start ;
}
if ( size < 0 || size > buf_size - offset ) {
av_log ( avctx , AV_LOG_ERROR , "Slice size is invalid\n" ) ;
break ;
}
last = rv34_decode_slice ( r , r -> si . end , buf + offset , size ) ;
if ( last ) break ;
}
if ( s -> current_picture_ptr ) {
if ( last ) {
if ( r -> loop_filter ) r -> loop_filter ( r , s -> mb_height - 1 ) ;
* got_picture_ptr = finish_frame ( avctx , pict ) ;
}
else if ( HAVE_THREADS && ( s -> avctx -> active_thread_type & FF_THREAD_FRAME ) ) {
av_log ( avctx , AV_LOG_INFO , "marking unfished frame as finished\n" ) ;
ff_er_frame_end ( & s -> er ) ;
ff_MPV_frame_end ( s ) ;
s -> mb_num_left = 0 ;
ff_thread_report_progress ( & s -> current_picture_ptr -> f , INT_MAX , 0 ) ;
return AVERROR_INVALIDDATA ;
}
}
return avpkt -> size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint32 dissect_netb_receive_outstanding ( tvbuff_t * tvb , packet_info * pinfo _U_ , int offset , proto_tree * tree ) {
nb_data2 ( hf_netb_num_data_bytes_accepted , tvb , offset , tree ) ;
nb_remote_session ( tvb , offset , tree ) ;
nb_local_session ( tvb , offset , tree ) ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void HCLComposite ( const MagickRealType hue , const MagickRealType chroma , const MagickRealType luma , MagickRealType * red , MagickRealType * green , MagickRealType * blue ) {
MagickRealType b , c , g , h , m , r , x ;
assert ( red != ( MagickRealType * ) NULL ) ;
assert ( green != ( MagickRealType * ) NULL ) ;
assert ( blue != ( MagickRealType * ) NULL ) ;
h = 6.0 * hue ;
c = chroma ;
x = c * ( 1.0 - fabs ( fmod ( h , 2.0 ) - 1.0 ) ) ;
r = 0.0 ;
g = 0.0 ;
b = 0.0 ;
if ( ( 0.0 <= h ) && ( h < 1.0 ) ) {
r = c ;
g = x ;
}
else if ( ( 1.0 <= h ) && ( h < 2.0 ) ) {
r = x ;
g = c ;
}
else if ( ( 2.0 <= h ) && ( h < 3.0 ) ) {
g = c ;
b = x ;
}
else if ( ( 3.0 <= h ) && ( h < 4.0 ) ) {
g = x ;
b = c ;
}
else if ( ( 4.0 <= h ) && ( h < 5.0 ) ) {
r = x ;
b = c ;
}
else if ( ( 5.0 <= h ) && ( h < 6.0 ) ) {
r = c ;
b = x ;
}
m = luma - ( 0.298839 * r + 0.586811 * g + 0.114350 * b ) ;
* red = QuantumRange * ( r + m ) ;
* green = QuantumRange * ( g + m ) ;
* blue = QuantumRange * ( b + m ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_pvfs_pdu ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
dissect_pvfs_common ( tvb , pinfo , tree , FALSE ) ;
return tvb_reported_length ( tvb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void mspack_destroy_kwaj_decompressor ( struct mskwaj_decompressor * base ) {
struct mskwaj_decompressor_p * self = ( struct mskwaj_decompressor_p * ) base ;
if ( self ) {
struct mspack_system * sys = self -> system ;
sys -> free ( self ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int gdev_pdf_put_params ( gx_device * dev , gs_param_list * plist ) {
int code ;
gx_device_pdf * pdev = ( gx_device_pdf * ) dev ;
gs_memory_t * mem = gs_memory_stable ( pdev -> memory ) ;
gx_device_pdf * save_dev = gs_malloc ( mem , sizeof ( gx_device_pdf ) , 1 , "saved gx_device_pdf" ) ;
if ( ! save_dev ) return_error ( gs_error_VMerror ) ;
memcpy ( save_dev , pdev , sizeof ( gx_device_pdf ) ) ;
code = gdev_pdf_put_params_impl ( dev , save_dev , plist ) ;
gs_free ( mem , save_dev , sizeof ( gx_device_pdf ) , 1 , "saved gx_device_pdf" ) ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int grid_fit ( gx_device_spot_analyzer * padev , gx_path * path , gs_font_type42 * pfont , const gs_log2_scale_point * pscale , gx_ttfExport * e , ttfOutliner * o ) {
gs_gstate gs_stub ;
gx_fill_params params ;
gx_device_color devc_stub ;
int code ;
t1_hinter_aux h ;
gs_matrix m , fm , fmb ;
gs_matrix_fixed ctm_temp ;
bool atp = gs_currentaligntopixels ( pfont -> dir ) ;
int FontType = 1 ;
fixed sbx = 0 , sby = 0 ;
double scale = 1.0 / o -> pFont -> nUnitsPerEm ;
gs_fixed_rect bbox ;
m . xx = o -> post_transform . a ;
m . xy = o -> post_transform . b ;
m . yx = o -> post_transform . c ;
m . yy = o -> post_transform . d ;
m . tx = o -> post_transform . tx ;
m . ty = o -> post_transform . ty ;
code = gs_matrix_fixed_from_matrix ( & ctm_temp , & m ) ;
if ( code < 0 ) return code ;
code = gs_matrix_scale ( & pfont -> FontMatrix , scale , scale , & fm ) ;
if ( code < 0 ) return code ;
code = gs_matrix_scale ( & pfont -> base -> FontMatrix , scale , scale , & fmb ) ;
if ( code < 0 ) return code ;
t1_hinter__init ( & h . super , path ) ;
code = t1_hinter__set_mapping ( & h . super , & ctm_temp , & fm , & fmb , pscale -> x , pscale -> x , 0 , 0 , ctm_temp . tx_fixed , ctm_temp . ty_fixed , atp ) ;
if ( code < 0 ) return code ;
if ( ! h . super . disable_hinting ) {
o -> post_transform . a = o -> post_transform . d = 1 ;
o -> post_transform . b = o -> post_transform . c = 0 ;
o -> post_transform . tx = o -> post_transform . ty = 0 ;
ttfOutliner__DrawGlyphOutline ( o ) ;
if ( e -> error ) return e -> error ;
code = t1_hinter__set_font42_data ( & h . super , FontType , & pfont -> data , false ) ;
if ( code < 0 ) return code ;
code = t1_hinter__sbw ( & h . super , sbx , sby , e -> w . x , e -> w . y ) ;
if ( code < 0 ) return code ;
code = gx_path_bbox ( path , & bbox ) ;
if ( code < 0 ) return code ;
memset ( & gs_stub , 0 , sizeof ( gs_stub ) ) ;
gs_stub . memory = padev -> memory ;
set_nonclient_dev_color ( & devc_stub , 1 ) ;
params . rule = gx_rule_winding_number ;
params . adjust . x = params . adjust . y = 0 ;
params . flatness = fixed2float ( max ( bbox . q . x - bbox . p . x , bbox . q . y - bbox . p . y ) ) / 100.0 ;
for ( h . transpose = 0 ;
h . transpose < 2 ;
h . transpose ++ ) {
h . midx = ( padev -> xmin + padev -> xmax ) / 2 ;
if ( h . transpose ) transpose_path ( path ) ;
gx_san_begin ( padev ) ;
code = dev_proc ( padev , fill_path ) ( ( gx_device * ) padev , & gs_stub , path , & params , & devc_stub , NULL ) ;
gx_san_end ( padev ) ;
if ( code >= 0 ) code = gx_san_generate_stems ( padev , OVERALL_HINT && h . transpose , & h , stem_hint_handler ) ;
if ( h . transpose ) transpose_path ( path ) ;
if ( code < 0 ) return code ;
}
code = path_to_hinter ( & h . super , path ) ;
if ( code < 0 ) return code ;
code = gx_path_new ( path ) ;
if ( code < 0 ) return code ;
code = t1_hinter__endglyph ( & h . super ) ;
}
else {
ttfOutliner__DrawGlyphOutline ( o ) ;
if ( e -> error ) return e -> error ;
}
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static zend_object_value spl_filesystem_object_new ( zend_class_entry * class_type TSRMLS_DC ) {
return spl_filesystem_object_new_ex ( class_type , NULL TSRMLS_CC ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void convolve_horiz ( const uint8_t * src , ptrdiff_t src_stride , uint8_t * dst , ptrdiff_t dst_stride , const InterpKernel * x_filters , int x0_q4 , int x_step_q4 , int w , int h ) {
int x , y ;
src -= SUBPEL_TAPS / 2 - 1 ;
for ( y = 0 ;
y < h ;
++ y ) {
int x_q4 = x0_q4 ;
for ( x = 0 ;
x < w ;
++ x ) {
const uint8_t * const src_x = & src [ x_q4 >> SUBPEL_BITS ] ;
const int16_t * const x_filter = x_filters [ x_q4 & SUBPEL_MASK ] ;
int k , sum = 0 ;
for ( k = 0 ;
k < SUBPEL_TAPS ;
++ k ) sum += src_x [ k ] * x_filter [ k ] ;
dst [ x ] = clip_pixel ( ROUND_POWER_OF_TWO ( sum , FILTER_BITS ) ) ;
x_q4 += x_step_q4 ;
}
src += src_stride ;
dst += dst_stride ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void do_device_del ( Monitor * mon , const QDict * qdict ) {
const char * id = qdict_get_str ( qdict , "id" ) ;
DeviceState * dev ;
dev = qdev_find_recursive ( main_system_bus , id ) ;
if ( NULL == dev ) {
qemu_error ( "Device '%s' not found\n" , id ) ;
return ;
}
qdev_unplug ( dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void apply_pitch_filters ( QCELPContext * q , float * cdn_vector ) {
int i ;
const float * v_synthesis_filtered , * v_pre_filtered ;
if ( q -> bitrate >= RATE_HALF || q -> bitrate == SILENCE || ( q -> bitrate == I_F_Q && ( q -> prev_bitrate >= RATE_HALF ) ) ) {
if ( q -> bitrate >= RATE_HALF ) {
for ( i = 0 ;
i < 4 ;
i ++ ) {
q -> pitch_gain [ i ] = q -> frame . plag [ i ] ? ( q -> frame . pgain [ i ] + 1 ) * 0.25 : 0.0 ;
q -> pitch_lag [ i ] = q -> frame . plag [ i ] + 16 ;
}
}
else {
float max_pitch_gain ;
if ( q -> bitrate == I_F_Q ) {
if ( q -> erasure_count < 3 ) max_pitch_gain = 0.9 - 0.3 * ( q -> erasure_count - 1 ) ;
else max_pitch_gain = 0.0 ;
}
else {
assert ( q -> bitrate == SILENCE ) ;
max_pitch_gain = 1.0 ;
}
for ( i = 0 ;
i < 4 ;
i ++ ) q -> pitch_gain [ i ] = FFMIN ( q -> pitch_gain [ i ] , max_pitch_gain ) ;
memset ( q -> frame . pfrac , 0 , sizeof ( q -> frame . pfrac ) ) ;
}
v_synthesis_filtered = do_pitchfilter ( q -> pitch_synthesis_filter_mem , cdn_vector , q -> pitch_gain , q -> pitch_lag , q -> frame . pfrac ) ;
for ( i = 0 ;
i < 4 ;
i ++ ) q -> pitch_gain [ i ] = 0.5 * FFMIN ( q -> pitch_gain [ i ] , 1.0 ) ;
v_pre_filtered = do_pitchfilter ( q -> pitch_pre_filter_mem , v_synthesis_filtered , q -> pitch_gain , q -> pitch_lag , q -> frame . pfrac ) ;
apply_gain_ctrl ( cdn_vector , v_synthesis_filtered , v_pre_filtered ) ;
}
else {
memcpy ( q -> pitch_synthesis_filter_mem , cdn_vector + 17 , 143 * sizeof ( float ) ) ;
memcpy ( q -> pitch_pre_filter_mem , cdn_vector + 17 , 143 * sizeof ( float ) ) ;
memset ( q -> pitch_gain , 0 , sizeof ( q -> pitch_gain ) ) ;
memset ( q -> pitch_lag , 0 , sizeof ( q -> pitch_lag ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int getSingletonPos ( const char * str ) {
int result = - 1 ;
int i = 0 ;
int len = 0 ;
if ( str && ( ( len = strlen ( str ) ) > 0 ) ) {
for ( i = 0 ;
i < len ;
i ++ ) {
if ( isIDSeparator ( * ( str + i ) ) ) {
if ( i == 1 ) {
result = 0 ;
break ;
}
else {
if ( isIDSeparator ( * ( str + i + 2 ) ) ) {
result = i + 1 ;
break ;
}
}
}
}
}
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void schedule_call_ready_callbacks ( NautilusDirectory * directory ) {
if ( directory -> details -> call_ready_idle_id == 0 ) {
directory -> details -> call_ready_idle_id = g_idle_add ( call_ready_callbacks_at_idle , directory ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , ExtractSearchTermsFromNonUTF8URL ) {
TemplateURLData data ;
data . SetURL ( "http://windows-1251.ru/?q={
searchTerms}
" ) ;
data . alternate_urls . push_back ( "http://windows-1251.ru/#q={
searchTerms}
" ) ;
data . alternate_urls . push_back ( "http://windows-1251.ru/path/{
searchTerms}
" ) ;
data . input_encodings . push_back ( "windows-1251" ) ;
TemplateURL url ( data ) ;
base : : string16 result ;
EXPECT_TRUE ( url . ExtractSearchTermsFromURL ( GURL ( "http://windows-1251.ru/?q=%C7%E4%F0%E0%E2%F1%F2%E2%F3%E9%2C+" "%EC%E8%F0!" ) , search_terms_data_ , & result ) ) ;
EXPECT_EQ ( base : : WideToUTF16 ( L"\x0417\x0434\x0440\x0430\x0432\x0441\x0442\x0432\x0443\x0439, " L"\x043C\x0438\x0440!" ) , result ) ;
EXPECT_TRUE ( url . ExtractSearchTermsFromURL ( GURL ( "http://windows-1251.ru/#q=%E4%E2%E0+%F1%EB%EE%E2%E0" ) , search_terms_data_ , & result ) ) ;
EXPECT_EQ ( base : : WideToUTF16 ( L"\x0434\x0432\x0430 \x0441\x043B\x043E\x0432\x0430" ) , result ) ;
EXPECT_TRUE ( url . ExtractSearchTermsFromURL ( GURL ( "http://windows-1251.ru/path/%E1%F3%EA%E2%FB%20%C0%20%E8%20A" ) , search_terms_data_ , & result ) ) ;
EXPECT_EQ ( base : : WideToUTF16 ( L"\x0431\x0443\x043A\x0432\x044B \x0410 \x0438 A" ) , result ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
hidden_proto ( _nss_dns_gethostbyname3_r ) enum nss_status _nss_dns_gethostbyname3_r ( const char * name , int af , struct hostent * result , char * buffer , size_t buflen , int * errnop , int * h_errnop , int32_t * ttlp , char * * canonp ) {
union {
querybuf * buf ;
u_char * ptr ;
}
host_buffer ;
querybuf * orig_host_buffer ;
char tmp [ NS_MAXDNAME ] ;
int size , type , n ;
const char * cp ;
int map = 0 ;
int olderr = errno ;
enum nss_status status ;
if ( __res_maybe_init ( & _res , 0 ) == - 1 ) return NSS_STATUS_UNAVAIL ;
switch ( af ) {
case AF_INET : size = INADDRSZ ;
type = T_A ;
break ;
case AF_INET6 : size = IN6ADDRSZ ;
type = T_AAAA ;
break ;
default : * h_errnop = NO_DATA ;
* errnop = EAFNOSUPPORT ;
return NSS_STATUS_UNAVAIL ;
}
result -> h_addrtype = af ;
result -> h_length = size ;
if ( strchr ( name , '.' ) == NULL && ( cp = res_hostalias ( & _res , name , tmp , sizeof ( tmp ) ) ) != NULL ) name = cp ;
host_buffer . buf = orig_host_buffer = ( querybuf * ) alloca ( 1024 ) ;
n = __libc_res_nsearch ( & _res , name , C_IN , type , host_buffer . buf -> buf , 1024 , & host_buffer . ptr , NULL , NULL , NULL , NULL ) ;
if ( n < 0 ) {
switch ( errno ) {
case ESRCH : status = NSS_STATUS_TRYAGAIN ;
h_errno = TRY_AGAIN ;
break ;
case EMFILE : case ENFILE : h_errno = NETDB_INTERNAL ;
case ECONNREFUSED : case ETIMEDOUT : status = NSS_STATUS_UNAVAIL ;
break ;
default : status = NSS_STATUS_NOTFOUND ;
break ;
}
* h_errnop = h_errno ;
if ( h_errno == TRY_AGAIN ) * errnop = EAGAIN ;
else __set_errno ( olderr ) ;
if ( af == AF_INET6 && ( _res . options & RES_USE_INET6 ) ) n = __libc_res_nsearch ( & _res , name , C_IN , T_A , host_buffer . buf -> buf , host_buffer . buf != orig_host_buffer ? MAXPACKET : 1024 , & host_buffer . ptr , NULL , NULL , NULL , NULL ) ;
if ( n < 0 ) {
if ( host_buffer . buf != orig_host_buffer ) free ( host_buffer . buf ) ;
return status ;
}
map = 1 ;
result -> h_addrtype = AF_INET ;
result -> h_length = INADDRSZ ;
}
status = getanswer_r ( host_buffer . buf , n , name , type , result , buffer , buflen , errnop , h_errnop , map , ttlp , canonp ) ;
if ( host_buffer . buf != orig_host_buffer ) free ( host_buffer . buf ) ;
return status ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int write_VD_boot_record ( struct archive_write * a ) {
struct iso9660 * iso9660 ;
unsigned char * bp ;
iso9660 = a -> format_data ;
bp = wb_buffptr ( a ) - 1 ;
set_VD_bp ( bp , VDT_BOOT_RECORD , 1 ) ;
memcpy ( bp + 8 , "EL TORITO SPECIFICATION" , 23 ) ;
set_unused_field_bp ( bp , 8 + 23 , 39 ) ;
set_unused_field_bp ( bp , 40 , 71 ) ;
set_num_731 ( bp + 72 , iso9660 -> el_torito . catalog -> file -> content . location ) ;
set_unused_field_bp ( bp , 76 , LOGICAL_BLOCK_SIZE ) ;
return ( wb_consume ( a , LOGICAL_BLOCK_SIZE ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_RemoteMCResponse ( 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_RemoteMCResponse , RemoteMCResponse_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void configure_buffer_updates ( VP9_COMP * cpi ) {
TWO_PASS * const twopass = & cpi -> twopass ;
cpi -> rc . is_src_frame_alt_ref = 0 ;
switch ( twopass -> gf_group . update_type [ twopass -> gf_group . index ] ) {
case KF_UPDATE : cpi -> refresh_last_frame = 1 ;
cpi -> refresh_golden_frame = 1 ;
cpi -> refresh_alt_ref_frame = 1 ;
break ;
case LF_UPDATE : cpi -> refresh_last_frame = 1 ;
cpi -> refresh_golden_frame = 0 ;
cpi -> refresh_alt_ref_frame = 0 ;
break ;
case GF_UPDATE : cpi -> refresh_last_frame = 1 ;
cpi -> refresh_golden_frame = 1 ;
cpi -> refresh_alt_ref_frame = 0 ;
break ;
case OVERLAY_UPDATE : cpi -> refresh_last_frame = 0 ;
cpi -> refresh_golden_frame = 1 ;
cpi -> refresh_alt_ref_frame = 0 ;
cpi -> rc . is_src_frame_alt_ref = 1 ;
break ;
case ARF_UPDATE : cpi -> refresh_last_frame = 0 ;
cpi -> refresh_golden_frame = 0 ;
cpi -> refresh_alt_ref_frame = 1 ;
break ;
default : assert ( 0 ) ;
break ;
}
if ( is_two_pass_svc ( cpi ) ) {
if ( cpi -> svc . temporal_layer_id > 0 ) {
cpi -> refresh_last_frame = 0 ;
cpi -> refresh_golden_frame = 0 ;
}
if ( cpi -> svc . layer_context [ cpi -> svc . spatial_layer_id ] . gold_ref_idx < 0 ) cpi -> refresh_golden_frame = 0 ;
if ( cpi -> alt_ref_source == NULL ) cpi -> refresh_alt_ref_frame = 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
virLogFilterPtr virLogFilterNew ( const char * match , virLogPriority priority , unsigned int flags ) {
virLogFilterPtr ret = NULL ;
char * mdup = NULL ;
virCheckFlags ( VIR_LOG_STACK_TRACE , NULL ) ;
if ( priority < VIR_LOG_DEBUG || priority > VIR_LOG_ERROR ) {
virReportError ( VIR_ERR_INVALID_ARG , _ ( "Invalid log priority %d" ) , priority ) ;
return NULL ;
}
if ( VIR_STRDUP_QUIET ( mdup , match ) < 0 ) return NULL ;
if ( VIR_ALLOC_QUIET ( ret ) < 0 ) {
VIR_FREE ( mdup ) ;
return NULL ;
}
ret -> match = mdup ;
ret -> priority = priority ;
ret -> flags = flags ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_pvfs_ds_keyval ( tvbuff_t * tvb , proto_tree * tree , int offset ) {
offset = dissect_pvfs_string ( tvb , tree , hf_pvfs_attribute_key , offset , NULL ) ;
offset = dissect_pvfs_string ( tvb , tree , hf_pvfs_attribute_value , offset , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pk_transaction_update_packages ( PkTransaction * transaction , GVariant * params , GDBusMethodInvocation * context ) {
gboolean ret ;
guint length ;
PkBitfield transaction_flags ;
g_autoptr ( GError ) error = NULL ;
g_autofree gchar * * package_ids = NULL ;
g_autofree gchar * package_ids_temp = NULL ;
g_autofree gchar * transaction_flags_temp = NULL ;
g_return_if_fail ( PK_IS_TRANSACTION ( transaction ) ) ;
g_return_if_fail ( transaction -> priv -> tid != NULL ) ;
g_variant_get ( params , "(t^a&s)" , & transaction_flags , & package_ids ) ;
package_ids_temp = pk_package_ids_to_string ( package_ids ) ;
transaction_flags_temp = pk_transaction_flag_bitfield_to_string ( transaction_flags ) ;
g_debug ( "UpdatePackages method called: %s (transaction_flags: %s)" , package_ids_temp , transaction_flags_temp ) ;
if ( ! pk_backend_is_implemented ( transaction -> priv -> backend , PK_ROLE_ENUM_UPDATE_PACKAGES ) ) {
g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NOT_SUPPORTED , "UpdatePackages not supported by backend" ) ;
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
length = g_strv_length ( package_ids ) ;
if ( length > PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS ) {
g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_NUMBER_OF_PACKAGES_INVALID , "Too many packages to process (%i/%i)" , length , PK_TRANSACTION_MAX_PACKAGES_TO_PROCESS ) ;
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
ret = pk_package_ids_check ( package_ids ) ;
if ( ! ret ) {
g_set_error ( & error , PK_TRANSACTION_ERROR , PK_TRANSACTION_ERROR_PACKAGE_ID_INVALID , "The package id's '%s' are not valid" , package_ids_temp ) ;
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
transaction -> priv -> cached_transaction_flags = transaction_flags ;
transaction -> priv -> cached_package_ids = g_strdupv ( package_ids ) ;
pk_transaction_set_role ( transaction , PK_ROLE_ENUM_UPDATE_PACKAGES ) ;
pk_transaction_emit_property_changed ( transaction , "TransactionFlags" , g_variant_new_uint64 ( transaction_flags ) ) ;
ret = pk_transaction_obtain_authorization ( transaction , PK_ROLE_ENUM_UPDATE_PACKAGES , & error ) ;
if ( ! ret ) {
pk_transaction_set_state ( transaction , PK_TRANSACTION_STATE_ERROR ) ;
goto out ;
}
out : pk_transaction_dbus_return ( context , error ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_set_mnt_opts ( struct super_block * sb , struct security_mnt_opts * opts , unsigned long kern_flags , unsigned long * set_kern_flags ) {
const struct cred * cred = current_cred ( ) ;
int rc = 0 , i ;
struct superblock_security_struct * sbsec = sb -> s_security ;
const char * name = sb -> s_type -> name ;
struct dentry * root = sbsec -> sb -> s_root ;
struct inode_security_struct * root_isec ;
u32 fscontext_sid = 0 , context_sid = 0 , rootcontext_sid = 0 ;
u32 defcontext_sid = 0 ;
char * * mount_options = opts -> mnt_opts ;
int * flags = opts -> mnt_opts_flags ;
int num_opts = opts -> num_mnt_opts ;
mutex_lock ( & sbsec -> lock ) ;
if ( ! ss_initialized ) {
if ( ! num_opts ) {
goto out ;
}
rc = - EINVAL ;
printk ( KERN_WARNING "SELinux: Unable to set superblock options " "before the security server is initialized\n" ) ;
goto out ;
}
if ( kern_flags && ! set_kern_flags ) {
rc = - EINVAL ;
goto out ;
}
if ( ( sbsec -> flags & SE_SBINITIALIZED ) && ( sb -> s_type -> fs_flags & FS_BINARY_MOUNTDATA ) && ( num_opts == 0 ) ) goto out ;
root_isec = backing_inode_security_novalidate ( root ) ;
for ( i = 0 ;
i < num_opts ;
i ++ ) {
u32 sid ;
if ( flags [ i ] == SBLABEL_MNT ) continue ;
rc = security_context_str_to_sid ( mount_options [ i ] , & sid , GFP_KERNEL ) ;
if ( rc ) {
printk ( KERN_WARNING "SELinux: security_context_str_to_sid" "(%s) failed for (dev %s, type %s) errno=%d\n" , mount_options [ i ] , sb -> s_id , name , rc ) ;
goto out ;
}
switch ( flags [ i ] ) {
case FSCONTEXT_MNT : fscontext_sid = sid ;
if ( bad_option ( sbsec , FSCONTEXT_MNT , sbsec -> sid , fscontext_sid ) ) goto out_double_mount ;
sbsec -> flags |= FSCONTEXT_MNT ;
break ;
case CONTEXT_MNT : context_sid = sid ;
if ( bad_option ( sbsec , CONTEXT_MNT , sbsec -> mntpoint_sid , context_sid ) ) goto out_double_mount ;
sbsec -> flags |= CONTEXT_MNT ;
break ;
case ROOTCONTEXT_MNT : rootcontext_sid = sid ;
if ( bad_option ( sbsec , ROOTCONTEXT_MNT , root_isec -> sid , rootcontext_sid ) ) goto out_double_mount ;
sbsec -> flags |= ROOTCONTEXT_MNT ;
break ;
case DEFCONTEXT_MNT : defcontext_sid = sid ;
if ( bad_option ( sbsec , DEFCONTEXT_MNT , sbsec -> def_sid , defcontext_sid ) ) goto out_double_mount ;
sbsec -> flags |= DEFCONTEXT_MNT ;
break ;
default : rc = - EINVAL ;
goto out ;
}
}
if ( sbsec -> flags & SE_SBINITIALIZED ) {
if ( ( sbsec -> flags & SE_MNTMASK ) && ! num_opts ) goto out_double_mount ;
rc = 0 ;
goto out ;
}
if ( strcmp ( sb -> s_type -> name , "proc" ) == 0 ) sbsec -> flags |= SE_SBPROC | SE_SBGENFS ;
if ( ! strcmp ( sb -> s_type -> name , "debugfs" ) || ! strcmp ( sb -> s_type -> name , "sysfs" ) || ! strcmp ( sb -> s_type -> name , "pstore" ) ) sbsec -> flags |= SE_SBGENFS ;
if ( ! sbsec -> behavior ) {
rc = security_fs_use ( sb ) ;
if ( rc ) {
printk ( KERN_WARNING "%s: security_fs_use(%s) returned %d\n" , __func__ , sb -> s_type -> name , rc ) ;
goto out ;
}
}
if ( sb -> s_user_ns != & init_user_ns ) {
if ( context_sid || fscontext_sid || rootcontext_sid || defcontext_sid ) {
rc = - EACCES ;
goto out ;
}
if ( sbsec -> behavior == SECURITY_FS_USE_XATTR ) {
sbsec -> behavior = SECURITY_FS_USE_MNTPOINT ;
rc = security_transition_sid ( current_sid ( ) , current_sid ( ) , SECCLASS_FILE , NULL , & sbsec -> mntpoint_sid ) ;
if ( rc ) goto out ;
}
goto out_set_opts ;
}
if ( fscontext_sid ) {
rc = may_context_mount_sb_relabel ( fscontext_sid , sbsec , cred ) ;
if ( rc ) goto out ;
sbsec -> sid = fscontext_sid ;
}
if ( kern_flags & SECURITY_LSM_NATIVE_LABELS && ! context_sid ) {
sbsec -> behavior = SECURITY_FS_USE_NATIVE ;
* set_kern_flags |= SECURITY_LSM_NATIVE_LABELS ;
}
if ( context_sid ) {
if ( ! fscontext_sid ) {
rc = may_context_mount_sb_relabel ( context_sid , sbsec , cred ) ;
if ( rc ) goto out ;
sbsec -> sid = context_sid ;
}
else {
rc = may_context_mount_inode_relabel ( context_sid , sbsec , cred ) ;
if ( rc ) goto out ;
}
if ( ! rootcontext_sid ) rootcontext_sid = context_sid ;
sbsec -> mntpoint_sid = context_sid ;
sbsec -> behavior = SECURITY_FS_USE_MNTPOINT ;
}
if ( rootcontext_sid ) {
rc = may_context_mount_inode_relabel ( rootcontext_sid , sbsec , cred ) ;
if ( rc ) goto out ;
root_isec -> sid = rootcontext_sid ;
root_isec -> initialized = LABEL_INITIALIZED ;
}
if ( defcontext_sid ) {
if ( sbsec -> behavior != SECURITY_FS_USE_XATTR && sbsec -> behavior != SECURITY_FS_USE_NATIVE ) {
rc = - EINVAL ;
printk ( KERN_WARNING "SELinux: defcontext option is " "invalid for this filesystem type\n" ) ;
goto out ;
}
if ( defcontext_sid != sbsec -> def_sid ) {
rc = may_context_mount_inode_relabel ( defcontext_sid , sbsec , cred ) ;
if ( rc ) goto out ;
}
sbsec -> def_sid = defcontext_sid ;
}
out_set_opts : rc = sb_finish_set_opts ( sb ) ;
out : mutex_unlock ( & sbsec -> lock ) ;
return rc ;
out_double_mount : rc = - EINVAL ;
printk ( KERN_WARNING "SELinux: mount invalid. Same superblock, different " "security settings for (dev %s, type %s)\n" , sb -> s_id , name ) ;
goto out ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void nameserver_probe_failed ( struct nameserver * const ns ) {
const struct timeval * timeout ;
( void ) evtimer_del ( & ns -> timeout_event ) ;
if ( ns -> state == 1 ) {
return ;
}
timeout = & global_nameserver_timeouts [ MIN ( ns -> failed_times , global_nameserver_timeouts_length - 1 ) ] ;
ns -> failed_times ++ ;
if ( evtimer_add ( & ns -> timeout_event , ( struct timeval * ) timeout ) < 0 ) {
log ( EVDNS_LOG_WARN , "Error from libevent when adding timer event for %s" , debug_ntoa ( ns -> address ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int main_recompress_output ( main_file * ofile ) {
pid_t recomp_id ;
int pipefd [ 2 ] ;
int output_fd = - 1 ;
int ret ;
const main_extcomp * recomp = ofile -> compressor ;
pipefd [ 0 ] = pipefd [ 1 ] = - 1 ;
if ( pipe ( pipefd ) ) {
XPR ( NT "pipe failed: %s\n" , xd3_mainerror ( ret = get_errno ( ) ) ) ;
goto pipe_cleanup ;
}
if ( ( recomp_id = fork ( ) ) < 0 ) {
XPR ( NT "fork failed: %s\n" , xd3_mainerror ( ret = get_errno ( ) ) ) ;
goto pipe_cleanup ;
}
if ( recomp_id == 0 ) {
if ( option_verbose > 2 ) {
XPR ( NT "external recompression pid %d\n" , getpid ( ) ) ;
}
if ( dup2 ( XFNO ( ofile ) , STDOUT_FILENO ) < 0 || dup2 ( pipefd [ PIPE_READ_FD ] , STDIN_FILENO ) < 0 || close ( pipefd [ PIPE_READ_FD ] ) || close ( pipefd [ PIPE_WRITE_FD ] ) || execlp ( recomp -> recomp_cmdname , recomp -> recomp_cmdname , recomp -> recomp_options , option_force2 ? "-f" : NULL , NULL ) ) {
XPR ( NT "child process %s failed to execute: %s\n" , recomp -> recomp_cmdname , xd3_mainerror ( get_errno ( ) ) ) ;
}
_exit ( 127 ) ;
}
XD3_ASSERT ( num_subprocs < MAX_SUBPROCS ) ;
ext_subprocs [ num_subprocs ++ ] = recomp_id ;
output_fd = dup ( pipefd [ PIPE_WRITE_FD ] ) ;
if ( output_fd < 0 || main_file_close ( ofile ) || close ( pipefd [ PIPE_READ_FD ] ) || close ( pipefd [ PIPE_WRITE_FD ] ) ) {
XPR ( NT "close failed: %s\n" , xd3_mainerror ( ret = get_errno ( ) ) ) ;
goto pipe_cleanup ;
}
# if XD3_STDIO if ( ( ofile -> file = fdopen ( output_fd , "w" ) ) == NULL ) {
XPR ( NT "fdopen failed: %s\n" , xd3_mainerror ( ret = get_errno ( ) ) ) ;
goto pipe_cleanup ;
}
# elif XD3_POSIX ofile -> file = output_fd ;
# endif return 0 ;
pipe_cleanup : close ( output_fd ) ;
close ( pipefd [ PIPE_READ_FD ] ) ;
close ( pipefd [ PIPE_WRITE_FD ] ) ;
return ret ;
}
| 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 ( ip_queue_rcv_skb ( sk , skb ) < 0 ) {
kfree_skb ( skb ) ;
return NET_RX_DROP ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void redomaxp ( struct alltabs * at , enum fontformat format ) {
at -> maxpf = tmpfile ( ) ;
putlong ( at -> maxpf , at -> maxp . version ) ;
putshort ( at -> maxpf , at -> maxp . numGlyphs ) ;
if ( format != ff_otf && format != ff_otfcid ) {
putshort ( at -> maxpf , at -> maxp . maxPoints ) ;
putshort ( at -> maxpf , at -> maxp . maxContours ) ;
putshort ( at -> maxpf , at -> maxp . maxCompositPts ) ;
putshort ( at -> maxpf , at -> maxp . maxCompositCtrs ) ;
putshort ( at -> maxpf , at -> maxp . maxZones ) ;
putshort ( at -> maxpf , at -> maxp . maxTwilightPts ) ;
putshort ( at -> maxpf , at -> maxp . maxStorage ) ;
putshort ( at -> maxpf , at -> maxp . maxFDEFs ) ;
putshort ( at -> maxpf , at -> maxp . maxIDEFs ) ;
putshort ( at -> maxpf , at -> maxp . maxStack ) ;
putshort ( at -> maxpf , at -> maxp . maxglyphInstr ) ;
putshort ( at -> maxpf , at -> maxp . maxnumcomponents ) ;
putshort ( at -> maxpf , at -> maxp . maxcomponentdepth ) ;
}
at -> maxplen = ftell ( at -> maxpf ) ;
if ( ( at -> maxplen & 2 ) != 0 ) putshort ( at -> maxpf , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void input_DecoderDelete ( decoder_t * p_dec ) {
decoder_owner_sys_t * p_owner = p_dec -> p_owner ;
vlc_cancel ( p_owner -> thread ) ;
vlc_mutex_lock ( & p_owner -> lock ) ;
const bool b_was_paused = p_owner -> b_paused ;
p_owner -> b_paused = false ;
p_owner -> b_waiting = false ;
p_owner -> b_flushing = true ;
p_owner -> b_exit = true ;
vlc_cond_signal ( & p_owner -> wait_request ) ;
vlc_mutex_unlock ( & p_owner -> lock ) ;
vlc_join ( p_owner -> thread , NULL ) ;
p_owner -> b_paused = b_was_paused ;
module_unneed ( p_dec , p_dec -> p_module ) ;
if ( p_dec -> p_owner -> cc . b_supported ) {
int i ;
for ( i = 0 ;
i < 4 ;
i ++ ) input_DecoderSetCcState ( p_dec , false , i ) ;
}
DeleteDecoder ( p_dec ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int arith_get_number ( ArithCoder * c , int mod_val ) {
int range = c -> high - c -> low + 1 ;
int val = ( ( c -> value - c -> low + 1 ) * mod_val - 1 ) / range ;
int prob = range * val ;
c -> high = ( prob + range ) / mod_val + c -> low - 1 ;
c -> low += prob / mod_val ;
arith_normalise ( c ) ;
return val ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int aes_gcm_ctrl ( EVP_CIPHER_CTX * c , int type , int arg , void * ptr ) {
EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , c ) ;
switch ( type ) {
case EVP_CTRL_INIT : gctx -> key_set = 0 ;
gctx -> iv_set = 0 ;
gctx -> ivlen = EVP_CIPHER_CTX_iv_length ( c ) ;
gctx -> iv = EVP_CIPHER_CTX_iv_noconst ( c ) ;
gctx -> taglen = - 1 ;
gctx -> iv_gen = 0 ;
gctx -> tls_aad_len = - 1 ;
return 1 ;
case EVP_CTRL_AEAD_SET_IVLEN : if ( arg <= 0 ) return 0 ;
if ( ( arg > EVP_MAX_IV_LENGTH ) && ( arg > gctx -> ivlen ) ) {
if ( gctx -> iv != EVP_CIPHER_CTX_iv_noconst ( c ) ) OPENSSL_free ( gctx -> iv ) ;
gctx -> iv = OPENSSL_malloc ( arg ) ;
if ( gctx -> iv == NULL ) return 0 ;
}
gctx -> ivlen = arg ;
return 1 ;
case EVP_CTRL_AEAD_SET_TAG : if ( arg <= 0 || arg > 16 || EVP_CIPHER_CTX_encrypting ( c ) ) return 0 ;
memcpy ( EVP_CIPHER_CTX_buf_noconst ( c ) , ptr , arg ) ;
gctx -> taglen = arg ;
return 1 ;
case EVP_CTRL_AEAD_GET_TAG : if ( arg <= 0 || arg > 16 || ! EVP_CIPHER_CTX_encrypting ( c ) || gctx -> taglen < 0 ) return 0 ;
memcpy ( ptr , EVP_CIPHER_CTX_buf_noconst ( c ) , arg ) ;
return 1 ;
case EVP_CTRL_GCM_SET_IV_FIXED : if ( arg == - 1 ) {
memcpy ( gctx -> iv , ptr , gctx -> ivlen ) ;
gctx -> iv_gen = 1 ;
return 1 ;
}
if ( ( arg < 4 ) || ( gctx -> ivlen - arg ) < 8 ) return 0 ;
if ( arg ) memcpy ( gctx -> iv , ptr , arg ) ;
if ( EVP_CIPHER_CTX_encrypting ( c ) && RAND_bytes ( gctx -> iv + arg , gctx -> ivlen - arg ) <= 0 ) return 0 ;
gctx -> iv_gen = 1 ;
return 1 ;
case EVP_CTRL_GCM_IV_GEN : if ( gctx -> iv_gen == 0 || gctx -> key_set == 0 ) return 0 ;
CRYPTO_gcm128_setiv ( & gctx -> gcm , gctx -> iv , gctx -> ivlen ) ;
if ( arg <= 0 || arg > gctx -> ivlen ) arg = gctx -> ivlen ;
memcpy ( ptr , gctx -> iv + gctx -> ivlen - arg , arg ) ;
ctr64_inc ( gctx -> iv + gctx -> ivlen - 8 ) ;
gctx -> iv_set = 1 ;
return 1 ;
case EVP_CTRL_GCM_SET_IV_INV : if ( gctx -> iv_gen == 0 || gctx -> key_set == 0 || EVP_CIPHER_CTX_encrypting ( c ) ) return 0 ;
memcpy ( gctx -> iv + gctx -> ivlen - arg , ptr , arg ) ;
CRYPTO_gcm128_setiv ( & gctx -> gcm , gctx -> iv , gctx -> ivlen ) ;
gctx -> iv_set = 1 ;
return 1 ;
case EVP_CTRL_AEAD_TLS1_AAD : if ( arg != EVP_AEAD_TLS1_AAD_LEN ) return 0 ;
memcpy ( EVP_CIPHER_CTX_buf_noconst ( c ) , ptr , arg ) ;
gctx -> tls_aad_len = arg ;
{
unsigned int len = EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 2 ] << 8 | EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 1 ] ;
if ( len < EVP_GCM_TLS_EXPLICIT_IV_LEN ) return 0 ;
len -= EVP_GCM_TLS_EXPLICIT_IV_LEN ;
if ( ! EVP_CIPHER_CTX_encrypting ( c ) ) {
if ( len < EVP_GCM_TLS_TAG_LEN ) return 0 ;
len -= EVP_GCM_TLS_TAG_LEN ;
}
EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 2 ] = len >> 8 ;
EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 1 ] = len & 0xff ;
}
return EVP_GCM_TLS_TAG_LEN ;
case EVP_CTRL_COPY : {
EVP_CIPHER_CTX * out = ptr ;
EVP_AES_GCM_CTX * gctx_out = EVP_C_DATA ( EVP_AES_GCM_CTX , out ) ;
if ( gctx -> gcm . key ) {
if ( gctx -> gcm . key != & gctx -> ks ) return 0 ;
gctx_out -> gcm . key = & gctx_out -> ks ;
}
if ( gctx -> iv == EVP_CIPHER_CTX_iv_noconst ( c ) ) gctx_out -> iv = EVP_CIPHER_CTX_iv_noconst ( out ) ;
else {
gctx_out -> iv = OPENSSL_malloc ( gctx -> ivlen ) ;
if ( gctx_out -> iv == NULL ) return 0 ;
memcpy ( gctx_out -> iv , gctx -> iv , gctx -> ivlen ) ;
}
return 1 ;
}
default : return - 1 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST ( WinUtils , SameObject ) {
using sandbox : : SameObject ;
wchar_t temp_directory [ MAX_PATH ] ;
wchar_t my_folder [ MAX_PATH ] ;
ASSERT_NE ( : : GetTempPath ( MAX_PATH , temp_directory ) , 0u ) ;
ASSERT_NE ( : : GetTempFileName ( temp_directory , L"test" , 0 , my_folder ) , 0u ) ;
ASSERT_TRUE ( : : DeleteFile ( my_folder ) ) ;
ASSERT_TRUE ( : : CreateDirectory ( my_folder , NULL ) ) ;
base : : string16 folder ( my_folder ) ;
base : : string16 file_name = folder + L"\\foo.txt" ;
const ULONG kSharing = FILE_SHARE_WRITE | FILE_SHARE_READ | FILE_SHARE_DELETE ;
base : : win : : ScopedHandle file ( CreateFile ( file_name . c_str ( ) , GENERIC_WRITE , kSharing , NULL , CREATE_ALWAYS , FILE_FLAG_DELETE_ON_CLOSE , NULL ) ) ;
EXPECT_TRUE ( file . IsValid ( ) ) ;
base : : string16 file_name_nt1 = base : : string16 ( L"\\??\\" ) + file_name ;
base : : string16 file_name_nt2 = base : : string16 ( L"\\??\\" ) + folder + L"\\FOO.txT" ;
EXPECT_TRUE ( SameObject ( file . Get ( ) , file_name_nt1 . c_str ( ) ) ) ;
EXPECT_TRUE ( SameObject ( file . Get ( ) , file_name_nt2 . c_str ( ) ) ) ;
file . Close ( ) ;
EXPECT_TRUE ( : : RemoveDirectory ( my_folder ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dump_string ( const byte * p , size_t n , int delim ) {
for ( ;
n ;
n -- , p ++ ) {
if ( ( * p & 0x80 ) || iscntrl ( * p ) || * p == delim ) {
if ( * p == '\n' ) log_printf ( "\\n" ) ;
else if ( * p == '\r' ) log_printf ( "\\r" ) ;
else if ( * p == '\f' ) log_printf ( "\\f" ) ;
else if ( * p == '\v' ) log_printf ( "\\v" ) ;
else if ( * p == '\b' ) log_printf ( "\\b" ) ;
else if ( ! * p ) log_printf ( "\\0" ) ;
else log_printf ( "\\x%02x" , * p ) ;
}
else log_printf ( "%c" , * p ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_h225_RasMessage ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 292 "./asn1/h225/h225.cnf" gint32 rasmessage_value ;
h225_packet_info * h225_pi ;
call_id_guid = NULL ;
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h225_RasMessage , RasMessage_choice , & rasmessage_value ) ;
col_add_fstr ( actx -> pinfo -> cinfo , COL_INFO , "RAS: %s " , val_to_str ( rasmessage_value , h225_RasMessage_vals , "<unknown>" ) ) ;
h225_pi = ( h225_packet_info * ) p_get_proto_data ( wmem_packet_scope ( ) , actx -> pinfo , proto_h225 , 0 ) ;
if ( h225_pi != NULL ) {
h225_pi -> msg_tag = rasmessage_value ;
if ( call_id_guid ) {
h225_pi -> guid = * call_id_guid ;
}
}
return offset ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int opt_pretty ( void * optctx , const char * opt , const char * arg ) {
show_value_unit = 1 ;
use_value_prefix = 1 ;
use_byte_value_binary_prefix = 1 ;
use_value_sexagesimal_format = 1 ;
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BudgetManagerTest , TestInsecureOrigin ) {
const blink : : mojom : : BudgetOperationType type = blink : : mojom : : BudgetOperationType : : SILENT_PUSH ;
SetOrigin ( url : : Origin ( GURL ( "http://example.com" ) ) ) ;
SetSiteEngagementScore ( kTestSES ) ;
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
|
void vp9_idct32x32_1024_add_sse2 ( const int16_t * input , uint8_t * dest , int stride ) {
const __m128i rounding = _mm_set1_epi32 ( DCT_CONST_ROUNDING ) ;
const __m128i final_rounding = _mm_set1_epi16 ( 1 << 5 ) ;
const __m128i stg1_0 = pair_set_epi16 ( cospi_31_64 , - cospi_1_64 ) ;
const __m128i stg1_1 = pair_set_epi16 ( cospi_1_64 , cospi_31_64 ) ;
const __m128i stg1_2 = pair_set_epi16 ( cospi_15_64 , - cospi_17_64 ) ;
const __m128i stg1_3 = pair_set_epi16 ( cospi_17_64 , cospi_15_64 ) ;
const __m128i stg1_4 = pair_set_epi16 ( cospi_23_64 , - cospi_9_64 ) ;
const __m128i stg1_5 = pair_set_epi16 ( cospi_9_64 , cospi_23_64 ) ;
const __m128i stg1_6 = pair_set_epi16 ( cospi_7_64 , - cospi_25_64 ) ;
const __m128i stg1_7 = pair_set_epi16 ( cospi_25_64 , cospi_7_64 ) ;
const __m128i stg1_8 = pair_set_epi16 ( cospi_27_64 , - cospi_5_64 ) ;
const __m128i stg1_9 = pair_set_epi16 ( cospi_5_64 , cospi_27_64 ) ;
const __m128i stg1_10 = pair_set_epi16 ( cospi_11_64 , - cospi_21_64 ) ;
const __m128i stg1_11 = pair_set_epi16 ( cospi_21_64 , cospi_11_64 ) ;
const __m128i stg1_12 = pair_set_epi16 ( cospi_19_64 , - cospi_13_64 ) ;
const __m128i stg1_13 = pair_set_epi16 ( cospi_13_64 , cospi_19_64 ) ;
const __m128i stg1_14 = pair_set_epi16 ( cospi_3_64 , - cospi_29_64 ) ;
const __m128i stg1_15 = pair_set_epi16 ( cospi_29_64 , cospi_3_64 ) ;
const __m128i stg2_0 = pair_set_epi16 ( cospi_30_64 , - cospi_2_64 ) ;
const __m128i stg2_1 = pair_set_epi16 ( cospi_2_64 , cospi_30_64 ) ;
const __m128i stg2_2 = pair_set_epi16 ( cospi_14_64 , - cospi_18_64 ) ;
const __m128i stg2_3 = pair_set_epi16 ( cospi_18_64 , cospi_14_64 ) ;
const __m128i stg2_4 = pair_set_epi16 ( cospi_22_64 , - cospi_10_64 ) ;
const __m128i stg2_5 = pair_set_epi16 ( cospi_10_64 , cospi_22_64 ) ;
const __m128i stg2_6 = pair_set_epi16 ( cospi_6_64 , - cospi_26_64 ) ;
const __m128i stg2_7 = pair_set_epi16 ( cospi_26_64 , cospi_6_64 ) ;
const __m128i stg3_0 = pair_set_epi16 ( cospi_28_64 , - cospi_4_64 ) ;
const __m128i stg3_1 = pair_set_epi16 ( cospi_4_64 , cospi_28_64 ) ;
const __m128i stg3_2 = pair_set_epi16 ( cospi_12_64 , - cospi_20_64 ) ;
const __m128i stg3_3 = pair_set_epi16 ( cospi_20_64 , cospi_12_64 ) ;
const __m128i stg3_4 = pair_set_epi16 ( - cospi_4_64 , cospi_28_64 ) ;
const __m128i stg3_5 = pair_set_epi16 ( cospi_28_64 , cospi_4_64 ) ;
const __m128i stg3_6 = pair_set_epi16 ( - cospi_28_64 , - cospi_4_64 ) ;
const __m128i stg3_8 = pair_set_epi16 ( - cospi_20_64 , cospi_12_64 ) ;
const __m128i stg3_9 = pair_set_epi16 ( cospi_12_64 , cospi_20_64 ) ;
const __m128i stg3_10 = pair_set_epi16 ( - cospi_12_64 , - cospi_20_64 ) ;
const __m128i stg4_0 = pair_set_epi16 ( cospi_16_64 , cospi_16_64 ) ;
const __m128i stg4_1 = pair_set_epi16 ( cospi_16_64 , - cospi_16_64 ) ;
const __m128i stg4_2 = pair_set_epi16 ( cospi_24_64 , - cospi_8_64 ) ;
const __m128i stg4_3 = pair_set_epi16 ( cospi_8_64 , cospi_24_64 ) ;
const __m128i stg4_4 = pair_set_epi16 ( - cospi_8_64 , cospi_24_64 ) ;
const __m128i stg4_5 = pair_set_epi16 ( cospi_24_64 , cospi_8_64 ) ;
const __m128i stg4_6 = pair_set_epi16 ( - cospi_24_64 , - cospi_8_64 ) ;
const __m128i stg6_0 = pair_set_epi16 ( - cospi_16_64 , cospi_16_64 ) ;
__m128i in [ 32 ] , col [ 128 ] , zero_idx [ 16 ] ;
__m128i stp1_0 , stp1_1 , stp1_2 , stp1_3 , stp1_4 , stp1_5 , stp1_6 , stp1_7 , stp1_8 , stp1_9 , stp1_10 , stp1_11 , stp1_12 , stp1_13 , stp1_14 , stp1_15 , stp1_16 , stp1_17 , stp1_18 , stp1_19 , stp1_20 , stp1_21 , stp1_22 , stp1_23 , stp1_24 , stp1_25 , stp1_26 , stp1_27 , stp1_28 , stp1_29 , stp1_30 , stp1_31 ;
__m128i stp2_0 , stp2_1 , stp2_2 , stp2_3 , stp2_4 , stp2_5 , stp2_6 , stp2_7 , stp2_8 , stp2_9 , stp2_10 , stp2_11 , stp2_12 , stp2_13 , stp2_14 , stp2_15 , stp2_16 , stp2_17 , stp2_18 , stp2_19 , stp2_20 , stp2_21 , stp2_22 , stp2_23 , stp2_24 , stp2_25 , stp2_26 , stp2_27 , stp2_28 , stp2_29 , stp2_30 , stp2_31 ;
__m128i tmp0 , tmp1 , tmp2 , tmp3 , tmp4 , tmp5 , tmp6 , tmp7 ;
int i , j , i32 ;
int zero_flag [ 2 ] ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
i32 = ( i << 5 ) ;
LOAD_DQCOEFF ( in [ 0 ] , input ) ;
LOAD_DQCOEFF ( in [ 8 ] , input ) ;
LOAD_DQCOEFF ( in [ 16 ] , input ) ;
LOAD_DQCOEFF ( in [ 24 ] , input ) ;
LOAD_DQCOEFF ( in [ 1 ] , input ) ;
LOAD_DQCOEFF ( in [ 9 ] , input ) ;
LOAD_DQCOEFF ( in [ 17 ] , input ) ;
LOAD_DQCOEFF ( in [ 25 ] , input ) ;
LOAD_DQCOEFF ( in [ 2 ] , input ) ;
LOAD_DQCOEFF ( in [ 10 ] , input ) ;
LOAD_DQCOEFF ( in [ 18 ] , input ) ;
LOAD_DQCOEFF ( in [ 26 ] , input ) ;
LOAD_DQCOEFF ( in [ 3 ] , input ) ;
LOAD_DQCOEFF ( in [ 11 ] , input ) ;
LOAD_DQCOEFF ( in [ 19 ] , input ) ;
LOAD_DQCOEFF ( in [ 27 ] , input ) ;
LOAD_DQCOEFF ( in [ 4 ] , input ) ;
LOAD_DQCOEFF ( in [ 12 ] , input ) ;
LOAD_DQCOEFF ( in [ 20 ] , input ) ;
LOAD_DQCOEFF ( in [ 28 ] , input ) ;
LOAD_DQCOEFF ( in [ 5 ] , input ) ;
LOAD_DQCOEFF ( in [ 13 ] , input ) ;
LOAD_DQCOEFF ( in [ 21 ] , input ) ;
LOAD_DQCOEFF ( in [ 29 ] , input ) ;
LOAD_DQCOEFF ( in [ 6 ] , input ) ;
LOAD_DQCOEFF ( in [ 14 ] , input ) ;
LOAD_DQCOEFF ( in [ 22 ] , input ) ;
LOAD_DQCOEFF ( in [ 30 ] , input ) ;
LOAD_DQCOEFF ( in [ 7 ] , input ) ;
LOAD_DQCOEFF ( in [ 15 ] , input ) ;
LOAD_DQCOEFF ( in [ 23 ] , input ) ;
LOAD_DQCOEFF ( in [ 31 ] , input ) ;
zero_idx [ 0 ] = _mm_or_si128 ( in [ 0 ] , in [ 1 ] ) ;
zero_idx [ 1 ] = _mm_or_si128 ( in [ 2 ] , in [ 3 ] ) ;
zero_idx [ 2 ] = _mm_or_si128 ( in [ 4 ] , in [ 5 ] ) ;
zero_idx [ 3 ] = _mm_or_si128 ( in [ 6 ] , in [ 7 ] ) ;
zero_idx [ 4 ] = _mm_or_si128 ( in [ 8 ] , in [ 9 ] ) ;
zero_idx [ 5 ] = _mm_or_si128 ( in [ 10 ] , in [ 11 ] ) ;
zero_idx [ 6 ] = _mm_or_si128 ( in [ 12 ] , in [ 13 ] ) ;
zero_idx [ 7 ] = _mm_or_si128 ( in [ 14 ] , in [ 15 ] ) ;
zero_idx [ 8 ] = _mm_or_si128 ( in [ 16 ] , in [ 17 ] ) ;
zero_idx [ 9 ] = _mm_or_si128 ( in [ 18 ] , in [ 19 ] ) ;
zero_idx [ 10 ] = _mm_or_si128 ( in [ 20 ] , in [ 21 ] ) ;
zero_idx [ 11 ] = _mm_or_si128 ( in [ 22 ] , in [ 23 ] ) ;
zero_idx [ 12 ] = _mm_or_si128 ( in [ 24 ] , in [ 25 ] ) ;
zero_idx [ 13 ] = _mm_or_si128 ( in [ 26 ] , in [ 27 ] ) ;
zero_idx [ 14 ] = _mm_or_si128 ( in [ 28 ] , in [ 29 ] ) ;
zero_idx [ 15 ] = _mm_or_si128 ( in [ 30 ] , in [ 31 ] ) ;
zero_idx [ 0 ] = _mm_or_si128 ( zero_idx [ 0 ] , zero_idx [ 1 ] ) ;
zero_idx [ 1 ] = _mm_or_si128 ( zero_idx [ 2 ] , zero_idx [ 3 ] ) ;
zero_idx [ 2 ] = _mm_or_si128 ( zero_idx [ 4 ] , zero_idx [ 5 ] ) ;
zero_idx [ 3 ] = _mm_or_si128 ( zero_idx [ 6 ] , zero_idx [ 7 ] ) ;
zero_idx [ 4 ] = _mm_or_si128 ( zero_idx [ 8 ] , zero_idx [ 9 ] ) ;
zero_idx [ 5 ] = _mm_or_si128 ( zero_idx [ 10 ] , zero_idx [ 11 ] ) ;
zero_idx [ 6 ] = _mm_or_si128 ( zero_idx [ 12 ] , zero_idx [ 13 ] ) ;
zero_idx [ 7 ] = _mm_or_si128 ( zero_idx [ 14 ] , zero_idx [ 15 ] ) ;
zero_idx [ 8 ] = _mm_or_si128 ( zero_idx [ 0 ] , zero_idx [ 1 ] ) ;
zero_idx [ 9 ] = _mm_or_si128 ( zero_idx [ 2 ] , zero_idx [ 3 ] ) ;
zero_idx [ 10 ] = _mm_or_si128 ( zero_idx [ 4 ] , zero_idx [ 5 ] ) ;
zero_idx [ 11 ] = _mm_or_si128 ( zero_idx [ 6 ] , zero_idx [ 7 ] ) ;
zero_idx [ 12 ] = _mm_or_si128 ( zero_idx [ 8 ] , zero_idx [ 9 ] ) ;
zero_idx [ 13 ] = _mm_or_si128 ( zero_idx [ 10 ] , zero_idx [ 11 ] ) ;
zero_idx [ 14 ] = _mm_or_si128 ( zero_idx [ 12 ] , zero_idx [ 13 ] ) ;
zero_idx [ 0 ] = _mm_unpackhi_epi64 ( zero_idx [ 14 ] , zero_idx [ 14 ] ) ;
zero_idx [ 1 ] = _mm_or_si128 ( zero_idx [ 0 ] , zero_idx [ 14 ] ) ;
zero_idx [ 2 ] = _mm_srli_epi64 ( zero_idx [ 1 ] , 32 ) ;
zero_flag [ 0 ] = _mm_cvtsi128_si32 ( zero_idx [ 1 ] ) ;
zero_flag [ 1 ] = _mm_cvtsi128_si32 ( zero_idx [ 2 ] ) ;
if ( ! zero_flag [ 0 ] && ! zero_flag [ 1 ] ) {
col [ i32 + 0 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 1 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 2 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 3 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 4 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 5 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 6 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 7 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 8 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 9 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 10 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 11 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 12 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 13 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 14 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 15 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 16 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 17 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 18 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 19 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 20 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 21 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 22 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 23 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 24 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 25 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 26 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 27 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 28 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 29 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 30 ] = _mm_setzero_si128 ( ) ;
col [ i32 + 31 ] = _mm_setzero_si128 ( ) ;
continue ;
}
array_transpose_8x8 ( in , in ) ;
array_transpose_8x8 ( in + 8 , in + 8 ) ;
array_transpose_8x8 ( in + 16 , in + 16 ) ;
array_transpose_8x8 ( in + 24 , in + 24 ) ;
IDCT32 col [ i32 + 0 ] = _mm_add_epi16 ( stp1_0 , stp1_31 ) ;
col [ i32 + 1 ] = _mm_add_epi16 ( stp1_1 , stp1_30 ) ;
col [ i32 + 2 ] = _mm_add_epi16 ( stp1_2 , stp1_29 ) ;
col [ i32 + 3 ] = _mm_add_epi16 ( stp1_3 , stp1_28 ) ;
col [ i32 + 4 ] = _mm_add_epi16 ( stp1_4 , stp1_27 ) ;
col [ i32 + 5 ] = _mm_add_epi16 ( stp1_5 , stp1_26 ) ;
col [ i32 + 6 ] = _mm_add_epi16 ( stp1_6 , stp1_25 ) ;
col [ i32 + 7 ] = _mm_add_epi16 ( stp1_7 , stp1_24 ) ;
col [ i32 + 8 ] = _mm_add_epi16 ( stp1_8 , stp1_23 ) ;
col [ i32 + 9 ] = _mm_add_epi16 ( stp1_9 , stp1_22 ) ;
col [ i32 + 10 ] = _mm_add_epi16 ( stp1_10 , stp1_21 ) ;
col [ i32 + 11 ] = _mm_add_epi16 ( stp1_11 , stp1_20 ) ;
col [ i32 + 12 ] = _mm_add_epi16 ( stp1_12 , stp1_19 ) ;
col [ i32 + 13 ] = _mm_add_epi16 ( stp1_13 , stp1_18 ) ;
col [ i32 + 14 ] = _mm_add_epi16 ( stp1_14 , stp1_17 ) ;
col [ i32 + 15 ] = _mm_add_epi16 ( stp1_15 , stp1_16 ) ;
col [ i32 + 16 ] = _mm_sub_epi16 ( stp1_15 , stp1_16 ) ;
col [ i32 + 17 ] = _mm_sub_epi16 ( stp1_14 , stp1_17 ) ;
col [ i32 + 18 ] = _mm_sub_epi16 ( stp1_13 , stp1_18 ) ;
col [ i32 + 19 ] = _mm_sub_epi16 ( stp1_12 , stp1_19 ) ;
col [ i32 + 20 ] = _mm_sub_epi16 ( stp1_11 , stp1_20 ) ;
col [ i32 + 21 ] = _mm_sub_epi16 ( stp1_10 , stp1_21 ) ;
col [ i32 + 22 ] = _mm_sub_epi16 ( stp1_9 , stp1_22 ) ;
col [ i32 + 23 ] = _mm_sub_epi16 ( stp1_8 , stp1_23 ) ;
col [ i32 + 24 ] = _mm_sub_epi16 ( stp1_7 , stp1_24 ) ;
col [ i32 + 25 ] = _mm_sub_epi16 ( stp1_6 , stp1_25 ) ;
col [ i32 + 26 ] = _mm_sub_epi16 ( stp1_5 , stp1_26 ) ;
col [ i32 + 27 ] = _mm_sub_epi16 ( stp1_4 , stp1_27 ) ;
col [ i32 + 28 ] = _mm_sub_epi16 ( stp1_3 , stp1_28 ) ;
col [ i32 + 29 ] = _mm_sub_epi16 ( stp1_2 , stp1_29 ) ;
col [ i32 + 30 ] = _mm_sub_epi16 ( stp1_1 , stp1_30 ) ;
col [ i32 + 31 ] = _mm_sub_epi16 ( stp1_0 , stp1_31 ) ;
}
for ( i = 0 ;
i < 4 ;
i ++ ) {
const __m128i zero = _mm_setzero_si128 ( ) ;
j = i << 3 ;
array_transpose_8x8 ( col + j , in ) ;
array_transpose_8x8 ( col + j + 32 , in + 8 ) ;
array_transpose_8x8 ( col + j + 64 , in + 16 ) ;
array_transpose_8x8 ( col + j + 96 , in + 24 ) ;
IDCT32 in [ 0 ] = _mm_add_epi16 ( stp1_0 , stp1_31 ) ;
in [ 1 ] = _mm_add_epi16 ( stp1_1 , stp1_30 ) ;
in [ 2 ] = _mm_add_epi16 ( stp1_2 , stp1_29 ) ;
in [ 3 ] = _mm_add_epi16 ( stp1_3 , stp1_28 ) ;
in [ 4 ] = _mm_add_epi16 ( stp1_4 , stp1_27 ) ;
in [ 5 ] = _mm_add_epi16 ( stp1_5 , stp1_26 ) ;
in [ 6 ] = _mm_add_epi16 ( stp1_6 , stp1_25 ) ;
in [ 7 ] = _mm_add_epi16 ( stp1_7 , stp1_24 ) ;
in [ 8 ] = _mm_add_epi16 ( stp1_8 , stp1_23 ) ;
in [ 9 ] = _mm_add_epi16 ( stp1_9 , stp1_22 ) ;
in [ 10 ] = _mm_add_epi16 ( stp1_10 , stp1_21 ) ;
in [ 11 ] = _mm_add_epi16 ( stp1_11 , stp1_20 ) ;
in [ 12 ] = _mm_add_epi16 ( stp1_12 , stp1_19 ) ;
in [ 13 ] = _mm_add_epi16 ( stp1_13 , stp1_18 ) ;
in [ 14 ] = _mm_add_epi16 ( stp1_14 , stp1_17 ) ;
in [ 15 ] = _mm_add_epi16 ( stp1_15 , stp1_16 ) ;
in [ 16 ] = _mm_sub_epi16 ( stp1_15 , stp1_16 ) ;
in [ 17 ] = _mm_sub_epi16 ( stp1_14 , stp1_17 ) ;
in [ 18 ] = _mm_sub_epi16 ( stp1_13 , stp1_18 ) ;
in [ 19 ] = _mm_sub_epi16 ( stp1_12 , stp1_19 ) ;
in [ 20 ] = _mm_sub_epi16 ( stp1_11 , stp1_20 ) ;
in [ 21 ] = _mm_sub_epi16 ( stp1_10 , stp1_21 ) ;
in [ 22 ] = _mm_sub_epi16 ( stp1_9 , stp1_22 ) ;
in [ 23 ] = _mm_sub_epi16 ( stp1_8 , stp1_23 ) ;
in [ 24 ] = _mm_sub_epi16 ( stp1_7 , stp1_24 ) ;
in [ 25 ] = _mm_sub_epi16 ( stp1_6 , stp1_25 ) ;
in [ 26 ] = _mm_sub_epi16 ( stp1_5 , stp1_26 ) ;
in [ 27 ] = _mm_sub_epi16 ( stp1_4 , stp1_27 ) ;
in [ 28 ] = _mm_sub_epi16 ( stp1_3 , stp1_28 ) ;
in [ 29 ] = _mm_sub_epi16 ( stp1_2 , stp1_29 ) ;
in [ 30 ] = _mm_sub_epi16 ( stp1_1 , stp1_30 ) ;
in [ 31 ] = _mm_sub_epi16 ( stp1_0 , stp1_31 ) ;
in [ 0 ] = _mm_adds_epi16 ( in [ 0 ] , final_rounding ) ;
in [ 1 ] = _mm_adds_epi16 ( in [ 1 ] , final_rounding ) ;
in [ 2 ] = _mm_adds_epi16 ( in [ 2 ] , final_rounding ) ;
in [ 3 ] = _mm_adds_epi16 ( in [ 3 ] , final_rounding ) ;
in [ 4 ] = _mm_adds_epi16 ( in [ 4 ] , final_rounding ) ;
in [ 5 ] = _mm_adds_epi16 ( in [ 5 ] , final_rounding ) ;
in [ 6 ] = _mm_adds_epi16 ( in [ 6 ] , final_rounding ) ;
in [ 7 ] = _mm_adds_epi16 ( in [ 7 ] , final_rounding ) ;
in [ 8 ] = _mm_adds_epi16 ( in [ 8 ] , final_rounding ) ;
in [ 9 ] = _mm_adds_epi16 ( in [ 9 ] , final_rounding ) ;
in [ 10 ] = _mm_adds_epi16 ( in [ 10 ] , final_rounding ) ;
in [ 11 ] = _mm_adds_epi16 ( in [ 11 ] , final_rounding ) ;
in [ 12 ] = _mm_adds_epi16 ( in [ 12 ] , final_rounding ) ;
in [ 13 ] = _mm_adds_epi16 ( in [ 13 ] , final_rounding ) ;
in [ 14 ] = _mm_adds_epi16 ( in [ 14 ] , final_rounding ) ;
in [ 15 ] = _mm_adds_epi16 ( in [ 15 ] , final_rounding ) ;
in [ 16 ] = _mm_adds_epi16 ( in [ 16 ] , final_rounding ) ;
in [ 17 ] = _mm_adds_epi16 ( in [ 17 ] , final_rounding ) ;
in [ 18 ] = _mm_adds_epi16 ( in [ 18 ] , final_rounding ) ;
in [ 19 ] = _mm_adds_epi16 ( in [ 19 ] , final_rounding ) ;
in [ 20 ] = _mm_adds_epi16 ( in [ 20 ] , final_rounding ) ;
in [ 21 ] = _mm_adds_epi16 ( in [ 21 ] , final_rounding ) ;
in [ 22 ] = _mm_adds_epi16 ( in [ 22 ] , final_rounding ) ;
in [ 23 ] = _mm_adds_epi16 ( in [ 23 ] , final_rounding ) ;
in [ 24 ] = _mm_adds_epi16 ( in [ 24 ] , final_rounding ) ;
in [ 25 ] = _mm_adds_epi16 ( in [ 25 ] , final_rounding ) ;
in [ 26 ] = _mm_adds_epi16 ( in [ 26 ] , final_rounding ) ;
in [ 27 ] = _mm_adds_epi16 ( in [ 27 ] , final_rounding ) ;
in [ 28 ] = _mm_adds_epi16 ( in [ 28 ] , final_rounding ) ;
in [ 29 ] = _mm_adds_epi16 ( in [ 29 ] , final_rounding ) ;
in [ 30 ] = _mm_adds_epi16 ( in [ 30 ] , final_rounding ) ;
in [ 31 ] = _mm_adds_epi16 ( in [ 31 ] , final_rounding ) ;
in [ 0 ] = _mm_srai_epi16 ( in [ 0 ] , 6 ) ;
in [ 1 ] = _mm_srai_epi16 ( in [ 1 ] , 6 ) ;
in [ 2 ] = _mm_srai_epi16 ( in [ 2 ] , 6 ) ;
in [ 3 ] = _mm_srai_epi16 ( in [ 3 ] , 6 ) ;
in [ 4 ] = _mm_srai_epi16 ( in [ 4 ] , 6 ) ;
in [ 5 ] = _mm_srai_epi16 ( in [ 5 ] , 6 ) ;
in [ 6 ] = _mm_srai_epi16 ( in [ 6 ] , 6 ) ;
in [ 7 ] = _mm_srai_epi16 ( in [ 7 ] , 6 ) ;
in [ 8 ] = _mm_srai_epi16 ( in [ 8 ] , 6 ) ;
in [ 9 ] = _mm_srai_epi16 ( in [ 9 ] , 6 ) ;
in [ 10 ] = _mm_srai_epi16 ( in [ 10 ] , 6 ) ;
in [ 11 ] = _mm_srai_epi16 ( in [ 11 ] , 6 ) ;
in [ 12 ] = _mm_srai_epi16 ( in [ 12 ] , 6 ) ;
in [ 13 ] = _mm_srai_epi16 ( in [ 13 ] , 6 ) ;
in [ 14 ] = _mm_srai_epi16 ( in [ 14 ] , 6 ) ;
in [ 15 ] = _mm_srai_epi16 ( in [ 15 ] , 6 ) ;
in [ 16 ] = _mm_srai_epi16 ( in [ 16 ] , 6 ) ;
in [ 17 ] = _mm_srai_epi16 ( in [ 17 ] , 6 ) ;
in [ 18 ] = _mm_srai_epi16 ( in [ 18 ] , 6 ) ;
in [ 19 ] = _mm_srai_epi16 ( in [ 19 ] , 6 ) ;
in [ 20 ] = _mm_srai_epi16 ( in [ 20 ] , 6 ) ;
in [ 21 ] = _mm_srai_epi16 ( in [ 21 ] , 6 ) ;
in [ 22 ] = _mm_srai_epi16 ( in [ 22 ] , 6 ) ;
in [ 23 ] = _mm_srai_epi16 ( in [ 23 ] , 6 ) ;
in [ 24 ] = _mm_srai_epi16 ( in [ 24 ] , 6 ) ;
in [ 25 ] = _mm_srai_epi16 ( in [ 25 ] , 6 ) ;
in [ 26 ] = _mm_srai_epi16 ( in [ 26 ] , 6 ) ;
in [ 27 ] = _mm_srai_epi16 ( in [ 27 ] , 6 ) ;
in [ 28 ] = _mm_srai_epi16 ( in [ 28 ] , 6 ) ;
in [ 29 ] = _mm_srai_epi16 ( in [ 29 ] , 6 ) ;
in [ 30 ] = _mm_srai_epi16 ( in [ 30 ] , 6 ) ;
in [ 31 ] = _mm_srai_epi16 ( in [ 31 ] , 6 ) ;
RECON_AND_STORE ( dest , in [ 0 ] ) ;
RECON_AND_STORE ( dest , in [ 1 ] ) ;
RECON_AND_STORE ( dest , in [ 2 ] ) ;
RECON_AND_STORE ( dest , in [ 3 ] ) ;
RECON_AND_STORE ( dest , in [ 4 ] ) ;
RECON_AND_STORE ( dest , in [ 5 ] ) ;
RECON_AND_STORE ( dest , in [ 6 ] ) ;
RECON_AND_STORE ( dest , in [ 7 ] ) ;
RECON_AND_STORE ( dest , in [ 8 ] ) ;
RECON_AND_STORE ( dest , in [ 9 ] ) ;
RECON_AND_STORE ( dest , in [ 10 ] ) ;
RECON_AND_STORE ( dest , in [ 11 ] ) ;
RECON_AND_STORE ( dest , in [ 12 ] ) ;
RECON_AND_STORE ( dest , in [ 13 ] ) ;
RECON_AND_STORE ( dest , in [ 14 ] ) ;
RECON_AND_STORE ( dest , in [ 15 ] ) ;
RECON_AND_STORE ( dest , in [ 16 ] ) ;
RECON_AND_STORE ( dest , in [ 17 ] ) ;
RECON_AND_STORE ( dest , in [ 18 ] ) ;
RECON_AND_STORE ( dest , in [ 19 ] ) ;
RECON_AND_STORE ( dest , in [ 20 ] ) ;
RECON_AND_STORE ( dest , in [ 21 ] ) ;
RECON_AND_STORE ( dest , in [ 22 ] ) ;
RECON_AND_STORE ( dest , in [ 23 ] ) ;
RECON_AND_STORE ( dest , in [ 24 ] ) ;
RECON_AND_STORE ( dest , in [ 25 ] ) ;
RECON_AND_STORE ( dest , in [ 26 ] ) ;
RECON_AND_STORE ( dest , in [ 27 ] ) ;
RECON_AND_STORE ( dest , in [ 28 ] ) ;
RECON_AND_STORE ( dest , in [ 29 ] ) ;
RECON_AND_STORE ( dest , in [ 30 ] ) ;
RECON_AND_STORE ( dest , in [ 31 ] ) ;
dest += 8 - ( stride * 32 ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void U_CALLCONV _ISCIIReset ( UConverter * cnv , UConverterResetChoice choice ) {
UConverterDataISCII * data = ( UConverterDataISCII * ) ( cnv -> extraInfo ) ;
if ( choice <= UCNV_RESET_TO_UNICODE ) {
cnv -> toUnicodeStatus = missingCharMarker ;
cnv -> mode = 0 ;
data -> currentDeltaToUnicode = data -> defDeltaToUnicode ;
data -> currentMaskToUnicode = data -> defMaskToUnicode ;
data -> contextCharToUnicode = NO_CHAR_MARKER ;
data -> prevToUnicodeStatus = 0x0000 ;
}
if ( choice != UCNV_RESET_TO_UNICODE ) {
cnv -> fromUChar32 = 0x0000 ;
data -> contextCharFromUnicode = 0x00 ;
data -> currentMaskFromUnicode = data -> defMaskToUnicode ;
data -> currentDeltaFromUnicode = data -> defDeltaToUnicode ;
data -> isFirstBuffer = TRUE ;
data -> resetToDefaultToUnicode = FALSE ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int spl_filesystem_file_open ( spl_filesystem_object * intern , int use_include_path , int silent TSRMLS_DC ) {
zval tmp ;
intern -> type = SPL_FS_FILE ;
php_stat ( intern -> file_name , intern -> file_name_len , FS_IS_DIR , & tmp TSRMLS_CC ) ;
if ( Z_LVAL ( tmp ) ) {
intern -> u . file . open_mode = NULL ;
intern -> file_name = NULL ;
zend_throw_exception_ex ( spl_ce_LogicException , 0 TSRMLS_CC , "Cannot use SplFileObject with directories" ) ;
return FAILURE ;
}
intern -> u . file . context = php_stream_context_from_zval ( intern -> u . file . zcontext , 0 ) ;
intern -> u . file . stream = php_stream_open_wrapper_ex ( intern -> file_name , intern -> u . file . open_mode , ( use_include_path ? USE_PATH : 0 ) | REPORT_ERRORS , NULL , intern -> u . file . context ) ;
if ( ! intern -> file_name_len || ! intern -> u . file . stream ) {
if ( ! EG ( exception ) ) {
zend_throw_exception_ex ( spl_ce_RuntimeException , 0 TSRMLS_CC , "Cannot open file '%s'" , intern -> file_name_len ? intern -> file_name : "" ) ;
}
intern -> file_name = NULL ;
intern -> u . file . open_mode = NULL ;
return FAILURE ;
}
if ( intern -> u . file . zcontext ) {
zend_list_addref ( Z_RESVAL_P ( intern -> u . file . zcontext ) ) ;
}
if ( intern -> file_name_len > 1 && IS_SLASH_AT ( intern -> file_name , intern -> file_name_len - 1 ) ) {
intern -> file_name_len -- ;
}
intern -> orig_path = estrndup ( intern -> u . file . stream -> orig_path , strlen ( intern -> u . file . stream -> orig_path ) ) ;
intern -> file_name = estrndup ( intern -> file_name , intern -> file_name_len ) ;
intern -> u . file . open_mode = estrndup ( intern -> u . file . open_mode , intern -> u . file . open_mode_len ) ;
ZVAL_RESOURCE ( & intern -> u . file . zresource , php_stream_get_resource_id ( intern -> u . file . stream ) ) ;
Z_SET_REFCOUNT ( intern -> u . file . zresource , 1 ) ;
intern -> u . file . delimiter = ',' ;
intern -> u . file . enclosure = '"' ;
intern -> u . file . escape = '\\' ;
zend_hash_find ( & intern -> std . ce -> function_table , "getcurrentline" , sizeof ( "getcurrentline" ) , ( void * * ) & intern -> u . file . func_getCurr ) ;
return SUCCESS ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h225_T_nsp_data ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 817 "./asn1/h225/h225.cnf" tvbuff_t * next_tvb = NULL ;
offset = dissect_per_octet_string ( tvb , offset , actx , tree , hf_index , NO_BOUND , NO_BOUND , FALSE , & next_tvb ) ;
if ( next_tvb && tvb_reported_length ( next_tvb ) ) {
call_dissector ( ( nsp_handle ) ? nsp_handle : data_handle , next_tvb , actx -> pinfo , tree ) ;
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ProfileBrowserTest , DISABLED_ProfileReadmeCreated ) {
base : : ScopedTempDir temp_dir ;
ASSERT_TRUE ( temp_dir . CreateUniqueTempDir ( ) ) ;
MockProfileDelegate delegate ;
EXPECT_CALL ( delegate , OnProfileCreated ( testing : : NotNull ( ) , true , true ) ) ;
{
content : : WindowedNotificationObserver observer ( chrome : : NOTIFICATION_PROFILE_CREATED , content : : NotificationService : : AllSources ( ) ) ;
std : : unique_ptr < Profile > profile ( CreateProfile ( temp_dir . path ( ) , & delegate , Profile : : CREATE_MODE_ASYNCHRONOUS ) ) ;
observer . Wait ( ) ;
EXPECT_TRUE ( base : : PathExists ( temp_dir . path ( ) . Append ( chrome : : kReadmeFilename ) ) ) ;
}
FlushIoTaskRunnerAndSpinThreads ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void end_softmask ( fz_context * ctx , pdf_run_processor * pr , softmask_save * save ) {
pdf_gstate * gstate = pr -> gstate + pr -> gtop ;
if ( save -> softmask == NULL ) return ;
gstate -> softmask = save -> softmask ;
gstate -> softmask_resources = save -> page_resources ;
gstate -> softmask_ctm = save -> ctm ;
fz_pop_clip ( ctx , pr -> dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
RestoreOptions * NewRestoreOptions ( void ) {
RestoreOptions * opts ;
opts = ( RestoreOptions * ) pg_malloc0 ( sizeof ( RestoreOptions ) ) ;
opts -> format = archUnknown ;
opts -> promptPassword = TRI_DEFAULT ;
opts -> dumpSections = DUMP_UNSECTIONED ;
return opts ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const FIRSTPASS_STATS * read_frame_stats ( const TWO_PASS * p , int offset ) {
if ( ( offset >= 0 && p -> stats_in + offset >= p -> stats_in_end ) || ( offset < 0 && p -> stats_in + offset < p -> stats_in_start ) ) {
return NULL ;
}
return & p -> stats_in [ offset ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void page_init ( void ) {
# ifdef _WIN32 {
SYSTEM_INFO system_info ;
GetSystemInfo ( & system_info ) ;
qemu_real_host_page_size = system_info . dwPageSize ;
}
# else qemu_real_host_page_size = getpagesize ( ) ;
# endif if ( qemu_host_page_size == 0 ) {
qemu_host_page_size = qemu_real_host_page_size ;
}
if ( qemu_host_page_size < TARGET_PAGE_SIZE ) {
qemu_host_page_size = TARGET_PAGE_SIZE ;
}
qemu_host_page_mask = ~ ( qemu_host_page_size - 1 ) ;
# if defined ( CONFIG_BSD ) && defined ( CONFIG_USER_ONLY ) {
# ifdef HAVE_KINFO_GETVMMAP struct kinfo_vmentry * freep ;
int i , cnt ;
freep = kinfo_getvmmap ( getpid ( ) , & cnt ) ;
if ( freep ) {
mmap_lock ( ) ;
for ( i = 0 ;
i < cnt ;
i ++ ) {
unsigned long startaddr , endaddr ;
startaddr = freep [ i ] . kve_start ;
endaddr = freep [ i ] . kve_end ;
if ( h2g_valid ( startaddr ) ) {
startaddr = h2g ( startaddr ) & TARGET_PAGE_MASK ;
if ( h2g_valid ( endaddr ) ) {
endaddr = h2g ( endaddr ) ;
page_set_flags ( startaddr , endaddr , PAGE_RESERVED ) ;
}
else {
# if TARGET_ABI_BITS <= L1_MAP_ADDR_SPACE_BITS endaddr = ~ 0ul ;
page_set_flags ( startaddr , endaddr , PAGE_RESERVED ) ;
# endif }
}
}
free ( freep ) ;
mmap_unlock ( ) ;
}
# else FILE * f ;
last_brk = ( unsigned long ) sbrk ( 0 ) ;
f = fopen ( "/compat/linux/proc/self/maps" , "r" ) ;
if ( f ) {
mmap_lock ( ) ;
do {
unsigned long startaddr , endaddr ;
int n ;
n = fscanf ( f , "%lx-%lx %*[^\n]\n" , & startaddr , & endaddr ) ;
if ( n == 2 && h2g_valid ( startaddr ) ) {
startaddr = h2g ( startaddr ) & TARGET_PAGE_MASK ;
if ( h2g_valid ( endaddr ) ) {
endaddr = h2g ( endaddr ) ;
}
else {
endaddr = ~ 0ul ;
}
page_set_flags ( startaddr , endaddr , PAGE_RESERVED ) ;
}
}
while ( ! feof ( f ) ) ;
fclose ( f ) ;
mmap_unlock ( ) ;
}
# endif }
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void IGDendelt ( void * d , const char * name , int l ) {
struct IGDdatas * datas = ( struct IGDdatas * ) d ;
datas -> level -- ;
if ( ( l == 7 ) && ! memcmp ( name , "service" , l ) ) {
if ( COMPARE ( datas -> tmp . servicetype , "urn:schemas-upnp-org:service:WANCommonInterfaceConfig:" ) ) {
memcpy ( & datas -> CIF , & datas -> tmp , sizeof ( struct IGDdatas_service ) ) ;
}
else if ( COMPARE ( datas -> tmp . servicetype , "urn:schemas-upnp-org:service:WANIPv6FirewallControl:" ) ) {
memcpy ( & datas -> IPv6FC , & datas -> tmp , sizeof ( struct IGDdatas_service ) ) ;
}
else if ( COMPARE ( datas -> tmp . servicetype , "urn:schemas-upnp-org:service:WANIPConnection:" ) || COMPARE ( datas -> tmp . servicetype , "urn:schemas-upnp-org:service:WANPPPConnection:" ) ) {
if ( datas -> first . servicetype [ 0 ] == '\0' ) {
memcpy ( & datas -> first , & datas -> tmp , sizeof ( struct IGDdatas_service ) ) ;
}
else {
memcpy ( & datas -> second , & datas -> tmp , sizeof ( struct IGDdatas_service ) ) ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static StkId callrethooks ( lua_State * L , StkId firstResult ) {
ptrdiff_t fr = savestack ( L , firstResult ) ;
luaD_callhook ( L , LUA_HOOKRET , - 1 ) ;
if ( f_isLua ( L -> ci ) ) {
while ( ( L -> hookmask & LUA_MASKRET ) && L -> ci -> tailcalls -- ) luaD_callhook ( L , LUA_HOOKTAILRET , - 1 ) ;
}
return restorestack ( L , fr ) ;
}
| 0False
|
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 ) ;
ret = slice_end ( avctx , picture ) ;
if ( ret < 0 ) return ret ;
else if ( ret ) {
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 ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void xps_parse_color ( xps_document * doc , char * base_uri , char * string , fz_colorspace * * csp , float * samples ) {
fz_context * ctx = doc -> ctx ;
char * p ;
int i , n ;
char buf [ 1024 ] ;
char * profile ;
* csp = fz_device_rgb ( ctx ) ;
samples [ 0 ] = 1 ;
samples [ 1 ] = 0 ;
samples [ 2 ] = 0 ;
samples [ 3 ] = 0 ;
if ( string [ 0 ] == '#' ) {
if ( strlen ( string ) == 9 ) {
samples [ 0 ] = unhex ( string [ 1 ] ) * 16 + unhex ( string [ 2 ] ) ;
samples [ 1 ] = unhex ( string [ 3 ] ) * 16 + unhex ( string [ 4 ] ) ;
samples [ 2 ] = unhex ( string [ 5 ] ) * 16 + unhex ( string [ 6 ] ) ;
samples [ 3 ] = unhex ( string [ 7 ] ) * 16 + unhex ( string [ 8 ] ) ;
}
else {
samples [ 0 ] = 255 ;
samples [ 1 ] = unhex ( string [ 1 ] ) * 16 + unhex ( string [ 2 ] ) ;
samples [ 2 ] = unhex ( string [ 3 ] ) * 16 + unhex ( string [ 4 ] ) ;
samples [ 3 ] = unhex ( string [ 5 ] ) * 16 + unhex ( string [ 6 ] ) ;
}
samples [ 0 ] /= 255 ;
samples [ 1 ] /= 255 ;
samples [ 2 ] /= 255 ;
samples [ 3 ] /= 255 ;
}
else if ( string [ 0 ] == 's' && string [ 1 ] == 'c' && string [ 2 ] == '#' ) {
if ( count_commas ( string ) == 2 ) sscanf ( string , "sc#%g,%g,%g" , samples + 1 , samples + 2 , samples + 3 ) ;
if ( count_commas ( string ) == 3 ) sscanf ( string , "sc#%g,%g,%g,%g" , samples , samples + 1 , samples + 2 , samples + 3 ) ;
}
else if ( strstr ( string , "ContextColor " ) == string ) {
fz_strlcpy ( buf , string , sizeof buf ) ;
profile = strchr ( buf , ' ' ) ;
if ( ! profile ) {
fz_warn ( ctx , "cannot find icc profile uri in '%s'" , string ) ;
return ;
}
* profile ++ = 0 ;
p = strchr ( profile , ' ' ) ;
if ( ! p ) {
fz_warn ( ctx , "cannot find component values in '%s'" , profile ) ;
return ;
}
* p ++ = 0 ;
n = count_commas ( p ) + 1 ;
if ( n > FZ_MAX_COLORS ) {
fz_warn ( ctx , "ignoring %d color components (max %d allowed)" , n - FZ_MAX_COLORS , FZ_MAX_COLORS ) ;
n = FZ_MAX_COLORS ;
}
i = 0 ;
while ( i < n ) {
samples [ i ++ ] = fz_atof ( p ) ;
p = strchr ( p , ',' ) ;
if ( ! p ) break ;
p ++ ;
if ( * p == ' ' ) p ++ ;
}
while ( i < n ) {
samples [ i ++ ] = 0 ;
}
switch ( n ) {
case 2 : * csp = fz_device_gray ( ctx ) ;
break ;
case 4 : * csp = fz_device_rgb ( ctx ) ;
break ;
case 5 : * csp = fz_device_cmyk ( ctx ) ;
break ;
default : * csp = fz_device_gray ( ctx ) ;
break ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned int _zip_read4 ( unsigned char * * a ) {
unsigned int ret ;
ret = ( ( ( ( ( ( * a ) [ 3 ] << 8 ) + ( * a ) [ 2 ] ) << 8 ) + ( * a ) [ 1 ] ) << 8 ) + ( * a ) [ 0 ] ;
* a += 4 ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , ftruncate ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
long size ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "l" , & size ) == FAILURE ) {
return ;
}
if ( ! php_stream_truncate_supported ( intern -> u . file . stream ) ) {
zend_throw_exception_ex ( spl_ce_LogicException , 0 TSRMLS_CC , "Can't truncate file %s" , intern -> file_name ) ;
RETURN_FALSE ;
}
RETURN_BOOL ( 0 == php_stream_truncate_set_size ( intern -> u . file . stream , size ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ipvideo_decode_block_opcode_0xF ( IpvideoContext * s ) {
int x , y ;
unsigned char sample [ 2 ] ;
sample [ 0 ] = bytestream2_get_byte ( & s -> stream_ptr ) ;
sample [ 1 ] = bytestream2_get_byte ( & s -> stream_ptr ) ;
for ( y = 0 ;
y < 8 ;
y ++ ) {
for ( x = 0 ;
x < 8 ;
x += 2 ) {
* s -> pixel_ptr ++ = sample [ y & 1 ] ;
* s -> pixel_ptr ++ = sample [ ! ( y & 1 ) ] ;
}
s -> pixel_ptr += s -> line_inc ;
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_pick_filter_level ( const YV12_BUFFER_CONFIG * sd , VP9_COMP * cpi , LPF_PICK_METHOD method ) {
VP9_COMMON * const cm = & cpi -> common ;
struct loopfilter * const lf = & cm -> lf ;
lf -> sharpness_level = cm -> frame_type == KEY_FRAME ? 0 : cpi -> oxcf . sharpness ;
if ( method == LPF_PICK_MINIMAL_LPF && lf -> filter_level ) {
lf -> filter_level = 0 ;
}
else if ( method >= LPF_PICK_FROM_Q ) {
const int min_filter_level = 0 ;
const int max_filter_level = get_max_filter_level ( cpi ) ;
const int q = vp9_ac_quant ( cm -> base_qindex , 0 ) ;
int filt_guess = ROUND_POWER_OF_TWO ( q * 20723 + 1015158 , 18 ) ;
if ( cm -> frame_type == KEY_FRAME ) filt_guess -= 4 ;
lf -> filter_level = clamp ( filt_guess , min_filter_level , max_filter_level ) ;
}
else {
lf -> filter_level = search_filter_level ( sd , cpi , method == LPF_PICK_FROM_SUBIMAGE ) ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static float find_hb_gain ( AMRWBContext * ctx , const float * synth , uint16_t hb_idx , uint8_t vad ) {
int wsp = ( vad > 0 ) ;
float tilt ;
if ( ctx -> fr_cur_mode == MODE_23k85 ) return qua_hb_gain [ hb_idx ] * ( 1.0f / ( 1 << 14 ) ) ;
tilt = avpriv_scalarproduct_float_c ( synth , synth + 1 , AMRWB_SFR_SIZE - 1 ) / avpriv_scalarproduct_float_c ( synth , synth , AMRWB_SFR_SIZE ) ;
return av_clipf ( ( 1.0 - FFMAX ( 0.0 , tilt ) ) * ( 1.25 - 0.25 * wsp ) , 0.1 , 1.0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
inline static void _slurm_rpc_accounting_first_reg ( slurm_msg_t * msg ) {
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
time_t event_time = time ( NULL ) ;
DEF_TIMERS ;
START_TIMER ;
debug2 ( "Processing RPC: ACCOUNTING_FIRST_REG from uid=%d" , uid ) ;
if ( ! validate_super_user ( uid ) ) {
error ( "First Registration request from non-super user uid=%d" , uid ) ;
return ;
}
send_all_to_accounting ( event_time , ACCOUNTING_FIRST_REG ) ;
END_TIMER2 ( "_slurm_rpc_accounting_first_reg" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * unescape_word ( struct Curl_easy * data , const char * inputbuff ) {
char * newp ;
char * dictp ;
char * ptr ;
int len ;
char ch ;
int olen = 0 ;
newp = curl_easy_unescape ( data , inputbuff , 0 , & len ) ;
if ( ! newp ) return NULL ;
dictp = malloc ( ( ( size_t ) len ) * 2 + 1 ) ;
if ( dictp ) {
for ( ptr = newp ;
( ch = * ptr ) != 0 ;
ptr ++ ) {
if ( ( ch <= 32 ) || ( ch == 127 ) || ( ch == '\'' ) || ( ch == '\"' ) || ( ch == '\\' ) ) {
dictp [ olen ++ ] = '\\' ;
}
dictp [ olen ++ ] = ch ;
}
dictp [ olen ] = 0 ;
}
free ( newp ) ;
return dictp ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean protocol_is_alljoyn_message ( tvbuff_t * tvb , gint offset , gboolean is_ardp ) {
gint length = tvb_captured_length ( tvb ) ;
if ( length < offset + 1 ) return FALSE ;
if ( ! is_ardp ) {
if ( tvb_get_guint8 ( tvb , offset ) == 0 ) return TRUE ;
if ( find_sasl_command ( tvb , offset ) != NULL ) return TRUE ;
}
if ( get_message_header_endianness ( tvb , offset ) == ENC_ALLJOYN_BAD_ENCODING ) return FALSE ;
if ( ( length < offset + 2 ) || ( try_val_to_str ( tvb_get_guint8 ( tvb , offset + 1 ) , message_header_encoding_vals ) == NULL ) ) return FALSE ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static GList * get_file_list_for_launch_locations ( GList * locations ) {
GList * files , * l ;
LaunchLocation * location ;
files = NULL ;
for ( l = locations ;
l != NULL ;
l = l -> next ) {
location = l -> data ;
files = g_list_prepend ( files , nautilus_file_ref ( location -> file ) ) ;
}
return g_list_reverse ( files ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * proto_tree_add_uint64_format_value ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start , gint length , guint64 value , const char * format , ... ) {
proto_item * pi ;
va_list ap ;
pi = proto_tree_add_uint64 ( tree , hfindex , tvb , start , length , value ) ;
if ( pi != tree ) {
va_start ( ap , format ) ;
proto_tree_set_representation_value ( pi , format , ap ) ;
va_end ( ap ) ;
}
return pi ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
REGRESSION_TEST ( SDK_API_TSMimeHdrParse ) ( RegressionTest * test , int , int * pstatus ) {
const char * parse_string = "field1:field1Value1,field1Value2\r\nfield2:10,-34,45\r\nfield3:field3Value1,23\r\nfield2: 2345, field2Value2\r\n\r\n" ;
const char * DUPLICATE_FIELD_NAME = "field2" ;
const char * REMOVE_FIELD_NAME = "field3" ;
TSMimeParser parser ;
TSMBuffer bufp1 = ( TSMBuffer ) nullptr ;
TSMBuffer bufp2 = ( TSMBuffer ) nullptr ;
TSMBuffer bufp3 = ( TSMBuffer ) nullptr ;
TSMLoc mime_hdr_loc1 = ( TSMLoc ) nullptr ;
TSMLoc mime_hdr_loc2 = ( TSMLoc ) nullptr ;
TSMLoc mime_hdr_loc3 = ( TSMLoc ) nullptr ;
TSMLoc field_loc1 = ( TSMLoc ) nullptr ;
TSMLoc field_loc2 = ( TSMLoc ) nullptr ;
const char * start ;
const char * end ;
char * temp ;
TSParseResult retval ;
int hdrLength ;
bool test_passed_parser_create = false ;
bool test_passed_parse = false ;
bool test_passed_parser_clear = false ;
bool test_passed_parser_destroy = false ;
bool test_passed_mime_hdr_print = false ;
bool test_passed_mime_hdr_length_get = false ;
bool test_passed_mime_hdr_field_next_dup = false ;
bool test_passed_mime_hdr_copy = false ;
bool test_passed_mime_hdr_clone = false ;
bool test_passed_mime_hdr_field_remove = false ;
bool test_passed_mime_hdr_field_copy = false ;
bool test_passed_mime_hdr_field_copy_values = false ;
bool test_passed_handle_mloc_release = false ;
bool test_passed_mime_hdr_field_find = false ;
parser = TSMimeParserCreate ( ) ;
SDK_RPRINT ( test , "TSMimeParserCreate" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_parser_create = true ;
if ( test_passed_parser_create == true ) {
bufp1 = TSMBufferCreate ( ) ;
if ( TSMimeHdrCreate ( bufp1 , & mime_hdr_loc1 ) != TS_SUCCESS ) {
SDK_RPRINT ( test , "TSMimeHdrParse" , "TestCase1" , TC_FAIL , "Cannot create Mime hdr for parsing" ) ;
SDK_RPRINT ( test , "TSMimeHdrPrint" , "TestCase1" , TC_FAIL , "Cannot run test as unable to create Mime Header for parsing" ) ;
SDK_RPRINT ( test , "TSMimeHdrLengthGet" , "TestCase1" , TC_FAIL , "Cannot run test as unable to create Mime Header for parsing" ) ;
if ( TSMBufferDestroy ( bufp1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrParse" , "TestCase1" , TC_FAIL , "Error in Destroying MBuffer" ) ;
}
}
else {
start = parse_string ;
end = parse_string + strlen ( parse_string ) + 1 ;
if ( ( retval = TSMimeHdrParse ( parser , bufp1 , mime_hdr_loc1 , & start , end ) ) == TS_PARSE_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrParse" , "TestCase1" , TC_FAIL , "TSMimeHdrParse returns TS_PARSE_ERROR" ) ;
SDK_RPRINT ( test , "TSMimeHdrPrint" , "TestCase1" , TC_FAIL , "Cannot run test as TSMimeHdrParse returned Error." ) ;
SDK_RPRINT ( test , "TSMimeHdrLengthGet" , "TestCase1" , TC_FAIL , "Cannot run test as TSMimeHdrParse returned Error." ) ;
}
else {
if ( retval == TS_PARSE_DONE ) {
temp = convert_mime_hdr_to_string ( bufp1 , mime_hdr_loc1 ) ;
if ( strcmp ( parse_string , temp ) == 0 ) {
SDK_RPRINT ( test , "TSMimeHdrParse" , "TestCase1" , TC_PASS , "ok" ) ;
SDK_RPRINT ( test , "TSMimeHdrPrint" , "TestCase1" , TC_PASS , "ok" ) ;
hdrLength = TSMimeHdrLengthGet ( bufp1 , mime_hdr_loc1 ) ;
if ( hdrLength == ( int ) strlen ( temp ) ) {
SDK_RPRINT ( test , "TSMimeHdrLengthGet" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_mime_hdr_length_get = true ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrLengthGet" , "TestCase1" , TC_FAIL , "Value's Mismatch" ) ;
}
test_passed_parse = true ;
test_passed_mime_hdr_print = true ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrParse|TSMimeHdrPrint" , "TestCase1" , TC_FAIL , "Incorrect parsing or incorrect Printing" ) ;
SDK_RPRINT ( test , "TSMimeHdrLengthGet" , "TestCase1" , TC_FAIL , "Cannot run test as TSMimeHdrParse|TSMimeHdrPrint failed." ) ;
}
TSfree ( temp ) ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrParse" , "TestCase1" , TC_FAIL , "Parsing Error" ) ;
SDK_RPRINT ( test , "TSMimeHdrPrint" , "TestCase1" , TC_FAIL , "Cannot run test as TSMimeHdrParse returned error." ) ;
SDK_RPRINT ( test , "TSMimeHdrLengthGet" , "TestCase1" , TC_FAIL , "Cannot run test as TSMimeHdrParse returned error." ) ;
}
}
}
}
else {
SDK_RPRINT ( test , "TSMimeHdrParse" , "TestCase1" , TC_FAIL , "Cannot run test as unable to create a parser" ) ;
SDK_RPRINT ( test , "TSMimeHdrPrint" , "TestCase1" , TC_FAIL , "Cannot run test as unable to create a parser" ) ;
SDK_RPRINT ( test , "TSMimeHdrLengthGet" , "TestCase1" , TC_FAIL , "Cannot run test as unable to create a parser" ) ;
}
if ( test_passed_parser_create == true ) {
TSMimeParserClear ( parser ) ;
SDK_RPRINT ( test , "TSMimeParserClear" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_parser_clear = true ;
}
else {
SDK_RPRINT ( test , "TSMimeParserClear" , "TestCase1" , TC_FAIL , "Cannot run test as unable to create a parser" ) ;
}
if ( test_passed_parser_create == true ) {
TSMimeParserDestroy ( parser ) ;
SDK_RPRINT ( test , "TSMimeParserDestroy" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_parser_destroy = true ;
}
else {
SDK_RPRINT ( test , "TSMimeParserDestroy" , "TestCase1" , TC_FAIL , "Cannot run test as unable to create a parser" ) ;
}
if ( test_passed_parse == true ) {
if ( ( field_loc1 = TSMimeHdrFieldFind ( bufp1 , mime_hdr_loc1 , DUPLICATE_FIELD_NAME , - 1 ) ) == TS_NULL_MLOC ) {
SDK_RPRINT ( test , "TSMimeHdrFieldNextDup" , "TestCase1" , TC_FAIL , "TSMimeHdrFieldFind returns TS_NULL_MLOC" ) ;
SDK_RPRINT ( test , "TSMimeHdrFieldFind" , "TestCase1" , TC_PASS , "TSMimeHdrFieldFind returns TS_NULL_MLOC" ) ;
}
else {
const char * fieldName ;
int length ;
fieldName = TSMimeHdrFieldNameGet ( bufp1 , mime_hdr_loc1 , field_loc1 , & length ) ;
if ( strncmp ( fieldName , DUPLICATE_FIELD_NAME , length ) == 0 ) {
SDK_RPRINT ( test , "TSMimeHdrFieldFind" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_mime_hdr_field_find = true ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldFind" , "TestCase1" , TC_PASS , "TSMimeHdrFieldFind returns incorrect field pointer" ) ;
}
field_loc2 = TSMimeHdrFieldNextDup ( bufp1 , mime_hdr_loc1 , field_loc1 ) ;
if ( compare_field_names ( test , bufp1 , mime_hdr_loc1 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrFieldNextDup" , "TestCase1" , TC_FAIL , "Incorrect Pointer" ) ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldNextDup" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_mime_hdr_field_next_dup = true ;
}
if ( TSHandleMLocRelease ( bufp1 , mime_hdr_loc1 , field_loc1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase1" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_handle_mloc_release = true ;
}
if ( field_loc2 != nullptr ) {
if ( TSHandleMLocRelease ( bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase2" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase2" , TC_PASS , "ok" ) ;
}
}
}
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldNext" , "TestCase1" , TC_FAIL , "Unable to run test as parsing failed." ) ;
}
if ( test_passed_parse == true ) {
bufp2 = TSMBufferCreate ( ) ;
if ( TSMimeHdrCreate ( bufp2 , & mime_hdr_loc2 ) != TS_SUCCESS ) {
SDK_RPRINT ( test , "TSMimeHdrCopy" , "TestCase1" , TC_FAIL , "Cannot create Mime hdr for copying" ) ;
if ( TSMBufferDestroy ( bufp2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrCopy" , "TestCase1" , TC_FAIL , "Error in Destroying MBuffer" ) ;
}
}
else {
if ( TSMimeHdrCopy ( bufp2 , mime_hdr_loc2 , bufp1 , mime_hdr_loc1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrCopy" , "TestCase1" , TC_FAIL , "TSMimeHdrCopy returns TS_ERROR" ) ;
}
else {
temp = convert_mime_hdr_to_string ( bufp2 , mime_hdr_loc2 ) ;
if ( strcmp ( parse_string , temp ) == 0 ) {
SDK_RPRINT ( test , "TSMimeHdrCopy" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_mime_hdr_copy = true ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrCopy" , "TestCase1" , TC_FAIL , "Value's Mismatch" ) ;
}
TSfree ( temp ) ;
}
}
}
else {
SDK_RPRINT ( test , "TSMimeHdrCopy" , "TestCase1" , TC_FAIL , "Unable to run test as parsing failed." ) ;
}
bufp3 = TSMBufferCreate ( ) ;
TSMimeHdrCreate ( bufp3 , & mime_hdr_loc3 ) ;
test_passed_mime_hdr_clone = true ;
if ( test_passed_mime_hdr_copy == true ) {
if ( ( field_loc1 = TSMimeHdrFieldFind ( bufp2 , mime_hdr_loc2 , REMOVE_FIELD_NAME , - 1 ) ) == TS_NULL_MLOC ) {
SDK_RPRINT ( test , "TSMimeHdrFieldRemove" , "TestCase1" , TC_FAIL , "TSMimeHdrFieldFind returns TS_NULL_MLOC" ) ;
}
else {
if ( TSMimeHdrFieldRemove ( bufp2 , mime_hdr_loc2 , field_loc1 ) != TS_SUCCESS ) {
SDK_RPRINT ( test , "TSMimeHdrFieldRemove" , "TestCase1" , TC_FAIL , "TSMimeHdrFieldRemove returns TS_ERROR" ) ;
}
else {
field_loc2 = TSMimeHdrFieldFind ( bufp2 , mime_hdr_loc2 , REMOVE_FIELD_NAME , - 1 ) ;
if ( ( field_loc2 == TS_NULL_MLOC ) || ( field_loc1 != field_loc2 ) ) {
test_passed_mime_hdr_field_remove = true ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldRemove" , "TestCase1" , TC_FAIL , "Field Not Removed" ) ;
}
if ( test_passed_mime_hdr_field_remove == true ) {
if ( TSMimeHdrFieldAppend ( bufp2 , mime_hdr_loc2 , field_loc1 ) != TS_SUCCESS ) {
SDK_RPRINT ( test , "TSMimeHdrFieldRemove" , "TestCase1" , TC_FAIL , "Unable to readd the field to mime header. Probably destroyed" ) ;
test_passed_mime_hdr_field_remove = false ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldRemove" , "TestCase1" , TC_PASS , "ok" ) ;
}
}
}
if ( TSHandleMLocRelease ( bufp2 , mime_hdr_loc2 , field_loc1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase3" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase3" , TC_PASS , "ok" ) ;
}
if ( field_loc2 != nullptr ) {
if ( TSHandleMLocRelease ( bufp2 , mime_hdr_loc2 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase4" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase4" , TC_PASS , "ok" ) ;
}
}
}
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldNext" , "TestCase1" , TC_FAIL , "Unable to run test as parsing failed." ) ;
}
if ( test_passed_mime_hdr_copy == true ) {
if ( TSMimeHdrFieldCreate ( bufp2 , mime_hdr_loc2 , & field_loc1 ) != TS_SUCCESS ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopy" , "TestCase1" , TC_FAIL , "Unable to create field for Copying" ) ;
}
else {
if ( ( field_loc2 = TSMimeHdrFieldGet ( bufp1 , mime_hdr_loc1 , 0 ) ) == TS_NULL_MLOC ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopy" , "TestCase1" , TC_FAIL , "Unable to get source field for copying" ) ;
}
else {
if ( TSMimeHdrFieldCopy ( bufp2 , mime_hdr_loc2 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopy" , "TestCase1" , TC_FAIL , "TSMimeHdrFieldCopy returns TS_ERROR" ) ;
}
else {
if ( ( compare_field_names ( test , bufp2 , mime_hdr_loc2 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) || ( compare_field_values ( test , bufp2 , mime_hdr_loc2 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopy" , "TestCase1" , TC_FAIL , "Value's Mismatch" ) ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldCopy" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_mime_hdr_field_copy = true ;
}
}
}
if ( TSHandleMLocRelease ( bufp2 , mime_hdr_loc2 , field_loc1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase5" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase5" , TC_PASS , "ok" ) ;
}
if ( field_loc2 != nullptr ) {
if ( TSHandleMLocRelease ( bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase6" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase6" , TC_PASS , "ok" ) ;
}
}
}
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldCopy" , "TestCase1" , TC_FAIL , "Unable to run test as bufp2 might not have been created" ) ;
}
if ( test_passed_mime_hdr_clone == true ) {
field_loc1 = nullptr ;
field_loc2 = nullptr ;
if ( ( field_loc2 = TSMimeHdrFieldGet ( bufp1 , mime_hdr_loc1 , 0 ) ) == TS_NULL_MLOC ) {
SDK_RPRINT ( test , "TSMimeHdrFieldClone" , "TestCase1" , TC_FAIL , "Unable to get source field for copying" ) ;
}
else {
if ( TSMimeHdrFieldClone ( bufp3 , mime_hdr_loc3 , bufp1 , mime_hdr_loc1 , field_loc2 , & field_loc1 ) != TS_SUCCESS ) {
SDK_RPRINT ( test , "TSMimeHdrFieldClone" , "TestCase1" , TC_FAIL , "TSMimeHdrFieldClone returns TS_ERROR" ) ;
}
else {
if ( ( compare_field_names ( test , bufp3 , mime_hdr_loc3 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) || ( compare_field_values ( test , bufp3 , mime_hdr_loc3 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) ) {
SDK_RPRINT ( test , "TSMimeHdrFieldClone" , "TestCase1" , TC_FAIL , "Value's Mismatch" ) ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldClone" , "TestCase1" , TC_PASS , "ok" ) ;
}
}
}
if ( field_loc1 != nullptr ) {
if ( TSHandleMLocRelease ( bufp3 , mime_hdr_loc3 , field_loc1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase7" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase7" , TC_PASS , "ok" ) ;
}
}
if ( field_loc2 != nullptr ) {
if ( TSHandleMLocRelease ( bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase8" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase8" , TC_PASS , "ok" ) ;
}
}
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldClone" , "TestCase1" , TC_FAIL , "Unable to run test as bufp3 might not have been created" ) ;
}
if ( test_passed_mime_hdr_copy == true ) {
if ( TSMimeHdrFieldCreate ( bufp2 , mime_hdr_loc2 , & field_loc1 ) != TS_SUCCESS ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopyValues" , "TestCase1" , TC_FAIL , "Unable to create field for Copying" ) ;
}
else {
if ( ( field_loc2 = TSMimeHdrFieldGet ( bufp1 , mime_hdr_loc1 , 0 ) ) == TS_NULL_MLOC ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopyValues" , "TestCase1" , TC_FAIL , "Unable to get source field for copying" ) ;
}
else {
if ( TSMimeHdrFieldCopyValues ( bufp2 , mime_hdr_loc2 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopyValues" , "TestCase1" , TC_FAIL , "TSMimeHdrFieldCopy returns TS_ERROR" ) ;
}
else {
if ( compare_field_values ( test , bufp2 , mime_hdr_loc2 , field_loc1 , bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSMimeHdrFieldCopyValues" , "TestCase1" , TC_FAIL , "Value's Mismatch" ) ;
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldCopyValues" , "TestCase1" , TC_PASS , "ok" ) ;
test_passed_mime_hdr_field_copy_values = true ;
}
}
}
if ( TSHandleMLocRelease ( bufp2 , mime_hdr_loc2 , field_loc1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase9" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase9" , TC_PASS , "ok" ) ;
}
if ( field_loc2 != nullptr ) {
if ( TSHandleMLocRelease ( bufp1 , mime_hdr_loc1 , field_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase10" , TC_FAIL , "TSHandleMLocRelease returns TS_ERROR" ) ;
test_passed_handle_mloc_release = false ;
}
else {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase10" , TC_PASS , "ok" ) ;
}
}
}
}
else {
SDK_RPRINT ( test , "TSMimeHdrFieldCopy" , "TestCase1" , TC_FAIL , "Unable to run test as bufp2 might not have been created" ) ;
}
if ( ( TSMimeHdrDestroy ( bufp1 , mime_hdr_loc1 ) == TS_ERROR ) || ( TSMimeHdrDestroy ( bufp2 , mime_hdr_loc2 ) == TS_ERROR ) || ( TSMimeHdrDestroy ( bufp3 , mime_hdr_loc3 ) == TS_ERROR ) ) {
SDK_RPRINT ( test , "" , "TestCase" , TC_FAIL , "TSMimeHdrDestroy returns TS_ERROR" ) ;
}
if ( TSHandleMLocRelease ( bufp1 , TS_NULL_MLOC , mime_hdr_loc1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase11|12|13" , TC_FAIL , "Unable to release mime_hdr_loc1 to Mime Hdrs" ) ;
test_passed_handle_mloc_release = false ;
}
if ( TSHandleMLocRelease ( bufp2 , TS_NULL_MLOC , mime_hdr_loc2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase11|12|13" , TC_FAIL , "Unable to release mime_hdr_loc2 to Mime Hdrs" ) ;
test_passed_handle_mloc_release = false ;
}
if ( TSHandleMLocRelease ( bufp3 , TS_NULL_MLOC , mime_hdr_loc3 ) == TS_ERROR ) {
SDK_RPRINT ( test , "TSHandleMLocRelease" , "TestCase11|12|13" , TC_FAIL , "Unable to release mime_hdr_loc3 to Mime Hdrs" ) ;
test_passed_handle_mloc_release = false ;
}
if ( TSMBufferDestroy ( bufp1 ) == TS_ERROR ) {
SDK_RPRINT ( test , "" , "TestCase" , TC_FAIL , "TSMBufferDestroy(bufp1) returns TS_ERROR" ) ;
}
if ( TSMBufferDestroy ( bufp2 ) == TS_ERROR ) {
SDK_RPRINT ( test , "" , "TestCase" , TC_FAIL , "TSMBufferDestroy(bufp2) returns TS_ERROR" ) ;
}
if ( TSMBufferDestroy ( bufp3 ) == TS_ERROR ) {
SDK_RPRINT ( test , "" , "TestCase" , TC_FAIL , "TSMBufferDestroy(bufp3) returns TS_ERROR" ) ;
}
if ( ( test_passed_parser_create != true ) || ( test_passed_parse != true ) || ( test_passed_parser_clear != true ) || ( test_passed_parser_destroy != true ) || ( test_passed_mime_hdr_print != true ) || ( test_passed_mime_hdr_length_get != true ) || ( test_passed_mime_hdr_field_next_dup != true ) || ( test_passed_mime_hdr_copy != true ) || ( test_passed_mime_hdr_clone != true ) || ( test_passed_mime_hdr_field_remove != true ) || ( test_passed_mime_hdr_field_copy != true ) || ( test_passed_mime_hdr_field_copy_values != true ) || ( test_passed_handle_mloc_release != true ) || ( test_passed_mime_hdr_field_find != true ) ) {
* pstatus = REGRESSION_TEST_FAILED ;
}
else {
* pstatus = REGRESSION_TEST_PASSED ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int SpoolssSetForm_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) {
proto_item * hidden_item ;
hidden_item = proto_tree_add_uint ( tree , hf_form , tvb , offset , 0 , 1 ) ;
PROTO_ITEM_SET_HIDDEN ( hidden_item ) ;
offset = dissect_doserror ( tvb , offset , pinfo , tree , di , drep , hf_rc , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static Datum ExecEvalRowCompare ( RowCompareExprState * rstate , ExprContext * econtext , bool * isNull , ExprDoneCond * isDone ) {
bool result ;
RowCompareType rctype = ( ( RowCompareExpr * ) rstate -> xprstate . expr ) -> rctype ;
int32 cmpresult = 0 ;
ListCell * l ;
ListCell * r ;
int i ;
if ( isDone ) * isDone = ExprSingleResult ;
* isNull = true ;
i = 0 ;
forboth ( l , rstate -> largs , r , rstate -> rargs ) {
ExprState * le = ( ExprState * ) lfirst ( l ) ;
ExprState * re = ( ExprState * ) lfirst ( r ) ;
FunctionCallInfoData locfcinfo ;
InitFunctionCallInfoData ( locfcinfo , & ( rstate -> funcs [ i ] ) , 2 , rstate -> collations [ i ] , NULL , NULL ) ;
locfcinfo . arg [ 0 ] = ExecEvalExpr ( le , econtext , & locfcinfo . argnull [ 0 ] , NULL ) ;
locfcinfo . arg [ 1 ] = ExecEvalExpr ( re , econtext , & locfcinfo . argnull [ 1 ] , NULL ) ;
if ( rstate -> funcs [ i ] . fn_strict && ( locfcinfo . argnull [ 0 ] || locfcinfo . argnull [ 1 ] ) ) return ( Datum ) 0 ;
locfcinfo . isnull = false ;
cmpresult = DatumGetInt32 ( FunctionCallInvoke ( & locfcinfo ) ) ;
if ( locfcinfo . isnull ) return ( Datum ) 0 ;
if ( cmpresult != 0 ) break ;
i ++ ;
}
switch ( rctype ) {
case ROWCOMPARE_LT : result = ( cmpresult < 0 ) ;
break ;
case ROWCOMPARE_LE : result = ( cmpresult <= 0 ) ;
break ;
case ROWCOMPARE_GE : result = ( cmpresult >= 0 ) ;
break ;
case ROWCOMPARE_GT : result = ( cmpresult > 0 ) ;
break ;
default : elog ( ERROR , "unrecognized RowCompareType: %d" , ( int ) rctype ) ;
result = 0 ;
break ;
}
* isNull = false ;
return BoolGetDatum ( result ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void startoutput ( void ) {
out_chars = 0 ;
out_linecount = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void sig_server_disconnected ( SERVER_REC * server ) {
MODULE_SERVER_REC * mserver ;
g_return_if_fail ( server != NULL ) ;
mserver = MODULE_DATA ( server ) ;
while ( mserver -> lastmsgs ) last_msg_destroy ( & mserver -> lastmsgs , mserver -> lastmsgs -> data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int h264_set_parameter_from_sps ( H264Context * h ) {
if ( h -> flags & CODEC_FLAG_LOW_DELAY || ( h -> sps . bitstream_restriction_flag && ! h -> sps . num_reorder_frames ) ) {
if ( h -> avctx -> has_b_frames > 1 || h -> delayed_pic [ 0 ] ) av_log ( h -> avctx , AV_LOG_WARNING , "Delayed frames seen. " "Reenabling low delay requires a codec flush.\n" ) ;
else h -> low_delay = 1 ;
}
if ( h -> avctx -> has_b_frames < 2 ) h -> avctx -> has_b_frames = ! h -> low_delay ;
if ( h -> sps . bit_depth_luma != h -> sps . bit_depth_chroma ) {
avpriv_request_sample ( h -> avctx , "Different chroma and luma bit depth" ) ;
return AVERROR_PATCHWELCOME ;
}
if ( h -> avctx -> bits_per_raw_sample != h -> sps . bit_depth_luma || h -> cur_chroma_format_idc != h -> sps . chroma_format_idc ) {
if ( h -> avctx -> codec && h -> avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU && ( h -> sps . bit_depth_luma != 8 || h -> sps . chroma_format_idc > 1 ) ) {
av_log ( h -> avctx , AV_LOG_ERROR , "VDPAU decoding does not support video colorspace.\n" ) ;
return AVERROR_INVALIDDATA ;
}
if ( h -> sps . bit_depth_luma >= 8 && h -> sps . bit_depth_luma <= 14 && h -> sps . bit_depth_luma != 11 && h -> sps . bit_depth_luma != 13 ) {
h -> avctx -> bits_per_raw_sample = h -> sps . bit_depth_luma ;
h -> cur_chroma_format_idc = h -> sps . chroma_format_idc ;
h -> pixel_shift = h -> sps . bit_depth_luma > 8 ;
ff_h264dsp_init ( & h -> h264dsp , h -> sps . bit_depth_luma , h -> sps . chroma_format_idc ) ;
ff_h264chroma_init ( & h -> h264chroma , h -> sps . bit_depth_chroma ) ;
ff_h264qpel_init ( & h -> h264qpel , h -> sps . bit_depth_luma ) ;
ff_h264_pred_init ( & h -> hpc , h -> avctx -> codec_id , h -> sps . bit_depth_luma , h -> sps . chroma_format_idc ) ;
if ( CONFIG_ERROR_RESILIENCE ) ff_dsputil_init ( & h -> dsp , h -> avctx ) ;
ff_videodsp_init ( & h -> vdsp , h -> sps . bit_depth_luma ) ;
}
else {
av_log ( h -> avctx , AV_LOG_ERROR , "Unsupported bit depth: %d\n" , h -> sps . bit_depth_luma ) ;
return AVERROR_INVALIDDATA ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void http_readcb ( struct bufferevent * bev , void * arg ) {
const char * what = "This is funny" ;
event_debug ( ( "%s: %s\n" , __func__ , EVBUFFER_DATA ( bev -> input ) ) ) ;
if ( evbuffer_find ( bev -> input , ( const unsigned char * ) what , strlen ( what ) ) != NULL ) {
struct evhttp_request * req = evhttp_request_new ( NULL , NULL ) ;
enum message_read_status done ;
req -> kind = EVHTTP_RESPONSE ;
done = evhttp_parse_firstline ( req , bev -> input ) ;
if ( done != ALL_DATA_READ ) goto out ;
done = evhttp_parse_headers ( req , bev -> input ) ;
if ( done != ALL_DATA_READ ) goto out ;
if ( done == 1 && evhttp_find_header ( req -> input_headers , "Content-Type" ) != NULL ) test_ok ++ ;
out : evhttp_request_free ( req ) ;
bufferevent_disable ( bev , EV_READ ) ;
if ( base ) event_base_loopexit ( base , NULL ) ;
else event_loopexit ( NULL ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_g ( fz_context * ctx , pdf_processor * proc , float g ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pr -> dev -> flags &= ~ FZ_DEVFLAG_FILLCOLOR_UNDEFINED ;
pdf_set_colorspace ( ctx , pr , PDF_FILL , fz_device_gray ( ctx ) ) ;
pdf_set_color ( ctx , pr , PDF_FILL , & g ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_convolve8_c ( const uint8_t * src , ptrdiff_t src_stride , uint8_t * dst , ptrdiff_t dst_stride , const int16_t * filter_x , int x_step_q4 , const int16_t * filter_y , int y_step_q4 , int w , int h ) {
const InterpKernel * const filters_x = get_filter_base ( filter_x ) ;
const int x0_q4 = get_filter_offset ( filter_x , filters_x ) ;
const InterpKernel * const filters_y = get_filter_base ( filter_y ) ;
const int y0_q4 = get_filter_offset ( filter_y , filters_y ) ;
convolve ( src , src_stride , dst , dst_stride , filters_x , x0_q4 , x_step_q4 , filters_y , y0_q4 , y_step_q4 , w , h ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int kvm_handle_debug ( X86CPU * cpu , struct kvm_debug_exit_arch * arch_info ) {
CPUState * cs = CPU ( cpu ) ;
CPUX86State * env = & cpu -> env ;
int ret = 0 ;
int n ;
if ( arch_info -> exception == 1 ) {
if ( arch_info -> dr6 & ( 1 << 14 ) ) {
if ( cs -> singlestep_enabled ) {
ret = EXCP_DEBUG ;
}
}
else {
for ( n = 0 ;
n < 4 ;
n ++ ) {
if ( arch_info -> dr6 & ( 1 << n ) ) {
switch ( ( arch_info -> dr7 >> ( 16 + n * 4 ) ) & 0x3 ) {
case 0x0 : ret = EXCP_DEBUG ;
break ;
case 0x1 : ret = EXCP_DEBUG ;
cs -> watchpoint_hit = & hw_watchpoint ;
hw_watchpoint . vaddr = hw_breakpoint [ n ] . addr ;
hw_watchpoint . flags = BP_MEM_WRITE ;
break ;
case 0x3 : ret = EXCP_DEBUG ;
cs -> watchpoint_hit = & hw_watchpoint ;
hw_watchpoint . vaddr = hw_breakpoint [ n ] . addr ;
hw_watchpoint . flags = BP_MEM_ACCESS ;
break ;
}
}
}
}
}
else if ( kvm_find_sw_breakpoint ( cs , arch_info -> pc ) ) {
ret = EXCP_DEBUG ;
}
if ( ret == 0 ) {
cpu_synchronize_state ( cs ) ;
assert ( env -> exception_injected == - 1 ) ;
env -> exception_injected = arch_info -> exception ;
env -> has_error_code = 0 ;
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int match_section ( const char * section_name , int show_all_entries , AVDictionary * entries ) {
int i , ret = 0 ;
for ( i = 0 ;
i < FF_ARRAY_ELEMS ( sections ) ;
i ++ ) {
const struct section * section = & sections [ i ] ;
if ( ! strcmp ( section_name , section -> name ) || ( section -> unique_name && ! strcmp ( section_name , section -> unique_name ) ) ) {
av_log ( NULL , AV_LOG_DEBUG , "'%s' matches section with unique name '%s'\n" , section_name , ( char * ) av_x_if_null ( section -> unique_name , section -> name ) ) ;
ret ++ ;
mark_section_show_entries ( section -> id , show_all_entries , entries ) ;
}
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( PageLoadMetricsBrowserTest , UseCounterAnimatedCSSPropertiesInMainFrame ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
auto waiter = CreatePageLoadMetricsWaiter ( ) ;
waiter -> AddPageExpectation ( TimingField : : LOAD_EVENT ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , embedded_test_server ( ) -> GetURL ( "/page_load_metrics/use_counter_features.html" ) ) ;
waiter -> Wait ( ) ;
NavigateToUntrackedUrl ( ) ;
histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , 161 , 1 ) ;
histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , 91 , 1 ) ;
histogram_tester_ . ExpectBucketCount ( internal : : kAnimatedCssPropertiesHistogramName , blink : : mojom : : kTotalPagesMeasuredCSSSampleId , 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dct_quantize_trellis_c ( MpegEncContext * s , int16_t * block , int n , int qscale , int * overflow ) {
const int * qmat ;
const uint8_t * scantable = s -> intra_scantable . scantable ;
const uint8_t * perm_scantable = s -> intra_scantable . permutated ;
int max = 0 ;
unsigned int threshold1 , threshold2 ;
int bias = 0 ;
int run_tab [ 65 ] ;
int level_tab [ 65 ] ;
int score_tab [ 65 ] ;
int survivor [ 65 ] ;
int survivor_count ;
int last_run = 0 ;
int last_level = 0 ;
int last_score = 0 ;
int last_i ;
int coeff [ 2 ] [ 64 ] ;
int coeff_count [ 64 ] ;
int qmul , qadd , start_i , last_non_zero , i , dc ;
const int esc_length = s -> ac_esc_length ;
uint8_t * length ;
uint8_t * last_length ;
const int lambda = s -> lambda2 >> ( FF_LAMBDA_SHIFT - 6 ) ;
s -> dsp . fdct ( block ) ;
if ( s -> dct_error_sum ) s -> denoise_dct ( s , block ) ;
qmul = qscale * 16 ;
qadd = ( ( qscale - 1 ) | 1 ) * 8 ;
if ( s -> mb_intra ) {
int q ;
if ( ! s -> h263_aic ) {
if ( n < 4 ) q = s -> y_dc_scale ;
else q = s -> c_dc_scale ;
q = q << 3 ;
}
else {
q = 1 << 3 ;
qadd = 0 ;
}
block [ 0 ] = ( block [ 0 ] + ( q >> 1 ) ) / q ;
start_i = 1 ;
last_non_zero = 0 ;
qmat = s -> q_intra_matrix [ qscale ] ;
if ( s -> mpeg_quant || s -> out_format == FMT_MPEG1 ) bias = 1 << ( QMAT_SHIFT - 1 ) ;
length = s -> intra_ac_vlc_length ;
last_length = s -> intra_ac_vlc_last_length ;
}
else {
start_i = 0 ;
last_non_zero = - 1 ;
qmat = s -> q_inter_matrix [ qscale ] ;
length = s -> inter_ac_vlc_length ;
last_length = s -> inter_ac_vlc_last_length ;
}
last_i = start_i ;
threshold1 = ( 1 << QMAT_SHIFT ) - bias - 1 ;
threshold2 = ( threshold1 << 1 ) ;
for ( i = 63 ;
i >= start_i ;
i -- ) {
const int j = scantable [ i ] ;
int level = block [ j ] * qmat [ j ] ;
if ( ( ( unsigned ) ( level + threshold1 ) ) > threshold2 ) {
last_non_zero = i ;
break ;
}
}
for ( i = start_i ;
i <= last_non_zero ;
i ++ ) {
const int j = scantable [ i ] ;
int level = block [ j ] * qmat [ j ] ;
if ( ( ( unsigned ) ( level + threshold1 ) ) > threshold2 ) {
if ( level > 0 ) {
level = ( bias + level ) >> QMAT_SHIFT ;
coeff [ 0 ] [ i ] = level ;
coeff [ 1 ] [ i ] = level - 1 ;
}
else {
level = ( bias - level ) >> QMAT_SHIFT ;
coeff [ 0 ] [ i ] = - level ;
coeff [ 1 ] [ i ] = - level + 1 ;
}
coeff_count [ i ] = FFMIN ( level , 2 ) ;
assert ( coeff_count [ i ] ) ;
max |= level ;
}
else {
coeff [ 0 ] [ i ] = ( level >> 31 ) | 1 ;
coeff_count [ i ] = 1 ;
}
}
* overflow = s -> max_qcoeff < max ;
if ( last_non_zero < start_i ) {
memset ( block + start_i , 0 , ( 64 - start_i ) * sizeof ( int16_t ) ) ;
return last_non_zero ;
}
score_tab [ start_i ] = 0 ;
survivor [ 0 ] = start_i ;
survivor_count = 1 ;
for ( i = start_i ;
i <= last_non_zero ;
i ++ ) {
int level_index , j , zero_distortion ;
int dct_coeff = FFABS ( block [ scantable [ i ] ] ) ;
int best_score = 256 * 256 * 256 * 120 ;
if ( s -> dsp . fdct == ff_fdct_ifast ) dct_coeff = ( dct_coeff * ff_inv_aanscales [ scantable [ i ] ] ) >> 12 ;
zero_distortion = dct_coeff * dct_coeff ;
for ( level_index = 0 ;
level_index < coeff_count [ i ] ;
level_index ++ ) {
int distortion ;
int level = coeff [ level_index ] [ i ] ;
const int alevel = FFABS ( level ) ;
int unquant_coeff ;
assert ( level ) ;
if ( s -> out_format == FMT_H263 ) {
unquant_coeff = alevel * qmul + qadd ;
}
else {
j = s -> dsp . idct_permutation [ scantable [ i ] ] ;
if ( s -> mb_intra ) {
unquant_coeff = ( int ) ( alevel * qscale * s -> intra_matrix [ j ] ) >> 3 ;
unquant_coeff = ( unquant_coeff - 1 ) | 1 ;
}
else {
unquant_coeff = ( ( ( alevel << 1 ) + 1 ) * qscale * ( ( int ) s -> inter_matrix [ j ] ) ) >> 4 ;
unquant_coeff = ( unquant_coeff - 1 ) | 1 ;
}
unquant_coeff <<= 3 ;
}
distortion = ( unquant_coeff - dct_coeff ) * ( unquant_coeff - dct_coeff ) - zero_distortion ;
level += 64 ;
if ( ( level & ( ~ 127 ) ) == 0 ) {
for ( j = survivor_count - 1 ;
j >= 0 ;
j -- ) {
int run = i - survivor [ j ] ;
int score = distortion + length [ UNI_AC_ENC_INDEX ( run , level ) ] * lambda ;
score += score_tab [ i - run ] ;
if ( score < best_score ) {
best_score = score ;
run_tab [ i + 1 ] = run ;
level_tab [ i + 1 ] = level - 64 ;
}
}
if ( s -> out_format == FMT_H263 ) {
for ( j = survivor_count - 1 ;
j >= 0 ;
j -- ) {
int run = i - survivor [ j ] ;
int score = distortion + last_length [ UNI_AC_ENC_INDEX ( run , level ) ] * lambda ;
score += score_tab [ i - run ] ;
if ( score < last_score ) {
last_score = score ;
last_run = run ;
last_level = level - 64 ;
last_i = i + 1 ;
}
}
}
}
else {
distortion += esc_length * lambda ;
for ( j = survivor_count - 1 ;
j >= 0 ;
j -- ) {
int run = i - survivor [ j ] ;
int score = distortion + score_tab [ i - run ] ;
if ( score < best_score ) {
best_score = score ;
run_tab [ i + 1 ] = run ;
level_tab [ i + 1 ] = level - 64 ;
}
}
if ( s -> out_format == FMT_H263 ) {
for ( j = survivor_count - 1 ;
j >= 0 ;
j -- ) {
int run = i - survivor [ j ] ;
int score = distortion + score_tab [ i - run ] ;
if ( score < last_score ) {
last_score = score ;
last_run = run ;
last_level = level - 64 ;
last_i = i + 1 ;
}
}
}
}
}
score_tab [ i + 1 ] = best_score ;
if ( last_non_zero <= 27 ) {
for ( ;
survivor_count ;
survivor_count -- ) {
if ( score_tab [ survivor [ survivor_count - 1 ] ] <= best_score ) break ;
}
}
else {
for ( ;
survivor_count ;
survivor_count -- ) {
if ( score_tab [ survivor [ survivor_count - 1 ] ] <= best_score + lambda ) break ;
}
}
survivor [ survivor_count ++ ] = i + 1 ;
}
if ( s -> out_format != FMT_H263 ) {
last_score = 256 * 256 * 256 * 120 ;
for ( i = survivor [ 0 ] ;
i <= last_non_zero + 1 ;
i ++ ) {
int score = score_tab [ i ] ;
if ( i ) score += lambda * 2 ;
if ( score < last_score ) {
last_score = score ;
last_i = i ;
last_level = level_tab [ i ] ;
last_run = run_tab [ i ] ;
}
}
}
s -> coded_score [ n ] = last_score ;
dc = FFABS ( block [ 0 ] ) ;
last_non_zero = last_i - 1 ;
memset ( block + start_i , 0 , ( 64 - start_i ) * sizeof ( int16_t ) ) ;
if ( last_non_zero < start_i ) return last_non_zero ;
if ( last_non_zero == 0 && start_i == 0 ) {
int best_level = 0 ;
int best_score = dc * dc ;
for ( i = 0 ;
i < coeff_count [ 0 ] ;
i ++ ) {
int level = coeff [ i ] [ 0 ] ;
int alevel = FFABS ( level ) ;
int unquant_coeff , score , distortion ;
if ( s -> out_format == FMT_H263 ) {
unquant_coeff = ( alevel * qmul + qadd ) >> 3 ;
}
else {
unquant_coeff = ( ( ( alevel << 1 ) + 1 ) * qscale * ( ( int ) s -> inter_matrix [ 0 ] ) ) >> 4 ;
unquant_coeff = ( unquant_coeff - 1 ) | 1 ;
}
unquant_coeff = ( unquant_coeff + 4 ) >> 3 ;
unquant_coeff <<= 3 + 3 ;
distortion = ( unquant_coeff - dc ) * ( unquant_coeff - dc ) ;
level += 64 ;
if ( ( level & ( ~ 127 ) ) == 0 ) score = distortion + last_length [ UNI_AC_ENC_INDEX ( 0 , level ) ] * lambda ;
else score = distortion + esc_length * lambda ;
if ( score < best_score ) {
best_score = score ;
best_level = level - 64 ;
}
}
block [ 0 ] = best_level ;
s -> coded_score [ n ] = best_score - dc * dc ;
if ( best_level == 0 ) return - 1 ;
else return last_non_zero ;
}
i = last_i ;
assert ( last_level ) ;
block [ perm_scantable [ last_non_zero ] ] = last_level ;
i -= last_run + 1 ;
for ( ;
i > start_i ;
i -= run_tab [ i ] + 1 ) {
block [ perm_scantable [ i - 1 ] ] = level_tab [ i ] ;
}
return last_non_zero ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int parse_CDbProp ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * parent_tree , proto_tree * pad_tree , struct GuidPropertySet * propset , const char * fmt , ... ) {
static const value_string EMPTY_VS [ ] = {
{
0 , NULL }
}
;
const value_string * vs = ( propset && propset -> id_map ) ? propset -> id_map : EMPTY_VS ;
guint32 id , opt , status ;
struct CBaseStorageVariant value ;
proto_item * item ;
proto_tree * tree ;
const char * str , * txt ;
va_list ap ;
va_start ( ap , fmt ) ;
txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ;
va_end ( ap ) ;
tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CDbProp , & item , txt ) ;
id = tvb_get_letohl ( tvb , offset ) ;
str = val_to_str ( id , vs , "0x%08x" ) ;
proto_tree_add_string_format_value ( tree , hf_mswsp_cdbprop_id , tvb , offset , 4 , str , "%s (0x%08x)" , ( str [ 0 ] == '0' ? "" : str ) , id ) ;
offset += 4 ;
proto_item_append_text ( item , " Id: %s" , str ) ;
opt = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_cdbprop_options , tvb , offset , 4 , opt ) ;
offset += 4 ;
status = tvb_get_letohl ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_cdbprop_status , tvb , offset , 4 , status ) ;
offset += 4 ;
offset = parse_CDbColId ( tvb , offset , tree , pad_tree , "colid" ) ;
offset = parse_CBaseStorageVariant ( tvb , pinfo , offset , tree , pad_tree , & value , "vValue" ) ;
str = str_CBaseStorageVariant ( & value , TRUE ) ;
proto_item_append_text ( item , " %s" , str ) ;
proto_item_set_end ( item , tvb , offset ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
rfbBool rfbProcessFileTransfer ( rfbClientPtr cl , uint8_t contentType , uint8_t contentParam , uint32_t size , uint32_t length ) {
char * buffer = NULL , * p = NULL ;
int retval = 0 ;
char filename1 [ MAX_PATH ] ;
char filename2 [ MAX_PATH ] ;
char szFileTime [ MAX_PATH ] ;
struct stat statbuf ;
uint32_t sizeHtmp = 0 ;
int n = 0 ;
char timespec [ 64 ] ;
# ifdef LIBVNCSERVER_HAVE_LIBZ unsigned char compBuff [ sz_rfbBlockSize ] ;
unsigned long nRawBytes = sz_rfbBlockSize ;
int nRet = 0 ;
# endif FILEXFER_ALLOWED_OR_CLOSE_AND_RETURN ( "" , cl , FALSE ) ;
switch ( contentType ) {
case rfbDirContentRequest : switch ( contentParam ) {
case rfbRDrivesList : filename2 [ 0 ] = 'C' ;
filename2 [ 1 ] = ':' ;
filename2 [ 2 ] = 'l' ;
filename2 [ 3 ] = 0 ;
filename2 [ 4 ] = 0 ;
retval = rfbSendFileTransferMessage ( cl , rfbDirPacket , rfbADrivesList , 0 , 5 , filename2 ) ;
if ( buffer != NULL ) free ( buffer ) ;
return retval ;
break ;
case rfbRDirContent : if ( ( buffer = rfbProcessFileTransferReadBuffer ( cl , length ) ) == NULL ) return FALSE ;
retval = rfbSendDirContent ( cl , length , buffer ) ;
if ( buffer != NULL ) free ( buffer ) ;
return retval ;
}
break ;
case rfbDirPacket : rfbLog ( "rfbProcessFileTransfer() rfbDirPacket\n" ) ;
break ;
case rfbFileAcceptHeader : rfbLog ( "rfbProcessFileTransfer() rfbFileAcceptHeader\n" ) ;
break ;
case rfbCommandReturn : rfbLog ( "rfbProcessFileTransfer() rfbCommandReturn\n" ) ;
break ;
case rfbFileChecksums : rfbLog ( "rfbProcessFileTransfer() rfbFileChecksums\n" ) ;
break ;
case rfbFileTransferAccess : rfbLog ( "rfbProcessFileTransfer() rfbFileTransferAccess\n" ) ;
break ;
case rfbFileTransferRequest : if ( ( buffer = rfbProcessFileTransferReadBuffer ( cl , length ) ) == NULL ) return FALSE ;
if ( ! rfbFilenameTranslate2UNIX ( cl , buffer , filename1 , sizeof ( filename1 ) ) ) goto fail ;
cl -> fileTransfer . fd = open ( filename1 , O_RDONLY , 0744 ) ;
if ( DB ) rfbLog ( "rfbProcessFileTransfer() rfbFileTransferRequest(\"%s\"->\"%s\") Open: %s fd=%d\n" , buffer , filename1 , ( cl -> fileTransfer . fd == - 1 ? "Failed" : "Success" ) , cl -> fileTransfer . fd ) ;
if ( cl -> fileTransfer . fd != - 1 ) {
if ( fstat ( cl -> fileTransfer . fd , & statbuf ) != 0 ) {
close ( cl -> fileTransfer . fd ) ;
cl -> fileTransfer . fd = - 1 ;
}
else {
strftime ( timespec , sizeof ( timespec ) , "%m/%d/%Y %H:%M" , gmtime ( & statbuf . st_ctime ) ) ;
buffer = realloc ( buffer , length + strlen ( timespec ) + 2 ) ;
if ( buffer == NULL ) {
rfbLog ( "rfbProcessFileTransfer() rfbFileTransferRequest: Failed to malloc %d bytes\n" , length + strlen ( timespec ) + 2 ) ;
return FALSE ;
}
strcat ( buffer , "," ) ;
strcat ( buffer , timespec ) ;
length = strlen ( buffer ) ;
if ( DB ) rfbLog ( "rfbProcessFileTransfer() buffer is now: \"%s\"\n" , buffer ) ;
}
}
cl -> fileTransfer . compressionEnabled = ( size == 1 ) ;
retval = rfbSendFileTransferMessage ( cl , rfbFileHeader , 0 , ( cl -> fileTransfer . fd == - 1 ? - 1 : statbuf . st_size ) , length , buffer ) ;
if ( cl -> fileTransfer . fd == - 1 ) {
if ( buffer != NULL ) free ( buffer ) ;
return retval ;
}
cl -> fileTransfer . fileSize = statbuf . st_size ;
cl -> fileTransfer . numPackets = statbuf . st_size / sz_rfbBlockSize ;
cl -> fileTransfer . receiving = 0 ;
cl -> fileTransfer . sending = 0 ;
sizeHtmp = 0 ;
LOCK ( cl -> sendMutex ) ;
if ( rfbWriteExact ( cl , ( char * ) & sizeHtmp , 4 ) < 0 ) {
rfbLogPerror ( "rfbProcessFileTransfer: write" ) ;
rfbCloseClient ( cl ) ;
UNLOCK ( cl -> sendMutex ) ;
if ( buffer != NULL ) free ( buffer ) ;
return FALSE ;
}
UNLOCK ( cl -> sendMutex ) ;
break ;
case rfbFileHeader : if ( size == - 1 ) {
rfbLog ( "rfbProcessFileTransfer() rfbFileHeader (error, aborting)\n" ) ;
close ( cl -> fileTransfer . fd ) ;
cl -> fileTransfer . fd = - 1 ;
return TRUE ;
}
cl -> fileTransfer . sending = 1 ;
return rfbSendFileTransferChunk ( cl ) ;
break ;
case rfbFileTransferOffer : if ( ( buffer = rfbProcessFileTransferReadBuffer ( cl , length ) ) == NULL ) return FALSE ;
p = strrchr ( buffer , ',' ) ;
if ( p != NULL ) {
* p = '\0' ;
strncpy ( szFileTime , p + 1 , sizeof ( szFileTime ) ) ;
szFileTime [ sizeof ( szFileTime ) - 1 ] = '\x00' ;
}
else szFileTime [ 0 ] = 0 ;
if ( ( n = rfbReadExact ( cl , ( char * ) & sizeHtmp , 4 ) ) <= 0 ) {
if ( n != 0 ) rfbLogPerror ( "rfbProcessFileTransfer: read sizeHtmp" ) ;
rfbCloseClient ( cl ) ;
if ( buffer != NULL ) free ( buffer ) ;
return FALSE ;
}
sizeHtmp = Swap32IfLE ( sizeHtmp ) ;
if ( ! rfbFilenameTranslate2UNIX ( cl , buffer , filename1 , sizeof ( filename1 ) ) ) goto fail ;
cl -> fileTransfer . fd = open ( filename1 , O_CREAT | O_WRONLY | O_TRUNC , 0744 ) ;
if ( DB ) rfbLog ( "rfbProcessFileTransfer() rfbFileTransferOffer(\"%s\"->\"%s\") %s %s fd=%d\n" , buffer , filename1 , ( cl -> fileTransfer . fd == - 1 ? "Failed" : "Success" ) , ( cl -> fileTransfer . fd == - 1 ? strerror ( errno ) : "" ) , cl -> fileTransfer . fd ) ;
retval = rfbSendFileTransferMessage ( cl , rfbFileAcceptHeader , 0 , ( cl -> fileTransfer . fd == - 1 ? - 1 : 0 ) , length , buffer ) ;
if ( cl -> fileTransfer . fd == - 1 ) {
free ( buffer ) ;
return retval ;
}
cl -> fileTransfer . fileSize = size ;
cl -> fileTransfer . numPackets = size / sz_rfbBlockSize ;
cl -> fileTransfer . receiving = 1 ;
cl -> fileTransfer . sending = 0 ;
break ;
case rfbFilePacket : if ( ( buffer = rfbProcessFileTransferReadBuffer ( cl , length ) ) == NULL ) return FALSE ;
if ( cl -> fileTransfer . fd != - 1 ) {
if ( size == 0 ) retval = write ( cl -> fileTransfer . fd , buffer , length ) ;
else {
# ifdef LIBVNCSERVER_HAVE_LIBZ nRet = uncompress ( compBuff , & nRawBytes , ( const unsigned char * ) buffer , length ) ;
if ( nRet == Z_OK ) retval = write ( cl -> fileTransfer . fd , ( char * ) compBuff , nRawBytes ) ;
else retval = - 1 ;
# else retval = write ( cl -> fileTransfer . fd , buffer , length ) ;
# endif }
if ( retval == - 1 ) {
close ( cl -> fileTransfer . fd ) ;
cl -> fileTransfer . fd = - 1 ;
cl -> fileTransfer . sending = 0 ;
cl -> fileTransfer . receiving = 0 ;
}
}
break ;
case rfbEndOfFile : if ( DB ) rfbLog ( "rfbProcessFileTransfer() rfbEndOfFile\n" ) ;
if ( cl -> fileTransfer . fd != - 1 ) close ( cl -> fileTransfer . fd ) ;
cl -> fileTransfer . fd = - 1 ;
cl -> fileTransfer . sending = 0 ;
cl -> fileTransfer . receiving = 0 ;
break ;
case rfbAbortFileTransfer : if ( DB ) rfbLog ( "rfbProcessFileTransfer() rfbAbortFileTransfer\n" ) ;
if ( cl -> fileTransfer . fd != - 1 ) {
close ( cl -> fileTransfer . fd ) ;
cl -> fileTransfer . fd = - 1 ;
cl -> fileTransfer . sending = 0 ;
cl -> fileTransfer . receiving = 0 ;
}
else {
if ( contentParam == 0 ) {
rfbLog ( "rfbProcessFileTransfer() File Transfer Permission DENIED! (Client Version <=RC18)\n" ) ;
return rfbSendFileTransferMessage ( cl , rfbAbortFileTransfer , 0 , - 1 , 0 , "" ) ;
}
if ( cl -> screen -> getFileTransferPermission != NULL ) {
if ( cl -> screen -> getFileTransferPermission ( cl ) == TRUE ) {
rfbLog ( "rfbProcessFileTransfer() File Transfer Permission Granted!\n" ) ;
return rfbSendFileTransferMessage ( cl , rfbFileTransferAccess , 0 , 1 , 0 , "" ) ;
}
else {
rfbLog ( "rfbProcessFileTransfer() File Transfer Permission DENIED!\n" ) ;
return rfbSendFileTransferMessage ( cl , rfbFileTransferAccess , 0 , - 1 , 0 , "" ) ;
}
}
else {
if ( cl -> screen -> permitFileTransfer ) {
rfbLog ( "rfbProcessFileTransfer() File Transfer Permission Granted!\n" ) ;
return rfbSendFileTransferMessage ( cl , rfbFileTransferAccess , 0 , 1 , 0 , "" ) ;
}
else {
rfbLog ( "rfbProcessFileTransfer() File Transfer Permission DENIED by default!\n" ) ;
return rfbSendFileTransferMessage ( cl , rfbFileTransferAccess , 0 , - 1 , 0 , "" ) ;
}
}
}
break ;
case rfbCommand : if ( ( buffer = rfbProcessFileTransferReadBuffer ( cl , length ) ) == NULL ) return FALSE ;
switch ( contentParam ) {
case rfbCDirCreate : if ( ! rfbFilenameTranslate2UNIX ( cl , buffer , filename1 , sizeof ( filename1 ) ) ) goto fail ;
retval = mkdir ( filename1 , 0755 ) ;
if ( DB ) rfbLog ( "rfbProcessFileTransfer() rfbCommand: rfbCDirCreate(\"%s\"->\"%s\") %s\n" , buffer , filename1 , ( retval == - 1 ? "Failed" : "Success" ) ) ;
retval = rfbSendFileTransferMessage ( cl , rfbCommandReturn , rfbADirCreate , retval , length , buffer ) ;
if ( buffer != NULL ) free ( buffer ) ;
return retval ;
case rfbCFileDelete : if ( ! rfbFilenameTranslate2UNIX ( cl , buffer , filename1 , sizeof ( filename1 ) ) ) goto fail ;
if ( stat ( filename1 , & statbuf ) == 0 ) {
if ( S_ISDIR ( statbuf . st_mode ) ) retval = rmdir ( filename1 ) ;
else retval = unlink ( filename1 ) ;
}
else retval = - 1 ;
retval = rfbSendFileTransferMessage ( cl , rfbCommandReturn , rfbAFileDelete , retval , length , buffer ) ;
if ( buffer != NULL ) free ( buffer ) ;
return retval ;
case rfbCFileRename : p = strrchr ( buffer , '*' ) ;
if ( p != NULL ) {
* p = '\0' ;
if ( ! rfbFilenameTranslate2UNIX ( cl , buffer , filename1 , sizeof ( filename1 ) ) ) goto fail ;
if ( ! rfbFilenameTranslate2UNIX ( cl , p + 1 , filename2 , sizeof ( filename2 ) ) ) goto fail ;
retval = rename ( filename1 , filename2 ) ;
if ( DB ) rfbLog ( "rfbProcessFileTransfer() rfbCommand: rfbCFileRename(\"%s\"->\"%s\" -->> \"%s\"->\"%s\") %s\n" , buffer , filename1 , p + 1 , filename2 , ( retval == - 1 ? "Failed" : "Success" ) ) ;
* p = '*' ;
retval = rfbSendFileTransferMessage ( cl , rfbCommandReturn , rfbAFileRename , retval , length , buffer ) ;
if ( buffer != NULL ) free ( buffer ) ;
return retval ;
}
break ;
}
break ;
}
if ( buffer != NULL ) free ( buffer ) ;
return TRUE ;
fail : if ( buffer != NULL ) free ( buffer ) ;
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_inode_mknod ( struct inode * dir , struct dentry * dentry , umode_t mode , dev_t dev ) {
return may_create ( dir , dentry , inode_mode_to_security_class ( mode ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int kvm_put_fpu ( X86CPU * cpu ) {
CPUX86State * env = & cpu -> env ;
struct kvm_fpu fpu ;
int i ;
memset ( & fpu , 0 , sizeof fpu ) ;
fpu . fsw = env -> fpus & ~ ( 7 << 11 ) ;
fpu . fsw |= ( env -> fpstt & 7 ) << 11 ;
fpu . fcw = env -> fpuc ;
fpu . last_opcode = env -> fpop ;
fpu . last_ip = env -> fpip ;
fpu . last_dp = env -> fpdp ;
for ( i = 0 ;
i < 8 ;
++ i ) {
fpu . ftwx |= ( ! env -> fptags [ i ] ) << i ;
}
memcpy ( fpu . fpr , env -> fpregs , sizeof env -> fpregs ) ;
for ( i = 0 ;
i < CPU_NB_REGS ;
i ++ ) {
stq_p ( & fpu . xmm [ i ] [ 0 ] , env -> xmm_regs [ i ] . ZMM_Q ( 0 ) ) ;
stq_p ( & fpu . xmm [ i ] [ 8 ] , env -> xmm_regs [ i ] . ZMM_Q ( 1 ) ) ;
}
fpu . mxcsr = env -> mxcsr ;
return kvm_vcpu_ioctl ( CPU ( cpu ) , KVM_SET_FPU , & fpu ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int com_use ( String * buffer __attribute__ ( ( unused ) ) , char * line ) {
char * tmp , buff [ FN_REFLEN + 1 ] ;
int select_db ;
bzero ( buff , sizeof ( buff ) ) ;
strmake_buf ( buff , line ) ;
tmp = get_arg ( buff , 0 ) ;
if ( ! tmp || ! * tmp ) {
put_info ( "USE must be followed by a database name" , INFO_ERROR ) ;
return 0 ;
}
get_current_db ( ) ;
if ( ! current_db || cmp_database ( charset_info , current_db , tmp ) ) {
if ( one_database ) {
skip_updates = 1 ;
select_db = 0 ;
}
else select_db = 2 ;
}
else {
skip_updates = 0 ;
select_db = 1 ;
}
if ( select_db ) {
if ( ! connected && reconnect ( ) ) return opt_reconnect ? - 1 : 1 ;
if ( mysql_select_db ( & mysql , tmp ) ) {
if ( mysql_errno ( & mysql ) != CR_SERVER_GONE_ERROR ) return put_error ( & mysql ) ;
if ( reconnect ( ) ) return opt_reconnect ? - 1 : 1 ;
if ( mysql_select_db ( & mysql , tmp ) ) return put_error ( & mysql ) ;
}
my_free ( current_db ) ;
current_db = my_strdup ( tmp , MYF ( MY_WME ) ) ;
# ifdef HAVE_READLINE if ( select_db > 1 ) build_completion_hash ( opt_rehash , 1 ) ;
# endif }
put_info ( "Database changed" , INFO_INFO ) ;
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int xmlListCopy ( xmlListPtr cur , const xmlListPtr old ) {
xmlLinkPtr lk ;
if ( ( old == NULL ) || ( cur == NULL ) ) return ( 1 ) ;
for ( lk = old -> sentinel -> next ;
lk != old -> sentinel ;
lk = lk -> next ) {
if ( 0 != xmlListInsert ( cur , lk -> data ) ) {
xmlListDelete ( cur ) ;
return ( 1 ) ;
}
}
return ( 0 ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( HistoryQuickProviderTest , ContentsClass ) {
std : : vector < std : : string > expected_urls ;
expected_urls . push_back ( "http://ja.wikipedia.org/wiki/%E7%AC%AC%E4%BA%8C%E6%AC%A1%E4%B8%96%E7" "%95%8C%E5%A4%A7%E6%88%A6#.E3.83.B4.E3.82.A7.E3.83.AB.E3.82.B5.E3.82." "A4.E3.83.A6.E4.BD.93.E5.88.B6" ) ;
RunTest ( base : : UTF8ToUTF16 ( "第二 e3" ) , false , expected_urls , false , base : : UTF8ToUTF16 ( "ja.wikipedia.org/wiki/第二次世界大戦#.E3.83.B4.E3." "82.A7.E3.83.AB.E3.82.B5.E3.82.A4.E3.83.A6.E4.BD." "93.E5.88.B6" ) , base : : string16 ( ) ) ;
# ifndef NDEBUG ac_matches_ [ 0 ] . Validate ( ) ;
# endif ACMatchClassifications contents_class ( ac_matches_ [ 0 ] . contents_class ) ;
size_t expected_offsets [ ] = {
0 , 22 , 24 , 31 , 33 , 40 , 42 , 49 , 51 , 58 , 60 , 67 , 69 , 76 , 78 }
;
EXPECT_LE ( contents_class . size ( ) , arraysize ( expected_offsets ) ) ;
EXPECT_GE ( contents_class . size ( ) , 5u ) ;
for ( size_t i = 0 ;
i < contents_class . size ( ) ;
++ i ) EXPECT_EQ ( expected_offsets [ i ] , contents_class [ i ] . offset ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void e1000e_core_pre_save ( E1000ECore * core ) {
int i ;
NetClientState * nc = qemu_get_queue ( core -> owner_nic ) ;
if ( nc -> link_down && e1000e_have_autoneg ( core ) ) {
core -> phy [ 0 ] [ PHY_STATUS ] |= MII_SR_AUTONEG_COMPLETE ;
e1000e_update_flowctl_status ( core ) ;
}
for ( i = 0 ;
i < ARRAY_SIZE ( core -> tx ) ;
i ++ ) {
if ( net_tx_pkt_has_fragments ( core -> tx [ i ] . tx_pkt ) ) {
core -> tx [ i ] . skip_cp = true ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , fread ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
long length = 0 ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "l" , & length ) == FAILURE ) {
return ;
}
if ( length <= 0 ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "Length parameter must be greater than 0" ) ;
RETURN_FALSE ;
}
if ( length > INT_MAX ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "Length parameter must be no more than %d" , INT_MAX ) ;
RETURN_FALSE ;
}
Z_STRVAL_P ( return_value ) = emalloc ( length + 1 ) ;
Z_STRLEN_P ( return_value ) = php_stream_read ( intern -> u . file . stream , Z_STRVAL_P ( return_value ) , length ) ;
Z_STRVAL_P ( return_value ) [ Z_STRLEN_P ( return_value ) ] = 0 ;
Z_TYPE_P ( return_value ) = IS_STRING ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSMimeHdrFieldNameSet ( TSMBuffer bufp , TSMLoc hdr , TSMLoc field , const char * name , int length ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( hdr ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( hdr ) == TS_SUCCESS ) ) ;
sdk_assert ( sdk_sanity_check_field_handle ( field , hdr ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) name ) == TS_SUCCESS ) ;
if ( ! isWriteable ( bufp ) ) {
return TS_ERROR ;
}
if ( length == - 1 ) {
length = strlen ( name ) ;
}
MIMEFieldSDKHandle * handle = ( MIMEFieldSDKHandle * ) field ;
HdrHeap * heap = ( ( HdrHeapSDKHandle * ) bufp ) -> m_heap ;
int attached = ( handle -> mh && handle -> field_ptr -> is_live ( ) ) ;
if ( attached ) {
mime_hdr_field_detach ( handle -> mh , handle -> field_ptr , false ) ;
}
handle -> field_ptr -> name_set ( heap , handle -> mh , name , length ) ;
if ( attached ) {
mime_hdr_field_attach ( handle -> mh , handle -> field_ptr , 1 , nullptr ) ;
}
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int mbfl_buffer_converter_flush ( mbfl_buffer_converter * convd ) {
if ( convd == NULL ) {
return - 1 ;
}
if ( convd -> filter1 != NULL ) {
mbfl_convert_filter_flush ( convd -> filter1 ) ;
}
if ( convd -> filter2 != NULL ) {
mbfl_convert_filter_flush ( convd -> filter2 ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int get_dns_name ( tvbuff_t * tvb , int offset , int max_len , int dns_data_offset , const guchar * * name ) {
int len ;
len = expand_dns_name ( tvb , offset , max_len , dns_data_offset , name ) ;
if ( * * name == '\0' ) {
* name = "<Root>" ;
}
return len ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.