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
|
enum nss_status _nss_nis_getaliasbyname_r ( const char * name , struct aliasent * alias , char * buffer , size_t buflen , int * errnop ) {
if ( name == NULL ) {
* errnop = EINVAL ;
return NSS_STATUS_UNAVAIL ;
}
size_t namlen = strlen ( name ) ;
char name2 [ namlen + 1 ] ;
char * domain ;
if ( __builtin_expect ( yp_get_default_domain ( & domain ) , 0 ) ) return NSS_STATUS_UNAVAIL ;
size_t i ;
for ( i = 0 ;
i < namlen ;
++ i ) name2 [ i ] = _tolower ( name [ i ] ) ;
name2 [ i ] = '\0' ;
char * result ;
int len ;
int yperr = yp_match ( domain , "mail.aliases" , name2 , namlen , & result , & len ) ;
if ( __builtin_expect ( yperr != YPERR_SUCCESS , 0 ) ) {
enum nss_status retval = yperr2nss ( yperr ) ;
if ( retval == NSS_STATUS_TRYAGAIN ) * errnop = errno ;
return retval ;
}
if ( __builtin_expect ( ( size_t ) ( len + 1 ) > buflen , 0 ) ) {
free ( result ) ;
* errnop = ERANGE ;
return NSS_STATUS_TRYAGAIN ;
}
char * p = strncpy ( buffer , result , len ) ;
buffer [ len ] = '\0' ;
while ( isspace ( * p ) ) ++ p ;
free ( result ) ;
alias -> alias_local = 0 ;
int parse_res = _nss_nis_parse_aliasent ( name , p , alias , buffer , buflen , errnop ) ;
if ( __builtin_expect ( parse_res < 1 , 0 ) ) {
if ( parse_res == - 1 ) return NSS_STATUS_TRYAGAIN ;
else return NSS_STATUS_NOTFOUND ;
}
return NSS_STATUS_SUCCESS ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vmsvga_io_write ( void * opaque , hwaddr addr , uint64_t data , unsigned size ) {
struct vmsvga_state_s * s = opaque ;
switch ( addr ) {
case SVGA_IO_MUL * SVGA_INDEX_PORT : vmsvga_index_write ( s , addr , data ) ;
break ;
case SVGA_IO_MUL * SVGA_VALUE_PORT : vmsvga_value_write ( s , addr , data ) ;
break ;
case SVGA_IO_MUL * SVGA_BIOS_PORT : vmsvga_bios_write ( s , addr , data ) ;
break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void send_protected_args ( int fd , char * args [ ] ) {
int i ;
# ifdef ICONV_OPTION int convert = ic_send != ( iconv_t ) - 1 ;
xbuf outbuf , inbuf ;
if ( convert ) alloc_xbuf ( & outbuf , 1024 ) ;
# endif for ( i = 0 ;
args [ i ] ;
i ++ ) {
}
args [ i ] = "rsync" ;
if ( DEBUG_GTE ( CMD , 1 ) ) print_child_argv ( "protected args:" , args + i + 1 ) ;
do {
if ( ! args [ i ] [ 0 ] ) write_buf ( fd , "." , 2 ) ;
# ifdef ICONV_OPTION else if ( convert ) {
INIT_XBUF_STRLEN ( inbuf , args [ i ] ) ;
iconvbufs ( ic_send , & inbuf , & outbuf , ICB_EXPAND_OUT | ICB_INCLUDE_BAD | ICB_INCLUDE_INCOMPLETE | ICB_INIT ) ;
outbuf . buf [ outbuf . len ] = '\0' ;
write_buf ( fd , outbuf . buf , outbuf . len + 1 ) ;
outbuf . len = 0 ;
}
# endif else write_buf ( fd , args [ i ] , strlen ( args [ i ] ) + 1 ) ;
}
while ( args [ ++ i ] ) ;
write_byte ( fd , 0 ) ;
# ifdef ICONV_OPTION if ( convert ) free ( outbuf . buf ) ;
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int proto_get_id ( const protocol_t * protocol ) {
return protocol -> proto_id ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void show_edge ( struct commit * commit ) {
printf ( "-%s\n" , oid_to_hex ( & commit -> object . oid ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void OnDangerPromptCreated ( DownloadDangerPrompt * prompt ) {
prompt -> InvokeActionForTesting ( DownloadDangerPrompt : : ACCEPT ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void CopySFNTAndFixup ( FILE * ttc , FILE * ttf ) {
int offset = ftell ( ttc ) ;
int val , table_cnt , i ;
fseek ( ttf , 0 , SEEK_SET ) ;
val = getlong ( ttf ) ;
putlong ( ttc , val ) ;
table_cnt = getushort ( ttf ) ;
putshort ( ttc , table_cnt ) ;
val = getushort ( ttf ) ;
putshort ( ttc , val ) ;
val = getushort ( ttf ) ;
putshort ( ttc , val ) ;
val = getushort ( ttf ) ;
putshort ( ttc , val ) ;
for ( i = 0 ;
i < table_cnt ;
++ i ) {
val = getlong ( ttf ) ;
putlong ( ttc , val ) ;
val = getlong ( ttf ) ;
putlong ( ttc , val ) ;
val = getlong ( ttf ) ;
putlong ( ttc , val + offset ) ;
val = getlong ( ttf ) ;
putlong ( ttc , val ) ;
}
while ( ( val = getc ( ttf ) ) != EOF ) putc ( val , ttc ) ;
fclose ( ttf ) ;
if ( ftell ( ttc ) & 1 ) putc ( '\0' , ttc ) ;
if ( ftell ( ttc ) & 2 ) putshort ( ttc , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void e1000e_core_set_link_status ( E1000ECore * core ) {
NetClientState * nc = qemu_get_queue ( core -> owner_nic ) ;
uint32_t old_status = core -> mac [ STATUS ] ;
trace_e1000e_link_status_changed ( nc -> link_down ? false : true ) ;
if ( nc -> link_down ) {
e1000x_update_regs_on_link_down ( core -> mac , core -> phy [ 0 ] ) ;
}
else {
if ( e1000e_have_autoneg ( core ) && ! ( core -> phy [ 0 ] [ PHY_STATUS ] & MII_SR_AUTONEG_COMPLETE ) ) {
e1000x_restart_autoneg ( core -> mac , core -> phy [ 0 ] , core -> autoneg_timer ) ;
}
else {
e1000x_update_regs_on_link_up ( core -> mac , core -> phy [ 0 ] ) ;
e1000e_start_recv ( core ) ;
}
}
if ( core -> mac [ STATUS ] != old_status ) {
e1000e_set_interrupt_cause ( core , E1000_ICR_LSC ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void jpc_ft_invlift_colgrp ( jpc_fix_t * a , int numrows , int stride , int parity ) {
jpc_fix_t * lptr ;
jpc_fix_t * hptr ;
register jpc_fix_t * lptr2 ;
register jpc_fix_t * hptr2 ;
register int n ;
register int i ;
int llen ;
llen = ( numrows + 1 - parity ) >> 1 ;
if ( numrows > 1 ) {
lptr = & a [ 0 ] ;
hptr = & a [ llen * stride ] ;
if ( ! parity ) {
lptr2 = lptr ;
hptr2 = hptr ;
for ( i = 0 ;
i < JPC_QMFB_COLGRPSIZE ;
++ i ) {
lptr2 [ 0 ] -= jpc_fix_asr ( hptr2 [ 0 ] + 1 , 1 ) ;
++ lptr2 ;
++ hptr2 ;
}
lptr += stride ;
}
n = llen - ( ! parity ) - ( parity != ( numrows & 1 ) ) ;
while ( n -- > 0 ) {
lptr2 = lptr ;
hptr2 = hptr ;
for ( i = 0 ;
i < JPC_QMFB_COLGRPSIZE ;
++ i ) {
lptr2 [ 0 ] -= jpc_fix_asr ( hptr2 [ 0 ] + hptr2 [ stride ] + 2 , 2 ) ;
++ lptr2 ;
++ hptr2 ;
}
lptr += stride ;
hptr += stride ;
}
if ( parity != ( numrows & 1 ) ) {
lptr2 = lptr ;
hptr2 = hptr ;
for ( i = 0 ;
i < JPC_QMFB_COLGRPSIZE ;
++ i ) {
lptr2 [ 0 ] -= jpc_fix_asr ( hptr2 [ 0 ] + 1 , 1 ) ;
++ lptr2 ;
++ hptr2 ;
}
}
lptr = & a [ 0 ] ;
hptr = & a [ llen * stride ] ;
if ( parity ) {
lptr2 = lptr ;
hptr2 = hptr ;
for ( i = 0 ;
i < JPC_QMFB_COLGRPSIZE ;
++ i ) {
hptr2 [ 0 ] += lptr2 [ 0 ] ;
++ hptr2 ;
++ lptr2 ;
}
hptr += stride ;
}
n = numrows - llen - parity - ( parity == ( numrows & 1 ) ) ;
while ( n -- > 0 ) {
lptr2 = lptr ;
hptr2 = hptr ;
for ( i = 0 ;
i < JPC_QMFB_COLGRPSIZE ;
++ i ) {
hptr2 [ 0 ] += jpc_fix_asr ( lptr2 [ 0 ] + lptr2 [ stride ] , 1 ) ;
++ lptr2 ;
++ hptr2 ;
}
hptr += stride ;
lptr += stride ;
}
if ( parity == ( numrows & 1 ) ) {
lptr2 = lptr ;
hptr2 = hptr ;
for ( i = 0 ;
i < JPC_QMFB_COLGRPSIZE ;
++ i ) {
hptr2 [ 0 ] += lptr2 [ 0 ] ;
++ lptr2 ;
++ hptr2 ;
}
}
}
else {
if ( parity ) {
lptr2 = & a [ 0 ] ;
for ( i = 0 ;
i < JPC_QMFB_COLGRPSIZE ;
++ i ) {
lptr2 [ 0 ] = jpc_fix_asr ( lptr2 [ 0 ] , 1 ) ;
++ lptr2 ;
}
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ff_mpv_frame_size_alloc ( MpegEncContext * s , int linesize ) {
int alloc_size = FFALIGN ( FFABS ( linesize ) + 32 , 32 ) ;
FF_ALLOCZ_OR_GOTO ( s -> avctx , s -> edge_emu_buffer , alloc_size * 2 * 24 , fail ) ;
FF_ALLOCZ_OR_GOTO ( s -> avctx , s -> me . scratchpad , alloc_size * 2 * 16 * 2 , fail ) s -> me . temp = s -> me . scratchpad ;
s -> rd_scratchpad = s -> me . scratchpad ;
s -> b_scratchpad = s -> me . scratchpad ;
s -> obmc_scratchpad = s -> me . scratchpad + 16 ;
return 0 ;
fail : av_freep ( & s -> edge_emu_buffer ) ;
return AVERROR ( ENOMEM ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void key_alloc_serial ( struct key * key ) {
struct rb_node * parent , * * p ;
struct key * xkey ;
do {
get_random_bytes ( & key -> serial , sizeof ( key -> serial ) ) ;
key -> serial >>= 1 ;
}
while ( key -> serial < 3 ) ;
spin_lock ( & key_serial_lock ) ;
attempt_insertion : parent = NULL ;
p = & key_serial_tree . rb_node ;
while ( * p ) {
parent = * p ;
xkey = rb_entry ( parent , struct key , serial_node ) ;
if ( key -> serial < xkey -> serial ) p = & ( * p ) -> rb_left ;
else if ( key -> serial > xkey -> serial ) p = & ( * p ) -> rb_right ;
else goto serial_exists ;
}
rb_link_node ( & key -> serial_node , parent , p ) ;
rb_insert_color ( & key -> serial_node , & key_serial_tree ) ;
spin_unlock ( & key_serial_lock ) ;
return ;
serial_exists : for ( ;
;
) {
key -> serial ++ ;
if ( key -> serial < 3 ) {
key -> serial = 3 ;
goto attempt_insertion ;
}
parent = rb_next ( parent ) ;
if ( ! parent ) goto attempt_insertion ;
xkey = rb_entry ( parent , struct key , serial_node ) ;
if ( key -> serial < xkey -> serial ) goto attempt_insertion ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int http_connect ( const char * address , u_short port ) {
# ifdef WIN32 struct hostent * he ;
struct sockaddr_in sin ;
# else struct addrinfo ai , * aitop ;
char strport [ NI_MAXSERV ] ;
# endif struct sockaddr * sa ;
int slen ;
int fd ;
# ifdef WIN32 if ( ! ( he = gethostbyname ( address ) ) ) {
event_warn ( "gethostbyname" ) ;
}
memcpy ( & sin . sin_addr , he -> h_addr_list [ 0 ] , he -> h_length ) ;
sin . sin_family = AF_INET ;
sin . sin_port = htons ( port ) ;
slen = sizeof ( struct sockaddr_in ) ;
sa = ( struct sockaddr * ) & sin ;
# else memset ( & ai , 0 , sizeof ( ai ) ) ;
ai . ai_family = AF_INET ;
ai . ai_socktype = SOCK_STREAM ;
snprintf ( strport , sizeof ( strport ) , "%d" , port ) ;
if ( getaddrinfo ( address , strport , & ai , & aitop ) != 0 ) {
event_warn ( "getaddrinfo" ) ;
return ( - 1 ) ;
}
sa = aitop -> ai_addr ;
slen = aitop -> ai_addrlen ;
# endif fd = socket ( AF_INET , SOCK_STREAM , 0 ) ;
if ( fd == - 1 ) event_err ( 1 , "socket failed" ) ;
if ( connect ( fd , sa , slen ) == - 1 ) event_err ( 1 , "connect failed" ) ;
# ifndef WIN32 freeaddrinfo ( aitop ) ;
# endif return ( fd ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_shm_shmctl ( struct shmid_kernel * shp , int cmd ) {
int perms ;
int err ;
switch ( cmd ) {
case IPC_INFO : case SHM_INFO : return task_has_system ( current , SYSTEM__IPC_INFO ) ;
case IPC_STAT : case SHM_STAT : perms = SHM__GETATTR | SHM__ASSOCIATE ;
break ;
case IPC_SET : perms = SHM__SETATTR ;
break ;
case SHM_LOCK : case SHM_UNLOCK : perms = SHM__LOCK ;
break ;
case IPC_RMID : perms = SHM__DESTROY ;
break ;
default : return 0 ;
}
err = ipc_has_perm ( & shp -> shm_perm , perms ) ;
return err ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int16_t vp9_ac_quant ( int qindex , int delta ) {
return ac_qlookup [ clamp ( qindex + delta , 0 , MAXQ ) ] ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void usage_exit ( ) {
fprintf ( stderr , "Usage: %s <infile> <outfile> <N-M|N/M>\n" , exec_name ) ;
exit ( EXIT_FAILURE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void handle_ctrl_proto ( netdissect_options * ndo , u_int proto , const u_char * pptr , int length ) {
const char * typestr ;
u_int code , len ;
int ( * pfunc ) ( netdissect_options * , const u_char * , int ) ;
int x , j ;
const u_char * tptr ;
tptr = pptr ;
typestr = tok2str ( ppptype2str , "unknown ctrl-proto (0x%04x)" , proto ) ;
ND_PRINT ( ( ndo , "%s, " , typestr ) ) ;
if ( length < 4 ) goto trunc ;
ND_TCHECK2 ( * tptr , 2 ) ;
code = * tptr ++ ;
ND_PRINT ( ( ndo , "%s (0x%02x), id %u, length %u" , tok2str ( cpcodes , "Unknown Opcode" , code ) , code , * tptr ++ , length + 2 ) ) ;
if ( ! ndo -> ndo_vflag ) return ;
if ( length <= 4 ) return ;
ND_TCHECK2 ( * tptr , 2 ) ;
len = EXTRACT_16BITS ( tptr ) ;
tptr += 2 ;
ND_PRINT ( ( ndo , "\n\tencoded length %u (=Option(s) length %u)" , len , len - 4 ) ) ;
if ( ndo -> ndo_vflag > 1 ) print_unknown_data ( ndo , pptr - 2 , "\n\t" , 6 ) ;
switch ( code ) {
case CPCODES_VEXT : if ( length < 11 ) break ;
ND_TCHECK2 ( * tptr , 4 ) ;
ND_PRINT ( ( ndo , "\n\t Magic-Num 0x%08x" , EXTRACT_32BITS ( tptr ) ) ) ;
tptr += 4 ;
ND_TCHECK2 ( * tptr , 3 ) ;
ND_PRINT ( ( ndo , " Vendor: %s (%u)" , tok2str ( oui_values , "Unknown" , EXTRACT_24BITS ( tptr ) ) , EXTRACT_24BITS ( tptr ) ) ) ;
break ;
case CPCODES_CONF_REQ : case CPCODES_CONF_ACK : case CPCODES_CONF_NAK : case CPCODES_CONF_REJ : x = len - 4 ;
do {
switch ( proto ) {
case PPP_LCP : pfunc = print_lcp_config_options ;
break ;
case PPP_IPCP : pfunc = print_ipcp_config_options ;
break ;
case PPP_IPV6CP : pfunc = print_ip6cp_config_options ;
break ;
case PPP_CCP : pfunc = print_ccp_config_options ;
break ;
case PPP_BACP : pfunc = print_bacp_config_options ;
break ;
default : pfunc = NULL ;
break ;
}
if ( pfunc == NULL ) break ;
if ( ( j = ( * pfunc ) ( ndo , tptr , len ) ) == 0 ) break ;
x -= j ;
tptr += j ;
}
while ( x > 0 ) ;
break ;
case CPCODES_TERM_REQ : case CPCODES_TERM_ACK : break ;
case CPCODES_CODE_REJ : break ;
case CPCODES_PROT_REJ : if ( length < 6 ) break ;
ND_TCHECK2 ( * tptr , 2 ) ;
ND_PRINT ( ( ndo , "\n\t Rejected %s Protocol (0x%04x)" , tok2str ( ppptype2str , "unknown" , EXTRACT_16BITS ( tptr ) ) , EXTRACT_16BITS ( tptr ) ) ) ;
if ( len > 6 ) {
ND_PRINT ( ( ndo , "\n\t Rejected Packet" ) ) ;
print_unknown_data ( ndo , tptr + 2 , "\n\t " , len - 2 ) ;
}
break ;
case CPCODES_ECHO_REQ : case CPCODES_ECHO_RPL : case CPCODES_DISC_REQ : if ( length < 8 ) break ;
ND_TCHECK2 ( * tptr , 4 ) ;
ND_PRINT ( ( ndo , "\n\t Magic-Num 0x%08x" , EXTRACT_32BITS ( tptr ) ) ) ;
if ( len > 8 ) {
ND_PRINT ( ( ndo , "\n\t -----trailing data-----" ) ) ;
ND_TCHECK2 ( tptr [ 4 ] , len - 8 ) ;
print_unknown_data ( ndo , tptr + 4 , "\n\t " , len - 8 ) ;
}
break ;
case CPCODES_ID : if ( length < 8 ) break ;
ND_TCHECK2 ( * tptr , 4 ) ;
ND_PRINT ( ( ndo , "\n\t Magic-Num 0x%08x" , EXTRACT_32BITS ( tptr ) ) ) ;
if ( len > 8 ) {
ND_PRINT ( ( ndo , "\n\t Message\n\t " ) ) ;
if ( fn_printn ( ndo , tptr + 4 , len - 4 , ndo -> ndo_snapend ) ) goto trunc ;
}
break ;
case CPCODES_TIME_REM : if ( length < 12 ) break ;
ND_TCHECK2 ( * tptr , 4 ) ;
ND_PRINT ( ( ndo , "\n\t Magic-Num 0x%08x" , EXTRACT_32BITS ( tptr ) ) ) ;
ND_TCHECK2 ( * ( tptr + 4 ) , 4 ) ;
ND_PRINT ( ( ndo , ", Seconds-Remaining %us" , EXTRACT_32BITS ( tptr + 4 ) ) ) ;
break ;
default : if ( ndo -> ndo_vflag <= 1 ) print_unknown_data ( ndo , pptr - 2 , "\n\t " , length + 2 ) ;
break ;
}
return ;
trunc : ND_PRINT ( ( ndo , "[|%s]" , typestr ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static FILE * _Gen816Enc ( SplineFont * sf , int * tlen , EncMap * map ) {
int i , j , complained , pos , k , subheadindex , jj , isbig5 = false ;
uint16 table [ 256 ] ;
struct subhead subheads [ 128 ] ;
uint16 * glyphs ;
uint16 tempglyphs [ 256 ] ;
int base , lbase , basebound , subheadcnt , planesize , plane0size ;
int base2 , base2bound ;
FILE * sub ;
const char * encname = map -> enc -> iconv_name != NULL ? map -> enc -> iconv_name : map -> enc -> enc_name ;
* tlen = 0 ;
base2 = - 1 ;
base2bound = - 2 ;
if ( map -> enc -> is_tradchinese && strstrmatch ( encname , "hkscs" ) != NULL ) {
base = 0x81 ;
basebound = 0xfe ;
subheadcnt = basebound - base + 1 ;
lbase = 0x40 ;
planesize = 191 ;
}
else if ( map -> enc -> is_tradchinese || sf -> uni_interp == ui_trad_chinese ) {
base = 0xa1 ;
basebound = 0xf9 ;
subheadcnt = basebound - base + 1 ;
lbase = 0x40 ;
planesize = 191 ;
isbig5 = true ;
}
else if ( strstrmatch ( encname , "euc" ) != NULL ) {
base = 0xa1 ;
basebound = 0xfd ;
lbase = 0xa1 ;
subheadcnt = basebound - base + 1 ;
planesize = 0xfe - lbase + 1 ;
}
else if ( strstrmatch ( encname , "johab" ) != NULL ) {
base = 0x84 ;
basebound = 0xf9 ;
lbase = 0x31 ;
subheadcnt = basebound - base + 1 ;
planesize = 0xfe - 0x31 + 1 ;
}
else if ( strstrmatch ( encname , "sjis" ) != NULL || strstrmatch ( encname , "cp932" ) != NULL ) {
base = 129 ;
basebound = 159 ;
lbase = 64 ;
planesize = 252 - lbase + 1 ;
base2 = 0xe0 ;
for ( base2bound = 0xfc00 ;
base2bound > 0xefff ;
-- base2bound ) if ( base2bound < map -> enccount && map -> map [ base2bound ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ base2bound ] ] ) ) break ;
base2bound >>= 8 ;
subheadcnt = basebound - base + 1 + base2bound - base2 + 1 ;
}
else {
IError ( "Unsupported 8/16 encoding %s\n" , map -> enc -> enc_name ) ;
return ( NULL ) ;
}
plane0size = base2 == - 1 ? base : base2 ;
i = 0 ;
if ( base2 != - 1 ) {
for ( i = basebound ;
i < base2 && i < map -> enccount ;
++ i ) if ( map -> map [ i ] == - 1 ) continue ;
else if ( SCWorthOutputting ( sf -> glyphs [ map -> map [ i ] ] ) ) break ;
if ( i == base2 || i == map -> enccount ) i = 0 ;
}
if ( i == 0 ) {
for ( i = 0 ;
i < base && i < map -> enccount ;
++ i ) if ( map -> map [ i ] == - 1 ) continue ;
else if ( SCWorthOutputting ( sf -> glyphs [ map -> map [ i ] ] ) ) break ;
}
if ( base2 != - 1 ) {
for ( i = base ;
i <= basebound && i < map -> enccount ;
++ i ) if ( map -> map [ i ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ i ] ] ) ) {
ff_post_error ( _ ( "Bad Encoding" ) , _ ( "There is a single byte character (%d) using one of the slots needed for double byte characters" ) , i ) ;
break ;
}
if ( i == basebound + 1 ) for ( i = base2 ;
i < 256 && i < map -> enccount ;
++ i ) if ( map -> map [ i ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ i ] ] ) ) {
ff_post_error ( _ ( "Bad Encoding" ) , _ ( "There is a single byte character (%d) using one of the slots needed for double byte characters" ) , i ) ;
break ;
}
}
else {
for ( i = base ;
i <= 256 && i < map -> enccount ;
++ i ) if ( map -> map [ i ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ i ] ] ) ) {
ff_post_error ( _ ( "Bad Encoding" ) , _ ( "There is a single byte character (%d) using one of the slots needed for double byte characters" ) , i ) ;
break ;
}
}
for ( i = 256 ;
i < ( base << 8 ) && i < map -> enccount ;
++ i ) if ( map -> map [ i ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ i ] ] ) ) {
ff_post_error ( _ ( "Bad Encoding" ) , _ ( "There is a character (%d) which cannot be encoded" ) , i ) ;
break ;
}
if ( i == ( base << 8 ) && base2 == - 1 ) for ( i = ( ( basebound + 1 ) << 8 ) ;
i < 0x10000 && i < map -> enccount ;
++ i ) if ( map -> map [ i ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ i ] ] ) ) {
ff_post_error ( _ ( "Bad Encoding" ) , _ ( "There is a character (%d) which cannot be encoded" ) , i ) ;
break ;
}
memset ( table , '\0' , sizeof ( table ) ) ;
for ( i = base ;
i <= basebound ;
++ i ) table [ i ] = 8 * ( i - base + 1 ) ;
for ( i = base2 ;
i <= base2bound ;
++ i ) table [ i ] = 8 * ( i - base2 + basebound - base + 1 + 1 ) ;
memset ( subheads , '\0' , sizeof ( subheads ) ) ;
subheads [ 0 ] . first = 0 ;
subheads [ 0 ] . cnt = plane0size ;
for ( i = 1 ;
i < subheadcnt + 1 ;
++ i ) {
subheads [ i ] . first = lbase ;
subheads [ i ] . cnt = planesize ;
}
glyphs = calloc ( subheadcnt * planesize + plane0size , sizeof ( uint16 ) ) ;
subheads [ 0 ] . rangeoff = 0 ;
for ( i = 0 ;
i < plane0size && i < map -> enccount ;
++ i ) if ( map -> map [ i ] != - 1 && sf -> glyphs [ map -> map [ i ] ] != NULL && sf -> glyphs [ map -> map [ i ] ] -> ttf_glyph != - 1 ) glyphs [ i ] = sf -> glyphs [ map -> map [ i ] ] -> ttf_glyph ;
pos = 1 ;
complained = false ;
subheadindex = 1 ;
for ( jj = 0 ;
jj < 2 || ( base2 == - 1 && jj < 1 ) ;
++ jj ) for ( j = ( ( jj == 0 ? base : base2 ) << 8 ) ;
j <= ( ( jj == 0 ? basebound : base2bound ) << 8 ) ;
j += 0x100 ) {
for ( i = 0 ;
i < lbase ;
++ i ) if ( ! complained && map -> map [ i + j ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ i + j ] ] ) ) {
ff_post_error ( _ ( "Bad Encoding" ) , _ ( "There is a character (%d) which is not normally in the encoding" ) , i + j ) ;
complained = true ;
}
if ( isbig5 ) {
for ( i = 0x7f ;
i < 0xa1 ;
++ i ) if ( ! complained && map -> map [ i + j ] != - 1 && SCWorthOutputting ( sf -> glyphs [ map -> map [ i + j ] ] ) ) {
ff_post_error ( _ ( "Bad Encoding" ) , _ ( "There is a character (%d) which is not normally in the encoding" ) , i + j ) ;
complained = true ;
}
}
memset ( tempglyphs , 0 , sizeof ( tempglyphs ) ) ;
for ( i = 0 ;
i < planesize ;
++ i ) if ( map -> map [ j + lbase + i ] != - 1 && sf -> glyphs [ map -> map [ j + lbase + i ] ] != NULL && sf -> glyphs [ map -> map [ j + lbase + i ] ] -> ttf_glyph != - 1 ) tempglyphs [ i ] = sf -> glyphs [ map -> map [ j + lbase + i ] ] -> ttf_glyph ;
for ( i = 1 ;
i < pos ;
++ i ) {
int delta = 0 ;
for ( k = 0 ;
k < planesize ;
++ k ) if ( tempglyphs [ k ] == 0 && glyphs [ plane0size + ( i - 1 ) * planesize + k ] == 0 ) ;
else if ( tempglyphs [ k ] == 0 || glyphs [ plane0size + ( i - 1 ) * planesize + k ] == 0 ) break ;
else if ( delta == 0 ) delta = ( uint16 ) ( tempglyphs [ k ] - glyphs [ plane0size + ( i - 1 ) * planesize + k ] ) ;
else if ( tempglyphs [ k ] == ( uint16 ) ( glyphs [ plane0size + ( i - 1 ) * planesize + k ] + delta ) ) ;
else break ;
if ( k == planesize ) {
subheads [ subheadindex ] . delta = delta ;
subheads [ subheadindex ] . rangeoff = plane0size + ( i - 1 ) * planesize ;
break ;
}
}
if ( subheads [ subheadindex ] . rangeoff == 0 ) {
memcpy ( glyphs + ( pos - 1 ) * planesize + plane0size , tempglyphs , planesize * sizeof ( uint16 ) ) ;
subheads [ subheadindex ] . rangeoff = plane0size + ( pos ++ - 1 ) * planesize ;
}
++ subheadindex ;
}
for ( i = 0 ;
i < subheadcnt + 1 ;
++ i ) subheads [ i ] . rangeoff = subheads [ i ] . rangeoff * sizeof ( uint16 ) + ( subheadcnt - i ) * sizeof ( struct subhead ) + sizeof ( uint16 ) ;
sub = tmpfile ( ) ;
if ( sub == NULL ) return ( NULL ) ;
putshort ( sub , 2 ) ;
putshort ( sub , 0 ) ;
putshort ( sub , 0 ) ;
for ( i = 0 ;
i < 256 ;
++ i ) putshort ( sub , table [ i ] ) ;
for ( i = 0 ;
i < subheadcnt + 1 ;
++ i ) {
putshort ( sub , subheads [ i ] . first ) ;
putshort ( sub , subheads [ i ] . cnt ) ;
putshort ( sub , subheads [ i ] . delta ) ;
putshort ( sub , subheads [ i ] . rangeoff ) ;
}
for ( i = 0 ;
i < ( pos - 1 ) * planesize + plane0size ;
++ i ) putshort ( sub , glyphs [ i ] ) ;
free ( glyphs ) ;
* tlen = ftell ( sub ) ;
fseek ( sub , 2 , SEEK_SET ) ;
putshort ( sub , * tlen ) ;
rewind ( sub ) ;
return ( sub ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ohci_async_cancel_device ( OHCIState * ohci , USBDevice * dev ) {
if ( ohci -> async_td && usb_packet_is_inflight ( & ohci -> usb_packet ) && ohci -> usb_packet . ep -> dev == dev ) {
usb_cancel_packet ( & ohci -> usb_packet ) ;
ohci -> async_td = 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int file_is_y4m ( const char detect [ 4 ] ) {
if ( memcmp ( detect , "YUV4" , 4 ) == 0 ) {
return 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
proto_item * proto_tree_add_ether ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start , gint length , const guint8 * value ) {
proto_item * pi ;
header_field_info * hfinfo ;
CHECK_FOR_NULL_TREE ( tree ) ;
TRY_TO_FAKE_THIS_ITEM ( tree , hfindex , hfinfo ) ;
DISSECTOR_ASSERT_FIELD_TYPE ( hfinfo , FT_ETHER ) ;
pi = proto_tree_add_pi ( tree , hfinfo , tvb , start , & length ) ;
proto_tree_set_ether ( PNODE_FINFO ( pi ) , value ) ;
return pi ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
extern int slurm_fail_job ( uint32_t job_id , uint32_t job_state ) {
int error_code ;
DEF_TIMERS ;
slurmctld_lock_t job_write_lock = {
NO_LOCK , WRITE_LOCK , WRITE_LOCK , NO_LOCK , NO_LOCK }
;
START_TIMER ;
lock_slurmctld ( job_write_lock ) ;
error_code = job_fail ( job_id , job_state ) ;
unlock_slurmctld ( job_write_lock ) ;
END_TIMER2 ( "slurm_fail_job" ) ;
return error_code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dissect_h225_ServiceControlSession ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_ServiceControlSession , ServiceControlSession_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int dtls1_read_failed ( SSL * s , int code ) {
if ( code > 0 ) {
SSLerr ( SSL_F_DTLS1_READ_FAILED , ERR_R_INTERNAL_ERROR ) ;
return 1 ;
}
if ( ! dtls1_is_timer_expired ( s ) ) {
return code ;
}
# ifndef OPENSSL_NO_HEARTBEATS if ( ! SSL_in_init ( s ) && ! s -> tlsext_hb_pending ) # else if ( ! SSL_in_init ( s ) ) # endif {
BIO_set_flags ( SSL_get_rbio ( s ) , BIO_FLAGS_READ ) ;
return code ;
}
return dtls1_handle_timeout ( s ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int combined_motion_search ( VP9_COMP * cpi , MACROBLOCK * x , BLOCK_SIZE bsize , int mi_row , int mi_col , int_mv * tmp_mv , int * rate_mv , int64_t best_rd_sofar ) {
MACROBLOCKD * xd = & x -> e_mbd ;
MB_MODE_INFO * mbmi = & xd -> mi [ 0 ] . src_mi -> mbmi ;
struct buf_2d backup_yv12 [ MAX_MB_PLANE ] = {
{
0 , 0 }
}
;
const int step_param = cpi -> sf . mv . fullpel_search_step_param ;
const int sadpb = x -> sadperbit16 ;
MV mvp_full ;
const int ref = mbmi -> ref_frame [ 0 ] ;
const MV ref_mv = mbmi -> ref_mvs [ ref ] [ 0 ] . as_mv ;
int dis ;
int rate_mode ;
const int tmp_col_min = x -> mv_col_min ;
const int tmp_col_max = x -> mv_col_max ;
const int tmp_row_min = x -> mv_row_min ;
const int tmp_row_max = x -> mv_row_max ;
int rv = 0 ;
int sad_list [ 5 ] ;
const YV12_BUFFER_CONFIG * scaled_ref_frame = vp9_get_scaled_ref_frame ( cpi , ref ) ;
if ( cpi -> common . show_frame && ( x -> pred_mv_sad [ ref ] >> 3 ) > x -> pred_mv_sad [ LAST_FRAME ] ) return rv ;
if ( scaled_ref_frame ) {
int i ;
for ( i = 0 ;
i < MAX_MB_PLANE ;
i ++ ) backup_yv12 [ i ] = xd -> plane [ i ] . pre [ 0 ] ;
vp9_setup_pre_planes ( xd , 0 , scaled_ref_frame , mi_row , mi_col , NULL ) ;
}
vp9_set_mv_search_range ( x , & ref_mv ) ;
assert ( x -> mv_best_ref_index [ ref ] <= 2 ) ;
if ( x -> mv_best_ref_index [ ref ] < 2 ) mvp_full = mbmi -> ref_mvs [ ref ] [ x -> mv_best_ref_index [ ref ] ] . as_mv ;
else mvp_full = x -> pred_mv [ ref ] ;
mvp_full . col >>= 3 ;
mvp_full . row >>= 3 ;
vp9_full_pixel_search ( cpi , x , bsize , & mvp_full , step_param , sadpb , cond_sad_list ( cpi , sad_list ) , & ref_mv , & tmp_mv -> as_mv , INT_MAX , 0 ) ;
x -> mv_col_min = tmp_col_min ;
x -> mv_col_max = tmp_col_max ;
x -> mv_row_min = tmp_row_min ;
x -> mv_row_max = tmp_row_max ;
mvp_full . row = tmp_mv -> as_mv . row * 8 ;
mvp_full . col = tmp_mv -> as_mv . col * 8 ;
* rate_mv = vp9_mv_bit_cost ( & mvp_full , & ref_mv , x -> nmvjointcost , x -> mvcost , MV_COST_WEIGHT ) ;
rate_mode = cpi -> inter_mode_cost [ mbmi -> mode_context [ ref ] ] [ INTER_OFFSET ( NEWMV ) ] ;
rv = ! ( RDCOST ( x -> rdmult , x -> rddiv , ( * rate_mv + rate_mode ) , 0 ) > best_rd_sofar ) ;
if ( rv ) {
cpi -> find_fractional_mv_step ( x , & tmp_mv -> as_mv , & ref_mv , cpi -> common . allow_high_precision_mv , x -> errorperbit , & cpi -> fn_ptr [ bsize ] , cpi -> sf . mv . subpel_force_stop , cpi -> sf . mv . subpel_iters_per_step , cond_sad_list ( cpi , sad_list ) , x -> nmvjointcost , x -> mvcost , & dis , & x -> pred_sse [ ref ] , NULL , 0 , 0 ) ;
x -> pred_mv [ ref ] = tmp_mv -> as_mv ;
}
if ( scaled_ref_frame ) {
int i ;
for ( i = 0 ;
i < MAX_MB_PLANE ;
i ++ ) xd -> plane [ i ] . pre [ 0 ] = backup_yv12 [ i ] ;
}
return rv ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int spl_filesystem_object_cast ( zval * readobj , zval * writeobj , int type TSRMLS_DC ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( readobj TSRMLS_CC ) ;
if ( type == IS_STRING ) {
if ( Z_OBJCE_P ( readobj ) -> __tostring ) {
return std_object_handlers . cast_object ( readobj , writeobj , type TSRMLS_CC ) ;
}
switch ( intern -> type ) {
case SPL_FS_INFO : case SPL_FS_FILE : if ( readobj == writeobj ) {
zval retval ;
zval * retval_ptr = & retval ;
ZVAL_STRINGL ( retval_ptr , intern -> file_name , intern -> file_name_len , 1 ) ;
zval_dtor ( readobj ) ;
ZVAL_ZVAL ( writeobj , retval_ptr , 0 , 0 ) ;
}
else {
ZVAL_STRINGL ( writeobj , intern -> file_name , intern -> file_name_len , 1 ) ;
}
return SUCCESS ;
case SPL_FS_DIR : if ( readobj == writeobj ) {
zval retval ;
zval * retval_ptr = & retval ;
ZVAL_STRING ( retval_ptr , intern -> u . dir . entry . d_name , 1 ) ;
zval_dtor ( readobj ) ;
ZVAL_ZVAL ( writeobj , retval_ptr , 0 , 0 ) ;
}
else {
ZVAL_STRING ( writeobj , intern -> u . dir . entry . d_name , 1 ) ;
}
return SUCCESS ;
}
}
else if ( type == IS_BOOL ) {
ZVAL_BOOL ( writeobj , 1 ) ;
return SUCCESS ;
}
if ( readobj == writeobj ) {
zval_dtor ( readobj ) ;
}
ZVAL_NULL ( writeobj ) ;
return FAILURE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int table2myisam ( TABLE * table_arg , MI_KEYDEF * * keydef_out , MI_COLUMNDEF * * recinfo_out , uint * records_out ) {
uint i , j , recpos , minpos , fieldpos , temp_length , length ;
enum ha_base_keytype type = HA_KEYTYPE_BINARY ;
uchar * record ;
KEY * pos ;
MI_KEYDEF * keydef ;
MI_COLUMNDEF * recinfo , * recinfo_pos ;
HA_KEYSEG * keyseg ;
TABLE_SHARE * share = table_arg -> s ;
uint options = share -> db_options_in_use ;
DBUG_ENTER ( "table2myisam" ) ;
if ( ! ( my_multi_malloc ( MYF ( MY_WME ) , recinfo_out , ( share -> fields * 2 + 2 ) * sizeof ( MI_COLUMNDEF ) , keydef_out , share -> keys * sizeof ( MI_KEYDEF ) , & keyseg , ( share -> key_parts + share -> keys ) * sizeof ( HA_KEYSEG ) , NullS ) ) ) DBUG_RETURN ( HA_ERR_OUT_OF_MEM ) ;
keydef = * keydef_out ;
recinfo = * recinfo_out ;
pos = table_arg -> key_info ;
for ( i = 0 ;
i < share -> keys ;
i ++ , pos ++ ) {
keydef [ i ] . flag = ( ( uint16 ) pos -> flags & ( HA_NOSAME | HA_FULLTEXT | HA_SPATIAL ) ) ;
keydef [ i ] . key_alg = pos -> algorithm == HA_KEY_ALG_UNDEF ? ( pos -> flags & HA_SPATIAL ? HA_KEY_ALG_RTREE : HA_KEY_ALG_BTREE ) : pos -> algorithm ;
keydef [ i ] . block_length = pos -> block_size ;
keydef [ i ] . seg = keyseg ;
keydef [ i ] . keysegs = pos -> key_parts ;
for ( j = 0 ;
j < pos -> key_parts ;
j ++ ) {
Field * field = pos -> key_part [ j ] . field ;
type = field -> key_type ( ) ;
keydef [ i ] . seg [ j ] . flag = pos -> key_part [ j ] . key_part_flag ;
if ( options & HA_OPTION_PACK_KEYS || ( pos -> flags & ( HA_PACK_KEY | HA_BINARY_PACK_KEY | HA_SPACE_PACK_USED ) ) ) {
if ( pos -> key_part [ j ] . length > 8 && ( type == HA_KEYTYPE_TEXT || type == HA_KEYTYPE_NUM || ( type == HA_KEYTYPE_BINARY && ! field -> zero_pack ( ) ) ) ) {
if ( j == 0 ) keydef [ i ] . flag |= HA_PACK_KEY ;
if ( ! ( field -> flags & ZEROFILL_FLAG ) && ( field -> type ( ) == MYSQL_TYPE_STRING || field -> type ( ) == MYSQL_TYPE_VAR_STRING || ( ( int ) ( pos -> key_part [ j ] . length - field -> decimals ( ) ) ) >= 4 ) ) keydef [ i ] . seg [ j ] . flag |= HA_SPACE_PACK ;
}
else if ( j == 0 && ( ! ( pos -> flags & HA_NOSAME ) || pos -> key_length > 16 ) ) keydef [ i ] . flag |= HA_BINARY_PACK_KEY ;
}
keydef [ i ] . seg [ j ] . type = ( int ) type ;
keydef [ i ] . seg [ j ] . start = pos -> key_part [ j ] . offset ;
keydef [ i ] . seg [ j ] . length = pos -> key_part [ j ] . length ;
keydef [ i ] . seg [ j ] . bit_start = keydef [ i ] . seg [ j ] . bit_end = keydef [ i ] . seg [ j ] . bit_length = 0 ;
keydef [ i ] . seg [ j ] . bit_pos = 0 ;
keydef [ i ] . seg [ j ] . language = field -> charset_for_protocol ( ) -> number ;
if ( field -> null_ptr ) {
keydef [ i ] . seg [ j ] . null_bit = field -> null_bit ;
keydef [ i ] . seg [ j ] . null_pos = ( uint ) ( field -> null_ptr - ( uchar * ) table_arg -> record [ 0 ] ) ;
}
else {
keydef [ i ] . seg [ j ] . null_bit = 0 ;
keydef [ i ] . seg [ j ] . null_pos = 0 ;
}
if ( field -> type ( ) == MYSQL_TYPE_BLOB || field -> type ( ) == MYSQL_TYPE_GEOMETRY ) {
keydef [ i ] . seg [ j ] . flag |= HA_BLOB_PART ;
keydef [ i ] . seg [ j ] . bit_start = ( uint ) ( field -> pack_length ( ) - share -> blob_ptr_size ) ;
}
else if ( field -> type ( ) == MYSQL_TYPE_BIT ) {
keydef [ i ] . seg [ j ] . bit_length = ( ( Field_bit * ) field ) -> bit_len ;
keydef [ i ] . seg [ j ] . bit_start = ( ( Field_bit * ) field ) -> bit_ofs ;
keydef [ i ] . seg [ j ] . bit_pos = ( uint ) ( ( ( Field_bit * ) field ) -> bit_ptr - ( uchar * ) table_arg -> record [ 0 ] ) ;
}
}
keyseg += pos -> key_parts ;
}
if ( table_arg -> found_next_number_field ) keydef [ share -> next_number_index ] . flag |= HA_AUTO_KEY ;
record = table_arg -> record [ 0 ] ;
recpos = 0 ;
recinfo_pos = recinfo ;
while ( recpos < ( uint ) share -> reclength ) {
Field * * field , * found = 0 ;
minpos = share -> reclength ;
length = 0 ;
for ( field = table_arg -> field ;
* field ;
field ++ ) {
if ( ( fieldpos = ( * field ) -> offset ( record ) ) >= recpos && fieldpos <= minpos ) {
if ( ! ( temp_length = ( * field ) -> pack_length_in_rec ( ) ) ) continue ;
if ( ! found || fieldpos < minpos || ( fieldpos == minpos && temp_length < length ) ) {
minpos = fieldpos ;
found = * field ;
length = temp_length ;
}
}
}
DBUG_PRINT ( "loop" , ( "found: 0x%lx recpos: %d minpos: %d length: %d" , ( long ) found , recpos , minpos , length ) ) ;
if ( recpos != minpos ) {
bzero ( ( char * ) recinfo_pos , sizeof ( * recinfo_pos ) ) ;
recinfo_pos -> type = ( int ) FIELD_NORMAL ;
recinfo_pos ++ -> length = ( uint16 ) ( minpos - recpos ) ;
}
if ( ! found ) break ;
if ( found -> flags & BLOB_FLAG ) recinfo_pos -> type = ( int ) FIELD_BLOB ;
else if ( found -> type ( ) == MYSQL_TYPE_VARCHAR ) recinfo_pos -> type = FIELD_VARCHAR ;
else if ( ! ( options & HA_OPTION_PACK_RECORD ) ) recinfo_pos -> type = ( int ) FIELD_NORMAL ;
else if ( found -> zero_pack ( ) ) recinfo_pos -> type = ( int ) FIELD_SKIP_ZERO ;
else recinfo_pos -> type = ( int ) ( ( length <= 3 || ( found -> flags & ZEROFILL_FLAG ) ) ? FIELD_NORMAL : found -> type ( ) == MYSQL_TYPE_STRING || found -> type ( ) == MYSQL_TYPE_VAR_STRING ? FIELD_SKIP_ENDSPACE : FIELD_SKIP_PRESPACE ) ;
if ( found -> null_ptr ) {
recinfo_pos -> null_bit = found -> null_bit ;
recinfo_pos -> null_pos = ( uint ) ( found -> null_ptr - ( uchar * ) table_arg -> record [ 0 ] ) ;
}
else {
recinfo_pos -> null_bit = 0 ;
recinfo_pos -> null_pos = 0 ;
}
( recinfo_pos ++ ) -> length = ( uint16 ) length ;
recpos = minpos + length ;
DBUG_PRINT ( "loop" , ( "length: %d type: %d" , recinfo_pos [ - 1 ] . length , recinfo_pos [ - 1 ] . type ) ) ;
}
* records_out = ( uint ) ( recinfo_pos - recinfo ) ;
DBUG_RETURN ( 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static unsigned char * dtls1_write_message_header ( SSL * s , unsigned char * p ) {
struct hm_header_st * msg_hdr = & s -> d1 -> w_msg_hdr ;
* p ++ = msg_hdr -> type ;
l2n3 ( msg_hdr -> msg_len , p ) ;
s2n ( msg_hdr -> seq , p ) ;
l2n3 ( msg_hdr -> frag_off , p ) ;
l2n3 ( msg_hdr -> frag_len , p ) ;
return p ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int fz_make_hash_link_key ( fz_context * ctx , fz_store_hash * hash , void * key_ ) {
fz_link_key * key = ( fz_link_key * ) key_ ;
memcpy ( hash -> u . link . dst_md5 , key -> dst_md5 , 16 ) ;
memcpy ( hash -> u . link . src_md5 , key -> src_md5 , 16 ) ;
hash -> u . link . ri = key -> rend . ri ;
hash -> u . link . bp = key -> rend . bp ;
hash -> u . link . src_extras = key -> src_extras ;
hash -> u . link . dst_extras = key -> dst_extras ;
hash -> u . link . bpp16 = key -> depth == 2 ;
hash -> u . link . proof = key -> proof ;
hash -> u . link . copy_spots = key -> copy_spots ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_sc_pattern ( fz_context * ctx , pdf_processor * proc , const char * name , pdf_pattern * pat , int n , float * color ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pr -> dev -> flags &= ~ FZ_DEVFLAG_FILLCOLOR_UNDEFINED ;
pdf_set_pattern ( ctx , pr , PDF_FILL , pat , color ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool parse_policyMappings ( chunk_t blob , int level0 , private_x509_cert_t * this ) {
x509_policy_mapping_t * map = NULL ;
asn1_parser_t * parser ;
chunk_t object ;
int objectID ;
bool success ;
parser = asn1_parser_create ( policyMappingsObjects , blob ) ;
parser -> set_top_level ( parser , level0 ) ;
while ( parser -> iterate ( parser , & objectID , & object ) ) {
switch ( objectID ) {
case POLICY_MAPPING : INIT ( map ) ;
this -> policy_mappings -> insert_last ( this -> policy_mappings , map ) ;
break ;
case POLICY_MAPPING_ISSUER : if ( map && ! map -> issuer . len ) {
map -> issuer = chunk_clone ( object ) ;
}
break ;
case POLICY_MAPPING_SUBJECT : if ( map && ! map -> subject . len ) {
map -> subject = chunk_clone ( object ) ;
}
break ;
default : break ;
}
}
success = parser -> success ( parser ) ;
parser -> destroy ( parser ) ;
return success ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
unsigned int vp9_sub_pixel_avg_variance ## W ## x ## H ## _c ( const uint8_t * src , int src_stride , int xoffset , int yoffset , const uint8_t * dst , int dst_stride , unsigned int * sse , const uint8_t * second_pred ) {
uint16_t fdata3 [ ( H + 1 ) * W ] ;
uint8_t temp2 [ H * W ] ;
DECLARE_ALIGNED_ARRAY ( 16 , uint8_t , temp3 , H * W ) ;
var_filter_block2d_bil_first_pass ( src , fdata3 , src_stride , 1 , H + 1 , W , BILINEAR_FILTERS_2TAP ( xoffset ) ) ;
var_filter_block2d_bil_second_pass ( fdata3 , temp2 , W , W , H , W , BILINEAR_FILTERS_2TAP ( yoffset ) ) ;
vp9_comp_avg_pred ( temp3 , second_pred , W , H , temp2 , W ) ;
return vp9_variance ## W ## x ## H ## _c ( temp3 , W , dst , dst_stride , sse ) ;
\ }
void vp9_get16x16var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 16 , 16 , sse , sum ) ;
}
void vp9_get8x8var_c ( const uint8_t * src_ptr , int source_stride , const uint8_t * ref_ptr , int ref_stride , unsigned int * sse , int * sum ) {
variance ( src_ptr , source_stride , ref_ptr , ref_stride , 8 , 8 , sse , sum ) ;
}
unsigned int vp9_mse16x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse16x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 16 , 8 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x16_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 16 , sse , & sum ) ;
return * sse ;
}
unsigned int vp9_mse8x8_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sse ) {
int sum ;
variance ( src , src_stride , ref , ref_stride , 8 , 8 , sse , & sum ) ;
return * sse ;
}
VAR ( 4 , 4 ) SUBPIX_VAR ( 4 , 4 ) SUBPIX_AVG_VAR ( 4 , 4 ) VAR ( 4 , 8 ) SUBPIX_VAR ( 4 , 8 ) SUBPIX_AVG_VAR ( 4 , 8 ) VAR ( 8 , 4 ) SUBPIX_VAR ( 8 , 4 ) SUBPIX_AVG_VAR ( 8 , 4 ) VAR ( 8 , 8 ) SUBPIX_VAR ( 8 , 8 ) SUBPIX_AVG_VAR ( 8 , 8 ) VAR ( 8 , 16 ) SUBPIX_VAR ( 8 , 16 ) SUBPIX_AVG_VAR ( 8 , 16 ) VAR ( 16 , 8 ) SUBPIX_VAR ( 16 , 8 ) SUBPIX_AVG_VAR ( 16 , 8 ) VAR ( 16 , 16 ) SUBPIX_VAR ( 16 , 16 ) SUBPIX_AVG_VAR ( 16 , 16 ) VAR ( 16 , 32 ) SUBPIX_VAR ( 16 , 32 ) SUBPIX_AVG_VAR ( 16 , 32 )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void file_info_start ( NautilusDirectory * directory , NautilusFile * file , gboolean * doing_io ) {
GFile * location ;
GetInfoState * state ;
file_info_stop ( directory ) ;
if ( directory -> details -> get_info_in_progress != NULL ) {
* doing_io = TRUE ;
return ;
}
if ( ! is_needy ( file , lacks_info , REQUEST_FILE_INFO ) ) {
return ;
}
* doing_io = TRUE ;
if ( ! async_job_start ( directory , "file info" ) ) {
return ;
}
directory -> details -> get_info_file = file ;
file -> details -> get_info_failed = FALSE ;
if ( file -> details -> get_info_error ) {
g_error_free ( file -> details -> get_info_error ) ;
file -> details -> get_info_error = NULL ;
}
state = g_new ( GetInfoState , 1 ) ;
state -> directory = directory ;
state -> cancellable = g_cancellable_new ( ) ;
directory -> details -> get_info_in_progress = state ;
location = nautilus_file_get_location ( file ) ;
g_file_query_info_async ( location , NAUTILUS_FILE_DEFAULT_ATTRIBUTES , 0 , G_PRIORITY_DEFAULT , state -> cancellable , query_info_callback , state ) ;
g_object_unref ( location ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean file_was_cancelled ( NautilusFile * file ) {
GError * error ;
error = nautilus_file_get_file_info_error ( file ) ;
return error != NULL && error -> domain == G_IO_ERROR && error -> code == G_IO_ERROR_CANCELLED ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void php_zip_free_entry ( zend_rsrc_list_entry * rsrc TSRMLS_DC ) {
zip_read_rsrc * zr_rsrc = ( zip_read_rsrc * ) rsrc -> ptr ;
if ( zr_rsrc ) {
if ( zr_rsrc -> zf ) {
if ( zr_rsrc -> zf -> za ) {
zip_fclose ( zr_rsrc -> zf ) ;
}
else {
if ( zr_rsrc -> zf -> src ) zip_source_free ( zr_rsrc -> zf -> src ) ;
free ( zr_rsrc -> zf ) ;
}
zr_rsrc -> zf = NULL ;
}
efree ( zr_rsrc ) ;
rsrc -> ptr = NULL ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_rsl_ie_frame_no ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_tree * ie_tree ;
guint8 ie_id ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_FRAME_NO ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 3 , ett_ie_frame_no , NULL , "Frame Number IE" ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T1prim , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T3 , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset ++ ;
proto_tree_add_item ( ie_tree , hf_rsl_req_ref_T2 , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug5315 ( ) {
MYSQL_STMT * stmt ;
const char * stmt_text ;
int rc ;
myheader ( "test_bug5315" ) ;
stmt_text = "SELECT 1" ;
stmt = mysql_stmt_init ( mysql ) ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
DIE_UNLESS ( rc == 0 ) ;
if ( ! opt_silent ) printf ( "Excuting mysql_change_user\n" ) ;
mysql_change_user ( mysql , opt_user , opt_password , current_db ) ;
if ( ! opt_silent ) printf ( "Excuting mysql_stmt_execute\n" ) ;
rc = mysql_stmt_execute ( stmt ) ;
DIE_UNLESS ( rc != 0 ) ;
if ( rc ) {
if ( ! opt_silent ) printf ( "Got error (as expected): '%s'\n" , mysql_stmt_error ( stmt ) ) ;
}
if ( ! opt_silent ) printf ( "Excuting mysql_stmt_close\n" ) ;
mysql_stmt_close ( stmt ) ;
if ( ! opt_silent ) printf ( "Excuting mysql_stmt_init\n" ) ;
stmt = mysql_stmt_init ( mysql ) ;
rc = mysql_stmt_prepare ( stmt , stmt_text , strlen ( stmt_text ) ) ;
DIE_UNLESS ( rc == 0 ) ;
rc = mysql_stmt_execute ( stmt ) ;
DIE_UNLESS ( rc == 0 ) ;
mysql_stmt_close ( stmt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int i2d_DSA_PUBKEY_bio ( BIO * bp , DSA * dsa ) {
return ASN1_i2d_bio_of ( DSA , i2d_DSA_PUBKEY , bp , dsa ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mss1_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
MSS1Context * ctx = avctx -> priv_data ;
MSS12Context * c = & ctx -> ctx ;
GetBitContext gb ;
ArithCoder acoder ;
int pal_changed = 0 ;
int ret ;
init_get_bits ( & gb , buf , buf_size * 8 ) ;
arith_init ( & acoder , & gb ) ;
if ( ( ret = ff_reget_buffer ( avctx , & ctx -> pic ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
c -> pal_pic = ctx -> pic . data [ 0 ] + ctx -> pic . linesize [ 0 ] * ( avctx -> height - 1 ) ;
c -> pal_stride = - ctx -> pic . linesize [ 0 ] ;
c -> keyframe = ! arith_get_bit ( & acoder ) ;
if ( c -> keyframe ) {
c -> corrupted = 0 ;
ff_mss12_slicecontext_reset ( & ctx -> sc ) ;
pal_changed = decode_pal ( c , & acoder ) ;
ctx -> pic . key_frame = 1 ;
ctx -> pic . pict_type = AV_PICTURE_TYPE_I ;
}
else {
if ( c -> corrupted ) return AVERROR_INVALIDDATA ;
ctx -> pic . key_frame = 0 ;
ctx -> pic . pict_type = AV_PICTURE_TYPE_P ;
}
c -> corrupted = ff_mss12_decode_rect ( & ctx -> sc , & acoder , 0 , 0 , avctx -> width , avctx -> height ) ;
if ( c -> corrupted ) return AVERROR_INVALIDDATA ;
memcpy ( ctx -> pic . data [ 1 ] , c -> pal , AVPALETTE_SIZE ) ;
ctx -> pic . palette_has_changed = pal_changed ;
if ( ( ret = av_frame_ref ( data , & ctx -> pic ) ) < 0 ) return ret ;
* got_frame = 1 ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static unsigned make_codepage_from_charset ( const char * charset ) {
( void ) charset ;
return ( - 1 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int gs_pop_string ( gs_main_instance * minst , gs_string * result ) {
i_ctx_t * i_ctx_p = minst -> i_ctx_p ;
ref vref ;
int code = pop_value ( i_ctx_p , & vref ) ;
if ( code < 0 ) return code ;
switch ( r_type ( & vref ) ) {
case t_name : name_string_ref ( minst -> heap , & vref , & vref ) ;
code = 1 ;
goto rstr ;
case t_string : code = ( r_has_attr ( & vref , a_write ) ? 0 : 1 ) ;
rstr : result -> data = vref . value . bytes ;
result -> size = r_size ( & vref ) ;
break ;
default : return_error ( gs_error_typecheck ) ;
}
ref_stack_pop ( & o_stack , 1 ) ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void writer_print_integers ( WriterContext * wctx , const char * name , uint8_t * data , int size , const char * format , int columns , int bytes , int offset_add ) {
AVBPrint bp ;
int offset = 0 , l , i ;
av_bprint_init ( & bp , 0 , AV_BPRINT_SIZE_UNLIMITED ) ;
av_bprintf ( & bp , "\n" ) ;
while ( size ) {
av_bprintf ( & bp , "%08x: " , offset ) ;
l = FFMIN ( size , columns ) ;
for ( i = 0 ;
i < l ;
i ++ ) {
if ( bytes == 1 ) av_bprintf ( & bp , format , * data ) ;
else if ( bytes == 2 ) av_bprintf ( & bp , format , AV_RN16 ( data ) ) ;
else if ( bytes == 4 ) av_bprintf ( & bp , format , AV_RN32 ( data ) ) ;
data += bytes ;
size -- ;
}
av_bprintf ( & bp , "\n" ) ;
offset += offset_add ;
}
writer_print_string ( wctx , name , bp . str , 0 ) ;
av_bprint_finalize ( & bp , NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_P ( BrowserCloseManagerBrowserTest , MAYBE_TestSessionRestore ) {
EXPECT_EQ ( 2 , browser ( ) -> tab_strip_model ( ) -> count ( ) ) ;
EXPECT_EQ ( GURL ( chrome : : kChromeUIVersionURL ) , browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 0 ) -> GetURL ( ) ) ;
EXPECT_EQ ( GURL ( "about:blank" ) , browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 1 ) -> GetURL ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static my_socket activate_tcp_port ( uint port ) {
struct addrinfo * ai , * a ;
struct addrinfo hints ;
int error ;
int arg ;
char port_buf [ NI_MAXSERV ] ;
my_socket ip_sock = INVALID_SOCKET ;
DBUG_ENTER ( "activate_tcp_port" ) ;
DBUG_PRINT ( "general" , ( "IP Socket is %d" , port ) ) ;
bzero ( & hints , sizeof ( hints ) ) ;
hints . ai_flags = AI_PASSIVE ;
hints . ai_socktype = SOCK_STREAM ;
hints . ai_family = AF_UNSPEC ;
my_snprintf ( port_buf , NI_MAXSERV , "%d" , port ) ;
error = getaddrinfo ( my_bind_addr_str , port_buf , & hints , & ai ) ;
if ( error != 0 ) {
DBUG_PRINT ( "error" , ( "Got error: %d from getaddrinfo()" , error ) ) ;
sql_perror ( ER_DEFAULT ( ER_IPSOCK_ERROR ) ) ;
unireg_abort ( 1 ) ;
}
for ( a = ai ;
a != NULL ;
a = a -> ai_next ) {
ip_sock = socket ( a -> ai_family , a -> ai_socktype , a -> ai_protocol ) ;
char ip_addr [ INET6_ADDRSTRLEN ] ;
if ( vio_get_normalized_ip_string ( a -> ai_addr , a -> ai_addrlen , ip_addr , sizeof ( ip_addr ) ) ) {
ip_addr [ 0 ] = 0 ;
}
if ( ip_sock == INVALID_SOCKET ) {
sql_print_error ( "Failed to create a socket for %s '%s': errno: %d." , ( a -> ai_family == AF_INET ) ? "IPv4" : "IPv6" , ( const char * ) ip_addr , ( int ) socket_errno ) ;
}
else {
sql_print_information ( "Server socket created on IP: '%s'." , ( const char * ) ip_addr ) ;
break ;
}
}
if ( ip_sock == INVALID_SOCKET ) {
DBUG_PRINT ( "error" , ( "Got error: %d from socket()" , socket_errno ) ) ;
sql_perror ( ER_DEFAULT ( ER_IPSOCK_ERROR ) ) ;
unireg_abort ( 1 ) ;
}
# ifndef __WIN__ arg = 1 ;
( void ) setsockopt ( ip_sock , SOL_SOCKET , SO_REUSEADDR , ( char * ) & arg , sizeof ( arg ) ) ;
# endif # ifdef IPV6_V6ONLY if ( a -> ai_family == AF_INET6 ) {
arg = 0 ;
( void ) setsockopt ( ip_sock , IPPROTO_IPV6 , IPV6_V6ONLY , ( char * ) & arg , sizeof ( arg ) ) ;
}
# endif int ret ;
uint waited , retry , this_wait ;
for ( waited = 0 , retry = 1 ;
;
retry ++ , waited += this_wait ) {
if ( ( ( ret = bind ( ip_sock , a -> ai_addr , a -> ai_addrlen ) ) >= 0 ) || ( socket_errno != SOCKET_EADDRINUSE ) || ( waited >= mysqld_port_timeout ) ) break ;
sql_print_information ( "Retrying bind on TCP/IP port %u" , port ) ;
this_wait = retry * retry / 3 + 1 ;
sleep ( this_wait ) ;
}
freeaddrinfo ( ai ) ;
if ( ret < 0 ) {
char buff [ 100 ] ;
sprintf ( buff , "Can't start server: Bind on TCP/IP port. Got error: %d" , ( int ) socket_errno ) ;
sql_perror ( buff ) ;
sql_print_error ( "Do you already have another mysqld server running on " "port: %u ?" , port ) ;
unireg_abort ( 1 ) ;
}
if ( listen ( ip_sock , ( int ) back_log ) < 0 ) {
sql_perror ( "Can't start server: listen() on TCP/IP port" ) ;
sql_print_error ( "listen() on TCP/IP failed with error %d" , socket_errno ) ;
unireg_abort ( 1 ) ;
}
DBUG_RETURN ( ip_sock ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
const char * _gcry_ecc_get_curve ( gcry_mpi_t * pkey , int iterator , unsigned int * r_nbits ) {
gpg_err_code_t err ;
elliptic_curve_t E ;
int idx ;
gcry_mpi_t tmp ;
const char * result = NULL ;
if ( r_nbits ) * r_nbits = 0 ;
if ( ! pkey ) {
idx = iterator ;
if ( idx >= 0 && idx < DIM ( domain_parms ) ) {
result = domain_parms [ idx ] . desc ;
if ( r_nbits ) * r_nbits = domain_parms [ idx ] . nbits ;
}
return result ;
}
if ( ! pkey [ 0 ] || ! pkey [ 1 ] || ! pkey [ 2 ] || ! pkey [ 3 ] || ! pkey [ 4 ] ) return NULL ;
E . model = MPI_EC_WEIERSTRASS ;
E . p = pkey [ 0 ] ;
E . a = pkey [ 1 ] ;
E . b = pkey [ 2 ] ;
_gcry_mpi_point_init ( & E . G ) ;
err = _gcry_ecc_os2ec ( & E . G , pkey [ 3 ] ) ;
if ( err ) {
_gcry_mpi_point_free_parts ( & E . G ) ;
return NULL ;
}
E . n = pkey [ 4 ] ;
for ( idx = 0 ;
domain_parms [ idx ] . desc ;
idx ++ ) {
tmp = scanval ( domain_parms [ idx ] . p ) ;
if ( ! mpi_cmp ( tmp , E . p ) ) {
mpi_free ( tmp ) ;
tmp = scanval ( domain_parms [ idx ] . a ) ;
if ( ! mpi_cmp ( tmp , E . a ) ) {
mpi_free ( tmp ) ;
tmp = scanval ( domain_parms [ idx ] . b ) ;
if ( ! mpi_cmp ( tmp , E . b ) ) {
mpi_free ( tmp ) ;
tmp = scanval ( domain_parms [ idx ] . n ) ;
if ( ! mpi_cmp ( tmp , E . n ) ) {
mpi_free ( tmp ) ;
tmp = scanval ( domain_parms [ idx ] . g_x ) ;
if ( ! mpi_cmp ( tmp , E . G . x ) ) {
mpi_free ( tmp ) ;
tmp = scanval ( domain_parms [ idx ] . g_y ) ;
if ( ! mpi_cmp ( tmp , E . G . y ) ) {
mpi_free ( tmp ) ;
result = domain_parms [ idx ] . desc ;
if ( r_nbits ) * r_nbits = domain_parms [ idx ] . nbits ;
break ;
}
}
}
}
}
}
mpi_free ( tmp ) ;
}
_gcry_mpi_point_free_parts ( & E . G ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void icc_base_conv_color ( fz_context * ctx , fz_color_converter * cc , float * dstv , const float * srcv ) {
const fz_colorspace * srcs = cc -> ss ;
float local_src_map [ FZ_MAX_COLORS ] ;
float local_src_map2 [ FZ_MAX_COLORS ] ;
float * src_map = local_src_map ;
do {
srcs -> to_ccs ( ctx , srcs , srcv , src_map ) ;
srcs = srcs -> get_base ( srcs ) ;
srcs -> clamp ( srcs , src_map , src_map ) ;
srcv = src_map ;
src_map = ( src_map == local_src_map ? local_src_map2 : local_src_map ) ;
}
while ( ! fz_colorspace_is_icc ( ctx , srcs ) && ! fz_colorspace_is_cal ( ctx , srcs ) ) ;
icc_conv_color ( ctx , cc , dstv , srcv ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static my_bool grant_load ( THD * thd , TABLE_LIST * tables ) {
MEM_ROOT * memex_ptr ;
my_bool return_val = 1 ;
TABLE * t_table = 0 , * c_table = 0 ;
bool check_no_resolve = specialflag & SPECIAL_NO_RESOLVE ;
MEM_ROOT * * save_mem_root_ptr = my_pthread_getspecific_ptr ( MEM_ROOT * * , THR_MALLOC ) ;
ulong old_sql_mode = thd -> variables . sql_mode ;
DBUG_ENTER ( "grant_load" ) ;
thd -> variables . sql_mode &= ~ MODE_PAD_CHAR_TO_FULL_LENGTH ;
( void ) hash_init ( & column_priv_hash , & my_charset_utf8_bin , 0 , 0 , 0 , ( hash_get_key ) get_grant_table , ( hash_free_key ) free_grant_table , 0 ) ;
t_table = tables [ 0 ] . table ;
c_table = tables [ 1 ] . table ;
t_table -> file -> ha_index_init ( 0 , 1 ) ;
t_table -> use_all_columns ( ) ;
c_table -> use_all_columns ( ) ;
if ( ! t_table -> file -> index_first ( t_table -> record [ 0 ] ) ) {
memex_ptr = & memex ;
my_pthread_setspecific_ptr ( THR_MALLOC , & memex_ptr ) ;
do {
GRANT_TABLE * mem_check ;
if ( ! ( mem_check = new ( memex_ptr ) GRANT_TABLE ( t_table , c_table ) ) ) {
goto end_unlock ;
}
if ( check_no_resolve ) {
if ( hostname_requires_resolving ( mem_check -> host . hostname ) ) {
sql_print_warning ( "'tables_priv' entry '%s %s@%s' " "ignored in --skip-name-resolve mode." , mem_check -> tname , mem_check -> user ? mem_check -> user : "" , mem_check -> host . hostname ? mem_check -> host . hostname : "" ) ;
continue ;
}
}
if ( ! mem_check -> ok ( ) ) delete mem_check ;
else if ( my_hash_insert ( & column_priv_hash , ( uchar * ) mem_check ) ) {
delete mem_check ;
goto end_unlock ;
}
}
while ( ! t_table -> file -> index_next ( t_table -> record [ 0 ] ) ) ;
}
return_val = 0 ;
end_unlock : thd -> variables . sql_mode = old_sql_mode ;
t_table -> file -> ha_index_end ( ) ;
my_pthread_setspecific_ptr ( THR_MALLOC , save_mem_root_ptr ) ;
DBUG_RETURN ( return_val ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorJSONRemoveHostNetwork ( qemuMonitorPtr mon , int vlan , const char * netname ) {
int ret ;
virJSONValuePtr cmd = qemuMonitorJSONMakeCommand ( "host_net_remove" , "i:vlan" , vlan , "s:device" , netname , NULL ) ;
virJSONValuePtr reply = NULL ;
if ( ! cmd ) return - 1 ;
ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ;
if ( ret == 0 ) ret = qemuMonitorJSONCheckError ( cmd , reply ) ;
virJSONValueFree ( cmd ) ;
virJSONValueFree ( reply ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void context_alloc ( void ) {
gpg_error_t err ;
gcry_ctx_t ctx ;
gcry_mpi_t p , a ;
wherestr = "context_alloc" ;
show ( "checking context functions\n" ) ;
p = gcry_mpi_set_ui ( NULL , 1 ) ;
a = gcry_mpi_set_ui ( NULL , 1 ) ;
err = ec_p_new ( & ctx , p , a ) ;
if ( err ) die ( "ec_p_new returned an error: %s\n" , gpg_strerror ( err ) ) ;
gcry_mpi_release ( p ) ;
gcry_mpi_release ( a ) ;
gcry_ctx_release ( ctx ) ;
p = gcry_mpi_set_ui ( NULL , 0 ) ;
a = gcry_mpi_set_ui ( NULL , 0 ) ;
err = ec_p_new ( & ctx , p , a ) ;
if ( ! err || gpg_err_code ( err ) != GPG_ERR_EINVAL ) fail ( "ec_p_new: bad parameter detection failed (1)\n" ) ;
gcry_mpi_set_ui ( p , 1 ) ;
err = ec_p_new ( & ctx , p , a ) ;
if ( ! err || gpg_err_code ( err ) != GPG_ERR_EINVAL ) fail ( "ec_p_new: bad parameter detection failed (2)\n" ) ;
gcry_mpi_release ( p ) ;
p = NULL ;
err = ec_p_new ( & ctx , p , a ) ;
if ( ! err || gpg_err_code ( err ) != GPG_ERR_EINVAL ) fail ( "ec_p_new: bad parameter detection failed (3)\n" ) ;
gcry_mpi_release ( a ) ;
a = NULL ;
err = ec_p_new ( & ctx , p , a ) ;
if ( ! err || gpg_err_code ( err ) != GPG_ERR_EINVAL ) fail ( "ec_p_new: bad parameter detection failed (4)\n" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ExternalProtocolHandlerTest , TestLaunchSchemeUnBlockedChromeUnknown ) {
DoTest ( ExternalProtocolHandler : : DONT_BLOCK , shell_integration : : UNKNOWN_DEFAULT , Action : : LAUNCH ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE join_der_i ( RB_BLOCK_CALL_FUNC_ARGLIST ( i , str ) ) {
i = ossl_to_der_if_possible ( i ) ;
StringValue ( i ) ;
rb_str_append ( str , i ) ;
return Qnil ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsBool SaveOneChromaticity ( cmsFloat64Number x , cmsFloat64Number y , cmsIOHANDLER * io ) {
if ( ! _cmsWriteUInt32Number ( io , _cmsDoubleTo15Fixed16 ( x ) ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , _cmsDoubleTo15Fixed16 ( y ) ) ) return FALSE ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * sic10_opaque_literal_attr ( tvbuff_t * tvb , guint32 offset , const char * token , guint8 codepage _U_ , guint32 * length ) {
guint32 data_len = tvb_get_guintvar ( tvb , offset , length ) ;
char * str = NULL ;
if ( token && ( ( strcmp ( token , "created" ) == 0 ) || ( strcmp ( token , "si-expires" ) == 0 ) ) ) {
str = date_time_from_opaque ( tvb , offset + * length , data_len ) ;
}
if ( str == NULL ) {
str = wmem_strdup_printf ( wmem_packet_scope ( ) , "(%d bytes of unparsed opaque data)" , data_len ) ;
}
* length += data_len ;
return str ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static enum fetch_step vbf_stp_done ( void ) {
WRONG ( "Just plain wrong" ) ;
NEEDLESS ( return ( F_STP_DONE ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * _zip_readfpstr ( FILE * fp , unsigned int len , int nulp , struct zip_error * error ) {
char * r , * o ;
r = ( char * ) malloc ( nulp ? len + 1 : len ) ;
if ( ! r ) {
_zip_error_set ( error , ZIP_ER_MEMORY , 0 ) ;
return NULL ;
}
if ( fread ( r , 1 , len , fp ) < len ) {
free ( r ) ;
_zip_error_set ( error , ZIP_ER_READ , errno ) ;
return NULL ;
}
if ( nulp ) {
r [ len ] = 0 ;
for ( o = r ;
o < r + len ;
o ++ ) if ( * o == '\0' ) * o = ' ' ;
}
return r ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_pack_bitstream ( VP9_COMP * cpi , uint8_t * dest , size_t * size ) {
uint8_t * data = dest ;
size_t first_part_size , uncompressed_hdr_size ;
struct vp9_write_bit_buffer wb = {
data , 0 }
;
struct vp9_write_bit_buffer saved_wb ;
write_uncompressed_header ( cpi , & wb ) ;
saved_wb = wb ;
vp9_wb_write_literal ( & wb , 0 , 16 ) ;
uncompressed_hdr_size = vp9_wb_bytes_written ( & wb ) ;
data += uncompressed_hdr_size ;
vp9_clear_system_state ( ) ;
first_part_size = write_compressed_header ( cpi , data ) ;
data += first_part_size ;
vp9_wb_write_literal ( & saved_wb , ( int ) first_part_size , 16 ) ;
data += encode_tiles ( cpi , data ) ;
* size = data - dest ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int sig_cb ( int operation , ASN1_VALUE * * pval , const ASN1_ITEM * it , void * exarg ) {
if ( operation == ASN1_OP_NEW_PRE ) {
DSA_SIG * sig ;
sig = OPENSSL_malloc ( sizeof ( DSA_SIG ) ) ;
if ( ! sig ) {
DSAerr ( DSA_F_SIG_CB , ERR_R_MALLOC_FAILURE ) ;
return 0 ;
}
sig -> r = NULL ;
sig -> s = NULL ;
* pval = ( ASN1_VALUE * ) sig ;
return 2 ;
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int match_principals_command ( struct ssh * ssh , struct passwd * user_pw , const struct sshkey * key , struct sshauthopt * * authoptsp ) {
struct passwd * runas_pw = NULL ;
const struct sshkey_cert * cert = key -> cert ;
FILE * f = NULL ;
int r , ok , found_principal = 0 ;
int i , ac = 0 , uid_swapped = 0 ;
pid_t pid ;
char * tmp , * username = NULL , * command = NULL , * * av = NULL ;
char * ca_fp = NULL , * key_fp = NULL , * catext = NULL , * keytext = NULL ;
char serial_s [ 16 ] , uidstr [ 32 ] ;
void ( * osigchld ) ( int ) ;
if ( authoptsp != NULL ) * authoptsp = NULL ;
if ( options . authorized_principals_command == NULL ) return 0 ;
if ( options . authorized_principals_command_user == NULL ) {
error ( "No user for AuthorizedPrincipalsCommand specified, " "skipping" ) ;
return 0 ;
}
osigchld = signal ( SIGCHLD , SIG_DFL ) ;
username = percent_expand ( options . authorized_principals_command_user , "u" , user_pw -> pw_name , ( char * ) NULL ) ;
runas_pw = getpwnam ( username ) ;
if ( runas_pw == NULL ) {
error ( "AuthorizedPrincipalsCommandUser \"%s\" not found: %s" , username , strerror ( errno ) ) ;
goto out ;
}
if ( argv_split ( options . authorized_principals_command , & ac , & av ) != 0 ) {
error ( "AuthorizedPrincipalsCommand \"%s\" contains " "invalid quotes" , command ) ;
goto out ;
}
if ( ac == 0 ) {
error ( "AuthorizedPrincipalsCommand \"%s\" yielded no arguments" , command ) ;
goto out ;
}
if ( ( ca_fp = sshkey_fingerprint ( cert -> signature_key , options . fingerprint_hash , SSH_FP_DEFAULT ) ) == NULL ) {
error ( "%s: sshkey_fingerprint failed" , __func__ ) ;
goto out ;
}
if ( ( key_fp = sshkey_fingerprint ( key , options . fingerprint_hash , SSH_FP_DEFAULT ) ) == NULL ) {
error ( "%s: sshkey_fingerprint failed" , __func__ ) ;
goto out ;
}
if ( ( r = sshkey_to_base64 ( cert -> signature_key , & catext ) ) != 0 ) {
error ( "%s: sshkey_to_base64 failed: %s" , __func__ , ssh_err ( r ) ) ;
goto out ;
}
if ( ( r = sshkey_to_base64 ( key , & keytext ) ) != 0 ) {
error ( "%s: sshkey_to_base64 failed: %s" , __func__ , ssh_err ( r ) ) ;
goto out ;
}
snprintf ( serial_s , sizeof ( serial_s ) , "%llu" , ( unsigned long long ) cert -> serial ) ;
snprintf ( uidstr , sizeof ( uidstr ) , "%llu" , ( unsigned long long ) user_pw -> pw_uid ) ;
for ( i = 1 ;
i < ac ;
i ++ ) {
tmp = percent_expand ( av [ i ] , "U" , uidstr , "u" , user_pw -> pw_name , "h" , user_pw -> pw_dir , "t" , sshkey_ssh_name ( key ) , "T" , sshkey_ssh_name ( cert -> signature_key ) , "f" , key_fp , "F" , ca_fp , "k" , keytext , "K" , catext , "i" , cert -> key_id , "s" , serial_s , ( char * ) NULL ) ;
if ( tmp == NULL ) fatal ( "%s: percent_expand failed" , __func__ ) ;
free ( av [ i ] ) ;
av [ i ] = tmp ;
}
command = argv_assemble ( ac , av ) ;
if ( ( pid = subprocess ( "AuthorizedPrincipalsCommand" , runas_pw , command , ac , av , & f , SSH_SUBPROCESS_STDOUT_CAPTURE | SSH_SUBPROCESS_STDERR_DISCARD ) ) == 0 ) goto out ;
uid_swapped = 1 ;
temporarily_use_uid ( runas_pw ) ;
ok = process_principals ( ssh , f , "(command)" , cert , authoptsp ) ;
fclose ( f ) ;
f = NULL ;
if ( exited_cleanly ( pid , "AuthorizedPrincipalsCommand" , command , 0 ) != 0 ) goto out ;
found_principal = ok ;
out : if ( f != NULL ) fclose ( f ) ;
signal ( SIGCHLD , osigchld ) ;
for ( i = 0 ;
i < ac ;
i ++ ) free ( av [ i ] ) ;
free ( av ) ;
if ( uid_swapped ) restore_uid ( ) ;
free ( command ) ;
free ( username ) ;
free ( ca_fp ) ;
free ( key_fp ) ;
free ( catext ) ;
free ( keytext ) ;
return found_principal ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void virtio_balloon_stat ( void * opaque , BalloonInfo * info ) {
VirtIOBalloon * dev = opaque ;
# if 0 if ( dev -> vdev . guest_features & ( 1 << VIRTIO_BALLOON_F_STATS_VQ ) ) {
virtqueue_push ( dev -> svq , & dev -> stats_vq_elem , dev -> stats_vq_offset ) ;
virtio_notify ( & dev -> vdev , dev -> svq ) ;
return ;
}
# endif reset_stats ( dev ) ;
info -> actual = ram_size - ( ( uint64_t ) dev -> actual << VIRTIO_BALLOON_PFN_SHIFT ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * strtok_r ( char * s , const char * delim , char * * state ) {
return strtok ( s , delim ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ipvideo_decode_block_opcode_0x9_16 ( IpvideoContext * s ) {
int x , y ;
uint16_t P [ 4 ] ;
uint16_t * pixel_ptr = ( uint16_t * ) s -> pixel_ptr ;
for ( x = 0 ;
x < 4 ;
x ++ ) P [ x ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
if ( ! ( P [ 0 ] & 0x8000 ) ) {
if ( ! ( P [ 2 ] & 0x8000 ) ) {
for ( y = 0 ;
y < 8 ;
y ++ ) {
int flags = bytestream2_get_le16 ( & s -> stream_ptr ) ;
for ( x = 0 ;
x < 8 ;
x ++ , flags >>= 2 ) * pixel_ptr ++ = P [ flags & 0x03 ] ;
pixel_ptr += s -> line_inc ;
}
}
else {
uint32_t flags ;
flags = bytestream2_get_le32 ( & s -> stream_ptr ) ;
for ( y = 0 ;
y < 8 ;
y += 2 ) {
for ( x = 0 ;
x < 8 ;
x += 2 , flags >>= 2 ) {
pixel_ptr [ x ] = pixel_ptr [ x + 1 ] = pixel_ptr [ x + s -> stride ] = pixel_ptr [ x + 1 + s -> stride ] = P [ flags & 0x03 ] ;
}
pixel_ptr += s -> stride * 2 ;
}
}
}
else {
uint64_t flags ;
flags = bytestream2_get_le64 ( & s -> stream_ptr ) ;
if ( ! ( P [ 2 ] & 0x8000 ) ) {
for ( y = 0 ;
y < 8 ;
y ++ ) {
for ( x = 0 ;
x < 8 ;
x += 2 , flags >>= 2 ) {
pixel_ptr [ x ] = pixel_ptr [ x + 1 ] = P [ flags & 0x03 ] ;
}
pixel_ptr += s -> stride ;
}
}
else {
for ( y = 0 ;
y < 8 ;
y += 2 ) {
for ( x = 0 ;
x < 8 ;
x ++ , flags >>= 2 ) {
pixel_ptr [ x ] = pixel_ptr [ x + s -> stride ] = P [ flags & 0x03 ] ;
}
pixel_ptr += s -> stride * 2 ;
}
}
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int cesu8_to_unicode ( uint32_t * pwc , const char * s , size_t n ) {
uint32_t wc = 0 ;
int cnt ;
cnt = _utf8_to_unicode ( & wc , s , n ) ;
if ( cnt == 3 && IS_HIGH_SURROGATE_LA ( wc ) ) {
uint32_t wc2 = 0 ;
if ( n - 3 < 3 ) {
goto invalid_sequence ;
}
cnt = _utf8_to_unicode ( & wc2 , s + 3 , n - 3 ) ;
if ( cnt != 3 || ! IS_LOW_SURROGATE_LA ( wc2 ) ) {
goto invalid_sequence ;
}
wc = combine_surrogate_pair ( wc , wc2 ) ;
cnt = 6 ;
}
else if ( cnt == 3 && IS_LOW_SURROGATE_LA ( wc ) ) {
goto invalid_sequence ;
}
* pwc = wc ;
return ( cnt ) ;
invalid_sequence : * pwc = UNICODE_R_CHAR ;
if ( cnt > 0 ) cnt *= - 1 ;
return ( cnt ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void fe_channels_init ( void ) {
settings_add_bool ( "lookandfeel" , "autoclose_windows" , TRUE ) ;
settings_add_bool ( "lookandfeel" , "show_names_on_join" , TRUE ) ;
settings_add_int ( "lookandfeel" , "names_max_columns" , 6 ) ;
settings_add_int ( "lookandfeel" , "names_max_width" , 0 ) ;
signal_add ( "channel created" , ( SIGNAL_FUNC ) signal_channel_created ) ;
signal_add ( "channel destroyed" , ( SIGNAL_FUNC ) signal_channel_destroyed ) ;
signal_add_last ( "window item changed" , ( SIGNAL_FUNC ) signal_window_item_changed ) ;
signal_add_last ( "server disconnected" , ( SIGNAL_FUNC ) sig_disconnected ) ;
signal_add_last ( "channel joined" , ( SIGNAL_FUNC ) sig_channel_joined ) ;
command_bind ( "join" , NULL , ( SIGNAL_FUNC ) cmd_join ) ;
command_bind ( "channel" , NULL , ( SIGNAL_FUNC ) cmd_channel ) ;
command_bind ( "channel add" , NULL , ( SIGNAL_FUNC ) cmd_channel_add ) ;
command_bind ( "channel modify" , NULL , ( SIGNAL_FUNC ) cmd_channel_modify ) ;
command_bind ( "channel remove" , NULL , ( SIGNAL_FUNC ) cmd_channel_remove ) ;
command_bind ( "channel list" , NULL , ( SIGNAL_FUNC ) cmd_channel_list ) ;
command_bind ( "names" , NULL , ( SIGNAL_FUNC ) cmd_names ) ;
command_bind ( "cycle" , NULL , ( SIGNAL_FUNC ) cmd_cycle ) ;
command_set_options ( "channel add" , "auto noauto -bots -botcmd" ) ;
command_set_options ( "channel modify" , "auto noauto -bots -botcmd" ) ;
command_set_options ( "names" , "count ops halfops voices normal" ) ;
command_set_options ( "join" , "invite window" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int selinux_sem_semop ( struct sem_array * sma , struct sembuf * sops , unsigned nsops , int alter ) {
u32 perms ;
if ( alter ) perms = SEM__READ | SEM__WRITE ;
else perms = SEM__READ ;
return ipc_has_perm ( & sma -> sem_perm , perms ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
jpc_pchglist_t * jpc_pchglist_create ( ) {
jpc_pchglist_t * pchglist ;
if ( ! ( pchglist = jas_malloc ( sizeof ( jpc_pchglist_t ) ) ) ) {
return 0 ;
}
pchglist -> numpchgs = 0 ;
pchglist -> maxpchgs = 0 ;
pchglist -> pchgs = 0 ;
return pchglist ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t U_CALLCONV uprv_readSwapUInt32 ( uint32_t x ) {
return ( uint32_t ) ( ( x << 24 ) | ( ( x << 8 ) & 0xff0000 ) | ( ( x >> 8 ) & 0xff00 ) | ( x >> 24 ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rtdatetolfp ( char * str , l_fp * lfp ) {
register char * cp ;
register int i ;
struct calendar cal ;
char buf [ 4 ] ;
cal . yearday = 0 ;
cp = str ;
if ( ! isdigit ( ( int ) * cp ) ) {
if ( * cp == '-' ) {
L_CLR ( lfp ) ;
return 1 ;
}
return 0 ;
}
cal . monthday = ( u_char ) ( * cp ++ - '0' ) ;
if ( isdigit ( ( int ) * cp ) ) {
cal . monthday = ( u_char ) ( ( cal . monthday << 3 ) + ( cal . monthday << 1 ) ) ;
cal . monthday = ( u_char ) ( cal . monthday + * cp ++ - '0' ) ;
}
if ( * cp ++ != '-' ) return 0 ;
for ( i = 0 ;
i < 3 ;
i ++ ) buf [ i ] = * cp ++ ;
buf [ 3 ] = '\0' ;
for ( i = 0 ;
i < 12 ;
i ++ ) if ( STREQ ( buf , months [ i ] ) ) break ;
if ( i == 12 ) return 0 ;
cal . month = ( u_char ) ( i + 1 ) ;
if ( * cp ++ != '-' ) return 0 ;
if ( ! isdigit ( ( int ) * cp ) ) return 0 ;
cal . year = ( u_short ) ( * cp ++ - '0' ) ;
if ( isdigit ( ( int ) * cp ) ) {
cal . year = ( u_short ) ( ( cal . year << 3 ) + ( cal . year << 1 ) ) ;
cal . year = ( u_short ) ( * cp ++ - '0' ) ;
}
if ( isdigit ( ( int ) * cp ) ) {
cal . year = ( u_short ) ( ( cal . year << 3 ) + ( cal . year << 1 ) ) ;
cal . year = ( u_short ) ( cal . year + * cp ++ - '0' ) ;
}
if ( isdigit ( ( int ) * cp ) ) {
cal . year = ( u_short ) ( ( cal . year << 3 ) + ( cal . year << 1 ) ) ;
cal . year = ( u_short ) ( cal . year + * cp ++ - '0' ) ;
}
if ( cal . year == 0 ) {
L_CLR ( lfp ) ;
return 1 ;
}
if ( * cp ++ != ' ' || ! isdigit ( ( int ) * cp ) ) return 0 ;
cal . hour = ( u_char ) ( * cp ++ - '0' ) ;
if ( isdigit ( ( int ) * cp ) ) {
cal . hour = ( u_char ) ( ( cal . hour << 3 ) + ( cal . hour << 1 ) ) ;
cal . hour = ( u_char ) ( cal . hour + * cp ++ - '0' ) ;
}
if ( * cp ++ != ':' || ! isdigit ( ( int ) * cp ) ) return 0 ;
cal . minute = ( u_char ) ( * cp ++ - '0' ) ;
if ( isdigit ( ( int ) * cp ) ) {
cal . minute = ( u_char ) ( ( cal . minute << 3 ) + ( cal . minute << 1 ) ) ;
cal . minute = ( u_char ) ( cal . minute + * cp ++ - '0' ) ;
}
if ( * cp ++ != ':' || ! isdigit ( ( int ) * cp ) ) return 0 ;
cal . second = ( u_char ) ( * cp ++ - '0' ) ;
if ( isdigit ( ( int ) * cp ) ) {
cal . second = ( u_char ) ( ( cal . second << 3 ) + ( cal . second << 1 ) ) ;
cal . second = ( u_char ) ( cal . second + * cp ++ - '0' ) ;
}
if ( cal . year < 72 ) cal . year += 2000 ;
if ( cal . year < 100 ) cal . year += 1900 ;
lfp -> l_ui = caltontp ( & cal ) ;
lfp -> l_uf = 0 ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static PyObject * string_find ( PyStringObject * self , PyObject * args ) {
Py_ssize_t result = string_find_internal ( self , args , + 1 ) ;
if ( result == - 2 ) return NULL ;
return PyInt_FromSsize_t ( result ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vga_draw_line2 ( VGACommonState * s1 , uint8_t * d , const uint8_t * s , int width ) {
uint32_t plane_mask , * palette , data , v ;
int x ;
palette = s1 -> last_palette ;
plane_mask = mask16 [ s1 -> ar [ VGA_ATC_PLANE_ENABLE ] & 0xf ] ;
width >>= 3 ;
for ( x = 0 ;
x < width ;
x ++ ) {
data = ( ( uint32_t * ) s ) [ 0 ] ;
data &= plane_mask ;
v = expand2 [ GET_PLANE ( data , 0 ) ] ;
v |= expand2 [ GET_PLANE ( data , 2 ) ] << 2 ;
( ( uint32_t * ) d ) [ 0 ] = palette [ v >> 12 ] ;
( ( uint32_t * ) d ) [ 1 ] = palette [ ( v >> 8 ) & 0xf ] ;
( ( uint32_t * ) d ) [ 2 ] = palette [ ( v >> 4 ) & 0xf ] ;
( ( uint32_t * ) d ) [ 3 ] = palette [ ( v >> 0 ) & 0xf ] ;
v = expand2 [ GET_PLANE ( data , 1 ) ] ;
v |= expand2 [ GET_PLANE ( data , 3 ) ] << 2 ;
( ( uint32_t * ) d ) [ 4 ] = palette [ v >> 12 ] ;
( ( uint32_t * ) d ) [ 5 ] = palette [ ( v >> 8 ) & 0xf ] ;
( ( uint32_t * ) d ) [ 6 ] = palette [ ( v >> 4 ) & 0xf ] ;
( ( uint32_t * ) d ) [ 7 ] = palette [ ( v >> 0 ) & 0xf ] ;
d += 32 ;
s += 4 ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static __inline__ void TLV_SET_LEN ( struct tlv_desc * tlv , __u16 len ) {
tlv -> tlv_len = htons ( len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int readfull ( AVFormatContext * s , AVIOContext * pb , uint8_t * dst , int n ) {
int ret = avio_read ( pb , dst , n ) ;
if ( ret != n ) {
if ( ret >= 0 ) memset ( dst + ret , 0 , n - ret ) ;
else memset ( dst , 0 , n ) ;
av_log ( s , AV_LOG_ERROR , "Failed to fully read block\n" ) ;
}
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void check_cluster_versions ( void ) {
prep_status ( "Checking cluster versions" ) ;
old_cluster . major_version = get_major_server_version ( & old_cluster ) ;
new_cluster . major_version = get_major_server_version ( & new_cluster ) ;
if ( GET_MAJOR_VERSION ( old_cluster . major_version ) < 804 ) pg_fatal ( "This utility can only upgrade from PostgreSQL version 8.4 and later.\n" ) ;
if ( GET_MAJOR_VERSION ( new_cluster . major_version ) != GET_MAJOR_VERSION ( PG_VERSION_NUM ) ) pg_fatal ( "This utility can only upgrade to PostgreSQL version %s.\n" , PG_MAJORVERSION ) ;
if ( old_cluster . major_version > new_cluster . major_version ) pg_fatal ( "This utility cannot be used to downgrade to older major PostgreSQL versions.\n" ) ;
get_bin_version ( & old_cluster ) ;
get_bin_version ( & new_cluster ) ;
if ( GET_MAJOR_VERSION ( old_cluster . major_version ) != GET_MAJOR_VERSION ( old_cluster . bin_version ) ) pg_fatal ( "Old cluster data and binary directories are from different major versions.\n" ) ;
if ( GET_MAJOR_VERSION ( new_cluster . major_version ) != GET_MAJOR_VERSION ( new_cluster . bin_version ) ) pg_fatal ( "New cluster data and binary directories are from different major versions.\n" ) ;
check_ok ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int mem_open ( gx_device * dev ) {
gx_device_memory * const mdev = ( gx_device_memory * ) dev ;
if ( mdev -> is_planar ) return_error ( gs_error_rangecheck ) ;
return gdev_mem_open_scan_lines ( mdev , dev -> height ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct evhttp * http_setup ( short * pport , struct event_base * base ) {
int i ;
struct evhttp * myhttp ;
short port = - 1 ;
myhttp = evhttp_new ( base ) ;
for ( i = 0 ;
i < 50 ;
++ i ) {
if ( evhttp_bind_socket ( myhttp , "127.0.0.1" , 8080 + i ) != - 1 ) {
port = 8080 + i ;
break ;
}
}
if ( port == - 1 ) event_errx ( 1 , "Could not start web server" ) ;
evhttp_set_cb ( myhttp , "/test" , http_basic_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/chunked" , http_chunked_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/postit" , http_post_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/largedelay" , http_large_delay_cb , NULL ) ;
evhttp_set_cb ( myhttp , "/" , http_dispatcher_cb , NULL ) ;
* pport = port ;
return ( myhttp ) ;
}
| 1True
|
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 )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void gs_deviceinitialmatrix ( gx_device * dev , gs_matrix * pmat ) {
fill_dev_proc ( dev , get_initial_matrix , gx_default_get_initial_matrix ) ;
( * dev_proc ( dev , get_initial_matrix ) ) ( dev , pmat ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void spl_dllist_object_free_storage ( void * object TSRMLS_DC ) {
spl_dllist_object * intern = ( spl_dllist_object * ) object ;
zval * tmp = NULL ;
zend_object_std_dtor ( & intern -> std TSRMLS_CC ) ;
while ( intern -> llist -> count > 0 ) {
tmp = ( zval * ) spl_ptr_llist_pop ( intern -> llist TSRMLS_CC ) ;
zval_ptr_dtor ( & tmp ) ;
}
spl_ptr_llist_destroy ( intern -> llist TSRMLS_CC ) ;
SPL_LLIST_CHECK_DELREF ( intern -> traverse_pointer ) ;
zval_ptr_dtor ( & intern -> retval ) ;
if ( intern -> debug_info != NULL ) {
zend_hash_destroy ( intern -> debug_info ) ;
efree ( intern -> debug_info ) ;
}
efree ( object ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int psf_is_pipe ( SF_PRIVATE * psf ) {
struct stat statbuf ;
if ( psf -> virtual_io ) return SF_FALSE ;
if ( fstat ( psf -> file . filedes , & statbuf ) == - 1 ) {
psf_log_syserr ( psf , errno ) ;
return SF_TRUE ;
}
;
if ( S_ISFIFO ( statbuf . st_mode ) || S_ISSOCK ( statbuf . st_mode ) ) return SF_TRUE ;
return SF_FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int read_huff_channels ( MLPDecodeContext * m , GetBitContext * gbp , unsigned int substr , unsigned int pos ) {
SubStream * s = & m -> substream [ substr ] ;
unsigned int mat , channel ;
for ( mat = 0 ;
mat < s -> num_primitive_matrices ;
mat ++ ) if ( s -> lsb_bypass [ mat ] ) m -> bypassed_lsbs [ pos + s -> blockpos ] [ mat ] = get_bits1 ( gbp ) ;
for ( channel = s -> min_channel ;
channel <= s -> max_channel ;
channel ++ ) {
ChannelParams * cp = & s -> channel_params [ channel ] ;
int codebook = cp -> codebook ;
int quant_step_size = s -> quant_step_size [ channel ] ;
int lsb_bits = cp -> huff_lsbs - quant_step_size ;
int result = 0 ;
if ( codebook > 0 ) result = get_vlc2 ( gbp , huff_vlc [ codebook - 1 ] . table , VLC_BITS , ( 9 + VLC_BITS - 1 ) / VLC_BITS ) ;
if ( result < 0 ) return AVERROR_INVALIDDATA ;
if ( lsb_bits > 0 ) result = ( result << lsb_bits ) + get_bits ( gbp , lsb_bits ) ;
result += cp -> sign_huff_offset ;
result <<= quant_step_size ;
m -> sample_buffer [ pos + s -> blockpos ] [ channel ] = result ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int64_t vp9_rd_pick_inter_mode_sub8x8 ( VP9_COMP * cpi , MACROBLOCK * x , const TileInfo * const tile , int mi_row , int mi_col , int * returnrate , int64_t * returndistortion , BLOCK_SIZE bsize , PICK_MODE_CONTEXT * ctx , int64_t best_rd_so_far ) {
VP9_COMMON * const cm = & cpi -> common ;
RD_OPT * const rd_opt = & cpi -> rd ;
MACROBLOCKD * const xd = & x -> e_mbd ;
MB_MODE_INFO * const mbmi = & xd -> mi [ 0 ] . src_mi -> mbmi ;
const struct segmentation * const seg = & cm -> seg ;
MV_REFERENCE_FRAME ref_frame , second_ref_frame ;
unsigned char segment_id = mbmi -> segment_id ;
int comp_pred , i ;
int_mv frame_mv [ MB_MODE_COUNT ] [ MAX_REF_FRAMES ] ;
struct buf_2d yv12_mb [ 4 ] [ MAX_MB_PLANE ] ;
static const int flag_list [ 4 ] = {
0 , VP9_LAST_FLAG , VP9_GOLD_FLAG , VP9_ALT_FLAG }
;
int64_t best_rd = best_rd_so_far ;
int64_t best_yrd = best_rd_so_far ;
static const int64_t best_tx_diff [ TX_MODES ] = {
0 }
;
int64_t best_pred_diff [ REFERENCE_MODES ] ;
int64_t best_pred_rd [ REFERENCE_MODES ] ;
int64_t best_filter_rd [ SWITCHABLE_FILTER_CONTEXTS ] ;
int64_t best_filter_diff [ SWITCHABLE_FILTER_CONTEXTS ] ;
MB_MODE_INFO best_mbmode ;
int ref_index , best_ref_index = 0 ;
unsigned int ref_costs_single [ MAX_REF_FRAMES ] , ref_costs_comp [ MAX_REF_FRAMES ] ;
vp9_prob comp_mode_p ;
INTERP_FILTER tmp_best_filter = SWITCHABLE ;
int rate_uv_intra , rate_uv_tokenonly ;
int64_t dist_uv ;
int skip_uv ;
PREDICTION_MODE mode_uv = DC_PRED ;
const int intra_cost_penalty = * vp9_dc_quant ( cm -> base_qindex , cm -> y_dc_delta_q , cm -> bit_depth ) ;
int_mv seg_mvs [ 4 ] [ MAX_REF_FRAMES ] ;
b_mode_info best_bmodes [ 4 ] ;
int best_skip2 = 0 ;
int ref_frame_skip_mask [ 2 ] = {
0 }
;
x -> skip_encode = cpi -> sf . skip_encode_frame && x -> q_index < QIDX_SKIP_THRESH ;
vpx_memset ( x -> zcoeff_blk [ TX_4X4 ] , 0 , 4 ) ;
vp9_zero ( best_mbmode ) ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
int j ;
for ( j = 0 ;
j < MAX_REF_FRAMES ;
j ++ ) seg_mvs [ i ] [ j ] . as_int = INVALID_MV ;
}
estimate_ref_frame_costs ( cm , xd , segment_id , ref_costs_single , ref_costs_comp , & comp_mode_p ) ;
for ( i = 0 ;
i < REFERENCE_MODES ;
++ i ) best_pred_rd [ i ] = INT64_MAX ;
for ( i = 0 ;
i < SWITCHABLE_FILTER_CONTEXTS ;
i ++ ) best_filter_rd [ i ] = INT64_MAX ;
rate_uv_intra = INT_MAX ;
* returnrate = INT_MAX ;
for ( ref_frame = LAST_FRAME ;
ref_frame <= ALTREF_FRAME ;
ref_frame ++ ) {
if ( cpi -> ref_frame_flags & flag_list [ ref_frame ] ) {
setup_buffer_inter ( cpi , x , tile , ref_frame , bsize , mi_row , mi_col , frame_mv [ NEARESTMV ] , frame_mv [ NEARMV ] , yv12_mb ) ;
}
else {
ref_frame_skip_mask [ 0 ] |= ( 1 << ref_frame ) ;
ref_frame_skip_mask [ 1 ] |= SECOND_REF_FRAME_MASK ;
}
frame_mv [ NEWMV ] [ ref_frame ] . as_int = INVALID_MV ;
frame_mv [ ZEROMV ] [ ref_frame ] . as_int = 0 ;
}
for ( ref_index = 0 ;
ref_index < MAX_REFS ;
++ ref_index ) {
int mode_excluded = 0 ;
int64_t this_rd = INT64_MAX ;
int disable_skip = 0 ;
int compmode_cost = 0 ;
int rate2 = 0 , rate_y = 0 , rate_uv = 0 ;
int64_t distortion2 = 0 , distortion_y = 0 , distortion_uv = 0 ;
int skippable = 0 ;
int i ;
int this_skip2 = 0 ;
int64_t total_sse = INT_MAX ;
int early_term = 0 ;
ref_frame = vp9_ref_order [ ref_index ] . ref_frame [ 0 ] ;
second_ref_frame = vp9_ref_order [ ref_index ] . ref_frame [ 1 ] ;
if ( ref_index > 2 && cpi -> sf . mode_skip_start < MAX_MODES ) {
if ( ref_index == 3 ) {
switch ( best_mbmode . ref_frame [ 0 ] ) {
case INTRA_FRAME : break ;
case LAST_FRAME : ref_frame_skip_mask [ 0 ] |= ( 1 << GOLDEN_FRAME ) | ( 1 << ALTREF_FRAME ) ;
ref_frame_skip_mask [ 1 ] |= SECOND_REF_FRAME_MASK ;
break ;
case GOLDEN_FRAME : ref_frame_skip_mask [ 0 ] |= ( 1 << LAST_FRAME ) | ( 1 << ALTREF_FRAME ) ;
ref_frame_skip_mask [ 1 ] |= SECOND_REF_FRAME_MASK ;
break ;
case ALTREF_FRAME : ref_frame_skip_mask [ 0 ] |= ( 1 << GOLDEN_FRAME ) | ( 1 << LAST_FRAME ) ;
break ;
case NONE : case MAX_REF_FRAMES : assert ( 0 && "Invalid Reference frame" ) ;
break ;
}
}
}
if ( ref_frame_skip_mask [ 0 ] & ( 1 << ref_frame ) && ref_frame_skip_mask [ 1 ] & ( 1 << MAX ( 0 , second_ref_frame ) ) ) continue ;
if ( rd_less_than_thresh ( best_rd , rd_opt -> threshes [ segment_id ] [ bsize ] [ ref_index ] , rd_opt -> thresh_freq_fact [ bsize ] [ ref_index ] ) ) continue ;
comp_pred = second_ref_frame > INTRA_FRAME ;
if ( comp_pred ) {
if ( ! cm -> allow_comp_inter_inter ) continue ;
if ( ! ( cpi -> ref_frame_flags & flag_list [ second_ref_frame ] ) ) continue ;
if ( vp9_segfeature_active ( seg , segment_id , SEG_LVL_REF_FRAME ) ) continue ;
if ( ( cpi -> sf . mode_search_skip_flags & FLAG_SKIP_COMP_BESTINTRA ) && best_mbmode . ref_frame [ 0 ] == INTRA_FRAME ) continue ;
}
if ( ref_frame > INTRA_FRAME && vp9_is_scaled ( & cm -> frame_refs [ ref_frame - 1 ] . sf ) ) continue ;
if ( second_ref_frame > INTRA_FRAME && vp9_is_scaled ( & cm -> frame_refs [ second_ref_frame - 1 ] . sf ) ) continue ;
if ( comp_pred ) mode_excluded = cm -> reference_mode == SINGLE_REFERENCE ;
else if ( ref_frame != INTRA_FRAME ) mode_excluded = cm -> reference_mode == COMPOUND_REFERENCE ;
if ( vp9_segfeature_active ( seg , segment_id , SEG_LVL_REF_FRAME ) && vp9_get_segdata ( seg , segment_id , SEG_LVL_REF_FRAME ) != ( int ) ref_frame ) {
continue ;
}
else if ( ! vp9_segfeature_active ( seg , segment_id , SEG_LVL_REF_FRAME ) ) {
if ( cpi -> rc . is_src_frame_alt_ref && ( cpi -> oxcf . arnr_max_frames == 0 ) ) continue ;
}
mbmi -> tx_size = TX_4X4 ;
mbmi -> uv_mode = DC_PRED ;
mbmi -> ref_frame [ 0 ] = ref_frame ;
mbmi -> ref_frame [ 1 ] = second_ref_frame ;
mbmi -> interp_filter = cm -> interp_filter == SWITCHABLE ? EIGHTTAP : cm -> interp_filter ;
x -> skip = 0 ;
set_ref_ptrs ( cm , xd , ref_frame , second_ref_frame ) ;
for ( i = 0 ;
i < MAX_MB_PLANE ;
i ++ ) {
xd -> plane [ i ] . pre [ 0 ] = yv12_mb [ ref_frame ] [ i ] ;
if ( comp_pred ) xd -> plane [ i ] . pre [ 1 ] = yv12_mb [ second_ref_frame ] [ i ] ;
}
if ( ref_frame == INTRA_FRAME ) {
int rate ;
if ( rd_pick_intra_sub_8x8_y_mode ( cpi , x , & rate , & rate_y , & distortion_y , best_rd ) >= best_rd ) continue ;
rate2 += rate ;
rate2 += intra_cost_penalty ;
distortion2 += distortion_y ;
if ( rate_uv_intra == INT_MAX ) {
choose_intra_uv_mode ( cpi , ctx , bsize , TX_4X4 , & rate_uv_intra , & rate_uv_tokenonly , & dist_uv , & skip_uv , & mode_uv ) ;
}
rate2 += rate_uv_intra ;
rate_uv = rate_uv_tokenonly ;
distortion2 += dist_uv ;
distortion_uv = dist_uv ;
mbmi -> uv_mode = mode_uv ;
}
else {
int rate ;
int64_t distortion ;
int64_t this_rd_thresh ;
int64_t tmp_rd , tmp_best_rd = INT64_MAX , tmp_best_rdu = INT64_MAX ;
int tmp_best_rate = INT_MAX , tmp_best_ratey = INT_MAX ;
int64_t tmp_best_distortion = INT_MAX , tmp_best_sse , uv_sse ;
int tmp_best_skippable = 0 ;
int switchable_filter_index ;
int_mv * second_ref = comp_pred ? & mbmi -> ref_mvs [ second_ref_frame ] [ 0 ] : NULL ;
b_mode_info tmp_best_bmodes [ 16 ] ;
MB_MODE_INFO tmp_best_mbmode ;
BEST_SEG_INFO bsi [ SWITCHABLE_FILTERS ] ;
int pred_exists = 0 ;
int uv_skippable ;
this_rd_thresh = ( ref_frame == LAST_FRAME ) ? rd_opt -> threshes [ segment_id ] [ bsize ] [ THR_LAST ] : rd_opt -> threshes [ segment_id ] [ bsize ] [ THR_ALTR ] ;
this_rd_thresh = ( ref_frame == GOLDEN_FRAME ) ? rd_opt -> threshes [ segment_id ] [ bsize ] [ THR_GOLD ] : this_rd_thresh ;
rd_opt -> mask_filter = 0 ;
for ( i = 0 ;
i < SWITCHABLE_FILTER_CONTEXTS ;
++ i ) rd_opt -> filter_cache [ i ] = INT64_MAX ;
if ( cm -> interp_filter != BILINEAR ) {
tmp_best_filter = EIGHTTAP ;
if ( x -> source_variance < cpi -> sf . disable_filter_search_var_thresh ) {
tmp_best_filter = EIGHTTAP ;
}
else if ( cpi -> sf . adaptive_pred_interp_filter == 1 && ctx -> pred_interp_filter < SWITCHABLE ) {
tmp_best_filter = ctx -> pred_interp_filter ;
}
else if ( cpi -> sf . adaptive_pred_interp_filter == 2 ) {
tmp_best_filter = ctx -> pred_interp_filter < SWITCHABLE ? ctx -> pred_interp_filter : 0 ;
}
else {
for ( switchable_filter_index = 0 ;
switchable_filter_index < SWITCHABLE_FILTERS ;
++ switchable_filter_index ) {
int newbest , rs ;
int64_t rs_rd ;
mbmi -> interp_filter = switchable_filter_index ;
tmp_rd = rd_pick_best_sub8x8_mode ( cpi , x , tile , & mbmi -> ref_mvs [ ref_frame ] [ 0 ] , second_ref , best_yrd , & rate , & rate_y , & distortion , & skippable , & total_sse , ( int ) this_rd_thresh , seg_mvs , bsi , switchable_filter_index , mi_row , mi_col ) ;
if ( tmp_rd == INT64_MAX ) continue ;
rs = vp9_get_switchable_rate ( cpi ) ;
rs_rd = RDCOST ( x -> rdmult , x -> rddiv , rs , 0 ) ;
rd_opt -> filter_cache [ switchable_filter_index ] = tmp_rd ;
rd_opt -> filter_cache [ SWITCHABLE_FILTERS ] = MIN ( rd_opt -> filter_cache [ SWITCHABLE_FILTERS ] , tmp_rd + rs_rd ) ;
if ( cm -> interp_filter == SWITCHABLE ) tmp_rd += rs_rd ;
rd_opt -> mask_filter = MAX ( rd_opt -> mask_filter , tmp_rd ) ;
newbest = ( tmp_rd < tmp_best_rd ) ;
if ( newbest ) {
tmp_best_filter = mbmi -> interp_filter ;
tmp_best_rd = tmp_rd ;
}
if ( ( newbest && cm -> interp_filter == SWITCHABLE ) || ( mbmi -> interp_filter == cm -> interp_filter && cm -> interp_filter != SWITCHABLE ) ) {
tmp_best_rdu = tmp_rd ;
tmp_best_rate = rate ;
tmp_best_ratey = rate_y ;
tmp_best_distortion = distortion ;
tmp_best_sse = total_sse ;
tmp_best_skippable = skippable ;
tmp_best_mbmode = * mbmi ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
tmp_best_bmodes [ i ] = xd -> mi [ 0 ] . src_mi -> bmi [ i ] ;
x -> zcoeff_blk [ TX_4X4 ] [ i ] = ! x -> plane [ 0 ] . eobs [ i ] ;
}
pred_exists = 1 ;
if ( switchable_filter_index == 0 && cpi -> sf . use_rd_breakout && best_rd < INT64_MAX ) {
if ( tmp_best_rdu / 2 > best_rd ) {
tmp_best_filter = mbmi -> interp_filter ;
tmp_best_rdu = INT64_MAX ;
break ;
}
}
}
}
}
}
if ( tmp_best_rdu == INT64_MAX && pred_exists ) continue ;
mbmi -> interp_filter = ( cm -> interp_filter == SWITCHABLE ? tmp_best_filter : cm -> interp_filter ) ;
if ( ! pred_exists ) {
tmp_rd = rd_pick_best_sub8x8_mode ( cpi , x , tile , & mbmi -> ref_mvs [ ref_frame ] [ 0 ] , second_ref , best_yrd , & rate , & rate_y , & distortion , & skippable , & total_sse , ( int ) this_rd_thresh , seg_mvs , bsi , 0 , mi_row , mi_col ) ;
if ( tmp_rd == INT64_MAX ) continue ;
}
else {
total_sse = tmp_best_sse ;
rate = tmp_best_rate ;
rate_y = tmp_best_ratey ;
distortion = tmp_best_distortion ;
skippable = tmp_best_skippable ;
* mbmi = tmp_best_mbmode ;
for ( i = 0 ;
i < 4 ;
i ++ ) xd -> mi [ 0 ] . src_mi -> bmi [ i ] = tmp_best_bmodes [ i ] ;
}
rate2 += rate ;
distortion2 += distortion ;
if ( cm -> interp_filter == SWITCHABLE ) rate2 += vp9_get_switchable_rate ( cpi ) ;
if ( ! mode_excluded ) mode_excluded = comp_pred ? cm -> reference_mode == SINGLE_REFERENCE : cm -> reference_mode == COMPOUND_REFERENCE ;
compmode_cost = vp9_cost_bit ( comp_mode_p , comp_pred ) ;
tmp_best_rdu = best_rd - MIN ( RDCOST ( x -> rdmult , x -> rddiv , rate2 , distortion2 ) , RDCOST ( x -> rdmult , x -> rddiv , 0 , total_sse ) ) ;
if ( tmp_best_rdu > 0 ) {
vp9_build_inter_predictors_sbuv ( & x -> e_mbd , mi_row , mi_col , BLOCK_8X8 ) ;
super_block_uvrd ( cpi , x , & rate_uv , & distortion_uv , & uv_skippable , & uv_sse , BLOCK_8X8 , tmp_best_rdu ) ;
if ( rate_uv == INT_MAX ) continue ;
rate2 += rate_uv ;
distortion2 += distortion_uv ;
skippable = skippable && uv_skippable ;
total_sse += uv_sse ;
}
}
if ( cm -> reference_mode == REFERENCE_MODE_SELECT ) rate2 += compmode_cost ;
if ( second_ref_frame > INTRA_FRAME ) {
rate2 += ref_costs_comp [ ref_frame ] ;
}
else {
rate2 += ref_costs_single [ ref_frame ] ;
}
if ( ! disable_skip ) {
if ( ref_frame != INTRA_FRAME && ! xd -> lossless ) {
if ( RDCOST ( x -> rdmult , x -> rddiv , rate_y + rate_uv , distortion2 ) < RDCOST ( x -> rdmult , x -> rddiv , 0 , total_sse ) ) {
rate2 += vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 0 ) ;
}
else {
rate2 += vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 1 ) ;
distortion2 = total_sse ;
assert ( total_sse >= 0 ) ;
rate2 -= ( rate_y + rate_uv ) ;
rate_y = 0 ;
rate_uv = 0 ;
this_skip2 = 1 ;
}
}
else {
rate2 += vp9_cost_bit ( vp9_get_skip_prob ( cm , xd ) , 0 ) ;
}
this_rd = RDCOST ( x -> rdmult , x -> rddiv , rate2 , distortion2 ) ;
}
if ( ! disable_skip && ref_frame == INTRA_FRAME ) {
for ( i = 0 ;
i < REFERENCE_MODES ;
++ i ) best_pred_rd [ i ] = MIN ( best_pred_rd [ i ] , this_rd ) ;
for ( i = 0 ;
i < SWITCHABLE_FILTER_CONTEXTS ;
i ++ ) best_filter_rd [ i ] = MIN ( best_filter_rd [ i ] , this_rd ) ;
}
if ( this_rd < best_rd || x -> skip ) {
if ( ! mode_excluded ) {
int max_plane = MAX_MB_PLANE ;
best_ref_index = ref_index ;
if ( ref_frame == INTRA_FRAME ) {
mbmi -> mv [ 0 ] . as_int = 0 ;
max_plane = 1 ;
}
* returnrate = rate2 ;
* returndistortion = distortion2 ;
best_rd = this_rd ;
best_yrd = best_rd - RDCOST ( x -> rdmult , x -> rddiv , rate_uv , distortion_uv ) ;
best_mbmode = * mbmi ;
best_skip2 = this_skip2 ;
if ( ! x -> select_tx_size ) swap_block_ptr ( x , ctx , 1 , 0 , 0 , max_plane ) ;
vpx_memcpy ( ctx -> zcoeff_blk , x -> zcoeff_blk [ TX_4X4 ] , sizeof ( uint8_t ) * ctx -> num_4x4_blk ) ;
for ( i = 0 ;
i < 4 ;
i ++ ) best_bmodes [ i ] = xd -> mi [ 0 ] . src_mi -> bmi [ i ] ;
if ( ( cpi -> sf . mode_search_skip_flags & FLAG_EARLY_TERMINATE ) && ( ref_index > MIN_EARLY_TERM_INDEX ) ) {
const int qstep = xd -> plane [ 0 ] . dequant [ 1 ] ;
int scale = 4 ;
if ( x -> source_variance < UINT_MAX ) {
const int var_adjust = ( x -> source_variance < 16 ) ;
scale -= var_adjust ;
}
if ( ref_frame > INTRA_FRAME && distortion2 * scale < qstep * qstep ) {
early_term = 1 ;
}
}
}
}
if ( ! disable_skip && ref_frame != INTRA_FRAME ) {
int64_t single_rd , hybrid_rd , single_rate , hybrid_rate ;
if ( cm -> reference_mode == REFERENCE_MODE_SELECT ) {
single_rate = rate2 - compmode_cost ;
hybrid_rate = rate2 ;
}
else {
single_rate = rate2 ;
hybrid_rate = rate2 + compmode_cost ;
}
single_rd = RDCOST ( x -> rdmult , x -> rddiv , single_rate , distortion2 ) ;
hybrid_rd = RDCOST ( x -> rdmult , x -> rddiv , hybrid_rate , distortion2 ) ;
if ( ! comp_pred && single_rd < best_pred_rd [ SINGLE_REFERENCE ] ) best_pred_rd [ SINGLE_REFERENCE ] = single_rd ;
else if ( comp_pred && single_rd < best_pred_rd [ COMPOUND_REFERENCE ] ) best_pred_rd [ COMPOUND_REFERENCE ] = single_rd ;
if ( hybrid_rd < best_pred_rd [ REFERENCE_MODE_SELECT ] ) best_pred_rd [ REFERENCE_MODE_SELECT ] = hybrid_rd ;
}
if ( ! mode_excluded && ! disable_skip && ref_frame != INTRA_FRAME && cm -> interp_filter != BILINEAR ) {
int64_t ref = rd_opt -> filter_cache [ cm -> interp_filter == SWITCHABLE ? SWITCHABLE_FILTERS : cm -> interp_filter ] ;
int64_t adj_rd ;
for ( i = 0 ;
i < SWITCHABLE_FILTER_CONTEXTS ;
i ++ ) {
if ( ref == INT64_MAX ) adj_rd = 0 ;
else if ( rd_opt -> filter_cache [ i ] == INT64_MAX ) adj_rd = rd_opt -> mask_filter - ref + 10 ;
else adj_rd = rd_opt -> filter_cache [ i ] - ref ;
adj_rd += this_rd ;
best_filter_rd [ i ] = MIN ( best_filter_rd [ i ] , adj_rd ) ;
}
}
if ( early_term ) break ;
if ( x -> skip && ! comp_pred ) break ;
}
if ( best_rd >= best_rd_so_far ) return INT64_MAX ;
if ( cpi -> sf . use_uv_intra_rd_estimate ) {
if ( best_mbmode . ref_frame [ 0 ] == INTRA_FRAME ) {
* mbmi = best_mbmode ;
rd_pick_intra_sbuv_mode ( cpi , x , ctx , & rate_uv_intra , & rate_uv_tokenonly , & dist_uv , & skip_uv , BLOCK_8X8 , TX_4X4 ) ;
}
}
if ( best_rd == INT64_MAX ) {
* returnrate = INT_MAX ;
* returndistortion = INT64_MAX ;
return best_rd ;
}
assert ( ( cm -> interp_filter == SWITCHABLE ) || ( cm -> interp_filter == best_mbmode . interp_filter ) || ! is_inter_block ( & best_mbmode ) ) ;
update_rd_thresh_fact ( cpi , bsize , best_ref_index ) ;
* mbmi = best_mbmode ;
x -> skip |= best_skip2 ;
if ( ! is_inter_block ( & best_mbmode ) ) {
for ( i = 0 ;
i < 4 ;
i ++ ) xd -> mi [ 0 ] . src_mi -> bmi [ i ] . as_mode = best_bmodes [ i ] . as_mode ;
}
else {
for ( i = 0 ;
i < 4 ;
++ i ) vpx_memcpy ( & xd -> mi [ 0 ] . src_mi -> bmi [ i ] , & best_bmodes [ i ] , sizeof ( b_mode_info ) ) ;
mbmi -> mv [ 0 ] . as_int = xd -> mi [ 0 ] . src_mi -> bmi [ 3 ] . as_mv [ 0 ] . as_int ;
mbmi -> mv [ 1 ] . as_int = xd -> mi [ 0 ] . src_mi -> bmi [ 3 ] . as_mv [ 1 ] . as_int ;
}
for ( i = 0 ;
i < REFERENCE_MODES ;
++ i ) {
if ( best_pred_rd [ i ] == INT64_MAX ) best_pred_diff [ i ] = INT_MIN ;
else best_pred_diff [ i ] = best_rd - best_pred_rd [ i ] ;
}
if ( ! x -> skip ) {
for ( i = 0 ;
i < SWITCHABLE_FILTER_CONTEXTS ;
i ++ ) {
if ( best_filter_rd [ i ] == INT64_MAX ) best_filter_diff [ i ] = 0 ;
else best_filter_diff [ i ] = best_rd - best_filter_rd [ i ] ;
}
if ( cm -> interp_filter == SWITCHABLE ) assert ( best_filter_diff [ SWITCHABLE_FILTERS ] == 0 ) ;
}
else {
vp9_zero ( best_filter_diff ) ;
}
store_coding_context ( x , ctx , best_ref_index , best_pred_diff , best_tx_diff , best_filter_diff , 0 ) ;
return best_rd ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void e1000e_intrmgr_pci_realize ( E1000ECore * core ) {
e1000e_intrmgr_initialize_all_timers ( core , true ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( SSLErrorAssistantTest , DynamicInterstitialListNoCommonName ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
EXPECT_EQ ( 1u , ssl_info ( ) . public_key_hashes . size ( ) ) ;
auto config_proto = std : : make_unique < chrome_browser_ssl : : SSLErrorAssistantConfig > ( ) ;
config_proto -> set_version_id ( kLargeVersionId ) ;
chrome_browser_ssl : : DynamicInterstitial * filter = config_proto -> add_dynamic_interstitial ( ) ;
filter -> set_interstitial_type ( chrome_browser_ssl : : DynamicInterstitial : : INTERSTITIAL_PAGE_CAPTIVE_PORTAL ) ;
filter -> set_cert_error ( chrome_browser_ssl : : DynamicInterstitial : : UNKNOWN_CERT_ERROR ) ;
filter -> add_sha256_hash ( "sha256ightjar" ) ;
filter -> add_sha256_hash ( "sha256/frogmouth" ) ;
filter -> add_sha256_hash ( "sha256/poorwill" ) ;
filter = config_proto -> add_dynamic_interstitial ( ) ;
filter -> set_interstitial_type ( chrome_browser_ssl : : DynamicInterstitial : : INTERSTITIAL_PAGE_SSL ) ;
filter -> set_cert_error ( chrome_browser_ssl : : DynamicInterstitial : : ERR_CERT_COMMON_NAME_INVALID ) ;
filter -> add_sha256_hash ( "sha256uthatch" ) ;
filter -> add_sha256_hash ( ssl_info ( ) . public_key_hashes [ 0 ] . ToString ( ) ) ;
filter -> add_sha256_hash ( "sha256/treecreeper" ) ;
filter -> set_issuer_common_name_regex ( std : : string ( ) ) ;
filter -> set_issuer_organization_regex ( issuer_organization_name ( ) ) ;
filter -> set_mitm_software_name ( "UwS" ) ;
error_assistant ( ) -> SetErrorAssistantProto ( std : : move ( config_proto ) ) ;
base : : Optional < DynamicInterstitialInfo > dynamic_interstitial = error_assistant ( ) -> MatchDynamicInterstitial ( ssl_info ( ) ) ;
ASSERT_TRUE ( dynamic_interstitial ) ;
EXPECT_EQ ( chrome_browser_ssl : : DynamicInterstitial : : INTERSTITIAL_PAGE_SSL , dynamic_interstitial -> interstitial_type ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int remoteStreamHandleWriteData ( struct qemud_client * client , struct qemud_client_stream * stream , struct qemud_client_message * msg ) {
remote_error rerr ;
int ret ;
VIR_DEBUG ( "stream=%p proc=%d serial=%d len=%d offset=%d" , stream , msg -> hdr . proc , msg -> hdr . serial , msg -> bufferLength , msg -> bufferOffset ) ;
memset ( & rerr , 0 , sizeof rerr ) ;
ret = virStreamSend ( stream -> st , msg -> buffer + msg -> bufferOffset , msg -> bufferLength - msg -> bufferOffset ) ;
if ( ret > 0 ) {
msg -> bufferOffset += ret ;
if ( msg -> bufferOffset < msg -> bufferLength ) return 1 ;
}
else if ( ret == - 2 ) {
return 1 ;
}
else {
VIR_INFO0 ( "Stream send failed" ) ;
stream -> closed = 1 ;
remoteDispatchError ( & rerr ) ;
return remoteSerializeReplyError ( client , & rerr , & msg -> hdr ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void alloc_objects ( unsigned int cnt ) {
struct object_entry_pool * b ;
b = xmalloc ( sizeof ( struct object_entry_pool ) + cnt * sizeof ( struct object_entry ) ) ;
b -> next_pool = blocks ;
b -> next_free = b -> entries ;
b -> end = b -> entries + cnt ;
blocks = b ;
alloc_count += cnt ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_reg_handoff_zbee_zcl_color_control ( void ) {
zbee_zcl_init_cluster ( ZBEE_PROTOABBREV_ZCL_COLOR_CONTROL , proto_zbee_zcl_color_control , ett_zbee_zcl_color_control , ZBEE_ZCL_CID_COLOR_CONTROL , ZBEE_MFG_CODE_NONE , hf_zbee_zcl_color_control_attr_id , hf_zbee_zcl_color_control_srv_rx_cmd_id , - 1 , ( zbee_zcl_fn_attr_data ) dissect_zcl_color_control_attr_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void nautilus_directory_add_file_monitors ( NautilusDirectory * directory , NautilusFile * file , FileMonitors * monitors ) {
GList * * list ;
GList * l ;
Monitor * monitor ;
g_assert ( NAUTILUS_IS_DIRECTORY ( directory ) ) ;
g_assert ( NAUTILUS_IS_FILE ( file ) ) ;
g_assert ( file -> details -> directory == directory ) ;
if ( monitors == NULL ) {
return ;
}
for ( l = ( GList * ) monitors ;
l != NULL ;
l = l -> next ) {
monitor = l -> data ;
request_counter_add_request ( directory -> details -> monitor_counters , monitor -> request ) ;
}
list = & directory -> details -> monitor_list ;
* list = g_list_concat ( * list , ( GList * ) monitors ) ;
nautilus_directory_add_file_to_work_queue ( directory , file ) ;
nautilus_directory_async_state_changed ( directory ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int qemuMonitorJSONCheckError ( virJSONValuePtr cmd , virJSONValuePtr reply ) {
if ( virJSONValueObjectHasKey ( reply , "error" ) ) {
virJSONValuePtr error = virJSONValueObjectGet ( reply , "error" ) ;
char * cmdstr = virJSONValueToString ( cmd ) ;
char * replystr = virJSONValueToString ( reply ) ;
VIR_DEBUG ( "unable to execute QEMU command %s: %s" , cmdstr , replystr ) ;
if ( ! error ) qemuReportError ( VIR_ERR_INTERNAL_ERROR , _ ( "unable to execute QEMU command '%s'" ) , qemuMonitorJSONCommandName ( cmd ) ) ;
else qemuReportError ( VIR_ERR_INTERNAL_ERROR , _ ( "unable to execute QEMU command '%s': %s" ) , qemuMonitorJSONCommandName ( cmd ) , qemuMonitorJSONStringifyError ( error ) ) ;
VIR_FREE ( cmdstr ) ;
VIR_FREE ( replystr ) ;
return - 1 ;
}
else if ( ! virJSONValueObjectHasKey ( reply , "return" ) ) {
char * cmdstr = virJSONValueToString ( cmd ) ;
char * replystr = virJSONValueToString ( reply ) ;
VIR_DEBUG ( "Neither 'return' nor 'error' is set in the JSON reply %s: %s" , cmdstr , replystr ) ;
qemuReportError ( VIR_ERR_INTERNAL_ERROR , _ ( "unable to execute QEMU command '%s'" ) , qemuMonitorJSONCommandName ( cmd ) ) ;
VIR_FREE ( cmdstr ) ;
VIR_FREE ( replystr ) ;
return - 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int archive_read_support_format_cpio ( struct archive * _a ) {
struct archive_read * a = ( struct archive_read * ) _a ;
struct cpio * cpio ;
int r ;
archive_check_magic ( _a , ARCHIVE_READ_MAGIC , ARCHIVE_STATE_NEW , "archive_read_support_format_cpio" ) ;
cpio = ( struct cpio * ) calloc ( 1 , sizeof ( * cpio ) ) ;
if ( cpio == NULL ) {
archive_set_error ( & a -> archive , ENOMEM , "Can't allocate cpio data" ) ;
return ( ARCHIVE_FATAL ) ;
}
cpio -> magic = CPIO_MAGIC ;
r = __archive_read_register_format ( a , cpio , "cpio" , archive_read_format_cpio_bid , archive_read_format_cpio_options , archive_read_format_cpio_read_header , archive_read_format_cpio_read_data , archive_read_format_cpio_skip , NULL , archive_read_format_cpio_cleanup , NULL , NULL ) ;
if ( r != ARCHIVE_OK ) free ( cpio ) ;
return ( ARCHIVE_OK ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool parse_nameConstraints ( chunk_t blob , int level0 , private_x509_cert_t * this ) {
asn1_parser_t * parser ;
identification_t * id ;
chunk_t object ;
int objectID ;
bool success = FALSE ;
parser = asn1_parser_create ( nameConstraintsObjects , blob ) ;
parser -> set_top_level ( parser , level0 ) ;
while ( parser -> iterate ( parser , & objectID , & object ) ) {
switch ( objectID ) {
case NAME_CONSTRAINT_PERMITTED : id = parse_generalName ( object , parser -> get_level ( parser ) + 1 ) ;
if ( ! id ) {
goto end ;
}
this -> permitted_names -> insert_last ( this -> permitted_names , id ) ;
break ;
case NAME_CONSTRAINT_EXCLUDED : id = parse_generalName ( object , parser -> get_level ( parser ) + 1 ) ;
if ( ! id ) {
goto end ;
}
this -> excluded_names -> insert_last ( this -> excluded_names , id ) ;
break ;
default : break ;
}
}
success = parser -> success ( parser ) ;
end : parser -> destroy ( parser ) ;
return success ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
gcry_sexp_t gcry_sexp_prepend ( const gcry_sexp_t a , const gcry_sexp_t n ) {
( void ) a ;
( void ) n ;
BUG ( ) ;
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int64_t TSHttpTxnPushedRespBodyBytesGet ( TSHttpTxn txnp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * sm = ( HttpSM * ) txnp ;
return sm -> pushed_response_body_bytes ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void vmsvga_cursor_define ( struct vmsvga_state_s * s , struct vmsvga_cursor_definition_s * c ) {
QEMUCursor * qc ;
int i , pixels ;
qc = cursor_alloc ( c -> width , c -> height ) ;
qc -> hot_x = c -> hot_x ;
qc -> hot_y = c -> hot_y ;
switch ( c -> bpp ) {
case 1 : cursor_set_mono ( qc , 0xffffff , 0x000000 , ( void * ) c -> image , 1 , ( void * ) c -> mask ) ;
# ifdef DEBUG cursor_print_ascii_art ( qc , "vmware/mono" ) ;
# endif break ;
case 32 : cursor_set_mono ( qc , 0x000000 , 0x000000 , ( void * ) c -> mask , 1 , ( void * ) c -> mask ) ;
pixels = c -> width * c -> height ;
for ( i = 0 ;
i < pixels ;
i ++ ) {
qc -> data [ i ] |= c -> image [ i ] & 0xffffff ;
}
# ifdef DEBUG cursor_print_ascii_art ( qc , "vmware/32bit" ) ;
# endif break ;
default : fprintf ( stderr , "%s: unhandled bpp %d, using fallback cursor\n" , __func__ , c -> bpp ) ;
cursor_put ( qc ) ;
qc = cursor_builtin_left_ptr ( ) ;
}
dpy_cursor_define ( s -> vga . con , qc ) ;
cursor_put ( qc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ffmpeg_ReleaseFrameBuf ( struct AVCodecContext * p_context , AVFrame * p_ff_pic ) {
decoder_t * p_dec = ( decoder_t * ) p_context -> opaque ;
decoder_sys_t * p_sys = p_dec -> p_sys ;
if ( p_sys -> p_va ) vlc_va_Release ( p_sys -> p_va , p_ff_pic -> opaque , p_ff_pic -> data [ 0 ] ) ;
else if ( p_ff_pic -> opaque ) decoder_UnlinkPicture ( p_dec , ( picture_t * ) p_ff_pic -> opaque ) ;
else if ( p_ff_pic -> type == FF_BUFFER_TYPE_INTERNAL ) avcodec_default_release_buffer ( p_context , p_ff_pic ) ;
for ( int i = 0 ;
i < 4 ;
i ++ ) p_ff_pic -> data [ i ] = NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ialloc_reset_free ( gs_ref_memory_t * mem ) {
int i ;
obj_header_t * * p ;
mem -> lost . objects = 0 ;
mem -> lost . refs = 0 ;
mem -> lost . strings = 0 ;
mem -> cfreed . cp = 0 ;
for ( i = 0 , p = & mem -> freelists [ 0 ] ;
i < num_freelists ;
i ++ , p ++ ) * p = 0 ;
mem -> largest_free_size = 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void TSVConnCacheHttpInfoSet ( TSVConn connp , TSCacheHttpInfo infop ) {
sdk_assert ( sdk_sanity_check_iocore_structure ( connp ) == TS_SUCCESS ) ;
CacheVC * vc = ( CacheVC * ) connp ;
if ( vc -> base_stat == cache_scan_active_stat ) {
vc -> set_http_info ( ( CacheHTTPInfo * ) infop ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void override_features_indic ( hb_ot_shape_planner_t * plan ) {
if ( hb_options ( ) . uniscribe_bug_compatible ) {
switch ( ( hb_tag_t ) plan -> props . script ) {
case HB_SCRIPT_KHMER : plan -> map . add_feature ( HB_TAG ( 'k' , 'e' , 'r' , 'n' ) , 0 , F_GLOBAL ) ;
break ;
}
}
plan -> map . add_feature ( HB_TAG ( 'l' , 'i' , 'g' , 'a' ) , 0 , F_GLOBAL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
guint8 dissect_coap_code ( tvbuff_t * tvb , proto_tree * tree , gint * offset , coap_common_dissect_t * dissect_hf , guint8 * code_class ) {
guint8 code ;
proto_tree_add_item ( tree , dissect_hf -> hf . code , tvb , * offset , 1 , ENC_BIG_ENDIAN ) ;
code = tvb_get_guint8 ( tvb , * offset ) ;
* code_class = code >> 5 ;
* offset += 1 ;
return code ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int avs_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
const uint8_t * buf_end = avpkt -> data + avpkt -> size ;
int buf_size = avpkt -> size ;
AvsContext * const avs = avctx -> priv_data ;
AVFrame * picture = data ;
AVFrame * const p = & avs -> picture ;
const uint8_t * table , * vect ;
uint8_t * out ;
int i , j , x , y , stride , ret , vect_w = 3 , vect_h = 3 ;
AvsVideoSubType sub_type ;
AvsBlockType type ;
GetBitContext change_map ;
if ( ( ret = ff_reget_buffer ( avctx , p ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
p -> pict_type = AV_PICTURE_TYPE_P ;
p -> key_frame = 0 ;
out = avs -> picture . data [ 0 ] ;
stride = avs -> picture . linesize [ 0 ] ;
if ( buf_end - buf < 4 ) return AVERROR_INVALIDDATA ;
sub_type = buf [ 0 ] ;
type = buf [ 1 ] ;
buf += 4 ;
if ( type == AVS_PALETTE ) {
int first , last ;
uint32_t * pal = ( uint32_t * ) avs -> picture . data [ 1 ] ;
first = AV_RL16 ( buf ) ;
last = first + AV_RL16 ( buf + 2 ) ;
if ( first >= 256 || last > 256 || buf_end - buf < 4 + 4 + 3 * ( last - first ) ) return AVERROR_INVALIDDATA ;
buf += 4 ;
for ( i = first ;
i < last ;
i ++ , buf += 3 ) pal [ i ] = ( buf [ 0 ] << 18 ) | ( buf [ 1 ] << 10 ) | ( buf [ 2 ] << 2 ) ;
sub_type = buf [ 0 ] ;
type = buf [ 1 ] ;
buf += 4 ;
}
if ( type != AVS_VIDEO ) return AVERROR_INVALIDDATA ;
switch ( sub_type ) {
case AVS_I_FRAME : p -> pict_type = AV_PICTURE_TYPE_I ;
p -> key_frame = 1 ;
case AVS_P_FRAME_3X3 : vect_w = 3 ;
vect_h = 3 ;
break ;
case AVS_P_FRAME_2X2 : vect_w = 2 ;
vect_h = 2 ;
break ;
case AVS_P_FRAME_2X3 : vect_w = 2 ;
vect_h = 3 ;
break ;
default : return AVERROR_INVALIDDATA ;
}
if ( buf_end - buf < 256 * vect_w * vect_h ) return AVERROR_INVALIDDATA ;
table = buf + ( 256 * vect_w * vect_h ) ;
if ( sub_type != AVS_I_FRAME ) {
int map_size = ( ( 318 / vect_w + 7 ) / 8 ) * ( 198 / vect_h ) ;
if ( buf_end - table < map_size ) return AVERROR_INVALIDDATA ;
init_get_bits ( & change_map , table , map_size * 8 ) ;
table += map_size ;
}
for ( y = 0 ;
y < 198 ;
y += vect_h ) {
for ( x = 0 ;
x < 318 ;
x += vect_w ) {
if ( sub_type == AVS_I_FRAME || get_bits1 ( & change_map ) ) {
if ( buf_end - table < 1 ) return AVERROR_INVALIDDATA ;
vect = & buf [ * table ++ * ( vect_w * vect_h ) ] ;
for ( j = 0 ;
j < vect_w ;
j ++ ) {
out [ ( y + 0 ) * stride + x + j ] = vect [ ( 0 * vect_w ) + j ] ;
out [ ( y + 1 ) * stride + x + j ] = vect [ ( 1 * vect_w ) + j ] ;
if ( vect_h == 3 ) out [ ( y + 2 ) * stride + x + j ] = vect [ ( 2 * vect_w ) + j ] ;
}
}
}
if ( sub_type != AVS_I_FRAME ) align_get_bits ( & change_map ) ;
}
if ( ( ret = av_frame_ref ( picture , & avs -> picture ) ) < 0 ) return ret ;
* got_frame = 1 ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int file_compare_by_mime_type ( NautilusFile * file_a , NautilusFile * file_b ) {
char * mime_type_a , * mime_type_b ;
int ret ;
mime_type_a = nautilus_file_get_mime_type ( file_a ) ;
mime_type_b = nautilus_file_get_mime_type ( file_b ) ;
ret = strcmp ( mime_type_a , mime_type_b ) ;
g_free ( mime_type_a ) ;
g_free ( mime_type_b ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int init_nss_hash ( struct crypto_instance * instance ) {
if ( ! hash_to_nss [ instance -> crypto_hash_type ] ) {
return 0 ;
}
instance -> nss_sym_key_sign = import_symmetric_key ( instance , SYM_KEY_TYPE_HASH ) ;
if ( instance -> nss_sym_key_sign == NULL ) {
return - 1 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int i2d_ ## name ( type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( itname ) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const ( type , name ) type * d2i_ ## name ( type * * a , const unsigned char * * in , long len ) ;
int i2d_ ## name ( const type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( name ) # define DECLARE_ASN1_NDEF_FUNCTION ( name ) int i2d_ ## name ## _NDEF ( name * a , unsigned char * * out ) ;
# define DECLARE_ASN1_FUNCTIONS_const ( name ) DECLARE_ASN1_ALLOC_FUNCTIONS ( name ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( name , name ) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name ( type , name ) type * name ## _new ( void ) ;
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ;
int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ;
int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) 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 )
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.