instruction
stringclasses 1
value | input
stringlengths 31
235k
| output
class label 2
classes |
---|---|---|
Categorize the following code snippet as vulnerable or not. True or False
|
static int64_t rd_pick_intra4x4block ( VP9_COMP * cpi , MACROBLOCK * x , int ib , PREDICTION_MODE * best_mode , const int * bmode_costs , ENTROPY_CONTEXT * a , ENTROPY_CONTEXT * l , int * bestrate , int * bestratey , int64_t * bestdistortion , BLOCK_SIZE bsize , int64_t rd_thresh ) {
PREDICTION_MODE mode ;
MACROBLOCKD * const xd = & x -> e_mbd ;
int64_t best_rd = rd_thresh ;
struct macroblock_plane * p = & x -> plane [ 0 ] ;
struct macroblockd_plane * pd = & xd -> plane [ 0 ] ;
const int src_stride = p -> src . stride ;
const int dst_stride = pd -> dst . stride ;
const uint8_t * src_init = & p -> src . buf [ raster_block_offset ( BLOCK_8X8 , ib , src_stride ) ] ;
uint8_t * dst_init = & pd -> dst . buf [ raster_block_offset ( BLOCK_8X8 , ib , dst_stride ) ] ;
ENTROPY_CONTEXT ta [ 2 ] , tempa [ 2 ] ;
ENTROPY_CONTEXT tl [ 2 ] , templ [ 2 ] ;
const int num_4x4_blocks_wide = num_4x4_blocks_wide_lookup [ bsize ] ;
const int num_4x4_blocks_high = num_4x4_blocks_high_lookup [ bsize ] ;
int idx , idy ;
uint8_t best_dst [ 8 * 8 ] ;
assert ( ib < 4 ) ;
vpx_memcpy ( ta , a , sizeof ( ta ) ) ;
vpx_memcpy ( tl , l , sizeof ( tl ) ) ;
xd -> mi [ 0 ] -> mbmi . tx_size = TX_4X4 ;
for ( mode = DC_PRED ;
mode <= TM_PRED ;
++ mode ) {
int64_t this_rd ;
int ratey = 0 ;
int64_t distortion = 0 ;
int rate = bmode_costs [ mode ] ;
if ( ! ( cpi -> sf . intra_y_mode_mask [ TX_4X4 ] & ( 1 << mode ) ) ) continue ;
if ( cpi -> sf . mode_search_skip_flags & FLAG_SKIP_INTRA_DIRMISMATCH ) {
if ( conditional_skipintra ( mode , * best_mode ) ) continue ;
}
vpx_memcpy ( tempa , ta , sizeof ( ta ) ) ;
vpx_memcpy ( templ , tl , sizeof ( tl ) ) ;
for ( idy = 0 ;
idy < num_4x4_blocks_high ;
++ idy ) {
for ( idx = 0 ;
idx < num_4x4_blocks_wide ;
++ idx ) {
const int block = ib + idy * 2 + idx ;
const uint8_t * const src = & src_init [ idx * 4 + idy * 4 * src_stride ] ;
uint8_t * const dst = & dst_init [ idx * 4 + idy * 4 * dst_stride ] ;
int16_t * const src_diff = raster_block_offset_int16 ( BLOCK_8X8 , block , p -> src_diff ) ;
int16_t * const coeff = BLOCK_OFFSET ( x -> plane [ 0 ] . coeff , block ) ;
xd -> mi [ 0 ] -> bmi [ block ] . as_mode = mode ;
vp9_predict_intra_block ( xd , block , 1 , TX_4X4 , mode , x -> skip_encode ? src : dst , x -> skip_encode ? src_stride : dst_stride , dst , dst_stride , idx , idy , 0 ) ;
vp9_subtract_block ( 4 , 4 , src_diff , 8 , src , src_stride , dst , dst_stride ) ;
if ( xd -> lossless ) {
const scan_order * so = & vp9_default_scan_orders [ TX_4X4 ] ;
vp9_fwht4x4 ( src_diff , coeff , 8 ) ;
vp9_regular_quantize_b_4x4 ( x , 0 , block , so -> scan , so -> iscan ) ;
ratey += cost_coeffs ( x , 0 , block , tempa + idx , templ + idy , TX_4X4 , so -> scan , so -> neighbors , cpi -> sf . use_fast_coef_costing ) ;
if ( RDCOST ( x -> rdmult , x -> rddiv , ratey , distortion ) >= best_rd ) goto next ;
vp9_iwht4x4_add ( BLOCK_OFFSET ( pd -> dqcoeff , block ) , dst , dst_stride , p -> eobs [ block ] ) ;
}
else {
int64_t unused ;
const TX_TYPE tx_type = get_tx_type_4x4 ( PLANE_TYPE_Y , xd , block ) ;
const scan_order * so = & vp9_scan_orders [ TX_4X4 ] [ tx_type ] ;
vp9_fht4x4 ( src_diff , coeff , 8 , tx_type ) ;
vp9_regular_quantize_b_4x4 ( x , 0 , block , so -> scan , so -> iscan ) ;
ratey += cost_coeffs ( x , 0 , block , tempa + idx , templ + idy , TX_4X4 , so -> scan , so -> neighbors , cpi -> sf . use_fast_coef_costing ) ;
distortion += vp9_block_error ( coeff , BLOCK_OFFSET ( pd -> dqcoeff , block ) , 16 , & unused ) >> 2 ;
if ( RDCOST ( x -> rdmult , x -> rddiv , ratey , distortion ) >= best_rd ) goto next ;
vp9_iht4x4_add ( tx_type , BLOCK_OFFSET ( pd -> dqcoeff , block ) , dst , dst_stride , p -> eobs [ block ] ) ;
}
}
}
rate += ratey ;
this_rd = RDCOST ( x -> rdmult , x -> rddiv , rate , distortion ) ;
if ( this_rd < best_rd ) {
* bestrate = rate ;
* bestratey = ratey ;
* bestdistortion = distortion ;
best_rd = this_rd ;
* best_mode = mode ;
vpx_memcpy ( a , tempa , sizeof ( tempa ) ) ;
vpx_memcpy ( l , templ , sizeof ( templ ) ) ;
for ( idy = 0 ;
idy < num_4x4_blocks_high * 4 ;
++ idy ) vpx_memcpy ( best_dst + idy * 8 , dst_init + idy * dst_stride , num_4x4_blocks_wide * 4 ) ;
}
next : {
}
}
if ( best_rd >= rd_thresh || x -> skip_encode ) return best_rd ;
for ( idy = 0 ;
idy < num_4x4_blocks_high * 4 ;
++ idy ) vpx_memcpy ( dst_init + idy * dst_stride , best_dst + idy * 8 , num_4x4_blocks_wide * 4 ) ;
return best_rd ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
gboolean pk_transaction_set_tid ( PkTransaction * transaction , const gchar * tid ) {
static const GDBusInterfaceVTable interface_vtable = {
pk_transaction_method_call , pk_transaction_get_property , NULL }
;
g_return_val_if_fail ( PK_IS_TRANSACTION ( transaction ) , FALSE ) ;
g_return_val_if_fail ( tid != NULL , FALSE ) ;
g_return_val_if_fail ( transaction -> priv -> tid == NULL , FALSE ) ;
transaction -> priv -> tid = g_strdup ( tid ) ;
transaction -> priv -> connection = g_bus_get_sync ( G_BUS_TYPE_SYSTEM , NULL , NULL ) ;
g_assert ( transaction -> priv -> connection != NULL ) ;
transaction -> priv -> registration_id = g_dbus_connection_register_object ( transaction -> priv -> connection , tid , transaction -> priv -> introspection -> interfaces [ 0 ] , & interface_vtable , transaction , NULL , NULL ) ;
g_assert ( transaction -> priv -> registration_id > 0 ) ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSMimeHdrFieldValueDateSet ( TSMBuffer bufp , TSMLoc hdr , TSMLoc field , time_t value ) {
sdk_assert ( sdk_sanity_check_mbuffer ( bufp ) == TS_SUCCESS ) ;
sdk_assert ( ( sdk_sanity_check_mime_hdr_handle ( hdr ) == TS_SUCCESS ) || ( sdk_sanity_check_http_hdr_handle ( hdr ) == TS_SUCCESS ) ) ;
sdk_assert ( sdk_sanity_check_field_handle ( field , hdr ) == TS_SUCCESS ) ;
if ( ! isWriteable ( bufp ) ) {
return TS_ERROR ;
}
char tmp [ 33 ] ;
int len = mime_format_date ( tmp , value ) ;
TSMimeFieldValueSet ( bufp , field , - 1 , tmp , len ) ;
return TS_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsBool Type_Text_Description_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
cmsMLU * mlu = ( cmsMLU * ) Ptr ;
char * Text = NULL ;
wchar_t * Wide = NULL ;
cmsUInt32Number len , len_text , len_tag_requirement , len_aligned ;
cmsBool rc = FALSE ;
char Filler [ 68 ] ;
memset ( Filler , 0 , sizeof ( Filler ) ) ;
len = cmsMLUgetASCII ( mlu , cmsNoLanguage , cmsNoCountry , NULL , 0 ) ;
if ( len <= 0 ) {
Text = ( char * ) _cmsDupMem ( self -> ContextID , "" , sizeof ( char ) ) ;
Wide = ( wchar_t * ) _cmsDupMem ( self -> ContextID , L"" , sizeof ( wchar_t ) ) ;
}
else {
Text = ( char * ) _cmsCalloc ( self -> ContextID , len , sizeof ( char ) ) ;
if ( Text == NULL ) goto Error ;
Wide = ( wchar_t * ) _cmsCalloc ( self -> ContextID , len , sizeof ( wchar_t ) ) ;
if ( Wide == NULL ) goto Error ;
cmsMLUgetASCII ( mlu , cmsNoLanguage , cmsNoCountry , Text , len * sizeof ( char ) ) ;
cmsMLUgetWide ( mlu , cmsNoLanguage , cmsNoCountry , Wide , len * sizeof ( wchar_t ) ) ;
}
len_text = ( cmsUInt32Number ) strlen ( Text ) + 1 ;
len_tag_requirement = ( 8 + 4 + len_text + 4 + 4 + 2 * len_text + 2 + 1 + 67 ) ;
len_aligned = _cmsALIGNLONG ( len_tag_requirement ) ;
if ( ! _cmsWriteUInt32Number ( io , len_text ) ) goto Error ;
if ( ! io -> Write ( io , len_text , Text ) ) goto Error ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) goto Error ;
if ( ! _cmsWriteUInt32Number ( io , len_text ) ) goto Error ;
if ( ! _cmsWriteWCharArray ( io , len_text , Wide ) ) goto Error ;
if ( ! _cmsWriteUInt16Number ( io , 0 ) ) goto Error ;
if ( ! _cmsWriteUInt8Number ( io , 0 ) ) goto Error ;
if ( ! io -> Write ( io , 67 , Filler ) ) goto Error ;
if ( len_aligned - len_tag_requirement > 0 ) if ( ! io -> Write ( io , len_aligned - len_tag_requirement , Filler ) ) goto Error ;
rc = TRUE ;
Error : if ( Text ) _cmsFree ( self -> ContextID , Text ) ;
if ( Wide ) _cmsFree ( self -> ContextID , Wide ) ;
return rc ;
cmsUNUSED_PARAMETER ( nItems ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gint dissect_rtmpt_body_command ( tvbuff_t * tvb , gint offset , proto_tree * rtmpt_tree , gboolean amf3 ) {
gboolean amf3_encoding = FALSE ;
if ( amf3 ) {
offset ++ ;
}
while ( tvb_reported_length_remaining ( tvb , offset ) > 0 ) {
if ( amf3_encoding ) offset = dissect_amf3_value_type ( tvb , offset , rtmpt_tree , NULL ) ;
else offset = dissect_amf0_value_type ( tvb , offset , rtmpt_tree , & amf3_encoding , NULL ) ;
}
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int sccp_calls ( packet_info * pinfo , const void * prot_info ) {
voip_calls_tapinfo_t * tapinfo = & the_tapinfo_struct ;
const sccp_msg_info_t * msg = ( const sccp_msg_info_t * ) prot_info ;
sccp_assoc_info_t * assoc = msg -> data . co . assoc ;
GList * list ;
voip_calls_info_t * callsinfo = NULL ;
const gchar * label = NULL ;
const gchar * comment = NULL ;
for ( list = g_list_first ( tapinfo -> callsinfo_list ) ;
list ;
list = g_list_next ( list ) ) {
if ( ( ( voip_calls_info_t * ) ( list -> data ) ) -> prot_info == assoc ) {
callsinfo = ( voip_calls_info_t * ) ( list -> data ) ;
break ;
}
}
if ( callsinfo == NULL ) {
callsinfo = ( voip_calls_info_t * ) g_malloc0 ( sizeof ( voip_calls_info_t ) ) ;
callsinfo -> call_state = VOIP_CALL_SETUP ;
callsinfo -> call_active_state = VOIP_ACTIVE ;
if ( assoc -> calling_party ) {
callsinfo -> from_identity = g_strdup ( assoc -> calling_party ) ;
}
else {
callsinfo -> from_identity = g_strdup ( "Unknown" ) ;
}
if ( assoc -> called_party ) {
callsinfo -> to_identity = g_strdup ( assoc -> called_party ) ;
}
else {
callsinfo -> to_identity = g_strdup ( "Unknown" ) ;
}
callsinfo -> prot_info = ( void * ) assoc ;
callsinfo -> free_prot_info = NULL ;
callsinfo -> npackets = 1 ;
COPY_ADDRESS ( & ( callsinfo -> initial_speaker ) , & ( pinfo -> src ) ) ;
callsinfo -> protocol = SP2VP ( assoc -> payload ) ;
callsinfo -> start_fd = pinfo -> fd ;
callsinfo -> start_rel_ts = pinfo -> rel_ts ;
callsinfo -> stop_fd = pinfo -> fd ;
callsinfo -> stop_rel_ts = pinfo -> rel_ts ;
callsinfo -> selected = FALSE ;
callsinfo -> call_num = tapinfo -> ncalls ++ ;
tapinfo -> callsinfo_list = g_list_prepend ( tapinfo -> callsinfo_list , callsinfo ) ;
}
else {
if ( assoc -> calling_party ) {
g_free ( callsinfo -> from_identity ) ;
callsinfo -> from_identity = g_strdup ( assoc -> calling_party ) ;
}
if ( assoc -> called_party ) {
g_free ( callsinfo -> to_identity ) ;
callsinfo -> to_identity = g_strdup ( assoc -> called_party ) ;
}
callsinfo -> protocol = SP2VP ( assoc -> payload ) ;
callsinfo -> stop_fd = pinfo -> fd ;
callsinfo -> stop_rel_ts = pinfo -> rel_ts ;
++ ( callsinfo -> npackets ) ;
switch ( msg -> type ) {
case SCCP_MSG_TYPE_CC : callsinfo -> call_state = VOIP_IN_CALL ;
break ;
case SCCP_MSG_TYPE_RLC : callsinfo -> call_state = VOIP_COMPLETED ;
callsinfo -> call_active_state = VOIP_INACTIVE ;
break ;
default : break ;
}
}
if ( msg -> data . co . label ) {
label = msg -> data . co . label ;
}
else {
label = val_to_str ( msg -> type , sccp_payload_values , "Unknown(%d)" ) ;
}
if ( msg -> data . co . comment ) {
comment = msg -> data . co . comment ;
}
else {
comment = NULL ;
}
add_to_graph ( tapinfo , pinfo , label , comment , callsinfo -> call_num , & ( pinfo -> src ) , & ( pinfo -> dst ) , 1 ) ;
++ ( tapinfo -> npackets ) ;
tapinfo -> redraw = TRUE ;
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool host_supports_vmx ( void ) {
uint32_t ecx , unused ;
host_cpuid ( 1 , 0 , & unused , & unused , & ecx , & unused ) ;
return ecx & CPUID_EXT_VMX ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_fwht4x4_c ( const int16_t * input , tran_low_t * output , int stride ) {
int i ;
tran_high_t a1 , b1 , c1 , d1 , e1 ;
const int16_t * ip_pass0 = input ;
const tran_low_t * ip = NULL ;
tran_low_t * op = output ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
a1 = ip_pass0 [ 0 * stride ] ;
b1 = ip_pass0 [ 1 * stride ] ;
c1 = ip_pass0 [ 2 * stride ] ;
d1 = ip_pass0 [ 3 * stride ] ;
a1 += b1 ;
d1 = d1 - c1 ;
e1 = ( a1 - d1 ) >> 1 ;
b1 = e1 - b1 ;
c1 = e1 - c1 ;
a1 -= c1 ;
d1 += b1 ;
op [ 0 ] = a1 ;
op [ 4 ] = c1 ;
op [ 8 ] = d1 ;
op [ 12 ] = b1 ;
ip_pass0 ++ ;
op ++ ;
}
ip = output ;
op = output ;
for ( i = 0 ;
i < 4 ;
i ++ ) {
a1 = ip [ 0 ] ;
b1 = ip [ 1 ] ;
c1 = ip [ 2 ] ;
d1 = ip [ 3 ] ;
a1 += b1 ;
d1 -= c1 ;
e1 = ( a1 - d1 ) >> 1 ;
b1 = e1 - b1 ;
c1 = e1 - c1 ;
a1 -= c1 ;
d1 += b1 ;
op [ 0 ] = a1 * UNIT_QUANT_FACTOR ;
op [ 1 ] = c1 * UNIT_QUANT_FACTOR ;
op [ 2 ] = d1 * UNIT_QUANT_FACTOR ;
op [ 3 ] = b1 * UNIT_QUANT_FACTOR ;
ip += 4 ;
op += 4 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void proto_deregister_field ( const int parent , gint hf_id ) {
header_field_info * hfi ;
protocol_t * proto ;
guint i ;
g_free ( last_field_name ) ;
last_field_name = NULL ;
if ( hf_id == - 1 || hf_id == 0 ) return ;
proto = find_protocol_by_id ( parent ) ;
if ( ! proto || proto -> fields -> len == 0 ) {
return ;
}
for ( i = 0 ;
i < proto -> fields -> len ;
i ++ ) {
hfi = ( header_field_info * ) g_ptr_array_index ( proto -> fields , i ) ;
if ( hfi -> id == hf_id ) {
g_hash_table_steal ( gpa_name_map , hfi -> abbrev ) ;
g_ptr_array_remove_index_fast ( proto -> fields , i ) ;
g_ptr_array_add ( deregistered_fields , gpa_hfinfo . hfi [ hf_id ] ) ;
return ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int proc_ioctl ( struct usb_dev_state * ps , struct usbdevfs_ioctl * ctl ) {
int size ;
void * buf = NULL ;
int retval = 0 ;
struct usb_interface * intf = NULL ;
struct usb_driver * driver = NULL ;
if ( ps -> privileges_dropped ) return - EACCES ;
size = _IOC_SIZE ( ctl -> ioctl_code ) ;
if ( size > 0 ) {
buf = kmalloc ( size , GFP_KERNEL ) ;
if ( buf == NULL ) return - ENOMEM ;
if ( ( _IOC_DIR ( ctl -> ioctl_code ) & _IOC_WRITE ) ) {
if ( copy_from_user ( buf , ctl -> data , size ) ) {
kfree ( buf ) ;
return - EFAULT ;
}
}
else {
memset ( buf , 0 , size ) ;
}
}
if ( ! connected ( ps ) ) {
kfree ( buf ) ;
return - ENODEV ;
}
if ( ps -> dev -> state != USB_STATE_CONFIGURED ) retval = - EHOSTUNREACH ;
else if ( ! ( intf = usb_ifnum_to_if ( ps -> dev , ctl -> ifno ) ) ) retval = - EINVAL ;
else switch ( ctl -> ioctl_code ) {
case USBDEVFS_DISCONNECT : if ( intf -> dev . driver ) {
driver = to_usb_driver ( intf -> dev . driver ) ;
dev_dbg ( & intf -> dev , "disconnect by usbfs\n" ) ;
usb_driver_release_interface ( driver , intf ) ;
}
else retval = - ENODATA ;
break ;
case USBDEVFS_CONNECT : if ( ! intf -> dev . driver ) retval = device_attach ( & intf -> dev ) ;
else retval = - EBUSY ;
break ;
default : if ( intf -> dev . driver ) driver = to_usb_driver ( intf -> dev . driver ) ;
if ( driver == NULL || driver -> unlocked_ioctl == NULL ) {
retval = - ENOTTY ;
}
else {
retval = driver -> unlocked_ioctl ( intf , ctl -> ioctl_code , buf ) ;
if ( retval == - ENOIOCTLCMD ) retval = - ENOTTY ;
}
}
if ( retval >= 0 && ( _IOC_DIR ( ctl -> ioctl_code ) & _IOC_READ ) != 0 && size > 0 && copy_to_user ( ctl -> data , buf , size ) != 0 ) retval = - EFAULT ;
kfree ( buf ) ;
return retval ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void complete_from_nicklist ( GList * * outlist , CHANNEL_REC * channel , const char * nick , const char * suffix , const int match_case ) {
MODULE_CHANNEL_REC * mchannel ;
GSList * tmp ;
GList * ownlist ;
char * str ;
int len ;
ownlist = NULL ;
len = strlen ( nick ) ;
mchannel = MODULE_DATA ( channel ) ;
for ( tmp = mchannel -> lastmsgs ;
tmp != NULL ;
tmp = tmp -> next ) {
LAST_MSG_REC * rec = tmp -> data ;
if ( ( match_case ? strncmp ( rec -> nick , nick , len ) : g_ascii_strncasecmp ( rec -> nick , nick , len ) ) == 0 && ( match_case ? glist_find_string ( * outlist , rec -> nick ) : glist_find_icase_string ( * outlist , rec -> nick ) ) == NULL ) {
str = g_strconcat ( rec -> nick , suffix , NULL ) ;
if ( completion_lowercase ) ascii_strdown ( str ) ;
if ( rec -> own ) ownlist = g_list_append ( ownlist , str ) ;
else * outlist = g_list_append ( * outlist , str ) ;
}
}
* outlist = g_list_concat ( ownlist , * outlist ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int mjpegb_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
MJpegDecodeContext * s = avctx -> priv_data ;
const uint8_t * buf_end , * buf_ptr ;
GetBitContext hgb ;
uint32_t dqt_offs , dht_offs , sof_offs , sos_offs , second_field_offs ;
uint32_t field_size , sod_offs ;
int ret ;
buf_ptr = buf ;
buf_end = buf + buf_size ;
read_header : s -> restart_interval = 0 ;
s -> restart_count = 0 ;
s -> mjpb_skiptosod = 0 ;
if ( buf_end - buf_ptr >= 1 << 28 ) return AVERROR_INVALIDDATA ;
init_get_bits ( & hgb , buf_ptr , ( buf_end - buf_ptr ) * 8 ) ;
skip_bits ( & hgb , 32 ) ;
if ( get_bits_long ( & hgb , 32 ) != MKBETAG ( 'm' , 'j' , 'p' , 'g' ) ) {
av_log ( avctx , AV_LOG_WARNING , "not mjpeg-b (bad fourcc)\n" ) ;
return AVERROR_INVALIDDATA ;
}
field_size = get_bits_long ( & hgb , 32 ) ;
av_log ( avctx , AV_LOG_DEBUG , "field size: 0x%x\n" , field_size ) ;
skip_bits ( & hgb , 32 ) ;
second_field_offs = read_offs ( avctx , & hgb , buf_end - buf_ptr , "second_field_offs is %d and size is %d\n" ) ;
av_log ( avctx , AV_LOG_DEBUG , "second field offs: 0x%x\n" , second_field_offs ) ;
dqt_offs = read_offs ( avctx , & hgb , buf_end - buf_ptr , "dqt is %d and size is %d\n" ) ;
av_log ( avctx , AV_LOG_DEBUG , "dqt offs: 0x%x\n" , dqt_offs ) ;
if ( dqt_offs ) {
init_get_bits ( & s -> gb , buf_ptr + dqt_offs , ( buf_end - ( buf_ptr + dqt_offs ) ) * 8 ) ;
s -> start_code = DQT ;
if ( ff_mjpeg_decode_dqt ( s ) < 0 && ( avctx -> err_recognition & AV_EF_EXPLODE ) ) return AVERROR_INVALIDDATA ;
}
dht_offs = read_offs ( avctx , & hgb , buf_end - buf_ptr , "dht is %d and size is %d\n" ) ;
av_log ( avctx , AV_LOG_DEBUG , "dht offs: 0x%x\n" , dht_offs ) ;
if ( dht_offs ) {
init_get_bits ( & s -> gb , buf_ptr + dht_offs , ( buf_end - ( buf_ptr + dht_offs ) ) * 8 ) ;
s -> start_code = DHT ;
ff_mjpeg_decode_dht ( s ) ;
}
sof_offs = read_offs ( avctx , & hgb , buf_end - buf_ptr , "sof is %d and size is %d\n" ) ;
av_log ( avctx , AV_LOG_DEBUG , "sof offs: 0x%x\n" , sof_offs ) ;
if ( sof_offs ) {
init_get_bits ( & s -> gb , buf_ptr + sof_offs , ( buf_end - ( buf_ptr + sof_offs ) ) * 8 ) ;
s -> start_code = SOF0 ;
if ( ff_mjpeg_decode_sof ( s ) < 0 ) return - 1 ;
}
sos_offs = read_offs ( avctx , & hgb , buf_end - buf_ptr , "sos is %d and size is %d\n" ) ;
av_log ( avctx , AV_LOG_DEBUG , "sos offs: 0x%x\n" , sos_offs ) ;
sod_offs = read_offs ( avctx , & hgb , buf_end - buf_ptr , "sof is %d and size is %d\n" ) ;
av_log ( avctx , AV_LOG_DEBUG , "sod offs: 0x%x\n" , sod_offs ) ;
if ( sos_offs ) {
init_get_bits ( & s -> gb , buf_ptr + sos_offs , 8 * FFMIN ( field_size , buf_end - buf_ptr - sos_offs ) ) ;
s -> mjpb_skiptosod = ( sod_offs - sos_offs - show_bits ( & s -> gb , 16 ) ) ;
s -> start_code = SOS ;
if ( ff_mjpeg_decode_sos ( s , NULL , NULL ) < 0 && ( avctx -> err_recognition & AV_EF_EXPLODE ) ) return AVERROR_INVALIDDATA ;
}
if ( s -> interlaced ) {
s -> bottom_field ^= 1 ;
if ( s -> bottom_field != s -> interlace_polarity && second_field_offs ) {
buf_ptr = buf + second_field_offs ;
second_field_offs = 0 ;
goto read_header ;
}
}
if ( ( ret = av_frame_ref ( data , s -> picture_ptr ) ) < 0 ) return ret ;
* got_frame = 1 ;
if ( ! s -> lossless && avctx -> debug & FF_DEBUG_QP ) {
av_log ( avctx , AV_LOG_DEBUG , "QP: %d\n" , FFMAX3 ( s -> qscale [ 0 ] , s -> qscale [ 1 ] , s -> qscale [ 2 ] ) ) ;
}
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean k12_seek_read ( wtap * wth , gint64 seek_off , struct wtap_pkthdr * phdr , Buffer * buf , int * err , gchar * * err_info ) {
k12_t * k12 = ( k12_t * ) wth -> priv ;
guint8 * buffer ;
gint len ;
K12_DBG ( 5 , ( "k12_seek_read: ENTER" ) ) ;
if ( file_seek ( wth -> random_fh , seek_off , SEEK_SET , err ) == - 1 ) {
K12_DBG ( 5 , ( "k12_seek_read: SEEK ERROR" ) ) ;
return FALSE ;
}
len = get_record ( k12 , wth -> random_fh , seek_off , TRUE , err , err_info ) ;
if ( len < 0 ) {
K12_DBG ( 5 , ( "k12_seek_read: READ ERROR" ) ) ;
return FALSE ;
}
else if ( len < K12_RECORD_SRC_ID + 4 ) {
K12_DBG ( 5 , ( "k12_seek_read: SHORT READ" ) ) ;
* err = WTAP_ERR_SHORT_READ ;
return FALSE ;
}
buffer = k12 -> rand_read_buff ;
process_packet_data ( phdr , buf , buffer , len , k12 ) ;
K12_DBG ( 5 , ( "k12_seek_read: DONE OK" ) ) ;
return TRUE ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _slurm_rpc_dump_partitions ( slurm_msg_t * msg ) {
DEF_TIMERS ;
char * dump ;
int dump_size ;
slurm_msg_t response_msg ;
part_info_request_msg_t * part_req_msg ;
slurmctld_lock_t part_read_lock = {
READ_LOCK , NO_LOCK , NO_LOCK , READ_LOCK , NO_LOCK }
;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
START_TIMER ;
debug2 ( "Processing RPC: REQUEST_PARTITION_INFO uid=%d" , uid ) ;
part_req_msg = ( part_info_request_msg_t * ) msg -> data ;
lock_slurmctld ( part_read_lock ) ;
if ( ( slurmctld_conf . private_data & PRIVATE_DATA_PARTITIONS ) && ! validate_operator ( uid ) ) {
unlock_slurmctld ( part_read_lock ) ;
debug2 ( "Security violation, PARTITION_INFO RPC from uid=%d" , uid ) ;
slurm_send_rc_msg ( msg , ESLURM_ACCESS_DENIED ) ;
}
else if ( ( part_req_msg -> last_update - 1 ) >= last_part_update ) {
unlock_slurmctld ( part_read_lock ) ;
debug2 ( "_slurm_rpc_dump_partitions, no change" ) ;
slurm_send_rc_msg ( msg , SLURM_NO_CHANGE_IN_DATA ) ;
}
else {
pack_all_part ( & dump , & dump_size , part_req_msg -> show_flags , uid , msg -> protocol_version ) ;
unlock_slurmctld ( part_read_lock ) ;
END_TIMER2 ( "_slurm_rpc_dump_partitions" ) ;
debug2 ( "_slurm_rpc_dump_partitions, size=%d %s" , dump_size , TIME_STR ) ;
slurm_msg_t_init ( & response_msg ) ;
response_msg . flags = msg -> flags ;
response_msg . protocol_version = msg -> protocol_version ;
response_msg . address = msg -> address ;
response_msg . conn = msg -> conn ;
response_msg . msg_type = RESPONSE_PARTITION_INFO ;
response_msg . data = dump ;
response_msg . data_size = dump_size ;
slurm_send_node_msg ( msg -> conn_fd , & response_msg ) ;
xfree ( dump ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void e1000e_intrmgr_on_timer ( void * opaque ) {
E1000IntrDelayTimer * timer = opaque ;
trace_e1000e_irq_throttling_timer ( timer -> delay_reg << 2 ) ;
timer -> running = false ;
e1000e_intrmgr_fire_delayed_interrupts ( timer -> core ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void set_roi_map ( const vpx_codec_enc_cfg_t * cfg , vpx_codec_ctx_t * codec ) {
unsigned int i ;
vpx_roi_map_t roi ;
memset ( & roi , 0 , sizeof ( roi ) ) ;
roi . rows = ( cfg -> g_h + 15 ) / 16 ;
roi . cols = ( cfg -> g_w + 15 ) / 16 ;
roi . delta_q [ 0 ] = 0 ;
roi . delta_q [ 1 ] = - 2 ;
roi . delta_q [ 2 ] = - 4 ;
roi . delta_q [ 3 ] = - 6 ;
roi . delta_lf [ 0 ] = 0 ;
roi . delta_lf [ 1 ] = 1 ;
roi . delta_lf [ 2 ] = 2 ;
roi . delta_lf [ 3 ] = 3 ;
roi . static_threshold [ 0 ] = 1500 ;
roi . static_threshold [ 1 ] = 1000 ;
roi . static_threshold [ 2 ] = 500 ;
roi . static_threshold [ 3 ] = 0 ;
roi . roi_map = ( uint8_t * ) malloc ( roi . rows * roi . cols ) ;
for ( i = 0 ;
i < roi . rows * roi . cols ;
++ i ) roi . roi_map [ i ] = i % 4 ;
if ( vpx_codec_control ( codec , VP8E_SET_ROI_MAP , & roi ) ) die_codec ( codec , "Failed to set ROI map" ) ;
free ( roi . roi_map ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int * __xmlLoadExtDtdDefaultValue ( void ) {
if ( IS_MAIN_THREAD ) return ( & xmlLoadExtDtdDefaultValue ) ;
else return ( & xmlGetGlobalState ( ) -> xmlLoadExtDtdDefaultValue ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
Datum icregexnejoinsel ( PG_FUNCTION_ARGS ) {
PG_RETURN_FLOAT8 ( patternjoinsel ( fcinfo , Pattern_Type_Regex_IC , true ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static my_bool get_one_option ( int optid , const struct my_option * opt __attribute__ ( ( unused ) ) , char * argument ) {
switch ( optid ) {
case 'a' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_STATISTICS ;
else check_param . testflag |= T_STATISTICS ;
break ;
case 'A' : if ( argument ) check_param . auto_increment_value = strtoull ( argument , NULL , 0 ) ;
else check_param . auto_increment_value = 0 ;
check_param . testflag |= T_AUTO_INC ;
break ;
case 'b' : check_param . search_after_block = strtoul ( argument , NULL , 10 ) ;
break ;
case 'B' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_BACKUP_DATA ;
else check_param . testflag |= T_BACKUP_DATA ;
break ;
case 'c' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_CHECK ;
else check_param . testflag |= T_CHECK ;
break ;
case 'C' : if ( argument == disabled_my_option ) check_param . testflag &= ~ ( T_CHECK | T_CHECK_ONLY_CHANGED ) ;
else check_param . testflag |= T_CHECK | T_CHECK_ONLY_CHANGED ;
break ;
case 'D' : check_param . max_data_file_length = strtoll ( argument , NULL , 10 ) ;
break ;
case 's' : if ( argument == disabled_my_option ) check_param . testflag &= ~ ( T_SILENT | T_VERY_SILENT ) ;
else {
if ( check_param . testflag & T_SILENT ) check_param . testflag |= T_VERY_SILENT ;
check_param . testflag |= T_SILENT ;
check_param . testflag &= ~ T_WRITE_LOOP ;
}
break ;
case 'w' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_WAIT_FOREVER ;
else check_param . testflag |= T_WAIT_FOREVER ;
break ;
case 'd' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_DESCRIPT ;
else check_param . testflag |= T_DESCRIPT ;
break ;
case 'e' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_EXTEND ;
else check_param . testflag |= T_EXTEND ;
break ;
case 'i' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_INFO ;
else check_param . testflag |= T_INFO ;
break ;
case 'f' : if ( argument == disabled_my_option ) {
check_param . tmpfile_createflag = O_RDWR | O_TRUNC | O_EXCL ;
check_param . testflag &= ~ ( T_FORCE_CREATE | T_UPDATE_STATE ) ;
}
else {
check_param . tmpfile_createflag = O_RDWR | O_TRUNC ;
check_param . testflag |= T_FORCE_CREATE | T_UPDATE_STATE ;
}
break ;
case 'F' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_FAST ;
else check_param . testflag |= T_FAST ;
break ;
case 'k' : check_param . keys_in_use = ( ulonglong ) strtoll ( argument , NULL , 10 ) ;
break ;
case 'm' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_MEDIUM ;
else check_param . testflag |= T_MEDIUM ;
break ;
case 'r' : check_param . testflag &= ~ T_REP_ANY ;
if ( argument != disabled_my_option ) check_param . testflag |= T_REP_BY_SORT ;
break ;
case 'p' : check_param . testflag &= ~ T_REP_ANY ;
if ( argument != disabled_my_option ) check_param . testflag |= T_REP_PARALLEL ;
break ;
case 'o' : check_param . testflag &= ~ T_REP_ANY ;
check_param . force_sort = 0 ;
if ( argument != disabled_my_option ) {
check_param . testflag |= T_REP ;
my_disable_async_io = 1 ;
}
break ;
case 'n' : check_param . testflag &= ~ T_REP_ANY ;
if ( argument == disabled_my_option ) check_param . force_sort = 0 ;
else {
check_param . testflag |= T_REP_BY_SORT ;
check_param . force_sort = 1 ;
}
break ;
case 'q' : if ( argument == disabled_my_option ) check_param . testflag &= ~ ( T_QUICK | T_FORCE_UNIQUENESS ) ;
else check_param . testflag |= ( check_param . testflag & T_QUICK ) ? T_FORCE_UNIQUENESS : T_QUICK ;
break ;
case 'u' : if ( argument == disabled_my_option ) check_param . testflag &= ~ ( T_UNPACK | T_REP_BY_SORT ) ;
else check_param . testflag |= T_UNPACK | T_REP_BY_SORT ;
break ;
case 'v' : if ( argument == disabled_my_option ) {
check_param . testflag &= ~ T_VERBOSE ;
check_param . verbose = 0 ;
}
else {
check_param . testflag |= T_VERBOSE ;
check_param . verbose ++ ;
}
break ;
case 'R' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_SORT_RECORDS ;
else {
check_param . testflag |= T_SORT_RECORDS ;
check_param . opt_sort_key = ( uint ) atoi ( argument ) - 1 ;
if ( check_param . opt_sort_key >= MI_MAX_KEY ) {
fprintf ( stderr , "The value of the sort key is bigger than max key: %d.\n" , MI_MAX_KEY ) ;
exit ( 1 ) ;
}
}
break ;
case 'S' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_SORT_INDEX ;
else check_param . testflag |= T_SORT_INDEX ;
break ;
case 'T' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_READONLY ;
else check_param . testflag |= T_READONLY ;
break ;
case 'U' : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_UPDATE_STATE ;
else check_param . testflag |= T_UPDATE_STATE ;
break ;
case '#' : if ( argument == disabled_my_option ) {
DBUG_POP ( ) ;
}
else {
DBUG_PUSH ( argument ? argument : "d:t:o,/tmp/myisamchk.trace" ) ;
}
break ;
case 'V' : print_version ( ) ;
exit ( 0 ) ;
case OPT_CORRECT_CHECKSUM : if ( argument == disabled_my_option ) check_param . testflag &= ~ T_CALC_CHECKSUM ;
else check_param . testflag |= T_CALC_CHECKSUM ;
break ;
case OPT_STATS_METHOD : {
int method ;
enum_mi_stats_method UNINIT_VAR ( method_conv ) ;
myisam_stats_method_str = argument ;
if ( ( method = find_type ( argument , & myisam_stats_method_typelib , FIND_TYPE_BASIC ) ) <= 0 ) {
fprintf ( stderr , "Invalid value of stats_method: %s.\n" , argument ) ;
exit ( 1 ) ;
}
switch ( method - 1 ) {
case 0 : method_conv = MI_STATS_METHOD_NULLS_EQUAL ;
break ;
case 1 : method_conv = MI_STATS_METHOD_NULLS_NOT_EQUAL ;
break ;
case 2 : method_conv = MI_STATS_METHOD_IGNORE_NULLS ;
break ;
default : assert ( 0 ) ;
}
check_param . stats_method = method_conv ;
break ;
}
# ifdef DEBUG case OPT_START_CHECK_POS : check_param . start_check_pos = strtoull ( argument , NULL , 0 ) ;
break ;
# endif case 'H' : my_print_help ( my_long_options ) ;
exit ( 0 ) ;
case '?' : usage ( ) ;
exit ( 0 ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
char * virLogGetOutputs ( void ) {
size_t i ;
virBuffer outputbuf = VIR_BUFFER_INITIALIZER ;
virLogLock ( ) ;
for ( i = 0 ;
i < virLogNbOutputs ;
i ++ ) {
virLogDestination dest = virLogOutputs [ i ] -> dest ;
if ( i ) virBufferAddChar ( & outputbuf , ' ' ) ;
switch ( dest ) {
case VIR_LOG_TO_SYSLOG : case VIR_LOG_TO_FILE : virBufferAsprintf ( & outputbuf , "%d:%s:%s" , virLogOutputs [ i ] -> priority , virLogDestinationTypeToString ( dest ) , virLogOutputs [ i ] -> name ) ;
break ;
default : virBufferAsprintf ( & outputbuf , "%d:%s" , virLogOutputs [ i ] -> priority , virLogDestinationTypeToString ( dest ) ) ;
}
}
virLogUnlock ( ) ;
if ( virBufferError ( & outputbuf ) ) {
virBufferFreeAndReset ( & outputbuf ) ;
return NULL ;
}
return virBufferContentAndReset ( & outputbuf ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void xps_clip ( xps_document * doc , const fz_matrix * ctm , xps_resource * dict , char * clip_att , fz_xml * clip_tag ) {
fz_path * path ;
int fill_rule = 0 ;
if ( clip_att ) path = xps_parse_abbreviated_geometry ( doc , clip_att , & fill_rule ) ;
else if ( clip_tag ) path = xps_parse_path_geometry ( doc , dict , clip_tag , 0 , & fill_rule ) ;
else path = fz_new_path ( doc -> ctx ) ;
fz_clip_path ( doc -> dev , path , NULL , fill_rule == 0 , ctm ) ;
fz_free_path ( doc -> ctx , path ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static PREDICTION_MODE read_inter_mode ( VP9_COMMON * cm , vp9_reader * r , int ctx ) {
const int mode = vp9_read_tree ( r , vp9_inter_mode_tree , cm -> fc . inter_mode_probs [ ctx ] ) ;
if ( ! cm -> frame_parallel_decoding_mode ) ++ cm -> counts . inter_mode [ ctx ] [ mode ] ;
return NEARESTMV + mode ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool parse_basicConstraints ( chunk_t blob , int level0 , private_x509_cert_t * this ) {
asn1_parser_t * parser ;
chunk_t object ;
int objectID ;
bool isCA = FALSE ;
bool success ;
parser = asn1_parser_create ( basicConstraintsObjects , blob ) ;
parser -> set_top_level ( parser , level0 ) ;
while ( parser -> iterate ( parser , & objectID , & object ) ) {
switch ( objectID ) {
case BASIC_CONSTRAINTS_CA : isCA = object . len && * object . ptr ;
DBG2 ( DBG_ASN , " %s" , isCA ? "TRUE" : "FALSE" ) ;
if ( isCA ) {
this -> flags |= X509_CA ;
}
break ;
case BASIC_CONSTRAINTS_PATH_LEN : if ( isCA ) {
this -> pathLenConstraint = parse_constraint ( 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
|
static void fill_decode_caches ( H264Context * h , int mb_type ) {
int topleft_xy , top_xy , topright_xy , left_xy [ LEFT_MBS ] ;
int topleft_type , top_type , topright_type , left_type [ LEFT_MBS ] ;
const uint8_t * left_block = h -> left_block ;
int i ;
uint8_t * nnz ;
uint8_t * nnz_cache ;
topleft_xy = h -> topleft_mb_xy ;
top_xy = h -> top_mb_xy ;
topright_xy = h -> topright_mb_xy ;
left_xy [ LTOP ] = h -> left_mb_xy [ LTOP ] ;
left_xy [ LBOT ] = h -> left_mb_xy [ LBOT ] ;
topleft_type = h -> topleft_type ;
top_type = h -> top_type ;
topright_type = h -> topright_type ;
left_type [ LTOP ] = h -> left_type [ LTOP ] ;
left_type [ LBOT ] = h -> left_type [ LBOT ] ;
if ( ! IS_SKIP ( mb_type ) ) {
if ( IS_INTRA ( mb_type ) ) {
int type_mask = h -> pps . constrained_intra_pred ? IS_INTRA ( - 1 ) : - 1 ;
h -> topleft_samples_available = h -> top_samples_available = h -> left_samples_available = 0xFFFF ;
h -> topright_samples_available = 0xEEEA ;
if ( ! ( top_type & type_mask ) ) {
h -> topleft_samples_available = 0xB3FF ;
h -> top_samples_available = 0x33FF ;
h -> topright_samples_available = 0x26EA ;
}
if ( IS_INTERLACED ( mb_type ) != IS_INTERLACED ( left_type [ LTOP ] ) ) {
if ( IS_INTERLACED ( mb_type ) ) {
if ( ! ( left_type [ LTOP ] & type_mask ) ) {
h -> topleft_samples_available &= 0xDFFF ;
h -> left_samples_available &= 0x5FFF ;
}
if ( ! ( left_type [ LBOT ] & type_mask ) ) {
h -> topleft_samples_available &= 0xFF5F ;
h -> left_samples_available &= 0xFF5F ;
}
}
else {
int left_typei = h -> cur_pic . mb_type [ left_xy [ LTOP ] + h -> mb_stride ] ;
assert ( left_xy [ LTOP ] == left_xy [ LBOT ] ) ;
if ( ! ( ( left_typei & type_mask ) && ( left_type [ LTOP ] & type_mask ) ) ) {
h -> topleft_samples_available &= 0xDF5F ;
h -> left_samples_available &= 0x5F5F ;
}
}
}
else {
if ( ! ( left_type [ LTOP ] & type_mask ) ) {
h -> topleft_samples_available &= 0xDF5F ;
h -> left_samples_available &= 0x5F5F ;
}
}
if ( ! ( topleft_type & type_mask ) ) h -> topleft_samples_available &= 0x7FFF ;
if ( ! ( topright_type & type_mask ) ) h -> topright_samples_available &= 0xFBFF ;
if ( IS_INTRA4x4 ( mb_type ) ) {
if ( IS_INTRA4x4 ( top_type ) ) {
AV_COPY32 ( h -> intra4x4_pred_mode_cache + 4 + 8 * 0 , h -> intra4x4_pred_mode + h -> mb2br_xy [ top_xy ] ) ;
}
else {
h -> intra4x4_pred_mode_cache [ 4 + 8 * 0 ] = h -> intra4x4_pred_mode_cache [ 5 + 8 * 0 ] = h -> intra4x4_pred_mode_cache [ 6 + 8 * 0 ] = h -> intra4x4_pred_mode_cache [ 7 + 8 * 0 ] = 2 - 3 * ! ( top_type & type_mask ) ;
}
for ( i = 0 ;
i < 2 ;
i ++ ) {
if ( IS_INTRA4x4 ( left_type [ LEFT ( i ) ] ) ) {
int8_t * mode = h -> intra4x4_pred_mode + h -> mb2br_xy [ left_xy [ LEFT ( i ) ] ] ;
h -> intra4x4_pred_mode_cache [ 3 + 8 * 1 + 2 * 8 * i ] = mode [ 6 - left_block [ 0 + 2 * i ] ] ;
h -> intra4x4_pred_mode_cache [ 3 + 8 * 2 + 2 * 8 * i ] = mode [ 6 - left_block [ 1 + 2 * i ] ] ;
}
else {
h -> intra4x4_pred_mode_cache [ 3 + 8 * 1 + 2 * 8 * i ] = h -> intra4x4_pred_mode_cache [ 3 + 8 * 2 + 2 * 8 * i ] = 2 - 3 * ! ( left_type [ LEFT ( i ) ] & type_mask ) ;
}
}
}
}
nnz_cache = h -> non_zero_count_cache ;
if ( top_type ) {
nnz = h -> non_zero_count [ top_xy ] ;
AV_COPY32 ( & nnz_cache [ 4 + 8 * 0 ] , & nnz [ 4 * 3 ] ) ;
if ( ! h -> chroma_y_shift ) {
AV_COPY32 ( & nnz_cache [ 4 + 8 * 5 ] , & nnz [ 4 * 7 ] ) ;
AV_COPY32 ( & nnz_cache [ 4 + 8 * 10 ] , & nnz [ 4 * 11 ] ) ;
}
else {
AV_COPY32 ( & nnz_cache [ 4 + 8 * 5 ] , & nnz [ 4 * 5 ] ) ;
AV_COPY32 ( & nnz_cache [ 4 + 8 * 10 ] , & nnz [ 4 * 9 ] ) ;
}
}
else {
uint32_t top_empty = CABAC && ! IS_INTRA ( mb_type ) ? 0 : 0x40404040 ;
AV_WN32A ( & nnz_cache [ 4 + 8 * 0 ] , top_empty ) ;
AV_WN32A ( & nnz_cache [ 4 + 8 * 5 ] , top_empty ) ;
AV_WN32A ( & nnz_cache [ 4 + 8 * 10 ] , top_empty ) ;
}
for ( i = 0 ;
i < 2 ;
i ++ ) {
if ( left_type [ LEFT ( i ) ] ) {
nnz = h -> non_zero_count [ left_xy [ LEFT ( i ) ] ] ;
nnz_cache [ 3 + 8 * 1 + 2 * 8 * i ] = nnz [ left_block [ 8 + 0 + 2 * i ] ] ;
nnz_cache [ 3 + 8 * 2 + 2 * 8 * i ] = nnz [ left_block [ 8 + 1 + 2 * i ] ] ;
if ( CHROMA444 ) {
nnz_cache [ 3 + 8 * 6 + 2 * 8 * i ] = nnz [ left_block [ 8 + 0 + 2 * i ] + 4 * 4 ] ;
nnz_cache [ 3 + 8 * 7 + 2 * 8 * i ] = nnz [ left_block [ 8 + 1 + 2 * i ] + 4 * 4 ] ;
nnz_cache [ 3 + 8 * 11 + 2 * 8 * i ] = nnz [ left_block [ 8 + 0 + 2 * i ] + 8 * 4 ] ;
nnz_cache [ 3 + 8 * 12 + 2 * 8 * i ] = nnz [ left_block [ 8 + 1 + 2 * i ] + 8 * 4 ] ;
}
else if ( CHROMA422 ) {
nnz_cache [ 3 + 8 * 6 + 2 * 8 * i ] = nnz [ left_block [ 8 + 0 + 2 * i ] - 2 + 4 * 4 ] ;
nnz_cache [ 3 + 8 * 7 + 2 * 8 * i ] = nnz [ left_block [ 8 + 1 + 2 * i ] - 2 + 4 * 4 ] ;
nnz_cache [ 3 + 8 * 11 + 2 * 8 * i ] = nnz [ left_block [ 8 + 0 + 2 * i ] - 2 + 8 * 4 ] ;
nnz_cache [ 3 + 8 * 12 + 2 * 8 * i ] = nnz [ left_block [ 8 + 1 + 2 * i ] - 2 + 8 * 4 ] ;
}
else {
nnz_cache [ 3 + 8 * 6 + 8 * i ] = nnz [ left_block [ 8 + 4 + 2 * i ] ] ;
nnz_cache [ 3 + 8 * 11 + 8 * i ] = nnz [ left_block [ 8 + 5 + 2 * i ] ] ;
}
}
else {
nnz_cache [ 3 + 8 * 1 + 2 * 8 * i ] = nnz_cache [ 3 + 8 * 2 + 2 * 8 * i ] = nnz_cache [ 3 + 8 * 6 + 2 * 8 * i ] = nnz_cache [ 3 + 8 * 7 + 2 * 8 * i ] = nnz_cache [ 3 + 8 * 11 + 2 * 8 * i ] = nnz_cache [ 3 + 8 * 12 + 2 * 8 * i ] = CABAC && ! IS_INTRA ( mb_type ) ? 0 : 64 ;
}
}
if ( CABAC ) {
if ( top_type ) h -> top_cbp = h -> cbp_table [ top_xy ] ;
else h -> top_cbp = IS_INTRA ( mb_type ) ? 0x7CF : 0x00F ;
if ( left_type [ LTOP ] ) {
h -> left_cbp = ( h -> cbp_table [ left_xy [ LTOP ] ] & 0x7F0 ) | ( ( h -> cbp_table [ left_xy [ LTOP ] ] >> ( left_block [ 0 ] & ( ~ 1 ) ) ) & 2 ) | ( ( ( h -> cbp_table [ left_xy [ LBOT ] ] >> ( left_block [ 2 ] & ( ~ 1 ) ) ) & 2 ) << 2 ) ;
}
else {
h -> left_cbp = IS_INTRA ( mb_type ) ? 0x7CF : 0x00F ;
}
}
}
if ( IS_INTER ( mb_type ) || ( IS_DIRECT ( mb_type ) && h -> direct_spatial_mv_pred ) ) {
int list ;
int b_stride = h -> b_stride ;
for ( list = 0 ;
list < h -> list_count ;
list ++ ) {
int8_t * ref_cache = & h -> ref_cache [ list ] [ scan8 [ 0 ] ] ;
int8_t * ref = h -> cur_pic . ref_index [ list ] ;
int16_t ( * mv_cache ) [ 2 ] = & h -> mv_cache [ list ] [ scan8 [ 0 ] ] ;
int16_t ( * mv ) [ 2 ] = h -> cur_pic . motion_val [ list ] ;
if ( ! USES_LIST ( mb_type , list ) ) continue ;
assert ( ! ( IS_DIRECT ( mb_type ) && ! h -> direct_spatial_mv_pred ) ) ;
if ( USES_LIST ( top_type , list ) ) {
const int b_xy = h -> mb2b_xy [ top_xy ] + 3 * b_stride ;
AV_COPY128 ( mv_cache [ 0 - 1 * 8 ] , mv [ b_xy + 0 ] ) ;
ref_cache [ 0 - 1 * 8 ] = ref_cache [ 1 - 1 * 8 ] = ref [ 4 * top_xy + 2 ] ;
ref_cache [ 2 - 1 * 8 ] = ref_cache [ 3 - 1 * 8 ] = ref [ 4 * top_xy + 3 ] ;
}
else {
AV_ZERO128 ( mv_cache [ 0 - 1 * 8 ] ) ;
AV_WN32A ( & ref_cache [ 0 - 1 * 8 ] , ( ( top_type ? LIST_NOT_USED : PART_NOT_AVAILABLE ) & 0xFF ) * 0x01010101u ) ;
}
if ( mb_type & ( MB_TYPE_16x8 | MB_TYPE_8x8 ) ) {
for ( i = 0 ;
i < 2 ;
i ++ ) {
int cache_idx = - 1 + i * 2 * 8 ;
if ( USES_LIST ( left_type [ LEFT ( i ) ] , list ) ) {
const int b_xy = h -> mb2b_xy [ left_xy [ LEFT ( i ) ] ] + 3 ;
const int b8_xy = 4 * left_xy [ LEFT ( i ) ] + 1 ;
AV_COPY32 ( mv_cache [ cache_idx ] , mv [ b_xy + b_stride * left_block [ 0 + i * 2 ] ] ) ;
AV_COPY32 ( mv_cache [ cache_idx + 8 ] , mv [ b_xy + b_stride * left_block [ 1 + i * 2 ] ] ) ;
ref_cache [ cache_idx ] = ref [ b8_xy + ( left_block [ 0 + i * 2 ] & ~ 1 ) ] ;
ref_cache [ cache_idx + 8 ] = ref [ b8_xy + ( left_block [ 1 + i * 2 ] & ~ 1 ) ] ;
}
else {
AV_ZERO32 ( mv_cache [ cache_idx ] ) ;
AV_ZERO32 ( mv_cache [ cache_idx + 8 ] ) ;
ref_cache [ cache_idx ] = ref_cache [ cache_idx + 8 ] = ( left_type [ LEFT ( i ) ] ) ? LIST_NOT_USED : PART_NOT_AVAILABLE ;
}
}
}
else {
if ( USES_LIST ( left_type [ LTOP ] , list ) ) {
const int b_xy = h -> mb2b_xy [ left_xy [ LTOP ] ] + 3 ;
const int b8_xy = 4 * left_xy [ LTOP ] + 1 ;
AV_COPY32 ( mv_cache [ - 1 ] , mv [ b_xy + b_stride * left_block [ 0 ] ] ) ;
ref_cache [ - 1 ] = ref [ b8_xy + ( left_block [ 0 ] & ~ 1 ) ] ;
}
else {
AV_ZERO32 ( mv_cache [ - 1 ] ) ;
ref_cache [ - 1 ] = left_type [ LTOP ] ? LIST_NOT_USED : PART_NOT_AVAILABLE ;
}
}
if ( USES_LIST ( topright_type , list ) ) {
const int b_xy = h -> mb2b_xy [ topright_xy ] + 3 * b_stride ;
AV_COPY32 ( mv_cache [ 4 - 1 * 8 ] , mv [ b_xy ] ) ;
ref_cache [ 4 - 1 * 8 ] = ref [ 4 * topright_xy + 2 ] ;
}
else {
AV_ZERO32 ( mv_cache [ 4 - 1 * 8 ] ) ;
ref_cache [ 4 - 1 * 8 ] = topright_type ? LIST_NOT_USED : PART_NOT_AVAILABLE ;
}
if ( ref_cache [ 4 - 1 * 8 ] < 0 ) {
if ( USES_LIST ( topleft_type , list ) ) {
const int b_xy = h -> mb2b_xy [ topleft_xy ] + 3 + b_stride + ( h -> topleft_partition & 2 * b_stride ) ;
const int b8_xy = 4 * topleft_xy + 1 + ( h -> topleft_partition & 2 ) ;
AV_COPY32 ( mv_cache [ - 1 - 1 * 8 ] , mv [ b_xy ] ) ;
ref_cache [ - 1 - 1 * 8 ] = ref [ b8_xy ] ;
}
else {
AV_ZERO32 ( mv_cache [ - 1 - 1 * 8 ] ) ;
ref_cache [ - 1 - 1 * 8 ] = topleft_type ? LIST_NOT_USED : PART_NOT_AVAILABLE ;
}
}
if ( ( mb_type & ( MB_TYPE_SKIP | MB_TYPE_DIRECT2 ) ) && ! FRAME_MBAFF ) continue ;
if ( ! ( mb_type & ( MB_TYPE_SKIP | MB_TYPE_DIRECT2 ) ) ) {
uint8_t ( * mvd_cache ) [ 2 ] = & h -> mvd_cache [ list ] [ scan8 [ 0 ] ] ;
uint8_t ( * mvd ) [ 2 ] = h -> mvd_table [ list ] ;
ref_cache [ 2 + 8 * 0 ] = ref_cache [ 2 + 8 * 2 ] = PART_NOT_AVAILABLE ;
AV_ZERO32 ( mv_cache [ 2 + 8 * 0 ] ) ;
AV_ZERO32 ( mv_cache [ 2 + 8 * 2 ] ) ;
if ( CABAC ) {
if ( USES_LIST ( top_type , list ) ) {
const int b_xy = h -> mb2br_xy [ top_xy ] ;
AV_COPY64 ( mvd_cache [ 0 - 1 * 8 ] , mvd [ b_xy + 0 ] ) ;
}
else {
AV_ZERO64 ( mvd_cache [ 0 - 1 * 8 ] ) ;
}
if ( USES_LIST ( left_type [ LTOP ] , list ) ) {
const int b_xy = h -> mb2br_xy [ left_xy [ LTOP ] ] + 6 ;
AV_COPY16 ( mvd_cache [ - 1 + 0 * 8 ] , mvd [ b_xy - left_block [ 0 ] ] ) ;
AV_COPY16 ( mvd_cache [ - 1 + 1 * 8 ] , mvd [ b_xy - left_block [ 1 ] ] ) ;
}
else {
AV_ZERO16 ( mvd_cache [ - 1 + 0 * 8 ] ) ;
AV_ZERO16 ( mvd_cache [ - 1 + 1 * 8 ] ) ;
}
if ( USES_LIST ( left_type [ LBOT ] , list ) ) {
const int b_xy = h -> mb2br_xy [ left_xy [ LBOT ] ] + 6 ;
AV_COPY16 ( mvd_cache [ - 1 + 2 * 8 ] , mvd [ b_xy - left_block [ 2 ] ] ) ;
AV_COPY16 ( mvd_cache [ - 1 + 3 * 8 ] , mvd [ b_xy - left_block [ 3 ] ] ) ;
}
else {
AV_ZERO16 ( mvd_cache [ - 1 + 2 * 8 ] ) ;
AV_ZERO16 ( mvd_cache [ - 1 + 3 * 8 ] ) ;
}
AV_ZERO16 ( mvd_cache [ 2 + 8 * 0 ] ) ;
AV_ZERO16 ( mvd_cache [ 2 + 8 * 2 ] ) ;
if ( h -> slice_type_nos == AV_PICTURE_TYPE_B ) {
uint8_t * direct_cache = & h -> direct_cache [ scan8 [ 0 ] ] ;
uint8_t * direct_table = h -> direct_table ;
fill_rectangle ( direct_cache , 4 , 4 , 8 , MB_TYPE_16x16 >> 1 , 1 ) ;
if ( IS_DIRECT ( top_type ) ) {
AV_WN32A ( & direct_cache [ - 1 * 8 ] , 0x01010101u * ( MB_TYPE_DIRECT2 >> 1 ) ) ;
}
else if ( IS_8X8 ( top_type ) ) {
int b8_xy = 4 * top_xy ;
direct_cache [ 0 - 1 * 8 ] = direct_table [ b8_xy + 2 ] ;
direct_cache [ 2 - 1 * 8 ] = direct_table [ b8_xy + 3 ] ;
}
else {
AV_WN32A ( & direct_cache [ - 1 * 8 ] , 0x01010101 * ( MB_TYPE_16x16 >> 1 ) ) ;
}
if ( IS_DIRECT ( left_type [ LTOP ] ) ) direct_cache [ - 1 + 0 * 8 ] = MB_TYPE_DIRECT2 >> 1 ;
else if ( IS_8X8 ( left_type [ LTOP ] ) ) direct_cache [ - 1 + 0 * 8 ] = direct_table [ 4 * left_xy [ LTOP ] + 1 + ( left_block [ 0 ] & ~ 1 ) ] ;
else direct_cache [ - 1 + 0 * 8 ] = MB_TYPE_16x16 >> 1 ;
if ( IS_DIRECT ( left_type [ LBOT ] ) ) direct_cache [ - 1 + 2 * 8 ] = MB_TYPE_DIRECT2 >> 1 ;
else if ( IS_8X8 ( left_type [ LBOT ] ) ) direct_cache [ - 1 + 2 * 8 ] = direct_table [ 4 * left_xy [ LBOT ] + 1 + ( left_block [ 2 ] & ~ 1 ) ] ;
else direct_cache [ - 1 + 2 * 8 ] = MB_TYPE_16x16 >> 1 ;
}
}
}
# define MAP_MVS MAP_F2F ( scan8 [ 0 ] - 1 - 1 * 8 , topleft_type ) MAP_F2F ( scan8 [ 0 ] + 0 - 1 * 8 , top_type ) MAP_F2F ( scan8 [ 0 ] + 1 - 1 * 8 , top_type ) MAP_F2F ( scan8 [ 0 ] + 2 - 1 * 8 , top_type ) MAP_F2F ( scan8 [ 0 ] + 3 - 1 * 8 , top_type ) MAP_F2F ( scan8 [ 0 ] + 4 - 1 * 8 , topright_type ) MAP_F2F ( scan8 [ 0 ] - 1 + 0 * 8 , left_type [ LTOP ] ) MAP_F2F ( scan8 [ 0 ] - 1 + 1 * 8 , left_type [ LTOP ] ) MAP_F2F ( scan8 [ 0 ] - 1 + 2 * 8 , left_type [ LBOT ] ) MAP_F2F ( scan8 [ 0 ] - 1 + 3 * 8 , left_type [ LBOT ] ) if ( FRAME_MBAFF ) {
if ( MB_FIELD ) {
# define MAP_F2F ( idx , mb_type ) if ( ! IS_INTERLACED ( mb_type ) && h -> ref_cache [ list ] [ idx ] >= 0 ) {
h -> ref_cache [ list ] [ idx ] <<= 1 ;
h -> mv_cache [ list ] [ idx ] [ 1 ] /= 2 ;
h -> mvd_cache [ list ] [ idx ] [ 1 ] >>= 1 ;
}
MAP_MVS }
else {
# undef MAP_F2F # define MAP_F2F ( idx , mb_type ) if ( IS_INTERLACED ( mb_type ) && h -> ref_cache [ list ] [ idx ] >= 0 ) {
h -> ref_cache [ list ] [ idx ] >>= 1 ;
h -> mv_cache [ list ] [ idx ] [ 1 ] <<= 1 ;
h -> mvd_cache [ list ] [ idx ] [ 1 ] <<= 1 ;
}
MAP_MVS # undef MAP_F2F }
}
}
}
h -> neighbor_transform_size = ! ! IS_8x8DCT ( top_type ) + ! ! IS_8x8DCT ( left_type [ LTOP ] ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
jas_stream_t * jas_stream_fopen ( const char * filename , const char * mode ) {
jas_stream_t * stream ;
jas_stream_fileobj_t * obj ;
int openflags ;
if ( ! ( stream = jas_stream_create ( ) ) ) {
return 0 ;
}
stream -> openmode_ = jas_strtoopenmode ( mode ) ;
if ( ( stream -> openmode_ & JAS_STREAM_READ ) && ( stream -> openmode_ & JAS_STREAM_WRITE ) ) {
openflags = O_RDWR ;
}
else if ( stream -> openmode_ & JAS_STREAM_READ ) {
openflags = O_RDONLY ;
}
else if ( stream -> openmode_ & JAS_STREAM_WRITE ) {
openflags = O_WRONLY ;
}
else {
openflags = 0 ;
}
if ( stream -> openmode_ & JAS_STREAM_APPEND ) {
openflags |= O_APPEND ;
}
if ( stream -> openmode_ & JAS_STREAM_BINARY ) {
openflags |= O_BINARY ;
}
if ( stream -> openmode_ & JAS_STREAM_CREATE ) {
openflags |= O_CREAT | O_TRUNC ;
}
if ( ! ( obj = jas_malloc ( sizeof ( jas_stream_fileobj_t ) ) ) ) {
jas_stream_destroy ( stream ) ;
return 0 ;
}
obj -> fd = - 1 ;
obj -> flags = 0 ;
obj -> pathname [ 0 ] = '\0' ;
stream -> obj_ = ( void * ) obj ;
stream -> ops_ = & jas_stream_fileops ;
if ( ( obj -> fd = open ( filename , openflags , JAS_STREAM_PERMS ) ) < 0 ) {
jas_stream_destroy ( stream ) ;
return 0 ;
}
jas_stream_initbuf ( stream , JAS_STREAM_FULLBUF , 0 , 0 ) ;
return stream ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static cmsTagTypeSignature DecideTextType ( cmsFloat64Number ICCVersion , const void * Data ) {
if ( ICCVersion >= 4.0 ) return cmsSigMultiLocalizedUnicodeType ;
return cmsSigTextType ;
cmsUNUSED_PARAMETER ( Data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static xmlNodeSetPtr exsltMathLowest ( xmlNodeSetPtr ns ) {
xmlNodeSetPtr ret = xmlXPathNodeSetCreate ( NULL ) ;
double min , cur ;
int i ;
if ( ( ns == NULL ) || ( ns -> nodeNr == 0 ) ) return ( ret ) ;
min = xmlXPathCastNodeToNumber ( ns -> nodeTab [ 0 ] ) ;
if ( xmlXPathIsNaN ( min ) ) return ( ret ) ;
else xmlXPathNodeSetAddUnique ( ret , ns -> nodeTab [ 0 ] ) ;
for ( i = 1 ;
i < ns -> nodeNr ;
i ++ ) {
cur = xmlXPathCastNodeToNumber ( ns -> nodeTab [ i ] ) ;
if ( xmlXPathIsNaN ( cur ) ) {
xmlXPathEmptyNodeSet ( ret ) ;
return ( ret ) ;
}
if ( cur > min ) continue ;
if ( cur < min ) {
min = cur ;
xmlXPathEmptyNodeSet ( ret ) ;
xmlXPathNodeSetAddUnique ( ret , ns -> nodeTab [ i ] ) ;
continue ;
}
xmlXPathNodeSetAddUnique ( ret , ns -> nodeTab [ i ] ) ;
}
return ( ret ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void link_file ( CopyMoveJob * job , GFile * src , GFile * dest_dir , char * * dest_fs_type , GHashTable * debuting_files , GdkPoint * position , int files_left ) {
GFile * src_dir , * dest , * new_dest ;
g_autofree gchar * dest_uri = NULL ;
int count ;
char * path ;
gboolean not_local ;
GError * error ;
CommonJob * common ;
char * primary , * secondary , * details ;
int response ;
gboolean handled_invalid_filename ;
common = ( CommonJob * ) job ;
count = 0 ;
src_dir = g_file_get_parent ( src ) ;
if ( g_file_equal ( src_dir , dest_dir ) ) {
count = 1 ;
}
g_object_unref ( src_dir ) ;
handled_invalid_filename = * dest_fs_type != NULL ;
dest = get_target_file_for_link ( src , dest_dir , * dest_fs_type , count ) ;
retry : error = NULL ;
not_local = FALSE ;
path = get_abs_path_for_symlink ( src , dest ) ;
if ( path == NULL ) {
not_local = TRUE ;
}
else if ( g_file_make_symbolic_link ( dest , path , common -> cancellable , & error ) ) {
if ( common -> undo_info != NULL ) {
nautilus_file_undo_info_ext_add_origin_target_pair ( NAUTILUS_FILE_UNDO_INFO_EXT ( common -> undo_info ) , src , dest ) ;
}
g_free ( path ) ;
if ( debuting_files ) {
g_hash_table_replace ( debuting_files , g_object_ref ( dest ) , GINT_TO_POINTER ( TRUE ) ) ;
}
nautilus_file_changes_queue_file_added ( dest ) ;
dest_uri = g_file_get_uri ( dest ) ;
if ( position ) {
nautilus_file_changes_queue_schedule_position_set ( dest , * position , common -> screen_num ) ;
}
else if ( eel_uri_is_desktop ( dest_uri ) ) {
nautilus_file_changes_queue_schedule_position_remove ( dest ) ;
}
g_object_unref ( dest ) ;
return ;
}
g_free ( path ) ;
if ( error != NULL && IS_IO_ERROR ( error , INVALID_FILENAME ) && ! handled_invalid_filename ) {
handled_invalid_filename = TRUE ;
g_assert ( * dest_fs_type == NULL ) ;
* dest_fs_type = query_fs_type ( dest_dir , common -> cancellable ) ;
new_dest = get_target_file_for_link ( src , dest_dir , * dest_fs_type , count ) ;
if ( ! g_file_equal ( dest , new_dest ) ) {
g_object_unref ( dest ) ;
dest = new_dest ;
g_error_free ( error ) ;
goto retry ;
}
else {
g_object_unref ( new_dest ) ;
}
}
if ( error != NULL && IS_IO_ERROR ( error , EXISTS ) ) {
g_object_unref ( dest ) ;
dest = get_target_file_for_link ( src , dest_dir , * dest_fs_type , count ++ ) ;
g_error_free ( error ) ;
goto retry ;
}
else if ( error != NULL && IS_IO_ERROR ( error , CANCELLED ) ) {
g_error_free ( error ) ;
}
else if ( error != NULL ) {
if ( common -> skip_all_error ) {
goto out ;
}
primary = f ( _ ( "Error while creating link to %B." ) , src ) ;
if ( not_local ) {
secondary = f ( _ ( "Symbolic links only supported for local files" ) ) ;
details = NULL ;
}
else if ( IS_IO_ERROR ( error , NOT_SUPPORTED ) ) {
secondary = f ( _ ( "The target doesn’t support symbolic links." ) ) ;
details = NULL ;
}
else {
secondary = f ( _ ( "There was an error creating the symlink in %F." ) , dest_dir ) ;
details = error -> message ;
}
response = run_warning ( common , primary , secondary , details , files_left > 1 , CANCEL , SKIP_ALL , SKIP , NULL ) ;
if ( error ) {
g_error_free ( error ) ;
}
if ( response == 0 || response == GTK_RESPONSE_DELETE_EVENT ) {
abort_job ( common ) ;
}
else if ( response == 1 ) {
common -> skip_all_error = TRUE ;
}
else if ( response == 2 ) {
}
else {
g_assert_not_reached ( ) ;
}
}
out : g_object_unref ( dest ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static PyObject * _cbson_bson_to_dict ( PyObject * self , PyObject * args ) {
unsigned int size ;
Py_ssize_t total_size ;
const char * string ;
PyObject * bson ;
PyObject * as_class ;
unsigned char tz_aware ;
unsigned char uuid_subtype ;
PyObject * dict ;
PyObject * remainder ;
PyObject * result ;
if ( ! PyArg_ParseTuple ( args , "OObb" , & bson , & as_class , & tz_aware , & uuid_subtype ) ) {
return NULL ;
}
# if PY_MAJOR_VERSION >= 3 if ( ! PyBytes_Check ( bson ) ) {
PyErr_SetString ( PyExc_TypeError , "argument to _bson_to_dict must be a bytes object" ) ;
# else if ( ! PyString_Check ( bson ) ) {
PyErr_SetString ( PyExc_TypeError , "argument to _bson_to_dict must be a string" ) ;
# endif return NULL ;
}
# if PY_MAJOR_VERSION >= 3 total_size = PyBytes_Size ( bson ) ;
# else total_size = PyString_Size ( bson ) ;
# endif if ( total_size < 5 ) {
PyObject * InvalidBSON = _error ( "InvalidBSON" ) ;
PyErr_SetString ( InvalidBSON , "not enough data for a BSON document" ) ;
Py_DECREF ( InvalidBSON ) ;
return NULL ;
}
# if PY_MAJOR_VERSION >= 3 string = PyBytes_AsString ( bson ) ;
# else string = PyString_AsString ( bson ) ;
# endif if ( ! string ) {
return NULL ;
}
memcpy ( & size , string , 4 ) ;
if ( total_size < size ) {
PyObject * InvalidBSON = _error ( "InvalidBSON" ) ;
PyErr_SetString ( InvalidBSON , "objsize too large" ) ;
Py_DECREF ( InvalidBSON ) ;
return NULL ;
}
if ( size != total_size || string [ size - 1 ] ) {
PyObject * InvalidBSON = _error ( "InvalidBSON" ) ;
PyErr_SetString ( InvalidBSON , "bad eoo" ) ;
Py_DECREF ( InvalidBSON ) ;
return NULL ;
}
dict = elements_to_dict ( self , string + 4 , size - 5 , as_class , tz_aware , uuid_subtype ) ;
if ( ! dict ) {
return NULL ;
}
# if PY_MAJOR_VERSION >= 3 remainder = PyBytes_FromStringAndSize ( string + size , total_size - size ) ;
# else remainder = PyString_FromStringAndSize ( string + size , total_size - size ) ;
# endif if ( ! remainder ) {
Py_DECREF ( dict ) ;
return NULL ;
}
result = Py_BuildValue ( "OO" , dict , remainder ) ;
Py_DECREF ( dict ) ;
Py_DECREF ( remainder ) ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_netbios ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
proto_tree * netb_tree = NULL ;
proto_item * ti ;
guint16 hdr_len , command ;
const char * command_name ;
char name [ ( NETBIOS_NAME_LEN - 1 ) * 4 + 1 ] ;
int name_type ;
guint16 session_id ;
gboolean save_fragmented ;
int len ;
fragment_head * fd_head ;
tvbuff_t * next_tvb ;
int offset = 0 ;
col_set_str ( pinfo -> cinfo , COL_PROTOCOL , "NetBIOS" ) ;
if ( 0xefff != tvb_get_letohs ( tvb , 2 ) ) {
++ offset ;
if ( 0xefff != tvb_get_letohs ( tvb , 3 ) ) {
col_set_str ( pinfo -> cinfo , COL_INFO , "Bad packet, no 0xEFFF marker" ) ;
return 3 ;
}
}
hdr_len = tvb_get_letohs ( tvb , offset + NB_LENGTH ) ;
command = tvb_get_guint8 ( tvb , offset + NB_COMMAND ) ;
command = MIN ( command , sizeof ( dissect_netb ) / sizeof ( void * ) ) ;
command_name = val_to_str_ext ( command , & cmd_vals_ext , "Unknown (0x%02x)" ) ;
switch ( command ) {
case NB_NAME_QUERY : name_type = get_netbios_name ( tvb , offset + 12 , name , ( NETBIOS_NAME_LEN - 1 ) * 4 + 1 ) ;
col_add_fstr ( pinfo -> cinfo , COL_INFO , "%s for %s<%02x>" , command_name , name , name_type ) ;
break ;
case NB_NAME_RESP : case NB_ADD_NAME : case NB_ADD_GROUP : name_type = get_netbios_name ( tvb , offset + 28 , name , ( NETBIOS_NAME_LEN - 1 ) * 4 + 1 ) ;
col_add_fstr ( pinfo -> cinfo , COL_INFO , "%s - %s<%02x>" , command_name , name , name_type ) ;
break ;
default : col_add_str ( pinfo -> cinfo , COL_INFO , command_name ) ;
break ;
}
if ( tree ) {
ti = proto_tree_add_item ( tree , proto_netbios , tvb , 0 , hdr_len , ENC_NA ) ;
netb_tree = proto_item_add_subtree ( ti , ett_netb ) ;
proto_tree_add_uint_format_value ( netb_tree , hf_netb_hdr_len , tvb , offset , 2 , hdr_len , "%d bytes" , hdr_len ) ;
proto_tree_add_uint_format_value ( netb_tree , hf_netb_delimiter , tvb , offset + 2 , 2 , tvb_get_letohs ( tvb , offset + 2 ) , "EFFF (NetBIOS)" ) ;
proto_tree_add_uint ( netb_tree , hf_netb_cmd , tvb , offset + NB_COMMAND , 1 , command ) ;
}
if ( command < sizeof ( dissect_netb ) / sizeof ( void * ) ) {
session_id = ( dissect_netb [ command ] ) ( tvb , pinfo , offset , netb_tree ) ;
offset += hdr_len ;
save_fragmented = pinfo -> fragmented ;
switch ( command ) {
case NB_DATAGRAM : case NB_DATAGRAM_BCAST : next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
dissect_netbios_payload ( next_tvb , pinfo , tree ) ;
break ;
case NB_DATA_FIRST_MIDDLE : case NB_DATA_ONLY_LAST : len = tvb_reported_length_remaining ( tvb , offset ) ;
if ( netbios_defragment && tvb_bytes_exist ( tvb , offset , len ) ) {
fd_head = fragment_add_seq_next ( & netbios_reassembly_table , tvb , offset , pinfo , session_id , NULL , len , command == NB_DATA_FIRST_MIDDLE ) ;
if ( fd_head != NULL ) {
if ( fd_head -> next != NULL ) {
next_tvb = tvb_new_chain ( tvb , fd_head -> tvb_data ) ;
add_new_data_source ( pinfo , next_tvb , "Reassembled NetBIOS" ) ;
if ( tree ) {
proto_item * frag_tree_item ;
show_fragment_seq_tree ( fd_head , & netbios_frag_items , netb_tree , pinfo , next_tvb , & frag_tree_item ) ;
}
}
else {
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
}
}
else {
next_tvb = NULL ;
}
}
else {
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
}
if ( next_tvb != NULL ) dissect_netbios_payload ( next_tvb , pinfo , tree ) ;
else {
next_tvb = tvb_new_subset_remaining ( tvb , offset ) ;
call_data_dissector ( next_tvb , pinfo , tree ) ;
}
break ;
}
pinfo -> fragmented = save_fragmented ;
}
return tvb_captured_length ( tvb ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void PPC_prep_io_writew ( void * opaque , hwaddr addr , uint32_t value ) {
sysctrl_t * sysctrl = opaque ;
addr = prep_IO_address ( sysctrl , addr ) ;
PPC_IO_DPRINTF ( "0x" TARGET_FMT_plx " => 0x%08" PRIx32 "\n" , addr , value ) ;
cpu_outw ( addr , value ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean dissect_applemidi_heur ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) {
guint16 command ;
conversation_t * p_conv ;
rtp_dyn_payload_t * rtp_dyn_payload = NULL ;
if ( tvb_length ( tvb ) < 4 ) return FALSE ;
if ( ! test_applemidi ( tvb , & command , FALSE ) ) {
return FALSE ;
}
rtp_dyn_payload = rtp_dyn_payload_new ( ) ;
rtp_dyn_payload_insert ( rtp_dyn_payload , 97 , "rtp-midi" , 10000 ) ;
rtp_add_address ( pinfo , & pinfo -> src , pinfo -> srcport , 0 , APPLEMIDI_DISSECTOR_SHORTNAME , pinfo -> fd -> num , FALSE , rtp_dyn_payload ) ;
p_conv = find_or_create_conversation ( pinfo ) ;
conversation_set_dissector ( p_conv , applemidi_handle ) ;
dissect_applemidi_common ( tvb , pinfo , tree , command ) ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void encode_tiles ( VP9_COMP * cpi ) {
const VP9_COMMON * const cm = & cpi -> common ;
const int tile_cols = 1 << cm -> log2_tile_cols ;
const int tile_rows = 1 << cm -> log2_tile_rows ;
int tile_col , tile_row ;
TOKENEXTRA * tok = cpi -> tok ;
for ( tile_row = 0 ;
tile_row < tile_rows ;
++ tile_row ) {
for ( tile_col = 0 ;
tile_col < tile_cols ;
++ tile_col ) {
TileInfo tile ;
TOKENEXTRA * old_tok = tok ;
int mi_row ;
vp9_tile_init ( & tile , cm , tile_row , tile_col ) ;
for ( mi_row = tile . mi_row_start ;
mi_row < tile . mi_row_end ;
mi_row += MI_BLOCK_SIZE ) {
if ( cpi -> sf . use_nonrd_pick_mode && ! frame_is_intra_only ( cm ) ) encode_nonrd_sb_row ( cpi , & tile , mi_row , & tok ) ;
else encode_rd_sb_row ( cpi , & tile , mi_row , & tok ) ;
}
cpi -> tok_count [ tile_row ] [ tile_col ] = ( unsigned int ) ( tok - old_tok ) ;
assert ( tok - cpi -> tok <= get_token_alloc ( cm -> mb_rows , cm -> mb_cols ) ) ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void h245_init ( void ) {
if ( h245_pending_olc_reqs ) g_hash_table_destroy ( h245_pending_olc_reqs ) ;
h245_pending_olc_reqs = g_hash_table_new ( g_str_hash , g_str_equal ) ;
h223_lc_init ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint16_t * build_linear_table ( int length ) {
int i ;
uint16_t * output = malloc ( sizeof ( uint16_t ) * length ) ;
if ( ! output ) return NULL ;
for ( i = 0 ;
i < length ;
i ++ ) {
double x = ( ( double ) i * 65535. ) / ( double ) ( length - 1 ) ;
uint16_fract_t input = floor ( x + .5 ) ;
output [ i ] = input ;
}
return output ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ExtensionMessageBubbleViewBrowserTest , InvokeDialog_devmode_warning ) {
RunDialog ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
rfbBool rfbSendCopyRegion ( rfbClientPtr cl , sraRegionPtr reg , int dx , int dy ) {
int x , y , w , h ;
rfbFramebufferUpdateRectHeader rect ;
rfbCopyRect cr ;
sraRectangleIterator * i ;
sraRect rect1 ;
i = sraRgnGetReverseIterator ( reg , dx > 0 , dy > 0 ) ;
dx = ScaleX ( cl -> screen , cl -> scaledScreen , dx ) ;
dy = ScaleX ( cl -> screen , cl -> scaledScreen , dy ) ;
while ( sraRgnIteratorNext ( i , & rect1 ) ) {
x = rect1 . x1 ;
y = rect1 . y1 ;
w = rect1 . x2 - x ;
h = rect1 . y2 - y ;
rfbScaledCorrection ( cl -> screen , cl -> scaledScreen , & x , & y , & w , & h , "copyrect" ) ;
rect . r . x = Swap16IfLE ( x ) ;
rect . r . y = Swap16IfLE ( y ) ;
rect . r . w = Swap16IfLE ( w ) ;
rect . r . h = Swap16IfLE ( h ) ;
rect . encoding = Swap32IfLE ( rfbEncodingCopyRect ) ;
memcpy ( & cl -> updateBuf [ cl -> ublen ] , ( char * ) & rect , sz_rfbFramebufferUpdateRectHeader ) ;
cl -> ublen += sz_rfbFramebufferUpdateRectHeader ;
cr . srcX = Swap16IfLE ( x - dx ) ;
cr . srcY = Swap16IfLE ( y - dy ) ;
memcpy ( & cl -> updateBuf [ cl -> ublen ] , ( char * ) & cr , sz_rfbCopyRect ) ;
cl -> ublen += sz_rfbCopyRect ;
rfbStatRecordEncodingSent ( cl , rfbEncodingCopyRect , sz_rfbFramebufferUpdateRectHeader + sz_rfbCopyRect , w * h * ( cl -> scaledScreen -> bitsPerPixel / 8 ) ) ;
}
sraRgnReleaseIterator ( i ) ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cluster_all_databases ( bool verbose , const char * maintenance_db , const char * host , const char * port , const char * username , enum trivalue prompt_password , const char * progname , bool echo , bool quiet ) {
PGconn * conn ;
PGresult * result ;
int i ;
conn = connectMaintenanceDatabase ( maintenance_db , host , port , username , prompt_password , progname ) ;
result = executeQuery ( conn , "SELECT datname FROM pg_database WHERE datallowconn ORDER BY 1;
" , progname , echo ) ;
PQfinish ( conn ) ;
for ( i = 0 ;
i < PQntuples ( result ) ;
i ++ ) {
char * dbname = PQgetvalue ( result , i , 0 ) ;
if ( ! quiet ) {
printf ( _ ( "%s: clustering database \"%s\"\n" ) , progname , dbname ) ;
fflush ( stdout ) ;
}
cluster_one_database ( dbname , verbose , NULL , host , port , username , prompt_password , progname , echo ) ;
}
PQclear ( result ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
my_bool acl_reload ( THD * thd ) {
TABLE_LIST tables [ 3 ] ;
DYNAMIC_ARRAY old_acl_hosts , old_acl_users , old_acl_dbs ;
MEM_ROOT old_mem ;
bool old_initialized ;
my_bool return_val = TRUE ;
DBUG_ENTER ( "acl_reload" ) ;
if ( thd -> locked_tables ) {
thd -> lock = thd -> locked_tables ;
thd -> locked_tables = 0 ;
close_thread_tables ( thd ) ;
}
bzero ( ( char * ) tables , sizeof ( tables ) ) ;
tables [ 0 ] . alias = tables [ 0 ] . table_name = ( char * ) "host" ;
tables [ 1 ] . alias = tables [ 1 ] . table_name = ( char * ) "user" ;
tables [ 2 ] . alias = tables [ 2 ] . table_name = ( char * ) "db" ;
tables [ 0 ] . db = tables [ 1 ] . db = tables [ 2 ] . db = ( char * ) "mysql" ;
tables [ 0 ] . next_local = tables [ 0 ] . next_global = tables + 1 ;
tables [ 1 ] . next_local = tables [ 1 ] . next_global = tables + 2 ;
tables [ 0 ] . lock_type = tables [ 1 ] . lock_type = tables [ 2 ] . lock_type = TL_READ ;
tables [ 0 ] . skip_temporary = tables [ 1 ] . skip_temporary = tables [ 2 ] . skip_temporary = TRUE ;
if ( simple_open_n_lock_tables ( thd , tables ) ) {
if ( thd -> main_da . is_error ( ) ) sql_print_error ( "Fatal error: Can't open and lock privilege tables: %s" , thd -> main_da . message ( ) ) ;
goto end ;
}
if ( ( old_initialized = initialized ) ) VOID ( pthread_mutex_lock ( & acl_cache -> lock ) ) ;
old_acl_hosts = acl_hosts ;
old_acl_users = acl_users ;
old_acl_dbs = acl_dbs ;
old_mem = mem ;
delete_dynamic ( & acl_wild_hosts ) ;
hash_free ( & acl_check_hosts ) ;
if ( ( return_val = acl_load ( thd , tables ) ) ) {
DBUG_PRINT ( "error" , ( "Reverting to old privileges" ) ) ;
acl_free ( ) ;
acl_hosts = old_acl_hosts ;
acl_users = old_acl_users ;
acl_dbs = old_acl_dbs ;
mem = old_mem ;
init_check_host ( ) ;
}
else {
free_root ( & old_mem , MYF ( 0 ) ) ;
delete_dynamic ( & old_acl_hosts ) ;
delete_dynamic ( & old_acl_users ) ;
delete_dynamic ( & old_acl_dbs ) ;
}
if ( old_initialized ) VOID ( pthread_mutex_unlock ( & acl_cache -> lock ) ) ;
end : close_thread_tables ( thd ) ;
DBUG_RETURN ( return_val ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
METHOD ( certificate_t , get_issuer , identification_t * , private_x509_cert_t * this ) {
return this -> issuer ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void pdf_drop_cmap_imp ( fz_context * ctx , fz_storable * cmap_ ) {
pdf_cmap * cmap = ( pdf_cmap * ) cmap_ ;
pdf_drop_cmap ( ctx , cmap -> usecmap ) ;
fz_free ( ctx , cmap -> ranges ) ;
fz_free ( ctx , cmap -> xranges ) ;
fz_free ( ctx , cmap -> mranges ) ;
fz_free ( ctx , cmap -> dict ) ;
fz_free ( ctx , cmap -> tree ) ;
fz_free ( ctx , cmap ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gs_memory_t * i_stable ( gs_memory_t * mem ) {
return mem -> stable_memory ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void malta_fpga_write ( void * opaque , hwaddr addr , uint64_t val , unsigned size ) {
MaltaFPGAState * s = opaque ;
uint32_t saddr ;
saddr = ( addr & 0xfffff ) ;
switch ( saddr ) {
case 0x00200 : break ;
case 0x00210 : break ;
case 0x00408 : s -> leds = val & 0xff ;
malta_fpga_update_display ( s ) ;
break ;
case 0x00410 : snprintf ( s -> display_text , 9 , "%08X" , ( uint32_t ) val ) ;
malta_fpga_update_display ( s ) ;
break ;
case 0x00418 : case 0x00420 : case 0x00428 : case 0x00430 : case 0x00438 : case 0x00440 : case 0x00448 : case 0x00450 : s -> display_text [ ( saddr - 0x00418 ) >> 3 ] = ( char ) val ;
malta_fpga_update_display ( s ) ;
break ;
case 0x00500 : if ( val == 0x42 ) qemu_system_reset_request ( ) ;
break ;
case 0x00508 : s -> brk = val & 0xff ;
break ;
case 0x00a00 : s -> gpout = val & 0xff ;
break ;
case 0x00b08 : s -> i2coe = val & 0x03 ;
break ;
case 0x00b10 : eeprom24c0x_write ( val & 0x02 , val & 0x01 ) ;
s -> i2cout = val ;
break ;
case 0x00b18 : s -> i2csel = val & 0x01 ;
break ;
default : # if 0 printf ( "malta_fpga_write: Bad register offset 0x" TARGET_FMT_lx "\n" , addr ) ;
# endif break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void log_syslog ( struct passwd const * pw , bool successful ) {
const char * new_user , * old_user , * tty ;
new_user = pw -> pw_name ;
old_user = getlogin ( ) ;
if ( ! old_user ) {
struct passwd * pwd = current_getpwuid ( ) ;
old_user = pwd ? pwd -> pw_name : "" ;
}
if ( get_terminal_name ( NULL , & tty , NULL ) != 0 || ! tty ) tty = "none" ;
openlog ( program_invocation_short_name , 0 , LOG_AUTH ) ;
syslog ( LOG_NOTICE , "%s(to %s) %s on %s" , successful ? "" : su_mode == RUNUSER_MODE ? "FAILED RUNUSER " : "FAILED SU " , new_user , old_user , tty ) ;
closelog ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int write_string ( buffer_t buffer , PyObject * py_string ) {
Py_ssize_t string_length ;
const char * string ;
# if PY_MAJOR_VERSION >= 3 if ( PyUnicode_Check ( py_string ) ) {
return write_unicode ( buffer , py_string ) ;
}
string = PyBytes_AsString ( py_string ) ;
# else string = PyString_AsString ( py_string ) ;
# endif if ( ! string ) {
return 0 ;
}
# if PY_MAJOR_VERSION >= 3 string_length = PyBytes_Size ( py_string ) + 1 ;
# else string_length = PyString_Size ( py_string ) + 1 ;
# endif if ( ! buffer_write_bytes ( buffer , ( const char * ) & string_length , 4 ) ) {
return 0 ;
}
if ( ! buffer_write_bytes ( buffer , string , string_length ) ) {
return 0 ;
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
err_status_t srtp_unprotect ( srtp_ctx_t * ctx , void * srtp_hdr , int * pkt_octet_len ) {
srtp_hdr_t * hdr = ( srtp_hdr_t * ) srtp_hdr ;
uint32_t * enc_start ;
uint32_t * auth_start ;
unsigned int enc_octet_len = 0 ;
uint8_t * auth_tag = NULL ;
xtd_seq_num_t est ;
int delta ;
v128_t iv ;
err_status_t status ;
srtp_stream_ctx_t * stream ;
uint8_t tmp_tag [ SRTP_MAX_TAG_LEN ] ;
int tag_len , prefix_len ;
debug_print ( mod_srtp , "function srtp_unprotect" , NULL ) ;
status = srtp_validate_rtp_header ( srtp_hdr , pkt_octet_len ) ;
if ( status ) return status ;
if ( * pkt_octet_len < octets_in_rtp_header ) return err_status_bad_param ;
stream = srtp_get_stream ( ctx , hdr -> ssrc ) ;
if ( stream == NULL ) {
if ( ctx -> stream_template != NULL ) {
stream = ctx -> stream_template ;
debug_print ( mod_srtp , "using provisional stream (SSRC: 0x%08x)" , hdr -> ssrc ) ;
# ifdef NO_64BIT_MATH est = ( xtd_seq_num_t ) make64 ( 0 , ntohs ( hdr -> seq ) ) ;
delta = low32 ( est ) ;
# else est = ( xtd_seq_num_t ) ntohs ( hdr -> seq ) ;
delta = ( int ) est ;
# endif }
else {
return err_status_no_ctx ;
}
}
else {
delta = rdbx_estimate_index ( & stream -> rtp_rdbx , & est , ntohs ( hdr -> seq ) ) ;
status = rdbx_check ( & stream -> rtp_rdbx , delta ) ;
if ( status ) return status ;
}
# ifdef NO_64BIT_MATH debug_print2 ( mod_srtp , "estimated u_packet index: %08x%08x" , high32 ( est ) , low32 ( est ) ) ;
# else debug_print ( mod_srtp , "estimated u_packet index: %016llx" , est ) ;
# endif if ( stream -> rtp_cipher -> algorithm == AES_128_GCM || stream -> rtp_cipher -> algorithm == AES_256_GCM ) {
return srtp_unprotect_aead ( ctx , stream , delta , est , srtp_hdr , ( unsigned int * ) pkt_octet_len ) ;
}
tag_len = auth_get_tag_length ( stream -> rtp_auth ) ;
if ( stream -> rtp_cipher -> type -> id == AES_ICM || stream -> rtp_cipher -> type -> id == AES_256_ICM ) {
iv . v32 [ 0 ] = 0 ;
iv . v32 [ 1 ] = hdr -> ssrc ;
# ifdef NO_64BIT_MATH iv . v64 [ 1 ] = be64_to_cpu ( make64 ( ( high32 ( est ) << 16 ) | ( low32 ( est ) >> 16 ) , low32 ( est ) << 16 ) ) ;
# else iv . v64 [ 1 ] = be64_to_cpu ( est << 16 ) ;
# endif status = cipher_set_iv ( stream -> rtp_cipher , & iv , direction_decrypt ) ;
}
else {
# ifdef NO_64BIT_MATH iv . v32 [ 0 ] = 0 ;
iv . v32 [ 1 ] = 0 ;
# else iv . v64 [ 0 ] = 0 ;
# endif iv . v64 [ 1 ] = be64_to_cpu ( est ) ;
status = cipher_set_iv ( stream -> rtp_cipher , & iv , direction_decrypt ) ;
}
if ( status ) return err_status_cipher_fail ;
# ifdef NO_64BIT_MATH est = be64_to_cpu ( make64 ( ( high32 ( est ) << 16 ) | ( low32 ( est ) >> 16 ) , low32 ( est ) << 16 ) ) ;
# else est = be64_to_cpu ( est << 16 ) ;
# endif if ( stream -> rtp_services & sec_serv_conf ) {
enc_start = ( uint32_t * ) hdr + uint32s_in_rtp_header + hdr -> cc ;
if ( hdr -> x == 1 ) {
srtp_hdr_xtnd_t * xtn_hdr = ( srtp_hdr_xtnd_t * ) enc_start ;
enc_start += ( ntohs ( xtn_hdr -> length ) + 1 ) ;
}
if ( ! ( ( uint8_t * ) enc_start < ( uint8_t * ) hdr + * pkt_octet_len ) ) return err_status_parse_err ;
enc_octet_len = ( uint32_t ) ( * pkt_octet_len - tag_len - ( ( uint8_t * ) enc_start - ( uint8_t * ) hdr ) ) ;
}
else {
enc_start = NULL ;
}
if ( stream -> rtp_services & sec_serv_auth ) {
auth_start = ( uint32_t * ) hdr ;
auth_tag = ( uint8_t * ) hdr + * pkt_octet_len - tag_len ;
}
else {
auth_start = NULL ;
auth_tag = NULL ;
}
if ( auth_start ) {
if ( stream -> rtp_auth -> prefix_len != 0 ) {
prefix_len = auth_get_prefix_length ( stream -> rtp_auth ) ;
status = cipher_output ( stream -> rtp_cipher , tmp_tag , prefix_len ) ;
debug_print ( mod_srtp , "keystream prefix: %s" , octet_string_hex_string ( tmp_tag , prefix_len ) ) ;
if ( status ) return err_status_cipher_fail ;
}
status = auth_start ( stream -> rtp_auth ) ;
if ( status ) return status ;
status = auth_update ( stream -> rtp_auth , ( uint8_t * ) auth_start , * pkt_octet_len - tag_len ) ;
status = auth_compute ( stream -> rtp_auth , ( uint8_t * ) & est , 4 , tmp_tag ) ;
debug_print ( mod_srtp , "computed auth tag: %s" , octet_string_hex_string ( tmp_tag , tag_len ) ) ;
debug_print ( mod_srtp , "packet auth tag: %s" , octet_string_hex_string ( auth_tag , tag_len ) ) ;
if ( status ) return err_status_auth_fail ;
if ( octet_string_is_eq ( tmp_tag , auth_tag , tag_len ) ) return err_status_auth_fail ;
}
switch ( key_limit_update ( stream -> limit ) ) {
case key_event_normal : break ;
case key_event_soft_limit : srtp_handle_event ( ctx , stream , event_key_soft_limit ) ;
break ;
case key_event_hard_limit : srtp_handle_event ( ctx , stream , event_key_hard_limit ) ;
return err_status_key_expired ;
default : break ;
}
if ( enc_start ) {
status = cipher_decrypt ( stream -> rtp_cipher , ( uint8_t * ) enc_start , & enc_octet_len ) ;
if ( status ) return err_status_cipher_fail ;
}
if ( stream -> direction != dir_srtp_receiver ) {
if ( stream -> direction == dir_unknown ) {
stream -> direction = dir_srtp_receiver ;
}
else {
srtp_handle_event ( ctx , stream , event_ssrc_collision ) ;
}
}
if ( stream == ctx -> stream_template ) {
srtp_stream_ctx_t * new_stream ;
status = srtp_stream_clone ( ctx -> stream_template , hdr -> ssrc , & new_stream ) ;
if ( status ) return status ;
new_stream -> next = ctx -> stream_list ;
ctx -> stream_list = new_stream ;
stream = new_stream ;
}
rdbx_add_index ( & stream -> rtp_rdbx , delta ) ;
* pkt_octet_len -= tag_len ;
return err_status_ok ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void directory_load_state_free ( DirectoryLoadState * state ) {
if ( state -> enumerator ) {
if ( ! g_file_enumerator_is_closed ( state -> enumerator ) ) {
g_file_enumerator_close_async ( state -> enumerator , 0 , NULL , NULL , NULL ) ;
}
g_object_unref ( state -> enumerator ) ;
}
if ( state -> load_mime_list_hash != NULL ) {
istr_set_destroy ( state -> load_mime_list_hash ) ;
}
nautilus_file_unref ( state -> load_directory_file ) ;
g_object_unref ( state -> cancellable ) ;
g_free ( state ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void MatMultiply ( real m1 [ 6 ] , real m2 [ 6 ] , real to [ 6 ] ) {
real trans [ 6 ] ;
trans [ 0 ] = m1 [ 0 ] * m2 [ 0 ] + m1 [ 1 ] * m2 [ 2 ] ;
trans [ 1 ] = m1 [ 0 ] * m2 [ 1 ] + m1 [ 1 ] * m2 [ 3 ] ;
trans [ 2 ] = m1 [ 2 ] * m2 [ 0 ] + m1 [ 3 ] * m2 [ 2 ] ;
trans [ 3 ] = m1 [ 2 ] * m2 [ 1 ] + m1 [ 3 ] * m2 [ 3 ] ;
trans [ 4 ] = m1 [ 4 ] * m2 [ 0 ] + m1 [ 5 ] * m2 [ 2 ] + m2 [ 4 ] ;
trans [ 5 ] = m1 [ 4 ] * m2 [ 1 ] + m1 [ 5 ] * m2 [ 3 ] + m2 [ 5 ] ;
memcpy ( to , trans , sizeof ( trans ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void qtmd_update_model ( struct qtmd_model * model ) {
struct qtmd_modelsym tmp ;
int i , j ;
if ( -- model -> shiftsleft ) {
for ( i = model -> entries - 1 ;
i >= 0 ;
i -- ) {
model -> syms [ i ] . cumfreq >>= 1 ;
if ( model -> syms [ i ] . cumfreq <= model -> syms [ i + 1 ] . cumfreq ) {
model -> syms [ i ] . cumfreq = model -> syms [ i + 1 ] . cumfreq + 1 ;
}
}
}
else {
model -> shiftsleft = 50 ;
for ( i = 0 ;
i < model -> entries ;
i ++ ) {
model -> syms [ i ] . cumfreq -= model -> syms [ i + 1 ] . cumfreq ;
model -> syms [ i ] . cumfreq ++ ;
model -> syms [ i ] . cumfreq >>= 1 ;
}
for ( i = 0 ;
i < model -> entries - 1 ;
i ++ ) {
for ( j = i + 1 ;
j < model -> entries ;
j ++ ) {
if ( model -> syms [ i ] . cumfreq < model -> syms [ j ] . cumfreq ) {
tmp = model -> syms [ i ] ;
model -> syms [ i ] = model -> syms [ j ] ;
model -> syms [ j ] = tmp ;
}
}
}
for ( i = model -> entries - 1 ;
i >= 0 ;
i -- ) {
model -> syms [ i ] . cumfreq += model -> syms [ i + 1 ] . cumfreq ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static bool contain_context_dependent_node_walker ( Node * node , int * flags ) {
if ( node == NULL ) return false ;
if ( IsA ( node , CaseTestExpr ) ) return ! ( * flags & CCDN_IN_CASEEXPR ) ;
if ( IsA ( node , CaseExpr ) ) {
CaseExpr * caseexpr = ( CaseExpr * ) node ;
if ( caseexpr -> arg ) {
int save_flags = * flags ;
bool res ;
* flags |= CCDN_IN_CASEEXPR ;
res = expression_tree_walker ( node , contain_context_dependent_node_walker , ( void * ) flags ) ;
* flags = save_flags ;
return res ;
}
}
return expression_tree_walker ( node , contain_context_dependent_node_walker , ( void * ) flags ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static # else auto # endif inline void __attribute__ ( ( unused , always_inline ) ) elf_get_dynamic_info ( struct link_map * l , ElfW ( Dyn ) * temp ) {
ElfW ( Dyn ) * dyn = l -> l_ld ;
ElfW ( Dyn ) * * info ;
# ifndef RTLD_BOOTSTRAP if ( dyn == NULL ) return ;
# endif info = l -> l_info ;
while ( dyn -> d_tag != DT_NULL ) {
if ( ( Elf32_Word ) dyn -> d_tag < DT_NUM ) info [ dyn -> d_tag ] = dyn ;
else if ( dyn -> d_tag >= DT_LOPROC && dyn -> d_tag < DT_LOPROC + DT_THISPROCNUM ) info [ dyn -> d_tag - DT_LOPROC + DT_NUM ] = dyn ;
else if ( ( Elf32_Word ) DT_VERSIONTAGIDX ( dyn -> d_tag ) < DT_VERSIONTAGNUM ) info [ VERSYMIDX ( dyn -> d_tag ) ] = dyn ;
else if ( ( Elf32_Word ) DT_EXTRATAGIDX ( dyn -> d_tag ) < DT_EXTRANUM ) info [ DT_EXTRATAGIDX ( dyn -> d_tag ) + DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM ] = dyn ;
else if ( ( Elf32_Word ) DT_VALTAGIDX ( dyn -> d_tag ) < DT_VALNUM ) info [ DT_VALTAGIDX ( dyn -> d_tag ) + DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM ] = dyn ;
else if ( ( Elf32_Word ) DT_ADDRTAGIDX ( dyn -> d_tag ) < DT_ADDRNUM ) info [ DT_ADDRTAGIDX ( dyn -> d_tag ) + DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM ] = dyn ;
++ dyn ;
}
# define DL_RO_DYN_TEMP_CNT 8 # ifndef DL_RO_DYN_SECTION if ( l -> l_addr != 0 ) {
ElfW ( Addr ) l_addr = l -> l_addr ;
int cnt = 0 ;
# define ADJUST_DYN_INFO ( tag ) do if ( info [ tag ] != NULL ) {
if ( temp ) {
temp [ cnt ] . d_tag = info [ tag ] -> d_tag ;
temp [ cnt ] . d_un . d_ptr = info [ tag ] -> d_un . d_ptr + l_addr ;
info [ tag ] = temp + cnt ++ ;
}
else info [ tag ] -> d_un . d_ptr += l_addr ;
}
while ( 0 ) ADJUST_DYN_INFO ( DT_HASH ) ;
ADJUST_DYN_INFO ( DT_PLTGOT ) ;
ADJUST_DYN_INFO ( DT_STRTAB ) ;
ADJUST_DYN_INFO ( DT_SYMTAB ) ;
# if ! ELF_MACHINE_NO_RELA ADJUST_DYN_INFO ( DT_RELA ) ;
# endif # if ! ELF_MACHINE_NO_REL ADJUST_DYN_INFO ( DT_REL ) ;
# endif ADJUST_DYN_INFO ( DT_JMPREL ) ;
ADJUST_DYN_INFO ( VERSYMIDX ( DT_VERSYM ) ) ;
ADJUST_DYN_INFO ( DT_ADDRTAGIDX ( DT_GNU_HASH ) + DT_NUM + DT_THISPROCNUM + DT_VERSIONTAGNUM + DT_EXTRANUM + DT_VALNUM ) ;
# undef ADJUST_DYN_INFO assert ( cnt <= DL_RO_DYN_TEMP_CNT ) ;
}
# endif if ( info [ DT_PLTREL ] != NULL ) {
# if ELF_MACHINE_NO_RELA assert ( info [ DT_PLTREL ] -> d_un . d_val == DT_REL ) ;
# elif ELF_MACHINE_NO_REL assert ( info [ DT_PLTREL ] -> d_un . d_val == DT_RELA ) ;
# else assert ( info [ DT_PLTREL ] -> d_un . d_val == DT_REL || info [ DT_PLTREL ] -> d_un . d_val == DT_RELA ) ;
# endif }
# if ! ELF_MACHINE_NO_RELA if ( info [ DT_RELA ] != NULL ) assert ( info [ DT_RELAENT ] -> d_un . d_val == sizeof ( ElfW ( Rela ) ) ) ;
# endif # if ! ELF_MACHINE_NO_REL if ( info [ DT_REL ] != NULL ) assert ( info [ DT_RELENT ] -> d_un . d_val == sizeof ( ElfW ( Rel ) ) ) ;
# endif # ifdef RTLD_BOOTSTRAP assert ( info [ VERSYMIDX ( DT_FLAGS_1 ) ] == NULL || info [ VERSYMIDX ( DT_FLAGS_1 ) ] -> d_un . d_val == DF_1_NOW ) ;
assert ( info [ DT_FLAGS ] == NULL || info [ DT_FLAGS ] -> d_un . d_val == DF_BIND_NOW ) ;
assert ( info [ DT_RUNPATH ] == NULL ) ;
assert ( info [ DT_RPATH ] == NULL ) ;
# else if ( info [ DT_FLAGS ] != NULL ) {
l -> l_flags = info [ DT_FLAGS ] -> d_un . d_val ;
if ( l -> l_flags & DF_SYMBOLIC ) info [ DT_SYMBOLIC ] = info [ DT_FLAGS ] ;
if ( l -> l_flags & DF_TEXTREL ) info [ DT_TEXTREL ] = info [ DT_FLAGS ] ;
if ( l -> l_flags & DF_BIND_NOW ) info [ DT_BIND_NOW ] = info [ DT_FLAGS ] ;
}
if ( info [ VERSYMIDX ( DT_FLAGS_1 ) ] != NULL ) {
l -> l_flags_1 = info [ VERSYMIDX ( DT_FLAGS_1 ) ] -> d_un . d_val ;
if ( l -> l_flags_1 & DF_1_NOW ) info [ DT_BIND_NOW ] = info [ VERSYMIDX ( DT_FLAGS_1 ) ] ;
}
if ( info [ DT_RUNPATH ] != NULL ) info [ DT_RPATH ] = NULL ;
# endif }
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_T_extensionAddressResponse ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_T_extensionAddressResponse , T_extensionAddressResponse_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_CommunicationModeCommand ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_CommunicationModeCommand , CommunicationModeCommand_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void init_config ( VP8_COMP * cpi , VP8_CONFIG * oxcf ) {
VP8_COMMON * cm = & cpi -> common ;
cpi -> oxcf = * oxcf ;
cpi -> auto_gold = 1 ;
cpi -> auto_adjust_gold_quantizer = 1 ;
cm -> version = oxcf -> Version ;
vp8_setup_version ( cm ) ;
cpi -> framerate = ( double ) ( oxcf -> timebase . den ) / ( double ) ( oxcf -> timebase . num ) ;
if ( cpi -> framerate > 180 ) cpi -> framerate = 30 ;
cpi -> ref_framerate = cpi -> framerate ;
vp8_change_config ( cpi , oxcf ) ;
cpi -> active_worst_quality = cpi -> oxcf . worst_allowed_q ;
cpi -> active_best_quality = cpi -> oxcf . best_allowed_q ;
cpi -> avg_frame_qindex = cpi -> oxcf . worst_allowed_q ;
cpi -> buffer_level = cpi -> oxcf . starting_buffer_level ;
cpi -> bits_off_target = cpi -> oxcf . starting_buffer_level ;
cpi -> rolling_target_bits = cpi -> av_per_frame_bandwidth ;
cpi -> rolling_actual_bits = cpi -> av_per_frame_bandwidth ;
cpi -> long_rolling_target_bits = cpi -> av_per_frame_bandwidth ;
cpi -> long_rolling_actual_bits = cpi -> av_per_frame_bandwidth ;
cpi -> total_actual_bits = 0 ;
cpi -> total_target_vs_actual = 0 ;
if ( cpi -> oxcf . number_of_layers > 1 ) {
unsigned int i ;
double prev_layer_framerate = 0 ;
for ( i = 0 ;
i < cpi -> oxcf . number_of_layers ;
i ++ ) {
init_temporal_layer_context ( cpi , oxcf , i , prev_layer_framerate ) ;
prev_layer_framerate = cpi -> output_framerate / cpi -> oxcf . rate_decimator [ i ] ;
}
}
# if VP8_TEMPORAL_ALT_REF {
int i ;
cpi -> fixed_divide [ 0 ] = 0 ;
for ( i = 1 ;
i < 512 ;
i ++ ) cpi -> fixed_divide [ i ] = 0x80000 / i ;
}
# endif }
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int TSHttpTxnDebugGet ( TSHttpTxn txnp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
return ( ( HttpSM * ) txnp ) -> debug_on ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void destroy_string_fifo ( string_fifo * fifo ) {
string_node * sn ;
if ( fifo != NULL ) {
do {
UNLINK_FIFO ( sn , * fifo , link ) ;
if ( sn != NULL ) {
if ( sn -> s != NULL ) free ( sn -> s ) ;
free ( sn ) ;
}
}
while ( sn != NULL ) ;
free ( fifo ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_MiscellaneousIndication ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_MiscellaneousIndication , MiscellaneousIndication_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void upsample_5_4 ( float * out , const float * in , int o_size ) {
const float * in0 = in - UPS_FIR_SIZE + 1 ;
int i , j , k ;
int int_part = 0 , frac_part ;
i = 0 ;
for ( j = 0 ;
j < o_size / 5 ;
j ++ ) {
out [ i ] = in [ int_part ] ;
frac_part = 4 ;
i ++ ;
for ( k = 1 ;
k < 5 ;
k ++ ) {
out [ i ] = avpriv_scalarproduct_float_c ( in0 + int_part , upsample_fir [ 4 - frac_part ] , UPS_MEM_SIZE ) ;
int_part ++ ;
frac_part -- ;
i ++ ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void U_CALLCONV _HZOpen ( UConverter * cnv , UConverterLoadArgs * pArgs , UErrorCode * errorCode ) {
UConverter * gbConverter ;
if ( pArgs -> onlyTestIsLoadable ) {
ucnv_canCreateConverter ( "GBK" , errorCode ) ;
return ;
}
gbConverter = ucnv_open ( "GBK" , errorCode ) ;
if ( U_FAILURE ( * errorCode ) ) {
return ;
}
cnv -> toUnicodeStatus = 0 ;
cnv -> fromUnicodeStatus = 0 ;
cnv -> mode = 0 ;
cnv -> fromUChar32 = 0x0000 ;
cnv -> extraInfo = uprv_calloc ( 1 , sizeof ( UConverterDataHZ ) ) ;
if ( cnv -> extraInfo != NULL ) {
( ( UConverterDataHZ * ) cnv -> extraInfo ) -> gbConverter = gbConverter ;
}
else {
ucnv_close ( gbConverter ) ;
* errorCode = U_MEMORY_ALLOCATION_ERROR ;
return ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int linux_udev_stop_event_monitor ( void ) {
char dummy = 1 ;
int r ;
assert ( udev_ctx != NULL ) ;
assert ( udev_monitor != NULL ) ;
assert ( udev_monitor_fd != - 1 ) ;
r = usbi_write ( udev_control_pipe [ 1 ] , & dummy , sizeof ( dummy ) ) ;
if ( r <= 0 ) {
usbi_warn ( NULL , "udev control pipe signal failed" ) ;
}
pthread_join ( linux_event_thread , NULL ) ;
udev_monitor_unref ( udev_monitor ) ;
udev_monitor = NULL ;
udev_monitor_fd = - 1 ;
udev_unref ( udev_ctx ) ;
udev_ctx = NULL ;
close ( udev_control_pipe [ 0 ] ) ;
close ( udev_control_pipe [ 1 ] ) ;
udev_control_pipe [ 0 ] = - 1 ;
udev_control_pipe [ 1 ] = - 1 ;
return LIBUSB_SUCCESS ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE ossl_cipher_pkcs5_keyivgen ( int argc , VALUE * argv , VALUE self ) {
EVP_CIPHER_CTX * ctx ;
const EVP_MD * digest ;
VALUE vpass , vsalt , viter , vdigest ;
unsigned char key [ EVP_MAX_KEY_LENGTH ] , iv [ EVP_MAX_IV_LENGTH ] , * salt = NULL ;
int iter ;
rb_scan_args ( argc , argv , "13" , & vpass , & vsalt , & viter , & vdigest ) ;
StringValue ( vpass ) ;
if ( ! NIL_P ( vsalt ) ) {
StringValue ( vsalt ) ;
if ( RSTRING_LEN ( vsalt ) != PKCS5_SALT_LEN ) ossl_raise ( eCipherError , "salt must be an 8-octet string" ) ;
salt = ( unsigned char * ) RSTRING_PTR ( vsalt ) ;
}
iter = NIL_P ( viter ) ? 2048 : NUM2INT ( viter ) ;
digest = NIL_P ( vdigest ) ? EVP_md5 ( ) : GetDigestPtr ( vdigest ) ;
GetCipher ( self , ctx ) ;
EVP_BytesToKey ( EVP_CIPHER_CTX_cipher ( ctx ) , digest , salt , ( unsigned char * ) RSTRING_PTR ( vpass ) , RSTRING_LENINT ( vpass ) , iter , key , iv ) ;
if ( EVP_CipherInit_ex ( ctx , NULL , NULL , key , iv , - 1 ) != 1 ) ossl_raise ( eCipherError , NULL ) ;
OPENSSL_cleanse ( key , sizeof key ) ;
OPENSSL_cleanse ( iv , sizeof iv ) ;
return Qnil ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int cred_has_capability ( const struct cred * cred , int cap , int audit , bool initns ) {
struct common_audit_data ad ;
struct av_decision avd ;
u16 sclass ;
u32 sid = cred_sid ( cred ) ;
u32 av = CAP_TO_MASK ( cap ) ;
int rc ;
ad . type = LSM_AUDIT_DATA_CAP ;
ad . u . cap = cap ;
switch ( CAP_TO_INDEX ( cap ) ) {
case 0 : sclass = initns ? SECCLASS_CAPABILITY : SECCLASS_CAP_USERNS ;
break ;
case 1 : sclass = initns ? SECCLASS_CAPABILITY2 : SECCLASS_CAP2_USERNS ;
break ;
default : printk ( KERN_ERR "SELinux: out of range capability %d\n" , cap ) ;
BUG ( ) ;
return - EINVAL ;
}
rc = avc_has_perm_noaudit ( sid , sid , sclass , av , 0 , & avd ) ;
if ( audit == SECURITY_CAP_AUDIT ) {
int rc2 = avc_audit ( sid , sid , sclass , av , & avd , rc , & ad , 0 ) ;
if ( rc2 ) return rc2 ;
}
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline void lh_ ## type ## _free ( LHASH_OF ( type ) * lh ) {
OPENSSL_LH_free ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline type * lh_ ## type ## _insert ( LHASH_OF ( type ) * lh , type * d ) {
return ( type * ) OPENSSL_LH_insert ( ( OPENSSL_LHASH * ) lh , d ) ;
}
static ossl_inline type * lh_ ## type ## _delete ( LHASH_OF ( type ) * lh , const type * d ) {
return ( type * ) OPENSSL_LH_delete ( ( OPENSSL_LHASH * ) lh , d ) ;
}
static ossl_inline type * lh_ ## type ## _retrieve ( LHASH_OF ( type ) * lh , const type * d ) {
return ( type * ) OPENSSL_LH_retrieve ( ( OPENSSL_LHASH * ) lh , d ) ;
}
static ossl_inline int lh_ ## type ## _error ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_error ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline unsigned long lh_ ## type ## _num_items ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_num_items ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline void lh_ ## type ## _node_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_node_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline void lh_ ## type ## _node_usage_stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_node_usage_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline void lh_ ## type ## _stats_bio ( const LHASH_OF ( type ) * lh , BIO * out ) {
OPENSSL_LH_stats_bio ( ( const OPENSSL_LHASH * ) lh , out ) ;
}
static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) {
OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ;
}
static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) {
OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ;
}
LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) {
OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ;
}
LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void SetOutput ( ArchiveHandle * AH , const char * filename , int compression ) {
int fn ;
if ( filename ) fn = - 1 ;
else if ( AH -> FH ) fn = fileno ( AH -> FH ) ;
else if ( AH -> fSpec ) {
fn = - 1 ;
filename = AH -> fSpec ;
}
else fn = fileno ( stdout ) ;
# ifdef HAVE_LIBZ if ( compression != 0 ) {
char fmode [ 10 ] ;
sprintf ( fmode , "wb%d" , compression ) ;
if ( fn >= 0 ) AH -> OF = gzdopen ( dup ( fn ) , fmode ) ;
else AH -> OF = gzopen ( filename , fmode ) ;
AH -> gzOut = 1 ;
}
else # endif {
if ( AH -> mode == archModeAppend ) {
if ( fn >= 0 ) AH -> OF = fdopen ( dup ( fn ) , PG_BINARY_A ) ;
else AH -> OF = fopen ( filename , PG_BINARY_A ) ;
}
else {
if ( fn >= 0 ) AH -> OF = fdopen ( dup ( fn ) , PG_BINARY_W ) ;
else AH -> OF = fopen ( filename , PG_BINARY_W ) ;
}
AH -> gzOut = 0 ;
}
if ( ! AH -> OF ) {
if ( filename ) exit_horribly ( modulename , "could not open output file \"%s\": %s\n" , filename , strerror ( errno ) ) ;
else exit_horribly ( modulename , "could not open output file: %s\n" , strerror ( errno ) ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
VirtIODevice * virtio_net_init ( DeviceState * dev , NICConf * conf , virtio_net_conf * net ) {
VirtIONet * n ;
n = ( VirtIONet * ) virtio_common_init ( "virtio-net" , VIRTIO_ID_NET , sizeof ( struct virtio_net_config ) , sizeof ( VirtIONet ) ) ;
n -> vdev . get_config = virtio_net_get_config ;
n -> vdev . set_config = virtio_net_set_config ;
n -> vdev . get_features = virtio_net_get_features ;
n -> vdev . set_features = virtio_net_set_features ;
n -> vdev . bad_features = virtio_net_bad_features ;
n -> vdev . reset = virtio_net_reset ;
n -> vdev . set_status = virtio_net_set_status ;
n -> rx_vq = virtio_add_queue ( & n -> vdev , 256 , virtio_net_handle_rx ) ;
if ( net -> tx && strcmp ( net -> tx , "timer" ) && strcmp ( net -> tx , "bh" ) ) {
error_report ( "virtio-net: " "Unknown option tx=%s, valid options: \"timer\" \"bh\"" , net -> tx ) ;
error_report ( "Defaulting to \"bh\"" ) ;
}
if ( net -> tx && ! strcmp ( net -> tx , "timer" ) ) {
n -> tx_vq = virtio_add_queue ( & n -> vdev , 256 , virtio_net_handle_tx_timer ) ;
n -> tx_timer = qemu_new_timer_ns ( vm_clock , virtio_net_tx_timer , n ) ;
n -> tx_timeout = net -> txtimer ;
}
else {
n -> tx_vq = virtio_add_queue ( & n -> vdev , 256 , virtio_net_handle_tx_bh ) ;
n -> tx_bh = qemu_bh_new ( virtio_net_tx_bh , n ) ;
}
n -> ctrl_vq = virtio_add_queue ( & n -> vdev , 64 , virtio_net_handle_ctrl ) ;
qemu_macaddr_default_if_unset ( & conf -> macaddr ) ;
memcpy ( & n -> mac [ 0 ] , & conf -> macaddr , sizeof ( n -> mac ) ) ;
n -> status = VIRTIO_NET_S_LINK_UP ;
n -> nic = qemu_new_nic ( & net_virtio_info , conf , object_get_typename ( OBJECT ( dev ) ) , dev -> id , n ) ;
qemu_format_nic_info_str ( & n -> nic -> nc , conf -> macaddr . a ) ;
n -> tx_waiting = 0 ;
n -> tx_burst = net -> txburst ;
n -> mergeable_rx_bufs = 0 ;
n -> promisc = 1 ;
n -> mac_table . macs = g_malloc0 ( MAC_TABLE_ENTRIES * ETH_ALEN ) ;
n -> vlans = g_malloc0 ( MAX_VLAN >> 3 ) ;
n -> qdev = dev ;
register_savevm ( dev , "virtio-net" , - 1 , VIRTIO_NET_VM_VERSION , virtio_net_save , virtio_net_load , n ) ;
add_boot_device_path ( conf -> bootindex , dev , "/ethernet-phy@0" ) ;
return & n -> vdev ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
struct event * min_heap_top ( min_heap_t * s ) {
return s -> n ? * s -> p : 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserListForceCloseAfterNormalClose ) {
NavigateToDataURL ( BEFORE_UNLOAD_HTML , "beforeunload" ) ;
content : : WindowedNotificationObserver window_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , content : : NotificationService : : AllSources ( ) ) ;
UnloadResults unload_results ;
BrowserList : : CloseAllBrowsersWithProfile ( browser ( ) -> profile ( ) , base : : Bind ( & UnloadResults : : AddSuccess , base : : Unretained ( & unload_results ) ) , base : : Bind ( & UnloadResults : : AddAbort , base : : Unretained ( & unload_results ) ) , false ) ;
BrowserList : : CloseAllBrowsersWithProfile ( browser ( ) -> profile ( ) , base : : Bind ( & UnloadResults : : AddSuccess , base : : Unretained ( & unload_results ) ) , base : : Bind ( & UnloadResults : : AddAbort , base : : Unretained ( & unload_results ) ) , true ) ;
window_observer . Wait ( ) ;
EXPECT_EQ ( 1 , unload_results . get_successes ( ) ) ;
EXPECT_EQ ( 0 , unload_results . get_aborts ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
int h , w ;
AVFrame * pic = avctx -> coded_frame ;
const uint8_t * src = avpkt -> data ;
uint8_t * Y1 , * Y2 , * U , * V ;
int ret ;
if ( pic -> data [ 0 ] ) avctx -> release_buffer ( avctx , pic ) ;
if ( avpkt -> size < avctx -> width * avctx -> height * 3 / 2 + 16 ) {
av_log ( avctx , AV_LOG_ERROR , "packet too small\n" ) ;
return AVERROR_INVALIDDATA ;
}
pic -> reference = 0 ;
if ( ( ret = ff_get_buffer ( avctx , pic ) ) < 0 ) return ret ;
pic -> pict_type = AV_PICTURE_TYPE_I ;
pic -> key_frame = 1 ;
if ( AV_RL32 ( src ) != 0x01000002 ) {
av_log_ask_for_sample ( avctx , "Unknown frame header %X\n" , AV_RL32 ( src ) ) ;
return AVERROR_PATCHWELCOME ;
}
src += 16 ;
Y1 = pic -> data [ 0 ] ;
Y2 = pic -> data [ 0 ] + pic -> linesize [ 0 ] ;
U = pic -> data [ 1 ] ;
V = pic -> data [ 2 ] ;
for ( h = 0 ;
h < avctx -> height ;
h += 2 ) {
for ( w = 0 ;
w < avctx -> width ;
w += 2 ) {
AV_COPY16 ( Y1 + w , src ) ;
AV_COPY16 ( Y2 + w , src + 2 ) ;
U [ w >> 1 ] = src [ 4 ] + 0x80 ;
V [ w >> 1 ] = src [ 5 ] + 0x80 ;
src += 6 ;
}
Y1 += pic -> linesize [ 0 ] << 1 ;
Y2 += pic -> linesize [ 0 ] << 1 ;
U += pic -> linesize [ 1 ] ;
V += pic -> linesize [ 2 ] ;
}
* got_frame = 1 ;
* ( AVFrame * ) data = * pic ;
return avpkt -> size ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void write_IRQreg_ilr ( OpenPICState * opp , int n_IRQ , uint32_t val ) {
if ( opp -> flags & OPENPIC_FLAG_ILR ) {
IRQSource * src = & opp -> src [ n_IRQ ] ;
src -> output = inttgt_to_output ( val & ILR_INTTGT_MASK ) ;
DPRINTF ( "Set ILR %d to 0x%08x, output %d\n" , n_IRQ , src -> idr , src -> output ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
inline void uint32_to_be ( void * bytes , unsigned integer ) {
unsigned char * b = ( unsigned char * ) bytes ;
b [ 0 ] = ( integer & 0xff000000 ) >> 24 ;
b [ 1 ] = ( integer & 0x00ff0000 ) >> 16 ;
b [ 2 ] = ( integer & 0x0000ff00 ) >> 8 ;
b [ 3 ] = ( integer & 0x000000ff ) >> 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _slurm_rpc_dump_job_single ( slurm_msg_t * msg ) {
DEF_TIMERS ;
char * dump = NULL ;
int dump_size , rc ;
slurm_msg_t response_msg ;
job_id_msg_t * job_id_msg = ( job_id_msg_t * ) msg -> data ;
slurmctld_lock_t job_read_lock = {
READ_LOCK , READ_LOCK , NO_LOCK , READ_LOCK , READ_LOCK }
;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
START_TIMER ;
debug3 ( "Processing RPC: REQUEST_JOB_INFO_SINGLE from uid=%d" , uid ) ;
lock_slurmctld ( job_read_lock ) ;
rc = pack_one_job ( & dump , & dump_size , job_id_msg -> job_id , job_id_msg -> show_flags , uid , msg -> protocol_version ) ;
unlock_slurmctld ( job_read_lock ) ;
END_TIMER2 ( "_slurm_rpc_dump_job_single" ) ;
# if 0 info ( "_slurm_rpc_dump_job_single, size=%d %s" , dump_size , TIME_STR ) ;
# endif if ( rc != SLURM_SUCCESS ) {
slurm_send_rc_msg ( msg , rc ) ;
}
else {
slurm_msg_t_init ( & response_msg ) ;
response_msg . flags = msg -> flags ;
response_msg . protocol_version = msg -> protocol_version ;
response_msg . address = msg -> address ;
response_msg . conn = msg -> conn ;
response_msg . msg_type = RESPONSE_JOB_INFO ;
response_msg . data = dump ;
response_msg . data_size = dump_size ;
slurm_send_node_msg ( msg -> conn_fd , & response_msg ) ;
}
xfree ( dump ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
virLogFilterPtr virLogParseFilter ( const char * src ) {
virLogFilterPtr ret = NULL ;
size_t count = 0 ;
virLogPriority prio ;
char * * tokens = NULL ;
unsigned int flags = 0 ;
char * match = NULL ;
VIR_DEBUG ( "filter=%s" , src ) ;
if ( ! ( tokens = virStringSplitCount ( src , ":" , 0 , & count ) ) || count != 2 ) {
virReportError ( VIR_ERR_INVALID_ARG , _ ( "Malformed format for filter '%s'" ) , src ) ;
goto cleanup ;
}
if ( virStrToLong_uip ( tokens [ 0 ] , NULL , 10 , & prio ) < 0 || ( prio < VIR_LOG_DEBUG ) || ( prio > VIR_LOG_ERROR ) ) {
virReportError ( VIR_ERR_INVALID_ARG , _ ( "Invalid priority '%s' for output '%s'" ) , tokens [ 0 ] , src ) ;
goto cleanup ;
}
match = tokens [ 1 ] ;
if ( match [ 0 ] == '+' ) {
flags |= VIR_LOG_STACK_TRACE ;
match ++ ;
}
if ( ! * match ) {
virReportError ( VIR_ERR_INVALID_ARG , _ ( "Invalid match string '%s'" ) , tokens [ 1 ] ) ;
goto cleanup ;
}
if ( ! ( ret = virLogFilterNew ( match , prio , flags ) ) ) goto cleanup ;
cleanup : virStringListFree ( tokens ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static unsigned char * kex_agree_instr ( unsigned char * haystack , unsigned long haystack_len , const unsigned char * needle , unsigned long needle_len ) {
unsigned char * s ;
if ( haystack_len < needle_len ) {
return NULL ;
}
if ( ( strncmp ( ( char * ) haystack , ( char * ) needle , needle_len ) == 0 ) && ( needle_len == haystack_len || haystack [ needle_len ] == ',' ) ) {
return haystack ;
}
s = haystack ;
while ( ( s = ( unsigned char * ) strchr ( ( char * ) s , ',' ) ) && ( ( haystack_len - ( s - haystack ) ) > needle_len ) ) {
s ++ ;
if ( ( strncmp ( ( char * ) s , ( char * ) needle , needle_len ) == 0 ) && ( ( ( s - haystack ) + needle_len ) == haystack_len || s [ needle_len ] == ',' ) ) {
return s ;
}
}
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void ucnv_toUnicode_UTF8_OFFSETS_LOGIC ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
UConverter * cnv = args -> converter ;
const unsigned char * mySource = ( unsigned char * ) args -> source ;
UChar * myTarget = args -> target ;
int32_t * myOffsets = args -> offsets ;
int32_t offsetNum = 0 ;
const unsigned char * sourceLimit = ( unsigned char * ) args -> sourceLimit ;
const UChar * targetLimit = args -> targetLimit ;
unsigned char * toUBytes = cnv -> toUBytes ;
UBool isCESU8 = hasCESU8Data ( cnv ) ;
uint32_t ch , ch2 = 0 ;
int32_t i , inBytes ;
if ( cnv -> toUnicodeStatus && myTarget < targetLimit ) {
inBytes = cnv -> mode ;
i = cnv -> toULength ;
cnv -> toULength = 0 ;
ch = cnv -> toUnicodeStatus ;
cnv -> toUnicodeStatus = 0 ;
goto morebytes ;
}
while ( mySource < sourceLimit && myTarget < targetLimit ) {
ch = * ( mySource ++ ) ;
if ( ch < 0x80 ) {
* ( myTarget ++ ) = ( UChar ) ch ;
* ( myOffsets ++ ) = offsetNum ++ ;
}
else {
toUBytes [ 0 ] = ( char ) ch ;
inBytes = bytesFromUTF8 [ ch ] ;
i = 1 ;
morebytes : while ( i < inBytes ) {
if ( mySource < sourceLimit ) {
toUBytes [ i ] = ( char ) ( ch2 = * mySource ) ;
if ( ! U8_IS_TRAIL ( ch2 ) ) {
break ;
}
ch = ( ch << 6 ) + ch2 ;
++ mySource ;
i ++ ;
}
else {
cnv -> toUnicodeStatus = ch ;
cnv -> mode = inBytes ;
cnv -> toULength = ( int8_t ) i ;
goto donefornow ;
}
}
ch -= offsetsFromUTF8 [ inBytes ] ;
if ( i == inBytes && ch <= MAXIMUM_UTF && ch >= utf8_minChar32 [ i ] && ( isCESU8 ? i <= 3 : ! U_IS_SURROGATE ( ch ) ) ) {
if ( ch <= MAXIMUM_UCS2 ) {
* ( myTarget ++ ) = ( UChar ) ch ;
* ( myOffsets ++ ) = offsetNum ;
}
else {
ch -= HALF_BASE ;
* ( myTarget ++ ) = ( UChar ) ( ( ch >> HALF_SHIFT ) + SURROGATE_HIGH_START ) ;
* ( myOffsets ++ ) = offsetNum ;
ch = ( ch & HALF_MASK ) + SURROGATE_LOW_START ;
if ( myTarget < targetLimit ) {
* ( myTarget ++ ) = ( UChar ) ch ;
* ( myOffsets ++ ) = offsetNum ;
}
else {
cnv -> UCharErrorBuffer [ 0 ] = ( UChar ) ch ;
cnv -> UCharErrorBufferLength = 1 ;
* err = U_BUFFER_OVERFLOW_ERROR ;
}
}
offsetNum += i ;
}
else {
cnv -> toULength = ( int8_t ) i ;
* err = U_ILLEGAL_CHAR_FOUND ;
break ;
}
}
}
donefornow : if ( mySource < sourceLimit && myTarget >= targetLimit && U_SUCCESS ( * err ) ) {
* err = U_BUFFER_OVERFLOW_ERROR ;
}
args -> target = myTarget ;
args -> source = ( const char * ) mySource ;
args -> offsets = myOffsets ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void push_compress_filter ( IOBUF out , compress_filter_context_t * zfx , int algo ) {
push_compress_filter2 ( out , zfx , algo , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * threaded_find_deltas ( void * arg ) {
struct thread_params * me = arg ;
while ( me -> remaining ) {
find_deltas ( me -> list , & me -> remaining , me -> window , me -> depth , me -> processed ) ;
progress_lock ( ) ;
me -> working = 0 ;
pthread_cond_signal ( & progress_cond ) ;
progress_unlock ( ) ;
pthread_mutex_lock ( & me -> mutex ) ;
while ( ! me -> data_ready ) pthread_cond_wait ( & me -> cond , & me -> mutex ) ;
me -> data_ready = 0 ;
pthread_mutex_unlock ( & me -> mutex ) ;
}
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void unref_picture ( H264Context * h , Picture * pic ) {
int off = offsetof ( Picture , tf ) + sizeof ( pic -> tf ) ;
int i ;
if ( ! pic -> f . buf [ 0 ] ) return ;
ff_thread_release_buffer ( h -> avctx , & pic -> tf ) ;
av_buffer_unref ( & pic -> hwaccel_priv_buf ) ;
av_buffer_unref ( & pic -> qscale_table_buf ) ;
av_buffer_unref ( & pic -> mb_type_buf ) ;
for ( i = 0 ;
i < 2 ;
i ++ ) {
av_buffer_unref ( & pic -> motion_val_buf [ i ] ) ;
av_buffer_unref ( & pic -> ref_index_buf [ i ] ) ;
}
memset ( ( uint8_t * ) pic + off , 0 , sizeof ( * pic ) - off ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_H262VideoMode ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_H262VideoMode , H262VideoMode_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline void pxa2xx_rtc_pi_tick ( void * opaque ) {
PXA2xxRTCState * s = ( PXA2xxRTCState * ) opaque ;
s -> rtsr |= ( 1 << 13 ) ;
pxa2xx_rtc_piupdate ( s ) ;
s -> last_rtcpicr = 0 ;
pxa2xx_rtc_alarm_update ( s , s -> rtsr ) ;
pxa2xx_rtc_int_update ( s ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ContentFaviconDriverTest , DoNotRemoveMappingIfStopped ) {
ASSERT_TRUE ( embedded_test_server ( ) -> Start ( ) ) ;
GURL url = embedded_test_server ( ) -> GetURL ( "/favicon/slow_page_with_favicon.html" ) ;
GURL icon_url = embedded_test_server ( ) -> GetURL ( "/favicon/icon.png" ) ;
GURL default_icon_url = embedded_test_server ( ) -> GetURL ( "/favicon.ico" ) ;
favicon_service ( ) -> SetFavicons ( {
url }
, icon_url , favicon_base : : IconType : : kFavicon , gfx : : test : : CreateImage ( 32 , 32 ) ) ;
ASSERT_NE ( nullptr , GetFaviconForPageURL ( url , favicon_base : : IconType : : kFavicon ) . bitmap_data ) ;
PageLoadStopper stopper ( web_contents ( ) ) ;
stopper . StopOnDidFinishNavigation ( ) ;
PendingTaskWaiter waiter ( web_contents ( ) ) ;
ui_test_utils : : NavigateToURLWithDisposition ( browser ( ) , url , WindowOpenDisposition : : CURRENT_TAB , ui_test_utils : : BROWSER_TEST_NONE ) ;
waiter . Wait ( ) ;
ASSERT_THAT ( stopper . last_favicon_candidates ( ) , ElementsAre ( default_icon_url ) ) ;
EXPECT_NE ( nullptr , GetFaviconForPageURL ( url , favicon_base : : IconType : : kFavicon ) . bitmap_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int map_uri_to_page_cache_file ( ngx_http_request_t * r , ngx_str_t * public_dir , const u_char * filename , size_t filename_len , ngx_str_t * page_cache_file ) {
u_char * end ;
if ( ( r -> method != NGX_HTTP_GET && r -> method != NGX_HTTP_HEAD ) || filename_len == 0 ) {
return 0 ;
}
if ( mapped_filename_equals ( filename , filename_len , public_dir ) ) {
if ( filename_len + sizeof ( "/index.html" ) > page_cache_file -> len ) {
return 0 ;
}
end = ngx_copy ( page_cache_file -> data , filename , filename_len ) ;
if ( filename [ filename_len - 1 ] != '/' ) {
end = ngx_copy ( end , "/" , 1 ) ;
}
end = ngx_copy ( end , "index.html" , sizeof ( "index.html" ) ) ;
}
else {
if ( filename_len + sizeof ( ".html" ) > page_cache_file -> len ) {
return 0 ;
}
end = ngx_copy ( page_cache_file -> data , filename , filename_len ) ;
end = ngx_copy ( end , ".html" , sizeof ( ".html" ) ) ;
}
if ( file_exists ( page_cache_file -> data , 0 ) ) {
page_cache_file -> len = end - page_cache_file -> data - 1 ;
return 1 ;
}
else {
return 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void cal_nmvsadcosts ( int * mvsadcost [ 2 ] ) {
int i = 1 ;
mvsadcost [ 0 ] [ 0 ] = 0 ;
mvsadcost [ 1 ] [ 0 ] = 0 ;
do {
double z = 256 * ( 2 * ( log2f ( 8 * i ) + .6 ) ) ;
mvsadcost [ 0 ] [ i ] = ( int ) z ;
mvsadcost [ 1 ] [ i ] = ( int ) z ;
mvsadcost [ 0 ] [ - i ] = ( int ) z ;
mvsadcost [ 1 ] [ - i ] = ( int ) z ;
}
while ( ++ i <= MV_MAX ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int SpoolssEnumJobs_q ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep _U_ ) {
dcerpc_call_value * dcv = ( dcerpc_call_value * ) di -> call_data ;
guint32 level ;
offset = dissect_nt_policy_hnd ( tvb , offset , pinfo , tree , di , drep , hf_hnd , NULL , NULL , FALSE , FALSE ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_enumjobs_firstjob , NULL ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_enumjobs_numjobs , NULL ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_level , & level ) ;
if ( ! pinfo -> fd -> flags . visited ) {
dcv -> se_data = GUINT_TO_POINTER ( ( int ) level ) ;
}
col_append_fstr ( pinfo -> cinfo , COL_INFO , ", level %d" , level ) ;
offset = dissect_spoolss_buffer ( tvb , offset , pinfo , tree , di , drep , NULL ) ;
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_offered , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void btcostestimate ( PlannerInfo * root , IndexPath * path , double loop_count , Cost * indexStartupCost , Cost * indexTotalCost , Selectivity * indexSelectivity , double * indexCorrelation ) {
IndexOptInfo * index = path -> indexinfo ;
List * qinfos ;
GenericCosts costs ;
Oid relid ;
AttrNumber colnum ;
VariableStatData vardata ;
double numIndexTuples ;
Cost descentCost ;
List * indexBoundQuals ;
int indexcol ;
bool eqQualHere ;
bool found_saop ;
bool found_is_null_op ;
double num_sa_scans ;
ListCell * lc ;
qinfos = deconstruct_indexquals ( path ) ;
indexBoundQuals = NIL ;
indexcol = 0 ;
eqQualHere = false ;
found_saop = false ;
found_is_null_op = false ;
num_sa_scans = 1 ;
foreach ( lc , qinfos ) {
IndexQualInfo * qinfo = ( IndexQualInfo * ) lfirst ( lc ) ;
RestrictInfo * rinfo = qinfo -> rinfo ;
Expr * clause = rinfo -> clause ;
Oid clause_op ;
int op_strategy ;
if ( indexcol != qinfo -> indexcol ) {
if ( ! eqQualHere ) break ;
eqQualHere = false ;
indexcol ++ ;
if ( indexcol != qinfo -> indexcol ) break ;
}
if ( IsA ( clause , ScalarArrayOpExpr ) ) {
int alength = estimate_array_length ( qinfo -> other_operand ) ;
found_saop = true ;
if ( alength > 1 ) num_sa_scans *= alength ;
}
else if ( IsA ( clause , NullTest ) ) {
NullTest * nt = ( NullTest * ) clause ;
if ( nt -> nulltesttype == IS_NULL ) {
found_is_null_op = true ;
eqQualHere = true ;
}
}
clause_op = qinfo -> clause_op ;
if ( OidIsValid ( clause_op ) ) {
op_strategy = get_op_opfamily_strategy ( clause_op , index -> opfamily [ indexcol ] ) ;
Assert ( op_strategy != 0 ) ;
if ( op_strategy == BTEqualStrategyNumber ) eqQualHere = true ;
}
indexBoundQuals = lappend ( indexBoundQuals , rinfo ) ;
}
if ( index -> unique && indexcol == index -> ncolumns - 1 && eqQualHere && ! found_saop && ! found_is_null_op ) numIndexTuples = 1.0 ;
else {
List * selectivityQuals ;
Selectivity btreeSelectivity ;
selectivityQuals = add_predicate_to_quals ( index , indexBoundQuals ) ;
btreeSelectivity = clauselist_selectivity ( root , selectivityQuals , index -> rel -> relid , JOIN_INNER , NULL ) ;
numIndexTuples = btreeSelectivity * index -> rel -> tuples ;
numIndexTuples = rint ( numIndexTuples / num_sa_scans ) ;
}
MemSet ( & costs , 0 , sizeof ( costs ) ) ;
costs . numIndexTuples = numIndexTuples ;
genericcostestimate ( root , path , loop_count , qinfos , & costs ) ;
if ( index -> tuples > 1 ) {
descentCost = ceil ( log ( index -> tuples ) / log ( 2.0 ) ) * cpu_operator_cost ;
costs . indexStartupCost += descentCost ;
costs . indexTotalCost += costs . num_sa_scans * descentCost ;
}
descentCost = ( index -> tree_height + 1 ) * 50.0 * cpu_operator_cost ;
costs . indexStartupCost += descentCost ;
costs . indexTotalCost += costs . num_sa_scans * descentCost ;
MemSet ( & vardata , 0 , sizeof ( vardata ) ) ;
if ( index -> indexkeys [ 0 ] != 0 ) {
RangeTblEntry * rte = planner_rt_fetch ( index -> rel -> relid , root ) ;
Assert ( rte -> rtekind == RTE_RELATION ) ;
relid = rte -> relid ;
Assert ( relid != InvalidOid ) ;
colnum = index -> indexkeys [ 0 ] ;
if ( get_relation_stats_hook && ( * get_relation_stats_hook ) ( root , rte , colnum , & vardata ) ) {
if ( HeapTupleIsValid ( vardata . statsTuple ) && ! vardata . freefunc ) elog ( ERROR , "no function provided to release variable stats with" ) ;
}
else {
vardata . statsTuple = SearchSysCache3 ( STATRELATTINH , ObjectIdGetDatum ( relid ) , Int16GetDatum ( colnum ) , BoolGetDatum ( rte -> inh ) ) ;
vardata . freefunc = ReleaseSysCache ;
}
}
else {
relid = index -> indexoid ;
colnum = 1 ;
if ( get_index_stats_hook && ( * get_index_stats_hook ) ( root , relid , colnum , & vardata ) ) {
if ( HeapTupleIsValid ( vardata . statsTuple ) && ! vardata . freefunc ) elog ( ERROR , "no function provided to release variable stats with" ) ;
}
else {
vardata . statsTuple = SearchSysCache3 ( STATRELATTINH , ObjectIdGetDatum ( relid ) , Int16GetDatum ( colnum ) , BoolGetDatum ( false ) ) ;
vardata . freefunc = ReleaseSysCache ;
}
}
if ( HeapTupleIsValid ( vardata . statsTuple ) ) {
Oid sortop ;
float4 * numbers ;
int nnumbers ;
sortop = get_opfamily_member ( index -> opfamily [ 0 ] , index -> opcintype [ 0 ] , index -> opcintype [ 0 ] , BTLessStrategyNumber ) ;
if ( OidIsValid ( sortop ) && get_attstatsslot ( vardata . statsTuple , InvalidOid , 0 , STATISTIC_KIND_CORRELATION , sortop , NULL , NULL , NULL , & numbers , & nnumbers ) ) {
double varCorrelation ;
Assert ( nnumbers == 1 ) ;
varCorrelation = numbers [ 0 ] ;
if ( index -> reverse_sort [ 0 ] ) varCorrelation = - varCorrelation ;
if ( index -> ncolumns > 1 ) costs . indexCorrelation = varCorrelation * 0.75 ;
else costs . indexCorrelation = varCorrelation ;
free_attstatsslot ( InvalidOid , NULL , 0 , numbers , nnumbers ) ;
}
}
ReleaseVariableStats ( vardata ) ;
* indexStartupCost = costs . indexStartupCost ;
* indexTotalCost = costs . indexTotalCost ;
* indexSelectivity = costs . indexSelectivity ;
* indexCorrelation = costs . indexCorrelation ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_free_active_base ( void ) {
struct event_base * base1 ;
struct event ev1 ;
setup_test ( "Free active base: " ) ;
base1 = event_init ( ) ;
event_set ( & ev1 , pair [ 1 ] , EV_READ , simple_read_cb , & ev1 ) ;
event_base_set ( base1 , & ev1 ) ;
event_add ( & ev1 , NULL ) ;
event_base_free ( base1 ) ;
test_ok = 1 ;
cleanup_test ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void _printTocEntry ( ArchiveHandle * AH , TocEntry * te , bool isData , bool acl_pass ) {
RestoreOptions * ropt = AH -> public . ropt ;
if ( acl_pass ) {
if ( ! _tocEntryIsACL ( te ) ) return ;
}
else {
if ( _tocEntryIsACL ( te ) ) return ;
}
if ( ! ( ropt -> dropSchema && ! ropt -> createDB ) ) {
if ( strcmp ( te -> desc , "SCHEMA" ) == 0 && strcmp ( te -> tag , "public" ) == 0 ) return ;
if ( strcmp ( te -> desc , "COMMENT" ) == 0 && strcmp ( te -> tag , "SCHEMA public" ) == 0 ) return ;
}
_becomeOwner ( AH , te ) ;
_selectOutputSchema ( AH , te -> namespace ) ;
_selectTablespace ( AH , te -> tablespace ) ;
if ( strcmp ( te -> desc , "TABLE" ) == 0 ) _setWithOids ( AH , te ) ;
if ( ! AH -> noTocComments ) {
const char * pfx ;
char * sanitized_name ;
char * sanitized_schema ;
char * sanitized_owner ;
if ( isData ) pfx = "Data for " ;
else pfx = "" ;
ahprintf ( AH , "--\n" ) ;
if ( AH -> public . verbose ) {
ahprintf ( AH , "-- TOC entry %d (class %u OID %u)\n" , te -> dumpId , te -> catalogId . tableoid , te -> catalogId . oid ) ;
if ( te -> nDeps > 0 ) {
int i ;
ahprintf ( AH , "-- Dependencies:" ) ;
for ( i = 0 ;
i < te -> nDeps ;
i ++ ) ahprintf ( AH , " %d" , te -> dependencies [ i ] ) ;
ahprintf ( AH , "\n" ) ;
}
}
sanitized_name = replace_line_endings ( te -> tag ) ;
if ( te -> namespace ) sanitized_schema = replace_line_endings ( te -> namespace ) ;
else sanitized_schema = pg_strdup ( "-" ) ;
if ( ! ropt -> noOwner ) sanitized_owner = replace_line_endings ( te -> owner ) ;
else sanitized_owner = pg_strdup ( "-" ) ;
ahprintf ( AH , "-- %sName: %s;
Type: %s;
Schema: %s;
Owner: %s" , pfx , sanitized_name , te -> desc , sanitized_schema , sanitized_owner ) ;
free ( sanitized_name ) ;
free ( sanitized_schema ) ;
free ( sanitized_owner ) ;
if ( te -> tablespace && strlen ( te -> tablespace ) > 0 && ! ropt -> noTablespace ) {
char * sanitized_tablespace ;
sanitized_tablespace = replace_line_endings ( te -> tablespace ) ;
ahprintf ( AH , ";
Tablespace: %s" , sanitized_tablespace ) ;
free ( sanitized_tablespace ) ;
}
ahprintf ( AH , "\n" ) ;
if ( AH -> PrintExtraTocPtr != NULL ) ( * AH -> PrintExtraTocPtr ) ( AH , te ) ;
ahprintf ( AH , "--\n\n" ) ;
}
if ( ropt -> noOwner && strcmp ( te -> desc , "SCHEMA" ) == 0 ) {
ahprintf ( AH , "CREATE SCHEMA %s;
\n\n\n" , fmtId ( te -> tag ) ) ;
}
else {
if ( strlen ( te -> defn ) > 0 ) ahprintf ( AH , "%s\n\n" , te -> defn ) ;
}
if ( ! ropt -> noOwner && ! ropt -> use_setsessauth && strlen ( te -> owner ) > 0 && strlen ( te -> dropStmt ) > 0 ) {
if ( strcmp ( te -> desc , "AGGREGATE" ) == 0 || strcmp ( te -> desc , "BLOB" ) == 0 || strcmp ( te -> desc , "COLLATION" ) == 0 || strcmp ( te -> desc , "CONVERSION" ) == 0 || strcmp ( te -> desc , "DATABASE" ) == 0 || strcmp ( te -> desc , "DOMAIN" ) == 0 || strcmp ( te -> desc , "FUNCTION" ) == 0 || strcmp ( te -> desc , "OPERATOR" ) == 0 || strcmp ( te -> desc , "OPERATOR CLASS" ) == 0 || strcmp ( te -> desc , "OPERATOR FAMILY" ) == 0 || strcmp ( te -> desc , "PROCEDURAL LANGUAGE" ) == 0 || strcmp ( te -> desc , "SCHEMA" ) == 0 || strcmp ( te -> desc , "TABLE" ) == 0 || strcmp ( te -> desc , "TYPE" ) == 0 || strcmp ( te -> desc , "VIEW" ) == 0 || strcmp ( te -> desc , "MATERIALIZED VIEW" ) == 0 || strcmp ( te -> desc , "SEQUENCE" ) == 0 || strcmp ( te -> desc , "FOREIGN TABLE" ) == 0 || strcmp ( te -> desc , "TEXT SEARCH DICTIONARY" ) == 0 || strcmp ( te -> desc , "TEXT SEARCH CONFIGURATION" ) == 0 || strcmp ( te -> desc , "FOREIGN DATA WRAPPER" ) == 0 || strcmp ( te -> desc , "SERVER" ) == 0 ) {
PQExpBuffer temp = createPQExpBuffer ( ) ;
appendPQExpBufferStr ( temp , "ALTER " ) ;
_getObjectDescription ( temp , te , AH ) ;
appendPQExpBuffer ( temp , " OWNER TO %s;
" , fmtId ( te -> owner ) ) ;
ahprintf ( AH , "%s\n\n" , temp -> data ) ;
destroyPQExpBuffer ( temp ) ;
}
else if ( strcmp ( te -> desc , "CAST" ) == 0 || strcmp ( te -> desc , "CHECK CONSTRAINT" ) == 0 || strcmp ( te -> desc , "CONSTRAINT" ) == 0 || strcmp ( te -> desc , "DEFAULT" ) == 0 || strcmp ( te -> desc , "FK CONSTRAINT" ) == 0 || strcmp ( te -> desc , "INDEX" ) == 0 || strcmp ( te -> desc , "RULE" ) == 0 || strcmp ( te -> desc , "TRIGGER" ) == 0 || strcmp ( te -> desc , "ROW SECURITY" ) == 0 || strcmp ( te -> desc , "POLICY" ) == 0 || strcmp ( te -> desc , "USER MAPPING" ) == 0 ) {
}
else {
write_msg ( modulename , "WARNING: don't know how to set owner for object type %s\n" , te -> desc ) ;
}
}
if ( acl_pass ) {
if ( AH -> currUser ) free ( AH -> currUser ) ;
AH -> currUser = NULL ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int unlock_remote ( struct remote_lock * lock ) {
struct active_request_slot * slot ;
struct slot_results results ;
struct remote_lock * prev = repo -> locks ;
struct curl_slist * dav_headers ;
int rc = 0 ;
dav_headers = get_dav_token_headers ( lock , DAV_HEADER_LOCK ) ;
slot = get_active_slot ( ) ;
slot -> results = & results ;
curl_setup_http_get ( slot -> curl , lock -> url , DAV_UNLOCK ) ;
curl_easy_setopt ( slot -> curl , CURLOPT_HTTPHEADER , dav_headers ) ;
if ( start_active_slot ( slot ) ) {
run_active_slot ( slot ) ;
if ( results . curl_result == CURLE_OK ) rc = 1 ;
else fprintf ( stderr , "UNLOCK HTTP error %ld\n" , results . http_code ) ;
}
else {
fprintf ( stderr , "Unable to start UNLOCK request\n" ) ;
}
curl_slist_free_all ( dav_headers ) ;
if ( repo -> locks == lock ) {
repo -> locks = lock -> next ;
}
else {
while ( prev && prev -> next != lock ) prev = prev -> next ;
if ( prev ) prev -> next = prev -> next -> next ;
}
free ( lock -> owner ) ;
free ( lock -> url ) ;
free ( lock -> token ) ;
free ( lock ) ;
return rc ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint32_t CnvExtWrite ( NewConverter * cnvData , const UConverterStaticData * staticData , UNewDataMemory * pData , int32_t tableType ) {
CnvExtData * extData = ( CnvExtData * ) cnvData ;
int32_t length , top , headerSize ;
int32_t indexes [ UCNV_EXT_INDEXES_MIN_LENGTH ] = {
0 }
;
if ( tableType & TABLE_BASE ) {
headerSize = 0 ;
}
else {
_MBCSHeader header = {
{
0 , 0 , 0 , 0 }
, 0 , 0 , 0 , 0 , 0 , 0 , 0 }
;
length = ( int32_t ) uprv_strlen ( extData -> ucm -> baseName ) + 1 ;
while ( length & 3 ) {
extData -> ucm -> baseName [ length ++ ] = 0 ;
}
headerSize = MBCS_HEADER_V4_LENGTH * 4 + length ;
header . version [ 0 ] = 4 ;
header . version [ 1 ] = 2 ;
header . flags = ( uint32_t ) ( ( headerSize << 8 ) | MBCS_OUTPUT_EXT_ONLY ) ;
udata_writeBlock ( pData , & header , MBCS_HEADER_V4_LENGTH * 4 ) ;
udata_writeBlock ( pData , extData -> ucm -> baseName , length ) ;
}
top = 0 ;
indexes [ UCNV_EXT_INDEXES_LENGTH ] = length = UCNV_EXT_INDEXES_MIN_LENGTH ;
top += length * 4 ;
indexes [ UCNV_EXT_TO_U_INDEX ] = top ;
indexes [ UCNV_EXT_TO_U_LENGTH ] = length = utm_countItems ( extData -> toUTable ) ;
top += length * 4 ;
indexes [ UCNV_EXT_TO_U_UCHARS_INDEX ] = top ;
indexes [ UCNV_EXT_TO_U_UCHARS_LENGTH ] = length = utm_countItems ( extData -> toUUChars ) ;
top += length * 2 ;
indexes [ UCNV_EXT_FROM_U_UCHARS_INDEX ] = top ;
length = utm_countItems ( extData -> fromUTableUChars ) ;
top += length * 2 ;
if ( top & 3 ) {
* ( ( UChar * ) utm_alloc ( extData -> fromUTableUChars ) ) = 0 ;
* ( ( uint32_t * ) utm_alloc ( extData -> fromUTableValues ) ) = 0 ;
++ length ;
top += 2 ;
}
indexes [ UCNV_EXT_FROM_U_LENGTH ] = length ;
indexes [ UCNV_EXT_FROM_U_VALUES_INDEX ] = top ;
top += length * 4 ;
indexes [ UCNV_EXT_FROM_U_BYTES_INDEX ] = top ;
length = utm_countItems ( extData -> fromUBytes ) ;
top += length ;
if ( top & 1 ) {
* ( ( uint8_t * ) utm_alloc ( extData -> fromUBytes ) ) = 0 ;
++ length ;
++ top ;
}
indexes [ UCNV_EXT_FROM_U_BYTES_LENGTH ] = length ;
indexes [ UCNV_EXT_FROM_U_STAGE_12_INDEX ] = top ;
indexes [ UCNV_EXT_FROM_U_STAGE_1_LENGTH ] = length = extData -> stage1Top ;
indexes [ UCNV_EXT_FROM_U_STAGE_12_LENGTH ] = length += extData -> stage2Top ;
top += length * 2 ;
indexes [ UCNV_EXT_FROM_U_STAGE_3_INDEX ] = top ;
length = extData -> stage3Top ;
top += length * 2 ;
if ( top & 3 ) {
extData -> stage3 [ extData -> stage3Top ++ ] = 0 ;
++ length ;
top += 2 ;
}
indexes [ UCNV_EXT_FROM_U_STAGE_3_LENGTH ] = length ;
indexes [ UCNV_EXT_FROM_U_STAGE_3B_INDEX ] = top ;
indexes [ UCNV_EXT_FROM_U_STAGE_3B_LENGTH ] = length = extData -> stage3bTop ;
top += length * 4 ;
indexes [ UCNV_EXT_SIZE ] = top ;
indexes [ UCNV_EXT_COUNT_BYTES ] = ( extData -> maxInBytes << 16 ) | ( extData -> maxOutBytes << 8 ) | extData -> maxBytesPerUChar ;
indexes [ UCNV_EXT_COUNT_UCHARS ] = ( extData -> maxInUChars << 16 ) | ( extData -> maxOutUChars << 8 ) | extData -> maxUCharsPerByte ;
indexes [ UCNV_EXT_FLAGS ] = extData -> ucm -> ext -> unicodeMask ;
udata_writeBlock ( pData , indexes , sizeof ( indexes ) ) ;
udata_writeBlock ( pData , utm_getStart ( extData -> toUTable ) , indexes [ UCNV_EXT_TO_U_LENGTH ] * 4 ) ;
udata_writeBlock ( pData , utm_getStart ( extData -> toUUChars ) , indexes [ UCNV_EXT_TO_U_UCHARS_LENGTH ] * 2 ) ;
udata_writeBlock ( pData , utm_getStart ( extData -> fromUTableUChars ) , indexes [ UCNV_EXT_FROM_U_LENGTH ] * 2 ) ;
udata_writeBlock ( pData , utm_getStart ( extData -> fromUTableValues ) , indexes [ UCNV_EXT_FROM_U_LENGTH ] * 4 ) ;
udata_writeBlock ( pData , utm_getStart ( extData -> fromUBytes ) , indexes [ UCNV_EXT_FROM_U_BYTES_LENGTH ] ) ;
udata_writeBlock ( pData , extData -> stage1 , extData -> stage1Top * 2 ) ;
udata_writeBlock ( pData , extData -> stage2 , extData -> stage2Top * 2 ) ;
udata_writeBlock ( pData , extData -> stage3 , extData -> stage3Top * 2 ) ;
udata_writeBlock ( pData , extData -> stage3b , extData -> stage3bTop * 4 ) ;
# if 0 {
int32_t i , j ;
length = extData -> stage1Top ;
printf ( "\nstage1[%x]:\n" , length ) ;
for ( i = 0 ;
i < length ;
++ i ) {
if ( extData -> stage1 [ i ] != length ) {
printf ( "stage1[%04x]=%04x\n" , i , extData -> stage1 [ i ] ) ;
}
}
j = length ;
length = extData -> stage2Top ;
printf ( "\nstage2[%x]:\n" , length ) ;
for ( i = 0 ;
i < length ;
++ j , ++ i ) {
if ( extData -> stage2 [ i ] != 0 ) {
printf ( "stage12[%04x]=%04x\n" , j , extData -> stage2 [ i ] ) ;
}
}
length = extData -> stage3Top ;
printf ( "\nstage3[%x]:\n" , length ) ;
for ( i = 0 ;
i < length ;
++ i ) {
if ( extData -> stage3 [ i ] != 0 ) {
printf ( "stage3[%04x]=%04x\n" , i , extData -> stage3 [ i ] ) ;
}
}
length = extData -> stage3bTop ;
printf ( "\nstage3b[%x]:\n" , length ) ;
for ( i = 0 ;
i < length ;
++ i ) {
if ( extData -> stage3b [ i ] != 0 ) {
printf ( "stage3b[%04x]=%08x\n" , i , extData -> stage3b [ i ] ) ;
}
}
}
# endif if ( VERBOSE ) {
printf ( "size of extension data: %ld\n" , ( long ) top ) ;
}
return ( uint32_t ) ( headerSize + top ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_NetworkAccessParameters ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h245_NetworkAccessParameters , NetworkAccessParameters_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
kadm5_ret_t kadm5_rename_principal ( void * server_handle , krb5_principal source , krb5_principal target ) {
krb5_db_entry * kdb ;
osa_princ_ent_rec adb ;
krb5_error_code ret ;
kadm5_server_handle_t handle = server_handle ;
krb5_int16 stype , i ;
krb5_data * salt = NULL ;
krb5_tl_data tl ;
CHECK_HANDLE ( server_handle ) ;
krb5_clear_error_message ( handle -> context ) ;
if ( source == NULL || target == NULL ) return EINVAL ;
if ( ( ret = kdb_get_entry ( handle , target , & kdb , & adb ) ) == 0 ) {
kdb_free_entry ( handle , kdb , & adb ) ;
return ( KADM5_DUP ) ;
}
if ( ( ret = kdb_get_entry ( handle , source , & kdb , & adb ) ) ) return ret ;
tl . tl_data_type = 0x7FFE ;
if ( krb5_dbe_lookup_tl_data ( handle -> context , kdb , & tl ) == 0 && tl . tl_data_length > 0 ) {
ret = KRB5_PLUGIN_OP_NOTSUPP ;
goto done ;
}
for ( i = 0 ;
i < kdb -> n_key_data ;
i ++ ) {
ret = krb5_dbe_compute_salt ( handle -> context , & kdb -> key_data [ i ] , kdb -> princ , & stype , & salt ) ;
if ( ret == KRB5_KDB_BAD_SALTTYPE ) ret = KADM5_NO_RENAME_SALT ;
if ( ret ) goto done ;
kdb -> key_data [ i ] . key_data_type [ 1 ] = KRB5_KDB_SALTTYPE_SPECIAL ;
free ( kdb -> key_data [ i ] . key_data_contents [ 1 ] ) ;
kdb -> key_data [ i ] . key_data_contents [ 1 ] = ( krb5_octet * ) salt -> data ;
kdb -> key_data [ i ] . key_data_length [ 1 ] = salt -> length ;
kdb -> key_data [ i ] . key_data_ver = 2 ;
free ( salt ) ;
salt = NULL ;
}
kadm5_free_principal ( handle -> context , kdb -> princ ) ;
ret = kadm5_copy_principal ( handle -> context , target , & kdb -> princ ) ;
if ( ret ) {
kdb -> princ = NULL ;
goto done ;
}
ret = k5_kadm5_hook_rename ( handle -> context , handle -> hook_handles , KADM5_HOOK_STAGE_PRECOMMIT , source , target ) ;
if ( ret ) goto done ;
if ( ( ret = kdb_put_entry ( handle , kdb , & adb ) ) ) goto done ;
( void ) k5_kadm5_hook_rename ( handle -> context , handle -> hook_handles , KADM5_HOOK_STAGE_POSTCOMMIT , source , target ) ;
ret = kdb_delete_entry ( handle , source ) ;
done : krb5_free_data ( handle -> context , salt ) ;
kdb_free_entry ( handle , kdb , & adb ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int socket_sockcreate_sid ( const struct task_security_struct * tsec , u16 secclass , u32 * socksid ) {
if ( tsec -> sockcreate_sid > SECSID_NULL ) {
* socksid = tsec -> sockcreate_sid ;
return 0 ;
}
return security_transition_sid ( tsec -> sid , tsec -> sid , secclass , NULL , socksid ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void iadst8 ( const int16_t * input , int16_t * output ) {
int s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ;
int x0 = input [ 7 ] ;
int x1 = input [ 0 ] ;
int x2 = input [ 5 ] ;
int x3 = input [ 2 ] ;
int x4 = input [ 3 ] ;
int x5 = input [ 4 ] ;
int x6 = input [ 1 ] ;
int x7 = input [ 6 ] ;
if ( ! ( x0 | x1 | x2 | x3 | x4 | x5 | x6 | x7 ) ) {
output [ 0 ] = output [ 1 ] = output [ 2 ] = output [ 3 ] = output [ 4 ] = output [ 5 ] = output [ 6 ] = output [ 7 ] = 0 ;
return ;
}
s0 = cospi_2_64 * x0 + cospi_30_64 * x1 ;
s1 = cospi_30_64 * x0 - cospi_2_64 * x1 ;
s2 = cospi_10_64 * x2 + cospi_22_64 * x3 ;
s3 = cospi_22_64 * x2 - cospi_10_64 * x3 ;
s4 = cospi_18_64 * x4 + cospi_14_64 * x5 ;
s5 = cospi_14_64 * x4 - cospi_18_64 * x5 ;
s6 = cospi_26_64 * x6 + cospi_6_64 * x7 ;
s7 = cospi_6_64 * x6 - cospi_26_64 * x7 ;
x0 = dct_const_round_shift ( s0 + s4 ) ;
x1 = dct_const_round_shift ( s1 + s5 ) ;
x2 = dct_const_round_shift ( s2 + s6 ) ;
x3 = dct_const_round_shift ( s3 + s7 ) ;
x4 = dct_const_round_shift ( s0 - s4 ) ;
x5 = dct_const_round_shift ( s1 - s5 ) ;
x6 = dct_const_round_shift ( s2 - s6 ) ;
x7 = dct_const_round_shift ( s3 - s7 ) ;
s0 = x0 ;
s1 = x1 ;
s2 = x2 ;
s3 = x3 ;
s4 = cospi_8_64 * x4 + cospi_24_64 * x5 ;
s5 = cospi_24_64 * x4 - cospi_8_64 * x5 ;
s6 = - cospi_24_64 * x6 + cospi_8_64 * x7 ;
s7 = cospi_8_64 * x6 + cospi_24_64 * x7 ;
x0 = s0 + s2 ;
x1 = s1 + s3 ;
x2 = s0 - s2 ;
x3 = s1 - s3 ;
x4 = dct_const_round_shift ( s4 + s6 ) ;
x5 = dct_const_round_shift ( s5 + s7 ) ;
x6 = dct_const_round_shift ( s4 - s6 ) ;
x7 = dct_const_round_shift ( s5 - s7 ) ;
s2 = cospi_16_64 * ( x2 + x3 ) ;
s3 = cospi_16_64 * ( x2 - x3 ) ;
s6 = cospi_16_64 * ( x6 + x7 ) ;
s7 = cospi_16_64 * ( x6 - x7 ) ;
x2 = dct_const_round_shift ( s2 ) ;
x3 = dct_const_round_shift ( s3 ) ;
x6 = dct_const_round_shift ( s6 ) ;
x7 = dct_const_round_shift ( s7 ) ;
output [ 0 ] = x0 ;
output [ 1 ] = - x4 ;
output [ 2 ] = x6 ;
output [ 3 ] = - x2 ;
output [ 4 ] = x3 ;
output [ 5 ] = - x7 ;
output [ 6 ] = x5 ;
output [ 7 ] = - x1 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t u_scanf_integer_handler ( UFILE * input , u_scanf_spec_info * info , ufmt_args * args , const UChar * fmt , int32_t * fmtConsumed , int32_t * argConverted ) {
( void ) fmt ;
( void ) fmtConsumed ;
int32_t len ;
void * num = ( void * ) ( args [ 0 ] . ptrValue ) ;
UNumberFormat * format ;
int32_t parsePos = 0 ;
int32_t skipped ;
UErrorCode status = U_ZERO_ERROR ;
int64_t result ;
skipped = u_scanf_skip_leading_ws ( input , info -> fPadChar ) ;
ufile_fill_uchar_buffer ( input ) ;
len = ( int32_t ) ( input -> str . fLimit - input -> str . fPos ) ;
if ( info -> fWidth != - 1 ) len = ufmt_min ( len , info -> fWidth ) ;
format = u_locbund_getNumberFormat ( & input -> str . fBundle , UNUM_DECIMAL ) ;
if ( format == 0 ) return 0 ;
skipped += u_scanf_skip_leading_positive_sign ( input , format , & status ) ;
result = unum_parseInt64 ( format , input -> str . fPos , len , & parsePos , & status ) ;
if ( ! info -> fSkipArg ) {
if ( info -> fIsShort ) * ( int16_t * ) num = ( int16_t ) ( UINT16_MAX & result ) ;
else if ( info -> fIsLongLong ) * ( int64_t * ) num = result ;
else * ( int32_t * ) num = ( int32_t ) ( UINT32_MAX & result ) ;
}
input -> str . fPos += parsePos ;
* argConverted = ! info -> fSkipArg ;
return parsePos + skipped ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * name ## _get_name ( void * ctx ) \ {
return # name ;
\ }
static const AVClass name ## _class = {
. class_name = # name , . item_name = name ## _get_name , . option = name ## _options \ }
typedef struct DefaultContext {
const AVClass * class ;
int nokey ;
int noprint_wrappers ;
int nested_section [ SECTION_MAX_NB_LEVELS ] ;
}
DefaultContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( DefaultContext , x ) static const AVOption default_options [ ] = {
{
"noprint_wrappers" , "do not print headers and footers" , OFFSET ( noprint_wrappers ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nw" , "do not print headers and footers" , OFFSET ( noprint_wrappers ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nokey" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nk" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( default ) ;
static inline char * upcase_string ( char * dst , size_t dst_size , const char * src ) {
int i ;
for ( i = 0 ;
src [ i ] && i < dst_size - 1 ;
i ++ ) dst [ i ] = av_toupper ( src [ i ] ) ;
dst [ i ] = 0 ;
return dst ;
}
static void default_print_section_header ( WriterContext * wctx ) {
DefaultContext * def = wctx -> priv ;
char buf [ 32 ] ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
av_bprint_clear ( & wctx -> section_pbuf [ wctx -> level ] ) ;
if ( parent_section && ! ( parent_section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) {
def -> nested_section [ wctx -> level ] = 1 ;
av_bprintf ( & wctx -> section_pbuf [ wctx -> level ] , "%s%s:" , wctx -> section_pbuf [ wctx -> level - 1 ] . str , upcase_string ( buf , sizeof ( buf ) , av_x_if_null ( section -> element_name , section -> name ) ) ) ;
}
if ( def -> noprint_wrappers || def -> nested_section [ wctx -> level ] ) return ;
if ( ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "[%s]\n" , upcase_string ( buf , sizeof ( buf ) , section -> name ) ) ;
}
static void default_print_section_footer ( WriterContext * wctx ) {
DefaultContext * def = wctx -> priv ;
const struct section * section = wctx -> section [ wctx -> level ] ;
char buf [ 32 ] ;
if ( def -> noprint_wrappers || def -> nested_section [ wctx -> level ] ) return ;
if ( ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "[/%s]\n" , upcase_string ( buf , sizeof ( buf ) , section -> name ) ) ;
}
static void default_print_str ( WriterContext * wctx , const char * key , const char * value ) {
DefaultContext * def = wctx -> priv ;
if ( ! def -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
printf ( "%s\n" , value ) ;
}
static void default_print_int ( WriterContext * wctx , const char * key , long long int value ) {
DefaultContext * def = wctx -> priv ;
if ( ! def -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
printf ( "%lld\n" , value ) ;
}
static const Writer default_writer = {
. name = "default" , . priv_size = sizeof ( DefaultContext ) , . print_section_header = default_print_section_header , . print_section_footer = default_print_section_footer , . print_integer = default_print_int , . print_string = default_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS , . priv_class = & default_class , }
;
static const char * c_escape_str ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) {
const char * p ;
for ( p = src ;
* p ;
p ++ ) {
switch ( * p ) {
case '\b' : av_bprintf ( dst , "%s" , "\\b" ) ;
break ;
case '\f' : av_bprintf ( dst , "%s" , "\\f" ) ;
break ;
case '\n' : av_bprintf ( dst , "%s" , "\\n" ) ;
break ;
case '\r' : av_bprintf ( dst , "%s" , "\\r" ) ;
break ;
case '\\' : av_bprintf ( dst , "%s" , "\\\\" ) ;
break ;
default : if ( * p == sep ) av_bprint_chars ( dst , '\\' , 1 ) ;
av_bprint_chars ( dst , * p , 1 ) ;
}
}
return dst -> str ;
}
static const char * csv_escape_str ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) {
char meta_chars [ ] = {
sep , '"' , '\n' , '\r' , '\0' }
;
int needs_quoting = ! ! src [ strcspn ( src , meta_chars ) ] ;
if ( needs_quoting ) av_bprint_chars ( dst , '"' , 1 ) ;
for ( ;
* src ;
src ++ ) {
if ( * src == '"' ) av_bprint_chars ( dst , '"' , 1 ) ;
av_bprint_chars ( dst , * src , 1 ) ;
}
if ( needs_quoting ) av_bprint_chars ( dst , '"' , 1 ) ;
return dst -> str ;
}
static const char * none_escape_str ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) {
return src ;
}
typedef struct CompactContext {
const AVClass * class ;
char * item_sep_str ;
char item_sep ;
int nokey ;
int print_section ;
char * escape_mode_str ;
const char * ( * escape_str ) ( AVBPrint * dst , const char * src , const char sep , void * log_ctx ) ;
int nested_section [ SECTION_MAX_NB_LEVELS ] ;
int has_nested_elems [ SECTION_MAX_NB_LEVELS ] ;
int terminate_line [ SECTION_MAX_NB_LEVELS ] ;
}
CompactContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( CompactContext , x ) static const AVOption compact_options [ ] = {
{
"item_sep" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "|" }
, CHAR_MIN , CHAR_MAX }
, {
"s" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "|" }
, CHAR_MIN , CHAR_MAX }
, {
"nokey" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"nk" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"escape" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "c" }
, CHAR_MIN , CHAR_MAX }
, {
"e" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "c" }
, CHAR_MIN , CHAR_MAX }
, {
"print_section" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"p" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( compact ) ;
static av_cold int compact_init ( WriterContext * wctx ) {
CompactContext * compact = wctx -> priv ;
if ( strlen ( compact -> item_sep_str ) != 1 ) {
av_log ( wctx , AV_LOG_ERROR , "Item separator '%s' specified, but must contain a single character\n" , compact -> item_sep_str ) ;
return AVERROR ( EINVAL ) ;
}
compact -> item_sep = compact -> item_sep_str [ 0 ] ;
if ( ! strcmp ( compact -> escape_mode_str , "none" ) ) compact -> escape_str = none_escape_str ;
else if ( ! strcmp ( compact -> escape_mode_str , "c" ) ) compact -> escape_str = c_escape_str ;
else if ( ! strcmp ( compact -> escape_mode_str , "csv" ) ) compact -> escape_str = csv_escape_str ;
else {
av_log ( wctx , AV_LOG_ERROR , "Unknown escape mode '%s'\n" , compact -> escape_mode_str ) ;
return AVERROR ( EINVAL ) ;
}
return 0 ;
}
static void compact_print_section_header ( WriterContext * wctx ) {
CompactContext * compact = wctx -> priv ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
compact -> terminate_line [ wctx -> level ] = 1 ;
compact -> has_nested_elems [ wctx -> level ] = 0 ;
av_bprint_clear ( & wctx -> section_pbuf [ wctx -> level ] ) ;
if ( ! ( section -> flags & SECTION_FLAG_IS_ARRAY ) && parent_section && ! ( parent_section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) {
compact -> nested_section [ wctx -> level ] = 1 ;
compact -> has_nested_elems [ wctx -> level - 1 ] = 1 ;
av_bprintf ( & wctx -> section_pbuf [ wctx -> level ] , "%s%s:" , wctx -> section_pbuf [ wctx -> level - 1 ] . str , ( char * ) av_x_if_null ( section -> element_name , section -> name ) ) ;
wctx -> nb_item [ wctx -> level ] = wctx -> nb_item [ wctx -> level - 1 ] ;
}
else {
if ( parent_section && compact -> has_nested_elems [ wctx -> level - 1 ] && ( section -> flags & SECTION_FLAG_IS_ARRAY ) ) {
compact -> terminate_line [ wctx -> level - 1 ] = 0 ;
printf ( "\n" ) ;
}
if ( compact -> print_section && ! ( section -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "%s%c" , section -> name , compact -> item_sep ) ;
}
}
static void compact_print_section_footer ( WriterContext * wctx ) {
CompactContext * compact = wctx -> priv ;
if ( ! compact -> nested_section [ wctx -> level ] && compact -> terminate_line [ wctx -> level ] && ! ( wctx -> section [ wctx -> level ] -> flags & ( SECTION_FLAG_IS_WRAPPER | SECTION_FLAG_IS_ARRAY ) ) ) printf ( "\n" ) ;
}
static void compact_print_str ( WriterContext * wctx , const char * key , const char * value ) {
CompactContext * compact = wctx -> priv ;
AVBPrint buf ;
if ( wctx -> nb_item [ wctx -> level ] ) printf ( "%c" , compact -> item_sep ) ;
if ( ! compact -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "%s" , compact -> escape_str ( & buf , value , compact -> item_sep , wctx ) ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static void compact_print_int ( WriterContext * wctx , const char * key , long long int value ) {
CompactContext * compact = wctx -> priv ;
if ( wctx -> nb_item [ wctx -> level ] ) printf ( "%c" , compact -> item_sep ) ;
if ( ! compact -> nokey ) printf ( "%s%s=" , wctx -> section_pbuf [ wctx -> level ] . str , key ) ;
printf ( "%lld" , value ) ;
}
static const Writer compact_writer = {
. name = "compact" , . priv_size = sizeof ( CompactContext ) , . init = compact_init , . print_section_header = compact_print_section_header , . print_section_footer = compact_print_section_footer , . print_integer = compact_print_int , . print_string = compact_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS , . priv_class = & compact_class , }
;
# undef OFFSET # define OFFSET ( x ) offsetof ( CompactContext , x ) static const AVOption csv_options [ ] = {
{
"item_sep" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "," }
, CHAR_MIN , CHAR_MAX }
, {
"s" , "set item separator" , OFFSET ( item_sep_str ) , AV_OPT_TYPE_STRING , {
. str = "," }
, CHAR_MIN , CHAR_MAX }
, {
"nokey" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"nk" , "force no key printing" , OFFSET ( nokey ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"escape" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "csv" }
, CHAR_MIN , CHAR_MAX }
, {
"e" , "set escape mode" , OFFSET ( escape_mode_str ) , AV_OPT_TYPE_STRING , {
. str = "csv" }
, CHAR_MIN , CHAR_MAX }
, {
"print_section" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"p" , "print section name" , OFFSET ( print_section ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( csv ) ;
static const Writer csv_writer = {
. name = "csv" , . priv_size = sizeof ( CompactContext ) , . init = compact_init , . print_section_header = compact_print_section_header , . print_section_footer = compact_print_section_footer , . print_integer = compact_print_int , . print_string = compact_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS , . priv_class = & csv_class , }
;
typedef struct FlatContext {
const AVClass * class ;
const char * sep_str ;
char sep ;
int hierarchical ;
}
FlatContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( FlatContext , x ) static const AVOption flat_options [ ] = {
{
"sep_char" , "set separator" , OFFSET ( sep_str ) , AV_OPT_TYPE_STRING , {
. str = "." }
, CHAR_MIN , CHAR_MAX }
, {
"s" , "set separator" , OFFSET ( sep_str ) , AV_OPT_TYPE_STRING , {
. str = "." }
, CHAR_MIN , CHAR_MAX }
, {
"hierarchical" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"h" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( flat ) ;
static av_cold int flat_init ( WriterContext * wctx ) {
FlatContext * flat = wctx -> priv ;
if ( strlen ( flat -> sep_str ) != 1 ) {
av_log ( wctx , AV_LOG_ERROR , "Item separator '%s' specified, but must contain a single character\n" , flat -> sep_str ) ;
return AVERROR ( EINVAL ) ;
}
flat -> sep = flat -> sep_str [ 0 ] ;
return 0 ;
}
static const char * flat_escape_key_str ( AVBPrint * dst , const char * src , const char sep ) {
const char * p ;
for ( p = src ;
* p ;
p ++ ) {
if ( ! ( ( * p >= '0' && * p <= '9' ) || ( * p >= 'a' && * p <= 'z' ) || ( * p >= 'A' && * p <= 'Z' ) ) ) av_bprint_chars ( dst , '_' , 1 ) ;
else av_bprint_chars ( dst , * p , 1 ) ;
}
return dst -> str ;
}
static const char * flat_escape_value_str ( AVBPrint * dst , const char * src ) {
const char * p ;
for ( p = src ;
* p ;
p ++ ) {
switch ( * p ) {
case '\n' : av_bprintf ( dst , "%s" , "\\n" ) ;
break ;
case '\r' : av_bprintf ( dst , "%s" , "\\r" ) ;
break ;
case '\\' : av_bprintf ( dst , "%s" , "\\\\" ) ;
break ;
case '"' : av_bprintf ( dst , "%s" , "\\\"" ) ;
break ;
case '`' : av_bprintf ( dst , "%s" , "\\`" ) ;
break ;
case '$' : av_bprintf ( dst , "%s" , "\\$" ) ;
break ;
default : av_bprint_chars ( dst , * p , 1 ) ;
break ;
}
}
return dst -> str ;
}
static void flat_print_section_header ( WriterContext * wctx ) {
FlatContext * flat = wctx -> priv ;
AVBPrint * buf = & wctx -> section_pbuf [ wctx -> level ] ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
av_bprint_clear ( buf ) ;
if ( ! parent_section ) return ;
av_bprintf ( buf , "%s" , wctx -> section_pbuf [ wctx -> level - 1 ] . str ) ;
if ( flat -> hierarchical || ! ( section -> flags & ( SECTION_FLAG_IS_ARRAY | SECTION_FLAG_IS_WRAPPER ) ) ) {
av_bprintf ( buf , "%s%s" , wctx -> section [ wctx -> level ] -> name , flat -> sep_str ) ;
if ( parent_section -> flags & SECTION_FLAG_IS_ARRAY ) {
int n = parent_section -> id == SECTION_ID_PACKETS_AND_FRAMES ? wctx -> nb_section_packet_frame : wctx -> nb_item [ wctx -> level - 1 ] ;
av_bprintf ( buf , "%d%s" , n , flat -> sep_str ) ;
}
}
}
static void flat_print_int ( WriterContext * wctx , const char * key , long long int value ) {
printf ( "%s%s=%lld\n" , wctx -> section_pbuf [ wctx -> level ] . str , key , value ) ;
}
static void flat_print_str ( WriterContext * wctx , const char * key , const char * value ) {
FlatContext * flat = wctx -> priv ;
AVBPrint buf ;
printf ( "%s" , wctx -> section_pbuf [ wctx -> level ] . str ) ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "%s=" , flat_escape_key_str ( & buf , key , flat -> sep ) ) ;
av_bprint_clear ( & buf ) ;
printf ( "\"%s\"\n" , flat_escape_value_str ( & buf , value ) ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static const Writer flat_writer = {
. name = "flat" , . priv_size = sizeof ( FlatContext ) , . init = flat_init , . print_section_header = flat_print_section_header , . print_integer = flat_print_int , . print_string = flat_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS | WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER , . priv_class = & flat_class , }
;
typedef struct INIContext {
const AVClass * class ;
int hierarchical ;
}
INIContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( INIContext , x ) static const AVOption ini_options [ ] = {
{
"hierarchical" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
"h" , "specify if the section specification should be hierarchical" , OFFSET ( hierarchical ) , AV_OPT_TYPE_BOOL , {
. i64 = 1 }
, 0 , 1 }
, {
NULL }
, }
;
DEFINE_WRITER_CLASS ( ini ) ;
static char * ini_escape_str ( AVBPrint * dst , const char * src ) {
int i = 0 ;
char c = 0 ;
while ( c = src [ i ++ ] ) {
switch ( c ) {
case '\b' : av_bprintf ( dst , "%s" , "\\b" ) ;
break ;
case '\f' : av_bprintf ( dst , "%s" , "\\f" ) ;
break ;
case '\n' : av_bprintf ( dst , "%s" , "\\n" ) ;
break ;
case '\r' : av_bprintf ( dst , "%s" , "\\r" ) ;
break ;
case '\t' : av_bprintf ( dst , "%s" , "\\t" ) ;
break ;
case '\\' : case '#' : case '=' : case ':' : av_bprint_chars ( dst , '\\' , 1 ) ;
default : if ( ( unsigned char ) c < 32 ) av_bprintf ( dst , "\\x00%02x" , c & 0xff ) ;
else av_bprint_chars ( dst , c , 1 ) ;
break ;
}
}
return dst -> str ;
}
static void ini_print_section_header ( WriterContext * wctx ) {
INIContext * ini = wctx -> priv ;
AVBPrint * buf = & wctx -> section_pbuf [ wctx -> level ] ;
const struct section * section = wctx -> section [ wctx -> level ] ;
const struct section * parent_section = wctx -> level ? wctx -> section [ wctx -> level - 1 ] : NULL ;
av_bprint_clear ( buf ) ;
if ( ! parent_section ) {
printf ( "# ffprobe output\n\n" ) ;
return ;
}
if ( wctx -> nb_item [ wctx -> level - 1 ] ) printf ( "\n" ) ;
av_bprintf ( buf , "%s" , wctx -> section_pbuf [ wctx -> level - 1 ] . str ) ;
if ( ini -> hierarchical || ! ( section -> flags & ( SECTION_FLAG_IS_ARRAY | SECTION_FLAG_IS_WRAPPER ) ) ) {
av_bprintf ( buf , "%s%s" , buf -> str [ 0 ] ? "." : "" , wctx -> section [ wctx -> level ] -> name ) ;
if ( parent_section -> flags & SECTION_FLAG_IS_ARRAY ) {
int n = parent_section -> id == SECTION_ID_PACKETS_AND_FRAMES ? wctx -> nb_section_packet_frame : wctx -> nb_item [ wctx -> level - 1 ] ;
av_bprintf ( buf , ".%d" , n ) ;
}
}
if ( ! ( section -> flags & ( SECTION_FLAG_IS_ARRAY | SECTION_FLAG_IS_WRAPPER ) ) ) printf ( "[%s]\n" , buf -> str ) ;
}
static void ini_print_str ( WriterContext * wctx , const char * key , const char * value ) {
AVBPrint buf ;
av_bprint_init ( & buf , 1 , AV_BPRINT_SIZE_UNLIMITED ) ;
printf ( "%s=" , ini_escape_str ( & buf , key ) ) ;
av_bprint_clear ( & buf ) ;
printf ( "%s\n" , ini_escape_str ( & buf , value ) ) ;
av_bprint_finalize ( & buf , NULL ) ;
}
static void ini_print_int ( WriterContext * wctx , const char * key , long long int value ) {
printf ( "%s=%lld\n" , key , value ) ;
}
static const Writer ini_writer = {
. name = "ini" , . priv_size = sizeof ( INIContext ) , . print_section_header = ini_print_section_header , . print_integer = ini_print_int , . print_string = ini_print_str , . flags = WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS | WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER , . priv_class = & ini_class , }
;
typedef struct JSONContext {
const AVClass * class ;
int indent_level ;
int compact ;
const char * item_sep , * item_start_end ;
}
JSONContext ;
# undef OFFSET # define OFFSET ( x ) offsetof ( JSONContext , x ) static const AVOption json_options [ ] = {
{
"compact" , "enable compact output" , OFFSET ( compact ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
"c" , "enable compact output" , OFFSET ( compact ) , AV_OPT_TYPE_BOOL , {
. i64 = 0 }
, 0 , 1 }
, {
NULL }
}
;
DEFINE_WRITER_CLASS ( json )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int TS_ext_print_bio ( BIO * bio , const STACK_OF ( X509_EXTENSION ) * extensions ) {
int i , critical , n ;
X509_EXTENSION * ex ;
ASN1_OBJECT * obj ;
BIO_printf ( bio , "Extensions:\n" ) ;
n = X509v3_get_ext_count ( extensions ) ;
for ( i = 0 ;
i < n ;
i ++ ) {
ex = X509v3_get_ext ( extensions , i ) ;
obj = X509_EXTENSION_get_object ( ex ) ;
i2a_ASN1_OBJECT ( bio , obj ) ;
critical = X509_EXTENSION_get_critical ( ex ) ;
BIO_printf ( bio , ": %s\n" , critical ? "critical" : "" ) ;
if ( ! X509V3_EXT_print ( bio , ex , 0 , 4 ) ) {
BIO_printf ( bio , "%4s" , "" ) ;
ASN1_STRING_print ( bio , X509_EXTENSION_get_data ( ex ) ) ;
}
BIO_write ( bio , "\n" , 1 ) ;
}
return 1 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( TemplateURLTest , GetURLNoInstantURL ) {
TemplateURLData data ;
data . SetURL ( "http://google.com/?q={
searchTerms}
" ) ;
data . suggestions_url = "http://google.com/suggest?q={
searchTerms}
" ;
data . alternate_urls . push_back ( "http://google.com/alt?q={
searchTerms}
" ) ;
data . alternate_urls . push_back ( "{
google:baseURL}
/alt/#q={
searchTerms}
" ) ;
TemplateURL url ( data ) ;
const std : : vector < TemplateURLRef > & url_refs = url . url_refs ( ) ;
ASSERT_EQ ( 3U , url_refs . size ( ) ) ;
EXPECT_EQ ( "http://google.com/alt?q={
searchTerms}
" , url_refs [ 0 ] . GetURL ( ) ) ;
EXPECT_EQ ( "{
google:baseURL}
/alt/#q={
searchTerms}
" , url_refs [ 1 ] . GetURL ( ) ) ;
EXPECT_EQ ( "http://google.com/?q={
searchTerms}
" , url_refs [ 2 ] . GetURL ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void separate_arf_mbs ( VP9_COMP * cpi ) {
VP9_COMMON * const cm = & cpi -> common ;
int mb_col , mb_row , offset , i ;
int mi_row , mi_col ;
int ncnt [ 4 ] = {
0 }
;
int n_frames = cpi -> mbgraph_n_frames ;
int * arf_not_zz ;
CHECK_MEM_ERROR ( cm , arf_not_zz , vpx_calloc ( cm -> mb_rows * cm -> mb_cols * sizeof ( * arf_not_zz ) , 1 ) ) ;
if ( n_frames > cpi -> rc . frames_till_gf_update_due ) n_frames = cpi -> rc . frames_till_gf_update_due ;
for ( i = n_frames - 1 ;
i >= 0 ;
i -- ) {
MBGRAPH_FRAME_STATS * frame_stats = & cpi -> mbgraph_stats [ i ] ;
for ( offset = 0 , mb_row = 0 ;
mb_row < cm -> mb_rows ;
offset += cm -> mb_cols , mb_row ++ ) {
for ( mb_col = 0 ;
mb_col < cm -> mb_cols ;
mb_col ++ ) {
MBGRAPH_MB_STATS * mb_stats = & frame_stats -> mb_stats [ offset + mb_col ] ;
int altref_err = mb_stats -> ref [ ALTREF_FRAME ] . err ;
int intra_err = mb_stats -> ref [ INTRA_FRAME ] . err ;
int golden_err = mb_stats -> ref [ GOLDEN_FRAME ] . err ;
if ( altref_err > 1000 || altref_err > intra_err || altref_err > golden_err ) {
arf_not_zz [ offset + mb_col ] ++ ;
}
}
}
}
for ( mi_row = 0 ;
mi_row < cm -> mi_rows ;
mi_row ++ ) {
for ( mi_col = 0 ;
mi_col < cm -> mi_cols ;
mi_col ++ ) {
if ( arf_not_zz [ mi_row / 2 * cm -> mb_cols + mi_col / 2 ] ) {
ncnt [ 0 ] ++ ;
cpi -> segmentation_map [ mi_row * cm -> mi_cols + mi_col ] = 0 ;
}
else {
cpi -> segmentation_map [ mi_row * cm -> mi_cols + mi_col ] = 1 ;
ncnt [ 1 ] ++ ;
}
}
}
if ( 1 ) {
if ( cm -> MBs ) cpi -> static_mb_pct = ( ncnt [ 1 ] * 100 ) / ( cm -> mi_rows * cm -> mi_cols ) ;
else cpi -> static_mb_pct = 0 ;
vp9_enable_segmentation ( & cm -> seg ) ;
}
else {
cpi -> static_mb_pct = 0 ;
vp9_disable_segmentation ( & cm -> seg ) ;
}
vpx_free ( arf_not_zz ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ipvideo_decode_block_opcode_0x7_16 ( IpvideoContext * s ) {
int x , y ;
uint16_t P [ 2 ] ;
unsigned int flags ;
uint16_t * pixel_ptr = ( uint16_t * ) s -> pixel_ptr ;
P [ 0 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
P [ 1 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
if ( ! ( P [ 0 ] & 0x8000 ) ) {
for ( y = 0 ;
y < 8 ;
y ++ ) {
flags = bytestream2_get_byte ( & s -> stream_ptr ) | 0x100 ;
for ( ;
flags != 1 ;
flags >>= 1 ) * pixel_ptr ++ = P [ flags & 1 ] ;
pixel_ptr += s -> line_inc ;
}
}
else {
flags = bytestream2_get_le16 ( & s -> stream_ptr ) ;
for ( y = 0 ;
y < 8 ;
y += 2 ) {
for ( x = 0 ;
x < 8 ;
x += 2 , flags >>= 1 ) {
pixel_ptr [ x ] = pixel_ptr [ x + 1 ] = pixel_ptr [ x + s -> stride ] = pixel_ptr [ x + 1 + s -> stride ] = P [ flags & 1 ] ;
}
pixel_ptr += s -> stride * 2 ;
}
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void sccp_calls_init_tap ( void ) {
GString * error_string ;
if ( have_sccp_tap_listener == FALSE ) {
error_string = register_tap_listener ( "sccp" , & ( the_tapinfo_struct . sccp_dummy ) , NULL , 0 , voip_calls_dlg_reset , sccp_calls_packet , voip_calls_dlg_draw ) ;
if ( error_string != NULL ) {
simple_dialog ( ESD_TYPE_ERROR , ESD_BTN_OK , "%s" , error_string -> str ) ;
g_string_free ( error_string , TRUE ) ;
exit ( 1 ) ;
}
have_sccp_tap_listener = TRUE ;
}
if ( have_sua_tap_listener == FALSE ) {
error_string = register_tap_listener ( "sua" , & ( the_tapinfo_struct . sua_dummy ) , NULL , 0 , voip_calls_dlg_reset , sua_calls_packet , voip_calls_dlg_draw ) ;
if ( error_string != NULL ) {
simple_dialog ( ESD_TYPE_ERROR , ESD_BTN_OK , "%s" , error_string -> str ) ;
g_string_free ( error_string , TRUE ) ;
exit ( 1 ) ;
}
have_sua_tap_listener = TRUE ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
Const * make_greater_string ( const Const * str_const , FmgrInfo * ltproc , Oid collation ) {
Oid datatype = str_const -> consttype ;
char * workstr ;
int len ;
Datum cmpstr ;
text * cmptxt = NULL ;
mbcharacter_incrementer charinc ;
if ( datatype == NAMEOID ) {
workstr = DatumGetCString ( DirectFunctionCall1 ( nameout , str_const -> constvalue ) ) ;
len = strlen ( workstr ) ;
cmpstr = str_const -> constvalue ;
}
else if ( datatype == BYTEAOID ) {
bytea * bstr = DatumGetByteaP ( str_const -> constvalue ) ;
len = VARSIZE ( bstr ) - VARHDRSZ ;
workstr = ( char * ) palloc ( len ) ;
memcpy ( workstr , VARDATA ( bstr ) , len ) ;
if ( ( Pointer ) bstr != DatumGetPointer ( str_const -> constvalue ) ) pfree ( bstr ) ;
cmpstr = str_const -> constvalue ;
}
else {
workstr = TextDatumGetCString ( str_const -> constvalue ) ;
len = strlen ( workstr ) ;
if ( lc_collate_is_c ( collation ) || len == 0 ) cmpstr = str_const -> constvalue ;
else {
static char suffixchar = 0 ;
static Oid suffixcollation = 0 ;
if ( ! suffixchar || suffixcollation != collation ) {
char * best ;
best = "Z" ;
if ( varstr_cmp ( best , 1 , "z" , 1 , collation ) < 0 ) best = "z" ;
if ( varstr_cmp ( best , 1 , "y" , 1 , collation ) < 0 ) best = "y" ;
if ( varstr_cmp ( best , 1 , "9" , 1 , collation ) < 0 ) best = "9" ;
suffixchar = * best ;
suffixcollation = collation ;
}
cmptxt = ( text * ) palloc ( VARHDRSZ + len + 1 ) ;
SET_VARSIZE ( cmptxt , VARHDRSZ + len + 1 ) ;
memcpy ( VARDATA ( cmptxt ) , workstr , len ) ;
* ( VARDATA ( cmptxt ) + len ) = suffixchar ;
cmpstr = PointerGetDatum ( cmptxt ) ;
}
}
if ( datatype == BYTEAOID ) charinc = byte_increment ;
else charinc = pg_database_encoding_character_incrementer ( ) ;
while ( len > 0 ) {
int charlen ;
unsigned char * lastchar ;
if ( datatype == BYTEAOID ) charlen = 1 ;
else charlen = len - pg_mbcliplen ( workstr , len , len - 1 ) ;
lastchar = ( unsigned char * ) ( workstr + len - charlen ) ;
while ( charinc ( lastchar , charlen ) ) {
Const * workstr_const ;
if ( datatype == BYTEAOID ) workstr_const = string_to_bytea_const ( workstr , len ) ;
else workstr_const = string_to_const ( workstr , datatype ) ;
if ( DatumGetBool ( FunctionCall2Coll ( ltproc , collation , cmpstr , workstr_const -> constvalue ) ) ) {
if ( cmptxt ) pfree ( cmptxt ) ;
pfree ( workstr ) ;
return workstr_const ;
}
pfree ( DatumGetPointer ( workstr_const -> constvalue ) ) ;
pfree ( workstr_const ) ;
}
len -= charlen ;
workstr [ len ] = '\0' ;
}
if ( cmptxt ) pfree ( cmptxt ) ;
pfree ( workstr ) ;
return NULL ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.