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
|
void pcnet_ioport_writel ( void * opaque , uint32_t addr , uint32_t val ) {
PCNetState * s = opaque ;
pcnet_poll_timer ( s ) ;
# ifdef PCNET_DEBUG_IO printf ( "pcnet_ioport_writel addr=0x%08x val=0x%08x\n" , addr , val ) ;
# endif if ( BCR_DWIO ( s ) ) {
switch ( addr & 0x0f ) {
case 0x00 : pcnet_csr_writew ( s , s -> rap , val & 0xffff ) ;
break ;
case 0x04 : s -> rap = val & 0x7f ;
break ;
case 0x0c : pcnet_bcr_writew ( s , s -> rap , val & 0xffff ) ;
break ;
}
}
else if ( ( addr & 0x0f ) == 0 ) {
pcnet_bcr_writew ( s , BCR_BSBC , pcnet_bcr_readw ( s , BCR_BSBC ) | 0x0080 ) ;
# ifdef PCNET_DEBUG_IO printf ( "device switched into dword i/o mode\n" ) ;
# endif }
pcnet_update_irq ( s ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_rfc2231_parser ( void ) {
const char * input = ";
key4*=us-ascii''foo" ";
key*2=ba%" ";
key2*0=a" ";
key3*0*=us-ascii'en'xyz" ";
key*0=\"foo\"" ";
key2*1*=b%25" ";
key3*1=plop%" ";
key*1=baz" ;
const char * output [ ] = {
"key" , "foobazba%" , "key2*" , "''ab%25" , "key3*" , "us-ascii'en'xyzplop%25" , "key4*" , "us-ascii''foo" , NULL }
;
struct rfc822_parser_context parser ;
const char * const * result ;
unsigned int i ;
test_begin ( "rfc2231 parser" ) ;
rfc822_parser_init ( & parser , ( const void * ) input , strlen ( input ) , NULL ) ;
test_assert ( rfc2231_parse ( & parser , & result ) == 0 ) ;
for ( i = 0 ;
output [ i ] != NULL && result [ i ] != NULL ;
i ++ ) test_assert ( strcmp ( output [ i ] , result [ i ] ) == 0 ) ;
rfc822_parser_deinit ( & parser ) ;
test_assert ( output [ i ] == NULL && result [ i ] == NULL ) ;
test_end ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void my_ungetc ( int c ) {
* line_buffer_pos ++ = ( char ) c ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int qemuMonitorJSONDriveDel ( qemuMonitorPtr mon , const char * drivestr ) {
int ret ;
virJSONValuePtr cmd ;
virJSONValuePtr reply = NULL ;
VIR_DEBUG ( "JSONDriveDel drivestr=%s" , drivestr ) ;
cmd = qemuMonitorJSONMakeCommand ( "drive_del" , "s:id" , drivestr , NULL ) ;
if ( ! cmd ) return - 1 ;
if ( ( ret = qemuMonitorJSONCommand ( mon , cmd , & reply ) ) < 0 ) goto cleanup ;
if ( qemuMonitorJSONHasError ( reply , "CommandNotFound" ) ) {
if ( qemuMonitorCheckHMP ( mon , "drive_del" ) ) {
VIR_DEBUG ( "drive_del command not found, trying HMP" ) ;
ret = qemuMonitorTextDriveDel ( mon , drivestr ) ;
}
else {
VIR_ERROR ( _ ( "deleting disk is not supported. " "This may leak data if disk is reassigned" ) ) ;
ret = 1 ;
}
}
else if ( qemuMonitorJSONHasError ( reply , "DeviceNotFound" ) ) {
ret = 0 ;
}
else {
ret = qemuMonitorJSONCheckError ( cmd , reply ) ;
}
cleanup : virJSONValueFree ( cmd ) ;
virJSONValueFree ( reply ) ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void usbdev_vm_close ( struct vm_area_struct * vma ) {
struct usb_memory * usbm = vma -> vm_private_data ;
dec_usb_memory_use_count ( usbm , & usbm -> vma_use_count ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void systick_timer_tick ( void * opaque ) {
nvic_state * s = ( nvic_state * ) opaque ;
s -> systick . control |= SYSTICK_COUNTFLAG ;
if ( s -> systick . control & SYSTICK_TICKINT ) {
armv7m_nvic_set_pending ( s , ARMV7M_EXCP_SYSTICK ) ;
}
if ( s -> systick . reload == 0 ) {
s -> systick . control &= ~ SYSTICK_ENABLE ;
}
else {
systick_reload ( s , 0 ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char )
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ExtensionServiceSyncTest , DefaultInstalledExtensionsAreNotReenabledOrDisabledBySync ) {
InitializeEmptyExtensionService ( ) ;
browser_sync : : ProfileSyncService * sync_service = ProfileSyncServiceFactory : : GetForProfile ( profile ( ) ) ;
sync_service -> SetFirstSetupComplete ( ) ;
service ( ) -> Init ( ) ;
extensions : : ChromeTestExtensionLoader extension_loader ( profile ( ) ) ;
extension_loader . set_pack_extension ( true ) ;
extension_loader . add_creation_flag ( Extension : : WAS_INSTALLED_BY_DEFAULT ) ;
scoped_refptr < const Extension > extension = extension_loader . LoadExtension ( data_dir ( ) . AppendASCII ( "simple_with_file" ) ) ;
ASSERT_TRUE ( extension ) ;
EXPECT_FALSE ( extensions : : util : : ShouldSync ( extension . get ( ) , profile ( ) ) ) ;
const std : : string kExtensionId = extension -> id ( ) ;
ASSERT_TRUE ( registry ( ) -> enabled_extensions ( ) . GetByID ( kExtensionId ) ) ;
syncer : : FakeSyncChangeProcessor * processor_raw = nullptr ;
{
auto processor = base : : MakeUnique < syncer : : FakeSyncChangeProcessor > ( ) ;
processor_raw = processor . get ( ) ;
extension_sync_service ( ) -> MergeDataAndStartSyncing ( syncer : : EXTENSIONS , syncer : : SyncDataList ( ) , std : : move ( processor ) , base : : MakeUnique < syncer : : SyncErrorFactoryMock > ( ) ) ;
}
processor_raw -> changes ( ) . clear ( ) ;
DisableExtensionFromSync ( * extension , extensions : : disable_reason : : DISABLE_USER_ACTION ) ;
EXPECT_TRUE ( registry ( ) -> enabled_extensions ( ) . GetByID ( kExtensionId ) ) ;
EXPECT_TRUE ( processor_raw -> changes ( ) . empty ( ) ) ;
service ( ) -> DisableExtension ( kExtensionId , extensions : : disable_reason : : DISABLE_USER_ACTION ) ;
EXPECT_TRUE ( registry ( ) -> disabled_extensions ( ) . GetByID ( kExtensionId ) ) ;
EXPECT_TRUE ( processor_raw -> changes ( ) . empty ( ) ) ;
EnableExtensionFromSync ( * extension ) ;
EXPECT_TRUE ( registry ( ) -> disabled_extensions ( ) . GetByID ( kExtensionId ) ) ;
EXPECT_TRUE ( processor_raw -> changes ( ) . empty ( ) ) ;
service ( ) -> EnableExtension ( kExtensionId ) ;
EXPECT_TRUE ( registry ( ) -> enabled_extensions ( ) . GetByID ( kExtensionId ) ) ;
EXPECT_TRUE ( processor_raw -> changes ( ) . empty ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int remoteStreamHandleAbort ( struct qemud_client * client , struct qemud_client_stream * stream , struct qemud_client_message * msg ) {
remote_error rerr ;
VIR_DEBUG ( "stream=%p proc=%d serial=%d" , stream , msg -> hdr . proc , msg -> hdr . serial ) ;
memset ( & rerr , 0 , sizeof rerr ) ;
stream -> closed = 1 ;
virStreamEventRemoveCallback ( stream -> st ) ;
virStreamAbort ( stream -> st ) ;
if ( msg -> hdr . status == REMOTE_ERROR ) remoteDispatchFormatError ( & rerr , "%s" , _ ( "stream aborted at client request" ) ) ;
else {
VIR_WARN ( "unexpected stream status %d" , msg -> hdr . status ) ;
remoteDispatchFormatError ( & rerr , _ ( "stream aborted with unexpected status %d" ) , msg -> hdr . status ) ;
}
return remoteSerializeReplyError ( client , & rerr , & msg -> hdr ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void inhibit_data_for_failed_table ( ArchiveHandle * AH , TocEntry * te ) {
ahlog ( AH , 1 , "table \"%s\" could not be created, will not restore its data\n" , te -> tag ) ;
if ( AH -> tableDataId [ te -> dumpId ] != 0 ) {
TocEntry * ted = AH -> tocsByDumpId [ AH -> tableDataId [ te -> dumpId ] ] ;
ted -> reqs = 0 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_run_dquote ( fz_context * ctx , pdf_processor * proc , float aw , float ac , char * string , int string_len ) {
pdf_run_processor * pr = ( pdf_run_processor * ) proc ;
pdf_gstate * gstate = pr -> gstate + pr -> gtop ;
gstate -> text . word_space = aw ;
gstate -> text . char_space = ac ;
pdf_tos_newline ( & pr -> tos , gstate -> text . leading ) ;
pdf_show_string ( ctx , pr , ( unsigned char * ) string , string_len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rc_pick_q_and_bounds_one_pass_vbr ( const VP9_COMP * cpi , int * bottom_index , int * top_index ) {
const VP9_COMMON * const cm = & cpi -> common ;
const RATE_CONTROL * const rc = & cpi -> rc ;
const VP9EncoderConfig * const oxcf = & cpi -> oxcf ;
const int cq_level = get_active_cq_level ( rc , oxcf ) ;
int active_best_quality ;
int active_worst_quality = calc_active_worst_quality_one_pass_vbr ( cpi ) ;
int q ;
int * inter_minq ;
ASSIGN_MINQ_TABLE ( cm -> bit_depth , inter_minq ) ;
if ( frame_is_intra_only ( cm ) ) {
if ( rc -> this_key_frame_forced ) {
int qindex = rc -> last_boosted_qindex ;
double last_boosted_q = vp9_convert_qindex_to_q ( qindex , cm -> bit_depth ) ;
int delta_qindex = vp9_compute_qdelta ( rc , last_boosted_q , last_boosted_q * 0.75 , cm -> bit_depth ) ;
active_best_quality = MAX ( qindex + delta_qindex , rc -> best_quality ) ;
}
else {
double q_adj_factor = 1.0 ;
double q_val ;
active_best_quality = get_kf_active_quality ( rc , rc -> avg_frame_qindex [ KEY_FRAME ] , cm -> bit_depth ) ;
if ( ( cm -> width * cm -> height ) <= ( 352 * 288 ) ) {
q_adj_factor -= 0.25 ;
}
q_val = vp9_convert_qindex_to_q ( active_best_quality , cm -> bit_depth ) ;
active_best_quality += vp9_compute_qdelta ( rc , q_val , q_val * q_adj_factor , cm -> bit_depth ) ;
}
}
else if ( ! rc -> is_src_frame_alt_ref && ( cpi -> refresh_golden_frame || cpi -> refresh_alt_ref_frame ) ) {
if ( rc -> frames_since_key > 1 && rc -> avg_frame_qindex [ INTER_FRAME ] < active_worst_quality ) {
q = rc -> avg_frame_qindex [ INTER_FRAME ] ;
}
else {
q = rc -> avg_frame_qindex [ KEY_FRAME ] ;
}
if ( oxcf -> rc_mode == VPX_CQ ) {
if ( q < cq_level ) q = cq_level ;
active_best_quality = get_gf_active_quality ( rc , q , cm -> bit_depth ) ;
active_best_quality = active_best_quality * 15 / 16 ;
}
else if ( oxcf -> rc_mode == VPX_Q ) {
if ( ! cpi -> refresh_alt_ref_frame ) {
active_best_quality = cq_level ;
}
else {
active_best_quality = get_gf_active_quality ( rc , q , cm -> bit_depth ) ;
}
}
else {
active_best_quality = get_gf_active_quality ( rc , q , cm -> bit_depth ) ;
}
}
else {
if ( oxcf -> rc_mode == VPX_Q ) {
active_best_quality = cq_level ;
}
else {
if ( cm -> current_video_frame > 1 ) active_best_quality = inter_minq [ rc -> avg_frame_qindex [ INTER_FRAME ] ] ;
else active_best_quality = inter_minq [ rc -> avg_frame_qindex [ KEY_FRAME ] ] ;
if ( ( oxcf -> rc_mode == VPX_CQ ) && ( active_best_quality < cq_level ) ) {
active_best_quality = cq_level ;
}
}
}
active_best_quality = clamp ( active_best_quality , rc -> best_quality , rc -> worst_quality ) ;
active_worst_quality = clamp ( active_worst_quality , active_best_quality , rc -> worst_quality ) ;
* top_index = active_worst_quality ;
* bottom_index = active_best_quality ;
# if LIMIT_QRANGE_FOR_ALTREF_AND_KEY {
int qdelta = 0 ;
vp9_clear_system_state ( ) ;
if ( cm -> frame_type == KEY_FRAME && ! rc -> this_key_frame_forced && ! ( cm -> current_video_frame == 0 ) ) {
qdelta = vp9_compute_qdelta_by_rate ( & cpi -> rc , cm -> frame_type , active_worst_quality , 2.0 , cm -> bit_depth ) ;
}
else if ( ! rc -> is_src_frame_alt_ref && ( cpi -> refresh_golden_frame || cpi -> refresh_alt_ref_frame ) ) {
qdelta = vp9_compute_qdelta_by_rate ( & cpi -> rc , cm -> frame_type , active_worst_quality , 1.75 , cm -> bit_depth ) ;
}
* top_index = active_worst_quality + qdelta ;
* top_index = ( * top_index > * bottom_index ) ? * top_index : * bottom_index ;
}
# endif if ( oxcf -> rc_mode == VPX_Q ) {
q = active_best_quality ;
}
else if ( ( cm -> frame_type == KEY_FRAME ) && rc -> this_key_frame_forced ) {
q = rc -> last_boosted_qindex ;
}
else {
q = vp9_rc_regulate_q ( cpi , rc -> this_frame_target , active_best_quality , active_worst_quality ) ;
if ( q > * top_index ) {
if ( rc -> this_frame_target >= rc -> max_frame_bandwidth ) * top_index = q ;
else q = * top_index ;
}
}
assert ( * top_index <= rc -> worst_quality && * top_index >= rc -> best_quality ) ;
assert ( * bottom_index <= rc -> worst_quality && * bottom_index >= rc -> best_quality ) ;
assert ( q <= rc -> worst_quality && q >= rc -> best_quality ) ;
return q ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void apply_loop_filter ( Vp3DecodeContext * s , int plane , int ystart , int yend ) {
int x , y ;
int * bounding_values = s -> bounding_values_array + 127 ;
int width = s -> fragment_width [ ! ! plane ] ;
int height = s -> fragment_height [ ! ! plane ] ;
int fragment = s -> fragment_start [ plane ] + ystart * width ;
int stride = s -> current_frame . linesize [ plane ] ;
uint8_t * plane_data = s -> current_frame . data [ plane ] ;
if ( ! s -> flipped_image ) stride = - stride ;
plane_data += s -> data_offset [ plane ] + 8 * ystart * stride ;
for ( y = ystart ;
y < yend ;
y ++ ) {
for ( x = 0 ;
x < width ;
x ++ ) {
if ( s -> all_fragments [ fragment ] . coding_method != MODE_COPY ) {
if ( x > 0 ) {
s -> vp3dsp . h_loop_filter ( plane_data + 8 * x , stride , bounding_values ) ;
}
if ( y > 0 ) {
s -> vp3dsp . v_loop_filter ( plane_data + 8 * x , stride , bounding_values ) ;
}
if ( ( x < width - 1 ) && ( s -> all_fragments [ fragment + 1 ] . coding_method == MODE_COPY ) ) {
s -> vp3dsp . h_loop_filter ( plane_data + 8 * x + 8 , stride , bounding_values ) ;
}
if ( ( y < height - 1 ) && ( s -> all_fragments [ fragment + width ] . coding_method == MODE_COPY ) ) {
s -> vp3dsp . v_loop_filter ( plane_data + 8 * x + 8 * stride , stride , bounding_values ) ;
}
}
fragment ++ ;
}
plane_data += 8 * stride ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * cmd_rule ( cmd_parms * cmd , void * _dcfg , const char * p1 , const char * p2 , const char * p3 ) {
return add_rule ( cmd , ( directory_config * ) _dcfg , RULE_TYPE_NORMAL , p1 , p2 , p3 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline MagickRealType GetPixelInfoChannel ( const PixelInfo * restrict pixel_info , const PixelChannel channel ) {
switch ( channel ) {
case RedPixelChannel : return ( pixel_info -> red ) ;
case GreenPixelChannel : return ( pixel_info -> green ) ;
case BluePixelChannel : return ( pixel_info -> blue ) ;
case BlackPixelChannel : return ( pixel_info -> black ) ;
case AlphaPixelChannel : return ( pixel_info -> alpha ) ;
case IndexPixelChannel : return ( pixel_info -> index ) ;
default : return ( ( MagickRealType ) 0.0 ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static long roundv ( LDOUBLE value ) {
long intpart ;
intpart = ( long ) value ;
value = value - intpart ;
if ( value >= 0.5 ) intpart ++ ;
return intpart ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static uint64 _tiffSeekProc ( thandle_t fd , uint64 off , int whence ) {
LARGE_INTEGER offli ;
DWORD dwMoveMethod ;
offli . QuadPart = off ;
switch ( whence ) {
case SEEK_SET : dwMoveMethod = FILE_BEGIN ;
break ;
case SEEK_CUR : dwMoveMethod = FILE_CURRENT ;
break ;
case SEEK_END : dwMoveMethod = FILE_END ;
break ;
default : dwMoveMethod = FILE_BEGIN ;
break ;
}
offli . LowPart = SetFilePointer ( fd , offli . LowPart , & offli . HighPart , dwMoveMethod ) ;
if ( ( offli . LowPart == INVALID_SET_FILE_POINTER ) && ( GetLastError ( ) != NO_ERROR ) ) offli . QuadPart = 0 ;
return ( offli . QuadPart ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_13 ( AVCodecContext * avctx , DxaDecContext * c , uint8_t * dst , int stride , uint8_t * src , uint8_t * ref ) {
uint8_t * code , * data , * mv , * msk , * tmp , * tmp2 ;
int i , j , k ;
int type , x , y , d , d2 ;
uint32_t mask ;
code = src + 12 ;
data = code + ( ( avctx -> width * avctx -> height ) >> 4 ) ;
mv = data + AV_RB32 ( src + 0 ) ;
msk = mv + AV_RB32 ( src + 4 ) ;
for ( j = 0 ;
j < avctx -> height ;
j += 4 ) {
for ( i = 0 ;
i < avctx -> width ;
i += 4 ) {
tmp = dst + i ;
tmp2 = ref + i ;
type = * code ++ ;
switch ( type ) {
case 4 : x = ( * mv ) >> 4 ;
if ( x & 8 ) x = 8 - x ;
y = ( * mv ++ ) & 0xF ;
if ( y & 8 ) y = 8 - y ;
tmp2 += x + y * stride ;
case 0 : case 5 : for ( y = 0 ;
y < 4 ;
y ++ ) {
memcpy ( tmp , tmp2 , 4 ) ;
tmp += stride ;
tmp2 += stride ;
}
break ;
case 1 : case 10 : case 11 : case 12 : case 13 : case 14 : case 15 : if ( type == 1 ) {
mask = AV_RB16 ( msk ) ;
msk += 2 ;
}
else {
type -= 10 ;
mask = ( ( msk [ 0 ] & 0xF0 ) << shift1 [ type ] ) | ( ( msk [ 0 ] & 0xF ) << shift2 [ type ] ) ;
msk ++ ;
}
for ( y = 0 ;
y < 4 ;
y ++ ) {
for ( x = 0 ;
x < 4 ;
x ++ ) {
tmp [ x ] = ( mask & 0x8000 ) ? * data ++ : tmp2 [ x ] ;
mask <<= 1 ;
}
tmp += stride ;
tmp2 += stride ;
}
break ;
case 2 : for ( y = 0 ;
y < 4 ;
y ++ ) {
memset ( tmp , data [ 0 ] , 4 ) ;
tmp += stride ;
}
data ++ ;
break ;
case 3 : for ( y = 0 ;
y < 4 ;
y ++ ) {
memcpy ( tmp , data , 4 ) ;
data += 4 ;
tmp += stride ;
}
break ;
case 8 : mask = * msk ++ ;
for ( k = 0 ;
k < 4 ;
k ++ ) {
d = ( ( k & 1 ) << 1 ) + ( ( k & 2 ) * stride ) ;
d2 = ( ( k & 1 ) << 1 ) + ( ( k & 2 ) * stride ) ;
tmp2 = ref + i + d2 ;
switch ( mask & 0xC0 ) {
case 0x80 : x = ( * mv ) >> 4 ;
if ( x & 8 ) x = 8 - x ;
y = ( * mv ++ ) & 0xF ;
if ( y & 8 ) y = 8 - y ;
tmp2 += x + y * stride ;
case 0x00 : tmp [ d + 0 ] = tmp2 [ 0 ] ;
tmp [ d + 1 ] = tmp2 [ 1 ] ;
tmp [ d + 0 + stride ] = tmp2 [ 0 + stride ] ;
tmp [ d + 1 + stride ] = tmp2 [ 1 + stride ] ;
break ;
case 0x40 : tmp [ d + 0 ] = data [ 0 ] ;
tmp [ d + 1 ] = data [ 0 ] ;
tmp [ d + 0 + stride ] = data [ 0 ] ;
tmp [ d + 1 + stride ] = data [ 0 ] ;
data ++ ;
break ;
case 0xC0 : tmp [ d + 0 ] = * data ++ ;
tmp [ d + 1 ] = * data ++ ;
tmp [ d + 0 + stride ] = * data ++ ;
tmp [ d + 1 + stride ] = * data ++ ;
break ;
}
mask <<= 2 ;
}
break ;
case 32 : mask = AV_RB16 ( msk ) ;
msk += 2 ;
for ( y = 0 ;
y < 4 ;
y ++ ) {
for ( x = 0 ;
x < 4 ;
x ++ ) {
tmp [ x ] = data [ mask & 1 ] ;
mask >>= 1 ;
}
tmp += stride ;
tmp2 += stride ;
}
data += 2 ;
break ;
case 33 : case 34 : mask = AV_RB32 ( msk ) ;
msk += 4 ;
for ( y = 0 ;
y < 4 ;
y ++ ) {
for ( x = 0 ;
x < 4 ;
x ++ ) {
tmp [ x ] = data [ mask & 3 ] ;
mask >>= 2 ;
}
tmp += stride ;
tmp2 += stride ;
}
data += type - 30 ;
break ;
default : av_log ( avctx , AV_LOG_ERROR , "Unknown opcode %d\n" , type ) ;
return AVERROR_INVALIDDATA ;
}
}
dst += stride * 4 ;
ref += stride * 4 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int jas_image_writecmpt ( jas_image_t * image , int cmptno , jas_image_coord_t x , jas_image_coord_t y , jas_image_coord_t width , jas_image_coord_t height , jas_matrix_t * data ) {
jas_image_cmpt_t * cmpt ;
jas_image_coord_t i ;
jas_image_coord_t j ;
jas_seqent_t * d ;
jas_seqent_t * dr ;
int drs ;
jas_seqent_t v ;
int k ;
int c ;
if ( cmptno < 0 || cmptno >= image -> numcmpts_ ) {
return - 1 ;
}
cmpt = image -> cmpts_ [ cmptno ] ;
if ( x >= cmpt -> width_ || y >= cmpt -> height_ || x + width > cmpt -> width_ || y + height > cmpt -> height_ ) {
return - 1 ;
}
if ( jas_matrix_numrows ( data ) != height || jas_matrix_numcols ( data ) != width ) {
return - 1 ;
}
dr = jas_matrix_getref ( data , 0 , 0 ) ;
drs = jas_matrix_rowstep ( data ) ;
for ( i = 0 ;
i < height ;
++ i , dr += drs ) {
d = dr ;
if ( jas_stream_seek ( cmpt -> stream_ , ( cmpt -> width_ * ( y + i ) + x ) * cmpt -> cps_ , SEEK_SET ) < 0 ) {
return - 1 ;
}
for ( j = width ;
j > 0 ;
-- j , ++ d ) {
v = inttobits ( * d , cmpt -> prec_ , cmpt -> sgnd_ ) ;
for ( k = cmpt -> cps_ ;
k > 0 ;
-- k ) {
c = ( v >> ( 8 * ( cmpt -> cps_ - 1 ) ) ) & 0xff ;
if ( jas_stream_putc ( cmpt -> stream_ , ( unsigned char ) c ) == EOF ) {
return - 1 ;
}
v <<= 8 ;
}
}
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
inline static void _slurm_rpc_reboot_nodes ( slurm_msg_t * msg ) {
int rc ;
uid_t uid = g_slurm_auth_get_uid ( msg -> auth_cred , slurmctld_config . auth_info ) ;
# ifndef HAVE_FRONT_END int i ;
struct node_record * node_ptr ;
reboot_msg_t * reboot_msg = ( reboot_msg_t * ) msg -> data ;
char * nodelist = NULL ;
bitstr_t * bitmap = NULL ;
slurmctld_lock_t node_write_lock = {
NO_LOCK , NO_LOCK , WRITE_LOCK , NO_LOCK , NO_LOCK }
;
time_t now = time ( NULL ) ;
# endif DEF_TIMERS ;
START_TIMER ;
debug2 ( "Processing RPC: REQUEST_REBOOT_NODES from uid=%d" , uid ) ;
if ( ! validate_super_user ( uid ) ) {
error ( "Security violation, REBOOT_NODES RPC from uid=%d" , uid ) ;
slurm_send_rc_msg ( msg , EACCES ) ;
return ;
}
# ifdef HAVE_FRONT_END rc = ESLURM_NOT_SUPPORTED ;
# else if ( reboot_msg ) nodelist = reboot_msg -> node_list ;
if ( ! nodelist || ! xstrcasecmp ( nodelist , "ALL" ) ) {
bitmap = bit_alloc ( node_record_count ) ;
bit_nset ( bitmap , 0 , ( node_record_count - 1 ) ) ;
}
else if ( node_name2bitmap ( nodelist , false , & bitmap ) != 0 ) {
FREE_NULL_BITMAP ( bitmap ) ;
error ( "Bad node list in REBOOT_NODES request: %s" , nodelist ) ;
slurm_send_rc_msg ( msg , ESLURM_INVALID_NODE_NAME ) ;
return ;
}
lock_slurmctld ( node_write_lock ) ;
for ( i = 0 , node_ptr = node_record_table_ptr ;
i < node_record_count ;
i ++ , node_ptr ++ ) {
if ( ! bit_test ( bitmap , i ) ) continue ;
if ( IS_NODE_FUTURE ( node_ptr ) || IS_NODE_DOWN ( node_ptr ) || ( IS_NODE_CLOUD ( node_ptr ) && IS_NODE_POWER_SAVE ( node_ptr ) ) ) {
bit_clear ( bitmap , i ) ;
continue ;
}
node_ptr -> node_state |= NODE_STATE_REBOOT ;
node_ptr -> boot_req_time = now ;
node_ptr -> last_response = now + slurmctld_config . boot_time ;
if ( reboot_msg && ( reboot_msg -> flags & REBOOT_FLAGS_ASAP ) ) {
node_ptr -> node_state |= NODE_STATE_DRAIN ;
if ( node_ptr -> reason == NULL ) {
node_ptr -> reason = xstrdup ( "Reboot ASAP" ) ;
node_ptr -> reason_time = now ;
node_ptr -> reason_uid = uid ;
}
}
want_nodes_reboot = true ;
}
if ( want_nodes_reboot == true ) schedule_node_save ( ) ;
unlock_slurmctld ( node_write_lock ) ;
if ( want_nodes_reboot == true ) {
nodelist = bitmap2node_name ( bitmap ) ;
info ( "reboot request queued for nodes %s" , nodelist ) ;
xfree ( nodelist ) ;
}
FREE_NULL_BITMAP ( bitmap ) ;
rc = SLURM_SUCCESS ;
# endif END_TIMER2 ( "_slurm_rpc_reboot_nodes" ) ;
slurm_send_rc_msg ( msg , rc ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gpgme_error_t gpgsm_getauditlog ( void * engine , gpgme_data_t output , unsigned int flags ) {
engine_gpgsm_t gpgsm = engine ;
gpgme_error_t err = 0 ;
if ( ! gpgsm || ! output ) return gpg_error ( GPG_ERR_INV_VALUE ) ;
# if USE_DESCRIPTOR_PASSING gpgsm -> output_cb . data = output ;
err = gpgsm_set_fd ( gpgsm , OUTPUT_FD , 0 ) ;
if ( err ) return err ;
gpgsm_clear_fd ( gpgsm , INPUT_FD ) ;
gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ;
gpgsm -> inline_data = NULL ;
# define CMD "GETAUDITLOG" # else gpgsm_clear_fd ( gpgsm , OUTPUT_FD ) ;
gpgsm_clear_fd ( gpgsm , INPUT_FD ) ;
gpgsm_clear_fd ( gpgsm , MESSAGE_FD ) ;
gpgsm -> inline_data = output ;
# define CMD "GETAUDITLOG --data" # endif err = start ( gpgsm , ( flags & GPGME_AUDITLOG_HTML ) ? CMD " --html" : CMD ) ;
return err ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static guint64 lbmpdm_fetch_uint64_encoded ( tvbuff_t * tvb , int offset , int encoding ) {
guint64 value = 0 ;
if ( encoding == ENC_BIG_ENDIAN ) {
value = tvb_get_ntoh64 ( tvb , offset ) ;
}
else {
value = tvb_get_letoh64 ( tvb , offset ) ;
}
return ( value ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void pdf_show_image ( fz_context * ctx , pdf_run_processor * pr , fz_image * image ) {
pdf_gstate * gstate = pr -> gstate + pr -> gtop ;
fz_matrix image_ctm ;
fz_rect bbox ;
if ( pr -> super . hidden ) return ;
image_ctm = gstate -> ctm ;
fz_pre_scale ( fz_pre_translate ( & image_ctm , 0 , 1 ) , 1 , - 1 ) ;
bbox = fz_unit_rect ;
fz_transform_rect ( & bbox , & image_ctm ) ;
if ( image -> mask && gstate -> blendmode ) {
fz_begin_group ( ctx , pr -> dev , & bbox , NULL , 0 , 0 , gstate -> blendmode , 1 ) ;
fz_try ( ctx ) fz_clip_image_mask ( ctx , pr -> dev , image -> mask , & image_ctm , & bbox ) ;
fz_catch ( ctx ) {
fz_end_group ( ctx , pr -> dev ) ;
fz_rethrow ( ctx ) ;
}
fz_try ( ctx ) pdf_show_image_imp ( ctx , pr , image , & image_ctm , & bbox ) ;
fz_always ( ctx ) {
fz_pop_clip ( ctx , pr -> dev ) ;
fz_end_group ( ctx , pr -> dev ) ;
}
fz_catch ( ctx ) fz_rethrow ( ctx ) ;
}
else if ( image -> mask ) {
fz_clip_image_mask ( ctx , pr -> dev , image -> mask , & image_ctm , & bbox ) ;
fz_try ( ctx ) pdf_show_image_imp ( ctx , pr , image , & image_ctm , & bbox ) ;
fz_always ( ctx ) fz_pop_clip ( ctx , pr -> dev ) ;
fz_catch ( ctx ) fz_rethrow ( ctx ) ;
}
else {
softmask_save softmask = {
NULL }
;
gstate = pdf_begin_group ( ctx , pr , & bbox , & softmask ) ;
fz_try ( ctx ) pdf_show_image_imp ( ctx , pr , image , & image_ctm , & bbox ) ;
fz_always ( ctx ) pdf_end_group ( ctx , pr , & softmask ) ;
fz_catch ( ctx ) fz_rethrow ( ctx ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gpointer init_common ( gsize job_size , GtkWindow * parent_window ) {
CommonJob * common ;
GdkScreen * screen ;
common = g_malloc0 ( job_size ) ;
if ( parent_window ) {
common -> parent_window = parent_window ;
g_object_add_weak_pointer ( G_OBJECT ( common -> parent_window ) , ( gpointer * ) & common -> parent_window ) ;
}
common -> progress = nautilus_progress_info_new ( ) ;
common -> cancellable = nautilus_progress_info_get_cancellable ( common -> progress ) ;
common -> time = g_timer_new ( ) ;
common -> inhibit_cookie = 0 ;
common -> screen_num = 0 ;
if ( parent_window ) {
screen = gtk_widget_get_screen ( GTK_WIDGET ( parent_window ) ) ;
common -> screen_num = gdk_screen_get_number ( screen ) ;
}
return common ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void char_out ( int c , GifCtx * ctx ) {
ctx -> accum [ ctx -> a_count ++ ] = c ;
if ( ctx -> a_count >= 254 ) {
flush_char ( ctx ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserCloseTwoSecondUnloadAlert ) {
LoadUrlAndQuitBrowser ( TWO_SECOND_UNLOAD_ALERT_HTML , "twosecondunloadalert" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int32_t U_CALLCONV compareMappingsUnicodeFirst ( const void * context , const void * left , const void * right ) {
return compareMappings ( ( UCMTable * ) context , ( const UCMapping * ) left , ( UCMTable * ) context , ( const UCMapping * ) right , TRUE ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_EncryptionMode ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_EncryptionMode , EncryptionMode_choice , NULL ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void compute_stereo ( MPADecodeContext * s , GranuleDef * g0 , GranuleDef * g1 ) {
int i , j , k , l ;
int sf_max , sf , len , non_zero_found ;
INTFLOAT ( * is_tab ) [ 16 ] , * tab0 , * tab1 , tmp0 , tmp1 , v1 , v2 ;
int non_zero_found_short [ 3 ] ;
if ( s -> mode_ext & MODE_EXT_I_STEREO ) {
if ( ! s -> lsf ) {
is_tab = is_table ;
sf_max = 7 ;
}
else {
is_tab = is_table_lsf [ g1 -> scalefac_compress & 1 ] ;
sf_max = 16 ;
}
tab0 = g0 -> sb_hybrid + 576 ;
tab1 = g1 -> sb_hybrid + 576 ;
non_zero_found_short [ 0 ] = 0 ;
non_zero_found_short [ 1 ] = 0 ;
non_zero_found_short [ 2 ] = 0 ;
k = ( 13 - g1 -> short_start ) * 3 + g1 -> long_end - 3 ;
for ( i = 12 ;
i >= g1 -> short_start ;
i -- ) {
if ( i != 11 ) k -= 3 ;
len = band_size_short [ s -> sample_rate_index ] [ i ] ;
for ( l = 2 ;
l >= 0 ;
l -- ) {
tab0 -= len ;
tab1 -= len ;
if ( ! non_zero_found_short [ l ] ) {
for ( j = 0 ;
j < len ;
j ++ ) {
if ( tab1 [ j ] != 0 ) {
non_zero_found_short [ l ] = 1 ;
goto found1 ;
}
}
sf = g1 -> scale_factors [ k + l ] ;
if ( sf >= sf_max ) goto found1 ;
v1 = is_tab [ 0 ] [ sf ] ;
v2 = is_tab [ 1 ] [ sf ] ;
for ( j = 0 ;
j < len ;
j ++ ) {
tmp0 = tab0 [ j ] ;
tab0 [ j ] = MULLx ( tmp0 , v1 , FRAC_BITS ) ;
tab1 [ j ] = MULLx ( tmp0 , v2 , FRAC_BITS ) ;
}
}
else {
found1 : if ( s -> mode_ext & MODE_EXT_MS_STEREO ) {
for ( j = 0 ;
j < len ;
j ++ ) {
tmp0 = tab0 [ j ] ;
tmp1 = tab1 [ j ] ;
tab0 [ j ] = MULLx ( tmp0 + tmp1 , ISQRT2 , FRAC_BITS ) ;
tab1 [ j ] = MULLx ( tmp0 - tmp1 , ISQRT2 , FRAC_BITS ) ;
}
}
}
}
}
non_zero_found = non_zero_found_short [ 0 ] | non_zero_found_short [ 1 ] | non_zero_found_short [ 2 ] ;
for ( i = g1 -> long_end - 1 ;
i >= 0 ;
i -- ) {
len = band_size_long [ s -> sample_rate_index ] [ i ] ;
tab0 -= len ;
tab1 -= len ;
if ( ! non_zero_found ) {
for ( j = 0 ;
j < len ;
j ++ ) {
if ( tab1 [ j ] != 0 ) {
non_zero_found = 1 ;
goto found2 ;
}
}
k = ( i == 21 ) ? 20 : i ;
sf = g1 -> scale_factors [ k ] ;
if ( sf >= sf_max ) goto found2 ;
v1 = is_tab [ 0 ] [ sf ] ;
v2 = is_tab [ 1 ] [ sf ] ;
for ( j = 0 ;
j < len ;
j ++ ) {
tmp0 = tab0 [ j ] ;
tab0 [ j ] = MULLx ( tmp0 , v1 , FRAC_BITS ) ;
tab1 [ j ] = MULLx ( tmp0 , v2 , FRAC_BITS ) ;
}
}
else {
found2 : if ( s -> mode_ext & MODE_EXT_MS_STEREO ) {
for ( j = 0 ;
j < len ;
j ++ ) {
tmp0 = tab0 [ j ] ;
tmp1 = tab1 [ j ] ;
tab0 [ j ] = MULLx ( tmp0 + tmp1 , ISQRT2 , FRAC_BITS ) ;
tab1 [ j ] = MULLx ( tmp0 - tmp1 , ISQRT2 , FRAC_BITS ) ;
}
}
}
}
}
else if ( s -> mode_ext & MODE_EXT_MS_STEREO ) {
# if CONFIG_FLOAT s -> fdsp . butterflies_float ( g0 -> sb_hybrid , g1 -> sb_hybrid , 576 ) ;
# else tab0 = g0 -> sb_hybrid ;
tab1 = g1 -> sb_hybrid ;
for ( i = 0 ;
i < 576 ;
i ++ ) {
tmp0 = tab0 [ i ] ;
tmp1 = tab1 [ i ] ;
tab0 [ i ] = tmp0 + tmp1 ;
tab1 [ i ] = tmp0 - tmp1 ;
}
# endif }
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_diameter_3gpp2_exp_res ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , void * data ) {
proto_item * pi ;
diam_sub_dis_t * diam_sub_dis ;
if ( data == NULL ) return 0 ;
diam_sub_dis = ( diam_sub_dis_t * ) data ;
if ( tree ) {
pi = proto_tree_add_item ( tree , hf_diameter_3gpp2_exp_res , tvb , 0 , 4 , ENC_BIG_ENDIAN ) ;
diam_sub_dis -> avp_str = ( char * ) wmem_alloc ( wmem_packet_scope ( ) , ITEM_LABEL_LENGTH + 1 ) ;
proto_item_fill_label ( PITEM_FINFO ( pi ) , diam_sub_dis -> avp_str ) ;
diam_sub_dis -> avp_str = strstr ( diam_sub_dis -> avp_str , ": " ) + 2 ;
}
return 4 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void hscroll ( AVCodecContext * avctx ) {
AnsiContext * s = avctx -> priv_data ;
int i ;
if ( s -> y < avctx -> height - s -> font_height ) {
s -> y += s -> font_height ;
return ;
}
i = 0 ;
for ( ;
i < avctx -> height - s -> font_height ;
i ++ ) memcpy ( s -> frame . data [ 0 ] + i * s -> frame . linesize [ 0 ] , s -> frame . data [ 0 ] + ( i + s -> font_height ) * s -> frame . linesize [ 0 ] , avctx -> width ) ;
for ( ;
i < avctx -> height ;
i ++ ) memset ( s -> frame . data [ 0 ] + i * s -> frame . linesize [ 0 ] , DEFAULT_BG_COLOR , avctx -> width ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void * data_create_arabic ( const hb_ot_shape_plan_t * plan ) {
arabic_shape_plan_t * arabic_plan = ( arabic_shape_plan_t * ) calloc ( 1 , sizeof ( arabic_shape_plan_t ) ) ;
if ( unlikely ( ! arabic_plan ) ) return NULL ;
arabic_plan -> do_fallback = plan -> props . script == HB_SCRIPT_ARABIC ;
for ( unsigned int i = 0 ;
i < ARABIC_NUM_FEATURES ;
i ++ ) {
arabic_plan -> mask_array [ i ] = plan -> map . get_1_mask ( arabic_features [ i ] ) ;
arabic_plan -> do_fallback = arabic_plan -> do_fallback && ( FEATURE_IS_SYRIAC ( arabic_features [ i ] ) || plan -> map . needs_fallback ( arabic_features [ i ] ) ) ;
}
return arabic_plan ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void vp9_fdct8x8_c ( const int16_t * input , tran_low_t * final_output , int stride ) {
int i , j ;
tran_low_t intermediate [ 64 ] ;
{
tran_low_t * output = intermediate ;
tran_high_t s0 , s1 , s2 , s3 , s4 , s5 , s6 , s7 ;
tran_high_t t0 , t1 , t2 , t3 ;
tran_high_t x0 , x1 , x2 , x3 ;
int i ;
for ( i = 0 ;
i < 8 ;
i ++ ) {
s0 = ( input [ 0 * stride ] + input [ 7 * stride ] ) * 4 ;
s1 = ( input [ 1 * stride ] + input [ 6 * stride ] ) * 4 ;
s2 = ( input [ 2 * stride ] + input [ 5 * stride ] ) * 4 ;
s3 = ( input [ 3 * stride ] + input [ 4 * stride ] ) * 4 ;
s4 = ( input [ 3 * stride ] - input [ 4 * stride ] ) * 4 ;
s5 = ( input [ 2 * stride ] - input [ 5 * stride ] ) * 4 ;
s6 = ( input [ 1 * stride ] - input [ 6 * stride ] ) * 4 ;
s7 = ( input [ 0 * stride ] - input [ 7 * stride ] ) * 4 ;
x0 = s0 + s3 ;
x1 = s1 + s2 ;
x2 = s1 - s2 ;
x3 = s0 - s3 ;
t0 = ( x0 + x1 ) * cospi_16_64 ;
t1 = ( x0 - x1 ) * cospi_16_64 ;
t2 = x2 * cospi_24_64 + x3 * cospi_8_64 ;
t3 = - x2 * cospi_8_64 + x3 * cospi_24_64 ;
output [ 0 * 8 ] = fdct_round_shift ( t0 ) ;
output [ 2 * 8 ] = fdct_round_shift ( t2 ) ;
output [ 4 * 8 ] = fdct_round_shift ( t1 ) ;
output [ 6 * 8 ] = fdct_round_shift ( t3 ) ;
t0 = ( s6 - s5 ) * cospi_16_64 ;
t1 = ( s6 + s5 ) * cospi_16_64 ;
t2 = fdct_round_shift ( t0 ) ;
t3 = fdct_round_shift ( t1 ) ;
x0 = s4 + t2 ;
x1 = s4 - t2 ;
x2 = s7 - t3 ;
x3 = s7 + t3 ;
t0 = x0 * cospi_28_64 + x3 * cospi_4_64 ;
t1 = x1 * cospi_12_64 + x2 * cospi_20_64 ;
t2 = x2 * cospi_12_64 + x1 * - cospi_20_64 ;
t3 = x3 * cospi_28_64 + x0 * - cospi_4_64 ;
output [ 1 * 8 ] = fdct_round_shift ( t0 ) ;
output [ 3 * 8 ] = fdct_round_shift ( t2 ) ;
output [ 5 * 8 ] = fdct_round_shift ( t1 ) ;
output [ 7 * 8 ] = fdct_round_shift ( t3 ) ;
input ++ ;
output ++ ;
}
}
for ( i = 0 ;
i < 8 ;
++ i ) {
fdct8 ( & intermediate [ i * 8 ] , & final_output [ i * 8 ] ) ;
for ( j = 0 ;
j < 8 ;
++ j ) final_output [ j + i * 8 ] /= 2 ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void vc1_decode_ac_coeff ( VC1Context * v , int * last , int * skip , int * value , int codingset ) {
GetBitContext * gb = & v -> s . gb ;
int index , escape , run = 0 , level = 0 , lst = 0 ;
index = get_vlc2 ( gb , ff_vc1_ac_coeff_table [ codingset ] . table , AC_VLC_BITS , 3 ) ;
if ( index != ff_vc1_ac_sizes [ codingset ] - 1 ) {
run = vc1_index_decode_table [ codingset ] [ index ] [ 0 ] ;
level = vc1_index_decode_table [ codingset ] [ index ] [ 1 ] ;
lst = index >= vc1_last_decode_table [ codingset ] || get_bits_left ( gb ) < 0 ;
if ( get_bits1 ( gb ) ) level = - level ;
}
else {
escape = decode210 ( gb ) ;
if ( escape != 2 ) {
index = get_vlc2 ( gb , ff_vc1_ac_coeff_table [ codingset ] . table , AC_VLC_BITS , 3 ) ;
run = vc1_index_decode_table [ codingset ] [ index ] [ 0 ] ;
level = vc1_index_decode_table [ codingset ] [ index ] [ 1 ] ;
lst = index >= vc1_last_decode_table [ codingset ] ;
if ( escape == 0 ) {
if ( lst ) level += vc1_last_delta_level_table [ codingset ] [ run ] ;
else level += vc1_delta_level_table [ codingset ] [ run ] ;
}
else {
if ( lst ) run += vc1_last_delta_run_table [ codingset ] [ level ] + 1 ;
else run += vc1_delta_run_table [ codingset ] [ level ] + 1 ;
}
if ( get_bits1 ( gb ) ) level = - level ;
}
else {
int sign ;
lst = get_bits1 ( gb ) ;
if ( v -> s . esc3_level_length == 0 ) {
if ( v -> pq < 8 || v -> dquantfrm ) {
v -> s . esc3_level_length = get_bits ( gb , 3 ) ;
if ( ! v -> s . esc3_level_length ) v -> s . esc3_level_length = get_bits ( gb , 2 ) + 8 ;
}
else {
v -> s . esc3_level_length = get_unary ( gb , 1 , 6 ) + 2 ;
}
v -> s . esc3_run_length = 3 + get_bits ( gb , 2 ) ;
}
run = get_bits ( gb , v -> s . esc3_run_length ) ;
sign = get_bits1 ( gb ) ;
level = get_bits ( gb , v -> s . esc3_level_length ) ;
if ( sign ) level = - level ;
}
}
* last = lst ;
* skip = run ;
* value = level ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void __udp6_lib_err ( struct sk_buff * skb , struct inet6_skb_parm * opt , u8 type , u8 code , int offset , __be32 info , struct udp_table * udptable ) {
struct ipv6_pinfo * np ;
struct ipv6hdr * hdr = ( struct ipv6hdr * ) skb -> data ;
struct in6_addr * saddr = & hdr -> saddr ;
struct in6_addr * daddr = & hdr -> daddr ;
struct udphdr * uh = ( struct udphdr * ) ( skb -> data + offset ) ;
struct sock * sk ;
int err ;
sk = __udp6_lib_lookup ( dev_net ( skb -> dev ) , daddr , uh -> dest , saddr , uh -> source , inet6_iif ( skb ) , udptable ) ;
if ( sk == NULL ) return ;
np = inet6_sk ( sk ) ;
if ( ! icmpv6_err_convert ( type , code , & err ) && ! np -> recverr ) goto out ;
if ( sk -> sk_state != TCP_ESTABLISHED && ! np -> recverr ) goto out ;
if ( np -> recverr ) ipv6_icmp_error ( sk , skb , err , uh -> dest , ntohl ( info ) , ( u8 * ) ( uh + 1 ) ) ;
sk -> sk_err = err ;
sk -> sk_error_report ( sk ) ;
out : sock_put ( sk ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( HttpsEngagementPageLoadMetricsBrowserTest , UncommittedLoadWithError ) {
StartHttpsServer ( true ) ;
TabStripModel * tab_strip_model = browser ( ) -> tab_strip_model ( ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , https_test_server_ -> GetURL ( "/simple.html" ) ) ;
content : : WebContentsDestroyedWatcher destroyed_watcher ( tab_strip_model -> GetActiveWebContents ( ) ) ;
EXPECT_TRUE ( tab_strip_model -> CloseWebContentsAt ( tab_strip_model -> active_index ( ) , 0 ) ) ;
destroyed_watcher . Wait ( ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpEngagementHistogram , 0 ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementHistogram , 0 ) ;
FakeUserMetricsUpload ( ) ;
histogram_tester_ . ExpectTotalCount ( internal : : kHttpsEngagementSessionPercentage , 0 ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static __inline__ int ethtool_validate_speed ( __u32 speed ) {
return speed <= INT_MAX || speed == SPEED_UNKNOWN ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void gx_device_free_local ( gx_device * dev ) {
gx_device_finalize ( dev -> memory , dev ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void mips_jazz_machine_init ( void ) {
qemu_register_machine ( & mips_magnum_machine ) ;
qemu_register_machine ( & mips_pica61_machine ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void find_mv_refs_idx ( const VP9_COMMON * cm , const MACROBLOCKD * xd , const TileInfo * const tile , MODE_INFO * mi , MV_REFERENCE_FRAME ref_frame , int_mv * mv_ref_list , int block , int mi_row , int mi_col ) {
const int * ref_sign_bias = cm -> ref_frame_sign_bias ;
int i , refmv_count = 0 ;
const MODE_INFO * prev_mi = ! cm -> error_resilient_mode && cm -> prev_mi ? cm -> prev_mi [ mi_row * xd -> mi_stride + mi_col ] . src_mi : NULL ;
const MB_MODE_INFO * const prev_mbmi = prev_mi ? & prev_mi -> src_mi -> mbmi : NULL ;
const POSITION * const mv_ref_search = mv_ref_blocks [ mi -> mbmi . sb_type ] ;
int different_ref_found = 0 ;
int context_counter = 0 ;
vpx_memset ( mv_ref_list , 0 , sizeof ( * mv_ref_list ) * MAX_MV_REF_CANDIDATES ) ;
for ( i = 0 ;
i < 2 ;
++ i ) {
const POSITION * const mv_ref = & mv_ref_search [ i ] ;
if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) {
const MODE_INFO * const candidate_mi = xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] . src_mi ;
const MB_MODE_INFO * const candidate = & candidate_mi -> mbmi ;
context_counter += mode_2_counter [ candidate -> mode ] ;
different_ref_found = 1 ;
if ( candidate -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( get_sub_block_mv ( candidate_mi , 0 , mv_ref -> col , block ) ) ;
else if ( candidate -> ref_frame [ 1 ] == ref_frame ) ADD_MV_REF_LIST ( get_sub_block_mv ( candidate_mi , 1 , mv_ref -> col , block ) ) ;
}
}
for ( ;
i < MVREF_NEIGHBOURS ;
++ i ) {
const POSITION * const mv_ref = & mv_ref_search [ i ] ;
if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) {
const MB_MODE_INFO * const candidate = & xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] . src_mi -> mbmi ;
different_ref_found = 1 ;
if ( candidate -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( candidate -> mv [ 0 ] ) ;
else if ( candidate -> ref_frame [ 1 ] == ref_frame ) ADD_MV_REF_LIST ( candidate -> mv [ 1 ] ) ;
}
}
if ( prev_mbmi ) {
if ( prev_mbmi -> ref_frame [ 0 ] == ref_frame ) ADD_MV_REF_LIST ( prev_mbmi -> mv [ 0 ] ) ;
else if ( prev_mbmi -> ref_frame [ 1 ] == ref_frame ) ADD_MV_REF_LIST ( prev_mbmi -> mv [ 1 ] ) ;
}
if ( different_ref_found ) {
for ( i = 0 ;
i < MVREF_NEIGHBOURS ;
++ i ) {
const POSITION * mv_ref = & mv_ref_search [ i ] ;
if ( is_inside ( tile , mi_col , mi_row , cm -> mi_rows , mv_ref ) ) {
const MB_MODE_INFO * const candidate = & xd -> mi [ mv_ref -> col + mv_ref -> row * xd -> mi_stride ] . src_mi -> mbmi ;
IF_DIFF_REF_FRAME_ADD_MV ( candidate ) ;
}
}
}
if ( prev_mbmi ) IF_DIFF_REF_FRAME_ADD_MV ( prev_mbmi ) ;
Done : mi -> mbmi . mode_context [ ref_frame ] = counter_to_context [ context_counter ] ;
for ( i = 0 ;
i < MAX_MV_REF_CANDIDATES ;
++ i ) clamp_mv_ref ( & mv_ref_list [ i ] . as_mv , xd ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int ipvideo_decode_block_opcode_0x8_16 ( IpvideoContext * s ) {
int x , y ;
uint16_t P [ 4 ] ;
unsigned int flags = 0 ;
uint16_t * pixel_ptr = ( uint16_t * ) s -> pixel_ptr ;
P [ 0 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
P [ 1 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
if ( ! ( P [ 0 ] & 0x8000 ) ) {
for ( y = 0 ;
y < 16 ;
y ++ ) {
if ( ! ( y & 3 ) ) {
if ( y ) {
P [ 0 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
P [ 1 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
}
flags = bytestream2_get_le16 ( & s -> stream_ptr ) ;
}
for ( x = 0 ;
x < 4 ;
x ++ , flags >>= 1 ) * pixel_ptr ++ = P [ flags & 1 ] ;
pixel_ptr += s -> stride - 4 ;
if ( y == 7 ) pixel_ptr -= 8 * s -> stride - 4 ;
}
}
else {
flags = bytestream2_get_le32 ( & s -> stream_ptr ) ;
P [ 2 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
P [ 3 ] = bytestream2_get_le16 ( & s -> stream_ptr ) ;
if ( ! ( P [ 2 ] & 0x8000 ) ) {
for ( y = 0 ;
y < 16 ;
y ++ ) {
for ( x = 0 ;
x < 4 ;
x ++ , flags >>= 1 ) * pixel_ptr ++ = P [ flags & 1 ] ;
pixel_ptr += s -> stride - 4 ;
if ( y == 7 ) {
pixel_ptr -= 8 * s -> stride - 4 ;
P [ 0 ] = P [ 2 ] ;
P [ 1 ] = P [ 3 ] ;
flags = bytestream2_get_le32 ( & s -> stream_ptr ) ;
}
}
}
else {
for ( y = 0 ;
y < 8 ;
y ++ ) {
if ( y == 4 ) {
P [ 0 ] = P [ 2 ] ;
P [ 1 ] = P [ 3 ] ;
flags = bytestream2_get_le32 ( & s -> stream_ptr ) ;
}
for ( x = 0 ;
x < 8 ;
x ++ , flags >>= 1 ) * pixel_ptr ++ = P [ flags & 1 ] ;
pixel_ptr += s -> line_inc ;
}
}
}
return 0 ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ff_release_unused_pictures ( MpegEncContext * s , int remove_current ) {
int i ;
for ( i = 0 ;
i < s -> picture_count ;
i ++ ) {
if ( s -> picture [ i ] . f . data [ 0 ] && ! s -> picture [ i ] . f . reference && ( ! s -> picture [ i ] . owner2 || s -> picture [ i ] . owner2 == s ) && ( remove_current || & s -> picture [ i ] != s -> current_picture_ptr ) ) {
free_frame_buffer ( s , & s -> picture [ i ] ) ;
}
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
int TSContCall ( TSCont contp , TSEvent event , void * edata ) {
Continuation * c = ( Continuation * ) contp ;
return c -> handleEvent ( ( int ) event , edata ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline unsigned long lh_ ## type ## _get_down_load ( LHASH_OF ( type ) * lh ) {
return OPENSSL_LH_get_down_load ( ( OPENSSL_LHASH * ) lh ) ;
}
static ossl_inline void lh_ ## type ## _set_down_load ( LHASH_OF ( type ) * lh , unsigned long dl ) {
OPENSSL_LH_set_down_load ( ( OPENSSL_LHASH * ) lh , dl ) ;
}
static ossl_inline void lh_ ## type ## _doall ( LHASH_OF ( type ) * lh , void ( * doall ) ( type * ) ) {
OPENSSL_LH_doall ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNC ) doall ) ;
}
LHASH_OF ( type ) # define IMPLEMENT_LHASH_DOALL_ARG_CONST ( type , argtype ) int_implement_lhash_doall ( type , argtype , const type ) # define IMPLEMENT_LHASH_DOALL_ARG ( type , argtype ) int_implement_lhash_doall ( type , argtype , type ) # define int_implement_lhash_doall ( type , argtype , cbargtype ) static ossl_inline void lh_ ## type ## _doall_ ## argtype ( LHASH_OF ( type ) * lh , void ( * fn ) ( cbargtype * , argtype * ) , argtype * arg ) {
OPENSSL_LH_doall_arg ( ( OPENSSL_LHASH * ) lh , ( OPENSSL_LH_DOALL_FUNCARG ) fn , ( void * ) arg ) ;
}
LHASH_OF ( type ) DEFINE_LHASH_OF ( OPENSSL_STRING )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int dissect_h245_NonStandardMessage ( 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_NonStandardMessage , NonStandardMessage_sequence ) ;
return offset ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( FullscreenControllerInteractiveTest , DISABLED_TestTabDoesntExitFullscreenOnSubFrameNavigation ) {
ASSERT_TRUE ( test_server ( ) -> Start ( ) ) ;
GURL url ( ui_test_utils : : GetTestUrl ( base : : FilePath ( base : : FilePath : : kCurrentDirectory ) , base : : FilePath ( kSimpleFile ) ) ) ;
GURL url_with_fragment ( url . spec ( ) + "#fragment" ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , url ) ;
ASSERT_NO_FATAL_FAILURE ( ToggleTabFullscreen ( true ) ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , url_with_fragment ) ;
ASSERT_TRUE ( IsWindowFullscreenForTabOrPending ( ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static List * fetch_function_defaults ( HeapTuple func_tuple ) {
List * defaults ;
Datum proargdefaults ;
bool isnull ;
char * str ;
proargdefaults = SysCacheGetAttr ( PROCOID , func_tuple , Anum_pg_proc_proargdefaults , & isnull ) ;
if ( isnull ) elog ( ERROR , "not enough default arguments" ) ;
str = TextDatumGetCString ( proargdefaults ) ;
defaults = ( List * ) stringToNode ( str ) ;
Assert ( IsA ( defaults , List ) ) ;
pfree ( str ) ;
return defaults ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void print_pem_cert ( FILE * out , certificate_t * cert ) {
chunk_t encoded ;
if ( cert -> get_encoding ( cert , CERT_PEM , & encoded ) ) {
fprintf ( out , "%.*s" , ( int ) encoded . len , encoded . ptr ) ;
free ( encoded . ptr ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_zcl_ota_imageblockrsp ( tvbuff_t * tvb , proto_tree * tree , guint * offset ) {
guint8 status ;
guint8 data_size ;
status = tvb_get_guint8 ( tvb , * offset ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_status , tvb , * offset , 1 , ENC_NA ) ;
* offset += 1 ;
if ( status == ZBEE_ZCL_STAT_SUCCESS ) {
proto_tree_add_item ( tree , hf_zbee_zcl_ota_manufacturer_code , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_image_type , tvb , * offset , 2 , ENC_LITTLE_ENDIAN ) ;
* offset += 2 ;
dissect_zcl_ota_file_version_field ( tvb , tree , offset ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_file_offset , tvb , * offset , 4 , ENC_LITTLE_ENDIAN ) ;
* offset += 4 ;
data_size = tvb_get_guint8 ( tvb , * offset ) ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_data_size , tvb , * offset , 1 , ENC_NA ) ;
* offset += 1 ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_image_data , tvb , * offset , data_size , ENC_NA ) ;
* offset += data_size ;
}
else if ( status == ZBEE_ZCL_STAT_OTA_WAIT_FOR_DATA ) {
proto_tree_add_item ( tree , hf_zbee_zcl_ota_current_time , tvb , * offset , 4 , ENC_LITTLE_ENDIAN ) ;
* offset += 4 ;
proto_tree_add_item ( tree , hf_zbee_zcl_ota_request_time , tvb , * offset , 4 , ENC_LITTLE_ENDIAN ) ;
* offset += 4 ;
}
else {
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int decode_bmv_frame ( const uint8_t * source , int src_len , uint8_t * frame , int frame_off ) {
unsigned val , saved_val = 0 ;
int tmplen = src_len ;
const uint8_t * src , * source_end = source + src_len ;
uint8_t * frame_end = frame + SCREEN_WIDE * SCREEN_HIGH ;
uint8_t * dst , * dst_end ;
int len , mask ;
int forward = ( frame_off <= - SCREEN_WIDE ) || ( frame_off >= 0 ) ;
int read_two_nibbles , flag ;
int advance_mode ;
int mode = 0 ;
int i ;
if ( src_len <= 0 ) return AVERROR_INVALIDDATA ;
if ( forward ) {
src = source ;
dst = frame ;
dst_end = frame_end ;
}
else {
src = source + src_len - 1 ;
dst = frame_end - 1 ;
dst_end = frame - 1 ;
}
for ( ;
;
) {
int shift = 0 ;
flag = 0 ;
if ( ! mode || ( tmplen == 4 ) ) {
if ( src < source || src >= source_end ) return AVERROR_INVALIDDATA ;
val = * src ;
read_two_nibbles = 1 ;
}
else {
val = saved_val ;
read_two_nibbles = 0 ;
}
if ( ! ( val & 0xC ) ) {
for ( ;
;
) {
if ( ! read_two_nibbles ) {
if ( src < source || src >= source_end ) return AVERROR_INVALIDDATA ;
shift += 2 ;
val |= * src << shift ;
if ( * src & 0xC ) break ;
}
read_two_nibbles = 0 ;
shift += 2 ;
mask = ( 1 << shift ) - 1 ;
val = ( ( val >> 2 ) & ~ mask ) | ( val & mask ) ;
NEXT_BYTE ( src ) ;
if ( ( val & ( 0xC << shift ) ) ) {
flag = 1 ;
break ;
}
}
}
else if ( mode ) {
flag = tmplen != 4 ;
}
if ( flag ) {
tmplen = 4 ;
}
else {
saved_val = val >> ( 4 + shift ) ;
tmplen = 0 ;
val &= ( 1 << ( shift + 4 ) ) - 1 ;
NEXT_BYTE ( src ) ;
}
advance_mode = val & 1 ;
len = ( val >> 1 ) - 1 ;
mode += 1 + advance_mode ;
if ( mode >= 4 ) mode -= 3 ;
if ( FFABS ( dst_end - dst ) < len ) return AVERROR_INVALIDDATA ;
switch ( mode ) {
case 1 : if ( forward ) {
if ( dst - frame + SCREEN_WIDE < frame_off || dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len ) return AVERROR_INVALIDDATA ;
for ( i = 0 ;
i < len ;
i ++ ) dst [ i ] = dst [ frame_off + i ] ;
dst += len ;
}
else {
dst -= len ;
if ( dst - frame + SCREEN_WIDE < frame_off || dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len ) return AVERROR_INVALIDDATA ;
for ( i = len - 1 ;
i >= 0 ;
i -- ) dst [ i ] = dst [ frame_off + i ] ;
}
break ;
case 2 : if ( forward ) {
if ( source + src_len - src < len ) return AVERROR_INVALIDDATA ;
memcpy ( dst , src , len ) ;
dst += len ;
src += len ;
}
else {
if ( src - source < len ) return AVERROR_INVALIDDATA ;
dst -= len ;
src -= len ;
memcpy ( dst , src , len ) ;
}
break ;
case 3 : val = forward ? dst [ - 1 ] : dst [ 1 ] ;
if ( forward ) {
memset ( dst , val , len ) ;
dst += len ;
}
else {
dst -= len ;
memset ( dst , val , len ) ;
}
break ;
default : break ;
}
if ( dst == dst_end ) return 0 ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int armv7m_nvic_acknowledge_irq ( void * opaque ) {
nvic_state * s = ( nvic_state * ) opaque ;
uint32_t irq ;
irq = gic_acknowledge_irq ( & s -> gic , 0 ) ;
if ( irq == 1023 ) hw_error ( "Interrupt but no vector\n" ) ;
if ( irq >= 32 ) irq -= 16 ;
return irq ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int ehci_create_ich9_with_companions ( PCIBus * bus , int slot ) {
const struct ehci_companions * comp ;
PCIDevice * ehci , * uhci ;
BusState * usbbus ;
const char * name ;
int i ;
switch ( slot ) {
case 0x1d : name = "ich9-usb-ehci1" ;
comp = ich9_1d ;
break ;
case 0x1a : name = "ich9-usb-ehci2" ;
comp = ich9_1a ;
break ;
default : return - 1 ;
}
ehci = pci_create_multifunction ( bus , PCI_DEVFN ( slot , 7 ) , true , name ) ;
qdev_init_nofail ( & ehci -> qdev ) ;
usbbus = QLIST_FIRST ( & ehci -> qdev . child_bus ) ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
uhci = pci_create_multifunction ( bus , PCI_DEVFN ( slot , comp [ i ] . func ) , true , comp [ i ] . name ) ;
qdev_prop_set_string ( & uhci -> qdev , "masterbus" , usbbus -> name ) ;
qdev_prop_set_uint32 ( & uhci -> qdev , "firstport" , comp [ i ] . port ) ;
qdev_init_nofail ( & uhci -> qdev ) ;
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static VALUE cState_aset ( VALUE self , VALUE name , VALUE value ) {
VALUE name_writer ;
name = rb_funcall ( name , i_to_s , 0 ) ;
name_writer = rb_str_cat2 ( rb_str_dup ( name ) , "=" ) ;
if ( RTEST ( rb_funcall ( self , i_respond_to_p , 1 , name_writer ) ) ) {
return rb_funcall ( self , i_send , 2 , name_writer , value ) ;
}
else {
rb_ivar_set ( self , rb_intern_str ( rb_str_concat ( rb_str_new2 ( "@" ) , name ) ) , value ) ;
}
return Qnil ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TSReturnCode TSHttpTxnClientFdGet ( TSHttpTxn txnp , int * fdp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
sdk_assert ( sdk_sanity_check_null_ptr ( ( void * ) fdp ) == TS_SUCCESS ) ;
TSHttpSsn ssnp = TSHttpTxnSsnGet ( txnp ) ;
return TSHttpSsnClientFdGet ( ssnp , fdp ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
hb_shape_plan_t * hb_shape_plan_create_cached ( hb_face_t * face , const hb_segment_properties_t * props , const hb_feature_t * user_features , unsigned int num_user_features , const char * const * shaper_list ) {
DEBUG_MSG_FUNC ( SHAPE_PLAN , NULL , "face=%p num_features=%d shaper_list=%p" , face , num_user_features , shaper_list ) ;
hb_shape_plan_proposal_t proposal = {
* props , shaper_list , user_features , num_user_features , NULL }
;
if ( shaper_list ) {
for ( const char * const * shaper_item = shaper_list ;
* shaper_item ;
shaper_item ++ ) if ( 0 ) ;
# define HB_SHAPER_IMPLEMENT ( shaper ) else if ( 0 == strcmp ( * shaper_item , # shaper ) && hb_ ## shaper ## _shaper_face_data_ensure ( face ) ) {
proposal . shaper_func = _hb_ ## shaper ## _shape ;
break ;
}
# include "hb-shaper-list.hh" # undef HB_SHAPER_IMPLEMENT if ( unlikely ( ! proposal . shaper_func ) ) return hb_shape_plan_get_empty ( ) ;
}
retry : hb_face_t : : plan_node_t * cached_plan_nodes = ( hb_face_t : : plan_node_t * ) hb_atomic_ptr_get ( & face -> shape_plans ) ;
for ( hb_face_t : : plan_node_t * node = cached_plan_nodes ;
node ;
node = node -> next ) if ( hb_shape_plan_matches ( node -> shape_plan , & proposal ) ) {
DEBUG_MSG_FUNC ( SHAPE_PLAN , node -> shape_plan , "fulfilled from cache" ) ;
return hb_shape_plan_reference ( node -> shape_plan ) ;
}
hb_shape_plan_t * shape_plan = hb_shape_plan_create ( face , props , user_features , num_user_features , shaper_list ) ;
if ( unlikely ( hb_object_is_inert ( face ) ) ) return shape_plan ;
if ( hb_non_global_user_features_present ( user_features , num_user_features ) ) return shape_plan ;
hb_face_t : : plan_node_t * node = ( hb_face_t : : plan_node_t * ) calloc ( 1 , sizeof ( hb_face_t : : plan_node_t ) ) ;
if ( unlikely ( ! node ) ) return shape_plan ;
node -> shape_plan = shape_plan ;
node -> next = cached_plan_nodes ;
if ( ! hb_atomic_ptr_cmpexch ( & face -> shape_plans , cached_plan_nodes , node ) ) {
hb_shape_plan_destroy ( shape_plan ) ;
free ( node ) ;
goto retry ;
}
DEBUG_MSG_FUNC ( SHAPE_PLAN , shape_plan , "inserted into cache" ) ;
return hb_shape_plan_reference ( shape_plan ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static UBool _addVariantToList ( VariantListEntry * * first , VariantListEntry * var ) {
UBool bAdded = TRUE ;
if ( * first == NULL ) {
var -> next = NULL ;
* first = var ;
}
else {
VariantListEntry * prev , * cur ;
int32_t cmp ;
prev = NULL ;
cur = * first ;
while ( TRUE ) {
if ( cur == NULL ) {
prev -> next = var ;
var -> next = NULL ;
break ;
}
cmp = uprv_compareInvCharsAsAscii ( var -> variant , cur -> variant ) ;
if ( cmp == 0 ) {
bAdded = FALSE ;
break ;
}
prev = cur ;
cur = cur -> next ;
}
}
return bAdded ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( BrowsingDataRemoverImplTest , RemoveProtectedLocalStorageForever ) {
# if BUILDFLAG ( ENABLE_EXTENSIONS ) MockExtensionSpecialStoragePolicy * policy = CreateMockPolicy ( ) ;
policy -> AddProtected ( kOrigin1 . GetOrigin ( ) ) ;
# endif BlockUntilBrowsingDataRemoved ( base : : Time ( ) , base : : Time : : Max ( ) , BrowsingDataRemover : : REMOVE_LOCAL_STORAGE , true ) ;
EXPECT_EQ ( BrowsingDataRemover : : REMOVE_LOCAL_STORAGE , GetRemovalMask ( ) ) ;
EXPECT_EQ ( BrowsingDataHelper : : UNPROTECTED_WEB | BrowsingDataHelper : : PROTECTED_WEB , GetOriginTypeMask ( ) ) ;
StoragePartitionRemovalData removal_data = GetStoragePartitionRemovalData ( ) ;
EXPECT_EQ ( removal_data . remove_mask , StoragePartition : : REMOVE_DATA_MASK_LOCAL_STORAGE ) ;
EXPECT_EQ ( removal_data . quota_storage_remove_mask , StoragePartition : : QUOTA_MANAGED_STORAGE_MASK_ALL ) ;
EXPECT_EQ ( removal_data . remove_begin , GetBeginTime ( ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin1 , mock_policy ( ) ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin2 , mock_policy ( ) ) ) ;
EXPECT_TRUE ( removal_data . origin_matcher . Run ( kOrigin3 , mock_policy ( ) ) ) ;
EXPECT_FALSE ( removal_data . origin_matcher . Run ( kOriginExt , mock_policy ( ) ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( WebFrameTest , ShowVirtualKeyboardOnElementFocus ) {
FrameTestHelpers : : WebViewHelper web_view_helper ;
web_view_helper . InitializeRemote ( ) ;
ShowVirtualKeyboardObserverWidgetClient web_widget_client ;
WebLocalFrameImpl * local_frame = FrameTestHelpers : : CreateLocalChild ( * web_view_helper . RemoteMainFrame ( ) , "child" , WebFrameOwnerProperties ( ) , nullptr , nullptr , & web_widget_client ) ;
RegisterMockedHttpURLLoad ( "input_field_default.html" ) ;
FrameTestHelpers : : LoadFrame ( local_frame , base_url_ + "input_field_default.html" ) ;
Frame : : NotifyUserActivation ( local_frame -> GetFrame ( ) , UserGestureToken : : kNewGesture ) ;
local_frame -> ExecuteScript ( WebScriptSource ( "window.focus();
" "document.querySelector('input').focus();
" ) ) ;
EXPECT_TRUE ( web_widget_client . DidShowVirtualKeyboard ( ) ) ;
web_view_helper . Reset ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
bool is_pseudo_constant_clause ( Node * clause ) {
if ( ! contain_var_clause ( clause ) && ! contain_volatile_functions ( clause ) ) return true ;
return false ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static const char * U_CALLCONV _ISCIIgetName ( const UConverter * cnv ) {
if ( cnv -> extraInfo ) {
UConverterDataISCII * myData = ( UConverterDataISCII * ) cnv -> extraInfo ;
return myData -> name ;
}
return NULL ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void onechr ( struct vars * v , chr c , struct state * lp , struct state * rp ) {
if ( ! ( v -> cflags & REG_ICASE ) ) {
newarc ( v -> nfa , PLAIN , subcolor ( v -> cm , c ) , lp , rp ) ;
return ;
}
dovec ( v , allcases ( v , c ) , lp , rp ) ;
}
| 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 ) {
const uint8_t * buf = avpkt -> data ;
int buf_size = avpkt -> size ;
C93DecoderContext * const c93 = avctx -> priv_data ;
AVFrame * const newpic = & c93 -> pictures [ c93 -> currentpic ] ;
AVFrame * const oldpic = & c93 -> pictures [ c93 -> currentpic ^ 1 ] ;
GetByteContext gb ;
uint8_t * out ;
int stride , ret , i , x , y , b , bt = 0 ;
c93 -> currentpic ^= 1 ;
if ( ( ret = ff_reget_buffer ( avctx , newpic ) ) < 0 ) {
av_log ( avctx , AV_LOG_ERROR , "reget_buffer() failed\n" ) ;
return ret ;
}
stride = newpic -> linesize [ 0 ] ;
bytestream2_init ( & gb , buf , buf_size ) ;
b = bytestream2_get_byte ( & gb ) ;
if ( b & C93_FIRST_FRAME ) {
newpic -> pict_type = AV_PICTURE_TYPE_I ;
newpic -> key_frame = 1 ;
}
else {
newpic -> pict_type = AV_PICTURE_TYPE_P ;
newpic -> key_frame = 0 ;
}
for ( y = 0 ;
y < HEIGHT ;
y += 8 ) {
out = newpic -> data [ 0 ] + y * stride ;
for ( x = 0 ;
x < WIDTH ;
x += 8 ) {
uint8_t * copy_from = oldpic -> data [ 0 ] ;
unsigned int offset , j ;
uint8_t cols [ 4 ] , grps [ 4 ] ;
C93BlockType block_type ;
if ( ! bt ) bt = bytestream2_get_byte ( & gb ) ;
block_type = bt & 0x0F ;
switch ( block_type ) {
case C93_8X8_FROM_PREV : offset = bytestream2_get_le16 ( & gb ) ;
if ( ( ret = copy_block ( avctx , out , copy_from , offset , 8 , stride ) ) < 0 ) return ret ;
break ;
case C93_4X4_FROM_CURR : copy_from = newpic -> data [ 0 ] ;
case C93_4X4_FROM_PREV : for ( j = 0 ;
j < 8 ;
j += 4 ) {
for ( i = 0 ;
i < 8 ;
i += 4 ) {
offset = bytestream2_get_le16 ( & gb ) ;
if ( ( ret = copy_block ( avctx , & out [ j * stride + i ] , copy_from , offset , 4 , stride ) ) < 0 ) return ret ;
}
}
break ;
case C93_8X8_2COLOR : bytestream2_get_buffer ( & gb , cols , 2 ) ;
for ( i = 0 ;
i < 8 ;
i ++ ) {
draw_n_color ( out + i * stride , stride , 8 , 1 , 1 , cols , NULL , bytestream2_get_byte ( & gb ) ) ;
}
break ;
case C93_4X4_2COLOR : case C93_4X4_4COLOR : case C93_4X4_4COLOR_GRP : for ( j = 0 ;
j < 8 ;
j += 4 ) {
for ( i = 0 ;
i < 8 ;
i += 4 ) {
if ( block_type == C93_4X4_2COLOR ) {
bytestream2_get_buffer ( & gb , cols , 2 ) ;
draw_n_color ( out + i + j * stride , stride , 4 , 4 , 1 , cols , NULL , bytestream2_get_le16 ( & gb ) ) ;
}
else if ( block_type == C93_4X4_4COLOR ) {
bytestream2_get_buffer ( & gb , cols , 4 ) ;
draw_n_color ( out + i + j * stride , stride , 4 , 4 , 2 , cols , NULL , bytestream2_get_le32 ( & gb ) ) ;
}
else {
bytestream2_get_buffer ( & gb , grps , 4 ) ;
draw_n_color ( out + i + j * stride , stride , 4 , 4 , 1 , cols , grps , bytestream2_get_le16 ( & gb ) ) ;
}
}
}
break ;
case C93_NOOP : break ;
case C93_8X8_INTRA : for ( j = 0 ;
j < 8 ;
j ++ ) bytestream2_get_buffer ( & gb , out + j * stride , 8 ) ;
break ;
default : av_log ( avctx , AV_LOG_ERROR , "unexpected type %x at %dx%d\n" , block_type , x , y ) ;
return AVERROR_INVALIDDATA ;
}
bt >>= 4 ;
out += 8 ;
}
}
if ( b & C93_HAS_PALETTE ) {
uint32_t * palette = ( uint32_t * ) newpic -> data [ 1 ] ;
for ( i = 0 ;
i < 256 ;
i ++ ) {
palette [ i ] = bytestream2_get_be24 ( & gb ) ;
}
newpic -> palette_has_changed = 1 ;
}
else {
if ( oldpic -> data [ 1 ] ) memcpy ( newpic -> data [ 1 ] , oldpic -> data [ 1 ] , 256 * 4 ) ;
}
if ( ( ret = av_frame_ref ( data , newpic ) ) < 0 ) return ret ;
* got_frame = 1 ;
return buf_size ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static krb5_boolean ks_tuple_present ( int n_ks_tuple , krb5_key_salt_tuple * ks_tuple , krb5_key_salt_tuple * looking_for ) {
int i ;
for ( i = 0 ;
i < n_ks_tuple ;
i ++ ) {
if ( ks_tuple [ i ] . ks_enctype == looking_for -> ks_enctype && ks_tuple [ i ] . ks_salttype == looking_for -> ks_salttype ) return TRUE ;
}
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static gboolean should_confirm_trash ( void ) {
GSettings * prefs ;
gboolean confirm_trash ;
prefs = g_settings_new ( "org.gnome.nautilus.preferences" ) ;
confirm_trash = g_settings_get_boolean ( prefs , NAUTILUS_PREFERENCES_CONFIRM_TRASH ) ;
g_object_unref ( prefs ) ;
return confirm_trash ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void row_dim_write ( zval * object , zval * member , zval * value TSRMLS_DC ) {
php_error_docref ( NULL TSRMLS_CC , E_WARNING , "This PDORow is not from a writable result set" ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline t2 * sk_ ## t1 ## _value ( const STACK_OF ( t1 ) * sk , int idx ) {
return ( t2 * ) OPENSSL_sk_value ( ( const OPENSSL_STACK * ) sk , idx ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new ( sk_ ## t1 ## _compfunc compare ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new ( ( OPENSSL_sk_compfunc ) compare ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_null ( void ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_null ( ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _new_reserve ( sk_ ## t1 ## _compfunc compare , int n ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_new_reserve ( ( OPENSSL_sk_compfunc ) compare , n ) ;
}
static ossl_inline int sk_ ## t1 ## _reserve ( STACK_OF ( t1 ) * sk , int n ) {
return OPENSSL_sk_reserve ( ( OPENSSL_STACK * ) sk , n ) ;
}
static ossl_inline void sk_ ## t1 ## _free ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_free ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char )
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dissect_wbxml_common ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , const wbxml_decoding * override_content_map ) {
proto_item * ti ;
proto_tree * wbxml_tree ;
proto_tree * wbxml_str_tbl_tree ;
proto_tree * wbxml_content_tree ;
guint8 version ;
guint offset = 0 ;
guint32 len ;
guint32 charset = 0 ;
guint32 charset_len = 0 ;
guint32 publicid ;
guint32 publicid_index = 0 ;
guint32 publicid_len ;
guint32 str_tbl ;
guint32 str_tbl_len ;
guint32 str_tbl_len_len = 0 ;
guint8 level = 0 ;
const wbxml_decoding * content_map = NULL ;
gchar * summary = NULL ;
guint8 codepage_stag = 0 ;
guint8 codepage_attr = 0 ;
DebugLog ( ( "dissect_wbxml: Dissecting packet %u\n" , pinfo -> fd -> num ) ) ;
switch ( version = tvb_get_guint8 ( tvb , 0 ) ) {
case 0x00 : break ;
case 0x01 : case 0x02 : case 0x03 : break ;
default : col_append_fstr ( pinfo -> cinfo , COL_INFO , " (Unknown WBXML version 0x%02x)" , version ) ;
ti = proto_tree_add_item ( tree , proto_wbxml , tvb , 0 , - 1 , ENC_NA ) ;
proto_item_append_text ( ti , ", Unknown version 0x%02x" , version ) ;
return ;
}
publicid = tvb_get_guintvar ( tvb , 1 , & publicid_len ) ;
if ( ! publicid ) {
publicid_index = tvb_get_guintvar ( tvb , 1 + publicid_len , & len ) ;
publicid_len += len ;
}
offset = 1 + publicid_len ;
switch ( version ) {
case 0x00 : break ;
case 0x01 : case 0x02 : case 0x03 : charset = tvb_get_guintvar ( tvb , offset , & charset_len ) ;
offset += charset_len ;
break ;
default : DISSECTOR_ASSERT_NOT_REACHED ( ) ;
break ;
}
tvb_get_guintvar ( tvb , offset , & str_tbl_len_len ) ;
str_tbl = offset + str_tbl_len_len ;
if ( publicid ) {
summary = wmem_strdup_printf ( wmem_packet_scope ( ) , "%s, Public ID: \"%s\"" , val_to_str_ext ( version , & vals_wbxml_versions_ext , "(unknown 0x%x)" ) , val_to_str_ext ( publicid , & vals_wbxml_public_ids_ext , "(unknown 0x%x)" ) ) ;
}
else {
len = tvb_strsize ( tvb , str_tbl + publicid_index ) ;
summary = wmem_strdup_printf ( wmem_packet_scope ( ) , "%s, Public ID: \"%s\"" , val_to_str_ext ( version , & vals_wbxml_versions_ext , "(unknown 0x%x)" ) , tvb_format_text ( tvb , str_tbl + publicid_index , len - 1 ) ) ;
}
col_append_fstr ( pinfo -> cinfo , COL_INFO , " (WBXML %s)" , summary ) ;
ti = proto_tree_add_item ( tree , proto_wbxml , tvb , 0 , - 1 , ENC_NA ) ;
proto_item_append_text ( ti , ", Version: %s" , summary ) ;
if ( tree ) {
wbxml_tree = proto_item_add_subtree ( ti , ett_wbxml ) ;
proto_tree_add_uint ( wbxml_tree , hf_wbxml_version , tvb , 0 , 1 , version ) ;
if ( publicid ) {
proto_tree_add_uint ( wbxml_tree , hf_wbxml_public_id_known , tvb , 1 , publicid_len , publicid ) ;
}
else {
proto_tree_add_item ( wbxml_tree , hf_wbxml_public_id_literal , tvb , 1 , publicid_len , ENC_ASCII | ENC_NA ) ;
}
offset = 1 + publicid_len ;
if ( version ) {
proto_tree_add_uint ( wbxml_tree , hf_wbxml_charset , tvb , 1 + publicid_len , charset_len , charset ) ;
offset += charset_len ;
}
str_tbl_len = tvb_get_guintvar ( tvb , offset , & len ) ;
str_tbl = offset + len ;
ti = proto_tree_add_text ( wbxml_tree , tvb , offset , len + str_tbl_len , "String table: %u bytes" , str_tbl_len ) ;
if ( wbxml_tree && str_tbl_len ) {
wbxml_str_tbl_tree = proto_item_add_subtree ( ti , ett_wbxml_str_tbl ) ;
show_wbxml_string_table ( wbxml_str_tbl_tree , tvb , str_tbl , str_tbl_len ) ;
}
offset += len + str_tbl_len ;
if ( disable_wbxml_token_parsing ) {
proto_tree_add_text ( wbxml_tree , tvb , offset , - 1 , "Data representation not shown " "(edit WBXML preferences to show)" ) ;
return ;
}
ti = proto_tree_add_text ( wbxml_tree , tvb , offset , - 1 , "Data representation" ) ;
wbxml_content_tree = proto_item_add_subtree ( ti , ett_wbxml_content ) ;
if ( wbxml_tree ) {
if ( override_content_map != NULL ) {
content_map = override_content_map ;
proto_item_append_text ( ti , " is based on: %s" , content_map -> name ) ;
}
else {
content_map = get_wbxml_decoding_from_public_id ( publicid ) ;
if ( ! content_map ) {
content_map = get_wbxml_decoding_from_content_type ( pinfo -> match_string , tvb , offset ) ;
if ( ! content_map ) {
proto_tree_add_text ( wbxml_content_tree , tvb , offset , - 1 , "[Rendering of this content type" " not (yet) supported]" ) ;
}
else {
proto_item_append_text ( ti , " is based on Content-Type: %s " "(chosen decoding: %s)" , pinfo -> match_string , content_map -> name ) ;
}
}
}
if ( content_map && skip_wbxml_token_mapping ) {
proto_tree_add_text ( wbxml_content_tree , tvb , offset , - 1 , "[Rendering of this content type" " has been disabled " "(edit WBXML preferences to enable)]" ) ;
content_map = NULL ;
}
proto_tree_add_text ( wbxml_content_tree , tvb , offset , - 1 , "Level | State | Codepage " "| WBXML Token Description " "| Rendering" ) ;
if ( content_map ) {
len = parse_wbxml_tag_defined ( wbxml_content_tree , tvb , offset , str_tbl , & level , & codepage_stag , & codepage_attr , content_map ) ;
}
else {
len = parse_wbxml_tag ( wbxml_content_tree , tvb , offset , str_tbl , & level , & codepage_stag , & codepage_attr ) ;
}
}
return ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
SPL_METHOD ( SplFileObject , getMaxLineLen ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
if ( zend_parse_parameters_none ( ) == FAILURE ) {
return ;
}
RETURN_LONG ( ( long ) intern -> u . file . max_line_len ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline bool is_joiner ( const hb_glyph_info_t & info ) {
return is_one_of ( info , JOINER_FLAGS ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void filter_block_plane_non420 ( VP9_COMMON * cm , struct macroblockd_plane * plane , MODE_INFO * * mi_8x8 , int mi_row , int mi_col ) {
const int ss_x = plane -> subsampling_x ;
const int ss_y = plane -> subsampling_y ;
const int row_step = 1 << ss_x ;
const int col_step = 1 << ss_y ;
const int row_step_stride = cm -> mi_stride * row_step ;
struct buf_2d * const dst = & plane -> dst ;
uint8_t * const dst0 = dst -> buf ;
unsigned int mask_16x16 [ MI_BLOCK_SIZE ] = {
0 }
;
unsigned int mask_8x8 [ MI_BLOCK_SIZE ] = {
0 }
;
unsigned int mask_4x4 [ MI_BLOCK_SIZE ] = {
0 }
;
unsigned int mask_4x4_int [ MI_BLOCK_SIZE ] = {
0 }
;
uint8_t lfl [ MI_BLOCK_SIZE * MI_BLOCK_SIZE ] ;
int r , c ;
for ( r = 0 ;
r < MI_BLOCK_SIZE && mi_row + r < cm -> mi_rows ;
r += row_step ) {
unsigned int mask_16x16_c = 0 ;
unsigned int mask_8x8_c = 0 ;
unsigned int mask_4x4_c = 0 ;
unsigned int border_mask ;
for ( c = 0 ;
c < MI_BLOCK_SIZE && mi_col + c < cm -> mi_cols ;
c += col_step ) {
const MODE_INFO * mi = mi_8x8 [ c ] ;
const BLOCK_SIZE sb_type = mi [ 0 ] . mbmi . sb_type ;
const int skip_this = mi [ 0 ] . mbmi . skip && is_inter_block ( & mi [ 0 ] . mbmi ) ;
const int block_edge_left = ( num_4x4_blocks_wide_lookup [ sb_type ] > 1 ) ? ! ( c & ( num_8x8_blocks_wide_lookup [ sb_type ] - 1 ) ) : 1 ;
const int skip_this_c = skip_this && ! block_edge_left ;
const int block_edge_above = ( num_4x4_blocks_high_lookup [ sb_type ] > 1 ) ? ! ( r & ( num_8x8_blocks_high_lookup [ sb_type ] - 1 ) ) : 1 ;
const int skip_this_r = skip_this && ! block_edge_above ;
const TX_SIZE tx_size = ( plane -> plane_type == PLANE_TYPE_UV ) ? get_uv_tx_size ( & mi [ 0 ] . mbmi , plane ) : mi [ 0 ] . mbmi . tx_size ;
const int skip_border_4x4_c = ss_x && mi_col + c == cm -> mi_cols - 1 ;
const int skip_border_4x4_r = ss_y && mi_row + r == cm -> mi_rows - 1 ;
if ( ! ( lfl [ ( r << 3 ) + ( c >> ss_x ) ] = get_filter_level ( & cm -> lf_info , & mi [ 0 ] . mbmi ) ) ) continue ;
if ( tx_size == TX_32X32 ) {
if ( ! skip_this_c && ( ( c >> ss_x ) & 3 ) == 0 ) {
if ( ! skip_border_4x4_c ) mask_16x16_c |= 1 << ( c >> ss_x ) ;
else mask_8x8_c |= 1 << ( c >> ss_x ) ;
}
if ( ! skip_this_r && ( ( r >> ss_y ) & 3 ) == 0 ) {
if ( ! skip_border_4x4_r ) mask_16x16 [ r ] |= 1 << ( c >> ss_x ) ;
else mask_8x8 [ r ] |= 1 << ( c >> ss_x ) ;
}
}
else if ( tx_size == TX_16X16 ) {
if ( ! skip_this_c && ( ( c >> ss_x ) & 1 ) == 0 ) {
if ( ! skip_border_4x4_c ) mask_16x16_c |= 1 << ( c >> ss_x ) ;
else mask_8x8_c |= 1 << ( c >> ss_x ) ;
}
if ( ! skip_this_r && ( ( r >> ss_y ) & 1 ) == 0 ) {
if ( ! skip_border_4x4_r ) mask_16x16 [ r ] |= 1 << ( c >> ss_x ) ;
else mask_8x8 [ r ] |= 1 << ( c >> ss_x ) ;
}
}
else {
if ( ! skip_this_c ) {
if ( tx_size == TX_8X8 || ( ( c >> ss_x ) & 3 ) == 0 ) mask_8x8_c |= 1 << ( c >> ss_x ) ;
else mask_4x4_c |= 1 << ( c >> ss_x ) ;
}
if ( ! skip_this_r ) {
if ( tx_size == TX_8X8 || ( ( r >> ss_y ) & 3 ) == 0 ) mask_8x8 [ r ] |= 1 << ( c >> ss_x ) ;
else mask_4x4 [ r ] |= 1 << ( c >> ss_x ) ;
}
if ( ! skip_this && tx_size < TX_8X8 && ! skip_border_4x4_c ) mask_4x4_int [ r ] |= 1 << ( c >> ss_x ) ;
}
}
border_mask = ~ ( mi_col == 0 ) ;
filter_selectively_vert ( dst -> buf , dst -> stride , mask_16x16_c & border_mask , mask_8x8_c & border_mask , mask_4x4_c & border_mask , mask_4x4_int [ r ] , & cm -> lf_info , & lfl [ r << 3 ] ) ;
dst -> buf += 8 * dst -> stride ;
mi_8x8 += row_step_stride ;
}
dst -> buf = dst0 ;
for ( r = 0 ;
r < MI_BLOCK_SIZE && mi_row + r < cm -> mi_rows ;
r += row_step ) {
const int skip_border_4x4_r = ss_y && mi_row + r == cm -> mi_rows - 1 ;
const unsigned int mask_4x4_int_r = skip_border_4x4_r ? 0 : mask_4x4_int [ r ] ;
unsigned int mask_16x16_r ;
unsigned int mask_8x8_r ;
unsigned int mask_4x4_r ;
if ( mi_row + r == 0 ) {
mask_16x16_r = 0 ;
mask_8x8_r = 0 ;
mask_4x4_r = 0 ;
}
else {
mask_16x16_r = mask_16x16 [ r ] ;
mask_8x8_r = mask_8x8 [ r ] ;
mask_4x4_r = mask_4x4 [ r ] ;
}
filter_selectively_horiz ( dst -> buf , dst -> stride , mask_16x16_r , mask_8x8_r , mask_4x4_r , mask_4x4_int_r , & cm -> lf_info , & lfl [ r << 3 ] ) ;
dst -> buf += 8 * dst -> stride ;
}
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int tipc_nl_compat_recv ( struct sk_buff * skb , struct genl_info * info ) {
int err ;
int len ;
struct tipc_nl_compat_msg msg ;
struct nlmsghdr * req_nlh ;
struct nlmsghdr * rep_nlh ;
struct tipc_genlmsghdr * req_userhdr = info -> userhdr ;
memset ( & msg , 0 , sizeof ( msg ) ) ;
req_nlh = ( struct nlmsghdr * ) skb -> data ;
msg . req = nlmsg_data ( req_nlh ) + GENL_HDRLEN + TIPC_GENL_HDRLEN ;
msg . cmd = req_userhdr -> cmd ;
msg . net = genl_info_net ( info ) ;
msg . dst_sk = skb -> sk ;
if ( ( msg . cmd & 0xC000 ) && ( ! netlink_net_capable ( skb , CAP_NET_ADMIN ) ) ) {
msg . rep = tipc_get_err_tlv ( TIPC_CFG_NOT_NET_ADMIN ) ;
err = - EACCES ;
goto send ;
}
len = nlmsg_attrlen ( req_nlh , GENL_HDRLEN + TIPC_GENL_HDRLEN ) ;
if ( len && ! TLV_OK ( msg . req , len ) ) {
msg . rep = tipc_get_err_tlv ( TIPC_CFG_NOT_SUPPORTED ) ;
err = - EOPNOTSUPP ;
goto send ;
}
err = tipc_nl_compat_handle ( & msg ) ;
if ( ( err == - EOPNOTSUPP ) || ( err == - EPERM ) ) msg . rep = tipc_get_err_tlv ( TIPC_CFG_NOT_SUPPORTED ) ;
else if ( err == - EINVAL ) msg . rep = tipc_get_err_tlv ( TIPC_CFG_TLV_ERROR ) ;
send : if ( ! msg . rep ) return err ;
len = nlmsg_total_size ( GENL_HDRLEN + TIPC_GENL_HDRLEN ) ;
skb_push ( msg . rep , len ) ;
rep_nlh = nlmsg_hdr ( msg . rep ) ;
memcpy ( rep_nlh , info -> nlhdr , len ) ;
rep_nlh -> nlmsg_len = msg . rep -> len ;
genlmsg_unicast ( msg . net , msg . rep , NETLINK_CB ( skb ) . portid ) ;
return err ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ber_init2 ( BerElement * ber , struct berval * bv , int options ) {
assert ( ber != NULL ) ;
( void ) memset ( ( char * ) ber , '\0' , sizeof ( BerElement ) ) ;
ber -> ber_valid = LBER_VALID_BERELEMENT ;
ber -> ber_tag = LBER_DEFAULT ;
ber -> ber_options = ( char ) options ;
ber -> ber_debug = ber_int_debug ;
if ( bv != NULL ) {
ber -> ber_buf = bv -> bv_val ;
ber -> ber_ptr = ber -> ber_buf ;
ber -> ber_end = ber -> ber_buf + bv -> bv_len ;
}
assert ( LBER_VALID ( ber ) ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void e1000e_intrmgr_reset ( E1000ECore * core ) {
int i ;
core -> delayed_causes = 0 ;
e1000e_intrmgr_stop_delay_timers ( core ) ;
e1000e_intrmgr_stop_timer ( & core -> itr ) ;
for ( i = 0 ;
i < E1000E_MSIX_VEC_NUM ;
i ++ ) {
e1000e_intrmgr_stop_timer ( & core -> eitr [ i ] ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static struct cvec * eclass ( struct vars * v , celt c , int cases ) {
struct cvec * cv ;
if ( ( v -> cflags & REG_FAKE ) && c == 'x' ) {
cv = getcvec ( v , 4 , 0 ) ;
addchr ( cv , ( chr ) 'x' ) ;
addchr ( cv , ( chr ) 'y' ) ;
if ( cases ) {
addchr ( cv , ( chr ) 'X' ) ;
addchr ( cv , ( chr ) 'Y' ) ;
}
return cv ;
}
if ( cases ) return allcases ( v , c ) ;
cv = getcvec ( v , 1 , 0 ) ;
assert ( cv != NULL ) ;
addchr ( cv , ( chr ) c ) ;
return cv ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void do_result_format_version ( struct st_command * command ) {
long version ;
static DYNAMIC_STRING ds_version ;
const struct command_arg result_format_args [ ] = {
{
"version" , ARG_STRING , TRUE , & ds_version , "Version to use" }
}
;
DBUG_ENTER ( "do_result_format_version" ) ;
check_command_args ( command , command -> first_argument , result_format_args , sizeof ( result_format_args ) / sizeof ( struct command_arg ) , ',' ) ;
if ( ! str2int ( ds_version . str , 10 , ( long ) 0 , ( long ) INT_MAX , & version ) ) die ( "Invalid version number: '%s'" , ds_version . str ) ;
set_result_format_version ( version ) ;
dynstr_append ( & ds_res , "result_format: " ) ;
dynstr_append_mem ( & ds_res , ds_version . str , ds_version . length ) ;
dynstr_append ( & ds_res , "\n" ) ;
dynstr_free ( & ds_version ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void test_bug28386 ( ) {
int rc ;
MYSQL_STMT * stmt ;
MYSQL_RES * result ;
MYSQL_ROW row ;
MYSQL_BIND bind ;
const char hello [ ] = "hello world!" ;
DBUG_ENTER ( "test_bug28386" ) ;
myheader ( "test_bug28386" ) ;
rc = mysql_query ( mysql , "select @@global.log_output" ) ;
myquery ( rc ) ;
result = mysql_store_result ( mysql ) ;
DIE_UNLESS ( result ) ;
row = mysql_fetch_row ( result ) ;
if ( ! strstr ( row [ 0 ] , "TABLE" ) ) {
mysql_free_result ( result ) ;
if ( ! opt_silent ) printf ( "Skipping the test since logging to tables is not enabled\n" ) ;
return ;
}
mysql_free_result ( result ) ;
enable_query_logs ( 1 ) ;
stmt = mysql_simple_prepare ( mysql , "SELECT ?" ) ;
check_stmt ( stmt ) ;
memset ( & bind , 0 , sizeof ( bind ) ) ;
bind . buffer_type = MYSQL_TYPE_STRING ;
bind . buffer = ( void * ) hello ;
bind . buffer_length = sizeof ( hello ) ;
mysql_stmt_bind_param ( stmt , & bind ) ;
mysql_stmt_send_long_data ( stmt , 0 , hello , sizeof ( hello ) ) ;
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = my_process_stmt_result ( stmt ) ;
DIE_UNLESS ( rc == 1 ) ;
rc = mysql_stmt_reset ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = mysql_stmt_close ( stmt ) ;
DIE_UNLESS ( ! rc ) ;
rc = mysql_query ( mysql , "select * from mysql.general_log where " "command_type='Close stmt' or " "command_type='Reset stmt' or " "command_type='Long Data'" ) ;
myquery ( rc ) ;
result = mysql_store_result ( mysql ) ;
mytest ( result ) ;
DIE_UNLESS ( mysql_num_rows ( result ) == 3 ) ;
mysql_free_result ( result ) ;
restore_query_logs ( ) ;
DBUG_VOID_RETURN ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
cmsBool _cmsRegisterTagPlugin ( cmsContext id , cmsPluginBase * Data ) {
cmsPluginTag * Plugin = ( cmsPluginTag * ) Data ;
_cmsTagLinkedList * pt ;
_cmsTagPluginChunkType * TagPluginChunk = ( _cmsTagPluginChunkType * ) _cmsContextGetClientChunk ( id , TagPlugin ) ;
if ( Data == NULL ) {
TagPluginChunk -> Tag = NULL ;
return TRUE ;
}
pt = ( _cmsTagLinkedList * ) _cmsPluginMalloc ( id , sizeof ( _cmsTagLinkedList ) ) ;
if ( pt == NULL ) return FALSE ;
pt -> Signature = Plugin -> Signature ;
pt -> Descriptor = Plugin -> Descriptor ;
pt -> Next = TagPluginChunk -> Tag ;
TagPluginChunk -> Tag = pt ;
return TRUE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int rv30_decode_mb_info ( RV34DecContext * r ) {
static const int rv30_p_types [ 6 ] = {
RV34_MB_SKIP , RV34_MB_P_16x16 , RV34_MB_P_8x8 , - 1 , RV34_MB_TYPE_INTRA , RV34_MB_TYPE_INTRA16x16 }
;
static const int rv30_b_types [ 6 ] = {
RV34_MB_SKIP , RV34_MB_B_DIRECT , RV34_MB_B_FORWARD , RV34_MB_B_BACKWARD , RV34_MB_TYPE_INTRA , RV34_MB_TYPE_INTRA16x16 }
;
MpegEncContext * s = & r -> s ;
GetBitContext * gb = & s -> gb ;
unsigned code = svq3_get_ue_golomb ( gb ) ;
if ( code > 11 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "Incorrect MB type code\n" ) ;
return - 1 ;
}
if ( code > 5 ) {
av_log ( s -> avctx , AV_LOG_ERROR , "dquant needed\n" ) ;
code -= 6 ;
}
if ( s -> pict_type != AV_PICTURE_TYPE_B ) return rv30_p_types [ code ] ;
else return rv30_b_types [ code ] ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
my_bool acl_init ( bool dont_read_acl_tables ) {
THD * thd ;
my_bool return_val ;
DBUG_ENTER ( "acl_init" ) ;
acl_cache = new hash_filo ( ACL_CACHE_SIZE , 0 , 0 , ( hash_get_key ) acl_entry_get_key , ( hash_free_key ) free , & my_charset_utf8_bin ) ;
if ( dont_read_acl_tables ) {
DBUG_RETURN ( 0 ) ;
}
if ( ! ( thd = new THD ) ) DBUG_RETURN ( 1 ) ;
thd -> thread_stack = ( char * ) & thd ;
thd -> store_globals ( ) ;
lex_start ( thd ) ;
return_val = acl_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 guint16 de_sub_addr ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo , guint32 offset , guint len , gchar * * extracted_address ) {
guint32 curr_offset , ia5_string_len , i ;
guint8 type_of_sub_addr , afi , dig1 , dig2 , oct ;
gchar * ia5_string ;
gboolean invalid_ia5_char ;
proto_item * item ;
curr_offset = offset ;
* extracted_address = NULL ;
proto_tree_add_item ( tree , hf_gsm_a_extension , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_type_of_sub_addr , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_odd_even_ind , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_bits_item ( tree , hf_gsm_a_spare_bits , tvb , ( curr_offset << 3 ) + 5 , 3 , ENC_BIG_ENDIAN ) ;
type_of_sub_addr = ( tvb_get_guint8 ( tvb , curr_offset ) & 0x70 ) >> 4 ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( ! type_of_sub_addr ) {
afi = tvb_get_guint8 ( tvb , curr_offset ) ;
proto_tree_add_item ( tree , hf_gsm_a_dtap_afi , tvb , curr_offset , 1 , ENC_BIG_ENDIAN ) ;
curr_offset ++ ;
NO_MORE_DATA_CHECK ( len ) ;
if ( afi == 0x50 ) {
ia5_string_len = len - ( curr_offset - offset ) ;
ia5_string = ( guint8 * ) tvb_memdup ( wmem_packet_scope ( ) , tvb , curr_offset , ia5_string_len ) ;
* extracted_address = ( gchar * ) wmem_alloc ( wmem_packet_scope ( ) , ia5_string_len ) ;
invalid_ia5_char = FALSE ;
for ( i = 0 ;
i < ia5_string_len ;
i ++ ) {
dig1 = ( ia5_string [ i ] & 0xf0 ) >> 4 ;
dig2 = ia5_string [ i ] & 0x0f ;
oct = ( dig1 * 10 ) + dig2 + 32 ;
if ( oct > 127 ) invalid_ia5_char = TRUE ;
ia5_string [ i ] = oct ;
}
IA5_7BIT_decode ( * extracted_address , ia5_string , ia5_string_len ) ;
item = proto_tree_add_string ( tree , hf_gsm_a_dtap_subaddress , tvb , curr_offset , len - ( curr_offset - offset ) , * extracted_address ) ;
if ( invalid_ia5_char ) expert_add_info ( pinfo , item , & ei_gsm_a_dtap_invalid_ia5_character ) ;
return ( len ) ;
}
}
proto_tree_add_item ( tree , hf_gsm_a_dtap_subaddress_information , tvb , curr_offset , len - ( curr_offset - offset ) , ENC_NA ) ;
return ( len ) ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int com_connect ( String * buffer , char * line ) {
char * tmp , buff [ 256 ] ;
my_bool save_rehash = opt_rehash ;
int error ;
bzero ( buff , sizeof ( buff ) ) ;
if ( buffer ) {
tmp = strmake ( buff , line , sizeof ( buff ) - 2 ) ;
# ifdef EXTRA_DEBUG tmp [ 1 ] = 0 ;
# endif tmp = get_arg ( buff , GET ) ;
if ( tmp && * tmp ) {
my_free ( current_db ) ;
current_db = my_strdup ( tmp , MYF ( MY_WME ) ) ;
tmp = get_arg ( buff , GET_NEXT ) ;
if ( tmp ) {
my_free ( current_host ) ;
current_host = my_strdup ( tmp , MYF ( MY_WME ) ) ;
}
}
else {
opt_rehash = 0 ;
}
buffer -> length ( 0 ) ;
}
else opt_rehash = 0 ;
error = sql_connect ( current_host , current_db , current_user , opt_password , 0 ) ;
opt_rehash = save_rehash ;
if ( connected ) {
sprintf ( buff , "Connection id: %lu" , mysql_thread_id ( & mysql ) ) ;
put_info ( buff , INFO_INFO ) ;
sprintf ( buff , "Current database: %.128s\n" , current_db ? current_db : "*** NONE ***" ) ;
put_info ( buff , INFO_INFO ) ;
}
return error ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static inline int get_value ( BinkContext * c , int bundle ) {
int ret ;
if ( bundle < BINK_SRC_X_OFF || bundle == BINK_SRC_RUN ) return * c -> bundle [ bundle ] . cur_ptr ++ ;
if ( bundle == BINK_SRC_X_OFF || bundle == BINK_SRC_Y_OFF ) return ( int8_t ) * c -> bundle [ bundle ] . cur_ptr ++ ;
ret = * ( int16_t * ) c -> bundle [ bundle ] . cur_ptr ;
c -> bundle [ bundle ] . cur_ptr += 2 ;
return ret ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int jbig2_decode_generic_template0_TPGDON ( Jbig2Ctx * ctx , Jbig2Segment * segment , const Jbig2GenericRegionParams * params , Jbig2ArithState * as , Jbig2Image * image , Jbig2ArithCx * GB_stats ) {
const int GBW = image -> width ;
const int GBH = image -> height ;
uint32_t CONTEXT ;
int x , y ;
bool bit ;
int LTP = 0 ;
for ( y = 0 ;
y < GBH ;
y ++ ) {
bit = jbig2_arith_decode ( as , & GB_stats [ 0x9B25 ] ) ;
if ( bit < 0 ) return - 1 ;
LTP ^= bit ;
if ( ! LTP ) {
for ( x = 0 ;
x < GBW ;
x ++ ) {
CONTEXT = jbig2_image_get_pixel ( image , x - 1 , y ) ;
CONTEXT |= jbig2_image_get_pixel ( image , x - 2 , y ) << 1 ;
CONTEXT |= jbig2_image_get_pixel ( image , x - 3 , y ) << 2 ;
CONTEXT |= jbig2_image_get_pixel ( image , x - 4 , y ) << 3 ;
CONTEXT |= jbig2_image_get_pixel ( image , x + params -> gbat [ 0 ] , y + params -> gbat [ 1 ] ) << 4 ;
CONTEXT |= jbig2_image_get_pixel ( image , x + 2 , y - 1 ) << 5 ;
CONTEXT |= jbig2_image_get_pixel ( image , x + 1 , y - 1 ) << 6 ;
CONTEXT |= jbig2_image_get_pixel ( image , x , y - 1 ) << 7 ;
CONTEXT |= jbig2_image_get_pixel ( image , x - 1 , y - 1 ) << 8 ;
CONTEXT |= jbig2_image_get_pixel ( image , x - 2 , y - 1 ) << 9 ;
CONTEXT |= jbig2_image_get_pixel ( image , x + params -> gbat [ 2 ] , y + params -> gbat [ 3 ] ) << 10 ;
CONTEXT |= jbig2_image_get_pixel ( image , x + params -> gbat [ 4 ] , y + params -> gbat [ 5 ] ) << 11 ;
CONTEXT |= jbig2_image_get_pixel ( image , x + 1 , y - 2 ) << 12 ;
CONTEXT |= jbig2_image_get_pixel ( image , x , y - 2 ) << 13 ;
CONTEXT |= jbig2_image_get_pixel ( image , x - 1 , y - 2 ) << 14 ;
CONTEXT |= jbig2_image_get_pixel ( image , x + params -> gbat [ 6 ] , y + params -> gbat [ 7 ] ) << 15 ;
bit = jbig2_arith_decode ( as , & GB_stats [ CONTEXT ] ) ;
if ( bit < 0 ) return - 1 ;
jbig2_image_set_pixel ( image , x , y , bit ) ;
}
}
else {
copy_prev_row ( image , y ) ;
}
}
return 0 ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void dtap_cc_cc_est ( tvbuff_t * tvb , proto_tree * tree , packet_info * pinfo _U_ , guint32 offset , guint len ) {
guint32 curr_offset ;
guint32 consumed ;
guint curr_len ;
curr_offset = offset ;
curr_len = len ;
is_uplink = IS_UPLINK_FALSE ;
ELEM_MAND_LV ( GSM_A_PDU_TYPE_DTAP , DE_SETUP_CONTAINER , NULL ) ;
EXTRANEOUS_DATA_CHECK ( curr_len , 0 , pinfo , & ei_gsm_a_dtap_extraneous_data ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
xmlListPtr xmlListCreate ( xmlListDeallocator deallocator , xmlListDataCompare compare ) {
xmlListPtr l ;
if ( NULL == ( l = ( xmlListPtr ) xmlMalloc ( sizeof ( xmlList ) ) ) ) {
xmlGenericError ( xmlGenericErrorContext , "Cannot initialize memory for list" ) ;
return ( NULL ) ;
}
memset ( l , 0 , sizeof ( xmlList ) ) ;
if ( NULL == ( l -> sentinel = ( xmlLinkPtr ) xmlMalloc ( sizeof ( xmlLink ) ) ) ) {
xmlGenericError ( xmlGenericErrorContext , "Cannot initialize memory for sentinel" ) ;
xmlFree ( l ) ;
return ( NULL ) ;
}
l -> sentinel -> next = l -> sentinel ;
l -> sentinel -> prev = l -> sentinel ;
l -> sentinel -> data = NULL ;
if ( deallocator != NULL ) l -> linkDeallocator = deallocator ;
if ( compare != NULL ) l -> linkCompare = compare ;
else l -> linkCompare = xmlLinkCompare ;
return l ;
}
| 1True
|
Categorize the following code snippet as vulnerable or not. True or False
|
xmlAttrPtr xsltAttrListTemplateProcess ( xsltTransformContextPtr ctxt , xmlNodePtr target , xmlAttrPtr attrs ) {
xmlAttrPtr attr , copy , last ;
xmlNodePtr oldInsert , text ;
xmlNsPtr origNs = NULL , copyNs = NULL ;
const xmlChar * value ;
xmlChar * valueAVT ;
if ( ( ctxt == NULL ) || ( target == NULL ) || ( attrs == NULL ) || ( target -> type != XML_ELEMENT_NODE ) ) return ( NULL ) ;
oldInsert = ctxt -> insert ;
ctxt -> insert = target ;
if ( target -> properties ) {
last = target -> properties ;
while ( last -> next != NULL ) last = last -> next ;
}
else {
last = NULL ;
}
attr = attrs ;
do {
# ifdef XSLT_REFACTORED if ( attr -> psvi == xsltXSLTAttrMarker ) {
goto next_attribute ;
}
# else if ( ( attr -> ns != NULL ) && xmlStrEqual ( attr -> ns -> href , XSLT_NAMESPACE ) ) {
goto next_attribute ;
}
# endif if ( attr -> children != NULL ) {
if ( ( attr -> children -> type != XML_TEXT_NODE ) || ( attr -> children -> next != NULL ) ) {
xsltTransformError ( ctxt , NULL , attr -> parent , "Internal error: The children of an attribute node of a " "literal result element are not in the expected form.\n" ) ;
goto error ;
}
value = attr -> children -> content ;
if ( value == NULL ) value = xmlDictLookup ( ctxt -> dict , BAD_CAST "" , 0 ) ;
}
else value = xmlDictLookup ( ctxt -> dict , BAD_CAST "" , 0 ) ;
copy = xmlNewDocProp ( target -> doc , attr -> name , NULL ) ;
if ( copy == NULL ) {
if ( attr -> ns ) {
xsltTransformError ( ctxt , NULL , attr -> parent , "Internal error: Failed to create attribute '{
%s}
%s'.\n" , attr -> ns -> href , attr -> name ) ;
}
else {
xsltTransformError ( ctxt , NULL , attr -> parent , "Internal error: Failed to create attribute '%s'.\n" , attr -> name ) ;
}
goto error ;
}
copy -> parent = target ;
if ( last == NULL ) {
target -> properties = copy ;
last = copy ;
}
else {
last -> next = copy ;
copy -> prev = last ;
last = copy ;
}
if ( attr -> ns != origNs ) {
origNs = attr -> ns ;
if ( attr -> ns != NULL ) {
# ifdef XSLT_REFACTORED copyNs = xsltGetSpecialNamespace ( ctxt , attr -> parent , attr -> ns -> href , attr -> ns -> prefix , target ) ;
# else copyNs = xsltGetNamespace ( ctxt , attr -> parent , attr -> ns , target ) ;
# endif if ( copyNs == NULL ) goto error ;
}
else copyNs = NULL ;
}
copy -> ns = copyNs ;
text = xmlNewText ( NULL ) ;
if ( text != NULL ) {
copy -> last = copy -> children = text ;
text -> parent = ( xmlNodePtr ) copy ;
text -> doc = copy -> doc ;
if ( attr -> psvi != NULL ) {
valueAVT = xsltEvalAVT ( ctxt , attr -> psvi , attr -> parent ) ;
if ( valueAVT == NULL ) {
if ( attr -> ns ) {
xsltTransformError ( ctxt , NULL , attr -> parent , "Internal error: Failed to evaluate the AVT " "of attribute '{
%s}
%s'.\n" , attr -> ns -> href , attr -> name ) ;
}
else {
xsltTransformError ( ctxt , NULL , attr -> parent , "Internal error: Failed to evaluate the AVT " "of attribute '%s'.\n" , attr -> name ) ;
}
text -> content = xmlStrdup ( BAD_CAST "" ) ;
goto error ;
}
else {
text -> content = valueAVT ;
}
}
else if ( ( ctxt -> internalized ) && ( target -> doc != NULL ) && ( target -> doc -> dict == ctxt -> dict ) && xmlDictOwns ( ctxt -> dict , value ) ) {
text -> content = ( xmlChar * ) value ;
}
else {
text -> content = xmlStrdup ( value ) ;
}
if ( ( copy != NULL ) && ( text != NULL ) && ( xmlIsID ( copy -> doc , copy -> parent , copy ) ) ) xmlAddID ( NULL , copy -> doc , text -> content , copy ) ;
}
next_attribute : attr = attr -> next ;
}
while ( attr != NULL ) ;
attr = attrs ;
do {
# ifdef XSLT_REFACTORED if ( ( attr -> psvi == xsltXSLTAttrMarker ) && xmlStrEqual ( attr -> name , ( const xmlChar * ) "use-attribute-sets" ) ) {
xsltApplyAttributeSet ( ctxt , ctxt -> node , ( xmlNodePtr ) attr , NULL ) ;
}
# else if ( ( attr -> ns != NULL ) && xmlStrEqual ( attr -> name , ( const xmlChar * ) "use-attribute-sets" ) && xmlStrEqual ( attr -> ns -> href , XSLT_NAMESPACE ) ) {
xsltApplyAttributeSet ( ctxt , ctxt -> node , ( xmlNodePtr ) attr , NULL ) ;
}
# endif attr = attr -> next ;
}
while ( attr != NULL ) ;
ctxt -> insert = oldInsert ;
return ( target -> properties ) ;
error : ctxt -> insert = oldInsert ;
return ( NULL ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void y4m_convert_42xpaldv_42xjpeg ( y4m_input * _y4m , unsigned char * _dst , unsigned char * _aux ) {
unsigned char * tmp ;
int c_w ;
int c_h ;
int c_sz ;
int pli ;
int y ;
int x ;
_dst += _y4m -> pic_w * _y4m -> pic_h ;
c_w = ( _y4m -> pic_w + 1 ) / 2 ;
c_h = ( _y4m -> pic_h + _y4m -> dst_c_dec_h - 1 ) / _y4m -> dst_c_dec_h ;
c_sz = c_w * c_h ;
tmp = _aux + 2 * c_sz ;
for ( pli = 1 ;
pli < 3 ;
pli ++ ) {
y4m_42xmpeg2_42xjpeg_helper ( tmp , _aux , c_w , c_h ) ;
_aux += c_sz ;
switch ( pli ) {
case 1 : {
for ( x = 0 ;
x < c_w ;
x ++ ) {
for ( y = 0 ;
y < OC_MINI ( c_h , 3 ) ;
y ++ ) {
_dst [ y * c_w ] = ( unsigned char ) OC_CLAMPI ( 0 , ( tmp [ 0 ] - 9 * tmp [ OC_MAXI ( y - 2 , 0 ) * c_w ] + 35 * tmp [ OC_MAXI ( y - 1 , 0 ) * c_w ] + 114 * tmp [ y * c_w ] - 17 * tmp [ OC_MINI ( y + 1 , c_h - 1 ) * c_w ] + 4 * tmp [ OC_MINI ( y + 2 , c_h - 1 ) * c_w ] + 64 ) >> 7 , 255 ) ;
}
for ( ;
y < c_h - 2 ;
y ++ ) {
_dst [ y * c_w ] = ( unsigned char ) OC_CLAMPI ( 0 , ( tmp [ ( y - 3 ) * c_w ] - 9 * tmp [ ( y - 2 ) * c_w ] + 35 * tmp [ ( y - 1 ) * c_w ] + 114 * tmp [ y * c_w ] - 17 * tmp [ ( y + 1 ) * c_w ] + 4 * tmp [ ( y + 2 ) * c_w ] + 64 ) >> 7 , 255 ) ;
}
for ( ;
y < c_h ;
y ++ ) {
_dst [ y * c_w ] = ( unsigned char ) OC_CLAMPI ( 0 , ( tmp [ ( y - 3 ) * c_w ] - 9 * tmp [ ( y - 2 ) * c_w ] + 35 * tmp [ ( y - 1 ) * c_w ] + 114 * tmp [ y * c_w ] - 17 * tmp [ OC_MINI ( y + 1 , c_h - 1 ) * c_w ] + 4 * tmp [ ( c_h - 1 ) * c_w ] + 64 ) >> 7 , 255 ) ;
}
_dst ++ ;
tmp ++ ;
}
_dst += c_sz - c_w ;
tmp -= c_w ;
}
break ;
case 2 : {
for ( x = 0 ;
x < c_w ;
x ++ ) {
for ( y = 0 ;
y < OC_MINI ( c_h , 2 ) ;
y ++ ) {
_dst [ y * c_w ] = ( unsigned char ) OC_CLAMPI ( 0 , ( 4 * tmp [ 0 ] - 17 * tmp [ OC_MAXI ( y - 1 , 0 ) * c_w ] + 114 * tmp [ y * c_w ] + 35 * tmp [ OC_MINI ( y + 1 , c_h - 1 ) * c_w ] - 9 * tmp [ OC_MINI ( y + 2 , c_h - 1 ) * c_w ] + tmp [ OC_MINI ( y + 3 , c_h - 1 ) * c_w ] + 64 ) >> 7 , 255 ) ;
}
for ( ;
y < c_h - 3 ;
y ++ ) {
_dst [ y * c_w ] = ( unsigned char ) OC_CLAMPI ( 0 , ( 4 * tmp [ ( y - 2 ) * c_w ] - 17 * tmp [ ( y - 1 ) * c_w ] + 114 * tmp [ y * c_w ] + 35 * tmp [ ( y + 1 ) * c_w ] - 9 * tmp [ ( y + 2 ) * c_w ] + tmp [ ( y + 3 ) * c_w ] + 64 ) >> 7 , 255 ) ;
}
for ( ;
y < c_h ;
y ++ ) {
_dst [ y * c_w ] = ( unsigned char ) OC_CLAMPI ( 0 , ( 4 * tmp [ ( y - 2 ) * c_w ] - 17 * tmp [ ( y - 1 ) * c_w ] + 114 * tmp [ y * c_w ] + 35 * tmp [ OC_MINI ( y + 1 , c_h - 1 ) * c_w ] - 9 * tmp [ OC_MINI ( y + 2 , c_h - 1 ) * c_w ] + tmp [ ( c_h - 1 ) * c_w ] + 64 ) >> 7 , 255 ) ;
}
_dst ++ ;
tmp ++ ;
}
}
break ;
}
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static char * extract_string_until ( const char * original , const char * until_substring ) {
char * result ;
g_assert ( ( int ) strlen ( original ) >= until_substring - original ) ;
g_assert ( until_substring - original >= 0 ) ;
result = g_malloc ( until_substring - original + 1 ) ;
strncpy ( result , original , until_substring - original ) ;
result [ until_substring - original ] = '\0' ;
return result ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static int get_search_range ( const VP9_COMMON * cm ) {
int sr = 0 ;
const int dim = MIN ( cm -> width , cm -> height ) ;
while ( ( dim << sr ) < MAX_FULL_PEL_VAL ) ++ sr ;
return sr ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
IN_PROC_BROWSER_TEST_F ( ExtensionMessageBubbleViewBrowserTest , TestDevModeBubbleIsntShownTwice ) {
TestDevModeBubbleIsntShownTwice ( ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void write_mv_update ( const vp9_tree_index * tree , vp9_prob probs [ ] , const unsigned int counts [ ] , int n , vp9_writer * w ) {
int i ;
unsigned int branch_ct [ 32 ] [ 2 ] ;
assert ( n <= 32 ) ;
vp9_tree_probs_from_distribution ( tree , branch_ct , counts ) ;
for ( i = 0 ;
i < n - 1 ;
++ i ) update_mv ( w , branch_ct [ i ] , & probs [ i ] , MV_UPDATE_PROB ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
TEST_F ( ScoredHistoryMatchTest , Inlining ) {
base : : Time now = base : : Time : : NowFromSystemTime ( ) ;
RowWordStarts word_starts ;
WordStarts one_word_no_offset ( 1 , 0u ) ;
VisitInfoVector visits ;
{
history : : URLRow row ( MakeURLRow ( "http://www.google.com" , "abcdef" , 3 , 30 , 1 ) ) ;
PopulateWordStarts ( row , & word_starts ) ;
ScoredHistoryMatch scored_a ( row , visits , ASCIIToUTF16 ( "g" ) , Make1Term ( "g" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_a . match_in_scheme ) ;
ScoredHistoryMatch scored_b ( row , visits , ASCIIToUTF16 ( "w" ) , Make1Term ( "w" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_b . match_in_scheme ) ;
ScoredHistoryMatch scored_c ( row , visits , ASCIIToUTF16 ( "h" ) , Make1Term ( "h" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_TRUE ( scored_c . match_in_scheme ) ;
ScoredHistoryMatch scored_d ( row , visits , ASCIIToUTF16 ( "o" ) , Make1Term ( "o" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_d . match_in_scheme ) ;
}
{
history : : URLRow row ( MakeURLRow ( "http://teams.foo.com" , "abcdef" , 3 , 30 , 1 ) ) ;
PopulateWordStarts ( row , & word_starts ) ;
ScoredHistoryMatch scored_a ( row , visits , ASCIIToUTF16 ( "t" ) , Make1Term ( "t" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_a . match_in_scheme ) ;
ScoredHistoryMatch scored_b ( row , visits , ASCIIToUTF16 ( "f" ) , Make1Term ( "f" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_b . match_in_scheme ) ;
ScoredHistoryMatch scored_c ( row , visits , ASCIIToUTF16 ( "o" ) , Make1Term ( "o" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_c . match_in_scheme ) ;
}
{
history : : URLRow row ( MakeURLRow ( "https://www.testing.com" , "abcdef" , 3 , 30 , 1 ) ) ;
PopulateWordStarts ( row , & word_starts ) ;
ScoredHistoryMatch scored_a ( row , visits , ASCIIToUTF16 ( "t" ) , Make1Term ( "t" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_a . match_in_scheme ) ;
ScoredHistoryMatch scored_b ( row , visits , ASCIIToUTF16 ( "h" ) , Make1Term ( "h" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_TRUE ( scored_b . match_in_scheme ) ;
ScoredHistoryMatch scored_c ( row , visits , ASCIIToUTF16 ( "w" ) , Make1Term ( "w" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_c . match_in_scheme ) ;
}
{
history : : URLRow row ( MakeURLRow ( "http://www.xn--1lq90ic7f1rc.cn/xnblah" , "abcd" , 3 , 30 , 1 ) ) ;
PopulateWordStarts ( row , & word_starts ) ;
ScoredHistoryMatch scored_a ( row , visits , ASCIIToUTF16 ( "x" ) , Make1Term ( "x" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_a . match_in_scheme ) ;
ScoredHistoryMatch scored_b ( row , visits , ASCIIToUTF16 ( "xn" ) , Make1Term ( "xn" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_b . match_in_scheme ) ;
ScoredHistoryMatch scored_c ( row , visits , ASCIIToUTF16 ( "w" ) , Make1Term ( "w" ) , one_word_no_offset , word_starts , false , nullptr , now ) ;
EXPECT_FALSE ( scored_c . match_in_scheme ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static ossl_inline void sk_ ## t1 ## _zero ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_zero ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete ( STACK_OF ( t1 ) * sk , int i ) {
return ( t2 * ) OPENSSL_sk_delete ( ( OPENSSL_STACK * ) sk , i ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _delete_ptr ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_delete_ptr ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _push ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_push ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _unshift ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_unshift ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _pop ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_pop ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _shift ( STACK_OF ( t1 ) * sk ) {
return ( t2 * ) OPENSSL_sk_shift ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline void sk_ ## t1 ## _pop_free ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _freefunc freefunc ) {
OPENSSL_sk_pop_free ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline int sk_ ## t1 ## _insert ( STACK_OF ( t1 ) * sk , t2 * ptr , int idx ) {
return OPENSSL_sk_insert ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr , idx ) ;
}
static ossl_inline t2 * sk_ ## t1 ## _set ( STACK_OF ( t1 ) * sk , int idx , t2 * ptr ) {
return ( t2 * ) OPENSSL_sk_set ( ( OPENSSL_STACK * ) sk , idx , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline int sk_ ## t1 ## _find_ex ( STACK_OF ( t1 ) * sk , t2 * ptr ) {
return OPENSSL_sk_find_ex ( ( OPENSSL_STACK * ) sk , ( const void * ) ptr ) ;
}
static ossl_inline void sk_ ## t1 ## _sort ( STACK_OF ( t1 ) * sk ) {
OPENSSL_sk_sort ( ( OPENSSL_STACK * ) sk ) ;
}
static ossl_inline int sk_ ## t1 ## _is_sorted ( const STACK_OF ( t1 ) * sk ) {
return OPENSSL_sk_is_sorted ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _dup ( const STACK_OF ( t1 ) * sk ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_dup ( ( const OPENSSL_STACK * ) sk ) ;
}
static ossl_inline STACK_OF ( t1 ) * sk_ ## t1 ## _deep_copy ( const STACK_OF ( t1 ) * sk , sk_ ## t1 ## _copyfunc copyfunc , sk_ ## t1 ## _freefunc freefunc ) {
return ( STACK_OF ( t1 ) * ) OPENSSL_sk_deep_copy ( ( const OPENSSL_STACK * ) sk , ( OPENSSL_sk_copyfunc ) copyfunc , ( OPENSSL_sk_freefunc ) freefunc ) ;
}
static ossl_inline sk_ ## t1 ## _compfunc sk_ ## t1 ## _set_cmp_func ( STACK_OF ( t1 ) * sk , sk_ ## t1 ## _compfunc compare ) {
return ( sk_ ## t1 ## _compfunc ) OPENSSL_sk_set_cmp_func ( ( OPENSSL_STACK * ) sk , ( OPENSSL_sk_compfunc ) compare ) ;
}
# define DEFINE_SPECIAL_STACK_OF ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , t2 , t2 ) # define DEFINE_STACK_OF ( t ) SKM_DEFINE_STACK_OF ( t , t , t ) # define DEFINE_SPECIAL_STACK_OF_CONST ( t1 , t2 ) SKM_DEFINE_STACK_OF ( t1 , const t2 , t2 ) # define DEFINE_STACK_OF_CONST ( t ) SKM_DEFINE_STACK_OF ( t , const t , t ) typedef char * OPENSSL_STRING ;
typedef const char * OPENSSL_CSTRING ;
DEFINE_SPECIAL_STACK_OF ( OPENSSL_STRING , char ) DEFINE_SPECIAL_STACK_OF_CONST ( OPENSSL_CSTRING , char ) 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 UBool _isRegionSubtag ( const char * s , int32_t len ) {
if ( len < 0 ) {
len = ( int32_t ) uprv_strlen ( s ) ;
}
if ( len == 2 && _isAlphaString ( s , len ) ) {
return TRUE ;
}
if ( len == 3 && _isNumericString ( s , len ) ) {
return TRUE ;
}
return FALSE ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
void ts_print ( netdissect_options * ndo , register const struct timeval * tvp ) {
register int s ;
struct tm * tm ;
time_t Time ;
char buf [ TS_BUF_SIZE ] ;
static struct timeval tv_ref ;
struct timeval tv_result ;
int negative_offset ;
int nano_prec ;
switch ( ndo -> ndo_tflag ) {
case 0 : s = ( tvp -> tv_sec + thiszone ) % 86400 ;
ND_PRINT ( ( ndo , "%s " , ts_format ( ndo , s , tvp -> tv_usec , buf ) ) ) ;
break ;
case 1 : break ;
case 2 : ND_PRINT ( ( ndo , "%s " , ts_unix_format ( ndo , tvp -> tv_sec , tvp -> tv_usec , buf ) ) ) ;
break ;
case 3 : case 5 : # ifdef HAVE_PCAP_SET_TSTAMP_PRECISION switch ( ndo -> ndo_tstamp_precision ) {
case PCAP_TSTAMP_PRECISION_MICRO : nano_prec = 0 ;
break ;
case PCAP_TSTAMP_PRECISION_NANO : nano_prec = 1 ;
break ;
default : nano_prec = 0 ;
break ;
}
# else nano_prec = 0 ;
# endif if ( ! ( netdissect_timevalisset ( & tv_ref ) ) ) tv_ref = * tvp ;
negative_offset = netdissect_timevalcmp ( tvp , & tv_ref , < ) ;
if ( negative_offset ) netdissect_timevalsub ( & tv_ref , tvp , & tv_result , nano_prec ) ;
else netdissect_timevalsub ( tvp , & tv_ref , & tv_result , nano_prec ) ;
ND_PRINT ( ( ndo , ( negative_offset ? "-" : " " ) ) ) ;
ND_PRINT ( ( ndo , "%s " , ts_format ( ndo , tv_result . tv_sec , tv_result . tv_usec , buf ) ) ) ;
if ( ndo -> ndo_tflag == 3 ) tv_ref = * tvp ;
break ;
case 4 : s = ( tvp -> tv_sec + thiszone ) % 86400 ;
Time = ( tvp -> tv_sec + thiszone ) - s ;
tm = gmtime ( & Time ) ;
if ( ! tm ) ND_PRINT ( ( ndo , "Date fail " ) ) ;
else ND_PRINT ( ( ndo , "%04d-%02d-%02d %s " , tm -> tm_year + 1900 , tm -> tm_mon + 1 , tm -> tm_mday , ts_format ( ndo , s , tvp -> tv_usec , buf ) ) ) ;
break ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void request_trans_id_set ( struct request * const req , const u16 trans_id ) {
req -> trans_id = trans_id ;
* ( ( u16 * ) req -> request ) = htons ( trans_id ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void release_request ( struct transfer_request * request ) {
struct transfer_request * entry = request_queue_head ;
if ( request == request_queue_head ) {
request_queue_head = request -> next ;
}
else {
while ( entry -> next != NULL && entry -> next != request ) entry = entry -> next ;
if ( entry -> next == request ) entry -> next = entry -> next -> next ;
}
free ( request -> url ) ;
free ( request ) ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
int main_loop ( int argc , const char * * argv_ ) {
vpx_codec_ctx_t decoder ;
char * fn = NULL ;
int i ;
uint8_t * buf = NULL ;
size_t bytes_in_buffer = 0 , buffer_size = 0 ;
FILE * infile ;
int frame_in = 0 , frame_out = 0 , flipuv = 0 , noblit = 0 ;
int do_md5 = 0 , progress = 0 ;
int stop_after = 0 , postproc = 0 , summary = 0 , quiet = 1 ;
int arg_skip = 0 ;
int ec_enabled = 0 ;
int keep_going = 0 ;
const VpxInterface * interface = NULL ;
const VpxInterface * fourcc_interface = NULL ;
uint64_t dx_time = 0 ;
struct arg arg ;
char * * argv , * * argi , * * argj ;
int single_file ;
int use_y4m = 1 ;
int opt_yv12 = 0 ;
int opt_i420 = 0 ;
vpx_codec_dec_cfg_t cfg = {
0 , 0 , 0 }
;
# if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH int output_bit_depth = 0 ;
# endif # if CONFIG_VP8_DECODER vp8_postproc_cfg_t vp8_pp_cfg = {
0 }
;
int vp8_dbg_color_ref_frame = 0 ;
int vp8_dbg_color_mb_modes = 0 ;
int vp8_dbg_color_b_modes = 0 ;
int vp8_dbg_display_mv = 0 ;
# endif int frames_corrupted = 0 ;
int dec_flags = 0 ;
int do_scale = 0 ;
vpx_image_t * scaled_img = NULL ;
# if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH vpx_image_t * img_shifted = NULL ;
# endif int frame_avail , got_data ;
int num_external_frame_buffers = 0 ;
struct ExternalFrameBufferList ext_fb_list = {
0 , NULL }
;
const char * outfile_pattern = NULL ;
char outfile_name [ PATH_MAX ] = {
0 }
;
FILE * outfile = NULL ;
MD5Context md5_ctx ;
unsigned char md5_digest [ 16 ] ;
struct VpxDecInputContext input = {
NULL , NULL }
;
struct VpxInputContext vpx_input_ctx ;
# if CONFIG_WEBM_IO struct WebmInputContext webm_ctx ;
memset ( & ( webm_ctx ) , 0 , sizeof ( webm_ctx ) ) ;
input . webm_ctx = & webm_ctx ;
# endif input . vpx_input_ctx = & vpx_input_ctx ;
exec_name = argv_ [ 0 ] ;
argv = argv_dup ( argc - 1 , argv_ + 1 ) ;
for ( argi = argj = argv ;
( * argj = * argi ) ;
argi += arg . argv_step ) {
memset ( & arg , 0 , sizeof ( arg ) ) ;
arg . argv_step = 1 ;
if ( arg_match ( & arg , & codecarg , argi ) ) {
interface = get_vpx_decoder_by_name ( arg . val ) ;
if ( ! interface ) die ( "Error: Unrecognized argument (%s) to --codec\n" , arg . val ) ;
}
else if ( arg_match ( & arg , & looparg , argi ) ) {
}
else if ( arg_match ( & arg , & outputfile , argi ) ) outfile_pattern = arg . val ;
else if ( arg_match ( & arg , & use_yv12 , argi ) ) {
use_y4m = 0 ;
flipuv = 1 ;
opt_yv12 = 1 ;
# if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH output_bit_depth = 8 ;
# endif }
else if ( arg_match ( & arg , & use_i420 , argi ) ) {
use_y4m = 0 ;
flipuv = 0 ;
opt_i420 = 1 ;
}
else if ( arg_match ( & arg , & rawvideo , argi ) ) {
use_y4m = 0 ;
}
else if ( arg_match ( & arg , & flipuvarg , argi ) ) flipuv = 1 ;
else if ( arg_match ( & arg , & noblitarg , argi ) ) noblit = 1 ;
else if ( arg_match ( & arg , & progressarg , argi ) ) progress = 1 ;
else if ( arg_match ( & arg , & limitarg , argi ) ) stop_after = arg_parse_uint ( & arg ) ;
else if ( arg_match ( & arg , & skiparg , argi ) ) arg_skip = arg_parse_uint ( & arg ) ;
else if ( arg_match ( & arg , & postprocarg , argi ) ) postproc = 1 ;
else if ( arg_match ( & arg , & md5arg , argi ) ) do_md5 = 1 ;
else if ( arg_match ( & arg , & summaryarg , argi ) ) summary = 1 ;
else if ( arg_match ( & arg , & threadsarg , argi ) ) cfg . threads = arg_parse_uint ( & arg ) ;
else if ( arg_match ( & arg , & verbosearg , argi ) ) quiet = 0 ;
else if ( arg_match ( & arg , & scalearg , argi ) ) do_scale = 1 ;
else if ( arg_match ( & arg , & fb_arg , argi ) ) num_external_frame_buffers = arg_parse_uint ( & arg ) ;
else if ( arg_match ( & arg , & continuearg , argi ) ) keep_going = 1 ;
# if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH else if ( arg_match ( & arg , & outbitdeptharg , argi ) ) {
output_bit_depth = arg_parse_uint ( & arg ) ;
}
# endif # if CONFIG_VP8_DECODER else if ( arg_match ( & arg , & addnoise_level , argi ) ) {
postproc = 1 ;
vp8_pp_cfg . post_proc_flag |= VP8_ADDNOISE ;
vp8_pp_cfg . noise_level = arg_parse_uint ( & arg ) ;
}
else if ( arg_match ( & arg , & demacroblock_level , argi ) ) {
postproc = 1 ;
vp8_pp_cfg . post_proc_flag |= VP8_DEMACROBLOCK ;
vp8_pp_cfg . deblocking_level = arg_parse_uint ( & arg ) ;
}
else if ( arg_match ( & arg , & deblock , argi ) ) {
postproc = 1 ;
vp8_pp_cfg . post_proc_flag |= VP8_DEBLOCK ;
}
else if ( arg_match ( & arg , & mfqe , argi ) ) {
postproc = 1 ;
vp8_pp_cfg . post_proc_flag |= VP8_MFQE ;
}
else if ( arg_match ( & arg , & pp_debug_info , argi ) ) {
unsigned int level = arg_parse_uint ( & arg ) ;
postproc = 1 ;
vp8_pp_cfg . post_proc_flag &= ~ 0x7 ;
if ( level ) vp8_pp_cfg . post_proc_flag |= level ;
}
else if ( arg_match ( & arg , & pp_disp_ref_frame , argi ) ) {
unsigned int flags = arg_parse_int ( & arg ) ;
if ( flags ) {
postproc = 1 ;
vp8_dbg_color_ref_frame = flags ;
}
}
else if ( arg_match ( & arg , & pp_disp_mb_modes , argi ) ) {
unsigned int flags = arg_parse_int ( & arg ) ;
if ( flags ) {
postproc = 1 ;
vp8_dbg_color_mb_modes = flags ;
}
}
else if ( arg_match ( & arg , & pp_disp_b_modes , argi ) ) {
unsigned int flags = arg_parse_int ( & arg ) ;
if ( flags ) {
postproc = 1 ;
vp8_dbg_color_b_modes = flags ;
}
}
else if ( arg_match ( & arg , & pp_disp_mvs , argi ) ) {
unsigned int flags = arg_parse_int ( & arg ) ;
if ( flags ) {
postproc = 1 ;
vp8_dbg_display_mv = flags ;
}
}
else if ( arg_match ( & arg , & error_concealment , argi ) ) {
ec_enabled = 1 ;
}
# endif else argj ++ ;
}
for ( argi = argv ;
* argi ;
argi ++ ) if ( argi [ 0 ] [ 0 ] == '-' && strlen ( argi [ 0 ] ) > 1 ) die ( "Error: Unrecognized option %s\n" , * argi ) ;
fn = argv [ 0 ] ;
if ( ! fn ) usage_exit ( ) ;
infile = strcmp ( fn , "-" ) ? fopen ( fn , "rb" ) : set_binary_mode ( stdin ) ;
if ( ! infile ) {
fprintf ( stderr , "Failed to open file '%s'" , strcmp ( fn , "-" ) ? fn : "stdin" ) ;
return EXIT_FAILURE ;
}
# if CONFIG_OS_SUPPORT if ( ! outfile_pattern && isatty ( fileno ( stdout ) ) && ! do_md5 && ! noblit ) {
fprintf ( stderr , "Not dumping raw video to your terminal. Use '-o -' to " "override.\n" ) ;
return EXIT_FAILURE ;
}
# endif input . vpx_input_ctx -> file = infile ;
if ( file_is_ivf ( input . vpx_input_ctx ) ) input . vpx_input_ctx -> file_type = FILE_TYPE_IVF ;
# if CONFIG_WEBM_IO else if ( file_is_webm ( input . webm_ctx , input . vpx_input_ctx ) ) input . vpx_input_ctx -> file_type = FILE_TYPE_WEBM ;
# endif else if ( file_is_raw ( input . vpx_input_ctx ) ) input . vpx_input_ctx -> file_type = FILE_TYPE_RAW ;
else {
fprintf ( stderr , "Unrecognized input file type.\n" ) ;
# if ! CONFIG_WEBM_IO fprintf ( stderr , "vpxdec was built without WebM container support.\n" ) ;
# endif return EXIT_FAILURE ;
}
outfile_pattern = outfile_pattern ? outfile_pattern : "-" ;
single_file = is_single_file ( outfile_pattern ) ;
if ( ! noblit && single_file ) {
generate_filename ( outfile_pattern , outfile_name , PATH_MAX , vpx_input_ctx . width , vpx_input_ctx . height , 0 ) ;
if ( do_md5 ) MD5Init ( & md5_ctx ) ;
else outfile = open_outfile ( outfile_name ) ;
}
if ( use_y4m && ! noblit ) {
if ( ! single_file ) {
fprintf ( stderr , "YUV4MPEG2 not supported with output patterns," " try --i420 or --yv12.\n" ) ;
return EXIT_FAILURE ;
}
# if CONFIG_WEBM_IO if ( vpx_input_ctx . file_type == FILE_TYPE_WEBM ) {
if ( webm_guess_framerate ( input . webm_ctx , input . vpx_input_ctx ) ) {
fprintf ( stderr , "Failed to guess framerate -- error parsing " "webm file?\n" ) ;
return EXIT_FAILURE ;
}
}
# endif }
fourcc_interface = get_vpx_decoder_by_fourcc ( vpx_input_ctx . fourcc ) ;
if ( interface && fourcc_interface && interface != fourcc_interface ) warn ( "Header indicates codec: %s\n" , fourcc_interface -> name ) ;
else interface = fourcc_interface ;
if ( ! interface ) interface = get_vpx_decoder_by_index ( 0 ) ;
dec_flags = ( postproc ? VPX_CODEC_USE_POSTPROC : 0 ) | ( ec_enabled ? VPX_CODEC_USE_ERROR_CONCEALMENT : 0 ) ;
if ( vpx_codec_dec_init ( & decoder , interface -> codec_interface ( ) , & cfg , dec_flags ) ) {
fprintf ( stderr , "Failed to initialize decoder: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
if ( ! quiet ) fprintf ( stderr , "%s\n" , decoder . name ) ;
# if CONFIG_VP8_DECODER if ( vp8_pp_cfg . post_proc_flag && vpx_codec_control ( & decoder , VP8_SET_POSTPROC , & vp8_pp_cfg ) ) {
fprintf ( stderr , "Failed to configure postproc: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
if ( vp8_dbg_color_ref_frame && vpx_codec_control ( & decoder , VP8_SET_DBG_COLOR_REF_FRAME , vp8_dbg_color_ref_frame ) ) {
fprintf ( stderr , "Failed to configure reference block visualizer: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
if ( vp8_dbg_color_mb_modes && vpx_codec_control ( & decoder , VP8_SET_DBG_COLOR_MB_MODES , vp8_dbg_color_mb_modes ) ) {
fprintf ( stderr , "Failed to configure macro block visualizer: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
if ( vp8_dbg_color_b_modes && vpx_codec_control ( & decoder , VP8_SET_DBG_COLOR_B_MODES , vp8_dbg_color_b_modes ) ) {
fprintf ( stderr , "Failed to configure block visualizer: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
if ( vp8_dbg_display_mv && vpx_codec_control ( & decoder , VP8_SET_DBG_DISPLAY_MV , vp8_dbg_display_mv ) ) {
fprintf ( stderr , "Failed to configure motion vector visualizer: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
# endif if ( arg_skip ) fprintf ( stderr , "Skipping first %d frames.\n" , arg_skip ) ;
while ( arg_skip ) {
if ( read_frame ( & input , & buf , & bytes_in_buffer , & buffer_size ) ) break ;
arg_skip -- ;
}
if ( num_external_frame_buffers > 0 ) {
ext_fb_list . num_external_frame_buffers = num_external_frame_buffers ;
ext_fb_list . ext_fb = ( struct ExternalFrameBuffer * ) calloc ( num_external_frame_buffers , sizeof ( * ext_fb_list . ext_fb ) ) ;
if ( vpx_codec_set_frame_buffer_functions ( & decoder , get_vp9_frame_buffer , release_vp9_frame_buffer , & ext_fb_list ) ) {
fprintf ( stderr , "Failed to configure external frame buffers: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
}
frame_avail = 1 ;
got_data = 0 ;
while ( frame_avail || got_data ) {
vpx_codec_iter_t iter = NULL ;
vpx_image_t * img ;
struct vpx_usec_timer timer ;
int corrupted ;
frame_avail = 0 ;
if ( ! stop_after || frame_in < stop_after ) {
if ( ! read_frame ( & input , & buf , & bytes_in_buffer , & buffer_size ) ) {
frame_avail = 1 ;
frame_in ++ ;
vpx_usec_timer_start ( & timer ) ;
if ( vpx_codec_decode ( & decoder , buf , ( unsigned int ) bytes_in_buffer , NULL , 0 ) ) {
const char * detail = vpx_codec_error_detail ( & decoder ) ;
warn ( "Failed to decode frame %d: %s" , frame_in , vpx_codec_error ( & decoder ) ) ;
if ( detail ) warn ( "Additional information: %s" , detail ) ;
if ( ! keep_going ) goto fail ;
}
vpx_usec_timer_mark ( & timer ) ;
dx_time += vpx_usec_timer_elapsed ( & timer ) ;
}
}
vpx_usec_timer_start ( & timer ) ;
got_data = 0 ;
if ( ( img = vpx_codec_get_frame ( & decoder , & iter ) ) ) {
++ frame_out ;
got_data = 1 ;
}
vpx_usec_timer_mark ( & timer ) ;
dx_time += ( unsigned int ) vpx_usec_timer_elapsed ( & timer ) ;
if ( vpx_codec_control ( & decoder , VP8D_GET_FRAME_CORRUPTED , & corrupted ) ) {
warn ( "Failed VP8_GET_FRAME_CORRUPTED: %s" , vpx_codec_error ( & decoder ) ) ;
goto fail ;
}
frames_corrupted += corrupted ;
if ( progress ) show_progress ( frame_in , frame_out , dx_time ) ;
if ( ! noblit && img ) {
const int PLANES_YUV [ ] = {
VPX_PLANE_Y , VPX_PLANE_U , VPX_PLANE_V }
;
const int PLANES_YVU [ ] = {
VPX_PLANE_Y , VPX_PLANE_V , VPX_PLANE_U }
;
const int * planes = flipuv ? PLANES_YVU : PLANES_YUV ;
if ( do_scale ) {
if ( frame_out == 1 ) {
int display_width = vpx_input_ctx . width ;
int display_height = vpx_input_ctx . height ;
if ( ! display_width || ! display_height ) {
int display_size [ 2 ] ;
if ( vpx_codec_control ( & decoder , VP9D_GET_DISPLAY_SIZE , display_size ) ) {
display_width = img -> d_w ;
display_height = img -> d_h ;
}
else {
display_width = display_size [ 0 ] ;
display_height = display_size [ 1 ] ;
}
}
scaled_img = vpx_img_alloc ( NULL , img -> fmt , display_width , display_height , 16 ) ;
scaled_img -> bit_depth = img -> bit_depth ;
}
if ( img -> d_w != scaled_img -> d_w || img -> d_h != scaled_img -> d_h ) {
# if CONFIG_LIBYUV vpx_image_scale ( img , scaled_img , kFilterBox ) ;
img = scaled_img ;
# else fprintf ( stderr , "Failed to scale output frame: %s.\n" "Scaling is disabled in this configuration. " "To enable scaling, configure with --enable-libyuv\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
# endif }
}
# if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH if ( ! output_bit_depth ) {
output_bit_depth = img -> bit_depth ;
}
if ( output_bit_depth != img -> bit_depth ) {
if ( ! img_shifted ) {
if ( output_bit_depth == 8 ) {
img_shifted = vpx_img_alloc ( NULL , img -> fmt - VPX_IMG_FMT_HIGHBITDEPTH , img -> d_w , img -> d_h , 16 ) ;
}
else {
img_shifted = vpx_img_alloc ( NULL , img -> fmt | VPX_IMG_FMT_HIGHBITDEPTH , img -> d_w , img -> d_h , 16 ) ;
}
img_shifted -> bit_depth = output_bit_depth ;
}
if ( output_bit_depth > img -> bit_depth ) {
img_upshift ( img_shifted , img , output_bit_depth - img -> bit_depth ) ;
}
else {
img_downshift ( img_shifted , img , img -> bit_depth - output_bit_depth ) ;
}
img = img_shifted ;
}
# endif if ( single_file ) {
if ( use_y4m ) {
char buf [ Y4M_BUFFER_SIZE ] = {
0 }
;
size_t len = 0 ;
if ( frame_out == 1 ) {
len = y4m_write_file_header ( buf , sizeof ( buf ) , vpx_input_ctx . width , vpx_input_ctx . height , & vpx_input_ctx . framerate , img -> fmt , img -> bit_depth ) ;
if ( do_md5 ) {
MD5Update ( & md5_ctx , ( md5byte * ) buf , ( unsigned int ) len ) ;
}
else {
fputs ( buf , outfile ) ;
}
}
len = y4m_write_frame_header ( buf , sizeof ( buf ) ) ;
if ( do_md5 ) {
MD5Update ( & md5_ctx , ( md5byte * ) buf , ( unsigned int ) len ) ;
}
else {
fputs ( buf , outfile ) ;
}
}
else {
if ( frame_out == 1 ) {
if ( opt_i420 ) {
if ( img -> fmt != VPX_IMG_FMT_I420 && img -> fmt != VPX_IMG_FMT_I42016 ) {
fprintf ( stderr , "Cannot produce i420 output for bit-stream.\n" ) ;
goto fail ;
}
}
if ( opt_yv12 ) {
if ( ( img -> fmt != VPX_IMG_FMT_I420 && img -> fmt != VPX_IMG_FMT_YV12 ) || img -> bit_depth != 8 ) {
fprintf ( stderr , "Cannot produce yv12 output for bit-stream.\n" ) ;
goto fail ;
}
}
}
}
if ( do_md5 ) {
update_image_md5 ( img , planes , & md5_ctx ) ;
}
else {
write_image_file ( img , planes , outfile ) ;
}
}
else {
generate_filename ( outfile_pattern , outfile_name , PATH_MAX , img -> d_w , img -> d_h , frame_in ) ;
if ( do_md5 ) {
MD5Init ( & md5_ctx ) ;
update_image_md5 ( img , planes , & md5_ctx ) ;
MD5Final ( md5_digest , & md5_ctx ) ;
print_md5 ( md5_digest , outfile_name ) ;
}
else {
outfile = open_outfile ( outfile_name ) ;
write_image_file ( img , planes , outfile ) ;
fclose ( outfile ) ;
}
}
}
if ( stop_after && frame_in >= stop_after ) break ;
}
if ( summary || progress ) {
show_progress ( frame_in , frame_out , dx_time ) ;
fprintf ( stderr , "\n" ) ;
}
if ( frames_corrupted ) fprintf ( stderr , "WARNING: %d frames corrupted.\n" , frames_corrupted ) ;
fail : if ( vpx_codec_destroy ( & decoder ) ) {
fprintf ( stderr , "Failed to destroy decoder: %s\n" , vpx_codec_error ( & decoder ) ) ;
return EXIT_FAILURE ;
}
if ( ! noblit && single_file ) {
if ( do_md5 ) {
MD5Final ( md5_digest , & md5_ctx ) ;
print_md5 ( md5_digest , outfile_name ) ;
}
else {
fclose ( outfile ) ;
}
}
# if CONFIG_WEBM_IO if ( input . vpx_input_ctx -> file_type == FILE_TYPE_WEBM ) webm_free ( input . webm_ctx ) ;
# endif if ( input . vpx_input_ctx -> file_type != FILE_TYPE_WEBM ) free ( buf ) ;
if ( scaled_img ) vpx_img_free ( scaled_img ) ;
# if CONFIG_VP9 && CONFIG_VP9_HIGHBITDEPTH if ( img_shifted ) vpx_img_free ( img_shifted ) ;
# endif for ( i = 0 ;
i < ext_fb_list . num_external_frame_buffers ;
++ i ) {
free ( ext_fb_list . ext_fb [ i ] . data ) ;
}
free ( ext_fb_list . ext_fb ) ;
fclose ( infile ) ;
free ( argv ) ;
return frames_corrupted ? EXIT_FAILURE : EXIT_SUCCESS ;
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void compress_task_thread_func ( GTask * task , gpointer source_object , gpointer task_data , GCancellable * cancellable ) {
CompressJob * compress_job = task_data ;
SourceInfo source_info ;
g_autoptr ( AutoarCompressor ) compressor = NULL ;
g_timer_start ( compress_job -> common . time ) ;
nautilus_progress_info_start ( compress_job -> common . progress ) ;
scan_sources ( compress_job -> source_files , & source_info , ( CommonJob * ) compress_job , OP_KIND_COMPRESS ) ;
compress_job -> total_files = source_info . num_files ;
compress_job -> total_size = source_info . num_bytes ;
compressor = autoar_compressor_new ( compress_job -> source_files , compress_job -> output_file , compress_job -> format , compress_job -> filter , FALSE ) ;
autoar_compressor_set_output_is_dest ( compressor , TRUE ) ;
autoar_compressor_set_notify_interval ( compressor , PROGRESS_NOTIFY_INTERVAL ) ;
g_signal_connect ( compressor , "progress" , G_CALLBACK ( compress_job_on_progress ) , compress_job ) ;
g_signal_connect ( compressor , "error" , G_CALLBACK ( compress_job_on_error ) , compress_job ) ;
g_signal_connect ( compressor , "completed" , G_CALLBACK ( compress_job_on_completed ) , compress_job ) ;
autoar_compressor_start ( compressor , compress_job -> common . cancellable ) ;
compress_job -> success = g_file_query_exists ( compress_job -> output_file , NULL ) ;
if ( compress_job -> common . undo_info != NULL && ! compress_job -> success ) {
g_clear_object ( & compress_job -> common . undo_info ) ;
}
}
| 0False
|
Categorize the following code snippet as vulnerable or not. True or False
|
static void timerblock_tick ( void * opaque ) {
TimerBlock * tb = ( TimerBlock * ) opaque ;
tb -> status = 1 ;
if ( tb -> control & 2 ) {
tb -> count = tb -> load ;
timerblock_reload ( tb , 0 ) ;
}
else {
tb -> count = 0 ;
}
timerblock_update_irq ( tb ) ;
}
| 0False
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.