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 inline void SetPixelAlphaTraits ( Image * image , const PixelTrait traits ) {
image -> channel_map [ AlphaPixelChannel ] . traits = traits ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int jpc_pi_nextrlcp ( register jpc_pi_t * pi ) {
jpc_pchg_t * pchg ;
int * prclyrno ;
pchg = pi -> pchg ;
if ( ! pi -> prgvolfirst ) {
assert ( pi -> prcno < pi -> pirlvl -> numprcs ) ;
prclyrno = & pi -> pirlvl -> prclyrnos [ pi -> prcno ] ;
goto skip ;
}
else {
pi -> prgvolfirst = 0 ;
}
for ( pi -> rlvlno = pchg -> rlvlnostart ;
pi -> rlvlno < pi -> maxrlvls && pi -> rlvlno < pchg -> rlvlnoend ;
++ pi -> rlvlno ) {
for ( pi -> lyrno = 0 ;
pi -> lyrno < pi -> numlyrs && pi -> lyrno < JAS_CAST ( int , pchg -> lyrnoend ) ;
++ pi -> lyrno ) {
for ( pi -> compno = pchg -> compnostart , pi -> picomp = & pi -> picomps [ pi -> compno ] ;
pi -> compno < pi -> numcomps && pi -> compno < JAS_CAST ( int , pchg -> compnoend ) ;
++ pi -> compno , ++ pi -> picomp ) {
if ( pi -> rlvlno >= pi -> picomp -> numrlvls ) {
continue ;
}
pi -> pirlvl = & pi -> picomp -> pirlvls [ pi -> rlvlno ] ;
for ( pi -> prcno = 0 , prclyrno = pi -> pirlvl -> prclyrnos ;
pi -> prcno < pi -> pirlvl -> numprcs ;
++ pi -> prcno , ++ prclyrno ) {
if ( pi -> lyrno >= * prclyrno ) {
* prclyrno = pi -> lyrno ;
++ ( * prclyrno ) ;
return 0 ;
}
skip : ;
}
}
}
}
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int parent_proxy_handler ( TSCont contp , TSEvent event , void * edata ) {
ParentTest * ptest = nullptr ;
CHECK_SPURIOUS_EVENT ( contp , event , edata ) ;
ptest = ( ParentTest * ) TSContDataGet ( contp ) ;
ink_release_assert ( ptest ) ;
TSHttpTxn txnp = ( TSHttpTxn ) edata ;
switch ( event ) {
case TS_EVENT_HTTP_READ_REQUEST_HDR : rprintf ( ptest -> regtest , "setting synserver parent proxy to %s:%d\n" , "127.0.0.1" , SYNSERVER_LISTEN_PORT ) ;
TSHttpTxnParentProxySet ( txnp , "127.0.0.1" , SYNSERVER_LISTEN_PORT ) ;
TSHttpTxnHookAdd ( txnp , TS_HTTP_SEND_RESPONSE_HDR_HOOK , contp ) ;
TSHttpTxnHookAdd ( txnp , TS_HTTP_TXN_CLOSE_HOOK , contp ) ;
TSSkipRemappingSet ( txnp , 1 ) ;
TSHttpTxnReenable ( txnp , TS_EVENT_HTTP_CONTINUE ) ;
break ;
case TS_EVENT_TIMEOUT : if ( * ( ptest -> pstatus ) == REGRESSION_TEST_INPROGRESS ) {
if ( ptest -> configured ) {
rprintf ( ptest -> regtest , "waiting for response\n" ) ;
TSContSchedule ( contp , 100 , TS_THREAD_POOL_DEFAULT ) ;
break ;
}
if ( ! ptest -> parent_routing_enabled ( ) ) {
rprintf ( ptest -> regtest , "waiting for configuration\n" ) ;
TSContSchedule ( contp , 100 , TS_THREAD_POOL_DEFAULT ) ;
break ;
}
char * request = generate_request ( 11 ) ;
synclient_txn_send_request ( ptest -> browser , request ) ;
TSfree ( request ) ;
ptest -> configured = true ;
}
else {
RecSetRecordInt ( "proxy.config.http.parent_proxy_routing_enable" , ptest -> parent_proxy_routing_enable , REC_SOURCE_EXPLICIT ) ;
TSContDataSet ( contp , nullptr ) ;
delete ptest ;
}
break ;
case TS_EVENT_HTTP_TXN_CLOSE : if ( * ( ptest -> pstatus ) == REGRESSION_TEST_INPROGRESS ) {
* ( ptest -> pstatus ) = REGRESSION_TEST_FAILED ;
SDK_RPRINT ( ptest -> regtest , "TSHttpTxnParentProxySet" , ptest -> testcase , TC_FAIL , "Failed on txn close" ) ;
}
TSHttpTxnReenable ( txnp , TS_EVENT_HTTP_CONTINUE ) ;
break ;
default : {
int status = ptest -> handler ( contp , event , edata ) ;
if ( status != REGRESSION_TEST_INPROGRESS ) {
int * pstatus = ptest -> pstatus ;
RecSetRecordInt ( "proxy.config.http.parent_proxy_routing_enable" , ptest -> parent_proxy_routing_enable , REC_SOURCE_EXPLICIT ) ;
TSContDataSet ( contp , nullptr ) ;
delete ptest ;
* pstatus = status ;
}
}
}
return TS_EVENT_NONE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static PGconn * _connectDB ( ArchiveHandle * AH , const char * reqdb , const char * requser ) {
PGconn * newConn ;
const char * newdb ;
const char * newuser ;
char * password ;
bool new_pass ;
if ( ! reqdb ) newdb = PQdb ( AH -> connection ) ;
else newdb = reqdb ;
if ( ! requser || strlen ( requser ) == 0 ) newuser = PQuser ( AH -> connection ) ;
else newuser = requser ;
ahlog ( AH , 1 , "connecting to database \"%s\" as user \"%s\"\n" , newdb , newuser ) ;
password = AH -> savedPassword ? pg_strdup ( AH -> savedPassword ) : NULL ;
if ( AH -> promptPassword == TRI_YES && password == NULL ) {
password = simple_prompt ( "Password: " , 100 , false ) ;
if ( password == NULL ) exit_horribly ( modulename , "out of memory\n" ) ;
}
do {
const char * keywords [ 7 ] ;
const char * values [ 7 ] ;
keywords [ 0 ] = "host" ;
values [ 0 ] = PQhost ( AH -> connection ) ;
keywords [ 1 ] = "port" ;
values [ 1 ] = PQport ( AH -> connection ) ;
keywords [ 2 ] = "user" ;
values [ 2 ] = newuser ;
keywords [ 3 ] = "password" ;
values [ 3 ] = password ;
keywords [ 4 ] = "dbname" ;
values [ 4 ] = newdb ;
keywords [ 5 ] = "fallback_application_name" ;
values [ 5 ] = progname ;
keywords [ 6 ] = NULL ;
values [ 6 ] = NULL ;
new_pass = false ;
newConn = PQconnectdbParams ( keywords , values , true ) ;
if ( ! newConn ) exit_horribly ( modulename , "failed to reconnect to database\n" ) ;
if ( PQstatus ( newConn ) == CONNECTION_BAD ) {
if ( ! PQconnectionNeedsPassword ( newConn ) ) exit_horribly ( modulename , "could not reconnect to database: %s" , PQerrorMessage ( newConn ) ) ;
PQfinish ( newConn ) ;
if ( password ) fprintf ( stderr , "Password incorrect\n" ) ;
fprintf ( stderr , "Connecting to %s as %s\n" , newdb , newuser ) ;
if ( password ) free ( password ) ;
if ( AH -> promptPassword != TRI_NO ) password = simple_prompt ( "Password: " , 100 , false ) ;
else exit_horribly ( modulename , "connection needs password\n" ) ;
if ( password == NULL ) exit_horribly ( modulename , "out of memory\n" ) ;
new_pass = true ;
}
}
while ( new_pass ) ;
if ( PQconnectionUsedPassword ( newConn ) ) {
if ( AH -> savedPassword ) free ( AH -> savedPassword ) ;
AH -> savedPassword = pg_strdup ( PQpass ( newConn ) ) ;
}
if ( password ) free ( password ) ;
_check_database_version ( AH ) ;
PQsetNoticeProcessor ( newConn , notice_processor , NULL ) ;
return newConn ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int cmp_simple ( MpegEncContext * s , const int x , const int y , int ref_index , int src_index , me_cmp_func cmp_func , me_cmp_func chroma_cmp_func ) {
return cmp_inline ( s , x , y , 0 , 0 , 0 , 16 , ref_index , src_index , cmp_func , chroma_cmp_func , 0 , 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int ipvideo_decode_block_opcode_0x9 ( IpvideoContext * s ) {
int x , y ;
unsigned char P [ 4 ] ;
bytestream2_get_buffer ( & s -> stream_ptr , P , 4 ) ;
if ( P [ 0 ] <= P [ 1 ] ) {
if ( P [ 2 ] <= P [ 3 ] ) {
for ( y = 0 ;
y < 8 ;
y ++ ) {
int flags = bytestream2_get_le16 ( & s -> stream_ptr ) ;
for ( x = 0 ;
x < 8 ;
x ++ , flags >>= 2 ) * s -> pixel_ptr ++ = P [ flags & 0x03 ] ;
s -> pixel_ptr += s -> line_inc ;
}
}
else {
uint32_t flags ;
flags = bytestream2_get_le32 ( & s -> stream_ptr ) ;
for ( y = 0 ;
y < 8 ;
y += 2 ) {
for ( x = 0 ;
x < 8 ;
x += 2 , flags >>= 2 ) {
s -> pixel_ptr [ x ] = s -> pixel_ptr [ x + 1 ] = s -> pixel_ptr [ x + s -> stride ] = s -> pixel_ptr [ x + 1 + s -> stride ] = P [ flags & 0x03 ] ;
}
s -> pixel_ptr += s -> stride * 2 ;
}
}
}
else {
uint64_t flags ;
flags = bytestream2_get_le64 ( & s -> stream_ptr ) ;
if ( P [ 2 ] <= P [ 3 ] ) {
for ( y = 0 ;
y < 8 ;
y ++ ) {
for ( x = 0 ;
x < 8 ;
x += 2 , flags >>= 2 ) {
s -> pixel_ptr [ x ] = s -> pixel_ptr [ x + 1 ] = P [ flags & 0x03 ] ;
}
s -> pixel_ptr += s -> stride ;
}
}
else {
for ( y = 0 ;
y < 8 ;
y += 2 ) {
for ( x = 0 ;
x < 8 ;
x ++ , flags >>= 2 ) {
s -> pixel_ptr [ x ] = s -> pixel_ptr [ x + s -> stride ] = P [ flags & 0x03 ] ;
}
s -> pixel_ptr += s -> stride * 2 ;
}
}
}
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int test_save_copy ( const char * origname ) {
char buf [ TESTBUFSIZE ] ;
int ret ;
snprintf_func ( buf , TESTBUFSIZE , "cp -f %s %s" , origname , TEST_COPY_FILE ) ;
if ( ( ret = system ( buf ) ) != 0 ) {
return XD3_INTERNAL ;
}
return 0 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , Navigate_Http ) {
StartHttpServer ( ) ;
NavigateTwiceInTabAndClose ( http_test_server_ -> GetURL ( "/simple.html" ) , GURL ( chrome : : kChromeUIVersionURL ) ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 1 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 0 ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static uint_fast32_t inttobits ( jas_seqent_t v , int prec , bool sgnd ) {
uint_fast32_t ret ;
ret = ( ( sgnd && v < 0 ) ? ( ( 1 << prec ) + v ) : v ) & JAS_ONES ( prec ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int aura_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * pkt ) {
AuraDecodeContext * s = avctx -> priv_data ;
uint8_t * Y , * U , * V ;
uint8_t val ;
int x , y , ret ;
const uint8_t * buf = pkt -> data ;
const int8_t * delta_table = ( const int8_t * ) buf + 16 ;
if ( pkt -> size != 48 + avctx -> height * avctx -> width ) {
av_log ( avctx , AV_LOG_ERROR , "got a buffer with %d bytes when %d were expected\n" , pkt -> size , 48 + avctx -> height * avctx -> width ) ;
return AVERROR_INVALIDDATA ;
}
buf += 48 ;
if ( s -> frame . data [ 0 ] ) avctx -> release_buffer ( avctx , & s -> frame ) ;
s -> frame . buffer_hints = FF_BUFFER_HINTS_VALID ;
s -> frame . reference = 0 ;
if ( ( ret = ff_get_buffer ( avctx , & s -> frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
Y = s -> frame . data [ 0 ] ;
U = s -> frame . data [ 1 ] ;
V = s -> frame . data [ 2 ] ;
for ( y = 0 ;
y < avctx -> height ;
y ++ ) {
val = * buf ++ ;
U [ 0 ] = val & 0xF0 ;
Y [ 0 ] = val << 4 ;
val = * buf ++ ;
V [ 0 ] = val & 0xF0 ;
Y [ 1 ] = Y [ 0 ] + delta_table [ val & 0xF ] ;
Y += 2 ;
U ++ ;
V ++ ;
for ( x = 1 ;
x < ( avctx -> width >> 1 ) ;
x ++ ) {
val = * buf ++ ;
U [ 0 ] = U [ - 1 ] + delta_table [ val >> 4 ] ;
Y [ 0 ] = Y [ - 1 ] + delta_table [ val & 0xF ] ;
val = * buf ++ ;
V [ 0 ] = V [ - 1 ] + delta_table [ val >> 4 ] ;
Y [ 1 ] = Y [ 0 ] + delta_table [ val & 0xF ] ;
Y += 2 ;
U ++ ;
V ++ ;
}
Y += s -> frame . linesize [ 0 ] - avctx -> width ;
U += s -> frame . linesize [ 1 ] - ( avctx -> width >> 1 ) ;
V += s -> frame . linesize [ 2 ] - ( avctx -> width >> 1 ) ;
}
* got_frame = 1 ;
* ( AVFrame * ) data = s -> frame ;
return pkt -> size ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static picture_t * DecodeBlock ( decoder_t * p_dec , block_t * * pp_block ) {
decoder_sys_t * p_sys = p_dec -> p_sys ;
if ( ! pp_block ) return NULL ;
if ( * pp_block ) {
block_t * p_block = * pp_block ;
if ( p_block -> i_flags & BLOCK_FLAG_DISCONTINUITY ) {
schro_decoder_reset ( p_sys -> p_schro ) ;
p_sys -> i_lastpts = VLC_TS_INVALID ;
block_Release ( p_block ) ;
* pp_block = NULL ;
return NULL ;
}
SchroBuffer * p_schrobuffer ;
p_schrobuffer = schro_buffer_new_with_data ( p_block -> p_buffer , p_block -> i_buffer ) ;
p_schrobuffer -> free = SchroBufferFree ;
p_schrobuffer -> priv = p_block ;
if ( p_block -> i_pts > VLC_TS_INVALID ) {
mtime_t * p_pts = malloc ( sizeof ( * p_pts ) ) ;
if ( p_pts ) {
* p_pts = p_block -> i_pts ;
p_schrobuffer -> tag = schro_tag_new ( p_pts , free ) ;
}
}
* pp_block = NULL ;
schro_decoder_autoparse_push ( p_sys -> p_schro , p_schrobuffer ) ;
}
while ( 1 ) {
SchroFrame * p_schroframe ;
picture_t * p_pic ;
int state = schro_decoder_autoparse_wait ( p_sys -> p_schro ) ;
switch ( state ) {
case SCHRO_DECODER_FIRST_ACCESS_UNIT : SetVideoFormat ( p_dec ) ;
break ;
case SCHRO_DECODER_NEED_BITS : return NULL ;
case SCHRO_DECODER_NEED_FRAME : p_schroframe = CreateSchroFrameFromPic ( p_dec ) ;
if ( ! p_schroframe ) {
msg_Err ( p_dec , "Could not allocate picture for decoder" ) ;
return NULL ;
}
schro_decoder_add_output_picture ( p_sys -> p_schro , p_schroframe ) ;
break ;
case SCHRO_DECODER_OK : {
SchroTag * p_tag = schro_decoder_get_picture_tag ( p_sys -> p_schro ) ;
p_schroframe = schro_decoder_pull ( p_sys -> p_schro ) ;
if ( ! p_schroframe || ! p_schroframe -> priv ) {
if ( p_tag ) schro_tag_free ( p_tag ) ;
if ( p_schroframe ) schro_frame_unref ( p_schroframe ) ;
break ;
}
p_pic = ( ( struct picture_free_t * ) p_schroframe -> priv ) -> p_pic ;
p_schroframe -> priv = NULL ;
if ( p_tag ) {
p_pic -> date = * ( mtime_t * ) p_tag -> value ;
schro_tag_free ( p_tag ) ;
}
else if ( p_sys -> i_lastpts > VLC_TS_INVALID ) {
p_pic -> date = p_sys -> i_lastpts + p_sys -> i_frame_pts_delta ;
}
p_sys -> i_lastpts = p_pic -> date ;
schro_frame_unref ( p_schroframe ) ;
return p_pic ;
}
case SCHRO_DECODER_EOS : break ;
case SCHRO_DECODER_ERROR : msg_Err ( p_dec , "SCHRO_DECODER_ERROR" ) ;
return NULL ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static cmsStage * ReadCLUT ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number Offset , int InputChannels , int OutputChannels ) {
cmsUInt8Number gridPoints8 [ cmsMAXCHANNELS ] ;
cmsUInt32Number GridPoints [ cmsMAXCHANNELS ] , i ;
cmsUInt8Number Precision ;
cmsStage * CLUT ;
_cmsStageCLutData * Data ;
if ( ! io -> Seek ( io , Offset ) ) return NULL ;
if ( io -> Read ( io , gridPoints8 , cmsMAXCHANNELS , 1 ) != 1 ) return NULL ;
for ( i = 0 ;
i < cmsMAXCHANNELS ;
i ++ ) {
if ( gridPoints8 [ i ] == 1 ) return NULL ;
GridPoints [ i ] = gridPoints8 [ i ] ;
}
if ( ! _cmsReadUInt8Number ( io , & Precision ) ) return NULL ;
if ( ! _cmsReadUInt8Number ( io , NULL ) ) return NULL ;
if ( ! _cmsReadUInt8Number ( io , NULL ) ) return NULL ;
if ( ! _cmsReadUInt8Number ( io , NULL ) ) return NULL ;
CLUT = cmsStageAllocCLut16bitGranular ( self -> ContextID , GridPoints , InputChannels , OutputChannels , NULL ) ;
if ( CLUT == NULL ) return NULL ;
Data = ( _cmsStageCLutData * ) CLUT -> Data ;
if ( Precision == 1 ) {
cmsUInt8Number v ;
for ( i = 0 ;
i < Data -> nEntries ;
i ++ ) {
if ( io -> Read ( io , & v , sizeof ( cmsUInt8Number ) , 1 ) != 1 ) return NULL ;
Data -> Tab . T [ i ] = FROM_8_TO_16 ( v ) ;
}
}
else if ( Precision == 2 ) {
if ( ! _cmsReadUInt16Array ( io , Data -> nEntries , Data -> Tab . T ) ) {
cmsStageFree ( CLUT ) ;
return NULL ;
}
}
else {
cmsStageFree ( CLUT ) ;
cmsSignalError ( self -> ContextID , cmsERROR_UNKNOWN_EXTENSION , "Unknown precision of '%d'" , Precision ) ;
return NULL ;
}
return CLUT ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int8_t highBit ( int32_t value ) {
int8_t bit = 0 ;
if ( value <= 0 ) {
return - 32 ;
}
if ( value >= 1 << 16 ) {
value >>= 16 ;
bit += 16 ;
}
if ( value >= 1 << 8 ) {
value >>= 8 ;
bit += 8 ;
}
if ( value >= 1 << 4 ) {
value >>= 4 ;
bit += 4 ;
}
if ( value >= 1 << 2 ) {
value >>= 2 ;
bit += 2 ;
}
if ( value >= 1 << 1 ) {
bit += 1 ;
}
return bit ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void close_detect_done ( struct evhttp_request * req , void * arg ) {
struct timeval tv ;
if ( req == NULL || req -> response_code != HTTP_OK ) {
fprintf ( stderr , "FAILED\n" ) ;
exit ( 1 ) ;
}
test_ok = 1 ;
timerclear ( & tv ) ;
tv . tv_sec = 3 ;
event_loopexit ( & tv ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_build_inter_predictors_sb ( MACROBLOCKD * xd , int mi_row , int mi_col , BLOCK_SIZE bsize ) {
build_inter_predictors_for_planes ( xd , bsize , mi_row , mi_col , 0 , MAX_MB_PLANE - 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gint64 ascend_seek ( wtap * wth , int * err , gchar * * err_info ) {
int byte ;
gint64 date_off = - 1 , cur_off , packet_off ;
size_t string_level [ ASCEND_MAGIC_STRINGS ] ;
guint string_i = 0 , type = 0 ;
guint excessive_read_count = 262144 ;
memset ( & string_level , 0 , sizeof ( string_level ) ) ;
while ( ( ( byte = file_getc ( wth -> fh ) ) != EOF ) ) {
excessive_read_count -- ;
if ( ! excessive_read_count ) {
* err = 0 ;
return - 1 ;
}
for ( string_i = 0 ;
string_i < ASCEND_MAGIC_STRINGS ;
string_i ++ ) {
const gchar * strptr = ascend_magic [ string_i ] . strptr ;
size_t len = strlen ( strptr ) ;
if ( byte == * ( strptr + string_level [ string_i ] ) ) {
string_level [ string_i ] ++ ;
if ( string_level [ string_i ] >= len ) {
cur_off = file_tell ( wth -> fh ) ;
if ( cur_off == - 1 ) {
* err = file_error ( wth -> fh , err_info ) ;
return - 1 ;
}
if ( strcmp ( strptr , ASCEND_DATE ) == 0 ) {
date_off = cur_off - len ;
string_level [ string_i ] = 0 ;
}
else {
if ( date_off == - 1 ) {
packet_off = cur_off - len ;
}
else {
packet_off = date_off ;
}
type = ascend_magic [ string_i ] . type ;
goto found ;
}
}
}
else {
string_level [ string_i ] = 0 ;
}
}
}
* err = file_error ( wth -> fh , err_info ) ;
return - 1 ;
found : if ( file_seek ( wth -> fh , packet_off , SEEK_SET , err ) == - 1 ) return - 1 ;
wth -> phdr . pseudo_header . ascend . type = type ;
return packet_off ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void rpc_test ( void ) {
struct msg * msg , * msg2 ;
struct kill * attack ;
struct run * run ;
struct evbuffer * tmp = evbuffer_new ( ) ;
struct timeval tv_start , tv_end ;
uint32_t tag ;
int i ;
fprintf ( stdout , "Testing RPC: " ) ;
msg = msg_new ( ) ;
EVTAG_ASSIGN ( msg , from_name , "niels" ) ;
EVTAG_ASSIGN ( msg , to_name , "phoenix" ) ;
if ( EVTAG_GET ( msg , attack , & attack ) == - 1 ) {
fprintf ( stderr , "Failed to set kill message.\n" ) ;
exit ( 1 ) ;
}
EVTAG_ASSIGN ( attack , weapon , "feather" ) ;
EVTAG_ASSIGN ( attack , action , "tickle" ) ;
evutil_gettimeofday ( & tv_start , NULL ) ;
for ( i = 0 ;
i < 1000 ;
++ i ) {
run = EVTAG_ADD ( msg , run ) ;
if ( run == NULL ) {
fprintf ( stderr , "Failed to add run message.\n" ) ;
exit ( 1 ) ;
}
EVTAG_ASSIGN ( run , how , "very fast but with some data in it" ) ;
EVTAG_ASSIGN ( run , fixed_bytes , ( unsigned char * ) "012345678901234567890123" ) ;
}
if ( msg_complete ( msg ) == - 1 ) {
fprintf ( stderr , "Failed to make complete message.\n" ) ;
exit ( 1 ) ;
}
evtag_marshal_msg ( tmp , 0xdeaf , msg ) ;
if ( evtag_peek ( tmp , & tag ) == - 1 ) {
fprintf ( stderr , "Failed to peak tag.\n" ) ;
exit ( 1 ) ;
}
if ( tag != 0xdeaf ) {
fprintf ( stderr , "Got incorrect tag: %0x.\n" , tag ) ;
exit ( 1 ) ;
}
msg2 = msg_new ( ) ;
if ( evtag_unmarshal_msg ( tmp , 0xdeaf , msg2 ) == - 1 ) {
fprintf ( stderr , "Failed to unmarshal message.\n" ) ;
exit ( 1 ) ;
}
evutil_gettimeofday ( & tv_end , NULL ) ;
evutil_timersub ( & tv_end , & tv_start , & tv_end ) ;
fprintf ( stderr , "(%.1f us/add) " , ( float ) tv_end . tv_sec / ( float ) i * 1000000.0 + tv_end . tv_usec / ( float ) i ) ;
if ( ! EVTAG_HAS ( msg2 , from_name ) || ! EVTAG_HAS ( msg2 , to_name ) || ! EVTAG_HAS ( msg2 , attack ) ) {
fprintf ( stderr , "Missing data structures.\n" ) ;
exit ( 1 ) ;
}
if ( EVTAG_LEN ( msg2 , run ) != i ) {
fprintf ( stderr , "Wrong number of run messages.\n" ) ;
exit ( 1 ) ;
}
msg_free ( msg ) ;
msg_free ( msg2 ) ;
evbuffer_free ( tmp ) ;
fprintf ( stdout , "OK\n" ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | hb_bool_t _hb_graphite2_shape ( hb_shape_plan_t * shape_plan , hb_font_t * font , hb_buffer_t * buffer , const hb_feature_t * features , unsigned int num_features ) {
hb_face_t * face = font -> face ;
gr_face * grface = HB_SHAPER_DATA_GET ( face ) -> grface ;
gr_font * grfont = HB_SHAPER_DATA_GET ( font ) ;
const char * lang = hb_language_to_string ( hb_buffer_get_language ( buffer ) ) ;
const char * lang_end = lang ? strchr ( lang , '-' ) : NULL ;
int lang_len = lang_end ? lang_end - lang : - 1 ;
gr_feature_val * feats = gr_face_featureval_for_lang ( grface , lang ? hb_tag_from_string ( lang , lang_len ) : 0 ) ;
while ( num_features -- ) {
const gr_feature_ref * fref = gr_face_find_fref ( grface , features -> tag ) ;
if ( fref ) gr_fref_set_feature_value ( fref , features -> value , feats ) ;
features ++ ;
}
gr_segment * seg = NULL ;
const gr_slot * is ;
unsigned int ci = 0 , ic = 0 ;
float curradvx = 0. , curradvy = 0. ;
unsigned int scratch_size ;
hb_buffer_t : : scratch_buffer_t * scratch = buffer -> get_scratch_buffer ( & scratch_size ) ;
uint32_t * chars = ( uint32_t * ) scratch ;
for ( unsigned int i = 0 ;
i < buffer -> len ;
++ i ) chars [ i ] = buffer -> info [ i ] . codepoint ;
hb_tag_t script_tag [ 2 ] ;
hb_ot_tags_from_script ( hb_buffer_get_script ( buffer ) , & script_tag [ 0 ] , & script_tag [ 1 ] ) ;
seg = gr_make_seg ( grfont , grface , script_tag [ 1 ] == HB_TAG_NONE ? script_tag [ 0 ] : script_tag [ 1 ] , feats , gr_utf32 , chars , buffer -> len , | ( hb_buffer_get_direction ( buffer ) == HB_DIRECTION_RTL ? 1 : 0 ) ) ;
if ( unlikely ( ! seg ) ) {
if ( feats ) gr_featureval_destroy ( feats ) ;
return false ;
}
unsigned int glyph_count = gr_seg_n_slots ( seg ) ;
if ( unlikely ( ! glyph_count ) ) {
if ( feats ) gr_featureval_destroy ( feats ) ;
gr_seg_destroy ( seg ) ;
return false ;
}
scratch = buffer -> get_scratch_buffer ( & scratch_size ) ;
while ( ( DIV_CEIL ( sizeof ( hb_graphite2_cluster_t ) * buffer -> len , sizeof ( * scratch ) ) + DIV_CEIL ( sizeof ( hb_codepoint_t ) * glyph_count , sizeof ( * scratch ) ) ) > scratch_size ) {
if ( unlikely ( ! buffer -> ensure ( buffer -> allocated * 2 ) ) ) {
if ( feats ) gr_featureval_destroy ( feats ) ;
gr_seg_destroy ( seg ) ;
return false ;
}
scratch = buffer -> get_scratch_buffer ( & scratch_size ) ;
}
# define ALLOCATE_ARRAY ( Type , name , len ) Type * name = ( Type * ) scratch ;
{
unsigned int _consumed = DIV_CEIL ( ( len ) * sizeof ( Type ) , sizeof ( * scratch ) ) ;
assert ( _consumed <= scratch_size ) ;
scratch += _consumed ;
scratch_size -= _consumed ;
}
ALLOCATE_ARRAY ( hb_graphite2_cluster_t , clusters , buffer -> len ) ;
ALLOCATE_ARRAY ( hb_codepoint_t , gids , glyph_count ) ;
# undef ALLOCATE_ARRAY memset ( clusters , 0 , sizeof ( clusters [ 0 ] ) * buffer -> len ) ;
hb_codepoint_t * pg = gids ;
clusters [ 0 ] . cluster = buffer -> info [ 0 ] . cluster ;
for ( is = gr_seg_first_slot ( seg ) , ic = 0 ;
is ;
is = gr_slot_next_in_segment ( is ) , ic ++ ) {
unsigned int before = gr_slot_before ( is ) ;
unsigned int after = gr_slot_after ( is ) ;
* pg = gr_slot_gid ( is ) ;
pg ++ ;
while ( clusters [ ci ] . base_char > before && ci ) {
clusters [ ci - 1 ] . num_chars += clusters [ ci ] . num_chars ;
clusters [ ci - 1 ] . num_glyphs += clusters [ ci ] . num_glyphs ;
ci -- ;
}
if ( gr_slot_can_insert_before ( is ) && clusters [ ci ] . num_chars && before >= clusters [ ci ] . base_char + clusters [ ci ] . num_chars ) {
hb_graphite2_cluster_t * c = clusters + ci + 1 ;
c -> base_char = clusters [ ci ] . base_char + clusters [ ci ] . num_chars ;
c -> cluster = buffer -> info [ c -> base_char ] . cluster ;
c -> num_chars = before - c -> base_char ;
c -> base_glyph = ic ;
c -> num_glyphs = 0 ;
ci ++ ;
}
clusters [ ci ] . num_glyphs ++ ;
if ( clusters [ ci ] . base_char + clusters [ ci ] . num_chars < after + 1 ) clusters [ ci ] . num_chars = after + 1 - clusters [ ci ] . base_char ;
}
ci ++ ;
for ( unsigned int i = 0 ;
i < ci ;
++ i ) {
for ( unsigned int j = 0 ;
j < clusters [ i ] . num_glyphs ;
++ j ) {
hb_glyph_info_t * info = & buffer -> info [ clusters [ i ] . base_glyph + j ] ;
info -> codepoint = gids [ clusters [ i ] . base_glyph + j ] ;
info -> cluster = clusters [ i ] . cluster ;
}
}
buffer -> len = glyph_count ;
if ( HB_DIRECTION_IS_BACKWARD ( buffer -> props . direction ) ) curradvx = gr_seg_advance_X ( seg ) ;
hb_glyph_position_t * pPos ;
for ( pPos = hb_buffer_get_glyph_positions ( buffer , NULL ) , is = gr_seg_first_slot ( seg ) ;
is ;
pPos ++ , is = gr_slot_next_in_segment ( is ) ) {
pPos -> x_offset = gr_slot_origin_X ( is ) - curradvx ;
pPos -> y_offset = gr_slot_origin_Y ( is ) - curradvy ;
pPos -> x_advance = gr_slot_advance_X ( is , grface , grfont ) ;
pPos -> y_advance = gr_slot_advance_Y ( is , grface , grfont ) ;
if ( HB_DIRECTION_IS_BACKWARD ( buffer -> props . direction ) ) curradvx -= pPos -> x_advance ;
pPos -> x_offset = gr_slot_origin_X ( is ) - curradvx ;
if ( ! HB_DIRECTION_IS_BACKWARD ( buffer -> props . direction ) ) curradvx += pPos -> x_advance ;
pPos -> y_offset = gr_slot_origin_Y ( is ) - curradvy ;
curradvy += pPos -> y_advance ;
}
if ( ! HB_DIRECTION_IS_BACKWARD ( buffer -> props . direction ) ) pPos [ - 1 ] . x_advance += gr_seg_advance_X ( seg ) - curradvx ;
if ( HB_DIRECTION_IS_BACKWARD ( buffer -> props . direction ) ) hb_buffer_reverse_clusters ( buffer ) ;
if ( feats ) gr_featureval_destroy ( feats ) ;
gr_seg_destroy ( seg ) ;
return true ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( BlockedAppApiTest , MAYBE_OpenAppFromIframe ) {
const Extension * app = LoadExtension ( test_data_dir_ . AppendASCII ( "app_process" ) ) ;
ASSERT_TRUE ( app ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , GetTestBaseURL ( "app_process" ) . Resolve ( "path3/container.html" ) ) ;
WebContents * tab = browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ;
PopupBlockerTabHelper * popup_blocker_tab_helper = PopupBlockerTabHelper : : FromWebContents ( tab ) ;
if ( ! popup_blocker_tab_helper -> GetBlockedPopupsCount ( ) ) {
content : : WindowedNotificationObserver observer ( chrome : : NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED , content : : NotificationService : : AllSources ( ) ) ;
observer . Wait ( ) ;
}
EXPECT_EQ ( 1u , popup_blocker_tab_helper -> GetBlockedPopupsCount ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * convert_mime_hdr_to_string ( TSMBuffer bufp , TSMLoc hdr_loc ) {
TSIOBuffer output_buffer ;
TSIOBufferReader reader ;
int64_t total_avail ;
TSIOBufferBlock block ;
const char * block_start ;
int64_t block_avail ;
char * output_string ;
int output_len ;
output_buffer = TSIOBufferCreate ( ) ;
if ( ! output_buffer ) {
TSError ( "[InkAPITest] couldn't allocate IOBuffer" ) ;
}
reader = TSIOBufferReaderAlloc ( output_buffer ) ;
TSMimeHdrPrint ( bufp , hdr_loc , output_buffer ) ;
total_avail = TSIOBufferReaderAvail ( reader ) ;
output_string = ( char * ) TSmalloc ( total_avail + 1 ) ;
output_len = 0 ;
block = TSIOBufferReaderStart ( reader ) ;
while ( block ) {
block_start = TSIOBufferBlockReadStart ( block , reader , & block_avail ) ;
if ( block_avail == 0 ) {
break ;
}
memcpy ( output_string + output_len , block_start , block_avail ) ;
output_len += block_avail ;
TSIOBufferReaderConsume ( reader , block_avail ) ;
block = TSIOBufferReaderStart ( reader ) ;
}
output_string [ output_len ] = '\0' ;
output_len ++ ;
TSIOBufferReaderFree ( reader ) ;
TSIOBufferDestroy ( output_buffer ) ;
return output_string ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | WORK_STATE tls_post_process_client_key_exchange ( SSL * s , WORK_STATE wst ) {
# ifndef OPENSSL_NO_SCTP if ( wst == WORK_MORE_A ) {
if ( SSL_IS_DTLS ( s ) ) {
unsigned char sctpauthkey [ 64 ] ;
char labelbuffer [ sizeof ( DTLS1_SCTP_AUTH_LABEL ) ] ;
memcpy ( labelbuffer , DTLS1_SCTP_AUTH_LABEL , sizeof ( DTLS1_SCTP_AUTH_LABEL ) ) ;
if ( SSL_export_keying_material ( s , sctpauthkey , sizeof ( sctpauthkey ) , labelbuffer , sizeof ( labelbuffer ) , NULL , 0 , 0 ) <= 0 ) {
ossl_statem_set_error ( s ) ;
return WORK_ERROR ;
;
}
BIO_ctrl ( SSL_get_wbio ( s ) , BIO_CTRL_DGRAM_SCTP_ADD_AUTH_KEY , sizeof ( sctpauthkey ) , sctpauthkey ) ;
}
wst = WORK_MORE_B ;
}
if ( ( wst == WORK_MORE_B ) && BIO_dgram_is_sctp ( SSL_get_wbio ( s ) ) && s -> renegotiate && ( s -> session -> peer == NULL || s -> statem . no_cert_verify ) && BIO_dgram_sctp_msg_waiting ( SSL_get_rbio ( s ) ) ) {
s -> s3 -> in_read_app_data = 2 ;
s -> rwstate = SSL_READING ;
BIO_clear_retry_flags ( SSL_get_rbio ( s ) ) ;
BIO_set_retry_read ( SSL_get_rbio ( s ) ) ;
ossl_statem_set_sctp_read_sock ( s , 1 ) ;
return WORK_MORE_B ;
}
else {
ossl_statem_set_sctp_read_sock ( s , 0 ) ;
}
# endif if ( s -> statem . no_cert_verify || ! s -> session -> peer ) {
if ( ! ssl3_digest_cached_records ( s , 0 ) ) {
ossl_statem_set_error ( s ) ;
return WORK_ERROR ;
}
return WORK_FINISHED_CONTINUE ;
}
else {
if ( ! s -> s3 -> handshake_buffer ) {
SSLerr ( SSL_F_TLS_POST_PROCESS_CLIENT_KEY_EXCHANGE , ERR_R_INTERNAL_ERROR ) ;
ossl_statem_set_error ( s ) ;
return WORK_ERROR ;
}
if ( ! ssl3_digest_cached_records ( s , 1 ) ) {
ossl_statem_set_error ( s ) ;
return WORK_ERROR ;
}
}
return WORK_FINISHED_CONTINUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_P ( SupervisedUserNavigationThrottleNotSupervisedTest , DontBlock ) {
BlockHost ( kExampleHost ) ;
GURL blocked_url = embedded_test_server ( ) -> GetURL ( kExampleHost , "/supervised_user/simple.html" ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , blocked_url ) ;
EXPECT_FALSE ( IsInterstitialBeingShown ( browser ( ) ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void clamp_lab ( const fz_colorspace * cs , const float * src , float * dst ) {
int i ;
for ( i = 0 ;
i < 3 ;
i ++ ) dst [ i ] = fz_clamp ( src [ i ] , i ? - 128 : 0 , i ? 127 : 100 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void fz_set_default_cmyk ( fz_context * ctx , fz_default_colorspaces * default_cs , fz_colorspace * cs ) {
if ( cs -> n == 4 ) {
fz_drop_colorspace ( ctx , default_cs -> cmyk ) ;
default_cs -> cmyk = fz_keep_colorspace ( ctx , cs ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | IN_PROC_BROWSER_TEST_F ( AppApiTest , DISABLED_AppProcessRedirectBack ) {
ASSERT_TRUE ( LoadExtension ( test_data_dir_ . AppendASCII ( "app_process" ) ) ) ;
GURL base_url = GetTestBaseURL ( "app_process" ) ;
chrome : : NewTab ( browser ( ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , base_url . Resolve ( "path1/empty.html" ) ) ;
chrome : : NewTab ( browser ( ) ) ;
ui_test_utils : : NavigateToURLBlockUntilNavigationsComplete ( browser ( ) , base_url . Resolve ( "path1/redirect.html" ) , 2 ) ;
ASSERT_EQ ( 3 , browser ( ) -> tab_strip_model ( ) -> count ( ) ) ;
EXPECT_EQ ( "/extensions/api_test/app_process/path1/empty.html" , browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 2 ) -> GetController ( ) . GetLastCommittedEntry ( ) -> GetURL ( ) . path ( ) ) ;
EXPECT_EQ ( browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 1 ) -> GetRenderProcessHost ( ) , browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 2 ) -> GetRenderProcessHost ( ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void gtkui_connections_detach ( GtkWidget * child ) {
conns_window = gtk_window_new ( GTK_WINDOW_TOPLEVEL ) ;
gtk_window_set_title ( GTK_WINDOW ( conns_window ) , "Live connections" ) ;
gtk_window_set_default_size ( GTK_WINDOW ( conns_window ) , 500 , 250 ) ;
g_signal_connect ( G_OBJECT ( conns_window ) , "delete_event" , G_CALLBACK ( gtkui_kill_connections ) , NULL ) ;
gtkui_page_attach_shortcut ( conns_window , gtkui_connections_attach ) ;
gtk_container_add ( GTK_CONTAINER ( conns_window ) , child ) ;
gtk_window_present ( GTK_WINDOW ( conns_window ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint dump_routines_for_db ( char * db ) {
char query_buff [ QUERY_LENGTH ] ;
const char * routine_type [ ] = {
"FUNCTION" , "PROCEDURE" }
;
char db_name_buff [ NAME_LEN * 2 + 3 ] , name_buff [ NAME_LEN * 2 + 3 ] ;
char * routine_name ;
int i ;
FILE * sql_file = md_result_file ;
MYSQL_RES * routine_res , * routine_list_res ;
MYSQL_ROW row , routine_list_row ;
char db_cl_name [ MY_CS_NAME_SIZE ] ;
int db_cl_altered = FALSE ;
DBUG_ENTER ( "dump_routines_for_db" ) ;
DBUG_PRINT ( "enter" , ( "db: '%s'" , db ) ) ;
mysql_real_escape_string ( mysql , db_name_buff , db , ( ulong ) strlen ( db ) ) ;
print_comment ( sql_file , 0 , "\n--\n-- Dumping routines for database '%s'\n--\n" , fix_for_comment ( db ) ) ;
if ( lock_tables ) mysql_query ( mysql , "LOCK TABLES mysql.proc READ" ) ;
if ( fetch_db_collation ( db , db_cl_name , sizeof ( db_cl_name ) ) ) DBUG_RETURN ( 1 ) ;
if ( switch_character_set_results ( mysql , "binary" ) ) DBUG_RETURN ( 1 ) ;
if ( opt_xml ) fputs ( "\t<routines>\n" , sql_file ) ;
for ( i = 0 ;
i <= 1 ;
i ++ ) {
my_snprintf ( query_buff , sizeof ( query_buff ) , "SHOW %s STATUS WHERE Db = '%s'" , routine_type [ i ] , db_name_buff ) ;
if ( mysql_query_with_error_report ( mysql , & routine_list_res , query_buff ) ) DBUG_RETURN ( 1 ) ;
if ( mysql_num_rows ( routine_list_res ) ) {
while ( ( routine_list_row = mysql_fetch_row ( routine_list_res ) ) ) {
routine_name = quote_name ( routine_list_row [ 1 ] , name_buff , 0 ) ;
DBUG_PRINT ( "info" , ( "retrieving CREATE %s for %s" , routine_type [ i ] , name_buff ) ) ;
my_snprintf ( query_buff , sizeof ( query_buff ) , "SHOW CREATE %s %s" , routine_type [ i ] , routine_name ) ;
if ( mysql_query_with_error_report ( mysql , & routine_res , query_buff ) ) DBUG_RETURN ( 1 ) ;
while ( ( row = mysql_fetch_row ( routine_res ) ) ) {
DBUG_PRINT ( "info" , ( "length of body for %s row[2] '%s' is %zu" , routine_name , row [ 2 ] ? row [ 2 ] : "(null)" , row [ 2 ] ? strlen ( row [ 2 ] ) : 0 ) ) ;
if ( row [ 2 ] == NULL ) {
print_comment ( sql_file , 1 , "\n-- insufficient privileges to %s\n" , query_buff ) ;
print_comment ( sql_file , 1 , "-- does %s have permissions on mysql.proc?\n\n" , current_user ) ;
maybe_die ( EX_MYSQLERR , "%s has insufficent privileges to %s!" , current_user , query_buff ) ;
}
else if ( strlen ( row [ 2 ] ) ) {
if ( opt_xml ) {
if ( i ) print_xml_row ( sql_file , "routine" , routine_res , & row , "Create Procedure" ) ;
else print_xml_row ( sql_file , "routine" , routine_res , & row , "Create Function" ) ;
continue ;
}
if ( opt_drop ) fprintf ( sql_file , "/*!50003 DROP %s IF EXISTS %s */;
\n" , routine_type [ i ] , routine_name ) ;
if ( mysql_num_fields ( routine_res ) >= 6 ) {
if ( switch_db_collation ( sql_file , db , ";
" , db_cl_name , row [ 5 ] , & db_cl_altered ) ) {
DBUG_RETURN ( 1 ) ;
}
switch_cs_variables ( sql_file , ";
" , row [ 3 ] , row [ 3 ] , row [ 4 ] ) ;
}
else {
fprintf ( sql_file , "--\n" "-- WARNING: old server version. " "The following dump may be incomplete.\n" "--\n" ) ;
}
switch_sql_mode ( sql_file , ";
" , row [ 1 ] ) ;
fprintf ( sql_file , "DELIMITER ;
;
\n" "%s ;
;
\n" "DELIMITER ;
\n" , ( const char * ) row [ 2 ] ) ;
restore_sql_mode ( sql_file , ";
" ) ;
if ( mysql_num_fields ( routine_res ) >= 6 ) {
restore_cs_variables ( sql_file , ";
" ) ;
if ( db_cl_altered ) {
if ( restore_db_collation ( sql_file , db , ";
" , db_cl_name ) ) DBUG_RETURN ( 1 ) ;
}
}
}
}
mysql_free_result ( routine_res ) ;
}
}
mysql_free_result ( routine_list_res ) ;
}
if ( opt_xml ) {
fputs ( "\t</routines>\n" , sql_file ) ;
check_io ( sql_file ) ;
}
if ( switch_character_set_results ( mysql , default_charset ) ) DBUG_RETURN ( 1 ) ;
if ( lock_tables ) ( void ) mysql_query_with_error_report ( mysql , 0 , "UNLOCK TABLES" ) ;
DBUG_RETURN ( 0 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void * Type_Text_Dup ( struct _cms_typehandler_struct * self , const void * Ptr , cmsUInt32Number n ) {
return ( void * ) cmsMLUdup ( ( cmsMLU * ) Ptr ) ;
cmsUNUSED_PARAMETER ( n ) ;
cmsUNUSED_PARAMETER ( self ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_fdct32x32_c ( const int16_t * input , int16_t * out , int stride ) {
int i , j ;
int output [ 32 * 32 ] ;
for ( i = 0 ;
i < 32 ;
++ i ) {
int temp_in [ 32 ] , temp_out [ 32 ] ;
for ( j = 0 ;
j < 32 ;
++ j ) temp_in [ j ] = input [ j * stride + i ] * 4 ;
fdct32 ( temp_in , temp_out , 0 ) ;
for ( j = 0 ;
j < 32 ;
++ j ) output [ j * 32 + i ] = ( temp_out [ j ] + 1 + ( temp_out [ j ] > 0 ) ) >> 2 ;
}
for ( i = 0 ;
i < 32 ;
++ i ) {
int temp_in [ 32 ] , temp_out [ 32 ] ;
for ( j = 0 ;
j < 32 ;
++ j ) temp_in [ j ] = output [ j + i * 32 ] ;
fdct32 ( temp_in , temp_out , 0 ) ;
for ( j = 0 ;
j < 32 ;
++ j ) out [ j + i * 32 ] = ( temp_out [ j ] + 1 + ( temp_out [ j ] < 0 ) ) >> 2 ;
}
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | int dtls1_retransmit_message ( SSL * s , unsigned short seq , unsigned long frag_off , int * found ) {
int ret ;
pitem * item ;
hm_fragment * frag ;
unsigned long header_length ;
unsigned char seq64be [ 8 ] ;
struct dtls1_retransmit_state saved_state ;
unsigned char save_write_sequence [ 8 ] ;
memset ( seq64be , 0 , sizeof ( seq64be ) ) ;
seq64be [ 6 ] = ( unsigned char ) ( seq >> 8 ) ;
seq64be [ 7 ] = ( unsigned char ) seq ;
item = pqueue_find ( s -> d1 -> sent_messages , seq64be ) ;
if ( item == NULL ) {
fprintf ( stderr , "retransmit: message %d non-existant\n" , seq ) ;
* found = 0 ;
return 0 ;
}
* found = 1 ;
frag = ( hm_fragment * ) item -> data ;
if ( frag -> msg_header . is_ccs ) header_length = DTLS1_CCS_HEADER_LENGTH ;
else header_length = DTLS1_HM_HEADER_LENGTH ;
memcpy ( s -> init_buf -> data , frag -> fragment , frag -> msg_header . msg_len + header_length ) ;
s -> init_num = frag -> msg_header . msg_len + header_length ;
dtls1_set_message_header_int ( s , frag -> msg_header . type , frag -> msg_header . msg_len , frag -> msg_header . seq , 0 , frag -> msg_header . frag_len ) ;
saved_state . enc_write_ctx = s -> enc_write_ctx ;
saved_state . write_hash = s -> write_hash ;
saved_state . compress = s -> compress ;
saved_state . session = s -> session ;
saved_state . epoch = s -> d1 -> w_epoch ;
saved_state . epoch = s -> d1 -> w_epoch ;
s -> d1 -> retransmitting = 1 ;
s -> enc_write_ctx = frag -> msg_header . saved_retransmit_state . enc_write_ctx ;
s -> write_hash = frag -> msg_header . saved_retransmit_state . write_hash ;
s -> compress = frag -> msg_header . saved_retransmit_state . compress ;
s -> session = frag -> msg_header . saved_retransmit_state . session ;
s -> d1 -> w_epoch = frag -> msg_header . saved_retransmit_state . epoch ;
if ( frag -> msg_header . saved_retransmit_state . epoch == saved_state . epoch - 1 ) {
memcpy ( save_write_sequence , s -> s3 -> write_sequence , sizeof ( s -> s3 -> write_sequence ) ) ;
memcpy ( s -> s3 -> write_sequence , s -> d1 -> last_write_sequence , sizeof ( s -> s3 -> write_sequence ) ) ;
}
ret = dtls1_do_write ( s , frag -> msg_header . is_ccs ? SSL3_RT_CHANGE_CIPHER_SPEC : SSL3_RT_HANDSHAKE ) ;
s -> enc_write_ctx = saved_state . enc_write_ctx ;
s -> write_hash = saved_state . write_hash ;
s -> compress = saved_state . compress ;
s -> session = saved_state . session ;
s -> d1 -> w_epoch = saved_state . epoch ;
if ( frag -> msg_header . saved_retransmit_state . epoch == saved_state . epoch - 1 ) {
memcpy ( s -> d1 -> last_write_sequence , s -> s3 -> write_sequence , sizeof ( s -> s3 -> write_sequence ) ) ;
memcpy ( s -> s3 -> write_sequence , save_write_sequence , sizeof ( s -> s3 -> write_sequence ) ) ;
}
s -> d1 -> retransmitting = 0 ;
( void ) BIO_flush ( SSL_get_wbio ( s ) ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ProfileInfoCacheTest , EmptyGAIAInfo ) {
base : : string16 profile_name = ASCIIToUTF16 ( "name_1" ) ;
int id = profiles : : GetDefaultAvatarIconResourceIDAtIndex ( 0 ) ;
const gfx : : Image & profile_image ( ResourceBundle : : GetSharedInstance ( ) . GetImageNamed ( id ) ) ;
GetCache ( ) -> AddProfileToCache ( GetProfilePath ( "path_1" ) , profile_name , base : : string16 ( ) , 0 , std : : string ( ) ) ;
GetCache ( ) -> SetGAIANameOfProfileAtIndex ( 0 , base : : string16 ( ) ) ;
GetCache ( ) -> SetGAIAPictureOfProfileAtIndex ( 0 , NULL ) ;
GetCache ( ) -> SetIsUsingGAIAPictureOfProfileAtIndex ( 0 , true ) ;
EXPECT_EQ ( profile_name , GetCache ( ) -> GetNameOfProfileAtIndex ( 0 ) ) ;
EXPECT_TRUE ( gfx : : test : : IsEqual ( profile_image , GetCache ( ) -> GetAvatarIconOfProfileAtIndex ( 0 ) ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean refresh_connections ( gpointer data ) {
struct row_pairs * lastconn = NULL , * cache = NULL ;
GtkTreeModel * model = GTK_TREE_MODEL ( ls_conns ) ;
void * list , * next , * listend ;
struct conn_object * conn ;
GtkTreeIter iter ;
char flags [ 2 ] , status [ 8 ] ;
unsigned int tx = 0 , rx = 0 ;
struct row_pairs * row = NULL , * nextrow = NULL , top , bottom ;
( void ) data ;
memset ( & flags , 0 , sizeof ( flags ) ) ;
memset ( & status , 0 , sizeof ( status ) ) ;
if ( ls_conns ) {
if ( ! gtk_widget_get_visible ( conns_window ) ) return ( FALSE ) ;
}
else {
ls_conns = gtk_list_store_new ( 12 , G_TYPE_STRING , G_TYPE_STRING , G_TYPE_UINT , G_TYPE_STRING , G_TYPE_STRING , G_TYPE_UINT , G_TYPE_STRING , G_TYPE_STRING , G_TYPE_UINT , G_TYPE_UINT , G_TYPE_STRING , G_TYPE_POINTER ) ;
connections = NULL ;
}
for ( row = connections ;
row ;
row = nextrow ) {
nextrow = row -> next ;
if ( conntrack_get ( 0 , row -> conn , NULL ) == NULL ) {
gtk_list_store_remove ( GTK_LIST_STORE ( ls_conns ) , & row -> iter ) ;
if ( row -> next ) row -> next -> prev = row -> prev ;
if ( row -> prev ) row -> prev -> next = row -> next ;
else connections = row -> next ;
SAFE_FREE ( row ) ;
}
if ( row ) lastconn = row ;
}
if ( ! lastconn ) {
listend = conntrack_get ( 0 , NULL , NULL ) ;
if ( listend == NULL ) return ( TRUE ) ;
}
else {
listend = lastconn -> conn ;
}
for ( list = conntrack_get ( + 1 , listend , NULL ) ;
list ;
list = next ) {
next = conntrack_get ( + 1 , list , & conn ) ;
cache = gtkui_connections_add ( conn , list , & connections ) ;
if ( cache ) lastconn = cache ;
}
gtkui_connection_list_row ( 1 , & top ) ;
gtkui_connection_list_row ( 0 , & bottom ) ;
if ( top . conn == NULL ) return ( TRUE ) ;
iter = top . iter ;
do {
gtk_tree_model_get ( model , & iter , 11 , & list , - 1 ) ;
conntrack_get ( 0 , list , & conn ) ;
conntrack_flagstr ( conn , flags , sizeof ( flags ) ) ;
conntrack_statusstr ( conn , status , sizeof ( status ) ) ;
tx = conn -> tx ;
rx = conn -> rx ;
gtk_list_store_set ( ls_conns , & iter , 0 , flags , 7 , status , 8 , tx , 9 , rx , - 1 ) ;
if ( bottom . conn == list ) break ;
}
while ( gtk_tree_model_iter_next ( model , & iter ) ) ;
gtk_tree_model_filter_refilter ( GTK_TREE_MODEL_FILTER ( filter . model ) ) ;
return ( TRUE ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static guint32 dissect_trunkcall_ts ( tvbuff_t * tvb , guint32 offset , proto_tree * iax2_tree , guint16 * scallno ) {
proto_tree * call_tree ;
guint16 datalen , rlen , ts ;
datalen = tvb_get_ntohs ( tvb , offset ) ;
* scallno = tvb_get_ntohs ( tvb , offset + 2 ) ;
ts = tvb_get_ntohs ( tvb , offset + 4 ) ;
rlen = MIN ( tvb_captured_length ( tvb ) - offset - 6 , datalen ) ;
if ( iax2_tree ) {
call_tree = proto_tree_add_subtree_format ( iax2_tree , tvb , offset , rlen + 6 , ett_iax2_trunk_call , NULL , "Trunk call from %u, ts: %u" , * scallno , ts ) ;
proto_tree_add_item ( call_tree , hf_iax2_trunk_call_len , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( call_tree , hf_iax2_trunk_call_scallno , tvb , offset + 2 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( call_tree , hf_iax2_trunk_call_ts , tvb , offset + 4 , 2 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( call_tree , hf_iax2_trunk_call_data , tvb , offset + 6 , rlen , ENC_NA ) ;
}
offset += 6 + rlen ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static uint16_t * build_pow_table ( float gamma , int length ) {
int i ;
uint16_t * output = malloc ( sizeof ( uint16_t ) * length ) ;
if ( ! output ) return NULL ;
for ( i = 0 ;
i < length ;
i ++ ) {
uint16_fract_t result ;
double x = ( ( double ) i ) / ( double ) ( length - 1 ) ;
x = pow ( x , gamma ) ;
result = floor ( x * 65535. + .5 ) ;
output [ i ] = result ;
}
return output ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( UsbBlocklistTest , StaticEntries ) {
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0111 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0112 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0115 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0116 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0211 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0404 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0405 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0406 , 0x0100 }
) ) ;
EXPECT_TRUE ( list ( ) . IsExcluded ( {
0x1050 , 0x0407 , 0x0100 }
) ) ;
EXPECT_FALSE ( list ( ) . IsExcluded ( {
0x1050 , 0x0200 , 0x0100 }
) ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static gboolean qio_channel_websock_handshake_send ( QIOChannel * ioc , GIOCondition condition , gpointer user_data ) {
QIOTask * task = user_data ;
QIOChannelWebsock * wioc = QIO_CHANNEL_WEBSOCK ( qio_task_get_source ( task ) ) ;
Error * err = NULL ;
ssize_t ret ;
ret = qio_channel_write ( wioc -> master , ( char * ) wioc -> encoutput . buffer , wioc -> encoutput . offset , & err ) ;
if ( ret < 0 ) {
trace_qio_channel_websock_handshake_fail ( ioc , error_get_pretty ( err ) ) ;
qio_task_set_error ( task , err ) ;
qio_task_complete ( task ) ;
return FALSE ;
}
buffer_advance ( & wioc -> encoutput , ret ) ;
if ( wioc -> encoutput . offset == 0 ) {
if ( wioc -> io_err ) {
trace_qio_channel_websock_handshake_fail ( ioc , error_get_pretty ( wioc -> io_err ) ) ;
qio_task_set_error ( task , wioc -> io_err ) ;
wioc -> io_err = NULL ;
qio_task_complete ( task ) ;
}
else {
trace_qio_channel_websock_handshake_complete ( ioc ) ;
qio_task_complete ( task ) ;
}
return FALSE ;
}
trace_qio_channel_websock_handshake_pending ( ioc , G_IO_OUT ) ;
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void qio_channel_websock_finalize ( Object * obj ) {
QIOChannelWebsock * ioc = QIO_CHANNEL_WEBSOCK ( obj ) ;
buffer_free ( & ioc -> encinput ) ;
buffer_free ( & ioc -> encoutput ) ;
buffer_free ( & ioc -> rawinput ) ;
buffer_free ( & ioc -> rawoutput ) ;
buffer_free ( & ioc -> ping_reply ) ;
object_unref ( OBJECT ( ioc -> master ) ) ;
if ( ioc -> io_tag ) {
g_source_remove ( ioc -> io_tag ) ;
}
if ( ioc -> io_err ) {
error_free ( ioc -> io_err ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) {
int w , v , iv ;
unsigned char * c ;
w = n / 8 ;
v = 1 << ( 7 - ( n & 0x07 ) ) ;
iv = ~ v ;
if ( ! value ) v = 0 ;
if ( a == NULL ) return 0 ;
a -> flags &= ~ ( ASN1_STRING_FLAG_BITS_LEFT | 0x07 ) ;
if ( ( a -> length < ( w + 1 ) ) || ( a -> data == NULL ) ) {
if ( ! value ) return ( 1 ) ;
if ( a -> data == NULL ) c = ( unsigned char * ) OPENSSL_malloc ( w + 1 ) ;
else c = ( unsigned char * ) OPENSSL_realloc_clean ( a -> data , a -> length , w + 1 ) ;
if ( c == NULL ) {
ASN1err ( ASN1_F_ASN1_BIT_STRING_SET_BIT , ERR_R_MALLOC_FAILURE ) ;
return 0 ;
}
if ( w + 1 - a -> length > 0 ) memset ( c + a -> length , 0 , w + 1 - a -> length ) ;
a -> data = c ;
a -> length = w + 1 ;
}
a -> data [ w ] = ( ( a -> data [ w ] ) & iv ) | v ;
while ( ( a -> length > 0 ) && ( a -> data [ a -> length - 1 ] == 0 ) ) a -> length -- ;
return ( 1 ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static krb5_error_code process_chpw_request ( krb5_context context , void * server_handle , char * realm , krb5_keytab keytab , const krb5_fulladdr * local_faddr , const krb5_fulladdr * remote_faddr , krb5_data * req , krb5_data * rep ) {
krb5_error_code ret ;
char * ptr ;
unsigned int plen , vno ;
krb5_data ap_req , ap_rep = empty_data ( ) ;
krb5_data cipher = empty_data ( ) , clear = empty_data ( ) ;
krb5_auth_context auth_context = NULL ;
krb5_principal changepw = NULL ;
krb5_principal client , target = NULL ;
krb5_ticket * ticket = NULL ;
krb5_replay_data replay ;
krb5_error krberror ;
int numresult ;
char strresult [ 1024 ] ;
char * clientstr = NULL , * targetstr = NULL ;
const char * errmsg = NULL ;
size_t clen ;
char * cdots ;
struct sockaddr_storage ss ;
socklen_t salen ;
char addrbuf [ 100 ] ;
krb5_address * addr = remote_faddr -> address ;
* rep = empty_data ( ) ;
if ( req -> length < 4 ) {
ret = KRB5KRB_AP_ERR_MODIFIED ;
numresult = KRB5_KPASSWD_MALFORMED ;
strlcpy ( strresult , "Request was truncated" , sizeof ( strresult ) ) ;
goto bailout ;
}
ptr = req -> data ;
plen = ( * ptr ++ & 0xff ) ;
plen = ( plen << 8 ) | ( * ptr ++ & 0xff ) ;
if ( plen != req -> length ) {
ret = KRB5KRB_AP_ERR_MODIFIED ;
numresult = KRB5_KPASSWD_MALFORMED ;
strlcpy ( strresult , "Request length was inconsistent" , sizeof ( strresult ) ) ;
goto bailout ;
}
vno = ( * ptr ++ & 0xff ) ;
vno = ( vno << 8 ) | ( * ptr ++ & 0xff ) ;
if ( vno != 1 && vno != RFC3244_VERSION ) {
ret = KRB5KDC_ERR_BAD_PVNO ;
numresult = KRB5_KPASSWD_BAD_VERSION ;
snprintf ( strresult , sizeof ( strresult ) , "Request contained unknown protocol version number %d" , vno ) ;
goto bailout ;
}
ap_req . length = ( * ptr ++ & 0xff ) ;
ap_req . length = ( ap_req . length << 8 ) | ( * ptr ++ & 0xff ) ;
if ( ptr + ap_req . length >= req -> data + req -> length ) {
ret = KRB5KRB_AP_ERR_MODIFIED ;
numresult = KRB5_KPASSWD_MALFORMED ;
strlcpy ( strresult , "Request was truncated in AP-REQ" , sizeof ( strresult ) ) ;
goto bailout ;
}
ap_req . data = ptr ;
ptr += ap_req . length ;
ret = krb5_auth_con_init ( context , & auth_context ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed initializing auth context" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
ret = krb5_auth_con_setflags ( context , auth_context , KRB5_AUTH_CONTEXT_DO_SEQUENCE ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed initializing auth context" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
ret = krb5_build_principal ( context , & changepw , strlen ( realm ) , realm , "kadmin" , "changepw" , NULL ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed building kadmin/changepw principal" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
ret = krb5_rd_req ( context , & auth_context , & ap_req , changepw , keytab , NULL , & ticket ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_AUTHERROR ;
strlcpy ( strresult , "Failed reading application request" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
ret = krb5_mk_rep ( context , auth_context , & ap_rep ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_AUTHERROR ;
strlcpy ( strresult , "Failed replying to application request" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
cipher . length = ( req -> data + req -> length ) - ptr ;
cipher . data = ptr ;
ret = krb5_rd_priv ( context , auth_context , & cipher , & clear , & replay ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed decrypting request" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
client = ticket -> enc_part2 -> client ;
if ( vno == RFC3244_VERSION ) {
krb5_data * clear_data ;
ret = decode_krb5_setpw_req ( & clear , & clear_data , & target ) ;
if ( ret != 0 ) {
numresult = KRB5_KPASSWD_MALFORMED ;
strlcpy ( strresult , "Failed decoding ChangePasswdData" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
zapfree ( clear . data , clear . length ) ;
clear = * clear_data ;
free ( clear_data ) ;
if ( target != NULL ) {
ret = krb5_unparse_name ( context , target , & targetstr ) ;
if ( ret != 0 ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed unparsing target name for log" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
}
}
ret = krb5_unparse_name ( context , client , & clientstr ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed unparsing client name for log" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
if ( vno == 1 && ( ticket -> enc_part2 -> flags & TKT_FLG_INITIAL ) == 0 ) {
numresult = KRB5_KPASSWD_INITIAL_FLAG_NEEDED ;
strlcpy ( strresult , "Ticket must be derived from a password" , sizeof ( strresult ) ) ;
goto chpwfail ;
}
ptr = k5memdup0 ( clear . data , clear . length , & ret ) ;
ret = schpw_util_wrapper ( server_handle , client , target , ( ticket -> enc_part2 -> flags & TKT_FLG_INITIAL ) != 0 , ptr , NULL , strresult , sizeof ( strresult ) ) ;
if ( ret ) errmsg = krb5_get_error_message ( context , ret ) ;
zapfree ( clear . data , clear . length ) ;
zapfree ( ptr , clear . length ) ;
clear = empty_data ( ) ;
clen = strlen ( clientstr ) ;
trunc_name ( & clen , & cdots ) ;
switch ( addr -> addrtype ) {
case ADDRTYPE_INET : {
struct sockaddr_in * sin = ss2sin ( & ss ) ;
sin -> sin_family = AF_INET ;
memcpy ( & sin -> sin_addr , addr -> contents , addr -> length ) ;
sin -> sin_port = htons ( remote_faddr -> port ) ;
salen = sizeof ( * sin ) ;
break ;
}
case ADDRTYPE_INET6 : {
struct sockaddr_in6 * sin6 = ss2sin6 ( & ss ) ;
sin6 -> sin6_family = AF_INET6 ;
memcpy ( & sin6 -> sin6_addr , addr -> contents , addr -> length ) ;
sin6 -> sin6_port = htons ( remote_faddr -> port ) ;
salen = sizeof ( * sin6 ) ;
break ;
}
default : {
struct sockaddr * sa = ss2sa ( & ss ) ;
sa -> sa_family = AF_UNSPEC ;
salen = sizeof ( * sa ) ;
break ;
}
}
if ( getnameinfo ( ss2sa ( & ss ) , salen , addrbuf , sizeof ( addrbuf ) , NULL , 0 , NI_NUMERICHOST | NI_NUMERICSERV ) != 0 ) strlcpy ( addrbuf , "<unprintable>" , sizeof ( addrbuf ) ) ;
if ( vno == RFC3244_VERSION ) {
size_t tlen ;
char * tdots ;
const char * targetp ;
if ( target == NULL ) {
tlen = clen ;
tdots = cdots ;
targetp = targetstr ;
}
else {
tlen = strlen ( targetstr ) ;
trunc_name ( & tlen , & tdots ) ;
targetp = clientstr ;
}
krb5_klog_syslog ( LOG_NOTICE , _ ( "setpw request from %s by %.*s%s for " "%.*s%s: %s" ) , addrbuf , ( int ) clen , clientstr , cdots , ( int ) tlen , targetp , tdots , errmsg ? errmsg : "success" ) ;
}
else {
krb5_klog_syslog ( LOG_NOTICE , _ ( "chpw request from %s for %.*s%s: %s" ) , addrbuf , ( int ) clen , clientstr , cdots , errmsg ? errmsg : "success" ) ;
}
switch ( ret ) {
case KADM5_AUTH_CHANGEPW : numresult = KRB5_KPASSWD_ACCESSDENIED ;
break ;
case KADM5_PASS_Q_TOOSHORT : case KADM5_PASS_REUSE : case KADM5_PASS_Q_CLASS : case KADM5_PASS_Q_DICT : case KADM5_PASS_Q_GENERIC : case KADM5_PASS_TOOSOON : numresult = KRB5_KPASSWD_SOFTERROR ;
break ;
case 0 : numresult = KRB5_KPASSWD_SUCCESS ;
strlcpy ( strresult , "" , sizeof ( strresult ) ) ;
break ;
default : numresult = KRB5_KPASSWD_HARDERROR ;
break ;
}
chpwfail : clear . length = 2 + strlen ( strresult ) ;
clear . data = ( char * ) malloc ( clear . length ) ;
ptr = clear . data ;
* ptr ++ = ( numresult >> 8 ) & 0xff ;
* ptr ++ = numresult & 0xff ;
memcpy ( ptr , strresult , strlen ( strresult ) ) ;
cipher = empty_data ( ) ;
if ( ap_rep . length ) {
ret = krb5_auth_con_setaddrs ( context , auth_context , local_faddr -> address , NULL ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed storing client and server internet addresses" , sizeof ( strresult ) ) ;
}
else {
ret = krb5_mk_priv ( context , auth_context , & clear , & cipher , & replay ) ;
if ( ret ) {
numresult = KRB5_KPASSWD_HARDERROR ;
strlcpy ( strresult , "Failed encrypting reply" , sizeof ( strresult ) ) ;
}
}
}
if ( cipher . length == 0 ) {
if ( ap_rep . length ) {
free ( ap_rep . data ) ;
ap_rep = empty_data ( ) ;
}
krberror . ctime = 0 ;
krberror . cusec = 0 ;
krberror . susec = 0 ;
ret = krb5_timeofday ( context , & krberror . stime ) ;
if ( ret ) goto bailout ;
krberror . error = ret ;
krberror . error -= ERROR_TABLE_BASE_krb5 ;
if ( krberror . error < 0 || krberror . error > 128 ) krberror . error = KRB_ERR_GENERIC ;
krberror . client = NULL ;
ret = krb5_build_principal ( context , & krberror . server , strlen ( realm ) , realm , "kadmin" , "changepw" , NULL ) ;
if ( ret ) goto bailout ;
krberror . text . length = 0 ;
krberror . e_data = clear ;
ret = krb5_mk_error ( context , & krberror , & cipher ) ;
krb5_free_principal ( context , krberror . server ) ;
if ( ret ) goto bailout ;
}
ret = alloc_data ( rep , 6 + ap_rep . length + cipher . length ) ;
if ( ret ) goto bailout ;
ptr = rep -> data ;
* ptr ++ = ( rep -> length >> 8 ) & 0xff ;
* ptr ++ = rep -> length & 0xff ;
* ptr ++ = 0 ;
* ptr ++ = 1 ;
* ptr ++ = ( ap_rep . length >> 8 ) & 0xff ;
* ptr ++ = ap_rep . length & 0xff ;
if ( ap_rep . length ) {
memcpy ( ptr , ap_rep . data , ap_rep . length ) ;
ptr += ap_rep . length ;
}
memcpy ( ptr , cipher . data , cipher . length ) ;
bailout : krb5_auth_con_free ( context , auth_context ) ;
krb5_free_principal ( context , changepw ) ;
krb5_free_ticket ( context , ticket ) ;
free ( ap_rep . data ) ;
free ( clear . data ) ;
free ( cipher . data ) ;
krb5_free_principal ( context , target ) ;
krb5_free_unparsed_name ( context , targetstr ) ;
krb5_free_unparsed_name ( context , clientstr ) ;
krb5_free_error_message ( context , errmsg ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void proto_tree_set_appendix ( proto_tree * tree , tvbuff_t * tvb , gint start , const gint length ) {
field_info * fi ;
if ( tree == NULL ) return ;
fi = PTREE_FINFO ( tree ) ;
if ( fi == NULL ) return ;
start += tvb_raw_offset ( tvb ) ;
DISSECTOR_ASSERT ( start >= 0 ) ;
DISSECTOR_ASSERT ( length >= 0 ) ;
fi -> appendix_start = start ;
fi -> appendix_length = length ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int _warc_read ( struct archive_read * a , const void * * buf , size_t * bsz , int64_t * off ) {
struct warc_s * w = a -> format -> data ;
const char * rab ;
ssize_t nrd ;
if ( w -> cntoff >= w -> cntlen ) {
eof : * buf = NULL ;
* bsz = 0U ;
* off = w -> cntoff + 4U ;
w -> unconsumed = 0U ;
return ( ARCHIVE_EOF ) ;
}
if ( w -> unconsumed ) {
__archive_read_consume ( a , w -> unconsumed ) ;
w -> unconsumed = 0U ;
}
rab = __archive_read_ahead ( a , 1U , & nrd ) ;
if ( nrd < 0 ) {
* bsz = 0U ;
return ( int ) nrd ;
}
else if ( nrd == 0 ) {
goto eof ;
}
else if ( ( size_t ) nrd > w -> cntlen - w -> cntoff ) {
nrd = w -> cntlen - w -> cntoff ;
}
* off = w -> cntoff ;
* bsz = nrd ;
* buf = rab ;
w -> cntoff += nrd ;
w -> unconsumed = ( size_t ) nrd ;
return ( ARCHIVE_OK ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void qtmd_init_model ( struct qtmd_model * model , struct qtmd_modelsym * syms , int start , int len ) {
int i ;
model -> shiftsleft = 4 ;
model -> entries = len ;
model -> syms = syms ;
for ( i = 0 ;
i <= len ;
i ++ ) {
syms [ i ] . sym = start + i ;
syms [ i ] . cumfreq = len - i ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void show_wbxml_string_table ( proto_tree * tree , tvbuff_t * tvb , guint32 str_tbl , guint32 str_tbl_len ) {
guint32 off = str_tbl ;
guint32 len = 0 ;
guint32 end = str_tbl + str_tbl_len ;
proto_tree_add_text ( tree , tvb , off , end , "Start | Length | String" ) ;
while ( off < end ) {
len = tvb_strsize ( tvb , off ) ;
proto_tree_add_text ( tree , tvb , off , len , "%6d | %6d | '%s'" , off - str_tbl , len , tvb_format_text ( tvb , off , len - 1 ) ) ;
off += len ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static cmsBool WriteSegmentedCurve ( cmsIOHANDLER * io , cmsToneCurve * g ) {
cmsUInt32Number i , j ;
cmsCurveSegment * Segments = g -> Segments ;
cmsUInt32Number nSegments = g -> nSegments ;
if ( ! _cmsWriteUInt32Number ( io , cmsSigSegmentedCurve ) ) goto Error ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) goto Error ;
if ( ! _cmsWriteUInt16Number ( io , ( cmsUInt16Number ) nSegments ) ) goto Error ;
if ( ! _cmsWriteUInt16Number ( io , 0 ) ) goto Error ;
for ( i = 0 ;
i < nSegments - 1 ;
i ++ ) {
if ( ! _cmsWriteFloat32Number ( io , Segments [ i ] . x1 ) ) goto Error ;
}
for ( i = 0 ;
i < g -> nSegments ;
i ++ ) {
cmsCurveSegment * ActualSeg = Segments + i ;
if ( ActualSeg -> Type == 0 ) {
if ( ! _cmsWriteUInt32Number ( io , ( cmsUInt32Number ) cmsSigSampledCurveSeg ) ) goto Error ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) goto Error ;
if ( ! _cmsWriteUInt32Number ( io , ActualSeg -> nGridPoints ) ) goto Error ;
for ( j = 0 ;
j < g -> Segments [ i ] . nGridPoints ;
j ++ ) {
if ( ! _cmsWriteFloat32Number ( io , ActualSeg -> SampledPoints [ j ] ) ) goto Error ;
}
}
else {
int Type ;
cmsUInt32Number ParamsByType [ ] = {
4 , 5 , 5 }
;
if ( ! _cmsWriteUInt32Number ( io , ( cmsUInt32Number ) cmsSigFormulaCurveSeg ) ) goto Error ;
if ( ! _cmsWriteUInt32Number ( io , 0 ) ) goto Error ;
Type = ActualSeg -> Type - 6 ;
if ( Type > 2 || Type < 0 ) goto Error ;
if ( ! _cmsWriteUInt16Number ( io , ( cmsUInt16Number ) Type ) ) goto Error ;
if ( ! _cmsWriteUInt16Number ( io , 0 ) ) goto Error ;
for ( j = 0 ;
j < ParamsByType [ Type ] ;
j ++ ) {
if ( ! _cmsWriteFloat32Number ( io , ( cmsFloat32Number ) ActualSeg -> Params [ j ] ) ) goto Error ;
}
}
}
return TRUE ;
Error : return FALSE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp8_sixtap_predict4x4_neon ( unsigned char * src_ptr , int src_pixels_per_line , int xoffset , int yoffset , unsigned char * dst_ptr , int dst_pitch ) {
unsigned char * src ;
uint8x8_t d0u8 , d1u8 , d2u8 , d3u8 , d4u8 , d5u8 , d18u8 , d19u8 , d20u8 , d21u8 ;
uint8x8_t d23u8 , d24u8 , d25u8 , d26u8 , d27u8 , d28u8 , d29u8 , d30u8 , d31u8 ;
int8x8_t dtmps8 , d0s8 , d1s8 , d2s8 , d3s8 , d4s8 , d5s8 ;
uint16x8_t q3u16 , q4u16 , q5u16 , q6u16 , q7u16 ;
uint16x8_t q8u16 , q9u16 , q10u16 , q11u16 , q12u16 ;
int16x8_t q3s16 , q4s16 , q5s16 , q6s16 , q7s16 ;
int16x8_t q8s16 , q9s16 , q10s16 , q11s16 , q12s16 ;
uint8x16_t q3u8 , q4u8 , q5u8 , q6u8 , q11u8 ;
uint64x2_t q3u64 , q4u64 , q5u64 , q6u64 , q9u64 , q10u64 ;
uint32x2x2_t d0u32x2 , d1u32x2 ;
if ( xoffset == 0 ) {
uint32x2_t d27u32 = vdup_n_u32 ( 0 ) ;
uint32x2_t d28u32 = vdup_n_u32 ( 0 ) ;
uint32x2_t d29u32 = vdup_n_u32 ( 0 ) ;
uint32x2_t d30u32 = vdup_n_u32 ( 0 ) ;
uint32x2_t d31u32 = vdup_n_u32 ( 0 ) ;
dtmps8 = vld1_s8 ( vp8_sub_pel_filters [ yoffset ] ) ;
d0s8 = vdup_lane_s8 ( dtmps8 , 0 ) ;
d1s8 = vdup_lane_s8 ( dtmps8 , 1 ) ;
d2s8 = vdup_lane_s8 ( dtmps8 , 2 ) ;
d3s8 = vdup_lane_s8 ( dtmps8 , 3 ) ;
d4s8 = vdup_lane_s8 ( dtmps8 , 4 ) ;
d5s8 = vdup_lane_s8 ( dtmps8 , 5 ) ;
d0u8 = vreinterpret_u8_s8 ( vabs_s8 ( d0s8 ) ) ;
d1u8 = vreinterpret_u8_s8 ( vabs_s8 ( d1s8 ) ) ;
d2u8 = vreinterpret_u8_s8 ( vabs_s8 ( d2s8 ) ) ;
d3u8 = vreinterpret_u8_s8 ( vabs_s8 ( d3s8 ) ) ;
d4u8 = vreinterpret_u8_s8 ( vabs_s8 ( d4s8 ) ) ;
d5u8 = vreinterpret_u8_s8 ( vabs_s8 ( d5s8 ) ) ;
src = src_ptr - src_pixels_per_line * 2 ;
d27u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d27u32 , 0 ) ;
src += src_pixels_per_line ;
d27u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d27u32 , 1 ) ;
src += src_pixels_per_line ;
d28u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d28u32 , 0 ) ;
src += src_pixels_per_line ;
d28u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d28u32 , 1 ) ;
src += src_pixels_per_line ;
d29u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d29u32 , 0 ) ;
src += src_pixels_per_line ;
d29u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d29u32 , 1 ) ;
src += src_pixels_per_line ;
d30u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d30u32 , 0 ) ;
src += src_pixels_per_line ;
d30u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d30u32 , 1 ) ;
src += src_pixels_per_line ;
d31u32 = vld1_lane_u32 ( ( const uint32_t * ) src , d31u32 , 0 ) ;
d27u8 = vreinterpret_u8_u32 ( d27u32 ) ;
d28u8 = vreinterpret_u8_u32 ( d28u32 ) ;
d29u8 = vreinterpret_u8_u32 ( d29u32 ) ;
d30u8 = vreinterpret_u8_u32 ( d30u32 ) ;
d31u8 = vreinterpret_u8_u32 ( d31u32 ) ;
d23u8 = vext_u8 ( d27u8 , d28u8 , 4 ) ;
d24u8 = vext_u8 ( d28u8 , d29u8 , 4 ) ;
d25u8 = vext_u8 ( d29u8 , d30u8 , 4 ) ;
d26u8 = vext_u8 ( d30u8 , d31u8 , 4 ) ;
q3u16 = vmull_u8 ( d27u8 , d0u8 ) ;
q4u16 = vmull_u8 ( d28u8 , d0u8 ) ;
q5u16 = vmull_u8 ( d25u8 , d5u8 ) ;
q6u16 = vmull_u8 ( d26u8 , d5u8 ) ;
q3u16 = vmlsl_u8 ( q3u16 , d29u8 , d4u8 ) ;
q4u16 = vmlsl_u8 ( q4u16 , d30u8 , d4u8 ) ;
q5u16 = vmlsl_u8 ( q5u16 , d23u8 , d1u8 ) ;
q6u16 = vmlsl_u8 ( q6u16 , d24u8 , d1u8 ) ;
q3u16 = vmlal_u8 ( q3u16 , d28u8 , d2u8 ) ;
q4u16 = vmlal_u8 ( q4u16 , d29u8 , d2u8 ) ;
q5u16 = vmlal_u8 ( q5u16 , d24u8 , d3u8 ) ;
q6u16 = vmlal_u8 ( q6u16 , d25u8 , d3u8 ) ;
q3s16 = vreinterpretq_s16_u16 ( q3u16 ) ;
q4s16 = vreinterpretq_s16_u16 ( q4u16 ) ;
q5s16 = vreinterpretq_s16_u16 ( q5u16 ) ;
q6s16 = vreinterpretq_s16_u16 ( q6u16 ) ;
q5s16 = vqaddq_s16 ( q5s16 , q3s16 ) ;
q6s16 = vqaddq_s16 ( q6s16 , q4s16 ) ;
d3u8 = vqrshrun_n_s16 ( q5s16 , 7 ) ;
d4u8 = vqrshrun_n_s16 ( q6s16 , 7 ) ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d3u8 ) , 0 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d3u8 ) , 1 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d4u8 ) , 0 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d4u8 ) , 1 ) ;
return ;
}
dtmps8 = vld1_s8 ( vp8_sub_pel_filters [ xoffset ] ) ;
d0s8 = vdup_lane_s8 ( dtmps8 , 0 ) ;
d1s8 = vdup_lane_s8 ( dtmps8 , 1 ) ;
d2s8 = vdup_lane_s8 ( dtmps8 , 2 ) ;
d3s8 = vdup_lane_s8 ( dtmps8 , 3 ) ;
d4s8 = vdup_lane_s8 ( dtmps8 , 4 ) ;
d5s8 = vdup_lane_s8 ( dtmps8 , 5 ) ;
d0u8 = vreinterpret_u8_s8 ( vabs_s8 ( d0s8 ) ) ;
d1u8 = vreinterpret_u8_s8 ( vabs_s8 ( d1s8 ) ) ;
d2u8 = vreinterpret_u8_s8 ( vabs_s8 ( d2s8 ) ) ;
d3u8 = vreinterpret_u8_s8 ( vabs_s8 ( d3s8 ) ) ;
d4u8 = vreinterpret_u8_s8 ( vabs_s8 ( d4s8 ) ) ;
d5u8 = vreinterpret_u8_s8 ( vabs_s8 ( d5s8 ) ) ;
if ( yoffset == 0 ) src = src_ptr - 2 ;
else src = src_ptr - 2 - ( src_pixels_per_line * 2 ) ;
q3u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
q4u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
q5u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
q6u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
d18u8 = vext_u8 ( vget_low_u8 ( q3u8 ) , vget_high_u8 ( q3u8 ) , 5 ) ;
d19u8 = vext_u8 ( vget_low_u8 ( q4u8 ) , vget_high_u8 ( q4u8 ) , 5 ) ;
d20u8 = vext_u8 ( vget_low_u8 ( q5u8 ) , vget_high_u8 ( q5u8 ) , 5 ) ;
d21u8 = vext_u8 ( vget_low_u8 ( q6u8 ) , vget_high_u8 ( q6u8 ) , 5 ) ;
q3u8 = vcombine_u8 ( vget_low_u8 ( q3u8 ) , vget_low_u8 ( q4u8 ) ) ;
q5u8 = vcombine_u8 ( vget_low_u8 ( q5u8 ) , vget_low_u8 ( q6u8 ) ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( d18u8 ) , vreinterpret_u32_u8 ( d19u8 ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( d20u8 ) , vreinterpret_u32_u8 ( d21u8 ) ) ;
q7u16 = vmull_u8 ( vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d5u8 ) ;
q8u16 = vmull_u8 ( vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d5u8 ) ;
q4u64 = vreinterpretq_u64_u8 ( q3u8 ) ;
q6u64 = vreinterpretq_u64_u8 ( q5u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( vget_low_u8 ( q3u8 ) ) , vreinterpret_u32_u8 ( vget_high_u8 ( q3u8 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( vget_low_u8 ( q5u8 ) ) , vreinterpret_u32_u8 ( vget_high_u8 ( q5u8 ) ) ) ;
q9u64 = vshrq_n_u64 ( q4u64 , 8 ) ;
q10u64 = vshrq_n_u64 ( q6u64 , 8 ) ;
q7u16 = vmlal_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d0u8 ) ;
q8u16 = vmlal_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d0u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q9u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q9u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q10u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q10u64 ) ) ) ;
q3u64 = vshrq_n_u64 ( q4u64 , 32 ) ;
q5u64 = vshrq_n_u64 ( q6u64 , 32 ) ;
q7u16 = vmlsl_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d1u8 ) ;
q8u16 = vmlsl_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d1u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q3u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q3u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q5u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q5u64 ) ) ) ;
q9u64 = vshrq_n_u64 ( q4u64 , 16 ) ;
q10u64 = vshrq_n_u64 ( q6u64 , 16 ) ;
q7u16 = vmlsl_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d4u8 ) ;
q8u16 = vmlsl_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d4u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q9u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q9u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q10u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q10u64 ) ) ) ;
q3u64 = vshrq_n_u64 ( q4u64 , 24 ) ;
q5u64 = vshrq_n_u64 ( q6u64 , 24 ) ;
q7u16 = vmlal_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d2u8 ) ;
q8u16 = vmlal_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d2u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q3u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q3u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q5u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q5u64 ) ) ) ;
q9u16 = vmull_u8 ( vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d3u8 ) ;
q10u16 = vmull_u8 ( vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d3u8 ) ;
q7s16 = vreinterpretq_s16_u16 ( q7u16 ) ;
q8s16 = vreinterpretq_s16_u16 ( q8u16 ) ;
q9s16 = vreinterpretq_s16_u16 ( q9u16 ) ;
q10s16 = vreinterpretq_s16_u16 ( q10u16 ) ;
q7s16 = vqaddq_s16 ( q7s16 , q9s16 ) ;
q8s16 = vqaddq_s16 ( q8s16 , q10s16 ) ;
d27u8 = vqrshrun_n_s16 ( q7s16 , 7 ) ;
d28u8 = vqrshrun_n_s16 ( q8s16 , 7 ) ;
if ( yoffset == 0 ) {
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d27u8 ) , 0 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d27u8 ) , 1 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d28u8 ) , 0 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d28u8 ) , 1 ) ;
return ;
}
q3u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
q4u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
q5u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
q6u8 = vld1q_u8 ( src ) ;
src += src_pixels_per_line ;
q11u8 = vld1q_u8 ( src ) ;
d18u8 = vext_u8 ( vget_low_u8 ( q3u8 ) , vget_high_u8 ( q3u8 ) , 5 ) ;
d19u8 = vext_u8 ( vget_low_u8 ( q4u8 ) , vget_high_u8 ( q4u8 ) , 5 ) ;
d20u8 = vext_u8 ( vget_low_u8 ( q5u8 ) , vget_high_u8 ( q5u8 ) , 5 ) ;
d21u8 = vext_u8 ( vget_low_u8 ( q6u8 ) , vget_high_u8 ( q6u8 ) , 5 ) ;
q3u8 = vcombine_u8 ( vget_low_u8 ( q3u8 ) , vget_low_u8 ( q4u8 ) ) ;
q5u8 = vcombine_u8 ( vget_low_u8 ( q5u8 ) , vget_low_u8 ( q6u8 ) ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( d18u8 ) , vreinterpret_u32_u8 ( d19u8 ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( d20u8 ) , vreinterpret_u32_u8 ( d21u8 ) ) ;
d31u8 = vext_u8 ( vget_low_u8 ( q11u8 ) , vget_high_u8 ( q11u8 ) , 5 ) ;
q7u16 = vmull_u8 ( vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d5u8 ) ;
q8u16 = vmull_u8 ( vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d5u8 ) ;
q12u16 = vmull_u8 ( d31u8 , d5u8 ) ;
q4u64 = vreinterpretq_u64_u8 ( q3u8 ) ;
q6u64 = vreinterpretq_u64_u8 ( q5u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( vget_low_u8 ( q3u8 ) ) , vreinterpret_u32_u8 ( vget_high_u8 ( q3u8 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u8 ( vget_low_u8 ( q5u8 ) ) , vreinterpret_u32_u8 ( vget_high_u8 ( q5u8 ) ) ) ;
q9u64 = vshrq_n_u64 ( q4u64 , 8 ) ;
q10u64 = vshrq_n_u64 ( q6u64 , 8 ) ;
q7u16 = vmlal_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d0u8 ) ;
q8u16 = vmlal_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d0u8 ) ;
q12u16 = vmlal_u8 ( q12u16 , vget_low_u8 ( q11u8 ) , d0u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q9u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q9u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q10u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q10u64 ) ) ) ;
q3u64 = vshrq_n_u64 ( q4u64 , 32 ) ;
q5u64 = vshrq_n_u64 ( q6u64 , 32 ) ;
d31u8 = vext_u8 ( vget_low_u8 ( q11u8 ) , vget_high_u8 ( q11u8 ) , 1 ) ;
q7u16 = vmlsl_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d1u8 ) ;
q8u16 = vmlsl_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d1u8 ) ;
q12u16 = vmlsl_u8 ( q12u16 , d31u8 , d1u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q3u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q3u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q5u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q5u64 ) ) ) ;
q9u64 = vshrq_n_u64 ( q4u64 , 16 ) ;
q10u64 = vshrq_n_u64 ( q6u64 , 16 ) ;
d31u8 = vext_u8 ( vget_low_u8 ( q11u8 ) , vget_high_u8 ( q11u8 ) , 4 ) ;
q7u16 = vmlsl_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d4u8 ) ;
q8u16 = vmlsl_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d4u8 ) ;
q12u16 = vmlsl_u8 ( q12u16 , d31u8 , d4u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q9u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q9u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q10u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q10u64 ) ) ) ;
q3u64 = vshrq_n_u64 ( q4u64 , 24 ) ;
q5u64 = vshrq_n_u64 ( q6u64 , 24 ) ;
d31u8 = vext_u8 ( vget_low_u8 ( q11u8 ) , vget_high_u8 ( q11u8 ) , 2 ) ;
q7u16 = vmlal_u8 ( q7u16 , vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d2u8 ) ;
q8u16 = vmlal_u8 ( q8u16 , vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d2u8 ) ;
q12u16 = vmlal_u8 ( q12u16 , d31u8 , d2u8 ) ;
d0u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q3u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q3u64 ) ) ) ;
d1u32x2 = vzip_u32 ( vreinterpret_u32_u64 ( vget_low_u64 ( q5u64 ) ) , vreinterpret_u32_u64 ( vget_high_u64 ( q5u64 ) ) ) ;
d31u8 = vext_u8 ( vget_low_u8 ( q11u8 ) , vget_high_u8 ( q11u8 ) , 3 ) ;
q9u16 = vmull_u8 ( vreinterpret_u8_u32 ( d0u32x2 . val [ 0 ] ) , d3u8 ) ;
q10u16 = vmull_u8 ( vreinterpret_u8_u32 ( d1u32x2 . val [ 0 ] ) , d3u8 ) ;
q11u16 = vmull_u8 ( d31u8 , d3u8 ) ;
q7s16 = vreinterpretq_s16_u16 ( q7u16 ) ;
q8s16 = vreinterpretq_s16_u16 ( q8u16 ) ;
q9s16 = vreinterpretq_s16_u16 ( q9u16 ) ;
q10s16 = vreinterpretq_s16_u16 ( q10u16 ) ;
q11s16 = vreinterpretq_s16_u16 ( q11u16 ) ;
q12s16 = vreinterpretq_s16_u16 ( q12u16 ) ;
q7s16 = vqaddq_s16 ( q7s16 , q9s16 ) ;
q8s16 = vqaddq_s16 ( q8s16 , q10s16 ) ;
q12s16 = vqaddq_s16 ( q12s16 , q11s16 ) ;
d29u8 = vqrshrun_n_s16 ( q7s16 , 7 ) ;
d30u8 = vqrshrun_n_s16 ( q8s16 , 7 ) ;
d31u8 = vqrshrun_n_s16 ( q12s16 , 7 ) ;
dtmps8 = vld1_s8 ( vp8_sub_pel_filters [ yoffset ] ) ;
d0s8 = vdup_lane_s8 ( dtmps8 , 0 ) ;
d1s8 = vdup_lane_s8 ( dtmps8 , 1 ) ;
d2s8 = vdup_lane_s8 ( dtmps8 , 2 ) ;
d3s8 = vdup_lane_s8 ( dtmps8 , 3 ) ;
d4s8 = vdup_lane_s8 ( dtmps8 , 4 ) ;
d5s8 = vdup_lane_s8 ( dtmps8 , 5 ) ;
d0u8 = vreinterpret_u8_s8 ( vabs_s8 ( d0s8 ) ) ;
d1u8 = vreinterpret_u8_s8 ( vabs_s8 ( d1s8 ) ) ;
d2u8 = vreinterpret_u8_s8 ( vabs_s8 ( d2s8 ) ) ;
d3u8 = vreinterpret_u8_s8 ( vabs_s8 ( d3s8 ) ) ;
d4u8 = vreinterpret_u8_s8 ( vabs_s8 ( d4s8 ) ) ;
d5u8 = vreinterpret_u8_s8 ( vabs_s8 ( d5s8 ) ) ;
d23u8 = vext_u8 ( d27u8 , d28u8 , 4 ) ;
d24u8 = vext_u8 ( d28u8 , d29u8 , 4 ) ;
d25u8 = vext_u8 ( d29u8 , d30u8 , 4 ) ;
d26u8 = vext_u8 ( d30u8 , d31u8 , 4 ) ;
q3u16 = vmull_u8 ( d27u8 , d0u8 ) ;
q4u16 = vmull_u8 ( d28u8 , d0u8 ) ;
q5u16 = vmull_u8 ( d25u8 , d5u8 ) ;
q6u16 = vmull_u8 ( d26u8 , d5u8 ) ;
q3u16 = vmlsl_u8 ( q3u16 , d29u8 , d4u8 ) ;
q4u16 = vmlsl_u8 ( q4u16 , d30u8 , d4u8 ) ;
q5u16 = vmlsl_u8 ( q5u16 , d23u8 , d1u8 ) ;
q6u16 = vmlsl_u8 ( q6u16 , d24u8 , d1u8 ) ;
q3u16 = vmlal_u8 ( q3u16 , d28u8 , d2u8 ) ;
q4u16 = vmlal_u8 ( q4u16 , d29u8 , d2u8 ) ;
q5u16 = vmlal_u8 ( q5u16 , d24u8 , d3u8 ) ;
q6u16 = vmlal_u8 ( q6u16 , d25u8 , d3u8 ) ;
q3s16 = vreinterpretq_s16_u16 ( q3u16 ) ;
q4s16 = vreinterpretq_s16_u16 ( q4u16 ) ;
q5s16 = vreinterpretq_s16_u16 ( q5u16 ) ;
q6s16 = vreinterpretq_s16_u16 ( q6u16 ) ;
q5s16 = vqaddq_s16 ( q5s16 , q3s16 ) ;
q6s16 = vqaddq_s16 ( q6s16 , q4s16 ) ;
d3u8 = vqrshrun_n_s16 ( q5s16 , 7 ) ;
d4u8 = vqrshrun_n_s16 ( q6s16 , 7 ) ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d3u8 ) , 0 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d3u8 ) , 1 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d4u8 ) , 0 ) ;
dst_ptr += dst_pitch ;
vst1_lane_u32 ( ( uint32_t * ) dst_ptr , vreinterpret_u32_u8 ( d4u8 ) , 1 ) ;
return ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_btgatt_nordic_uart_rx ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) {
btatt_data_t * att_data = ( btatt_data_t * ) data ;
if ( bluetooth_gatt_has_no_parameter ( att_data -> opcode ) ) return - 1 ;
proto_tree_add_item ( tree , hf_gatt_nordic_uart_rx , tvb , 0 , tvb_captured_length ( tvb ) , ENC_ASCII | ENC_NA ) ;
return tvb_captured_length ( tvb ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | decoder_t * input_DecoderNew ( input_thread_t * p_input , es_format_t * fmt , input_clock_t * p_clock , sout_instance_t * p_sout ) {
return decoder_New ( VLC_OBJECT ( p_input ) , p_input , fmt , p_clock , p_input -> p -> p_resource , p_sout ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static __always_inline __u16 __swab16p ( const __u16 * p ) {
# ifdef __arch_swab16p return __arch_swab16p ( p ) ;
# else return __swab16 ( * p ) ;
# endif } | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | gpg_error_t ksba_oid_from_str ( const char * string , unsigned char * * rbuf , size_t * rlength ) {
unsigned char * buf ;
size_t buflen ;
unsigned long val1 , val ;
const char * endp ;
int arcno ;
if ( ! string || ! rbuf || ! rlength ) return gpg_error ( GPG_ERR_INV_VALUE ) ;
* rbuf = NULL ;
* rlength = 0 ;
if ( ! strncmp ( string , "oid." , 4 ) || ! strncmp ( string , "OID." , 4 ) ) string += 4 ;
if ( ! * string ) return gpg_error ( GPG_ERR_INV_VALUE ) ;
buf = xtrymalloc ( strlen ( string ) + 2 ) ;
if ( ! buf ) return gpg_error ( GPG_ERR_ENOMEM ) ;
buflen = 0 ;
val1 = 0 ;
arcno = 0 ;
do {
arcno ++ ;
val = strtoul ( string , ( char * * ) & endp , 10 ) ;
if ( ! digitp ( string ) || ! ( * endp == '.' || ! * endp ) ) {
xfree ( buf ) ;
return gpg_error ( GPG_ERR_INV_OID_STRING ) ;
}
if ( * endp == '.' ) string = endp + 1 ;
if ( arcno == 1 ) {
if ( val > 2 ) break ;
val1 = val ;
}
else if ( arcno == 2 ) {
if ( val1 < 2 ) {
if ( val > 39 ) {
xfree ( buf ) ;
return gpg_error ( GPG_ERR_INV_OID_STRING ) ;
}
buf [ buflen ++ ] = val1 * 40 + val ;
}
else {
val += 80 ;
buflen = make_flagged_int ( val , buf , buflen ) ;
}
}
else {
buflen = make_flagged_int ( val , buf , buflen ) ;
}
}
while ( * endp == '.' ) ;
if ( arcno == 1 ) {
xfree ( buf ) ;
return gpg_error ( GPG_ERR_INV_OID_STRING ) ;
}
* rbuf = buf ;
* rlength = buflen ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int vc1_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame , AVPacket * avpkt ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size , n_slices = 0 , i , ret ;
VC1Context * v = avctx -> priv_data ;
MpegEncContext * s = & v -> s ;
AVFrame * pict = data ;
uint8_t * buf2 = NULL ;
const uint8_t * buf_start = buf ;
int mb_height , n_slices1 ;
struct {
uint8_t * buf ;
GetBitContext gb ;
int mby_start ;
}
* slices = NULL , * tmp ;
if ( buf_size == 0 || ( buf_size == 4 && AV_RB32 ( buf ) == VC1_CODE_ENDOFSEQ ) ) {
if ( s -> low_delay == 0 && s -> next_picture_ptr ) {
if ( ( ret = av_frame_ref ( pict , & s -> next_picture_ptr -> f ) ) < 0 ) return ret ;
s -> next_picture_ptr = NULL ;
* got_frame = 1 ;
}
return 0 ;
}
if ( s -> avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) {
if ( v -> profile < PROFILE_ADVANCED ) avctx -> pix_fmt = AV_PIX_FMT_VDPAU_WMV3 ;
else avctx -> pix_fmt = AV_PIX_FMT_VDPAU_VC1 ;
}
if ( avctx -> codec_id == AV_CODEC_ID_VC1 || avctx -> codec_id == AV_CODEC_ID_VC1IMAGE ) {
int buf_size2 = 0 ;
buf2 = av_mallocz ( buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( IS_MARKER ( AV_RB32 ( buf ) ) ) {
const uint8_t * start , * end , * next ;
int size ;
next = buf ;
for ( start = buf , end = buf + buf_size ;
next < end ;
start = next ) {
next = find_next_marker ( start + 4 , end ) ;
size = next - start - 4 ;
if ( size <= 0 ) continue ;
switch ( AV_RB32 ( start ) ) {
case VC1_CODE_FRAME : if ( avctx -> hwaccel || s -> avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) buf_start = start ;
buf_size2 = vc1_unescape_buffer ( start + 4 , size , buf2 ) ;
break ;
case VC1_CODE_FIELD : {
int buf_size3 ;
tmp = av_realloc ( slices , sizeof ( * slices ) * ( n_slices + 1 ) ) ;
if ( ! tmp ) goto err ;
slices = tmp ;
slices [ n_slices ] . buf = av_mallocz ( buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! slices [ n_slices ] . buf ) goto err ;
buf_size3 = vc1_unescape_buffer ( start + 4 , size , slices [ n_slices ] . buf ) ;
init_get_bits ( & slices [ n_slices ] . gb , slices [ n_slices ] . buf , buf_size3 << 3 ) ;
slices [ n_slices ] . mby_start = s -> mb_height >> 1 ;
n_slices1 = n_slices - 1 ;
n_slices ++ ;
break ;
}
case VC1_CODE_ENTRYPOINT : buf_size2 = vc1_unescape_buffer ( start + 4 , size , buf2 ) ;
init_get_bits ( & s -> gb , buf2 , buf_size2 * 8 ) ;
ff_vc1_decode_entry_point ( avctx , v , & s -> gb ) ;
break ;
case VC1_CODE_SLICE : {
int buf_size3 ;
tmp = av_realloc ( slices , sizeof ( * slices ) * ( n_slices + 1 ) ) ;
if ( ! tmp ) goto err ;
slices = tmp ;
slices [ n_slices ] . buf = av_mallocz ( buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! slices [ n_slices ] . buf ) goto err ;
buf_size3 = vc1_unescape_buffer ( start + 4 , size , slices [ n_slices ] . buf ) ;
init_get_bits ( & slices [ n_slices ] . gb , slices [ n_slices ] . buf , buf_size3 << 3 ) ;
slices [ n_slices ] . mby_start = get_bits ( & slices [ n_slices ] . gb , 9 ) ;
n_slices ++ ;
break ;
}
}
}
}
else if ( v -> interlace && ( ( buf [ 0 ] & 0xC0 ) == 0xC0 ) ) {
const uint8_t * divider ;
int buf_size3 ;
divider = find_next_marker ( buf , buf + buf_size ) ;
if ( ( divider == ( buf + buf_size ) ) || AV_RB32 ( divider ) != VC1_CODE_FIELD ) {
av_log ( avctx , AV_LOG_ERROR , "Error in WVC1 interlaced frame\n" ) ;
goto err ;
}
else {
tmp = av_realloc ( slices , sizeof ( * slices ) * ( n_slices + 1 ) ) ;
if ( ! tmp ) goto err ;
slices = tmp ;
slices [ n_slices ] . buf = av_mallocz ( buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! slices [ n_slices ] . buf ) goto err ;
buf_size3 = vc1_unescape_buffer ( divider + 4 , buf + buf_size - divider - 4 , slices [ n_slices ] . buf ) ;
init_get_bits ( & slices [ n_slices ] . gb , slices [ n_slices ] . buf , buf_size3 << 3 ) ;
slices [ n_slices ] . mby_start = s -> mb_height >> 1 ;
n_slices1 = n_slices - 1 ;
n_slices ++ ;
}
buf_size2 = vc1_unescape_buffer ( buf , divider - buf , buf2 ) ;
}
else {
buf_size2 = vc1_unescape_buffer ( buf , buf_size , buf2 ) ;
}
init_get_bits ( & s -> gb , buf2 , buf_size2 * 8 ) ;
}
else init_get_bits ( & s -> gb , buf , buf_size * 8 ) ;
if ( v -> res_sprite ) {
v -> new_sprite = ! get_bits1 ( & s -> gb ) ;
v -> two_sprites = get_bits1 ( & s -> gb ) ;
if ( avctx -> codec_id == AV_CODEC_ID_WMV3IMAGE || avctx -> codec_id == AV_CODEC_ID_VC1IMAGE ) {
if ( v -> new_sprite ) {
avctx -> width = avctx -> coded_width = v -> sprite_width ;
avctx -> height = avctx -> coded_height = v -> sprite_height ;
}
else {
goto image ;
}
}
}
if ( s -> context_initialized && ( s -> width != avctx -> coded_width || s -> height != avctx -> coded_height ) ) {
ff_vc1_decode_end ( avctx ) ;
}
if ( ! s -> context_initialized ) {
if ( ff_msmpeg4_decode_init ( avctx ) < 0 || ff_vc1_decode_init_alloc_tables ( v ) < 0 ) goto err ;
s -> low_delay = ! avctx -> has_b_frames || v -> res_sprite ;
if ( v -> profile == PROFILE_ADVANCED ) {
s -> h_edge_pos = avctx -> coded_width ;
s -> v_edge_pos = avctx -> coded_height ;
}
}
if ( s -> current_picture_ptr == NULL || s -> current_picture_ptr -> f . data [ 0 ] ) {
int i = ff_find_unused_picture ( s , 0 ) ;
if ( i < 0 ) goto err ;
s -> current_picture_ptr = & s -> picture [ i ] ;
}
v -> pic_header_flag = 0 ;
if ( v -> profile < PROFILE_ADVANCED ) {
if ( ff_vc1_parse_frame_header ( v , & s -> gb ) == - 1 ) {
goto err ;
}
}
else {
if ( ff_vc1_parse_frame_header_adv ( v , & s -> gb ) == - 1 ) {
goto err ;
}
}
if ( ( avctx -> codec_id == AV_CODEC_ID_WMV3IMAGE || avctx -> codec_id == AV_CODEC_ID_VC1IMAGE ) && s -> pict_type != AV_PICTURE_TYPE_I ) {
av_log ( v -> s . avctx , AV_LOG_ERROR , "Sprite decoder: expected I-frame\n" ) ;
goto err ;
}
s -> current_picture_ptr -> f . repeat_pict = 0 ;
if ( v -> rff ) {
s -> current_picture_ptr -> f . repeat_pict = 1 ;
}
else if ( v -> rptfrm ) {
s -> current_picture_ptr -> f . repeat_pict = v -> rptfrm * 2 ;
}
s -> current_picture . f . pict_type = s -> pict_type ;
s -> current_picture . f . key_frame = s -> pict_type == AV_PICTURE_TYPE_I ;
if ( s -> last_picture_ptr == NULL && ( s -> pict_type == AV_PICTURE_TYPE_B || s -> droppable ) ) {
goto err ;
}
if ( ( avctx -> skip_frame >= AVDISCARD_NONREF && s -> pict_type == AV_PICTURE_TYPE_B ) || ( avctx -> skip_frame >= AVDISCARD_NONKEY && s -> pict_type != AV_PICTURE_TYPE_I ) || avctx -> skip_frame >= AVDISCARD_ALL ) {
goto end ;
}
if ( s -> next_p_frame_damaged ) {
if ( s -> pict_type == AV_PICTURE_TYPE_B ) goto end ;
else s -> next_p_frame_damaged = 0 ;
}
if ( ff_MPV_frame_start ( s , avctx ) < 0 ) {
goto err ;
}
s -> me . qpel_put = s -> dsp . put_qpel_pixels_tab ;
s -> me . qpel_avg = s -> dsp . avg_qpel_pixels_tab ;
if ( ( CONFIG_VC1_VDPAU_DECODER ) && s -> avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) ff_vdpau_vc1_decode_picture ( s , buf_start , ( buf + buf_size ) - buf_start ) ;
else if ( avctx -> hwaccel ) {
if ( avctx -> hwaccel -> start_frame ( avctx , buf , buf_size ) < 0 ) goto err ;
if ( avctx -> hwaccel -> decode_slice ( avctx , buf_start , ( buf + buf_size ) - buf_start ) < 0 ) goto err ;
if ( avctx -> hwaccel -> end_frame ( avctx ) < 0 ) goto err ;
}
else {
ff_mpeg_er_frame_start ( s ) ;
v -> bits = buf_size * 8 ;
v -> end_mb_x = s -> mb_width ;
if ( v -> field_mode ) {
uint8_t * tmp [ 2 ] ;
s -> current_picture . f . linesize [ 0 ] <<= 1 ;
s -> current_picture . f . linesize [ 1 ] <<= 1 ;
s -> current_picture . f . linesize [ 2 ] <<= 1 ;
s -> linesize <<= 1 ;
s -> uvlinesize <<= 1 ;
tmp [ 0 ] = v -> mv_f_last [ 0 ] ;
tmp [ 1 ] = v -> mv_f_last [ 1 ] ;
v -> mv_f_last [ 0 ] = v -> mv_f_next [ 0 ] ;
v -> mv_f_last [ 1 ] = v -> mv_f_next [ 1 ] ;
v -> mv_f_next [ 0 ] = v -> mv_f [ 0 ] ;
v -> mv_f_next [ 1 ] = v -> mv_f [ 1 ] ;
v -> mv_f [ 0 ] = tmp [ 0 ] ;
v -> mv_f [ 1 ] = tmp [ 1 ] ;
}
mb_height = s -> mb_height >> v -> field_mode ;
for ( i = 0 ;
i <= n_slices ;
i ++ ) {
if ( i > 0 && slices [ i - 1 ] . mby_start >= mb_height ) {
if ( v -> field_mode <= 0 ) {
av_log ( v -> s . avctx , AV_LOG_ERROR , "Slice %d starts beyond " "picture boundary (%d >= %d)\n" , i , slices [ i - 1 ] . mby_start , mb_height ) ;
continue ;
}
v -> second_field = 1 ;
v -> blocks_off = s -> mb_width * s -> mb_height << 1 ;
v -> mb_off = s -> mb_stride * s -> mb_height >> 1 ;
}
else {
v -> second_field = 0 ;
v -> blocks_off = 0 ;
v -> mb_off = 0 ;
}
if ( i ) {
v -> pic_header_flag = 0 ;
if ( v -> field_mode && i == n_slices1 + 2 ) {
if ( ff_vc1_parse_frame_header_adv ( v , & s -> gb ) < 0 ) {
av_log ( v -> s . avctx , AV_LOG_ERROR , "Field header damaged\n" ) ;
continue ;
}
}
else if ( get_bits1 ( & s -> gb ) ) {
v -> pic_header_flag = 1 ;
if ( ff_vc1_parse_frame_header_adv ( v , & s -> gb ) < 0 ) {
av_log ( v -> s . avctx , AV_LOG_ERROR , "Slice header damaged\n" ) ;
continue ;
}
}
}
s -> start_mb_y = ( i == 0 ) ? 0 : FFMAX ( 0 , slices [ i - 1 ] . mby_start % mb_height ) ;
if ( ! v -> field_mode || v -> second_field ) s -> end_mb_y = ( i == n_slices ) ? mb_height : FFMIN ( mb_height , slices [ i ] . mby_start % mb_height ) ;
else s -> end_mb_y = ( i <= n_slices1 + 1 ) ? mb_height : FFMIN ( mb_height , slices [ i ] . mby_start % mb_height ) ;
ff_vc1_decode_blocks ( v ) ;
if ( i != n_slices ) s -> gb = slices [ i ] . gb ;
}
if ( v -> field_mode ) {
v -> second_field = 0 ;
if ( s -> pict_type == AV_PICTURE_TYPE_B ) {
memcpy ( v -> mv_f_base , v -> mv_f_next_base , 2 * ( s -> b8_stride * ( s -> mb_height * 2 + 1 ) + s -> mb_stride * ( s -> mb_height + 1 ) * 2 ) ) ;
}
s -> current_picture . f . linesize [ 0 ] >>= 1 ;
s -> current_picture . f . linesize [ 1 ] >>= 1 ;
s -> current_picture . f . linesize [ 2 ] >>= 1 ;
s -> linesize >>= 1 ;
s -> uvlinesize >>= 1 ;
}
av_dlog ( s -> avctx , "Consumed %i/%i bits\n" , get_bits_count ( & s -> gb ) , s -> gb . size_in_bits ) ;
ff_er_frame_end ( & s -> er ) ;
}
ff_MPV_frame_end ( s ) ;
if ( avctx -> codec_id == AV_CODEC_ID_WMV3IMAGE || avctx -> codec_id == AV_CODEC_ID_VC1IMAGE ) {
image : avctx -> width = avctx -> coded_width = v -> output_width ;
avctx -> height = avctx -> coded_height = v -> output_height ;
if ( avctx -> skip_frame >= AVDISCARD_NONREF ) goto end ;
# if CONFIG_WMV3IMAGE_DECODER || CONFIG_VC1IMAGE_DECODER if ( vc1_decode_sprites ( v , & s -> gb ) ) goto err ;
# endif if ( ( ret = av_frame_ref ( pict , & v -> sprite_output_frame ) ) < 0 ) goto err ;
* got_frame = 1 ;
}
else {
if ( s -> pict_type == AV_PICTURE_TYPE_B || s -> low_delay ) {
if ( ( ret = av_frame_ref ( pict , & s -> current_picture_ptr -> f ) ) < 0 ) goto err ;
ff_print_debug_info ( s , s -> current_picture_ptr ) ;
}
else if ( s -> last_picture_ptr != NULL ) {
if ( ( ret = av_frame_ref ( pict , & s -> last_picture_ptr -> f ) ) < 0 ) goto err ;
ff_print_debug_info ( s , s -> last_picture_ptr ) ;
}
if ( s -> last_picture_ptr || s -> low_delay ) {
* got_frame = 1 ;
}
}
end : av_free ( buf2 ) ;
for ( i = 0 ;
i < n_slices ;
i ++ ) av_free ( slices [ i ] . buf ) ;
av_free ( slices ) ;
return buf_size ;
err : av_free ( buf2 ) ;
for ( i = 0 ;
i < n_slices ;
i ++ ) av_free ( slices [ i ] . buf ) ;
av_free ( slices ) ;
return - 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void ef_debug ( u_char level , const char * message , ... ) {
va_list ap ;
if ( EF_GBL_OPTIONS -> debug < level ) return ;
va_start ( ap , message ) ;
vfprintf ( stderr , message , ap ) ;
fflush ( stderr ) ;
va_end ( ap ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_change_config ( struct VP9_COMP * cpi , const VP9EncoderConfig * oxcf ) {
VP9_COMMON * const cm = & cpi -> common ;
RATE_CONTROL * const rc = & cpi -> rc ;
if ( cm -> profile != oxcf -> profile ) cm -> profile = oxcf -> profile ;
cm -> bit_depth = oxcf -> bit_depth ;
if ( cm -> profile <= PROFILE_1 ) assert ( cm -> bit_depth == VPX_BITS_8 ) ;
else assert ( cm -> bit_depth > VPX_BITS_8 ) ;
cpi -> oxcf = * oxcf ;
# if CONFIG_VP9_HIGHBITDEPTH if ( cpi -> oxcf . use_highbitdepth ) {
cpi -> mb . e_mbd . bd = ( int ) cm -> bit_depth ;
}
# endif rc -> baseline_gf_interval = DEFAULT_GF_INTERVAL ;
cpi -> refresh_golden_frame = 0 ;
cpi -> refresh_last_frame = 1 ;
cm -> refresh_frame_context = 1 ;
cm -> reset_frame_context = 0 ;
vp9_reset_segment_features ( & cm -> seg ) ;
vp9_set_high_precision_mv ( cpi , 0 ) ;
{
int i ;
for ( i = 0 ;
i < MAX_SEGMENTS ;
i ++ ) cpi -> segment_encode_breakout [ i ] = cpi -> oxcf . encode_breakout ;
}
cpi -> encode_breakout = cpi -> oxcf . encode_breakout ;
set_rc_buffer_sizes ( rc , & cpi -> oxcf ) ;
rc -> bits_off_target = MIN ( rc -> bits_off_target , rc -> maximum_buffer_size ) ;
rc -> buffer_level = MIN ( rc -> buffer_level , rc -> maximum_buffer_size ) ;
vp9_new_framerate ( cpi , cpi -> framerate ) ;
rc -> worst_quality = cpi -> oxcf . worst_allowed_q ;
rc -> best_quality = cpi -> oxcf . best_allowed_q ;
cm -> interp_filter = cpi -> sf . default_interp_filter ;
cm -> display_width = cpi -> oxcf . width ;
cm -> display_height = cpi -> oxcf . height ;
if ( cpi -> initial_width ) {
assert ( cm -> width <= cpi -> initial_width ) ;
assert ( cm -> height <= cpi -> initial_height ) ;
}
update_frame_size ( cpi ) ;
if ( ( cpi -> svc . number_temporal_layers > 1 && cpi -> oxcf . rc_mode == VPX_CBR ) || ( ( cpi -> svc . number_temporal_layers > 1 || cpi -> svc . number_spatial_layers > 1 ) && cpi -> oxcf . pass == 2 ) ) {
vp9_update_layer_context_change_config ( cpi , ( int ) cpi -> oxcf . target_bandwidth ) ;
}
cpi -> alt_ref_source = NULL ;
rc -> is_src_frame_alt_ref = 0 ;
# if 0 cpi -> frame_distortion = 0 ;
cpi -> last_frame_distortion = 0 ;
# endif set_tile_limits ( cpi ) ;
cpi -> ext_refresh_frame_flags_pending = 0 ;
cpi -> ext_refresh_frame_context_pending = 0 ;
# if CONFIG_VP9_TEMPORAL_DENOISING if ( cpi -> oxcf . noise_sensitivity > 0 ) {
vp9_denoiser_alloc ( & ( cpi -> denoiser ) , cm -> width , cm -> height , cm -> subsampling_x , cm -> subsampling_y , # if CONFIG_VP9_HIGHBITDEPTH cm -> use_highbitdepth , # endif VP9_ENC_BORDER_IN_PIXELS ) ;
}
# endif } | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int mpc8_decode_frame ( AVCodecContext * avctx , void * data , int * got_frame_ptr , AVPacket * avpkt ) {
AVFrame * frame = data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
MPCContext * c = avctx -> priv_data ;
GetBitContext gb2 , * gb = & gb2 ;
int i , j , k , ch , cnt , res , t ;
Band * bands = c -> bands ;
int off ;
int maxband , keyframe ;
int last [ 2 ] ;
frame -> nb_samples = MPC_FRAME_SIZE ;
if ( ( res = ff_get_buffer ( avctx , frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return res ;
}
keyframe = c -> cur_frame == 0 ;
if ( keyframe ) {
memset ( c -> Q , 0 , sizeof ( c -> Q ) ) ;
c -> last_bits_used = 0 ;
}
init_get_bits ( gb , buf , buf_size * 8 ) ;
skip_bits ( gb , c -> last_bits_used & 7 ) ;
if ( keyframe ) maxband = mpc8_get_mod_golomb ( gb , c -> maxbands + 1 ) ;
else {
maxband = c -> last_max_band + get_vlc2 ( gb , band_vlc . table , MPC8_BANDS_BITS , 2 ) ;
if ( maxband > 32 ) maxband -= 33 ;
}
if ( maxband > c -> maxbands + 1 ) return AVERROR_INVALIDDATA ;
c -> last_max_band = maxband ;
if ( maxband ) {
last [ 0 ] = last [ 1 ] = 0 ;
for ( i = maxband - 1 ;
i >= 0 ;
i -- ) {
for ( ch = 0 ;
ch < 2 ;
ch ++ ) {
last [ ch ] = get_vlc2 ( gb , res_vlc [ last [ ch ] > 2 ] . table , MPC8_RES_BITS , 2 ) + last [ ch ] ;
if ( last [ ch ] > 15 ) last [ ch ] -= 17 ;
bands [ i ] . res [ ch ] = last [ ch ] ;
}
}
if ( c -> MSS ) {
int mask ;
cnt = 0 ;
for ( i = 0 ;
i < maxband ;
i ++ ) if ( bands [ i ] . res [ 0 ] || bands [ i ] . res [ 1 ] ) cnt ++ ;
t = mpc8_get_mod_golomb ( gb , cnt ) ;
mask = mpc8_get_mask ( gb , cnt , t ) ;
for ( i = maxband - 1 ;
i >= 0 ;
i -- ) if ( bands [ i ] . res [ 0 ] || bands [ i ] . res [ 1 ] ) {
bands [ i ] . msf = mask & 1 ;
mask >>= 1 ;
}
}
}
for ( i = maxband ;
i < c -> maxbands ;
i ++ ) bands [ i ] . res [ 0 ] = bands [ i ] . res [ 1 ] = 0 ;
if ( keyframe ) {
for ( i = 0 ;
i < 32 ;
i ++ ) c -> oldDSCF [ 0 ] [ i ] = c -> oldDSCF [ 1 ] [ i ] = 1 ;
}
for ( i = 0 ;
i < maxband ;
i ++ ) {
if ( bands [ i ] . res [ 0 ] || bands [ i ] . res [ 1 ] ) {
cnt = ! ! bands [ i ] . res [ 0 ] + ! ! bands [ i ] . res [ 1 ] - 1 ;
if ( cnt >= 0 ) {
t = get_vlc2 ( gb , scfi_vlc [ cnt ] . table , scfi_vlc [ cnt ] . bits , 1 ) ;
if ( bands [ i ] . res [ 0 ] ) bands [ i ] . scfi [ 0 ] = t >> ( 2 * cnt ) ;
if ( bands [ i ] . res [ 1 ] ) bands [ i ] . scfi [ 1 ] = t & 3 ;
}
}
}
for ( i = 0 ;
i < maxband ;
i ++ ) {
for ( ch = 0 ;
ch < 2 ;
ch ++ ) {
if ( ! bands [ i ] . res [ ch ] ) continue ;
if ( c -> oldDSCF [ ch ] [ i ] ) {
bands [ i ] . scf_idx [ ch ] [ 0 ] = get_bits ( gb , 7 ) - 6 ;
c -> oldDSCF [ ch ] [ i ] = 0 ;
}
else {
t = get_vlc2 ( gb , dscf_vlc [ 1 ] . table , MPC8_DSCF1_BITS , 2 ) ;
if ( t == 64 ) t += get_bits ( gb , 6 ) ;
bands [ i ] . scf_idx [ ch ] [ 0 ] = ( ( bands [ i ] . scf_idx [ ch ] [ 2 ] + t - 25 ) & 0x7F ) - 6 ;
}
for ( j = 0 ;
j < 2 ;
j ++ ) {
if ( ( bands [ i ] . scfi [ ch ] << j ) & 2 ) bands [ i ] . scf_idx [ ch ] [ j + 1 ] = bands [ i ] . scf_idx [ ch ] [ j ] ;
else {
t = get_vlc2 ( gb , dscf_vlc [ 0 ] . table , MPC8_DSCF0_BITS , 2 ) ;
if ( t == 31 ) t = 64 + get_bits ( gb , 6 ) ;
bands [ i ] . scf_idx [ ch ] [ j + 1 ] = ( ( bands [ i ] . scf_idx [ ch ] [ j ] + t - 25 ) & 0x7F ) - 6 ;
}
}
}
}
for ( i = 0 , off = 0 ;
i < maxband ;
i ++ , off += SAMPLES_PER_BAND ) {
for ( ch = 0 ;
ch < 2 ;
ch ++ ) {
res = bands [ i ] . res [ ch ] ;
switch ( res ) {
case - 1 : for ( j = 0 ;
j < SAMPLES_PER_BAND ;
j ++ ) c -> Q [ ch ] [ off + j ] = ( av_lfg_get ( & c -> rnd ) & 0x3FC ) - 510 ;
break ;
case 0 : break ;
case 1 : for ( j = 0 ;
j < SAMPLES_PER_BAND ;
j += SAMPLES_PER_BAND / 2 ) {
cnt = get_vlc2 ( gb , q1_vlc . table , MPC8_Q1_BITS , 2 ) ;
t = mpc8_get_mask ( gb , 18 , cnt ) ;
for ( k = 0 ;
k < SAMPLES_PER_BAND / 2 ;
k ++ , t <<= 1 ) c -> Q [ ch ] [ off + j + k ] = ( t & 0x20000 ) ? ( get_bits1 ( gb ) << 1 ) - 1 : 0 ;
}
break ;
case 2 : cnt = 6 ;
for ( j = 0 ;
j < SAMPLES_PER_BAND ;
j += 3 ) {
t = get_vlc2 ( gb , q2_vlc [ cnt > 3 ] . table , MPC8_Q2_BITS , 2 ) ;
c -> Q [ ch ] [ off + j + 0 ] = mpc8_idx50 [ t ] ;
c -> Q [ ch ] [ off + j + 1 ] = mpc8_idx51 [ t ] ;
c -> Q [ ch ] [ off + j + 2 ] = mpc8_idx52 [ t ] ;
cnt = ( cnt >> 1 ) + mpc8_huffq2 [ t ] ;
}
break ;
case 3 : case 4 : for ( j = 0 ;
j < SAMPLES_PER_BAND ;
j += 2 ) {
t = get_vlc2 ( gb , q3_vlc [ res - 3 ] . table , MPC8_Q3_BITS , 2 ) + q3_offsets [ res - 3 ] ;
c -> Q [ ch ] [ off + j + 1 ] = t >> 4 ;
c -> Q [ ch ] [ off + j + 0 ] = ( t & 8 ) ? ( t & 0xF ) - 16 : ( t & 0xF ) ;
}
break ;
case 5 : case 6 : case 7 : case 8 : cnt = 2 * mpc8_thres [ res ] ;
for ( j = 0 ;
j < SAMPLES_PER_BAND ;
j ++ ) {
t = get_vlc2 ( gb , quant_vlc [ res - 5 ] [ cnt > mpc8_thres [ res ] ] . table , quant_vlc [ res - 5 ] [ cnt > mpc8_thres [ res ] ] . bits , 2 ) + quant_offsets [ res - 5 ] ;
c -> Q [ ch ] [ off + j ] = t ;
cnt = ( cnt >> 1 ) + FFABS ( c -> Q [ ch ] [ off + j ] ) ;
}
break ;
default : for ( j = 0 ;
j < SAMPLES_PER_BAND ;
j ++ ) {
c -> Q [ ch ] [ off + j ] = get_vlc2 ( gb , q9up_vlc . table , MPC8_Q9UP_BITS , 2 ) ;
if ( res != 9 ) {
c -> Q [ ch ] [ off + j ] <<= res - 9 ;
c -> Q [ ch ] [ off + j ] |= get_bits ( gb , res - 9 ) ;
}
c -> Q [ ch ] [ off + j ] -= ( 1 << ( res - 2 ) ) - 1 ;
}
}
}
}
ff_mpc_dequantize_and_synth ( c , maxband - 1 , ( int16_t * * ) frame -> extended_data , avctx -> channels ) ;
c -> cur_frame ++ ;
c -> last_bits_used = get_bits_count ( gb ) ;
if ( get_bits_left ( gb ) < 8 ) c -> last_bits_used = buf_size << 3 ;
if ( c -> cur_frame >= c -> frames ) c -> cur_frame = 0 ;
* got_frame_ptr = 1 ;
return c -> cur_frame ? c -> last_bits_used >> 3 : buf_size ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static UBool generateFromUTable ( CnvExtData * extData , UCMTable * table , int32_t start , int32_t limit , int32_t unitIndex , uint32_t defaultValue ) {
UCMapping * mappings , * m ;
int32_t * map ;
int32_t i , j , uniqueCount , count , subStart , subLimit ;
UChar * uchars ;
UChar32 low , high , prev ;
UChar * sectionUChars ;
uint32_t * sectionValues ;
mappings = table -> mappings ;
map = table -> reverseMap ;
m = mappings + map [ start ] ;
uchars = ( UChar * ) UCM_GET_CODE_POINTS ( table , m ) ;
low = uchars [ unitIndex ] ;
uniqueCount = 1 ;
prev = high = low ;
for ( i = start + 1 ;
i < limit ;
++ i ) {
m = mappings + map [ i ] ;
uchars = ( UChar * ) UCM_GET_CODE_POINTS ( table , m ) ;
high = uchars [ unitIndex ] ;
if ( high != prev ) {
prev = high ;
++ uniqueCount ;
}
}
count = uniqueCount ;
sectionUChars = ( UChar * ) utm_allocN ( extData -> fromUTableUChars , 1 + count ) ;
sectionValues = ( uint32_t * ) utm_allocN ( extData -> fromUTableValues , 1 + count ) ;
* sectionUChars ++ = ( UChar ) count ;
* sectionValues ++ = defaultValue ;
prev = low - 1 ;
j = 0 ;
for ( i = start ;
i < limit ;
++ i ) {
m = mappings + map [ i ] ;
uchars = ( UChar * ) UCM_GET_CODE_POINTS ( table , m ) ;
high = uchars [ unitIndex ] ;
if ( high != prev ) {
prev = high ;
sectionUChars [ j ] = ( UChar ) high ;
sectionValues [ j ] = ( uint32_t ) i ;
++ j ;
}
}
subLimit = ( int32_t ) ( sectionValues [ 0 ] ) ;
for ( j = 0 ;
j < count ;
++ j ) {
subStart = subLimit ;
subLimit = ( j + 1 ) < count ? ( int32_t ) ( sectionValues [ j + 1 ] ) : limit ;
defaultValue = 0 ;
m = mappings + map [ subStart ] ;
if ( m -> uLen == unitIndex + 1 ) {
++ subStart ;
if ( subStart < subLimit && mappings [ map [ subStart ] ] . uLen == unitIndex + 1 ) {
fprintf ( stderr , "error: multiple mappings from same Unicode code points\n" ) ;
ucm_printMapping ( table , m , stderr ) ;
ucm_printMapping ( table , mappings + map [ subStart ] , stderr ) ;
return FALSE ;
}
defaultValue = getFromUBytesValue ( extData , table , m ) ;
}
if ( subStart == subLimit ) {
sectionValues [ j ] = defaultValue ;
}
else {
sectionValues [ j ] = ( uint32_t ) utm_countItems ( extData -> fromUTableValues ) ;
if ( ! generateFromUTable ( extData , table , subStart , subLimit , unitIndex + 1 , defaultValue ) ) {
return FALSE ;
}
}
}
return TRUE ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline void tswap64s ( uint64_t * s ) {
} | 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 ) {
MDECContext * const a = avctx -> priv_data ;
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
ThreadFrame frame = {
. f = data }
;
int i , ret ;
if ( ( ret = ff_thread_get_buffer ( avctx , & frame , 0 ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
frame . f -> pict_type = AV_PICTURE_TYPE_I ;
frame . f -> key_frame = 1 ;
av_fast_malloc ( & a -> bitstream_buffer , & a -> bitstream_buffer_size , buf_size + FF_INPUT_BUFFER_PADDING_SIZE ) ;
if ( ! a -> bitstream_buffer ) return AVERROR ( ENOMEM ) ;
for ( i = 0 ;
i < buf_size ;
i += 2 ) {
a -> bitstream_buffer [ i ] = buf [ i + 1 ] ;
a -> bitstream_buffer [ i + 1 ] = buf [ i ] ;
}
init_get_bits ( & a -> gb , a -> bitstream_buffer , buf_size * 8 ) ;
skip_bits ( & a -> gb , 32 ) ;
a -> qscale = get_bits ( & a -> gb , 16 ) ;
a -> version = get_bits ( & a -> gb , 16 ) ;
a -> last_dc [ 0 ] = a -> last_dc [ 1 ] = a -> last_dc [ 2 ] = 128 ;
for ( a -> mb_x = 0 ;
a -> mb_x < a -> mb_width ;
a -> mb_x ++ ) {
for ( a -> mb_y = 0 ;
a -> mb_y < a -> mb_height ;
a -> mb_y ++ ) {
if ( ( ret = decode_mb ( a , a -> block ) ) < 0 ) return ret ;
idct_put ( a , frame . f , a -> mb_x , a -> mb_y ) ;
}
}
* got_frame = 1 ;
return ( get_bits_count ( & a -> gb ) + 31 ) / 32 * 4 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int decode_udvm_multitype_operand ( guint8 * buff , guint operand_address , guint16 * value ) {
guint test_bits ;
guint bytecode ;
guint offset = operand_address ;
guint16 operand ;
guint32 result ;
guint8 temp_data ;
guint16 temp_data16 ;
guint16 memmory_addr = 0 ;
* value = 0 ;
if ( operand_address >= UDVM_MEMORY_SIZE ) return - 1 ;
bytecode = buff [ operand_address ] ;
test_bits = ( bytecode & 0xc0 ) >> 6 ;
switch ( test_bits ) {
case 0 : operand = buff [ operand_address ] ;
* value = operand ;
offset ++ ;
break ;
case 1 : memmory_addr = ( bytecode & 0x3f ) * 2 ;
temp_data16 = buff [ memmory_addr ] << 8 ;
temp_data16 = temp_data16 | buff [ ( memmory_addr + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset ++ ;
break ;
case 2 : test_bits = ( bytecode & 0xe0 ) >> 5 ;
if ( test_bits == 5 ) {
temp_data = buff [ operand_address ] & 0x1f ;
operand = temp_data << 8 ;
temp_data = buff [ ( operand_address + 1 ) & 0xffff ] ;
operand = operand | temp_data ;
* value = operand ;
offset = offset + 2 ;
}
else {
test_bits = ( bytecode & 0xf0 ) >> 4 ;
if ( test_bits == 9 ) {
temp_data = buff [ operand_address ] & 0x0f ;
operand = temp_data << 8 ;
temp_data = buff [ ( operand_address + 1 ) & 0xffff ] ;
operand = operand | temp_data ;
operand = operand + 61440 ;
* value = operand ;
offset = offset + 2 ;
}
else {
test_bits = ( bytecode & 0x08 ) >> 3 ;
if ( test_bits == 1 ) {
result = 1 << ( ( buff [ operand_address ] & 0x07 ) + 8 ) ;
operand = result & 0xffff ;
* value = operand ;
offset ++ ;
}
else {
test_bits = ( bytecode & 0x0e ) >> 1 ;
if ( test_bits == 3 ) {
result = 1 << ( ( buff [ operand_address ] & 0x01 ) + 6 ) ;
operand = result & 0xffff ;
* value = operand ;
offset ++ ;
}
else {
offset ++ ;
temp_data16 = buff [ ( operand_address + 1 ) & 0xffff ] << 8 ;
temp_data16 = temp_data16 | buff [ ( operand_address + 2 ) & 0xffff ] ;
if ( ( bytecode & 0x01 ) == 1 ) {
memmory_addr = temp_data16 ;
temp_data16 = buff [ memmory_addr ] << 8 ;
temp_data16 = temp_data16 | buff [ ( memmory_addr + 1 ) & 0xffff ] ;
}
* value = temp_data16 ;
offset = offset + 2 ;
}
}
}
}
break ;
case 3 : test_bits = ( bytecode & 0x20 ) >> 5 ;
if ( test_bits == 1 ) {
operand = ( buff [ operand_address ] & 0x1f ) + 65504 ;
* value = operand ;
offset ++ ;
}
else {
memmory_addr = buff [ operand_address ] & 0x1f ;
memmory_addr = memmory_addr << 8 ;
memmory_addr = memmory_addr | buff [ ( operand_address + 1 ) & 0xffff ] ;
temp_data16 = buff [ memmory_addr ] << 8 ;
temp_data16 = temp_data16 | buff [ ( memmory_addr + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset = offset + 2 ;
}
default : break ;
}
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static PyObject * string_sizeof ( PyStringObject * v ) {
Py_ssize_t res ;
res = PyStringObject_SIZE + PyString_GET_SIZE ( v ) * Py_TYPE ( v ) -> tp_itemsize ;
return PyInt_FromSsize_t ( res ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | my_bool grant_init ( ) {
THD * thd ;
my_bool return_val ;
DBUG_ENTER ( "grant_init" ) ;
if ( ! ( thd = new THD ) ) DBUG_RETURN ( 1 ) ;
thd -> thread_stack = ( char * ) & thd ;
thd -> store_globals ( ) ;
lex_start ( thd ) ;
return_val = grant_reload ( thd ) ;
delete thd ;
my_pthread_setspecific_ptr ( THR_THD , 0 ) ;
DBUG_RETURN ( return_val ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void pmac_ide_flush ( DBDMA_io * io ) {
MACIOIDEState * m = io -> opaque ;
if ( m -> aiocb ) {
blk_drain_all ( ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void e1000e_set_phy_page ( E1000ECore * core , int index , uint16_t val ) {
core -> phy [ 0 ] [ PHY_PAGE ] = val & PHY_PAGE_RW_MASK ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSFile TSfopen ( const char * filename , const char * mode ) {
FileImpl * file ;
file = new FileImpl ;
if ( ! file -> fopen ( filename , mode ) ) {
delete file ;
return nullptr ;
}
return ( TSFile ) file ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) typedef void * OPENSSL_BLOCK ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_BLOCK , void ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static unsigned int read32 ( const uint8_t * * ptr , int is_big ) {
unsigned int temp ;
if ( is_big ) {
temp = AV_RB32 ( * ptr ) ;
}
else {
temp = AV_RL32 ( * ptr ) ;
}
* ptr += 4 ;
return temp ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static inline bool is_one_of ( const hb_glyph_info_t & info , unsigned int flags ) {
if ( _hb_glyph_info_ligated ( & info ) ) return false ;
return ! ! ( FLAG_SAFE ( info . indic_category ( ) ) & flags ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int pfkey_delete ( struct sock * sk , struct sk_buff * skb , const struct sadb_msg * hdr , void * const * ext_hdrs ) {
struct net * net = sock_net ( sk ) ;
struct xfrm_state * x ;
struct km_event c ;
int err ;
if ( ! ext_hdrs [ SADB_EXT_SA - 1 ] || ! present_and_same_family ( ext_hdrs [ SADB_EXT_ADDRESS_SRC - 1 ] , ext_hdrs [ SADB_EXT_ADDRESS_DST - 1 ] ) ) return - EINVAL ;
x = pfkey_xfrm_state_lookup ( net , hdr , ext_hdrs ) ;
if ( x == NULL ) return - ESRCH ;
if ( ( err = security_xfrm_state_delete ( x ) ) ) goto out ;
if ( xfrm_state_kern ( x ) ) {
err = - EPERM ;
goto out ;
}
err = xfrm_state_delete ( x ) ;
if ( err < 0 ) goto out ;
c . seq = hdr -> sadb_msg_seq ;
c . portid = hdr -> sadb_msg_pid ;
c . event = XFRM_MSG_DELSA ;
km_state_notify ( x , & c ) ;
out : xfrm_audit_state_delete ( x , err ? 0 : 1 , audit_get_loginuid ( current ) , audit_get_sessionid ( current ) , 0 ) ;
xfrm_state_put ( x ) ;
return err ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void bn_mul_comba8 ( BN_ULONG * r , BN_ULONG * a , BN_ULONG * b ) {
BN_ULONG t1 , t2 ;
BN_ULONG c1 , c2 , c3 ;
c1 = 0 ;
c2 = 0 ;
c3 = 0 ;
mul_add_c ( a [ 0 ] , b [ 0 ] , c1 , c2 , c3 ) ;
r [ 0 ] = c1 ;
c1 = 0 ;
mul_add_c ( a [ 0 ] , b [ 1 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 1 ] , b [ 0 ] , c2 , c3 , c1 ) ;
r [ 1 ] = c2 ;
c2 = 0 ;
mul_add_c ( a [ 2 ] , b [ 0 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 1 ] , b [ 1 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 0 ] , b [ 2 ] , c3 , c1 , c2 ) ;
r [ 2 ] = c3 ;
c3 = 0 ;
mul_add_c ( a [ 0 ] , b [ 3 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 1 ] , b [ 2 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 2 ] , b [ 1 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 3 ] , b [ 0 ] , c1 , c2 , c3 ) ;
r [ 3 ] = c1 ;
c1 = 0 ;
mul_add_c ( a [ 4 ] , b [ 0 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 3 ] , b [ 1 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 2 ] , b [ 2 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 1 ] , b [ 3 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 0 ] , b [ 4 ] , c2 , c3 , c1 ) ;
r [ 4 ] = c2 ;
c2 = 0 ;
mul_add_c ( a [ 0 ] , b [ 5 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 1 ] , b [ 4 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 2 ] , b [ 3 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 3 ] , b [ 2 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 4 ] , b [ 1 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 5 ] , b [ 0 ] , c3 , c1 , c2 ) ;
r [ 5 ] = c3 ;
c3 = 0 ;
mul_add_c ( a [ 6 ] , b [ 0 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 5 ] , b [ 1 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 4 ] , b [ 2 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 3 ] , b [ 3 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 2 ] , b [ 4 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 1 ] , b [ 5 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 0 ] , b [ 6 ] , c1 , c2 , c3 ) ;
r [ 6 ] = c1 ;
c1 = 0 ;
mul_add_c ( a [ 0 ] , b [ 7 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 1 ] , b [ 6 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 2 ] , b [ 5 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 3 ] , b [ 4 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 4 ] , b [ 3 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 5 ] , b [ 2 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 6 ] , b [ 1 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 7 ] , b [ 0 ] , c2 , c3 , c1 ) ;
r [ 7 ] = c2 ;
c2 = 0 ;
mul_add_c ( a [ 7 ] , b [ 1 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 6 ] , b [ 2 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 5 ] , b [ 3 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 4 ] , b [ 4 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 3 ] , b [ 5 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 2 ] , b [ 6 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 1 ] , b [ 7 ] , c3 , c1 , c2 ) ;
r [ 8 ] = c3 ;
c3 = 0 ;
mul_add_c ( a [ 2 ] , b [ 7 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 3 ] , b [ 6 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 4 ] , b [ 5 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 5 ] , b [ 4 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 6 ] , b [ 3 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 7 ] , b [ 2 ] , c1 , c2 , c3 ) ;
r [ 9 ] = c1 ;
c1 = 0 ;
mul_add_c ( a [ 7 ] , b [ 3 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 6 ] , b [ 4 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 5 ] , b [ 5 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 4 ] , b [ 6 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 3 ] , b [ 7 ] , c2 , c3 , c1 ) ;
r [ 10 ] = c2 ;
c2 = 0 ;
mul_add_c ( a [ 4 ] , b [ 7 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 5 ] , b [ 6 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 6 ] , b [ 5 ] , c3 , c1 , c2 ) ;
mul_add_c ( a [ 7 ] , b [ 4 ] , c3 , c1 , c2 ) ;
r [ 11 ] = c3 ;
c3 = 0 ;
mul_add_c ( a [ 7 ] , b [ 5 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 6 ] , b [ 6 ] , c1 , c2 , c3 ) ;
mul_add_c ( a [ 5 ] , b [ 7 ] , c1 , c2 , c3 ) ;
r [ 12 ] = c1 ;
c1 = 0 ;
mul_add_c ( a [ 6 ] , b [ 7 ] , c2 , c3 , c1 ) ;
mul_add_c ( a [ 7 ] , b [ 6 ] , c2 , c3 , c1 ) ;
r [ 13 ] = c2 ;
c2 = 0 ;
mul_add_c ( a [ 7 ] , b [ 7 ] , c3 , c1 , c2 ) ;
r [ 14 ] = c3 ;
r [ 15 ] = c1 ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static void stream_add_data ( struct attachment_istream * astream , const void * data , size_t size ) {
if ( size > 0 ) {
memcpy ( i_stream_alloc ( & astream -> istream , size ) , data , size ) ;
astream -> istream . pos += size ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int SpoolssStartDocPrinter_r ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
offset = dissect_ndr_uint32 ( tvb , offset , pinfo , tree , di , drep , hf_job_id , NULL ) ;
offset = dissect_doserror ( tvb , offset , pinfo , tree , di , drep , hf_rc , NULL ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int com_prompt ( String * buffer __attribute__ ( ( unused ) ) , char * line ) {
char * ptr = strchr ( line , ' ' ) ;
prompt_counter = 0 ;
my_free ( current_prompt ) ;
current_prompt = my_strdup ( ptr ? ptr + 1 : default_prompt , MYF ( MY_WME ) ) ;
if ( ! ptr ) tee_fprintf ( stdout , "Returning to default PROMPT of %s\n" , default_prompt ) ;
else tee_fprintf ( stdout , "PROMPT set to '%s'\n" , current_prompt ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | struct groupchat * purple_chat_with ( struct im_connection * ic , char * who ) {
struct purple_data * pd = ic -> proto_data ;
PurplePlugin * prpl = purple_plugins_find_with_id ( pd -> account -> protocol_id ) ;
PurplePluginProtocolInfo * pi = prpl -> info -> extra_info ;
PurpleBuddy * pb = purple_find_buddy ( pd -> account , who ) ;
PurpleMenuAction * mi ;
GList * menu ;
void ( * callback ) ( PurpleBlistNode * , gpointer ) ;
if ( ! pb || ! pi || ! pi -> blist_node_menu ) {
return NULL ;
}
menu = pi -> blist_node_menu ( & pb -> node ) ;
while ( menu ) {
mi = menu -> data ;
if ( purple_menu_cmp ( mi -> label , "initiate chat" ) || purple_menu_cmp ( mi -> label , "initiate conference" ) ) {
break ;
}
menu = menu -> next ;
}
if ( menu == NULL ) {
return NULL ;
}
callback = ( void * ) mi -> callback ;
callback ( & pb -> node , mi -> data ) ;
return NULL ;
} | 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 ) {
AnmContext * s = avctx -> priv_data ;
const int buf_size = avpkt -> size ;
uint8_t * dst , * dst_end ;
int count , ret ;
if ( ( ret = avctx -> reget_buffer ( avctx , & s -> frame ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "get_buffer() failed\n" ) ;
return ret ;
}
dst = s -> frame . data [ 0 ] ;
dst_end = s -> frame . data [ 0 ] + s -> frame . linesize [ 0 ] * avctx -> height ;
bytestream2_init ( & s -> gb , avpkt -> data , buf_size ) ;
if ( bytestream2_get_byte ( & s -> gb ) != 0x42 ) {
av_log_ask_for_sample ( avctx , "unknown record type\n" ) ;
return buf_size ;
}
if ( bytestream2_get_byte ( & s -> gb ) ) {
av_log_ask_for_sample ( avctx , "padding bytes not supported\n" ) ;
return buf_size ;
}
bytestream2_skip ( & s -> gb , 2 ) ;
s -> x = 0 ;
do {
# define OP ( gb , pixel , count ) op ( & dst , dst_end , ( gb ) , ( pixel ) , ( count ) , & s -> x , avctx -> width , s -> frame . linesize [ 0 ] ) int type = bytestream2_get_byte ( & s -> gb ) ;
count = type & 0x7F ;
type >>= 7 ;
if ( count ) {
if ( OP ( type ? NULL : & s -> gb , - 1 , count ) ) break ;
}
else if ( ! type ) {
int pixel ;
count = bytestream2_get_byte ( & s -> gb ) ;
pixel = bytestream2_get_byte ( & s -> gb ) ;
if ( OP ( NULL , pixel , count ) ) break ;
}
else {
int pixel ;
type = bytestream2_get_le16 ( & s -> gb ) ;
count = type & 0x3FFF ;
type >>= 14 ;
if ( ! count ) {
if ( type == 0 ) break ;
if ( type == 2 ) {
av_log_ask_for_sample ( avctx , "unknown opcode" ) ;
return AVERROR_PATCHWELCOME ;
}
continue ;
}
pixel = type == 3 ? bytestream2_get_byte ( & s -> gb ) : - 1 ;
if ( type == 1 ) count += 0x4000 ;
if ( OP ( type == 2 ? & s -> gb : NULL , pixel , count ) ) break ;
}
}
while ( bytestream2_get_bytes_left ( & s -> gb ) > 0 ) ;
memcpy ( s -> frame . data [ 1 ] , s -> palette , AVPALETTE_SIZE ) ;
* got_frame = 1 ;
* ( AVFrame * ) data = s -> frame ;
return buf_size ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int write_path_table ( struct archive_write * a , int type_m , struct vdd * vdd ) {
int depth , r ;
size_t path_table_size ;
r = ARCHIVE_OK ;
path_table_size = 0 ;
for ( depth = 0 ;
depth < vdd -> max_depth ;
depth ++ ) {
r = _write_path_table ( a , type_m , depth , vdd ) ;
if ( r < 0 ) return ( r ) ;
path_table_size += r ;
}
path_table_size = path_table_size % PATH_TABLE_BLOCK_SIZE ;
if ( path_table_size > 0 ) r = write_null ( a , PATH_TABLE_BLOCK_SIZE - path_table_size ) ;
return ( r ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void aes_crypt_cbc ( aes_context * ctx , int mode , int length , unsigned char iv [ 16 ] , const unsigned char * input , unsigned char * output ) {
int i ;
unsigned char temp [ 16 ] ;
# if defined ( XYSSL_PADLOCK_C ) && defined ( XYSSL_HAVE_X86 ) if ( padlock_supports ( PADLOCK_ACE ) ) {
if ( padlock_xcryptcbc ( ctx , mode , length , iv , input , output ) == 0 ) return ;
}
# endif if ( mode == AES_DECRYPT ) {
while ( length > 0 ) {
memcpy ( temp , input , 16 ) ;
aes_crypt_ecb ( ctx , mode , input , output ) ;
for ( i = 0 ;
i < 16 ;
i ++ ) output [ i ] = ( unsigned char ) ( output [ i ] ^ iv [ i ] ) ;
memcpy ( iv , temp , 16 ) ;
input += 16 ;
output += 16 ;
length -= 16 ;
}
}
else {
while ( length > 0 ) {
for ( i = 0 ;
i < 16 ;
i ++ ) output [ i ] = ( unsigned char ) ( input [ i ] ^ iv [ i ] ) ;
aes_crypt_ecb ( ctx , mode , output , output ) ;
memcpy ( iv , output , 16 ) ;
input += 16 ;
output += 16 ;
length -= 16 ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int kvm_put_msr_feature_control ( X86CPU * cpu ) {
int ret ;
if ( ! has_msr_feature_control ) {
return 0 ;
}
ret = kvm_put_one_msr ( cpu , MSR_IA32_FEATURE_CONTROL , cpu -> env . msr_ia32_feature_control ) ;
if ( ret < 0 ) {
return ret ;
}
assert ( ret == 1 ) ;
return 0 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static struct object_list * * process_blob ( struct blob * blob , struct object_list * * p , struct name_path * path , const char * name ) {
struct object * obj = & blob -> object ;
obj -> flags |= LOCAL ;
if ( obj -> flags & ( UNINTERESTING | SEEN ) ) return p ;
obj -> flags |= SEEN ;
return add_one_object ( obj , p ) ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h225_TBCD_STRING ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
# line 900 "./asn1/h225/h225.cnf" int min_len , max_len ;
gboolean has_extension ;
get_size_constraint_from_stack ( actx , "TBCD_STRING" , & min_len , & max_len , & has_extension ) ;
offset = dissect_per_restricted_character_string ( tvb , offset , actx , tree , hf_index , min_len , max_len , has_extension , "0123456789#*abc" , 15 , NULL ) ;
return offset ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_spoolss_doc_info_1 ( tvbuff_t * tvb , int offset , packet_info * pinfo , proto_tree * tree , dcerpc_info * di , guint8 * drep ) {
proto_tree * subtree ;
subtree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_DOC_INFO_1 , NULL , "Document info level 1" ) ;
offset = dissect_ndr_str_pointer_item ( tvb , offset , pinfo , subtree , di , drep , NDR_POINTER_UNIQUE , "Document name" , hf_documentname , 0 ) ;
offset = dissect_ndr_str_pointer_item ( tvb , offset , pinfo , subtree , di , drep , NDR_POINTER_UNIQUE , "Output file" , hf_outputfile , 0 ) ;
offset = dissect_ndr_str_pointer_item ( tvb , offset , pinfo , subtree , di , drep , NDR_POINTER_UNIQUE , "Data type" , hf_datatype , 0 ) ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_udvm_reference_operand_memory ( guint8 * buff , guint operand_address , guint16 * value , guint * result_dest ) {
guint bytecode ;
guint16 operand ;
guint offset = operand_address ;
guint test_bits ;
guint8 temp_data ;
guint16 temp_data16 ;
if ( operand_address >= UDVM_MEMORY_SIZE ) return - 1 ;
bytecode = buff [ operand_address ] ;
test_bits = bytecode >> 7 ;
if ( test_bits == 1 ) {
test_bits = bytecode >> 6 ;
if ( test_bits == 2 ) {
temp_data = buff [ operand_address ] & 0x3f ;
operand = temp_data << 8 ;
temp_data = buff [ ( operand_address + 1 ) & 0xffff ] ;
operand = operand | temp_data ;
operand = ( operand * 2 ) ;
* result_dest = operand ;
temp_data16 = buff [ operand ] << 8 ;
temp_data16 = temp_data16 | buff [ ( operand + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset = offset + 2 ;
}
else {
operand_address ++ ;
operand = buff [ operand_address ] << 8 ;
operand = operand | buff [ ( operand_address + 1 ) & 0xffff ] ;
* result_dest = operand ;
temp_data16 = buff [ operand ] << 8 ;
temp_data16 = temp_data16 | buff [ ( operand + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset = offset + 3 ;
}
}
else {
operand = ( bytecode & 0x7f ) ;
operand = ( operand * 2 ) ;
* result_dest = operand ;
temp_data16 = buff [ operand ] << 8 ;
temp_data16 = temp_data16 | buff [ ( operand + 1 ) & 0xffff ] ;
* value = temp_data16 ;
offset ++ ;
}
if ( offset >= UDVM_MEMORY_SIZE || * result_dest >= UDVM_MEMORY_SIZE - 1 ) return - 1 ;
return offset ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int get_kpcr_number ( CPUX86State * env ) {
struct kpcr {
uint8_t fill1 [ 0x1c ] ;
uint32_t self ;
uint8_t fill2 [ 0x31 ] ;
uint8_t number ;
}
QEMU_PACKED kpcr ;
if ( cpu_memory_rw_debug ( env , env -> segs [ R_FS ] . base , ( void * ) & kpcr , sizeof ( kpcr ) , 0 ) < 0 || kpcr . self != env -> segs [ R_FS ] . base ) {
return - 1 ;
}
return kpcr . number ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void vp9_convolve_copy_c ( const uint8_t * src , ptrdiff_t src_stride , uint8_t * dst , ptrdiff_t dst_stride , const int16_t * filter_x , int filter_x_stride , const int16_t * filter_y , int filter_y_stride , int w , int h ) {
int r ;
( void ) filter_x ;
( void ) filter_x_stride ;
( void ) filter_y ;
( void ) filter_y_stride ;
for ( r = h ;
r > 0 ;
-- r ) {
vpx_memcpy ( dst , src , w ) ;
src += src_stride ;
dst += dst_stride ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ;
int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ;
int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) DECLARE_ASN1_FUNCTIONS ( ASN1_BMPSTRING ) | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static char * checkpe ( char * dst , uint32_t dsize , char * pehdr , uint32_t * valign , unsigned int * sectcnt ) {
char * sections ;
if ( ! CLI_ISCONTAINED ( dst , dsize , pehdr , 0xf8 ) ) return NULL ;
if ( cli_readint32 ( pehdr ) != 0x4550 ) return NULL ;
if ( ! ( * valign = cli_readint32 ( pehdr + 0x38 ) ) ) return NULL ;
sections = pehdr + 0xf8 ;
if ( ! ( * sectcnt = ( unsigned char ) pehdr [ 6 ] + ( unsigned char ) pehdr [ 7 ] * 256 ) ) return NULL ;
if ( ! CLI_ISCONTAINED ( dst , dsize , sections , * sectcnt * 0x28 ) ) return NULL ;
return sections ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void help ( void ) {
printf ( _ ( "%s extracts a PostgreSQL database cluster into an SQL script file.\n\n" ) , progname ) ;
printf ( _ ( "Usage:\n" ) ) ;
printf ( _ ( " %s [OPTION]...\n" ) , progname ) ;
printf ( _ ( "\nGeneral options:\n" ) ) ;
printf ( _ ( " -f, --file=FILENAME output file name\n" ) ) ;
printf ( _ ( " -V, --version output version information, then exit\n" ) ) ;
printf ( _ ( " --lock-wait-timeout=TIMEOUT fail after waiting TIMEOUT for a table lock\n" ) ) ;
printf ( _ ( " -?, --help show this help, then exit\n" ) ) ;
printf ( _ ( "\nOptions controlling the output content:\n" ) ) ;
printf ( _ ( " -a, --data-only dump only the data, not the schema\n" ) ) ;
printf ( _ ( " -c, --clean clean (drop) databases before recreating\n" ) ) ;
printf ( _ ( " -g, --globals-only dump only global objects, no databases\n" ) ) ;
printf ( _ ( " -o, --oids include OIDs in dump\n" ) ) ;
printf ( _ ( " -O, --no-owner skip restoration of object ownership\n" ) ) ;
printf ( _ ( " -r, --roles-only dump only roles, no databases or tablespaces\n" ) ) ;
printf ( _ ( " -s, --schema-only dump only the schema, no data\n" ) ) ;
printf ( _ ( " -S, --superuser=NAME superuser user name to use in the dump\n" ) ) ;
printf ( _ ( " -t, --tablespaces-only dump only tablespaces, no databases or roles\n" ) ) ;
printf ( _ ( " -x, --no-privileges do not dump privileges (grant/revoke)\n" ) ) ;
printf ( _ ( " --binary-upgrade for use by upgrade utilities only\n" ) ) ;
printf ( _ ( " --column-inserts dump data as INSERT commands with column names\n" ) ) ;
printf ( _ ( " --disable-dollar-quoting disable dollar quoting, use SQL standard quoting\n" ) ) ;
printf ( _ ( " --disable-triggers disable triggers during data-only restore\n" ) ) ;
printf ( _ ( " --if-exists use IF EXISTS when dropping objects\n" ) ) ;
printf ( _ ( " --inserts dump data as INSERT commands, rather than COPY\n" ) ) ;
printf ( _ ( " --no-security-labels do not dump security label assignments\n" ) ) ;
printf ( _ ( " --no-tablespaces do not dump tablespace assignments\n" ) ) ;
printf ( _ ( " --no-unlogged-table-data do not dump unlogged table data\n" ) ) ;
printf ( _ ( " --quote-all-identifiers quote all identifiers, even if not key words\n" ) ) ;
printf ( _ ( " --use-set-session-authorization\n" " use SET SESSION AUTHORIZATION commands instead of\n" " ALTER OWNER commands to set ownership\n" ) ) ;
printf ( _ ( "\nConnection options:\n" ) ) ;
printf ( _ ( " -d, --dbname=CONNSTR connect using connection string\n" ) ) ;
printf ( _ ( " -h, --host=HOSTNAME database server host or socket directory\n" ) ) ;
printf ( _ ( " -l, --database=DBNAME alternative default database\n" ) ) ;
printf ( _ ( " -p, --port=PORT database server port number\n" ) ) ;
printf ( _ ( " -U, --username=NAME connect as specified database user\n" ) ) ;
printf ( _ ( " -w, --no-password never prompt for password\n" ) ) ;
printf ( _ ( " -W, --password force password prompt (should happen automatically)\n" ) ) ;
printf ( _ ( " --role=ROLENAME do SET ROLE before dump\n" ) ) ;
printf ( _ ( "\nIf -f/--file is not used, then the SQL script will be written to the standard\n" "output.\n\n" ) ) ;
printf ( _ ( "Report bugs to <[email protected]>.\n" ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void send_everything ( connection_t * c ) {
avl_node_t * node , * node2 ;
node_t * n ;
subnet_t * s ;
edge_t * e ;
if ( tunnelserver ) {
for ( node = myself -> subnet_tree -> head ;
node ;
node = node -> next ) {
s = node -> data ;
send_add_subnet ( c , s ) ;
}
return ;
}
for ( node = node_tree -> head ;
node ;
node = node -> next ) {
n = node -> data ;
for ( node2 = n -> subnet_tree -> head ;
node2 ;
node2 = node2 -> next ) {
s = node2 -> data ;
send_add_subnet ( c , s ) ;
}
for ( node2 = n -> edge_tree -> head ;
node2 ;
node2 = node2 -> next ) {
e = node2 -> data ;
send_add_edge ( c , e ) ;
}
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | guint16 de_cn_common_gsm_map_nas_sys_info ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * add_string _U_ , int string_len _U_ ) {
guint32 curr_offset ;
curr_offset = offset ;
proto_tree_add_item ( tree , hf_gsm_a_lac , tvb , curr_offset , 2 , ENC_BIG_ENDIAN ) ;
curr_offset += 2 ;
EXTRANEOUS_DATA_CHECK ( len , curr_offset - offset , pinfo , & ei_gsm_a_extraneous_data ) ;
return ( curr_offset - offset ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TSConfig TSConfigGet ( unsigned int id ) {
return reinterpret_cast < TSConfig > ( configProcessor . get ( id ) ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void evtag_test ( void ) {
fprintf ( stdout , "Testing Tagging:\n" ) ;
evtag_init ( ) ;
evtag_int_test ( ) ;
evtag_fuzz ( ) ;
evtag_tag_encoding ( ) ;
fprintf ( stdout , "OK\n" ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void async_job_end ( NautilusDirectory * directory , const char * job ) {
# ifdef DEBUG_ASYNC_JOBS char * key ;
gpointer table_key , value ;
# endif # ifdef DEBUG_START_STOP g_message ( "stopping %s in %p" , job , directory -> details -> location ) ;
# endif g_assert ( async_job_count > 0 ) ;
# ifdef DEBUG_ASYNC_JOBS {
char * uri ;
uri = nautilus_directory_get_uri ( directory ) ;
g_assert ( async_jobs != NULL ) ;
key = g_strconcat ( uri , ": " , job , NULL ) ;
if ( ! g_hash_table_lookup_extended ( async_jobs , key , & table_key , & value ) ) {
g_warning ( "ending job we didn't start: %s in %s" , job , uri ) ;
}
else {
g_hash_table_remove ( async_jobs , key ) ;
g_free ( table_key ) ;
}
g_free ( uri ) ;
g_free ( key ) ;
}
# endif async_job_count -= 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | TEST_F ( ExternalProtocolHandlerTest , DISABLED_TestLaunchSchemeUnknownChromeDefault ) {
DoTest ( ExternalProtocolHandler : : UNKNOWN , shell_integration : : IS_DEFAULT , Action : : BLOCK ) ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | void PNGAPI png_set_sRGB ( png_structp png_ptr , png_infop info_ptr , int intent ) {
png_debug1 ( 1 , "in %s storage function" , "sRGB" ) ;
if ( png_ptr == NULL || info_ptr == NULL ) return ;
info_ptr -> srgb_intent = ( png_byte ) intent ;
info_ptr -> valid |= PNG_INFO_sRGB ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static void StrictNamesCheck ( RestoreOptions * ropt ) {
const char * missing_name ;
Assert ( ropt -> strict_names ) ;
if ( ropt -> schemaNames . head != NULL ) {
missing_name = simple_string_list_not_touched ( & ropt -> schemaNames ) ;
if ( missing_name != NULL ) exit_horribly ( modulename , "schema \"%s\" not found\n" , missing_name ) ;
}
if ( ropt -> tableNames . head != NULL ) {
missing_name = simple_string_list_not_touched ( & ropt -> tableNames ) ;
if ( missing_name != NULL ) exit_horribly ( modulename , "table \"%s\" not found\n" , missing_name ) ;
}
if ( ropt -> indexNames . head != NULL ) {
missing_name = simple_string_list_not_touched ( & ropt -> indexNames ) ;
if ( missing_name != NULL ) exit_horribly ( modulename , "index \"%s\" not found\n" , missing_name ) ;
}
if ( ropt -> functionNames . head != NULL ) {
missing_name = simple_string_list_not_touched ( & ropt -> functionNames ) ;
if ( missing_name != NULL ) exit_horribly ( modulename , "function \"%s\" not found\n" , missing_name ) ;
}
if ( ropt -> triggerNames . head != NULL ) {
missing_name = simple_string_list_not_touched ( & ropt -> triggerNames ) ;
if ( missing_name != NULL ) exit_horribly ( modulename , "trigger \"%s\" not found\n" , missing_name ) ;
}
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int vorbis_parse_setup_hdr_codebooks ( vorbis_context * vc ) {
unsigned cb ;
uint8_t * tmp_vlc_bits = NULL ;
uint32_t * tmp_vlc_codes = NULL ;
GetBitContext * gb = & vc -> gb ;
uint16_t * codebook_multiplicands = NULL ;
int ret = 0 ;
vc -> codebook_count = get_bits ( gb , 8 ) + 1 ;
av_dlog ( NULL , " Codebooks: %d \n" , vc -> codebook_count ) ;
vc -> codebooks = av_mallocz ( vc -> codebook_count * sizeof ( * vc -> codebooks ) ) ;
tmp_vlc_bits = av_mallocz ( V_MAX_VLCS * sizeof ( * tmp_vlc_bits ) ) ;
tmp_vlc_codes = av_mallocz ( V_MAX_VLCS * sizeof ( * tmp_vlc_codes ) ) ;
codebook_multiplicands = av_malloc ( V_MAX_VLCS * sizeof ( * codebook_multiplicands ) ) ;
if ( ! vc -> codebooks || ! tmp_vlc_bits || ! tmp_vlc_codes || ! codebook_multiplicands ) {
ret = AVERROR ( ENOMEM ) ;
goto error ;
}
for ( cb = 0 ;
cb < vc -> codebook_count ;
++ cb ) {
vorbis_codebook * codebook_setup = & vc -> codebooks [ cb ] ;
unsigned ordered , t , entries , used_entries = 0 ;
av_dlog ( NULL , " %u. Codebook\n" , cb ) ;
if ( get_bits ( gb , 24 ) != 0x564342 ) {
av_log ( vc -> avctx , AV_LOG_ERROR , " %u. Codebook setup data corrupt.\n" , cb ) ;
ret = AVERROR_INVALIDDATA ;
goto error ;
}
codebook_setup -> dimensions = get_bits ( gb , 16 ) ;
if ( codebook_setup -> dimensions > 16 || codebook_setup -> dimensions == 0 ) {
av_log ( vc -> avctx , AV_LOG_ERROR , " %u. Codebook's dimension is invalid (%d).\n" , cb , codebook_setup -> dimensions ) ;
ret = AVERROR_INVALIDDATA ;
goto error ;
}
entries = get_bits ( gb , 24 ) ;
if ( entries > V_MAX_VLCS ) {
av_log ( vc -> avctx , AV_LOG_ERROR , " %u. Codebook has too many entries (%u).\n" , cb , entries ) ;
ret = AVERROR_INVALIDDATA ;
goto error ;
}
ordered = get_bits1 ( gb ) ;
av_dlog ( NULL , " codebook_dimensions %d, codebook_entries %u\n" , codebook_setup -> dimensions , entries ) ;
if ( ! ordered ) {
unsigned ce , flag ;
unsigned sparse = get_bits1 ( gb ) ;
av_dlog ( NULL , " not ordered \n" ) ;
if ( sparse ) {
av_dlog ( NULL , " sparse \n" ) ;
used_entries = 0 ;
for ( ce = 0 ;
ce < entries ;
++ ce ) {
flag = get_bits1 ( gb ) ;
if ( flag ) {
tmp_vlc_bits [ ce ] = get_bits ( gb , 5 ) + 1 ;
++ used_entries ;
}
else tmp_vlc_bits [ ce ] = 0 ;
}
}
else {
av_dlog ( NULL , " not sparse \n" ) ;
used_entries = entries ;
for ( ce = 0 ;
ce < entries ;
++ ce ) tmp_vlc_bits [ ce ] = get_bits ( gb , 5 ) + 1 ;
}
}
else {
unsigned current_entry = 0 ;
unsigned current_length = get_bits ( gb , 5 ) + 1 ;
av_dlog ( NULL , " ordered, current length: %u\n" , current_length ) ;
used_entries = entries ;
for ( ;
current_entry < used_entries && current_length <= 32 ;
++ current_length ) {
unsigned i , number ;
av_dlog ( NULL , " number bits: %u " , ilog ( entries - current_entry ) ) ;
number = get_bits ( gb , ilog ( entries - current_entry ) ) ;
av_dlog ( NULL , " number: %u\n" , number ) ;
for ( i = current_entry ;
i < number + current_entry ;
++ i ) if ( i < used_entries ) tmp_vlc_bits [ i ] = current_length ;
current_entry += number ;
}
if ( current_entry > used_entries ) {
av_log ( vc -> avctx , AV_LOG_ERROR , " More codelengths than codes in codebook. \n" ) ;
ret = AVERROR_INVALIDDATA ;
goto error ;
}
}
codebook_setup -> lookup_type = get_bits ( gb , 4 ) ;
av_dlog ( NULL , " lookup type: %d : %s \n" , codebook_setup -> lookup_type , codebook_setup -> lookup_type ? "vq" : "no lookup" ) ;
if ( codebook_setup -> lookup_type == 1 ) {
unsigned i , j , k ;
unsigned codebook_lookup_values = ff_vorbis_nth_root ( entries , codebook_setup -> dimensions ) ;
float codebook_minimum_value = vorbisfloat2float ( get_bits_long ( gb , 32 ) ) ;
float codebook_delta_value = vorbisfloat2float ( get_bits_long ( gb , 32 ) ) ;
unsigned codebook_value_bits = get_bits ( gb , 4 ) + 1 ;
unsigned codebook_sequence_p = get_bits1 ( gb ) ;
av_dlog ( NULL , " We expect %d numbers for building the codevectors. \n" , codebook_lookup_values ) ;
av_dlog ( NULL , " delta %f minmum %f \n" , codebook_delta_value , codebook_minimum_value ) ;
for ( i = 0 ;
i < codebook_lookup_values ;
++ i ) {
codebook_multiplicands [ i ] = get_bits ( gb , codebook_value_bits ) ;
av_dlog ( NULL , " multiplicands*delta+minmum : %e \n" , ( float ) codebook_multiplicands [ i ] * codebook_delta_value + codebook_minimum_value ) ;
av_dlog ( NULL , " multiplicand %u\n" , codebook_multiplicands [ i ] ) ;
}
codebook_setup -> codevectors = used_entries ? av_mallocz ( used_entries * codebook_setup -> dimensions * sizeof ( * codebook_setup -> codevectors ) ) : NULL ;
for ( j = 0 , i = 0 ;
i < entries ;
++ i ) {
unsigned dim = codebook_setup -> dimensions ;
if ( tmp_vlc_bits [ i ] ) {
float last = 0.0 ;
unsigned lookup_offset = i ;
av_dlog ( vc -> avctx , "Lookup offset %u ," , i ) ;
for ( k = 0 ;
k < dim ;
++ k ) {
unsigned multiplicand_offset = lookup_offset % codebook_lookup_values ;
codebook_setup -> codevectors [ j * dim + k ] = codebook_multiplicands [ multiplicand_offset ] * codebook_delta_value + codebook_minimum_value + last ;
if ( codebook_sequence_p ) last = codebook_setup -> codevectors [ j * dim + k ] ;
lookup_offset /= codebook_lookup_values ;
}
tmp_vlc_bits [ j ] = tmp_vlc_bits [ i ] ;
av_dlog ( vc -> avctx , "real lookup offset %u, vector: " , j ) ;
for ( k = 0 ;
k < dim ;
++ k ) av_dlog ( vc -> avctx , " %f " , codebook_setup -> codevectors [ j * dim + k ] ) ;
av_dlog ( vc -> avctx , "\n" ) ;
++ j ;
}
}
if ( j != used_entries ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Bug in codevector vector building code. \n" ) ;
ret = AVERROR_INVALIDDATA ;
goto error ;
}
entries = used_entries ;
}
else if ( codebook_setup -> lookup_type >= 2 ) {
av_log ( vc -> avctx , AV_LOG_ERROR , "Codebook lookup type not supported. \n" ) ;
ret = AVERROR_INVALIDDATA ;
goto error ;
}
if ( ff_vorbis_len2vlc ( tmp_vlc_bits , tmp_vlc_codes , entries ) ) {
av_log ( vc -> avctx , AV_LOG_ERROR , " Invalid code lengths while generating vlcs. \n" ) ;
ret = AVERROR_INVALIDDATA ;
goto error ;
}
codebook_setup -> maxdepth = 0 ;
for ( t = 0 ;
t < entries ;
++ t ) if ( tmp_vlc_bits [ t ] >= codebook_setup -> maxdepth ) codebook_setup -> maxdepth = tmp_vlc_bits [ t ] ;
if ( codebook_setup -> maxdepth > 3 * V_NB_BITS ) codebook_setup -> nb_bits = V_NB_BITS2 ;
else codebook_setup -> nb_bits = V_NB_BITS ;
codebook_setup -> maxdepth = ( codebook_setup -> maxdepth + codebook_setup -> nb_bits - 1 ) / codebook_setup -> nb_bits ;
if ( ( ret = init_vlc ( & codebook_setup -> vlc , codebook_setup -> nb_bits , entries , tmp_vlc_bits , sizeof ( * tmp_vlc_bits ) , sizeof ( * tmp_vlc_bits ) , tmp_vlc_codes , sizeof ( * tmp_vlc_codes ) , sizeof ( * tmp_vlc_codes ) , INIT_VLC_LE ) ) ) {
av_log ( vc -> avctx , AV_LOG_ERROR , " Error generating vlc tables. \n" ) ;
goto error ;
}
}
av_free ( tmp_vlc_bits ) ;
av_free ( tmp_vlc_codes ) ;
av_free ( codebook_multiplicands ) ;
return 0 ;
error : av_free ( tmp_vlc_bits ) ;
av_free ( tmp_vlc_codes ) ;
av_free ( codebook_multiplicands ) ;
return ret ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static __inline__ __u32 tipc_addr ( unsigned int zone , unsigned int cluster , unsigned int node ) {
return ( zone << TIPC_ZONE_OFFSET ) | ( cluster << TIPC_CLUSTER_OFFSET ) | node ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int chacha_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * inp , size_t len ) {
EVP_CHACHA_KEY * key = data ( ctx ) ;
unsigned int n , rem , ctr32 ;
if ( ( n = key -> partial_len ) ) {
while ( len && n < CHACHA_BLK_SIZE ) {
* out ++ = * inp ++ ^ key -> buf [ n ++ ] ;
len -- ;
}
key -> partial_len = n ;
if ( len == 0 ) return 1 ;
if ( n == CHACHA_BLK_SIZE ) {
key -> partial_len = 0 ;
key -> counter [ 0 ] ++ ;
if ( key -> counter [ 0 ] == 0 ) key -> counter [ 1 ] ++ ;
}
}
rem = ( unsigned int ) ( len % CHACHA_BLK_SIZE ) ;
len -= rem ;
ctr32 = key -> counter [ 0 ] ;
while ( len >= CHACHA_BLK_SIZE ) {
size_t blocks = len / CHACHA_BLK_SIZE ;
if ( sizeof ( size_t ) > sizeof ( unsigned int ) && blocks > ( 1U << 28 ) ) blocks = ( 1U << 28 ) ;
ctr32 += ( unsigned int ) blocks ;
if ( ctr32 < blocks ) {
blocks -= ctr32 ;
ctr32 = 0 ;
}
blocks *= CHACHA_BLK_SIZE ;
ChaCha20_ctr32 ( out , inp , blocks , key -> key . d , key -> counter ) ;
len -= blocks ;
inp += blocks ;
out += blocks ;
key -> counter [ 0 ] = ctr32 ;
if ( ctr32 == 0 ) key -> counter [ 1 ] ++ ;
}
if ( rem ) {
memset ( key -> buf , 0 , sizeof ( key -> buf ) ) ;
ChaCha20_ctr32 ( key -> buf , key -> buf , CHACHA_BLK_SIZE , key -> key . d , key -> counter ) ;
for ( n = 0 ;
n < rem ;
n ++ ) out [ n ] = inp [ n ] ^ key -> buf [ n ] ;
key -> partial_len = rem ;
}
return 1 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static UChar32 _LMBCSGetNextUCharWorker ( UConverterToUnicodeArgs * args , UErrorCode * err ) {
UChar32 uniChar = 0 ;
ulmbcs_byte_t CurByte ;
if ( args -> source >= args -> sourceLimit ) {
* err = U_ILLEGAL_ARGUMENT_ERROR ;
return 0xffff ;
}
CurByte = * ( ( ulmbcs_byte_t * ) ( args -> source ++ ) ) ;
if ( ( ( CurByte > ULMBCS_C0END ) && ( CurByte < ULMBCS_C1START ) ) || ( CurByte == 0 ) || CurByte == ULMBCS_HT || CurByte == ULMBCS_CR || CurByte == ULMBCS_LF || CurByte == ULMBCS_123SYSTEMRANGE ) {
uniChar = CurByte ;
}
else {
UConverterDataLMBCS * extraInfo ;
ulmbcs_byte_t group ;
UConverterSharedData * cnv ;
if ( CurByte == ULMBCS_GRP_CTRL ) {
ulmbcs_byte_t C0C1byte ;
CHECK_SOURCE_LIMIT ( 1 ) ;
C0C1byte = * ( args -> source ) ++ ;
uniChar = ( C0C1byte < ULMBCS_C1START ) ? C0C1byte - ULMBCS_CTRLOFFSET : C0C1byte ;
}
else if ( CurByte == ULMBCS_GRP_UNICODE ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
return GetUniFromLMBCSUni ( & ( args -> source ) ) ;
}
else if ( CurByte <= ULMBCS_CTRLOFFSET ) {
group = CurByte ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
if ( group > ULMBCS_GRP_LAST || ( cnv = extraInfo -> OptGrpConverter [ group ] ) == NULL ) {
* err = U_INVALID_CHAR_FOUND ;
}
else if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
CHECK_SOURCE_LIMIT ( 2 ) ;
if ( * args -> source == group ) {
++ args -> source ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 1 , FALSE ) ;
++ args -> source ;
}
else {
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source , 2 , FALSE ) ;
args -> source += 2 ;
}
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
CurByte = * ( args -> source ) ++ ;
if ( CurByte >= ULMBCS_C1START ) {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
else {
char bytes [ 2 ] ;
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
cnv = extraInfo -> OptGrpConverter [ ULMBCS_GRP_EXCEPT ] ;
bytes [ 0 ] = group ;
bytes [ 1 ] = CurByte ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , bytes , 2 , FALSE ) ;
}
}
}
else if ( CurByte >= ULMBCS_C1START ) {
extraInfo = ( UConverterDataLMBCS * ) args -> converter -> extraInfo ;
group = extraInfo -> OptGroup ;
cnv = extraInfo -> OptGrpConverter [ group ] ;
if ( group >= ULMBCS_DOUBLEOPTGROUP_START ) {
if ( ! ucnv_MBCSIsLeadByte ( cnv , CurByte ) ) {
CHECK_SOURCE_LIMIT ( 0 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 1 , FALSE ) ;
}
else {
CHECK_SOURCE_LIMIT ( 1 ) ;
uniChar = ucnv_MBCSSimpleGetNextUChar ( cnv , args -> source - 1 , 2 , FALSE ) ;
++ args -> source ;
}
}
else {
uniChar = _MBCS_SINGLE_SIMPLE_GET_NEXT_BMP ( cnv , CurByte ) ;
}
}
}
return uniChar ;
} | 1True
|
Categorize the following code snippet as vulnerable or not. True or False | static inline uint32_t read_IRQreg_ilr ( OpenPICState * opp , int n_IRQ ) {
if ( opp -> flags & OPENPIC_FLAG_ILR ) {
return output_to_inttgt ( opp -> src [ n_IRQ ] . output ) ;
}
return 0xffffffff ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int gs_main_interpret ( gs_main_instance * minst , ref * pref , int user_errors , int * pexit_code , ref * perror_object ) {
int code ;
minst -> i_ctx_p -> lib_path = & minst -> lib_path ;
code = gs_interpret ( & minst -> i_ctx_p , pref , user_errors , pexit_code , perror_object ) ;
return code ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int mix ( int c0 , int c1 ) {
int blue = 2 * ( c0 & 0x001F ) + ( c1 & 0x001F ) ;
int green = ( 2 * ( c0 & 0x03E0 ) + ( c1 & 0x03E0 ) ) >> 5 ;
int red = 2 * ( c0 >> 10 ) + ( c1 >> 10 ) ;
return red / 3 * 1024 + green / 3 * 32 + blue / 3 ;
} | 0False
|
Categorize the following code snippet as vulnerable or not. True or False | static int dissect_h245_H235Media ( 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_H235Media , H235Media_sequence ) ;
return offset ;
} | 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.