project
stringclasses 791
values | commit_id
stringlengths 6
81
| CVE ID
stringlengths 13
16
| CWE ID
stringclasses 127
values | func
stringlengths 5
484k
| vul
int8 0
1
|
---|---|---|---|---|---|
Chrome | 6a60f01228557982e6508c5919cc21fcfddf110b | NOT_APPLICABLE | NOT_APPLICABLE | WebRunnerBrowserContext::GetBackgroundFetchDelegate() {
return nullptr;
}
| 0 |
tor | 02e05bd74dbec614397b696cfcda6525562a4675 | NOT_APPLICABLE | NOT_APPLICABLE | authdir_wants_to_reject_router(routerinfo_t *ri, const char **msg,
int complain, int *valid_out)
{
/* Okay. Now check whether the fingerprint is recognized. */
time_t now;
int severity = (complain && ri->contact_info) ? LOG_NOTICE : LOG_INFO;
uint32_t status = dirserv_router_get_status(ri, msg, severity);
tor_assert(msg);
if (status & FP_REJECT)
return -1; /* msg is already set. */
/* Is there too much clock skew? */
now = time(NULL);
if (ri->cache_info.published_on > now+ROUTER_ALLOW_SKEW) {
log_fn(severity, LD_DIRSERV, "Publication time for %s is too "
"far (%d minutes) in the future; possible clock skew. Not adding "
"(%s)",
router_describe(ri),
(int)((ri->cache_info.published_on-now)/60),
esc_router_info(ri));
*msg = "Rejected: Your clock is set too far in the future, or your "
"timezone is not correct.";
return -1;
}
if (ri->cache_info.published_on < now-ROUTER_MAX_AGE_TO_PUBLISH) {
log_fn(severity, LD_DIRSERV,
"Publication time for %s is too far "
"(%d minutes) in the past. Not adding (%s)",
router_describe(ri),
(int)((now-ri->cache_info.published_on)/60),
esc_router_info(ri));
*msg = "Rejected: Server is expired, or your clock is too far in the past,"
" or your timezone is not correct.";
return -1;
}
if (dirserv_router_has_valid_address(ri) < 0) {
log_fn(severity, LD_DIRSERV,
"Router %s has invalid address. Not adding (%s).",
router_describe(ri),
esc_router_info(ri));
*msg = "Rejected: Address is a private address.";
return -1;
}
*valid_out = ! (status & FP_INVALID);
return 0;
} | 0 |
Chrome | 248a92c21c20c14b5983680c50e1d8b73fc79a2f | NOT_APPLICABLE | NOT_APPLICABLE | bool RenderBlock::adjustLogicalLineTopAndLogicalHeightIfNeeded(ShapeInsideInfo* shapeInsideInfo, LayoutUnit absoluteLogicalTop, LineLayoutState& layoutState, InlineBidiResolver& resolver, FloatingObject* lastFloatFromPreviousLine, InlineIterator& end, WordMeasurements& wordMeasurements)
{
LayoutUnit adjustedLogicalLineTop = adjustLogicalLineTop(shapeInsideInfo, resolver.position(), end, wordMeasurements);
if (!adjustedLogicalLineTop)
return false;
LayoutUnit newLogicalHeight = adjustedLogicalLineTop - absoluteLogicalTop;
if (layoutState.flowThread()) {
layoutState.setAdjustedLogicalLineTop(adjustedLogicalLineTop);
newLogicalHeight = logicalHeight();
}
end = restartLayoutRunsAndFloatsInRange(logicalHeight(), newLogicalHeight, lastFloatFromPreviousLine, resolver, end);
return true;
}
| 0 |
vim | d6c67629ed05aae436164eec474832daf8ba7420 | NOT_APPLICABLE | NOT_APPLICABLE | jump_to_help_window(qf_info_T *qi, int newwin, int *opened_window)
{
win_T *wp;
int flags;
if (cmdmod.cmod_tab != 0 || newwin)
wp = NULL;
else
wp = qf_find_help_win();
if (wp != NULL && wp->w_buffer->b_nwindows > 0)
win_enter(wp, TRUE);
else
{
// Split off help window; put it at far top if no position
// specified, the current window is vertically split and narrow.
flags = WSP_HELP;
if (cmdmod.cmod_split == 0 && curwin->w_width != Columns
&& curwin->w_width < 80)
flags |= WSP_TOP;
// If the user asks to open a new window, then copy the location list.
// Otherwise, don't copy the location list.
if (IS_LL_STACK(qi) && !newwin)
flags |= WSP_NEWLOC;
if (win_split(0, flags) == FAIL)
return FAIL;
*opened_window = TRUE;
if (curwin->w_height < p_hh)
win_setheight((int)p_hh);
// When using location list, the new window should use the supplied
// location list. If the user asks to open a new window, then the new
// window will get a copy of the location list.
if (IS_LL_STACK(qi) && !newwin)
win_set_loclist(curwin, qi);
}
if (!p_im)
restart_edit = 0; // don't want insert mode in help file
return OK;
} | 0 |
mbedtls | 83c9f495ffe70c7dd280b41fdfd4881485a3bc28 | NOT_APPLICABLE | NOT_APPLICABLE | static void ssl_write_ecjpake_kkpp_ext( mbedtls_ssl_context *ssl,
unsigned char *buf,
size_t *olen )
{
int ret;
unsigned char *p = buf;
const unsigned char *end = ssl->out_msg + MBEDTLS_SSL_MAX_CONTENT_LEN;
size_t kkpp_len;
*olen = 0;
/* Skip costly computation if not needed */
if( ssl->transform_negotiate->ciphersuite_info->key_exchange !=
MBEDTLS_KEY_EXCHANGE_ECJPAKE )
return;
MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, ecjpake kkpp extension" ) );
if( end - p < 4 )
{
MBEDTLS_SSL_DEBUG_MSG( 1, ( "buffer too small" ) );
return;
}
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ECJPAKE_KKPP >> 8 ) & 0xFF );
*p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ECJPAKE_KKPP ) & 0xFF );
ret = mbedtls_ecjpake_write_round_one( &ssl->handshake->ecjpake_ctx,
p + 2, end - p - 2, &kkpp_len,
ssl->conf->f_rng, ssl->conf->p_rng );
if( ret != 0 )
{
MBEDTLS_SSL_DEBUG_RET( 1 , "mbedtls_ecjpake_write_round_one", ret );
return;
}
*p++ = (unsigned char)( ( kkpp_len >> 8 ) & 0xFF );
*p++ = (unsigned char)( ( kkpp_len ) & 0xFF );
*olen = kkpp_len + 4;
}
| 0 |
samba | 0998f2f1bced019db4000ef4b55887abcb65f6d2 | NOT_APPLICABLE | NOT_APPLICABLE | int ldb_kv_search_indexed(struct ldb_kv_context *ac, uint32_t *match_count)
{
struct ldb_context *ldb = ldb_module_get_ctx(ac->module);
struct ldb_kv_private *ldb_kv = talloc_get_type(
ldb_module_get_private(ac->module), struct ldb_kv_private);
struct dn_list *dn_list;
int ret;
enum ldb_scope index_scope;
enum key_truncation scope_one_truncation = KEY_NOT_TRUNCATED;
/* see if indexing is enabled */
if (!ldb_kv->cache->attribute_indexes &&
!ldb_kv->cache->one_level_indexes && ac->scope != LDB_SCOPE_BASE) {
/* fallback to a full search */
return LDB_ERR_OPERATIONS_ERROR;
}
dn_list = talloc_zero(ac, struct dn_list);
if (dn_list == NULL) {
return ldb_module_oom(ac->module);
}
/*
* For the purposes of selecting the switch arm below, if we
* don't have a one-level index then treat it like a subtree
* search
*/
if (ac->scope == LDB_SCOPE_ONELEVEL &&
!ldb_kv->cache->one_level_indexes) {
index_scope = LDB_SCOPE_SUBTREE;
} else {
index_scope = ac->scope;
}
switch (index_scope) {
case LDB_SCOPE_BASE:
/*
* The only caller will have filtered the operation out
* so we should never get here
*/
return ldb_operr(ldb);
case LDB_SCOPE_ONELEVEL:
/*
* If we ever start to also load the index values for
* the tree, we must ensure we strictly intersect with
* this list, as we trust the ONELEVEL index
*/
ret = ldb_kv_index_dn_one(ac->module,
ldb_kv,
ac->base,
dn_list,
&scope_one_truncation);
if (ret != LDB_SUCCESS) {
talloc_free(dn_list);
return ret;
}
/*
* If we have too many matches, running the filter
* tree over the SCOPE_ONELEVEL can be quite expensive
* so we now check the filter tree index as well.
*
* We only do this in the GUID index mode, which is
* O(n*log(m)) otherwise the intersection below will
* be too costly at O(n*m).
*
* We don't set a heuristic for 'too many' but instead
* do it always and rely on the index lookup being
* fast enough in the small case.
*/
if (ldb_kv->cache->GUID_index_attribute != NULL) {
struct dn_list *idx_one_tree_list
= talloc_zero(ac, struct dn_list);
if (idx_one_tree_list == NULL) {
return ldb_module_oom(ac->module);
}
if (!ldb_kv->cache->attribute_indexes) {
talloc_free(idx_one_tree_list);
talloc_free(dn_list);
return LDB_ERR_OPERATIONS_ERROR;
}
/*
* Here we load the index for the tree.
*
* We only care if this is successful, if the
* index can't trim the result list down then
* the ONELEVEL index is still good enough.
*/
ret = ldb_kv_index_dn(
ac->module, ldb_kv, ac->tree, idx_one_tree_list);
if (ret == LDB_SUCCESS) {
if (!list_intersect(ldb,
ldb_kv,
dn_list,
idx_one_tree_list)) {
talloc_free(idx_one_tree_list);
talloc_free(dn_list);
return LDB_ERR_OPERATIONS_ERROR;
}
}
}
break;
case LDB_SCOPE_SUBTREE:
case LDB_SCOPE_DEFAULT:
if (!ldb_kv->cache->attribute_indexes) {
talloc_free(dn_list);
return LDB_ERR_OPERATIONS_ERROR;
}
/*
* Here we load the index for the tree. We have no
* index for the subtree.
*/
ret = ldb_kv_index_dn(ac->module, ldb_kv, ac->tree, dn_list);
if (ret != LDB_SUCCESS) {
talloc_free(dn_list);
return ret;
}
break;
}
/*
* It is critical that this function do the re-filter even
* on things found by the index as the index can over-match
* in cases of truncation (as well as when it decides it is
* not worth further filtering)
*
* If this changes, then the index code above would need to
* pass up a flag to say if any index was truncated during
* processing as the truncation here refers only to the
* SCOPE_ONELEVEL index.
*/
ret = ldb_kv_index_filter(
ldb_kv, dn_list, ac, match_count, scope_one_truncation);
talloc_free(dn_list);
return ret;
} | 0 |
Chrome | b755ebba29dd405d6f1e4cf70f5bc81ffd33b0f6 | NOT_APPLICABLE | NOT_APPLICABLE | bool PrintWebViewHelper::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PrintWebViewHelper, message)
IPC_MESSAGE_HANDLER(PrintMsg_PrintPages, OnPrintPages)
IPC_MESSAGE_HANDLER(PrintMsg_PrintForSystemDialog, OnPrintForSystemDialog)
IPC_MESSAGE_HANDLER(PrintMsg_InitiatePrintPreview, OnInitiatePrintPreview)
IPC_MESSAGE_HANDLER(PrintMsg_PrintNodeUnderContextMenu,
OnPrintNodeUnderContextMenu)
IPC_MESSAGE_HANDLER(PrintMsg_PrintPreview, OnPrintPreview)
IPC_MESSAGE_HANDLER(PrintMsg_PrintForPrintPreview, OnPrintForPrintPreview)
IPC_MESSAGE_HANDLER(PrintMsg_PrintingDone, OnPrintingDone)
IPC_MESSAGE_HANDLER(PrintMsg_ResetScriptedPrintCount,
ResetScriptedPrintCount)
IPC_MESSAGE_HANDLER(PrintMsg_SetScriptedPrintingBlocked,
SetScriptedPrintBlocked)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
}
| 0 |
linux | 355627f518978b5167256d27492fe0b343aaf2f2 | NOT_APPLICABLE | NOT_APPLICABLE | static struct mm_struct *mm_init(struct mm_struct *mm, struct task_struct *p,
struct user_namespace *user_ns)
{
mm->mmap = NULL;
mm->mm_rb = RB_ROOT;
mm->vmacache_seqnum = 0;
atomic_set(&mm->mm_users, 1);
atomic_set(&mm->mm_count, 1);
init_rwsem(&mm->mmap_sem);
INIT_LIST_HEAD(&mm->mmlist);
mm->core_state = NULL;
atomic_long_set(&mm->nr_ptes, 0);
mm_nr_pmds_init(mm);
mm->map_count = 0;
mm->locked_vm = 0;
mm->pinned_vm = 0;
memset(&mm->rss_stat, 0, sizeof(mm->rss_stat));
spin_lock_init(&mm->page_table_lock);
mm_init_cpumask(mm);
mm_init_aio(mm);
mm_init_owner(mm, p);
RCU_INIT_POINTER(mm->exe_file, NULL);
mmu_notifier_mm_init(mm);
init_tlb_flush_pending(mm);
#if defined(CONFIG_TRANSPARENT_HUGEPAGE) && !USE_SPLIT_PMD_PTLOCKS
mm->pmd_huge_pte = NULL;
#endif
mm_init_uprobes_state(mm);
if (current->mm) {
mm->flags = current->mm->flags & MMF_INIT_MASK;
mm->def_flags = current->mm->def_flags & VM_INIT_DEF_MASK;
} else {
mm->flags = default_dump_filter;
mm->def_flags = 0;
}
if (mm_alloc_pgd(mm))
goto fail_nopgd;
if (init_new_context(p, mm))
goto fail_nocontext;
mm->user_ns = get_user_ns(user_ns);
return mm;
fail_nocontext:
mm_free_pgd(mm);
fail_nopgd:
free_mm(mm);
return NULL;
} | 0 |
curl | 9069838b30fb3b48af0123e39f664cea683254a5 | NOT_APPLICABLE | NOT_APPLICABLE | name_to_level(const char *name)
{
int i;
for(i = 0; i < (int)sizeof(level_names)/(int)sizeof(level_names[0]); i++)
if(checkprefix(name, level_names[i].name))
return level_names[i].level;
return PROT_NONE;
} | 0 |
php | e5246580a85f031e1a3b8064edbaa55c1643a451 | NOT_APPLICABLE | NOT_APPLICABLE | int phar_detect_phar_fname_ext(const char *filename, int filename_len, const char **ext_str, int *ext_len, int executable, int for_create, int is_complete TSRMLS_DC) /* {{{ */
{
const char *pos, *slash;
*ext_str = NULL;
*ext_len = 0;
if (!filename_len || filename_len == 1) {
return FAILURE;
}
phar_request_initialize(TSRMLS_C);
/* first check for alias in first segment */
pos = memchr(filename, '/', filename_len);
if (pos && pos != filename) {
/* check for url like http:// or phar:// */
if (*(pos - 1) == ':' && (pos - filename) < filename_len - 1 && *(pos + 1) == '/') {
*ext_len = -2;
*ext_str = NULL;
return FAILURE;
}
if (zend_hash_exists(&(PHAR_GLOBALS->phar_alias_map), (char *) filename, pos - filename)) {
*ext_str = pos;
*ext_len = -1;
return FAILURE;
}
if (PHAR_G(manifest_cached) && zend_hash_exists(&cached_alias, (char *) filename, pos - filename)) {
*ext_str = pos;
*ext_len = -1;
return FAILURE;
}
}
if (zend_hash_num_elements(&(PHAR_GLOBALS->phar_fname_map)) || PHAR_G(manifest_cached)) {
phar_archive_data **pphar;
if (is_complete) {
if (SUCCESS == zend_hash_find(&(PHAR_GLOBALS->phar_fname_map), (char *) filename, filename_len, (void **)&pphar)) {
*ext_str = filename + (filename_len - (*pphar)->ext_len);
woohoo:
*ext_len = (*pphar)->ext_len;
if (executable == 2) {
return SUCCESS;
}
if (executable == 1 && !(*pphar)->is_data) {
return SUCCESS;
}
if (!executable && (*pphar)->is_data) {
return SUCCESS;
}
return FAILURE;
}
if (PHAR_G(manifest_cached) && SUCCESS == zend_hash_find(&cached_phars, (char *) filename, filename_len, (void **)&pphar)) {
*ext_str = filename + (filename_len - (*pphar)->ext_len);
goto woohoo;
}
} else {
char *str_key;
uint keylen;
ulong unused;
for (zend_hash_internal_pointer_reset(&(PHAR_GLOBALS->phar_fname_map));
HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&(PHAR_GLOBALS->phar_fname_map), &str_key, &keylen, &unused, 0, NULL);
zend_hash_move_forward(&(PHAR_GLOBALS->phar_fname_map))
) {
if (keylen > (uint) filename_len) {
continue;
}
if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen
|| filename[keylen] == '/' || filename[keylen] == '\0')) {
if (FAILURE == zend_hash_get_current_data(&(PHAR_GLOBALS->phar_fname_map), (void **) &pphar)) {
break;
}
*ext_str = filename + (keylen - (*pphar)->ext_len);
goto woohoo;
}
}
if (PHAR_G(manifest_cached)) {
for (zend_hash_internal_pointer_reset(&cached_phars);
HASH_KEY_NON_EXISTENT != zend_hash_get_current_key_ex(&cached_phars, &str_key, &keylen, &unused, 0, NULL);
zend_hash_move_forward(&cached_phars)
) {
if (keylen > (uint) filename_len) {
continue;
}
if (!memcmp(filename, str_key, keylen) && ((uint)filename_len == keylen
|| filename[keylen] == '/' || filename[keylen] == '\0')) {
if (FAILURE == zend_hash_get_current_data(&cached_phars, (void **) &pphar)) {
break;
}
*ext_str = filename + (keylen - (*pphar)->ext_len);
goto woohoo;
}
}
}
}
}
pos = memchr(filename + 1, '.', filename_len);
next_extension:
if (!pos) {
return FAILURE;
}
while (pos != filename && (*(pos - 1) == '/' || *(pos - 1) == '\0')) {
pos = memchr(pos + 1, '.', filename_len - (pos - filename) + 1);
if (!pos) {
return FAILURE;
}
}
slash = memchr(pos, '/', filename_len - (pos - filename));
if (!slash) {
/* this is a url like "phar://blah.phar" with no directory */
*ext_str = pos;
*ext_len = strlen(pos);
/* file extension must contain "phar" */
switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create TSRMLS_CC)) {
case SUCCESS:
return SUCCESS;
case FAILURE:
/* we are at the end of the string, so we fail */
return FAILURE;
}
}
/* we've found an extension that ends at a directory separator */
*ext_str = pos;
*ext_len = slash - pos;
switch (phar_check_str(filename, *ext_str, *ext_len, executable, for_create TSRMLS_CC)) {
case SUCCESS:
return SUCCESS;
case FAILURE:
/* look for more extensions */
pos = strchr(pos + 1, '.');
if (pos) {
*ext_str = NULL;
*ext_len = 0;
}
goto next_extension;
}
return FAILURE;
}
/* }}} */
| 0 |
ImageMagick | 76f94fa2d9ae5d96e15929b6b6ce0c866fc44c69 | NOT_APPLICABLE | NOT_APPLICABLE | static inline MagickBooleanType IsPixelCacheAuthentic(
const CacheInfo *magick_restrict cache_info,
const NexusInfo *magick_restrict nexus_info)
{
MagickBooleanType
status;
MagickOffsetType
offset;
/*
Does nexus pixels point directly to in-core cache pixels or is it buffered?
*/
if (cache_info->type == PingCache)
return(MagickTrue);
offset=(MagickOffsetType) nexus_info->region.y*cache_info->columns+
nexus_info->region.x;
status=nexus_info->pixels == (cache_info->pixels+offset*
cache_info->number_channels) ? MagickTrue : MagickFalse;
return(status);
} | 0 |
ImageMagick | 8ca35831e91c3db8c6d281d09b605001003bec08 | NOT_APPLICABLE | NOT_APPLICABLE | static Image *ReadOneJNGImage(MngInfo *mng_info,
const ImageInfo *image_info, ExceptionInfo *exception)
{
Image
*alpha_image,
*color_image,
*image,
*jng_image;
ImageInfo
*alpha_image_info,
*color_image_info;
MagickBooleanType
logging;
ssize_t
y;
MagickBooleanType
status;
png_uint_32
jng_height,
jng_width;
png_byte
jng_color_type,
jng_image_sample_depth,
jng_image_compression_method,
jng_image_interlace_method,
jng_alpha_sample_depth,
jng_alpha_compression_method,
jng_alpha_filter_method,
jng_alpha_interlace_method;
register const Quantum
*s;
register ssize_t
i,
x;
register Quantum
*q;
register unsigned char
*p;
unsigned int
read_JSEP,
reading_idat;
size_t
length;
jng_alpha_compression_method=0;
jng_alpha_sample_depth=8;
jng_color_type=0;
jng_height=0;
jng_width=0;
alpha_image=(Image *) NULL;
color_image=(Image *) NULL;
alpha_image_info=(ImageInfo *) NULL;
color_image_info=(ImageInfo *) NULL;
logging=LogMagickEvent(CoderEvent,GetMagickModule(),
" Enter ReadOneJNGImage()");
image=mng_info->image;
if (GetAuthenticPixelQueue(image) != (Quantum *) NULL)
{
/*
Allocate next image structure.
*/
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" AcquireNextImage()");
AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
return(DestroyImageList(image));
image=SyncNextImageInList(image);
}
mng_info->image=image;
/*
Signature bytes have already been read.
*/
read_JSEP=MagickFalse;
reading_idat=MagickFalse;
for (;;)
{
char
type[MagickPathExtent];
unsigned char
*chunk;
unsigned int
count;
/*
Read a new JNG chunk.
*/
status=SetImageProgress(image,LoadImagesTag,TellBlob(image),
2*GetBlobSize(image));
if (status == MagickFalse)
break;
type[0]='\0';
(void) ConcatenateMagickString(type,"errr",MagickPathExtent);
length=ReadBlobMSBLong(image);
count=(unsigned int) ReadBlob(image,4,(unsigned char *) type);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading JNG chunk type %c%c%c%c, length: %.20g",
type[0],type[1],type[2],type[3],(double) length);
if (length > PNG_UINT_31_MAX || count == 0)
ThrowReaderException(CorruptImageError,"CorruptImage");
p=NULL;
chunk=(unsigned char *) NULL;
if (length != 0)
{
chunk=(unsigned char *) AcquireQuantumMemory(length,sizeof(*chunk));
if (chunk == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
for (i=0; i < (ssize_t) length; i++)
chunk[i]=(unsigned char) ReadBlobByte(image);
p=chunk;
}
(void) ReadBlobMSBLong(image); /* read crc word */
if (memcmp(type,mng_JHDR,4) == 0)
{
if (length == 16)
{
jng_width=(size_t) ((p[0] << 24) | (p[1] << 16) |
(p[2] << 8) | p[3]);
jng_height=(size_t) ((p[4] << 24) | (p[5] << 16) |
(p[6] << 8) | p[7]);
if ((jng_width == 0) || (jng_height == 0))
ThrowReaderException(CorruptImageError,
"NegativeOrZeroImageSize");
jng_color_type=p[8];
jng_image_sample_depth=p[9];
jng_image_compression_method=p[10];
jng_image_interlace_method=p[11];
image->interlace=jng_image_interlace_method != 0 ? PNGInterlace :
NoInterlace;
jng_alpha_sample_depth=p[12];
jng_alpha_compression_method=p[13];
jng_alpha_filter_method=p[14];
jng_alpha_interlace_method=p[15];
if (logging != MagickFalse)
{
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_width: %16lu, jng_height: %16lu\n"
" jng_color_type: %16d, jng_image_sample_depth: %3d\n"
" jng_image_compression_method:%3d",
(unsigned long) jng_width, (unsigned long) jng_height,
jng_color_type, jng_image_sample_depth,
jng_image_compression_method);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_image_interlace_method: %3d"
" jng_alpha_sample_depth: %3d",
jng_image_interlace_method,
jng_alpha_sample_depth);
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" jng_alpha_compression_method:%3d\n"
" jng_alpha_filter_method: %3d\n"
" jng_alpha_interlace_method: %3d",
jng_alpha_compression_method,
jng_alpha_filter_method,
jng_alpha_interlace_method);
}
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if ((reading_idat == MagickFalse) && (read_JSEP == MagickFalse) &&
((memcmp(type,mng_JDAT,4) == 0) || (memcmp(type,mng_JdAA,4) == 0) ||
(memcmp(type,mng_IDAT,4) == 0) || (memcmp(type,mng_JDAA,4) == 0)))
{
/*
o create color_image
o open color_blob, attached to color_image
o if (color type has alpha)
open alpha_blob, attached to alpha_image
*/
color_image_info=(ImageInfo *)AcquireMagickMemory(sizeof(ImageInfo));
if (color_image_info == (ImageInfo *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
GetImageInfo(color_image_info);
color_image=AcquireImage(color_image_info,exception);
if (color_image == (Image *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating color_blob.");
(void) AcquireUniqueFilename(color_image->filename);
status=OpenBlob(color_image_info,color_image,WriteBinaryBlobMode,
exception);
if (status == MagickFalse)
{
color_image=DestroyImage(color_image);
return(DestroyImageList(image));
}
if ((image_info->ping == MagickFalse) && (jng_color_type >= 12))
{
alpha_image_info=(ImageInfo *)
AcquireMagickMemory(sizeof(ImageInfo));
if (alpha_image_info == (ImageInfo *) NULL)
{
color_image=DestroyImage(color_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
GetImageInfo(alpha_image_info);
alpha_image=AcquireImage(alpha_image_info,exception);
if (alpha_image == (Image *) NULL)
{
alpha_image_info=DestroyImageInfo(alpha_image_info);
color_image=DestroyImage(color_image);
ThrowReaderException(ResourceLimitError,
"MemoryAllocationFailed");
}
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Creating alpha_blob.");
(void) AcquireUniqueFilename(alpha_image->filename);
status=OpenBlob(alpha_image_info,alpha_image,WriteBinaryBlobMode,
exception);
if (status == MagickFalse)
{
alpha_image=DestroyImage(alpha_image);
alpha_image_info=DestroyImageInfo(alpha_image_info);
color_image=DestroyImage(color_image);
return(DestroyImageList(image));
}
if (jng_alpha_compression_method == 0)
{
unsigned char
data[18];
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Writing IHDR chunk to alpha_blob.");
(void) WriteBlob(alpha_image,8,(const unsigned char *)
"\211PNG\r\n\032\n");
(void) WriteBlobMSBULong(alpha_image,13L);
PNGType(data,mng_IHDR);
LogPNGChunk(logging,mng_IHDR,13L);
PNGLong(data+4,jng_width);
PNGLong(data+8,jng_height);
data[12]=jng_alpha_sample_depth;
data[13]=0; /* color_type gray */
data[14]=0; /* compression method 0 */
data[15]=0; /* filter_method 0 */
data[16]=0; /* interlace_method 0 */
(void) WriteBlob(alpha_image,17,data);
(void) WriteBlobMSBULong(alpha_image,crc32(0,data,17));
}
}
reading_idat=MagickTrue;
}
if (memcmp(type,mng_JDAT,4) == 0)
{
/* Copy chunk to color_image->blob */
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying JDAT chunk data to color_blob.");
if (length != 0)
{
(void) WriteBlob(color_image,length,chunk);
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
}
continue;
}
if (memcmp(type,mng_IDAT,4) == 0)
{
png_byte
data[5];
/* Copy IDAT header and chunk data to alpha_image->blob */
if (alpha_image != NULL && image_info->ping == MagickFalse)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying IDAT chunk data to alpha_blob.");
(void) WriteBlobMSBULong(alpha_image,(size_t) length);
PNGType(data,mng_IDAT);
LogPNGChunk(logging,mng_IDAT,length);
(void) WriteBlob(alpha_image,4,data);
(void) WriteBlob(alpha_image,length,chunk);
(void) WriteBlobMSBULong(alpha_image,
crc32(crc32(0,data,4),chunk,(uInt) length));
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if ((memcmp(type,mng_JDAA,4) == 0) || (memcmp(type,mng_JdAA,4) == 0))
{
/* Copy chunk data to alpha_image->blob */
if (alpha_image != NULL && image_info->ping == MagickFalse)
{
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying JDAA chunk data to alpha_blob.");
(void) WriteBlob(alpha_image,length,chunk);
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_JSEP,4) == 0)
{
read_JSEP=MagickTrue;
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_bKGD,4) == 0)
{
if (length == 2)
{
image->background_color.red=ScaleCharToQuantum(p[1]);
image->background_color.green=image->background_color.red;
image->background_color.blue=image->background_color.red;
}
if (length == 6)
{
image->background_color.red=ScaleCharToQuantum(p[1]);
image->background_color.green=ScaleCharToQuantum(p[3]);
image->background_color.blue=ScaleCharToQuantum(p[5]);
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_gAMA,4) == 0)
{
if (length == 4)
image->gamma=((float) mng_get_long(p))*0.00001;
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_cHRM,4) == 0)
{
if (length == 32)
{
image->chromaticity.white_point.x=0.00001*mng_get_long(p);
image->chromaticity.white_point.y=0.00001*mng_get_long(&p[4]);
image->chromaticity.red_primary.x=0.00001*mng_get_long(&p[8]);
image->chromaticity.red_primary.y=0.00001*mng_get_long(&p[12]);
image->chromaticity.green_primary.x=0.00001*mng_get_long(&p[16]);
image->chromaticity.green_primary.y=0.00001*mng_get_long(&p[20]);
image->chromaticity.blue_primary.x=0.00001*mng_get_long(&p[24]);
image->chromaticity.blue_primary.y=0.00001*mng_get_long(&p[28]);
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_sRGB,4) == 0)
{
if (length == 1)
{
image->rendering_intent=
Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]);
image->gamma=1.000f/2.200f;
image->chromaticity.red_primary.x=0.6400f;
image->chromaticity.red_primary.y=0.3300f;
image->chromaticity.green_primary.x=0.3000f;
image->chromaticity.green_primary.y=0.6000f;
image->chromaticity.blue_primary.x=0.1500f;
image->chromaticity.blue_primary.y=0.0600f;
image->chromaticity.white_point.x=0.3127f;
image->chromaticity.white_point.y=0.3290f;
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_oFFs,4) == 0)
{
if (length > 8)
{
image->page.x=(ssize_t) mng_get_long(p);
image->page.y=(ssize_t) mng_get_long(&p[4]);
if ((int) p[8] != 0)
{
image->page.x/=10000;
image->page.y/=10000;
}
}
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
if (memcmp(type,mng_pHYs,4) == 0)
{
if (length > 8)
{
image->resolution.x=(double) mng_get_long(p);
image->resolution.y=(double) mng_get_long(&p[4]);
if ((int) p[8] == PNG_RESOLUTION_METER)
{
image->units=PixelsPerCentimeterResolution;
image->resolution.x=image->resolution.x/100.0f;
image->resolution.y=image->resolution.y/100.0f;
}
}
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
#if 0
if (memcmp(type,mng_iCCP,4) == 0)
{
/* To do: */
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
continue;
}
#endif
if (length != 0)
chunk=(unsigned char *) RelinquishMagickMemory(chunk);
if (memcmp(type,mng_IEND,4))
continue;
break;
}
/* IEND found */
/*
Finish up reading image data:
o read main image from color_blob.
o close color_blob.
o if (color_type has alpha)
if alpha_encoding is PNG
read secondary image from alpha_blob via ReadPNG
if alpha_encoding is JPEG
read secondary image from alpha_blob via ReadJPEG
o close alpha_blob.
o copy intensity of secondary image into
alpha samples of main image.
o destroy the secondary image.
*/
if (color_image_info == (ImageInfo *) NULL)
{
assert(color_image == (Image *) NULL);
assert(alpha_image == (Image *) NULL);
return(DestroyImageList(image));
}
if (color_image == (Image *) NULL)
{
assert(alpha_image == (Image *) NULL);
return(DestroyImageList(image));
}
(void) SeekBlob(color_image,0,SEEK_SET);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading jng_image from color_blob.");
assert(color_image_info != (ImageInfo *) NULL);
(void) FormatLocaleString(color_image_info->filename,MagickPathExtent,"%s",
color_image->filename);
color_image_info->ping=MagickFalse; /* To do: avoid this */
jng_image=ReadImage(color_image_info,exception);
(void) RelinquishUniqueFileResource(color_image->filename);
color_image=DestroyImage(color_image);
color_image_info=DestroyImageInfo(color_image_info);
if (jng_image == (Image *) NULL)
return(DestroyImageList(image));
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Copying jng_image pixels to main image.");
image->rows=jng_height;
image->columns=jng_width;
status=SetImageExtent(image,image->columns,image->rows,exception);
if (status == MagickFalse)
return(DestroyImageList(image));
for (y=0; y < (ssize_t) image->rows; y++)
{
s=GetVirtualPixels(jng_image,0,y,image->columns,1,exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
for (x=(ssize_t) image->columns; x != 0; x--)
{
SetPixelRed(image,GetPixelRed(jng_image,s),q);
SetPixelGreen(image,GetPixelGreen(jng_image,s),q);
SetPixelBlue(image,GetPixelBlue(jng_image,s),q);
q+=GetPixelChannels(image);
s+=GetPixelChannels(jng_image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
jng_image=DestroyImage(jng_image);
if (image_info->ping == MagickFalse)
{
if (jng_color_type >= 12)
{
if (jng_alpha_compression_method == 0)
{
png_byte
data[5];
(void) WriteBlobMSBULong(alpha_image,0x00000000L);
PNGType(data,mng_IEND);
LogPNGChunk(logging,mng_IEND,0L);
(void) WriteBlob(alpha_image,4,data);
(void) WriteBlobMSBULong(alpha_image,crc32(0,data,4));
}
(void) CloseBlob(alpha_image);
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" Reading alpha from alpha_blob.");
(void) FormatLocaleString(alpha_image_info->filename,MagickPathExtent,
"%s",alpha_image->filename);
jng_image=ReadImage(alpha_image_info,exception);
if (jng_image != (Image *) NULL)
for (y=0; y < (ssize_t) image->rows; y++)
{
s=GetVirtualPixels(jng_image,0,y,image->columns,1,
exception);
q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
if (image->alpha_trait != UndefinedPixelTrait)
for (x=(ssize_t) image->columns; x != 0; x--)
{
SetPixelAlpha(image,GetPixelRed(jng_image,s),q);
q+=GetPixelChannels(image);
s+=GetPixelChannels(jng_image);
}
else
for (x=(ssize_t) image->columns; x != 0; x--)
{
SetPixelAlpha(image,GetPixelRed(jng_image,s),q);
if (GetPixelAlpha(image,q) != OpaqueAlpha)
image->alpha_trait=BlendPixelTrait;
q+=GetPixelChannels(image);
s+=GetPixelChannels(jng_image);
}
if (SyncAuthenticPixels(image,exception) == MagickFalse)
break;
}
(void) RelinquishUniqueFileResource(alpha_image->filename);
alpha_image=DestroyImage(alpha_image);
alpha_image_info=DestroyImageInfo(alpha_image_info);
if (jng_image != (Image *) NULL)
jng_image=DestroyImage(jng_image);
}
}
/* Read the JNG image. */
if (mng_info->mng_type == 0)
{
mng_info->mng_width=jng_width;
mng_info->mng_height=jng_height;
}
if (image->page.width == 0 && image->page.height == 0)
{
image->page.width=jng_width;
image->page.height=jng_height;
}
if (image->page.x == 0 && image->page.y == 0)
{
image->page.x=mng_info->x_off[mng_info->object_id];
image->page.y=mng_info->y_off[mng_info->object_id];
}
else
{
image->page.y=mng_info->y_off[mng_info->object_id];
}
mng_info->image_found++;
status=SetImageProgress(image,LoadImagesTag,2*TellBlob(image),
2*GetBlobSize(image));
if (status == MagickFalse)
return(DestroyImageList(image));
if (logging != MagickFalse)
(void) LogMagickEvent(CoderEvent,GetMagickModule(),
" exit ReadOneJNGImage()");
return(image);
}
| 0 |
poppler | b224e2f5739fe61de9fa69955d016725b2a4b78d | NOT_APPLICABLE | NOT_APPLICABLE | SplashOutputDev::SplashOutputDev(SplashColorMode colorModeA,
int bitmapRowPadA,
bool reverseVideoA,
SplashColorPtr paperColorA,
bool bitmapTopDownA,
SplashThinLineMode thinLineMode,
bool overprintPreviewA) {
colorMode = colorModeA;
bitmapRowPad = bitmapRowPadA;
bitmapTopDown = bitmapTopDownA;
bitmapUpsideDown = false;
fontAntialias = true;
vectorAntialias = true;
overprintPreview = overprintPreviewA;
enableFreeTypeHinting = false;
enableSlightHinting = false;
setupScreenParams(72.0, 72.0);
reverseVideo = reverseVideoA;
if (paperColorA != nullptr) {
splashColorCopy(paperColor, paperColorA);
} else {
splashClearColor(paperColor);
}
skipHorizText = false;
skipRotatedText = false;
keepAlphaChannel = paperColorA == nullptr;
doc = nullptr;
bitmap = new SplashBitmap(1, 1, bitmapRowPad, colorMode,
colorMode != splashModeMono1, bitmapTopDown);
splash = new Splash(bitmap, vectorAntialias, &screenParams);
splash->setMinLineWidth(s_minLineWidth);
splash->setThinLineMode(thinLineMode);
splash->clear(paperColor, 0);
fontEngine = nullptr;
nT3Fonts = 0;
t3GlyphStack = nullptr;
font = nullptr;
needFontUpdate = false;
textClipPath = nullptr;
transpGroupStack = nullptr;
nestCount = 0;
xref = nullptr;
} | 0 |
linux | 51ebd3181572af8d5076808dab2682d800f6da5d | NOT_APPLICABLE | NOT_APPLICABLE | static int ip6_pkt_drop(struct sk_buff *skb, u8 code, int ipstats_mib_noroutes)
{
int type;
struct dst_entry *dst = skb_dst(skb);
switch (ipstats_mib_noroutes) {
case IPSTATS_MIB_INNOROUTES:
type = ipv6_addr_type(&ipv6_hdr(skb)->daddr);
if (type == IPV6_ADDR_ANY) {
IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst),
IPSTATS_MIB_INADDRERRORS);
break;
}
/* FALLTHROUGH */
case IPSTATS_MIB_OUTNOROUTES:
IP6_INC_STATS(dev_net(dst->dev), ip6_dst_idev(dst),
ipstats_mib_noroutes);
break;
}
icmpv6_send(skb, ICMPV6_DEST_UNREACH, code, 0);
kfree_skb(skb);
return 0;
} | 0 |
linux | 3a4d44b6162555070194e486ff6b3799a8d323a2 | NOT_APPLICABLE | NOT_APPLICABLE | int put_compat_rusage(const struct rusage *r, struct compat_rusage __user *ru)
{
if (!access_ok(VERIFY_WRITE, ru, sizeof(*ru)) ||
__put_user(r->ru_utime.tv_sec, &ru->ru_utime.tv_sec) ||
__put_user(r->ru_utime.tv_usec, &ru->ru_utime.tv_usec) ||
__put_user(r->ru_stime.tv_sec, &ru->ru_stime.tv_sec) ||
__put_user(r->ru_stime.tv_usec, &ru->ru_stime.tv_usec) ||
__put_user(r->ru_maxrss, &ru->ru_maxrss) ||
__put_user(r->ru_ixrss, &ru->ru_ixrss) ||
__put_user(r->ru_idrss, &ru->ru_idrss) ||
__put_user(r->ru_isrss, &ru->ru_isrss) ||
__put_user(r->ru_minflt, &ru->ru_minflt) ||
__put_user(r->ru_majflt, &ru->ru_majflt) ||
__put_user(r->ru_nswap, &ru->ru_nswap) ||
__put_user(r->ru_inblock, &ru->ru_inblock) ||
__put_user(r->ru_oublock, &ru->ru_oublock) ||
__put_user(r->ru_msgsnd, &ru->ru_msgsnd) ||
__put_user(r->ru_msgrcv, &ru->ru_msgrcv) ||
__put_user(r->ru_nsignals, &ru->ru_nsignals) ||
__put_user(r->ru_nvcsw, &ru->ru_nvcsw) ||
__put_user(r->ru_nivcsw, &ru->ru_nivcsw))
return -EFAULT;
return 0;
} | 0 |
linux | b6878d9e03043695dbf3fa1caa6dfc09db225b16 | NOT_APPLICABLE | NOT_APPLICABLE | static ssize_t ubb_store(struct md_rdev *rdev, const char *page, size_t len)
{
return badblocks_store(&rdev->badblocks, page, len, 1);
}
| 0 |
Chrome | 83a4b3aa72d98fe4176b4a54c8cea227ed966570 | NOT_APPLICABLE | NOT_APPLICABLE | void Increment(const v8::FunctionCallbackInfo<v8::Value>& args) {
counter_++;
}
| 0 |
linux | cb222aed03d798fc074be55e59d9a112338ee784 | NOT_APPLICABLE | NOT_APPLICABLE | int input_grab_device(struct input_handle *handle)
{
struct input_dev *dev = handle->dev;
int retval;
retval = mutex_lock_interruptible(&dev->mutex);
if (retval)
return retval;
if (dev->grab) {
retval = -EBUSY;
goto out;
}
rcu_assign_pointer(dev->grab, handle);
out:
mutex_unlock(&dev->mutex);
return retval;
} | 0 |
sqlite | e41fd72acc7a06ce5a6a7d28154db1ffe8ba37a8 | NOT_APPLICABLE | NOT_APPLICABLE | static RtreeSearchPoint *rtreeSearchPointFirst(RtreeCursor *pCur){
return pCur->bPoint ? &pCur->sPoint : pCur->nPoint ? pCur->aPoint : 0;
} | 0 |
php-radius | 13c149b051f82b709e8d7cc32111e84b49d57234 | NOT_APPLICABLE | NOT_APPLICABLE | PHP_FUNCTION(radius_add_server)
{
char *hostname, *secret;
int hostname_len, secret_len;
long port, timeout, maxtries;
radius_descriptor *raddesc;
zval *z_radh;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rslsll", &z_radh,
&hostname, &hostname_len,
&port,
&secret, &secret_len,
&timeout, &maxtries) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(raddesc, radius_descriptor *, &z_radh, -1, "rad_handle", le_radius);
if (rad_add_server(raddesc->radh, hostname, port, secret, timeout, maxtries) == -1) {
RETURN_FALSE;
} else {
RETURN_TRUE;
}
}
| 0 |
linux | c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81 | NOT_APPLICABLE | NOT_APPLICABLE | cifs_idmap_key_destroy(struct key *key)
{
if (key->datalen > sizeof(key->payload))
kfree(key->payload.data);
}
| 0 |
curl | 81d135d67155c5295b1033679c606165d4e28f3f | NOT_APPLICABLE | NOT_APPLICABLE | static CURLcode set_login(struct connectdata *conn)
{
CURLcode result = CURLE_OK;
const char *setuser = CURL_DEFAULT_USER;
const char *setpasswd = CURL_DEFAULT_PASSWORD;
/* If our protocol needs a password and we have none, use the defaults */
if((conn->handler->flags & PROTOPT_NEEDSPWD) && !conn->bits.user_passwd)
;
else {
setuser = "";
setpasswd = "";
}
/* Store the default user */
if(!conn->user) {
conn->user = strdup(setuser);
if(!conn->user)
return CURLE_OUT_OF_MEMORY;
}
/* Store the default password */
if(!conn->passwd) {
conn->passwd = strdup(setpasswd);
if(!conn->passwd)
result = CURLE_OUT_OF_MEMORY;
}
/* if there's a user without password, consider password blank */
if(conn->user && !conn->passwd) {
conn->passwd = strdup("");
if(!conn->passwd)
result = CURLE_OUT_OF_MEMORY;
}
return result;
}
| 0 |
tensorflow | 4f38b1ac8e42727e18a2f0bde06d3bee8e77b250 | CVE-2022-23577 | CWE-476 | Status GetInitOp(const string& export_dir, const MetaGraphDef& meta_graph_def,
string* init_op_name) {
const auto& sig_def_map = meta_graph_def.signature_def();
const auto& init_op_sig_it =
meta_graph_def.signature_def().find(kSavedModelInitOpSignatureKey);
if (init_op_sig_it != sig_def_map.end()) {
*init_op_name = init_op_sig_it->second.outputs()
.find(kSavedModelInitOpSignatureKey)
->second.name();
return Status::OK();
}
const auto& collection_def_map = meta_graph_def.collection_def();
string init_op_collection_key;
if (collection_def_map.find(kSavedModelMainOpKey) !=
collection_def_map.end()) {
init_op_collection_key = kSavedModelMainOpKey;
} else {
init_op_collection_key = kSavedModelLegacyInitOpKey;
}
const auto init_op_it = collection_def_map.find(init_op_collection_key);
if (init_op_it != collection_def_map.end()) {
if (init_op_it->second.node_list().value_size() != 1) {
return errors::FailedPrecondition(
strings::StrCat("Expected exactly one main op in : ", export_dir));
}
*init_op_name = init_op_it->second.node_list().value(0);
}
return Status::OK();
} | 1 |
Android | 04e8cd58f075bec5892e369c8deebca9c67e855c | CVE-2018-9496 | CWE-787 | VOID ixheaacd_esbr_postradixcompute2(WORD32 *ptr_y, WORD32 *ptr_x,
const WORD32 *pdig_rev_tbl,
WORD32 npoints) {
WORD32 i, k;
WORD32 h2;
WORD32 x_0, x_1, x_2, x_3;
WORD32 x_4, x_5, x_6, x_7;
WORD32 x_8, x_9, x_a, x_b, x_c, x_d, x_e, x_f;
WORD32 n00, n10, n20, n30, n01, n11, n21, n31;
WORD32 n02, n12, n22, n32, n03, n13, n23, n33;
WORD32 n0, j0;
WORD32 *x2, *x0;
WORD32 *y0, *y1, *y2, *y3;
y0 = ptr_y;
y2 = ptr_y + (WORD32)npoints;
x0 = ptr_x;
x2 = ptr_x + (WORD32)(npoints >> 1);
y1 = y0 + (WORD32)(npoints >> 2);
y3 = y2 + (WORD32)(npoints >> 2);
j0 = 8;
n0 = npoints >> 1;
for (k = 0; k < 2; k++) {
for (i = 0; i<npoints>> 1; i += 8) {
h2 = *pdig_rev_tbl++ >> 2;
x_0 = *x0++;
x_1 = *x0++;
x_2 = *x0++;
x_3 = *x0++;
x_4 = *x0++;
x_5 = *x0++;
x_6 = *x0++;
x_7 = *x0++;
n00 = x_0 + x_2;
n01 = x_1 + x_3;
n20 = x_0 - x_2;
n21 = x_1 - x_3;
n10 = x_4 + x_6;
n11 = x_5 + x_7;
n30 = x_4 - x_6;
n31 = x_5 - x_7;
y0[h2] = n00;
y0[h2 + 1] = n01;
y1[h2] = n10;
y1[h2 + 1] = n11;
y2[h2] = n20;
y2[h2 + 1] = n21;
y3[h2] = n30;
y3[h2 + 1] = n31;
x_8 = *x2++;
x_9 = *x2++;
x_a = *x2++;
x_b = *x2++;
x_c = *x2++;
x_d = *x2++;
x_e = *x2++;
x_f = *x2++;
n02 = x_8 + x_a;
n03 = x_9 + x_b;
n22 = x_8 - x_a;
n23 = x_9 - x_b;
n12 = x_c + x_e;
n13 = x_d + x_f;
n32 = x_c - x_e;
n33 = x_d - x_f;
y0[h2 + 2] = n02;
y0[h2 + 3] = n03;
y1[h2 + 2] = n12;
y1[h2 + 3] = n13;
y2[h2 + 2] = n22;
y2[h2 + 3] = n23;
y3[h2 + 2] = n32;
y3[h2 + 3] = n33;
}
x0 += (WORD32)npoints >> 1;
x2 += (WORD32)npoints >> 1;
}
}
| 1 |
openssl | 1fb9fdc3027b27d8eb6a1e6a846435b070980770 | NOT_APPLICABLE | NOT_APPLICABLE | int ssl3_do_uncompress(SSL *ssl, SSL3_RECORD *rr)
{
#ifndef OPENSSL_NO_COMP
int i;
if (rr->comp == NULL) {
rr->comp = (unsigned char *)
OPENSSL_malloc(SSL3_RT_MAX_ENCRYPTED_LENGTH);
}
if (rr->comp == NULL)
return 0;
i = COMP_expand_block(ssl->expand, rr->comp,
SSL3_RT_MAX_PLAIN_LENGTH, rr->data, (int)rr->length);
if (i < 0)
return 0;
else
rr->length = i;
rr->data = rr->comp;
#endif
return 1;
}
| 0 |
Chrome | 35eb28748d45b87695a69eceffaff73a0be476af | NOT_APPLICABLE | NOT_APPLICABLE | TestBackgroundLoaderOffliner::GetVisibleSecurityState(
content::WebContents* web_contents) {
if (custom_visible_security_state_)
return std::move(custom_visible_security_state_);
return BackgroundLoaderOffliner::GetVisibleSecurityState(web_contents);
}
| 0 |
net-snmp | 5f881d3bf24599b90d67a45cae7a3eb099cd71c9 | NOT_APPLICABLE | NOT_APPLICABLE | snmp_synch_input(int op,
netsnmp_session * session,
int reqid, netsnmp_pdu *pdu, void *magic)
{
struct synch_state *state = (struct synch_state *) magic;
int rpt_type;
if (reqid != state->reqid && pdu && pdu->command != SNMP_MSG_REPORT) {
DEBUGMSGTL(("snmp_synch", "Unexpected response (ReqID: %d,%d - Cmd %d)\n",
reqid, state->reqid, pdu->command ));
return 0;
}
state->waiting = 0;
DEBUGMSGTL(("snmp_synch", "Response (ReqID: %d - Cmd %d)\n",
reqid, (pdu ? pdu->command : -1)));
if (op == NETSNMP_CALLBACK_OP_RECEIVED_MESSAGE && pdu) {
if (pdu->command == SNMP_MSG_REPORT) {
rpt_type = snmpv3_get_report_type(pdu);
if (SNMPV3_IGNORE_UNAUTH_REPORTS ||
rpt_type == SNMPERR_NOT_IN_TIME_WINDOW) {
state->waiting = 1;
}
state->pdu = NULL;
state->status = STAT_ERROR;
session->s_snmp_errno = rpt_type;
SET_SNMP_ERROR(rpt_type);
} else if (pdu->command == SNMP_MSG_RESPONSE) {
/*
* clone the pdu to return to snmp_synch_response
*/
state->pdu = snmp_clone_pdu(pdu);
state->status = STAT_SUCCESS;
session->s_snmp_errno = SNMPERR_SUCCESS;
}
else {
char msg_buf[50];
state->status = STAT_ERROR;
session->s_snmp_errno = SNMPERR_PROTOCOL;
SET_SNMP_ERROR(SNMPERR_PROTOCOL);
snprintf(msg_buf, sizeof(msg_buf), "Expected RESPONSE-PDU but got %s-PDU",
snmp_pdu_type(pdu->command));
snmp_set_detail(msg_buf);
return 0;
}
} else if (op == NETSNMP_CALLBACK_OP_TIMED_OUT) {
state->pdu = NULL;
state->status = STAT_TIMEOUT;
session->s_snmp_errno = SNMPERR_TIMEOUT;
SET_SNMP_ERROR(SNMPERR_TIMEOUT);
} else if (op == NETSNMP_CALLBACK_OP_SEC_ERROR) {
state->pdu = NULL;
/*
* If we already have an error in status, then leave it alone.
*/
if (state->status == STAT_SUCCESS) {
state->status = STAT_ERROR;
session->s_snmp_errno = SNMPERR_GENERR;
SET_SNMP_ERROR(SNMPERR_GENERR);
}
} else if (op == NETSNMP_CALLBACK_OP_DISCONNECT) {
state->pdu = NULL;
state->status = STAT_ERROR;
session->s_snmp_errno = SNMPERR_ABORT;
SET_SNMP_ERROR(SNMPERR_ABORT);
}
DEBUGMSGTL(("snmp_synch", "status = %d errno = %d\n",
state->status, session->s_snmp_errno));
return 1;
} | 0 |
poppler | 7b2d314a61fd0e12f47c62996cb49ec0d1ba747a | NOT_APPLICABLE | NOT_APPLICABLE | void ArthurOutputDev::type3D1(GfxState *state, double wx, double wy,
double llx, double lly, double urx, double ury)
{
}
| 0 |
Chrome | 4026d85fcded8c4ee5113cb1bd1a7e8149e03827 | NOT_APPLICABLE | NOT_APPLICABLE | static void GetLoadTimes(const v8::FunctionCallbackInfo<v8::Value>& args) {
WebLocalFrame* frame = WebLocalFrame::frameForCurrentContext();
if (!frame) {
args.GetReturnValue().SetNull();
return;
}
WebDataSource* data_source = frame->dataSource();
if (!data_source) {
args.GetReturnValue().SetNull();
return;
}
DocumentState* document_state = DocumentState::FromDataSource(data_source);
if (!document_state) {
args.GetReturnValue().SetNull();
return;
}
double request_time = document_state->request_time().ToDoubleT();
double start_load_time = document_state->start_load_time().ToDoubleT();
double commit_load_time = document_state->commit_load_time().ToDoubleT();
double finish_document_load_time =
document_state->finish_document_load_time().ToDoubleT();
double finish_load_time = document_state->finish_load_time().ToDoubleT();
double first_paint_time = document_state->first_paint_time().ToDoubleT();
double first_paint_after_load_time =
document_state->first_paint_after_load_time().ToDoubleT();
std::string navigation_type =
GetNavigationType(data_source->navigationType());
bool was_fetched_via_spdy = document_state->was_fetched_via_spdy();
bool was_npn_negotiated = document_state->was_npn_negotiated();
std::string npn_negotiated_protocol =
document_state->npn_negotiated_protocol();
bool was_alternate_protocol_available =
document_state->was_alternate_protocol_available();
std::string connection_info = net::HttpResponseInfo::ConnectionInfoToString(
document_state->connection_info());
// Important: |frame|, |data_source| and |document_state| should not be
// referred to below this line, as JS setters below can invalidate these
// pointers.
v8::Isolate* isolate = args.GetIsolate();
v8::Local<v8::Object> load_times = v8::Object::New(isolate);
load_times->Set(v8::String::NewFromUtf8(isolate, "requestTime"),
v8::Number::New(isolate, request_time));
load_times->Set(v8::String::NewFromUtf8(isolate, "startLoadTime"),
v8::Number::New(isolate, start_load_time));
load_times->Set(v8::String::NewFromUtf8(isolate, "commitLoadTime"),
v8::Number::New(isolate, commit_load_time));
load_times->Set(v8::String::NewFromUtf8(isolate, "finishDocumentLoadTime"),
v8::Number::New(isolate, finish_document_load_time));
load_times->Set(v8::String::NewFromUtf8(isolate, "finishLoadTime"),
v8::Number::New(isolate, finish_load_time));
load_times->Set(v8::String::NewFromUtf8(isolate, "firstPaintTime"),
v8::Number::New(isolate, first_paint_time));
load_times->Set(v8::String::NewFromUtf8(isolate, "firstPaintAfterLoadTime"),
v8::Number::New(isolate, first_paint_after_load_time));
load_times->Set(v8::String::NewFromUtf8(isolate, "navigationType"),
v8::String::NewFromUtf8(isolate, navigation_type.c_str()));
load_times->Set(v8::String::NewFromUtf8(isolate, "wasFetchedViaSpdy"),
v8::Boolean::New(isolate, was_fetched_via_spdy));
load_times->Set(v8::String::NewFromUtf8(isolate, "wasNpnNegotiated"),
v8::Boolean::New(isolate, was_npn_negotiated));
load_times->Set(
v8::String::NewFromUtf8(isolate, "npnNegotiatedProtocol"),
v8::String::NewFromUtf8(isolate, npn_negotiated_protocol.c_str()));
load_times->Set(
v8::String::NewFromUtf8(isolate, "wasAlternateProtocolAvailable"),
v8::Boolean::New(isolate, was_alternate_protocol_available));
load_times->Set(v8::String::NewFromUtf8(isolate, "connectionInfo"),
v8::String::NewFromUtf8(isolate, connection_info.c_str()));
args.GetReturnValue().Set(load_times);
}
| 0 |
envoy | e9f936d85dc1edc34fabd0a1725ec180f2316353 | NOT_APPLICABLE | NOT_APPLICABLE | TestUtilOptions& setExpectedPeerSubject(const std::string& expected_peer_subject) {
expected_peer_subject_ = expected_peer_subject;
return *this;
} | 0 |
nspluginwrapper | 7e4ab8e1189846041f955e6c83f72bc1624e7a98 | NOT_APPLICABLE | NOT_APPLICABLE | invoke_NPN_IntFromIdentifier(NPIdentifier identifier)
{
npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), -1);
int error = rpc_method_invoke(g_rpc_connection,
RPC_METHOD_NPN_INT_FROM_IDENTIFIER,
RPC_TYPE_NP_IDENTIFIER, &identifier,
RPC_TYPE_INVALID);
if (error != RPC_ERROR_NO_ERROR) {
npw_perror("NPN_IntFromIdentifier() invoke", error);
return -1;
}
int32_t ret;
error = rpc_method_wait_for_reply(g_rpc_connection,
RPC_TYPE_INT32, &ret,
RPC_TYPE_INVALID);
if (error != RPC_ERROR_NO_ERROR) {
npw_perror("NPN_IntFromIdentifier() wait for reply", error);
return -1;
}
return ret;
}
| 0 |
unicorn | c733bbada356b0373fa8aa72c044574bb855fd24 | NOT_APPLICABLE | NOT_APPLICABLE | static inline void page_lock_tb(struct uc_struct *uc, const TranslationBlock *tb)
{
page_lock_pair(uc, NULL, tb->page_addr[0], NULL, tb->page_addr[1], 0);
} | 0 |
htcondor | 5e5571d1a431eb3c61977b6dd6ec90186ef79867 | NOT_APPLICABLE | NOT_APPLICABLE | sysapi_opsys(void)
{
if( ! arch_inited ) {
init_arch();
}
return opsys;
}
| 0 |
u-boot | 8f8c04bf1ebbd2f72f1643e7ad9617dafa6e5409 | NOT_APPLICABLE | NOT_APPLICABLE | static int do_i2c_mw(struct cmd_tbl *cmdtp, int flag, int argc,
char *const argv[])
{
uint chip;
ulong addr;
uint alen;
uchar byte;
uint count;
int ret;
#if CONFIG_IS_ENABLED(DM_I2C)
struct udevice *dev;
#endif
if ((argc < 4) || (argc > 5))
return CMD_RET_USAGE;
/*
* Chip is always specified.
*/
chip = hextoul(argv[1], NULL);
/*
* Address is always specified.
*/
addr = hextoul(argv[2], NULL);
alen = get_alen(argv[2], DEFAULT_ADDR_LEN);
if (alen > 3)
return CMD_RET_USAGE;
#if CONFIG_IS_ENABLED(DM_I2C)
ret = i2c_get_cur_bus_chip(chip, &dev);
if (!ret && alen != -1)
ret = i2c_set_chip_offset_len(dev, alen);
if (ret)
return i2c_report_err(ret, I2C_ERR_WRITE);
#endif
/*
* Value to write is always specified.
*/
byte = hextoul(argv[3], NULL);
/*
* Optional count
*/
if (argc == 5)
count = hextoul(argv[4], NULL);
else
count = 1;
while (count-- > 0) {
#if CONFIG_IS_ENABLED(DM_I2C)
ret = dm_i2c_write(dev, addr++, &byte, 1);
#else
ret = i2c_write(chip, addr++, alen, &byte, 1);
#endif
if (ret)
return i2c_report_err(ret, I2C_ERR_WRITE);
/*
* Wait for the write to complete. The write can take
* up to 10mSec (we allow a little more time).
*/
/*
* No write delay with FRAM devices.
*/
#if !defined(CONFIG_SYS_I2C_FRAM)
udelay(11000);
#endif
}
return 0;
} | 0 |
postgres | 160c0258802d10b0600d7671b1bbea55d8e17d45 | NOT_APPLICABLE | NOT_APPLICABLE | PQsetClientEncoding(PGconn *conn, const char *encoding)
{
char qbuf[128];
static const char query[] = "set client_encoding to '%s'";
PGresult *res;
int status;
if (!conn || conn->status != CONNECTION_OK)
return -1;
if (!encoding)
return -1;
/* Resolve special "auto" value from the locale */
if (strcmp(encoding, "auto") == 0)
encoding = pg_encoding_to_char(pg_get_encoding_from_locale(NULL, true));
/* check query buffer overflow */
if (sizeof(qbuf) < (sizeof(query) + strlen(encoding)))
return -1;
/* ok, now send a query */
sprintf(qbuf, query, encoding);
res = PQexec(conn, qbuf);
if (res == NULL)
return -1;
if (res->resultStatus != PGRES_COMMAND_OK)
status = -1;
else
{
/*
* We rely on the backend to report the parameter value, and we'll
* change state at that time.
*/
status = 0; /* everything is ok */
}
PQclear(res);
return status;
} | 0 |
php-src | 97eff7eb57fc2320c267a949cffd622c38712484?w=1 | NOT_APPLICABLE | NOT_APPLICABLE | static int strToMatch(const char* str ,char *retstr)
{
char* anchor = NULL;
const char* anchor1 = NULL;
int result = 0;
if( (!str) || str[0] == '\0'){
return result;
} else {
anchor = retstr;
anchor1 = str;
while( (*str)!='\0' ){
if( *str == '-' ){
*retstr = '_';
} else {
*retstr = tolower(*str);
}
str++;
retstr++;
}
*retstr = '\0';
retstr= anchor;
str= anchor1;
result = 1;
}
return(result);
}
| 0 |
Chrome | c6f0d22d508a551a40fc8bd7418941b77435aac3 | NOT_APPLICABLE | NOT_APPLICABLE | bool OmniboxViewViews::IsDropCursorForInsertion() const {
return HasTextBeingDragged();
}
| 0 |
Chrome | b944f670bb7a8a919daac497a4ea0536c954c201 | NOT_APPLICABLE | NOT_APPLICABLE | JSValue jsTestObjConditionalAttr5Constructor(ExecState* exec, JSValue slotBase, const Identifier&)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
return JSTestObjectB::getConstructor(exec, castedThis);
}
| 0 |
perl5 | 897d1f7fd515b828e4b198d8b8bef76c6faf03ed | NOT_APPLICABLE | NOT_APPLICABLE | void
Perl_regprop(pTHX_ const regexp *prog, SV *sv, const regnode *o, const regmatch_info *reginfo, const RExC_state_t *pRExC_state)
{
#ifdef DEBUGGING
dVAR;
int k;
RXi_GET_DECL(prog, progi);
GET_RE_DEBUG_FLAGS_DECL;
PERL_ARGS_ASSERT_REGPROP;
SvPVCLEAR(sv);
if (OP(o) > REGNODE_MAX) /* regnode.type is unsigned */
/* It would be nice to FAIL() here, but this may be called from
regexec.c, and it would be hard to supply pRExC_state. */
Perl_croak(aTHX_ "Corrupted regexp opcode %d > %d",
(int)OP(o), (int)REGNODE_MAX);
sv_catpv(sv, PL_reg_name[OP(o)]); /* Take off const! */
k = PL_regkind[OP(o)];
if (k == EXACT) {
sv_catpvs(sv, " ");
/* Using is_utf8_string() (via PERL_PV_UNI_DETECT)
* is a crude hack but it may be the best for now since
* we have no flag "this EXACTish node was UTF-8"
* --jhi */
pv_pretty(sv, STRING(o), STR_LEN(o), PL_dump_re_max_len,
PL_colors[0], PL_colors[1],
PERL_PV_ESCAPE_UNI_DETECT |
PERL_PV_ESCAPE_NONASCII |
PERL_PV_PRETTY_ELLIPSES |
PERL_PV_PRETTY_LTGT |
PERL_PV_PRETTY_NOCLEAR
);
} else if (k == TRIE) {
/* print the details of the trie in dumpuntil instead, as
* progi->data isn't available here */
const char op = OP(o);
const U32 n = ARG(o);
const reg_ac_data * const ac = IS_TRIE_AC(op) ?
(reg_ac_data *)progi->data->data[n] :
NULL;
const reg_trie_data * const trie
= (reg_trie_data*)progi->data->data[!IS_TRIE_AC(op) ? n : ac->trie];
Perl_sv_catpvf(aTHX_ sv, "-%s", PL_reg_name[o->flags]);
DEBUG_TRIE_COMPILE_r({
if (trie->jump)
sv_catpvs(sv, "(JUMP)");
Perl_sv_catpvf(aTHX_ sv,
"<S:%" UVuf "/%" IVdf " W:%" UVuf " L:%" UVuf "/%" UVuf " C:%" UVuf "/%" UVuf ">",
(UV)trie->startstate,
(IV)trie->statecount-1, /* -1 because of the unused 0 element */
(UV)trie->wordcount,
(UV)trie->minlen,
(UV)trie->maxlen,
(UV)TRIE_CHARCOUNT(trie),
(UV)trie->uniquecharcount
);
});
if ( IS_ANYOF_TRIE(op) || trie->bitmap ) {
sv_catpvs(sv, "[");
(void) put_charclass_bitmap_innards(sv,
((IS_ANYOF_TRIE(op))
? ANYOF_BITMAP(o)
: TRIE_BITMAP(trie)),
NULL,
NULL,
NULL,
FALSE
);
sv_catpvs(sv, "]");
}
} else if (k == CURLY) {
U32 lo = ARG1(o), hi = ARG2(o);
if (OP(o) == CURLYM || OP(o) == CURLYN || OP(o) == CURLYX)
Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags); /* Parenth number */
Perl_sv_catpvf(aTHX_ sv, "{%u,", (unsigned) lo);
if (hi == REG_INFTY)
sv_catpvs(sv, "INFTY");
else
Perl_sv_catpvf(aTHX_ sv, "%u", (unsigned) hi);
sv_catpvs(sv, "}");
}
else if (k == WHILEM && o->flags) /* Ordinal/of */
Perl_sv_catpvf(aTHX_ sv, "[%d/%d]", o->flags & 0xf, o->flags>>4);
else if (k == REF || k == OPEN || k == CLOSE
|| k == GROUPP || OP(o)==ACCEPT)
{
AV *name_list= NULL;
U32 parno= OP(o) == ACCEPT ? (U32)ARG2L(o) : ARG(o);
Perl_sv_catpvf(aTHX_ sv, "%" UVuf, (UV)parno); /* Parenth number */
if ( RXp_PAREN_NAMES(prog) ) {
name_list= MUTABLE_AV(progi->data->data[progi->name_list_idx]);
} else if ( pRExC_state ) {
name_list= RExC_paren_name_list;
}
if (name_list) {
if ( k != REF || (OP(o) < NREF)) {
SV **name= av_fetch(name_list, parno, 0 );
if (name)
Perl_sv_catpvf(aTHX_ sv, " '%" SVf "'", SVfARG(*name));
}
else {
SV *sv_dat= MUTABLE_SV(progi->data->data[ parno ]);
I32 *nums=(I32*)SvPVX(sv_dat);
SV **name= av_fetch(name_list, nums[0], 0 );
I32 n;
if (name) {
for ( n=0; n<SvIVX(sv_dat); n++ ) {
Perl_sv_catpvf(aTHX_ sv, "%s%" IVdf,
(n ? "," : ""), (IV)nums[n]);
}
Perl_sv_catpvf(aTHX_ sv, " '%" SVf "'", SVfARG(*name));
}
}
}
if ( k == REF && reginfo) {
U32 n = ARG(o); /* which paren pair */
I32 ln = prog->offs[n].start;
if (prog->lastparen < n || ln == -1 || prog->offs[n].end == -1)
Perl_sv_catpvf(aTHX_ sv, ": FAIL");
else if (ln == prog->offs[n].end)
Perl_sv_catpvf(aTHX_ sv, ": ACCEPT - EMPTY STRING");
else {
const char *s = reginfo->strbeg + ln;
Perl_sv_catpvf(aTHX_ sv, ": ");
Perl_pv_pretty( aTHX_ sv, s, prog->offs[n].end - prog->offs[n].start, 32, 0, 0,
PERL_PV_ESCAPE_UNI_DETECT|PERL_PV_PRETTY_NOCLEAR|PERL_PV_PRETTY_ELLIPSES|PERL_PV_PRETTY_QUOTE );
}
}
} else if (k == GOSUB) {
AV *name_list= NULL;
if ( RXp_PAREN_NAMES(prog) ) {
name_list= MUTABLE_AV(progi->data->data[progi->name_list_idx]);
} else if ( pRExC_state ) {
name_list= RExC_paren_name_list;
}
/* Paren and offset */
Perl_sv_catpvf(aTHX_ sv, "%d[%+d:%d]", (int)ARG(o),(int)ARG2L(o),
(int)((o + (int)ARG2L(o)) - progi->program) );
if (name_list) {
SV **name= av_fetch(name_list, ARG(o), 0 );
if (name)
Perl_sv_catpvf(aTHX_ sv, " '%" SVf "'", SVfARG(*name));
}
}
else if (k == LOGICAL)
/* 2: embedded, otherwise 1 */
Perl_sv_catpvf(aTHX_ sv, "[%d]", o->flags);
else if (k == ANYOF) {
const U8 flags = (OP(o) == ANYOFH) ? 0 : ANYOF_FLAGS(o);
bool do_sep = FALSE; /* Do we need to separate various components of
the output? */
/* Set if there is still an unresolved user-defined property */
SV *unresolved = NULL;
/* Things that are ignored except when the runtime locale is UTF-8 */
SV *only_utf8_locale_invlist = NULL;
/* Code points that don't fit in the bitmap */
SV *nonbitmap_invlist = NULL;
/* And things that aren't in the bitmap, but are small enough to be */
SV* bitmap_range_not_in_bitmap = NULL;
const bool inverted = flags & ANYOF_INVERT;
if (OP(o) == ANYOFL || OP(o) == ANYOFPOSIXL) {
if (ANYOFL_UTF8_LOCALE_REQD(flags)) {
sv_catpvs(sv, "{utf8-locale-reqd}");
}
if (flags & ANYOFL_FOLD) {
sv_catpvs(sv, "{i}");
}
}
/* If there is stuff outside the bitmap, get it */
if (ARG(o) != ANYOF_ONLY_HAS_BITMAP) {
(void) _get_regclass_nonbitmap_data(prog, o, FALSE,
&unresolved,
&only_utf8_locale_invlist,
&nonbitmap_invlist);
/* The non-bitmap data may contain stuff that could fit in the
* bitmap. This could come from a user-defined property being
* finally resolved when this call was done; or much more likely
* because there are matches that require UTF-8 to be valid, and so
* aren't in the bitmap. This is teased apart later */
_invlist_intersection(nonbitmap_invlist,
PL_InBitmap,
&bitmap_range_not_in_bitmap);
/* Leave just the things that don't fit into the bitmap */
_invlist_subtract(nonbitmap_invlist,
PL_InBitmap,
&nonbitmap_invlist);
}
/* Obey this flag to add all above-the-bitmap code points */
if (flags & ANYOF_MATCHES_ALL_ABOVE_BITMAP) {
nonbitmap_invlist = _add_range_to_invlist(nonbitmap_invlist,
NUM_ANYOF_CODE_POINTS,
UV_MAX);
}
/* Ready to start outputting. First, the initial left bracket */
Perl_sv_catpvf(aTHX_ sv, "[%s", PL_colors[0]);
if (OP(o) != ANYOFH) {
/* Then all the things that could fit in the bitmap */
do_sep = put_charclass_bitmap_innards(sv,
ANYOF_BITMAP(o),
bitmap_range_not_in_bitmap,
only_utf8_locale_invlist,
o,
/* Can't try inverting for a
* better display if there
* are things that haven't
* been resolved */
unresolved != NULL);
SvREFCNT_dec(bitmap_range_not_in_bitmap);
/* If there are user-defined properties which haven't been defined
* yet, output them. If the result is not to be inverted, it is
* clearest to output them in a separate [] from the bitmap range
* stuff. If the result is to be complemented, we have to show
* everything in one [], as the inversion applies to the whole
* thing. Use {braces} to separate them from anything in the
* bitmap and anything above the bitmap. */
if (unresolved) {
if (inverted) {
if (! do_sep) { /* If didn't output anything in the bitmap
*/
sv_catpvs(sv, "^");
}
sv_catpvs(sv, "{");
}
else if (do_sep) {
Perl_sv_catpvf(aTHX_ sv,"%s][%s", PL_colors[1],
PL_colors[0]);
}
sv_catsv(sv, unresolved);
if (inverted) {
sv_catpvs(sv, "}");
}
do_sep = ! inverted;
}
}
/* And, finally, add the above-the-bitmap stuff */
if (nonbitmap_invlist && _invlist_len(nonbitmap_invlist)) {
SV* contents;
/* See if truncation size is overridden */
const STRLEN dump_len = (PL_dump_re_max_len > 256)
? PL_dump_re_max_len
: 256;
/* This is output in a separate [] */
if (do_sep) {
Perl_sv_catpvf(aTHX_ sv,"%s][%s", PL_colors[1], PL_colors[0]);
}
/* And, for easy of understanding, it is shown in the
* uncomplemented form if possible. The one exception being if
* there are unresolved items, where the inversion has to be
* delayed until runtime */
if (inverted && ! unresolved) {
_invlist_invert(nonbitmap_invlist);
_invlist_subtract(nonbitmap_invlist, PL_InBitmap, &nonbitmap_invlist);
}
contents = invlist_contents(nonbitmap_invlist,
FALSE /* output suitable for catsv */
);
/* If the output is shorter than the permissible maximum, just do it. */
if (SvCUR(contents) <= dump_len) {
sv_catsv(sv, contents);
}
else {
const char * contents_string = SvPVX(contents);
STRLEN i = dump_len;
/* Otherwise, start at the permissible max and work back to the
* first break possibility */
while (i > 0 && contents_string[i] != ' ') {
i--;
}
if (i == 0) { /* Fail-safe. Use the max if we couldn't
find a legal break */
i = dump_len;
}
sv_catpvn(sv, contents_string, i);
sv_catpvs(sv, "...");
}
SvREFCNT_dec_NN(contents);
SvREFCNT_dec_NN(nonbitmap_invlist);
}
/* And finally the matching, closing ']' */
Perl_sv_catpvf(aTHX_ sv, "%s]", PL_colors[1]);
if (OP(o) == ANYOFH && FLAGS(o) != 0) {
Perl_sv_catpvf(aTHX_ sv, " (First UTF-8 byte=\\x%02x)", FLAGS(o));
}
SvREFCNT_dec(unresolved);
}
else if (k == ANYOFM) {
SV * cp_list = get_ANYOFM_contents(o);
Perl_sv_catpvf(aTHX_ sv, "[%s", PL_colors[0]);
if (OP(o) == NANYOFM) {
_invlist_invert(cp_list);
}
put_charclass_bitmap_innards(sv, NULL, cp_list, NULL, NULL, TRUE);
Perl_sv_catpvf(aTHX_ sv, "%s]", PL_colors[1]);
SvREFCNT_dec(cp_list);
}
else if (k == POSIXD || k == NPOSIXD) {
U8 index = FLAGS(o) * 2;
if (index < C_ARRAY_LENGTH(anyofs)) {
if (*anyofs[index] != '[') {
sv_catpvs(sv, "[");
}
sv_catpv(sv, anyofs[index]);
if (*anyofs[index] != '[') {
sv_catpvs(sv, "]");
}
}
else {
Perl_sv_catpvf(aTHX_ sv, "[illegal type=%d])", index);
}
}
else if (k == BOUND || k == NBOUND) {
/* Must be synced with order of 'bound_type' in regcomp.h */
const char * const bounds[] = {
"", /* Traditional */
"{gcb}",
"{lb}",
"{sb}",
"{wb}"
};
assert(FLAGS(o) < C_ARRAY_LENGTH(bounds));
sv_catpv(sv, bounds[FLAGS(o)]);
}
else if (k == BRANCHJ && (OP(o) == UNLESSM || OP(o) == IFMATCH)) {
Perl_sv_catpvf(aTHX_ sv, "[%d", -(o->flags));
if (o->next_off) {
Perl_sv_catpvf(aTHX_ sv, "..-%d", o->flags - o->next_off);
}
Perl_sv_catpvf(aTHX_ sv, "]");
}
else if (OP(o) == SBOL)
Perl_sv_catpvf(aTHX_ sv, " /%s/", o->flags ? "\\A" : "^");
/* add on the verb argument if there is one */
if ( ( k == VERB || OP(o) == ACCEPT || OP(o) == OPFAIL ) && o->flags) {
if ( ARG(o) )
Perl_sv_catpvf(aTHX_ sv, ":%" SVf,
SVfARG((MUTABLE_SV(progi->data->data[ ARG( o ) ]))));
else
sv_catpvs(sv, ":NULL");
}
#else
PERL_UNUSED_CONTEXT;
PERL_UNUSED_ARG(sv);
PERL_UNUSED_ARG(o);
PERL_UNUSED_ARG(prog);
PERL_UNUSED_ARG(reginfo);
PERL_UNUSED_ARG(pRExC_state);
#endif /* DEBUGGING */ | 0 |
linux | f3d3342602f8bcbf37d7c46641cb9bca7618eb1c | NOT_APPLICABLE | NOT_APPLICABLE | static inline void delete_item(struct pppoe_net *pn, __be16 sid,
char *addr, int ifindex)
{
write_lock_bh(&pn->hash_lock);
__delete_item(pn, sid, addr, ifindex);
write_unlock_bh(&pn->hash_lock);
}
| 0 |
Chrome | e3aa8a56706c4abe208934d5c294f7b594b8b693 | NOT_APPLICABLE | NOT_APPLICABLE | explicit QuitMessageLoopAfterScreenshot(base::OnceClosure done)
: done_(std::move(done)) {}
| 0 |
linux | 854e8bb1aa06c578c2c9145fa6bfe3680ef63b23 | NOT_APPLICABLE | NOT_APPLICABLE | static void svm_fpu_activate(struct kvm_vcpu *vcpu)
{
struct vcpu_svm *svm = to_svm(vcpu);
clr_exception_intercept(svm, NM_VECTOR);
svm->vcpu.fpu_active = 1;
update_cr0_intercept(svm);
}
| 0 |
gpac | bceb03fd2be95097a7b409ea59914f332fb6bc86 | NOT_APPLICABLE | NOT_APPLICABLE | GF_Err vmhd_Size(GF_Box *s)
{
GF_VideoMediaHeaderBox *ptr = (GF_VideoMediaHeaderBox *)s;
ptr->size += 8;
return GF_OK;
}
| 0 |
radare2 | 10517e3ff0e609697eb8cde60ec8dc999ee5ea24 | NOT_APPLICABLE | NOT_APPLICABLE | static bool r_anal_try_get_fcn(RCore *core, RAnalRef *ref, int fcndepth, int refdepth) {
if (!refdepth) {
return false;
}
RIOMap *map = r_io_map_get_at (core->io, ref->addr);
if (!map) {
return false;
}
if (map->perm & R_PERM_X) {
ut8 buf[64];
r_io_read_at (core->io, ref->addr, buf, sizeof (buf));
bool looksLikeAFunction = r_anal_check_fcn (core->anal, buf, sizeof (buf), ref->addr, r_io_map_begin (map),
r_io_map_end (map));
if (looksLikeAFunction) {
if (core->anal->limit) {
if (ref->addr < core->anal->limit->from ||
ref->addr > core->anal->limit->to) {
return 1;
}
}
r_core_anal_fcn (core, ref->addr, ref->at, ref->type, fcndepth - 1);
}
} else {
ut64 offs = 0;
ut64 sz = core->anal->bits >> 3;
RAnalRef ref1;
ref1.type = R_ANAL_REF_TYPE_DATA;
ref1.at = ref->addr;
ref1.addr = 0;
ut32 i32;
ut16 i16;
ut8 i8;
ut64 offe = offs + 1024;
for (offs = 0; offs < offe; offs += sz, ref1.at += sz) {
ut8 bo[8];
r_io_read_at (core->io, ref->addr + offs, bo, R_MIN (sizeof (bo), sz));
bool be = core->anal->big_endian;
switch (sz) {
case 1:
i8 = r_read_ble8 (bo);
ref1.addr = (ut64)i8;
break;
case 2:
i16 = r_read_ble16 (bo, be);
ref1.addr = (ut64)i16;
break;
case 4:
i32 = r_read_ble32 (bo, be);
ref1.addr = (ut64)i32;
break;
case 8:
ref1.addr = r_read_ble64 (bo, be);
break;
}
r_anal_try_get_fcn (core, &ref1, fcndepth, refdepth - 1);
}
}
return 1;
} | 0 |
FFmpeg | e5c7229999182ad1cef13b9eca050dba7a5a08da | NOT_APPLICABLE | NOT_APPLICABLE | int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx,
AVFrame *frame,
int *got_frame_ptr,
const AVPacket *avpkt)
{
AVCodecInternal *avci = avctx->internal;
int ret = 0;
*got_frame_ptr = 0;
if (!avpkt->data && avpkt->size) {
av_log(avctx, AV_LOG_ERROR, "invalid packet: NULL data, size != 0\n");
return AVERROR(EINVAL);
}
if (!avctx->codec)
return AVERROR(EINVAL);
if (avctx->codec->type != AVMEDIA_TYPE_AUDIO) {
av_log(avctx, AV_LOG_ERROR, "Invalid media type for audio\n");
return AVERROR(EINVAL);
}
av_frame_unref(frame);
if ((avctx->codec->capabilities & CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) {
uint8_t *side;
int side_size;
uint32_t discard_padding = 0;
// copy to ensure we do not change avpkt
AVPacket tmp = *avpkt;
int did_split = av_packet_split_side_data(&tmp);
ret = apply_param_change(avctx, &tmp);
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "Error applying parameter changes.\n");
if (avctx->err_recognition & AV_EF_EXPLODE)
goto fail;
}
avctx->internal->pkt = &tmp;
if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME)
ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, &tmp);
else {
ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp);
frame->pkt_dts = avpkt->dts;
}
if (ret >= 0 && *got_frame_ptr) {
add_metadata_from_side_data(avctx, frame);
avctx->frame_number++;
av_frame_set_best_effort_timestamp(frame,
guess_correct_pts(avctx,
frame->pkt_pts,
frame->pkt_dts));
if (frame->format == AV_SAMPLE_FMT_NONE)
frame->format = avctx->sample_fmt;
if (!frame->channel_layout)
frame->channel_layout = avctx->channel_layout;
if (!av_frame_get_channels(frame))
av_frame_set_channels(frame, avctx->channels);
if (!frame->sample_rate)
frame->sample_rate = avctx->sample_rate;
}
side= av_packet_get_side_data(avctx->internal->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size);
if(side && side_size>=10) {
avctx->internal->skip_samples = AV_RL32(side);
av_log(avctx, AV_LOG_DEBUG, "skip %d samples due to side data\n",
avctx->internal->skip_samples);
discard_padding = AV_RL32(side + 4);
}
if (avctx->internal->skip_samples && *got_frame_ptr) {
if(frame->nb_samples <= avctx->internal->skip_samples){
*got_frame_ptr = 0;
avctx->internal->skip_samples -= frame->nb_samples;
av_log(avctx, AV_LOG_DEBUG, "skip whole frame, skip left: %d\n",
avctx->internal->skip_samples);
} else {
av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples,
frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format);
if(avctx->pkt_timebase.num && avctx->sample_rate) {
int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples,
(AVRational){1, avctx->sample_rate},
avctx->pkt_timebase);
if(frame->pkt_pts!=AV_NOPTS_VALUE)
frame->pkt_pts += diff_ts;
if(frame->pkt_dts!=AV_NOPTS_VALUE)
frame->pkt_dts += diff_ts;
if (av_frame_get_pkt_duration(frame) >= diff_ts)
av_frame_set_pkt_duration(frame, av_frame_get_pkt_duration(frame) - diff_ts);
} else {
av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for skipped samples.\n");
}
av_log(avctx, AV_LOG_DEBUG, "skip %d/%d samples\n",
avctx->internal->skip_samples, frame->nb_samples);
frame->nb_samples -= avctx->internal->skip_samples;
avctx->internal->skip_samples = 0;
}
}
if (discard_padding > 0 && discard_padding <= frame->nb_samples && *got_frame_ptr) {
if (discard_padding == frame->nb_samples) {
*got_frame_ptr = 0;
} else {
if(avctx->pkt_timebase.num && avctx->sample_rate) {
int64_t diff_ts = av_rescale_q(frame->nb_samples - discard_padding,
(AVRational){1, avctx->sample_rate},
avctx->pkt_timebase);
if (av_frame_get_pkt_duration(frame) >= diff_ts)
av_frame_set_pkt_duration(frame, av_frame_get_pkt_duration(frame) - diff_ts);
} else {
av_log(avctx, AV_LOG_WARNING, "Could not update timestamps for discarded samples.\n");
}
av_log(avctx, AV_LOG_DEBUG, "discard %d/%d samples\n",
discard_padding, frame->nb_samples);
frame->nb_samples -= discard_padding;
}
}
fail:
avctx->internal->pkt = NULL;
if (did_split) {
av_packet_free_side_data(&tmp);
if(ret == tmp.size)
ret = avpkt->size;
}
if (ret >= 0 && *got_frame_ptr) {
if (!avctx->refcounted_frames) {
int err = unrefcount_frame(avci, frame);
if (err < 0)
return err;
}
} else
av_frame_unref(frame);
}
return ret;
} | 0 |
libconfuse | d73777c2c3566fb2647727bb56d9a2295b81669b | NOT_APPLICABLE | NOT_APPLICABLE | DLLIMPORT char *cfg_tilde_expand(const char *filename)
{
char *expanded = NULL;
#ifndef _WIN32
/* Do tilde expansion */
if (filename[0] == '~') {
struct passwd *passwd = NULL;
const char *file = NULL;
if (filename[1] == '/' || filename[1] == 0) {
/* ~ or ~/path */
passwd = getpwuid(geteuid());
file = filename + 1;
} else {
char *user; /* ~user or ~user/path */
size_t len;
file = strchr(filename, '/');
if (file == NULL)
file = filename + strlen(filename);
len = file - filename - 1;
user = malloc(len + 1);
if (!user)
return NULL;
strncpy(user, &filename[1], len);
user[len] = 0;
passwd = getpwnam(user);
free(user);
}
if (passwd) {
expanded = malloc(strlen(passwd->pw_dir) + strlen(file) + 1);
if (!expanded)
return NULL;
strcpy(expanded, passwd->pw_dir);
strcat(expanded, file);
}
}
#endif
if (!expanded)
expanded = strdup(filename);
return expanded;
} | 0 |
linux | 78c9c4dfbf8c04883941445a195276bb4bb92c76 | NOT_APPLICABLE | NOT_APPLICABLE | static void itimer_delete(struct k_itimer *timer)
{
unsigned long flags;
retry_delete:
spin_lock_irqsave(&timer->it_lock, flags);
if (timer_delete_hook(timer) == TIMER_RETRY) {
unlock_timer(timer, flags);
goto retry_delete;
}
list_del(&timer->list);
/*
* This keeps any tasks waiting on the spin lock from thinking
* they got something (see the lock code above).
*/
timer->it_signal = NULL;
unlock_timer(timer, flags);
release_posix_timer(timer, IT_ID_SET);
}
| 0 |
weechat | f105c6f0b56fb5687b2d2aedf37cb1d1b434d556 | CVE-2017-14727 | CWE-119 | logger_get_mask_expanded (struct t_gui_buffer *buffer, const char *mask)
{
char *mask2, *mask_decoded, *mask_decoded2, *mask_decoded3, *mask_decoded4;
char *mask_decoded5;
const char *dir_separator;
int length;
time_t seconds;
struct tm *date_tmp;
mask2 = NULL;
mask_decoded = NULL;
mask_decoded2 = NULL;
mask_decoded3 = NULL;
mask_decoded4 = NULL;
mask_decoded5 = NULL;
dir_separator = weechat_info_get ("dir_separator", "");
if (!dir_separator)
return NULL;
/*
* we first replace directory separator (commonly '/') by \01 because
* buffer mask can contain this char, and will be replaced by replacement
* char ('_' by default)
*/
mask2 = weechat_string_replace (mask, dir_separator, "\01");
if (!mask2)
goto end;
mask_decoded = weechat_buffer_string_replace_local_var (buffer, mask2);
if (!mask_decoded)
goto end;
mask_decoded2 = weechat_string_replace (mask_decoded,
dir_separator,
weechat_config_string (logger_config_file_replacement_char));
if (!mask_decoded2)
goto end;
#ifdef __CYGWIN__
mask_decoded3 = weechat_string_replace (mask_decoded2, "\\",
weechat_config_string (logger_config_file_replacement_char));
#else
mask_decoded3 = strdup (mask_decoded2);
#endif /* __CYGWIN__ */
if (!mask_decoded3)
goto end;
/* restore directory separator */
mask_decoded4 = weechat_string_replace (mask_decoded3,
"\01", dir_separator);
if (!mask_decoded4)
goto end;
/* replace date/time specifiers in mask */
length = strlen (mask_decoded4) + 256 + 1;
mask_decoded5 = malloc (length);
if (!mask_decoded5)
goto end;
seconds = time (NULL);
date_tmp = localtime (&seconds);
mask_decoded5[0] = '\0';
strftime (mask_decoded5, length - 1, mask_decoded4, date_tmp);
/* convert to lower case? */
if (weechat_config_boolean (logger_config_file_name_lower_case))
weechat_string_tolower (mask_decoded5);
if (weechat_logger_plugin->debug)
{
weechat_printf_date_tags (NULL, 0, "no_log",
"%s: buffer = \"%s\", mask = \"%s\", "
"decoded mask = \"%s\"",
LOGGER_PLUGIN_NAME,
weechat_buffer_get_string (buffer, "name"),
mask, mask_decoded5);
}
end:
if (mask2)
free (mask2);
if (mask_decoded)
free (mask_decoded);
if (mask_decoded2)
free (mask_decoded2);
if (mask_decoded3)
free (mask_decoded3);
if (mask_decoded4)
free (mask_decoded4);
return mask_decoded5;
}
| 1 |
cinnamon-screensaver | da7af55f1fa966c52e15cc288d4f8928eca8cc9f | NOT_APPLICABLE | NOT_APPLICABLE | gs_window_real_hide (GtkWidget *widget)
{
GSWindow *window;
window = GS_WINDOW (widget);
gdk_window_remove_filter (NULL, (GdkFilterFunc)xevent_filter, window);
remove_watchdog_timer (window);
if (GTK_WIDGET_CLASS (gs_window_parent_class)->hide) {
GTK_WIDGET_CLASS (gs_window_parent_class)->hide (widget);
}
} | 0 |
FreeRDP | 3627aaf7d289315b614a584afb388f04abfb5bbf | NOT_APPLICABLE | NOT_APPLICABLE | static BOOL rdp_write_sound_capability_set(wStream* s, const rdpSettings* settings)
{
size_t header;
UINT16 soundFlags;
if (!Stream_EnsureRemainingCapacity(s, 32))
return FALSE;
header = rdp_capability_set_start(s);
if (header > UINT16_MAX)
return FALSE;
soundFlags = (settings->SoundBeepsEnabled) ? SOUND_BEEPS_FLAG : 0;
Stream_Write_UINT16(s, soundFlags); /* soundFlags (2 bytes) */
Stream_Write_UINT16(s, 0); /* pad2OctetsA (2 bytes) */
rdp_capability_set_finish(s, (UINT16)header, CAPSET_TYPE_SOUND);
return TRUE;
} | 0 |
exiv2 | b3d077dcaefb6747fff8204490f33eba5a144edb | NOT_APPLICABLE | NOT_APPLICABLE | void CrwMap::encode0x2008(const Image& image,
const CrwMapping* pCrwMapping,
CiffHeader* pHead)
{
assert(pCrwMapping != 0);
assert(pHead != 0);
ExifThumbC exifThumb(image.exifData());
DataBuf buf = exifThumb.copy();
if (buf.size_ != 0) {
pHead->add(pCrwMapping->crwTagId_, pCrwMapping->crwDir_, buf);
}
else {
pHead->remove(pCrwMapping->crwTagId_, pCrwMapping->crwDir_);
}
} // CrwMap::encode0x2008 | 0 |
poco | bb7e5feece68ccfd8660caee93da25c5c39a4707 | NOT_APPLICABLE | NOT_APPLICABLE | ZipInputStream::~ZipInputStream()
{
} | 0 |
linux | 864745d291b5ba80ea0bd0edcbe67273de368836 | NOT_APPLICABLE | NOT_APPLICABLE | static int __init xfrm_user_init(void)
{
int rv;
printk(KERN_INFO "Initializing XFRM netlink socket\n");
rv = register_pernet_subsys(&xfrm_user_net_ops);
if (rv < 0)
return rv;
rv = xfrm_register_km(&netlink_mgr);
if (rv < 0)
unregister_pernet_subsys(&xfrm_user_net_ops);
return rv;
}
| 0 |
linux | a3727a8bac0a9e77c70820655fd8715523ba3db7 | NOT_APPLICABLE | NOT_APPLICABLE | static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags)
{
struct smack_known *skp = smk_of_current();
struct socket_smack *ssp;
ssp = kzalloc(sizeof(struct socket_smack), gfp_flags);
if (ssp == NULL)
return -ENOMEM;
/*
* Sockets created by kernel threads receive web label.
*/
if (unlikely(current->flags & PF_KTHREAD)) {
ssp->smk_in = &smack_known_web;
ssp->smk_out = &smack_known_web;
} else {
ssp->smk_in = skp;
ssp->smk_out = skp;
}
ssp->smk_packet = NULL;
sk->sk_security = ssp;
return 0;
} | 0 |
linux-2.6 | 13788ccc41ceea5893f9c747c59bc0b28f2416c2 | NOT_APPLICABLE | NOT_APPLICABLE | static inline int hrtimer_enqueue_reprogram(struct hrtimer *timer,
struct hrtimer_clock_base *base)
{
if (base->cpu_base->hres_active && hrtimer_reprogram(timer, base)) {
/* Timer is expired, act upon the callback mode */
switch(timer->cb_mode) {
case HRTIMER_CB_IRQSAFE_NO_RESTART:
/*
* We can call the callback from here. No restart
* happens, so no danger of recursion
*/
BUG_ON(timer->function(timer) != HRTIMER_NORESTART);
return 1;
case HRTIMER_CB_IRQSAFE_NO_SOFTIRQ:
/*
* This is solely for the sched tick emulation with
* dynamic tick support to ensure that we do not
* restart the tick right on the edge and end up with
* the tick timer in the softirq ! The calling site
* takes care of this.
*/
return 1;
case HRTIMER_CB_IRQSAFE:
case HRTIMER_CB_SOFTIRQ:
/*
* Move everything else into the softirq pending list !
*/
list_add_tail(&timer->cb_entry,
&base->cpu_base->cb_pending);
timer->state = HRTIMER_STATE_PENDING;
raise_softirq(HRTIMER_SOFTIRQ);
return 1;
default:
BUG();
}
}
return 0;
} | 0 |
vim | a27e1dcddc9e3914ab34b164f71c51b72903b00b | NOT_APPLICABLE | NOT_APPLICABLE | alloc_tabpage(void)
{
tabpage_T *tp;
# ifdef FEAT_GUI
int i;
# endif
tp = ALLOC_CLEAR_ONE(tabpage_T);
if (tp == NULL)
return NULL;
# ifdef FEAT_EVAL
/* init t: variables */
tp->tp_vars = dict_alloc();
if (tp->tp_vars == NULL)
{
vim_free(tp);
return NULL;
}
init_var_dict(tp->tp_vars, &tp->tp_winvar, VAR_SCOPE);
# endif
# ifdef FEAT_GUI
for (i = 0; i < 3; i++)
tp->tp_prev_which_scrollbars[i] = -1;
# endif
# ifdef FEAT_DIFF
tp->tp_diff_invalid = TRUE;
# endif
tp->tp_ch_used = p_ch;
return tp;
} | 0 |
cJSON | 94df772485c92866ca417d92137747b2e3b0a917 | NOT_APPLICABLE | NOT_APPLICABLE | void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return;
newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem;
if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);}
| 0 |
gpac | ebfa346eff05049718f7b80041093b4c5581c24e | NOT_APPLICABLE | NOT_APPLICABLE | GF_Err gf_isom_add_user_data_boxes(GF_ISOFile *movie, u32 trackNumber, u8 *data, u32 DataLength)
{
GF_Err e;
GF_TrackBox *trak;
GF_UserDataBox *udta;
GF_BitStream *bs;
e = CanAccessMovie(movie, GF_ISOM_OPEN_WRITE);
if (e) return e;
if (trackNumber) {
trak = gf_isom_get_track_from_file(movie, trackNumber);
if (!trak) return GF_BAD_PARAM;
if (!trak->udta) trak_on_child_box((GF_Box*)trak, gf_isom_box_new_parent(&trak->child_boxes, GF_ISOM_BOX_TYPE_UDTA), GF_FALSE);
udta = trak->udta;
} else {
if (!movie->moov) return GF_BAD_PARAM;
if (!movie->moov->udta) moov_on_child_box((GF_Box*)movie->moov, gf_isom_box_new_parent(&movie->moov->child_boxes, GF_ISOM_BOX_TYPE_UDTA), GF_FALSE);
udta = movie->moov->udta;
}
if (!udta) return GF_OUT_OF_MEM;
bs = gf_bs_new(data, DataLength, GF_BITSTREAM_READ);
while (gf_bs_available(bs)) {
GF_Box *a;
e = gf_isom_box_parse(&a, bs);
if (e) break;
e = udta_on_child_box((GF_Box *)udta, a, GF_FALSE);
if (e) break;
}
gf_bs_del(bs);
return e;
} | 0 |
tcpdump | bd4e697ebd6c8457efa8f28f6831fc929b88a014 | NOT_APPLICABLE | NOT_APPLICABLE | bgp_route_refresh_print(netdissect_options *ndo,
const u_char *pptr, int len)
{
const struct bgp_route_refresh *bgp_route_refresh_header;
ND_TCHECK2(pptr[0], BGP_ROUTE_REFRESH_SIZE);
/* some little sanity checking */
if (len<BGP_ROUTE_REFRESH_SIZE)
return;
bgp_route_refresh_header = (const struct bgp_route_refresh *)pptr;
ND_PRINT((ndo, "\n\t AFI %s (%u), SAFI %s (%u)",
tok2str(af_values,"Unknown",
/* this stinks but the compiler pads the structure
* weird */
EXTRACT_16BITS(&bgp_route_refresh_header->afi)),
EXTRACT_16BITS(&bgp_route_refresh_header->afi),
tok2str(bgp_safi_values,"Unknown",
bgp_route_refresh_header->safi),
bgp_route_refresh_header->safi));
if (ndo->ndo_vflag > 1) {
ND_TCHECK2(*pptr, len);
print_unknown_data(ndo, pptr, "\n\t ", len);
}
return;
trunc:
ND_PRINT((ndo, "[|BGP]"));
}
| 0 |
passenger | 4e97fdb86d0a0141ec9a052c6e691fcd07bb45c8 | NOT_APPLICABLE | NOT_APPLICABLE | describeCommand(int argc, const char *argv[], const Options &options) {
string result = "'";
result.append(argv[options.programArgStart]);
result.append("'");
if (argc > options.programArgStart + 1) {
result.append(" (with params '");
int i = options.programArgStart + 1;
while (i < argc) {
if (i != options.programArgStart + 1) {
result.append(" ");
}
result.append(argv[i]);
i++;
}
result.append("')");
}
return result;
} | 0 |
linux | 8605330aac5a5785630aec8f64378a54891937cc | NOT_APPLICABLE | NOT_APPLICABLE | int skb_to_sgvec_nomark(struct sk_buff *skb, struct scatterlist *sg,
int offset, int len)
{
return __skb_to_sgvec(skb, sg, offset, len);
}
| 0 |
keepalived | c6247a9ef2c7b33244ab1d3aa5d629ec49f0a067 | CVE-2018-19045 | CWE-200 | usage(const char *prog)
{
fprintf(stderr, "Usage: %s [OPTION...]\n", prog);
fprintf(stderr, " -f, --use-file=FILE Use the specified configuration file\n");
#if defined _WITH_VRRP_ && defined _WITH_LVS_
fprintf(stderr, " -P, --vrrp Only run with VRRP subsystem\n");
fprintf(stderr, " -C, --check Only run with Health-checker subsystem\n");
#endif
#ifdef _WITH_BFD_
fprintf(stderr, " -B, --no_bfd Don't run BFD subsystem\n");
#endif
fprintf(stderr, " --all Force all child processes to run, even if have no configuration\n");
fprintf(stderr, " -l, --log-console Log messages to local console\n");
fprintf(stderr, " -D, --log-detail Detailed log messages\n");
fprintf(stderr, " -S, --log-facility=[0-7] Set syslog facility to LOG_LOCAL[0-7]\n");
fprintf(stderr, " -g, --log-file=FILE Also log to FILE (default /tmp/keepalived.log)\n");
fprintf(stderr, " --flush-log-file Flush log file on write\n");
fprintf(stderr, " -G, --no-syslog Don't log via syslog\n");
#ifdef _WITH_VRRP_
fprintf(stderr, " -X, --release-vips Drop VIP on transition from signal.\n");
fprintf(stderr, " -V, --dont-release-vrrp Don't remove VRRP VIPs and VROUTEs on daemon stop\n");
#endif
#ifdef _WITH_LVS_
fprintf(stderr, " -I, --dont-release-ipvs Don't remove IPVS topology on daemon stop\n");
#endif
fprintf(stderr, " -R, --dont-respawn Don't respawn child processes\n");
fprintf(stderr, " -n, --dont-fork Don't fork the daemon process\n");
fprintf(stderr, " -d, --dump-conf Dump the configuration data\n");
fprintf(stderr, " -p, --pid=FILE Use specified pidfile for parent process\n");
#ifdef _WITH_VRRP_
fprintf(stderr, " -r, --vrrp_pid=FILE Use specified pidfile for VRRP child process\n");
#endif
#ifdef _WITH_LVS_
fprintf(stderr, " -c, --checkers_pid=FILE Use specified pidfile for checkers child process\n");
fprintf(stderr, " -a, --address-monitoring Report all address additions/deletions notified via netlink\n");
#endif
#ifdef _WITH_BFD_
fprintf(stderr, " -b, --bfd_pid=FILE Use specified pidfile for BFD child process\n");
#endif
#ifdef _WITH_SNMP_
fprintf(stderr, " -x, --snmp Enable SNMP subsystem\n");
fprintf(stderr, " -A, --snmp-agent-socket=FILE Use the specified socket for master agent\n");
#endif
#if HAVE_DECL_CLONE_NEWNET
fprintf(stderr, " -s, --namespace=NAME Run in network namespace NAME (overrides config)\n");
#endif
fprintf(stderr, " -m, --core-dump Produce core dump if terminate abnormally\n");
fprintf(stderr, " -M, --core-dump-pattern=PATN Also set /proc/sys/kernel/core_pattern to PATN (default 'core')\n");
#ifdef _MEM_CHECK_LOG_
fprintf(stderr, " -L, --mem-check-log Log malloc/frees to syslog\n");
#endif
fprintf(stderr, " -i, --config-id id Skip any configuration lines beginning '@' that don't match id\n"
" or any lines beginning @^ that do match.\n"
" The config-id defaults to the node name if option not used\n");
fprintf(stderr, " --signum=SIGFUNC Return signal number for STOP, RELOAD, DATA, STATS"
#ifdef _WITH_JSON_
", JSON"
#endif
"\n");
fprintf(stderr, " -t, --config-test[=LOG_FILE] Check the configuration for obvious errors, output to\n"
" stderr by default\n");
#ifdef _WITH_PERF_
fprintf(stderr, " --perf[=PERF_TYPE] Collect perf data, PERF_TYPE=all, run(default) or end\n");
#endif
#ifdef WITH_DEBUG_OPTIONS
fprintf(stderr, " --debug[=...] Enable debug options. p, b, c, v specify parent, bfd, checker and vrrp processes\n");
#ifdef _TIMER_CHECK_
fprintf(stderr, " T - timer debug\n");
#endif
#ifdef _SMTP_ALERT_DEBUG_
fprintf(stderr, " M - email alert debug\n");
#endif
#ifdef _EPOLL_DEBUG_
fprintf(stderr, " E - epoll debug\n");
#endif
#ifdef _EPOLL_THREAD_DUMP_
fprintf(stderr, " D - epoll thread dump debug\n");
#endif
#ifdef _VRRP_FD_DEBUG
fprintf(stderr, " F - vrrp fd dump debug\n");
#endif
#ifdef _REGEX_DEBUG_
fprintf(stderr, " R - regex debug\n");
#endif
#ifdef _WITH_REGEX_TIMERS_
fprintf(stderr, " X - regex timers\n");
#endif
#ifdef _TSM_DEBUG_
fprintf(stderr, " S - TSM debug\n");
#endif
#ifdef _NETLINK_TIMERS_
fprintf(stderr, " N - netlink timer debug\n");
#endif
fprintf(stderr, " Example --debug=TpMEvcp\n");
#endif
fprintf(stderr, " -v, --version Display the version number\n");
fprintf(stderr, " -h, --help Display this help message\n");
}
| 1 |
ovs | 9237a63c47bd314b807cda0bd2216264e82edbe8 | NOT_APPLICABLE | NOT_APPLICABLE | decode_NXAST_RAW_SAMPLE2(const struct nx_action_sample2 *nas,
enum ofp_version ofp_version OVS_UNUSED,
struct ofpbuf *out)
{
return decode_SAMPLE2(nas, NXAST_RAW_SAMPLE2, NX_ACTION_SAMPLE_DEFAULT,
ofpact_put_SAMPLE(out));
}
| 0 |
FreeRDP | 06c32f170093a6ecde93e3bc07fed6a706bfbeb3 | NOT_APPLICABLE | NOT_APPLICABLE | static UINT video_plugin_initialize(IWTSPlugin* plugin, IWTSVirtualChannelManager* channelMgr)
{
UINT status;
VIDEO_PLUGIN* video = (VIDEO_PLUGIN*)plugin;
VIDEO_LISTENER_CALLBACK* callback;
video->control_callback = callback =
(VIDEO_LISTENER_CALLBACK*)calloc(1, sizeof(VIDEO_LISTENER_CALLBACK));
if (!callback)
{
WLog_ERR(TAG, "calloc for control callback failed!");
return CHANNEL_RC_NO_MEMORY;
}
callback->iface.OnNewChannelConnection = video_control_on_new_channel_connection;
callback->plugin = plugin;
callback->channel_mgr = channelMgr;
status = channelMgr->CreateListener(channelMgr, VIDEO_CONTROL_DVC_CHANNEL_NAME, 0,
(IWTSListenerCallback*)callback, &(video->controlListener));
if (status != CHANNEL_RC_OK)
return status;
video->controlListener->pInterface = video->wtsPlugin.pInterface;
video->data_callback = callback =
(VIDEO_LISTENER_CALLBACK*)calloc(1, sizeof(VIDEO_LISTENER_CALLBACK));
if (!callback)
{
WLog_ERR(TAG, "calloc for data callback failed!");
return CHANNEL_RC_NO_MEMORY;
}
callback->iface.OnNewChannelConnection = video_data_on_new_channel_connection;
callback->plugin = plugin;
callback->channel_mgr = channelMgr;
status = channelMgr->CreateListener(channelMgr, VIDEO_DATA_DVC_CHANNEL_NAME, 0,
(IWTSListenerCallback*)callback, &(video->dataListener));
if (status == CHANNEL_RC_OK)
video->dataListener->pInterface = video->wtsPlugin.pInterface;
return status;
} | 0 |
mstdlib | db124b8f607dd0a40a9aef2d4d468fad433522a7 | NOT_APPLICABLE | NOT_APPLICABLE | static M_fs_error_t M_fs_delete_file(const char *path)
{
if (!DeleteFile(path)) {
return M_fs_error_from_syserr(GetLastError());
}
return M_FS_ERROR_SUCCESS;
}
| 0 |
qemu | 98a8cc741dad9cb4738f81a994bcf8d77d619152 | NOT_APPLICABLE | NOT_APPLICABLE | static void zynq_slcr_init(Object *obj)
{
ZynqSLCRState *s = ZYNQ_SLCR(obj);
memory_region_init_io(&s->iomem, obj, &slcr_ops, s, "slcr",
ZYNQ_SLCR_MMIO_SIZE);
sysbus_init_mmio(SYS_BUS_DEVICE(obj), &s->iomem);
qdev_init_clocks(DEVICE(obj), zynq_slcr_clocks);
} | 0 |
Chrome | 5f8761dd073c4ddd3b5aea8d95a2717e7b6e36e5 | NOT_APPLICABLE | NOT_APPLICABLE | size_t GLES2Util::GetComponentCountForGLTransformType(uint32_t type) {
switch (type) {
case GL_TRANSLATE_X_CHROMIUM:
case GL_TRANSLATE_Y_CHROMIUM:
return 1;
case GL_TRANSLATE_2D_CHROMIUM:
return 2;
case GL_TRANSLATE_3D_CHROMIUM:
return 3;
case GL_AFFINE_2D_CHROMIUM:
case GL_TRANSPOSE_AFFINE_2D_CHROMIUM:
return 6;
case GL_AFFINE_3D_CHROMIUM:
case GL_TRANSPOSE_AFFINE_3D_CHROMIUM:
return 12;
default:
return 0;
}
}
| 0 |
linux | d5aa407f59f5b83d2c50ec88f5bf56d40f1f8978 | NOT_APPLICABLE | NOT_APPLICABLE | ip6_tnl_bucket(struct ip6_tnl_net *ip6n, struct ip6_tnl_parm *p)
{
struct in6_addr *remote = &p->raddr;
struct in6_addr *local = &p->laddr;
unsigned h = 0;
int prio = 0;
if (!ipv6_addr_any(remote) || !ipv6_addr_any(local)) {
prio = 1;
h = HASH(remote) ^ HASH(local);
}
return &ip6n->tnls[prio][h];
}
| 0 |
busybox | 352f79acbd759c14399e39baef21fc4ffe180ac2 | NOT_APPLICABLE | NOT_APPLICABLE | static NOINLINE int send_decline(/*uint32_t xid,*/ uint32_t server, uint32_t requested)
{
struct dhcp_packet packet;
/* Fill in: op, htype, hlen, cookie, chaddr, random xid fields,
* client-id option (unless -C), message type option:
*/
init_packet(&packet, DHCPDECLINE);
#if 0
/* RFC 2131 says DHCPDECLINE's xid is randomly selected by client,
* but in case the server is buggy and wants DHCPDECLINE's xid
* to match the xid which started entire handshake,
* we use the same xid we used in initial DHCPDISCOVER:
*/
packet.xid = xid;
#endif
/* DHCPDECLINE uses "requested ip", not ciaddr, to store offered IP */
udhcp_add_simple_option(&packet, DHCP_REQUESTED_IP, requested);
udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server);
bb_info_msg("Sending decline...");
return raw_bcast_from_client_config_ifindex(&packet);
}
| 0 |
samba | 2632e8ebae826a7305fe7d3948ee28b77d2ffbc0 | NOT_APPLICABLE | NOT_APPLICABLE | static void dnsserver_reload_zones(struct dnsserver_state *dsstate)
{
struct dnsserver_partition *p;
struct dnsserver_zone *zones, *z, *znext, *zmatch;
struct dnsserver_zone *old_list, *new_list;
old_list = dsstate->zones;
new_list = NULL;
for (p = dsstate->partitions; p; p = p->next) {
zones = dnsserver_db_enumerate_zones(dsstate, dsstate->samdb, p);
if (zones == NULL) {
continue;
}
for (z = zones; z; ) {
znext = z->next;
zmatch = dnsserver_find_zone(old_list, z->name);
if (zmatch == NULL) {
/* Missing zone */
z->zoneinfo = dnsserver_init_zoneinfo(z, dsstate->serverinfo);
if (z->zoneinfo == NULL) {
continue;
}
DLIST_ADD_END(new_list, z);
p->zones_count++;
dsstate->zones_count++;
} else {
/* Existing zone */
talloc_free(z);
DLIST_REMOVE(old_list, zmatch);
DLIST_ADD_END(new_list, zmatch);
}
z = znext;
}
}
if (new_list == NULL) {
return;
}
/* Deleted zones */
for (z = old_list; z; ) {
znext = z->next;
z->partition->zones_count--;
dsstate->zones_count--;
talloc_free(z);
z = znext;
}
dsstate->zones = new_list;
} | 0 |
linux | b799207e1e1816b09e7a5920fbb2d5fcf6edd681 | NOT_APPLICABLE | NOT_APPLICABLE | static int check_ld_abs(struct bpf_verifier_env *env, struct bpf_insn *insn)
{
struct bpf_reg_state *regs = cur_regs(env);
u8 mode = BPF_MODE(insn->code);
int i, err;
if (!may_access_skb(env->prog->type)) {
verbose(env, "BPF_LD_[ABS|IND] instructions not allowed for this program type\n");
return -EINVAL;
}
if (!env->ops->gen_ld_abs) {
verbose(env, "bpf verifier is misconfigured\n");
return -EINVAL;
}
if (env->subprog_cnt > 1) {
/* when program has LD_ABS insn JITs and interpreter assume
* that r1 == ctx == skb which is not the case for callees
* that can have arbitrary arguments. It's problematic
* for main prog as well since JITs would need to analyze
* all functions in order to make proper register save/restore
* decisions in the main prog. Hence disallow LD_ABS with calls
*/
verbose(env, "BPF_LD_[ABS|IND] instructions cannot be mixed with bpf-to-bpf calls\n");
return -EINVAL;
}
if (insn->dst_reg != BPF_REG_0 || insn->off != 0 ||
BPF_SIZE(insn->code) == BPF_DW ||
(mode == BPF_ABS && insn->src_reg != BPF_REG_0)) {
verbose(env, "BPF_LD_[ABS|IND] uses reserved fields\n");
return -EINVAL;
}
/* check whether implicit source operand (register R6) is readable */
err = check_reg_arg(env, BPF_REG_6, SRC_OP);
if (err)
return err;
if (regs[BPF_REG_6].type != PTR_TO_CTX) {
verbose(env,
"at the time of BPF_LD_ABS|IND R6 != pointer to skb\n");
return -EINVAL;
}
if (mode == BPF_IND) {
/* check explicit source operand */
err = check_reg_arg(env, insn->src_reg, SRC_OP);
if (err)
return err;
}
/* reset caller saved regs to unreadable */
for (i = 0; i < CALLER_SAVED_REGS; i++) {
mark_reg_not_init(env, regs, caller_saved[i]);
check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK);
}
/* mark destination R0 register as readable, since it contains
* the value fetched from the packet.
* Already marked as written above.
*/
mark_reg_unknown(env, regs, BPF_REG_0);
return 0;
}
| 0 |
Android | 308396a55280f69ad4112d4f9892f4cbeff042aa | NOT_APPLICABLE | NOT_APPLICABLE | xmlHaltParser(xmlParserCtxtPtr ctxt) {
if (ctxt == NULL)
return;
ctxt->instate = XML_PARSER_EOF;
ctxt->disableSAX = 1;
if (ctxt->input != NULL) {
/*
* in case there was a specific allocation deallocate before
* overriding base
*/
if (ctxt->input->free != NULL) {
ctxt->input->free((xmlChar *) ctxt->input->base);
ctxt->input->free = NULL;
}
ctxt->input->cur = BAD_CAST"";
ctxt->input->base = ctxt->input->cur;
}
}
| 0 |
linux | f5364c150aa645b3d7daa21b5c0b9feaa1c9cd6d | NOT_APPLICABLE | NOT_APPLICABLE | static bool dl_param_changed(struct task_struct *p,
const struct sched_attr *attr)
{
struct sched_dl_entity *dl_se = &p->dl;
if (dl_se->dl_runtime != attr->sched_runtime ||
dl_se->dl_deadline != attr->sched_deadline ||
dl_se->dl_period != attr->sched_period ||
dl_se->flags != attr->sched_flags)
return true;
return false;
}
| 0 |
FFmpeg | e6d3fd942f772f54ab6a5ca619cdaadef26b7702 | NOT_APPLICABLE | NOT_APPLICABLE | static int mov_add_tfra_entries(AVIOContext *pb, MOVMuxContext *mov, int tracks,
int size)
{
int i;
for (i = 0; i < mov->nb_streams; i++) {
MOVTrack *track = &mov->tracks[i];
MOVFragmentInfo *info;
if ((tracks >= 0 && i != tracks) || !track->entry)
continue;
track->nb_frag_info++;
if (track->nb_frag_info >= track->frag_info_capacity) {
unsigned new_capacity = track->nb_frag_info + MOV_FRAG_INFO_ALLOC_INCREMENT;
if (av_reallocp_array(&track->frag_info,
new_capacity,
sizeof(*track->frag_info)))
return AVERROR(ENOMEM);
track->frag_info_capacity = new_capacity;
}
info = &track->frag_info[track->nb_frag_info - 1];
info->offset = avio_tell(pb);
info->size = size;
// Try to recreate the original pts for the first packet
// from the fields we have stored
info->time = track->start_dts + track->frag_start +
track->cluster[0].cts;
info->duration = track->end_pts -
(track->cluster[0].dts + track->cluster[0].cts);
// If the pts is less than zero, we will have trimmed
// away parts of the media track using an edit list,
// and the corresponding start presentation time is zero.
if (info->time < 0) {
info->duration += info->time;
info->time = 0;
}
info->tfrf_offset = 0;
mov_write_tfrf_tags(pb, mov, track);
}
return 0;
} | 0 |
exim | d12746bc15d83ab821be36975da0179672708bc1 | NOT_APPLICABLE | NOT_APPLICABLE | par_read_pipe(int poffset, BOOL eop)
{
host_item *h;
pardata *p = parlist + poffset;
address_item *addrlist = p->addrlist;
address_item *addr = p->addr;
pid_t pid = p->pid;
int fd = p->fd;
uschar *msg = p->msg;
BOOL done = p->done;
/* Loop through all items, reading from the pipe when necessary. The pipe
used to be non-blocking. But I do not see a reason for using non-blocking I/O
here, as the preceding select() tells us, if data is available for reading.
A read() on a "selected" handle should never block, but(!) it may return
less data then we expected. (The buffer size we pass to read() shouldn't be
understood as a "request", but as a "limit".)
Each separate item is written to the pipe in a timely manner. But, especially for
larger items, the read(2) may already return partial data from the write(2).
The write is atomic mostly (depending on the amount written), but atomic does
not imply "all or noting", it just is "not intermixed" with other writes on the
same channel (pipe).
*/
DEBUG(D_deliver) debug_printf("reading pipe for subprocess %d (%s)\n",
(int)p->pid, eop? "ended" : "not ended yet");
while (!done)
{
retry_item *r, **rp;
uschar pipeheader[PIPE_HEADER_SIZE+1];
uschar *id = &pipeheader[0];
uschar *subid = &pipeheader[1];
uschar *ptr = big_buffer;
size_t required = PIPE_HEADER_SIZE; /* first the pipehaeder, later the data */
ssize_t got;
DEBUG(D_deliver) debug_printf(
"expect %lu bytes (pipeheader) from tpt process %d\n", (u_long)required, pid);
/* We require(!) all the PIPE_HEADER_SIZE bytes here, as we know,
they're written in a timely manner, so waiting for the write shouldn't hurt a lot.
If we get less, we can assume the subprocess do be done and do not expect any further
information from it. */
if ((got = readn(fd, pipeheader, required)) != required)
{
msg = string_sprintf("got " SSIZE_T_FMT " of %d bytes (pipeheader) "
"from transport process %d for transport %s",
got, PIPE_HEADER_SIZE, pid, addr->transport->driver_name);
done = TRUE;
break;
}
pipeheader[PIPE_HEADER_SIZE] = '\0';
DEBUG(D_deliver)
debug_printf("got %ld bytes (pipeheader) from transport process %d\n",
(long) got, pid);
{
/* If we can't decode the pipeheader, the subprocess seems to have a
problem, we do not expect any furher information from it. */
char *endc;
required = Ustrtol(pipeheader+2, &endc, 10);
if (*endc)
{
msg = string_sprintf("failed to read pipe "
"from transport process %d for transport %s: error decoding size from header",
pid, addr->transport->driver_name);
done = TRUE;
break;
}
}
DEBUG(D_deliver)
debug_printf("expect %lu bytes (pipedata) from transport process %d\n",
(u_long)required, pid);
/* Same as above, the transport process will write the bytes announced
in a timely manner, so we can just wait for the bytes, getting less than expected
is considered a problem of the subprocess, we do not expect anything else from it. */
if ((got = readn(fd, big_buffer, required)) != required)
{
msg = string_sprintf("got only " SSIZE_T_FMT " of " SIZE_T_FMT
" bytes (pipedata) from transport process %d for transport %s",
got, required, pid, addr->transport->driver_name);
done = TRUE;
break;
}
/* Handle each possible type of item, assuming the complete item is
available in store. */
switch (*id)
{
/* Host items exist only if any hosts were marked unusable. Match
up by checking the IP address. */
case 'H':
for (h = addrlist->host_list; h; h = h->next)
{
if (!h->address || Ustrcmp(h->address, ptr+2) != 0) continue;
h->status = ptr[0];
h->why = ptr[1];
}
ptr += 2;
while (*ptr++);
break;
/* Retry items are sent in a preceding R item for each address. This is
kept separate to keep each message short enough to guarantee it won't
be split in the pipe. Hopefully, in the majority of cases, there won't in
fact be any retry items at all.
The complete set of retry items might include an item to delete a
routing retry if there was a previous routing delay. However, routing
retries are also used when a remote transport identifies an address error.
In that case, there may also be an "add" item for the same key. Arrange
that a "delete" item is dropped in favour of an "add" item. */
case 'R':
if (!addr) goto ADDR_MISMATCH;
DEBUG(D_deliver|D_retry)
debug_printf("reading retry information for %s from subprocess\n",
ptr+1);
/* Cut out any "delete" items on the list. */
for (rp = &addr->retries; (r = *rp); rp = &r->next)
if (Ustrcmp(r->key, ptr+1) == 0) /* Found item with same key */
{
if (!(r->flags & rf_delete)) break; /* It was not "delete" */
*rp = r->next; /* Excise a delete item */
DEBUG(D_deliver|D_retry)
debug_printf(" existing delete item dropped\n");
}
/* We want to add a delete item only if there is no non-delete item;
however we still have to step ptr through the data. */
if (!r || !(*ptr & rf_delete))
{
r = store_get(sizeof(retry_item));
r->next = addr->retries;
addr->retries = r;
r->flags = *ptr++;
r->key = string_copy(ptr);
while (*ptr++);
memcpy(&r->basic_errno, ptr, sizeof(r->basic_errno));
ptr += sizeof(r->basic_errno);
memcpy(&r->more_errno, ptr, sizeof(r->more_errno));
ptr += sizeof(r->more_errno);
r->message = *ptr ? string_copy(ptr) : NULL;
DEBUG(D_deliver|D_retry) debug_printf(" added %s item\n",
r->flags & rf_delete ? "delete" : "retry");
}
else
{
DEBUG(D_deliver|D_retry)
debug_printf(" delete item not added: non-delete item exists\n");
ptr++;
while(*ptr++);
ptr += sizeof(r->basic_errno) + sizeof(r->more_errno);
}
while(*ptr++);
break;
/* Put the amount of data written into the parlist block */
case 'S':
memcpy(&(p->transport_count), ptr, sizeof(transport_count));
ptr += sizeof(transport_count);
break;
/* Address items are in the order of items on the address chain. We
remember the current address value in case this function is called
several times to empty the pipe in stages. Information about delivery
over TLS is sent in a preceding X item for each address. We don't put
it in with the other info, in order to keep each message short enough to
guarantee it won't be split in the pipe. */
#ifdef SUPPORT_TLS
case 'X':
if (!addr) goto ADDR_MISMATCH; /* Below, in 'A' handler */
switch (*subid)
{
case '1':
addr->cipher = NULL;
addr->peerdn = NULL;
if (*ptr)
addr->cipher = string_copy(ptr);
while (*ptr++);
if (*ptr)
addr->peerdn = string_copy(ptr);
break;
case '2':
if (*ptr)
(void) tls_import_cert(ptr, &addr->peercert);
else
addr->peercert = NULL;
break;
case '3':
if (*ptr)
(void) tls_import_cert(ptr, &addr->ourcert);
else
addr->ourcert = NULL;
break;
# ifndef DISABLE_OCSP
case '4':
addr->ocsp = *ptr ? *ptr - '0' : OCSP_NOT_REQ;
break;
# endif
}
while (*ptr++);
break;
#endif /*SUPPORT_TLS*/
case 'C': /* client authenticator information */
switch (*subid)
{
case '1': addr->authenticator = *ptr ? string_copy(ptr) : NULL; break;
case '2': addr->auth_id = *ptr ? string_copy(ptr) : NULL; break;
case '3': addr->auth_sndr = *ptr ? string_copy(ptr) : NULL; break;
}
while (*ptr++);
break;
#ifndef DISABLE_PRDR
case 'P':
setflag(addr, af_prdr_used);
break;
#endif
case 'L':
switch (*subid)
{
#ifdef EXPERIMENTAL_PIPE_CONNECT
case 2: setflag(addr, af_early_pipe); /*FALLTHROUGH*/
#endif
case 1: setflag(addr, af_pipelining); break;
}
break;
case 'K':
setflag(addr, af_chunking_used);
break;
case 'T':
setflag(addr, af_tcp_fastopen_conn);
if (*subid > '0') setflag(addr, af_tcp_fastopen);
if (*subid > '1') setflag(addr, af_tcp_fastopen_data);
break;
case 'D':
if (!addr) goto ADDR_MISMATCH;
memcpy(&(addr->dsn_aware), ptr, sizeof(addr->dsn_aware));
ptr += sizeof(addr->dsn_aware);
DEBUG(D_deliver) debug_printf("DSN read: addr->dsn_aware = %d\n", addr->dsn_aware);
break;
case 'A':
if (!addr)
{
ADDR_MISMATCH:
msg = string_sprintf("address count mismatch for data read from pipe "
"for transport process %d for transport %s", pid,
addrlist->transport->driver_name);
done = TRUE;
break;
}
switch (*subid)
{
#ifdef SUPPORT_SOCKS
case '2': /* proxy information; must arrive before A0 and applies to that addr XXX oops*/
proxy_session = TRUE; /*XXX should this be cleared somewhere? */
if (*ptr == 0)
ptr++;
else
{
proxy_local_address = string_copy(ptr);
while(*ptr++);
memcpy(&proxy_local_port, ptr, sizeof(proxy_local_port));
ptr += sizeof(proxy_local_port);
}
break;
#endif
#ifdef EXPERIMENTAL_DSN_INFO
case '1': /* must arrive before A0, and applies to that addr */
/* Two strings: smtp_greeting and helo_response */
addr->smtp_greeting = string_copy(ptr);
while(*ptr++);
addr->helo_response = string_copy(ptr);
while(*ptr++);
break;
#endif
case '0':
DEBUG(D_deliver) debug_printf("A0 %s tret %d\n", addr->address, *ptr);
addr->transport_return = *ptr++;
addr->special_action = *ptr++;
memcpy(&addr->basic_errno, ptr, sizeof(addr->basic_errno));
ptr += sizeof(addr->basic_errno);
memcpy(&addr->more_errno, ptr, sizeof(addr->more_errno));
ptr += sizeof(addr->more_errno);
memcpy(&addr->delivery_usec, ptr, sizeof(addr->delivery_usec));
ptr += sizeof(addr->delivery_usec);
memcpy(&addr->flags, ptr, sizeof(addr->flags));
ptr += sizeof(addr->flags);
addr->message = *ptr ? string_copy(ptr) : NULL;
while(*ptr++);
addr->user_message = *ptr ? string_copy(ptr) : NULL;
while(*ptr++);
/* Always two strings for host information, followed by the port number and DNSSEC mark */
if (*ptr)
{
h = store_get(sizeof(host_item));
h->name = string_copy(ptr);
while (*ptr++);
h->address = string_copy(ptr);
while(*ptr++);
memcpy(&h->port, ptr, sizeof(h->port));
ptr += sizeof(h->port);
h->dnssec = *ptr == '2' ? DS_YES
: *ptr == '1' ? DS_NO
: DS_UNK;
ptr++;
addr->host_used = h;
}
else ptr++;
/* Finished with this address */
addr = addr->next;
break;
}
break;
/* Local interface address/port */
case 'I':
if (*ptr) sending_ip_address = string_copy(ptr);
while (*ptr++) ;
if (*ptr) sending_port = atoi(CS ptr);
while (*ptr++) ;
break;
/* Z marks the logical end of the data. It is followed by '0' if
continue_transport was NULL at the end of transporting, otherwise '1'.
We need to know when it becomes NULL during a delivery down a passed SMTP
channel so that we don't try to pass anything more down it. Of course, for
most normal messages it will remain NULL all the time. */
case 'Z':
if (*ptr == '0')
{
continue_transport = NULL;
continue_hostname = NULL;
}
done = TRUE;
DEBUG(D_deliver) debug_printf("Z0%c item read\n", *ptr);
break;
/* Anything else is a disaster. */
default:
msg = string_sprintf("malformed data (%d) read from pipe for transport "
"process %d for transport %s", ptr[-1], pid,
addr->transport->driver_name);
done = TRUE;
break;
}
}
/* The done flag is inspected externally, to determine whether or not to
call the function again when the process finishes. */
p->done = done;
/* If the process hadn't finished, and we haven't seen the end of the data
or if we suffered a disaster, update the rest of the state, and return FALSE to
indicate "not finished". */
if (!eop && !done)
{
p->addr = addr;
p->msg = msg;
return FALSE;
}
/* Close our end of the pipe, to prevent deadlock if the far end is still
pushing stuff into it. */
(void)close(fd);
p->fd = -1;
/* If we have finished without error, but haven't had data for every address,
something is wrong. */
if (!msg && addr)
msg = string_sprintf("insufficient address data read from pipe "
"for transport process %d for transport %s", pid,
addr->transport->driver_name);
/* If an error message is set, something has gone wrong in getting back
the delivery data. Put the message into each address and freeze it. */
if (msg)
for (addr = addrlist; addr; addr = addr->next)
{
addr->transport_return = DEFER;
addr->special_action = SPECIAL_FREEZE;
addr->message = msg;
log_write(0, LOG_MAIN|LOG_PANIC, "Delivery status for %s: %s\n", addr->address, addr->message);
}
/* Return TRUE to indicate we have got all we need from this process, even
if it hasn't actually finished yet. */
return TRUE;
} | 0 |
linux | d974baa398f34393db76be45f7d4d04fbdbb4a0a | NOT_APPLICABLE | NOT_APPLICABLE | static ulong vmx_read_guest_seg_base(struct vcpu_vmx *vmx, unsigned seg)
{
ulong *p = &vmx->segment_cache.seg[seg].base;
if (!vmx_segment_cache_test_set(vmx, seg, SEG_FIELD_BASE))
*p = vmcs_readl(kvm_vmx_segment_fields[seg].base);
return *p;
}
| 0 |
tcpdump | 0f95d441e4b5d7512cc5c326c8668a120e048eda | NOT_APPLICABLE | NOT_APPLICABLE | handle_ppp(netdissect_options *ndo,
u_int proto, const u_char *p, int length)
{
if ((proto & 0xff00) == 0x7e00) { /* is this an escape code ? */
ppp_hdlc(ndo, p - 1, length);
return;
}
switch (proto) {
case PPP_LCP: /* fall through */
case PPP_IPCP:
case PPP_OSICP:
case PPP_MPLSCP:
case PPP_IPV6CP:
case PPP_CCP:
case PPP_BACP:
handle_ctrl_proto(ndo, proto, p, length);
break;
case PPP_ML:
handle_mlppp(ndo, p, length);
break;
case PPP_CHAP:
handle_chap(ndo, p, length);
break;
case PPP_PAP:
handle_pap(ndo, p, length);
break;
case PPP_BAP: /* XXX: not yet completed */
handle_bap(ndo, p, length);
break;
case ETHERTYPE_IP: /*XXX*/
case PPP_VJNC:
case PPP_IP:
ip_print(ndo, p, length);
break;
case ETHERTYPE_IPV6: /*XXX*/
case PPP_IPV6:
ip6_print(ndo, p, length);
break;
case ETHERTYPE_IPX: /*XXX*/
case PPP_IPX:
ipx_print(ndo, p, length);
break;
case PPP_OSI:
isoclns_print(ndo, p, length, length);
break;
case PPP_MPLS_UCAST:
case PPP_MPLS_MCAST:
mpls_print(ndo, p, length);
break;
case PPP_COMP:
ND_PRINT((ndo, "compressed PPP data"));
break;
default:
ND_PRINT((ndo, "%s ", tok2str(ppptype2str, "unknown PPP protocol (0x%04x)", proto)));
print_unknown_data(ndo, p, "\n\t", length);
break;
}
}
| 0 |
ghostscript | 241d91112771a6104de10b3948c3f350d6690c1d | NOT_APPLICABLE | NOT_APPLICABLE | gs_push_real(gs_main_instance * minst, double value)
{
ref vref;
make_real(&vref, value);
return push_value(minst, &vref);
}
| 0 |
php-src | 780ff63c377dc79de2c04d6b341913ab0102135b | NOT_APPLICABLE | NOT_APPLICABLE | int XMLRPC_GetValueStringLen(XMLRPC_VALUE value) {
return ((value) ? value->str.len : 0);
} | 0 |
postgres | 31400a673325147e1205326008e32135a78b4d8a | NOT_APPLICABLE | NOT_APPLICABLE | on_ppath(PG_FUNCTION_ARGS)
{
Point *pt = PG_GETARG_POINT_P(0);
PATH *path = PG_GETARG_PATH_P(1);
int i,
n;
double a,
b;
/*-- OPEN --*/
if (!path->closed)
{
n = path->npts - 1;
a = point_dt(pt, &path->p[0]);
for (i = 0; i < n; i++)
{
b = point_dt(pt, &path->p[i + 1]);
if (FPeq(a + b,
point_dt(&path->p[i], &path->p[i + 1])))
PG_RETURN_BOOL(true);
a = b;
}
PG_RETURN_BOOL(false);
}
/*-- CLOSED --*/
PG_RETURN_BOOL(point_inside(pt, path->npts, path->p) != 0);
}
| 0 |
spice | ca5bbc5692e052159bce1a75f55dc60b36078749 | NOT_APPLICABLE | NOT_APPLICABLE | static void pthreads_locking_callback(int mode, int type, const char *file, int line)
{
if (mode & CRYPTO_LOCK) {
pthread_mutex_lock(&(lock_cs[type]));
} else {
pthread_mutex_unlock(&(lock_cs[type]));
}
} | 0 |
libgd | 40bec0f38f50e8510f5bb71a82f516d46facde03 | NOT_APPLICABLE | NOT_APPLICABLE | BGD_DECLARE(void *) gdImageWebpPtrEx (gdImagePtr im, int *size, int quality)
{
void *rv;
gdIOCtx *out = gdNewDynamicCtx(2048, NULL);
if (out == NULL) {
return NULL;
}
gdImageWebpCtx(im, out, quality);
rv = gdDPExtractData(out, size);
out->gd_free(out);
return rv;
}
| 0 |
rsyslog | 0381a0de64a5a048c3d48b79055bd9848d0c7fc2 | NOT_APPLICABLE | NOT_APPLICABLE | processDataRcvd(ptcpsess_t *const __restrict__ pThis,
char **buff,
const int buffLen,
struct syslogTime *stTime,
const time_t ttGenTime,
multi_submit_t *pMultiSub,
unsigned *const __restrict__ pnMsgs)
{
DEFiRet;
char c = **buff;
int octatesToCopy, octatesToDiscard;
if(pThis->inputState == eAtStrtFram) {
if(pThis->bSuppOctetFram && isdigit((int) c)) {
pThis->inputState = eInOctetCnt;
pThis->iOctetsRemain = 0;
pThis->eFraming = TCP_FRAMING_OCTET_COUNTING;
} else if(pThis->bSPFramingFix && c == ' ') {
/* Cisco very occasionally sends a SP after a LF, which
* thrashes framing if not taken special care of. Here,
* we permit space *in front of the next frame* and
* ignore it.
*/
FINALIZE;
} else {
pThis->inputState = eInMsg;
pThis->eFraming = TCP_FRAMING_OCTET_STUFFING;
}
}
if(pThis->inputState == eInOctetCnt) {
if(isdigit(c)) {
if(pThis->iOctetsRemain <= 200000000) {
pThis->iOctetsRemain = pThis->iOctetsRemain * 10 + c - '0';
} else {
errmsg.LogError(0, NO_ERRCODE, "Framing Error in received TCP message: "
"frame too large (at least %d%c), change to octet stuffing",
pThis->iOctetsRemain, c);
pThis->eFraming = TCP_FRAMING_OCTET_STUFFING;
pThis->inputState = eInMsg;
}
*(pThis->pMsg + pThis->iMsg++) = c;
} else { /* done with the octet count, so this must be the SP terminator */
DBGPRINTF("TCP Message with octet-counter, size %d.\n", pThis->iOctetsRemain);
if(c != ' ') {
errmsg.LogError(0, NO_ERRCODE, "Framing Error in received TCP message: "
"delimiter is not SP but has ASCII value %d.", c);
}
if(pThis->iOctetsRemain < 1) {
/* TODO: handle the case where the octet count is 0! */
errmsg.LogError(0, NO_ERRCODE, "Framing Error in received TCP message: "
"invalid octet count %d.", pThis->iOctetsRemain);
pThis->eFraming = TCP_FRAMING_OCTET_STUFFING;
} else if(pThis->iOctetsRemain > iMaxLine) {
/* while we can not do anything against it, we can at least log an indication
* that something went wrong) -- rgerhards, 2008-03-14
*/
DBGPRINTF("truncating message with %d octets - max msg size is %d\n",
pThis->iOctetsRemain, iMaxLine);
errmsg.LogError(0, NO_ERRCODE, "received oversize message: size is %d bytes, "
"max msg size is %d, truncating...", pThis->iOctetsRemain, iMaxLine);
}
pThis->inputState = eInMsg;
pThis->iMsg = 0;
}
} else {
assert(pThis->inputState == eInMsg);
if (pThis->eFraming == TCP_FRAMING_OCTET_STUFFING) {
if(pThis->iMsg >= iMaxLine) {
/* emergency, we now need to flush, no matter if we are at end of message or not... */
int i = 1;
char currBuffChar;
while(i < buffLen && ((currBuffChar = (*buff)[i]) != '\n'
&& (pThis->pLstn->pSrv->iAddtlFrameDelim == TCPSRV_NO_ADDTL_DELIMITER
|| currBuffChar != pThis->pLstn->pSrv->iAddtlFrameDelim))) {
i++;
}
LogError(0, NO_ERRCODE, "error: message received is at least %d byte larger than max msg"
" size; message will be split starting at: \"%.*s\"\n", i, (i < 32) ? i : 32, *buff);
doSubmitMsg(pThis, stTime, ttGenTime, pMultiSub);
++(*pnMsgs);
/* we might think if it is better to ignore the rest of the
* message than to treat it as a new one. Maybe this is a good
* candidate for a configuration parameter...
* rgerhards, 2006-12-04
*/
}
if ((c == '\n')
|| ((pThis->pLstn->pSrv->iAddtlFrameDelim != TCPSRV_NO_ADDTL_DELIMITER)
&& (c == pThis->pLstn->pSrv->iAddtlFrameDelim))
) { /* record delimiter? */
doSubmitMsg(pThis, stTime, ttGenTime, pMultiSub);
++(*pnMsgs);
pThis->inputState = eAtStrtFram;
} else {
/* IMPORTANT: here we copy the actual frame content to the message - for BOTH framing modes!
* If we have a message that is larger than the max msg size, we truncate it. This is the best
* we can do in light of what the engine supports. -- rgerhards, 2008-03-14
*/
if(pThis->iMsg < iMaxLine) {
*(pThis->pMsg + pThis->iMsg++) = c;
}
}
} else {
assert(pThis->eFraming == TCP_FRAMING_OCTET_COUNTING);
octatesToCopy = pThis->iOctetsRemain;
octatesToDiscard = 0;
if (buffLen < octatesToCopy) {
octatesToCopy = buffLen;
}
if (octatesToCopy + pThis->iMsg > iMaxLine) {
octatesToDiscard = octatesToCopy - (iMaxLine - pThis->iMsg);
octatesToCopy = iMaxLine - pThis->iMsg;
}
memcpy(pThis->pMsg + pThis->iMsg, *buff, octatesToCopy);
pThis->iMsg += octatesToCopy;
pThis->iOctetsRemain -= (octatesToCopy + octatesToDiscard);
*buff += (octatesToCopy + octatesToDiscard - 1);
if (pThis->iOctetsRemain == 0) {
/* we have end of frame! */
doSubmitMsg(pThis, stTime, ttGenTime, pMultiSub);
++(*pnMsgs);
pThis->inputState = eAtStrtFram;
}
}
}
finalize_it:
RETiRet;
} | 0 |
wildmidi | ad6d7cf88d6673167ca1f517248af9409a9f1be1 | NOT_APPLICABLE | NOT_APPLICABLE | void _WM_do_control_data_entry_fine(struct _mdi *mdi,
struct _event_data *data) {
uint8_t ch = data->channel;
int data_tmp;
MIDI_EVENT_DEBUG(__FUNCTION__,ch, data->data.value);
if ((mdi->channel[ch].reg_non == 0)
&& (mdi->channel[ch].reg_data == 0x0000)) { /* Pitch Bend Range */
data_tmp = mdi->channel[ch].pitch_range / 100;
mdi->channel[ch].pitch_range = (data_tmp * 100) + data->data.value;
/* printf("Data Entry Fine: pitch_range: %i\n\r",mdi->channel[ch].pitch_range);*/
/* printf("Data Entry Fine: data: %li\n\r", data->data.value);*/
}
} | 0 |
Chrome | a4150b688a754d3d10d2ca385155b1c95d77d6ae | NOT_APPLICABLE | NOT_APPLICABLE | ScriptValue WebGLRenderingContextBase::getParameter(ScriptState* script_state,
GLenum pname) {
if (isContextLost())
return ScriptValue::CreateNull(script_state);
const int kIntZero = 0;
switch (pname) {
case GL_ACTIVE_TEXTURE:
return GetUnsignedIntParameter(script_state, pname);
case GL_ALIASED_LINE_WIDTH_RANGE:
return GetWebGLFloatArrayParameter(script_state, pname);
case GL_ALIASED_POINT_SIZE_RANGE:
return GetWebGLFloatArrayParameter(script_state, pname);
case GL_ALPHA_BITS:
if (drawing_buffer_->RequiresAlphaChannelToBePreserved())
return WebGLAny(script_state, 0);
return GetIntParameter(script_state, pname);
case GL_ARRAY_BUFFER_BINDING:
return WebGLAny(script_state, bound_array_buffer_.Get());
case GL_BLEND:
return GetBooleanParameter(script_state, pname);
case GL_BLEND_COLOR:
return GetWebGLFloatArrayParameter(script_state, pname);
case GL_BLEND_DST_ALPHA:
return GetUnsignedIntParameter(script_state, pname);
case GL_BLEND_DST_RGB:
return GetUnsignedIntParameter(script_state, pname);
case GL_BLEND_EQUATION_ALPHA:
return GetUnsignedIntParameter(script_state, pname);
case GL_BLEND_EQUATION_RGB:
return GetUnsignedIntParameter(script_state, pname);
case GL_BLEND_SRC_ALPHA:
return GetUnsignedIntParameter(script_state, pname);
case GL_BLEND_SRC_RGB:
return GetUnsignedIntParameter(script_state, pname);
case GL_BLUE_BITS:
return GetIntParameter(script_state, pname);
case GL_COLOR_CLEAR_VALUE:
return GetWebGLFloatArrayParameter(script_state, pname);
case GL_COLOR_WRITEMASK:
return GetBooleanArrayParameter(script_state, pname);
case GL_COMPRESSED_TEXTURE_FORMATS:
return WebGLAny(script_state, DOMUint32Array::Create(
compressed_texture_formats_.data(),
compressed_texture_formats_.size()));
case GL_CULL_FACE:
return GetBooleanParameter(script_state, pname);
case GL_CULL_FACE_MODE:
return GetUnsignedIntParameter(script_state, pname);
case GL_CURRENT_PROGRAM:
return WebGLAny(script_state, current_program_.Get());
case GL_DEPTH_BITS:
if (!framebuffer_binding_ && !CreationAttributes().depth)
return WebGLAny(script_state, kIntZero);
return GetIntParameter(script_state, pname);
case GL_DEPTH_CLEAR_VALUE:
return GetFloatParameter(script_state, pname);
case GL_DEPTH_FUNC:
return GetUnsignedIntParameter(script_state, pname);
case GL_DEPTH_RANGE:
return GetWebGLFloatArrayParameter(script_state, pname);
case GL_DEPTH_TEST:
return GetBooleanParameter(script_state, pname);
case GL_DEPTH_WRITEMASK:
return GetBooleanParameter(script_state, pname);
case GL_DITHER:
return GetBooleanParameter(script_state, pname);
case GL_ELEMENT_ARRAY_BUFFER_BINDING:
return WebGLAny(script_state,
bound_vertex_array_object_->BoundElementArrayBuffer());
case GL_FRAMEBUFFER_BINDING:
return WebGLAny(script_state, framebuffer_binding_.Get());
case GL_FRONT_FACE:
return GetUnsignedIntParameter(script_state, pname);
case GL_GENERATE_MIPMAP_HINT:
return GetUnsignedIntParameter(script_state, pname);
case GL_GREEN_BITS:
return GetIntParameter(script_state, pname);
case GL_IMPLEMENTATION_COLOR_READ_FORMAT:
return GetIntParameter(script_state, pname);
case GL_IMPLEMENTATION_COLOR_READ_TYPE:
return GetIntParameter(script_state, pname);
case GL_LINE_WIDTH:
return GetFloatParameter(script_state, pname);
case GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS:
return GetIntParameter(script_state, pname);
case GL_MAX_CUBE_MAP_TEXTURE_SIZE:
return GetIntParameter(script_state, pname);
case GL_MAX_FRAGMENT_UNIFORM_VECTORS:
return GetIntParameter(script_state, pname);
case GL_MAX_RENDERBUFFER_SIZE:
return GetIntParameter(script_state, pname);
case GL_MAX_TEXTURE_IMAGE_UNITS:
return GetIntParameter(script_state, pname);
case GL_MAX_TEXTURE_SIZE:
return GetIntParameter(script_state, pname);
case GL_MAX_VARYING_VECTORS:
return GetIntParameter(script_state, pname);
case GL_MAX_VERTEX_ATTRIBS:
return GetIntParameter(script_state, pname);
case GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS:
return GetIntParameter(script_state, pname);
case GL_MAX_VERTEX_UNIFORM_VECTORS:
return GetIntParameter(script_state, pname);
case GL_MAX_VIEWPORT_DIMS:
return GetWebGLIntArrayParameter(script_state, pname);
case GL_NUM_SHADER_BINARY_FORMATS:
return GetIntParameter(script_state, pname);
case GL_PACK_ALIGNMENT:
return GetIntParameter(script_state, pname);
case GL_POLYGON_OFFSET_FACTOR:
return GetFloatParameter(script_state, pname);
case GL_POLYGON_OFFSET_FILL:
return GetBooleanParameter(script_state, pname);
case GL_POLYGON_OFFSET_UNITS:
return GetFloatParameter(script_state, pname);
case GL_RED_BITS:
return GetIntParameter(script_state, pname);
case GL_RENDERBUFFER_BINDING:
return WebGLAny(script_state, renderbuffer_binding_.Get());
case GL_RENDERER:
return WebGLAny(script_state, String("WebKit WebGL"));
case GL_SAMPLE_ALPHA_TO_COVERAGE:
return GetBooleanParameter(script_state, pname);
case GL_SAMPLE_BUFFERS:
return GetIntParameter(script_state, pname);
case GL_SAMPLE_COVERAGE:
return GetBooleanParameter(script_state, pname);
case GL_SAMPLE_COVERAGE_INVERT:
return GetBooleanParameter(script_state, pname);
case GL_SAMPLE_COVERAGE_VALUE:
return GetFloatParameter(script_state, pname);
case GL_SAMPLES:
return GetIntParameter(script_state, pname);
case GL_SCISSOR_BOX:
return GetWebGLIntArrayParameter(script_state, pname);
case GL_SCISSOR_TEST:
return GetBooleanParameter(script_state, pname);
case GL_SHADING_LANGUAGE_VERSION:
return WebGLAny(
script_state,
"WebGL GLSL ES 1.0 (" +
String(ContextGL()->GetString(GL_SHADING_LANGUAGE_VERSION)) +
")");
case GL_STENCIL_BACK_FAIL:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_BACK_FUNC:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_BACK_PASS_DEPTH_FAIL:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_BACK_PASS_DEPTH_PASS:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_BACK_REF:
return GetIntParameter(script_state, pname);
case GL_STENCIL_BACK_VALUE_MASK:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_BACK_WRITEMASK:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_BITS:
if (!framebuffer_binding_ && !CreationAttributes().stencil)
return WebGLAny(script_state, kIntZero);
return GetIntParameter(script_state, pname);
case GL_STENCIL_CLEAR_VALUE:
return GetIntParameter(script_state, pname);
case GL_STENCIL_FAIL:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_FUNC:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_PASS_DEPTH_FAIL:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_PASS_DEPTH_PASS:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_REF:
return GetIntParameter(script_state, pname);
case GL_STENCIL_TEST:
return WebGLAny(script_state, stencil_enabled_);
case GL_STENCIL_VALUE_MASK:
return GetUnsignedIntParameter(script_state, pname);
case GL_STENCIL_WRITEMASK:
return GetUnsignedIntParameter(script_state, pname);
case GL_SUBPIXEL_BITS:
return GetIntParameter(script_state, pname);
case GL_TEXTURE_BINDING_2D:
return WebGLAny(
script_state,
texture_units_[active_texture_unit_].texture2d_binding_.Get());
case GL_TEXTURE_BINDING_CUBE_MAP:
return WebGLAny(
script_state,
texture_units_[active_texture_unit_].texture_cube_map_binding_.Get());
case GL_UNPACK_ALIGNMENT:
return GetIntParameter(script_state, pname);
case GC3D_UNPACK_FLIP_Y_WEBGL:
return WebGLAny(script_state, unpack_flip_y_);
case GC3D_UNPACK_PREMULTIPLY_ALPHA_WEBGL:
return WebGLAny(script_state, unpack_premultiply_alpha_);
case GC3D_UNPACK_COLORSPACE_CONVERSION_WEBGL:
return WebGLAny(script_state, unpack_colorspace_conversion_);
case GL_VENDOR:
return WebGLAny(script_state, String("WebKit"));
case GL_VERSION:
return WebGLAny(
script_state,
"WebGL 1.0 (" + String(ContextGL()->GetString(GL_VERSION)) + ")");
case GL_VIEWPORT:
return GetWebGLIntArrayParameter(script_state, pname);
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: // OES_standard_derivatives
if (ExtensionEnabled(kOESStandardDerivativesName) || IsWebGL2OrHigher())
return GetUnsignedIntParameter(script_state,
GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES);
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, OES_standard_derivatives not enabled");
return ScriptValue::CreateNull(script_state);
case WebGLDebugRendererInfo::kUnmaskedRendererWebgl:
if (ExtensionEnabled(kWebGLDebugRendererInfoName))
return WebGLAny(script_state,
String(ContextGL()->GetString(GL_RENDERER)));
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, WEBGL_debug_renderer_info not enabled");
return ScriptValue::CreateNull(script_state);
case WebGLDebugRendererInfo::kUnmaskedVendorWebgl:
if (ExtensionEnabled(kWebGLDebugRendererInfoName))
return WebGLAny(script_state,
String(ContextGL()->GetString(GL_VENDOR)));
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, WEBGL_debug_renderer_info not enabled");
return ScriptValue::CreateNull(script_state);
case GL_VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object
if (ExtensionEnabled(kOESVertexArrayObjectName) || IsWebGL2OrHigher()) {
if (!bound_vertex_array_object_->IsDefaultObject())
return WebGLAny(script_state, bound_vertex_array_object_.Get());
return ScriptValue::CreateNull(script_state);
}
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, OES_vertex_array_object not enabled");
return ScriptValue::CreateNull(script_state);
case GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT: // EXT_texture_filter_anisotropic
if (ExtensionEnabled(kEXTTextureFilterAnisotropicName))
return GetUnsignedIntParameter(script_state,
GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT);
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, EXT_texture_filter_anisotropic not enabled");
return ScriptValue::CreateNull(script_state);
case GL_MAX_COLOR_ATTACHMENTS_EXT: // EXT_draw_buffers BEGIN
if (ExtensionEnabled(kWebGLDrawBuffersName) || IsWebGL2OrHigher())
return WebGLAny(script_state, MaxColorAttachments());
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, WEBGL_draw_buffers not enabled");
return ScriptValue::CreateNull(script_state);
case GL_MAX_DRAW_BUFFERS_EXT:
if (ExtensionEnabled(kWebGLDrawBuffersName) || IsWebGL2OrHigher())
return WebGLAny(script_state, MaxDrawBuffers());
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, WEBGL_draw_buffers not enabled");
return ScriptValue::CreateNull(script_state);
case GL_TIMESTAMP_EXT:
if (ExtensionEnabled(kEXTDisjointTimerQueryName))
return WebGLAny(script_state, 0);
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, EXT_disjoint_timer_query not enabled");
return ScriptValue::CreateNull(script_state);
case GL_GPU_DISJOINT_EXT:
if (ExtensionEnabled(kEXTDisjointTimerQueryName))
return GetBooleanParameter(script_state, GL_GPU_DISJOINT_EXT);
SynthesizeGLError(
GL_INVALID_ENUM, "getParameter",
"invalid parameter name, EXT_disjoint_timer_query not enabled");
return ScriptValue::CreateNull(script_state);
case GL_MAX_VIEWS_OVR:
if (ExtensionEnabled(kOVRMultiview2Name))
return GetIntParameter(script_state, pname);
SynthesizeGLError(GL_INVALID_ENUM, "getParameter",
"invalid parameter name, OVR_multiview2 not enabled");
return ScriptValue::CreateNull(script_state);
default:
if ((ExtensionEnabled(kWebGLDrawBuffersName) || IsWebGL2OrHigher()) &&
pname >= GL_DRAW_BUFFER0_EXT &&
pname < static_cast<GLenum>(GL_DRAW_BUFFER0_EXT + MaxDrawBuffers())) {
GLint value = GL_NONE;
if (framebuffer_binding_)
value = framebuffer_binding_->GetDrawBuffer(pname);
else // emulated backbuffer
value = back_draw_buffer_;
return WebGLAny(script_state, value);
}
SynthesizeGLError(GL_INVALID_ENUM, "getParameter",
"invalid parameter name");
return ScriptValue::CreateNull(script_state);
}
}
| 0 |
gnutls | 21f89efad7014a5ee0debd4cd3d59e27774b29e6 | CVE-2014-3566 | CWE-310 | copy_ciphersuites(gnutls_session_t session,
gnutls_buffer_st * cdata, int add_scsv)
{
int ret;
uint8_t cipher_suites[MAX_CIPHERSUITE_SIZE + 2]; /* allow space for SCSV */
int cipher_suites_size;
size_t init_length = cdata->length;
ret =
_gnutls_supported_ciphersuites(session, cipher_suites,
sizeof(cipher_suites) - 2);
if (ret < 0)
return gnutls_assert_val(ret);
/* Here we remove any ciphersuite that does not conform
* the certificate requested, or to the
* authentication requested (eg SRP).
*/
ret =
_gnutls_remove_unwanted_ciphersuites(session, cipher_suites,
ret, NULL, 0);
if (ret < 0)
return gnutls_assert_val(ret);
/* If no cipher suites were enabled.
*/
if (ret == 0)
return
gnutls_assert_val(GNUTLS_E_INSUFFICIENT_CREDENTIALS);
cipher_suites_size = ret;
if (add_scsv) {
cipher_suites[cipher_suites_size] = 0x00;
cipher_suites[cipher_suites_size + 1] = 0xff;
cipher_suites_size += 2;
ret = _gnutls_ext_sr_send_cs(session);
if (ret < 0)
return gnutls_assert_val(ret);
}
ret =
_gnutls_buffer_append_data_prefix(cdata, 16, cipher_suites,
cipher_suites_size);
if (ret < 0)
return gnutls_assert_val(ret);
ret = cdata->length - init_length;
return ret;
} | 1 |
libarchive | e79ef306afe332faf22e9b442a2c6b59cb175573 | NOT_APPLICABLE | NOT_APPLICABLE | free_decompression(struct archive_read *a, struct _7zip *zip)
{
int r = ARCHIVE_OK;
#if !defined(HAVE_ZLIB_H) &&\
!(defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR))
(void)a;/* UNUSED */
#endif
#ifdef HAVE_LZMA_H
if (zip->lzstream_valid)
lzma_end(&(zip->lzstream));
#endif
#if defined(HAVE_BZLIB_H) && defined(BZ_CONFIG_ERROR)
if (zip->bzstream_valid) {
if (BZ2_bzDecompressEnd(&(zip->bzstream)) != BZ_OK) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Failed to clean up bzip2 decompressor");
r = ARCHIVE_FATAL;
}
zip->bzstream_valid = 0;
}
#endif
#ifdef HAVE_ZLIB_H
if (zip->stream_valid) {
if (inflateEnd(&(zip->stream)) != Z_OK) {
archive_set_error(&a->archive,
ARCHIVE_ERRNO_MISC,
"Failed to clean up zlib decompressor");
r = ARCHIVE_FATAL;
}
zip->stream_valid = 0;
}
#endif
if (zip->ppmd7_valid) {
__archive_ppmd7_functions.Ppmd7_Free(
&zip->ppmd7_context, &g_szalloc);
zip->ppmd7_valid = 0;
}
return (r);
}
| 0 |
libzip | 2217022b7d1142738656d891e00b3d2d9179b796 | NOT_APPLICABLE | NOT_APPLICABLE | _zip_dirent_needs_zip64(const zip_dirent_t *de, zip_flags_t flags)
{
if (de->uncomp_size >= ZIP_UINT32_MAX || de->comp_size >= ZIP_UINT32_MAX
|| ((flags & ZIP_FL_CENTRAL) && de->offset >= ZIP_UINT32_MAX))
return true;
return false;
}
| 0 |
mbedtls | c988f32adde62a169ba340fee0da15aecd40e76e | NOT_APPLICABLE | NOT_APPLICABLE | void ssl_set_cbc_record_splitting( ssl_context *ssl, char split )
{
ssl->split_done = split;
} | 0 |
jasper | d42b2388f7f8e0332c846675133acea151fc557a | NOT_APPLICABLE | NOT_APPLICABLE | static void tcmpt_destroy(jpc_enc_tcmpt_t *tcmpt)
{
jpc_enc_rlvl_t *rlvl;
uint_fast16_t rlvlno;
if (tcmpt->rlvls) {
for (rlvlno = 0, rlvl = tcmpt->rlvls; rlvlno < tcmpt->numrlvls;
++rlvlno, ++rlvl) {
rlvl_destroy(rlvl);
}
jas_free(tcmpt->rlvls);
}
if (tcmpt->data) {
jas_seq2d_destroy(tcmpt->data);
}
if (tcmpt->tsfb) {
jpc_tsfb_destroy(tcmpt->tsfb);
}
}
| 0 |
Chrome | 3a353ebdb7753a3fbeb401c4c0e0f3358ccbb90b | NOT_APPLICABLE | NOT_APPLICABLE | void SetError(MediaError* err) { Media()->MediaEngineError(err); }
| 0 |
Android | 7558d03e6498e970b761aa44fff6b2c659202d95 | NOT_APPLICABLE | NOT_APPLICABLE | bool venc_dev::venc_set_peak_bitrate(OMX_U32 nPeakBitrate)
{
struct v4l2_control control;
int rc = 0;
control.id = V4L2_CID_MPEG_VIDEO_BITRATE_PEAK;
control.value = nPeakBitrate;
DEBUG_PRINT_LOW("venc_set_peak_bitrate: bitrate = %u", (unsigned int)nPeakBitrate);
DEBUG_PRINT_LOW("Calling IOCTL set control for id=%d, val=%d", control.id, control.value);
rc = ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control);
if (rc) {
DEBUG_PRINT_ERROR("Failed to set peak bitrate control");
return false;
}
DEBUG_PRINT_LOW("Success IOCTL set control for id=%d, value=%d", control.id, control.value);
return true;
}
| 0 |
Chrome | 503bea2643350c6378de5f7a268b85cf2480e1ac | NOT_APPLICABLE | NOT_APPLICABLE | void AudioInputRendererHost::OnRecordStream(int stream_id) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
AudioEntry* entry = LookupById(stream_id);
if (!entry) {
SendErrorMessage(stream_id);
return;
}
entry->controller->Record();
}
| 0 |
samba | 22b4091924977f6437b59627f33a8e6f02b41011 | NOT_APPLICABLE | NOT_APPLICABLE | static void samba_extended_info_version(struct smb_extended_info *extended_info)
{
SMB_ASSERT(extended_info != NULL);
extended_info->samba_magic = SAMBA_EXTENDED_INFO_MAGIC;
extended_info->samba_version = ((SAMBA_VERSION_MAJOR & 0xff) << 24)
| ((SAMBA_VERSION_MINOR & 0xff) << 16)
| ((SAMBA_VERSION_RELEASE & 0xff) << 8);
#ifdef SAMBA_VERSION_REVISION
extended_info->samba_version |= (tolower(*SAMBA_VERSION_REVISION) - 'a' + 1) & 0xff;
#endif
extended_info->samba_subversion = 0;
#ifdef SAMBA_VERSION_RC_RELEASE
extended_info->samba_subversion |= (SAMBA_VERSION_RC_RELEASE & 0xff) << 24;
#else
#ifdef SAMBA_VERSION_PRE_RELEASE
extended_info->samba_subversion |= (SAMBA_VERSION_PRE_RELEASE & 0xff) << 16;
#endif
#endif
#ifdef SAMBA_VERSION_VENDOR_PATCH
extended_info->samba_subversion |= (SAMBA_VERSION_VENDOR_PATCH & 0xffff);
#endif
extended_info->samba_gitcommitdate = 0;
#ifdef SAMBA_VERSION_COMMIT_TIME
unix_to_nt_time(&extended_info->samba_gitcommitdate, SAMBA_VERSION_COMMIT_TIME);
#endif
memset(extended_info->samba_version_string, 0,
sizeof(extended_info->samba_version_string));
snprintf (extended_info->samba_version_string,
sizeof(extended_info->samba_version_string),
"%s", samba_version_string());
} | 0 |
curl | 75ca568fa1c19de4c5358fed246686de8467c238 | CVE-2012-0036 | CWE-89 | static CURLcode imap_parse_url_path(struct connectdata *conn)
{
/* the imap struct is already inited in imap_connect() */
struct imap_conn *imapc = &conn->proto.imapc;
struct SessionHandle *data = conn->data;
const char *path = data->state.path;
int len;
if(!*path)
path = "INBOX";
/* url decode the path and use this mailbox */
imapc->mailbox = curl_easy_unescape(data, path, 0, &len);
if(!imapc->mailbox)
return CURLE_OUT_OF_MEMORY;
return CURLE_OK;
}
| 1 |
file-roller | b147281293a8307808475e102a14857055f81631 | NOT_APPLICABLE | NOT_APPLICABLE | _archive_write_file (struct archive *b,
SaveData *save_data,
AddFile *add_file,
gboolean follow_link,
struct archive_entry *r_entry,
GCancellable *cancellable)
{
LoadData *load_data = LOAD_DATA (save_data);
GFileInfo *info;
struct archive_entry *w_entry;
int rb;
/* write the file header */
info = g_file_query_info (add_file->file,
FILE_ATTRIBUTES_NEEDED_BY_ARCHIVE_ENTRY,
(! follow_link ? G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS : 0),
cancellable,
&load_data->error);
if (info == NULL)
return WRITE_ACTION_ABORT;
w_entry = archive_entry_new ();
if (! _archive_entry_copy_file_info (w_entry, info, save_data)) {
archive_entry_free (w_entry);
g_object_unref (info);
return WRITE_ACTION_SKIP_ENTRY;
}
/* honor the update flag */
if (save_data->update && (r_entry != NULL) && (archive_entry_mtime (w_entry) < archive_entry_mtime (r_entry))) {
archive_entry_free (w_entry);
g_object_unref (info);
return WRITE_ACTION_WRITE_ENTRY;
}
archive_entry_set_pathname (w_entry, add_file->pathname);
rb = archive_write_header (b, w_entry);
/* write the file data */
if (g_file_info_get_file_type (info) == G_FILE_TYPE_REGULAR) {
GInputStream *istream;
istream = (GInputStream *) g_file_read (add_file->file, cancellable, &load_data->error);
if (istream != NULL) {
gssize bytes_read;
while ((bytes_read = g_input_stream_read (istream, save_data->buffer, save_data->buffer_size, cancellable, &load_data->error)) > 0) {
archive_write_data (b, save_data->buffer, bytes_read);
fr_archive_progress_inc_completed_bytes (load_data->archive, bytes_read);
}
g_object_unref (istream);
}
}
rb = archive_write_finish_entry (b);
if ((load_data->error == NULL) && (rb != ARCHIVE_OK))
load_data->error = g_error_new_literal (FR_ERROR, FR_ERROR_COMMAND_ERROR, archive_error_string (b));
archive_entry_free (w_entry);
g_object_unref (info);
return (load_data->error == NULL) ? WRITE_ACTION_SKIP_ENTRY : WRITE_ACTION_ABORT;
} | 0 |
LibRaw | d1975cb0e055d2bfe58c9d845c9a3e57c346a2f9 | NOT_APPLICABLE | NOT_APPLICABLE | const char *libraw_strprogress(enum LibRaw_progress p)
{
return LibRaw::strprogress(p);
} | 0 |
Chrome | 7da6c3419fd172405bcece1ae4ec6ec8316cd345 | NOT_APPLICABLE | NOT_APPLICABLE | void SimulateGestureScrollUpdateEvent(float dX, float dY, int modifiers) {
SimulateGestureEventCore(SyntheticWebGestureEventBuilder::BuildScrollUpdate(
dX, dY, modifiers, blink::kWebGestureDeviceTouchscreen));
}
| 0 |
gpac | 2da2f68bffd51d89b1d272d22aa8cc023c1c066e | NOT_APPLICABLE | NOT_APPLICABLE | GF_Err stbl_GetSampleRAP(GF_SyncSampleBox *stss, u32 SampleNumber, GF_ISOSAPType *IsRAP, u32 *prevRAP, u32 *nextRAP)
{
u32 i;
if (prevRAP) *prevRAP = 0;
if (nextRAP) *nextRAP = 0;
(*IsRAP) = RAP_NO;
if (!stss || !SampleNumber) return GF_BAD_PARAM;
if (stss->r_LastSyncSample && (stss->r_LastSyncSample < SampleNumber) ) {
i = stss->r_LastSampleIndex;
} else {
i = 0;
}
for (; i < stss->nb_entries; i++) {
//get the entry
if (stss->sampleNumbers[i] == SampleNumber) {
//update the cache
stss->r_LastSyncSample = SampleNumber;
stss->r_LastSampleIndex = i;
(*IsRAP) = RAP;
}
else if (stss->sampleNumbers[i] > SampleNumber) {
if (nextRAP) *nextRAP = stss->sampleNumbers[i];
return GF_OK;
}
if (prevRAP) *prevRAP = stss->sampleNumbers[i];
}
return GF_OK;
} | 0 |
pacemaker | 564f7cc2a51dcd2f28ab12a13394f31be5aa3c93 | NOT_APPLICABLE | NOT_APPLICABLE | mainloop_gio_callback(GIOChannel *gio, GIOCondition condition, gpointer data)
{
gboolean keep = TRUE;
mainloop_io_t *client = data;
if(condition & G_IO_IN) {
if(client->ipc) {
long rc = 0;
int max = 10;
do {
rc = crm_ipc_read(client->ipc);
if(rc <= 0) {
crm_trace("Message acquisition from %s[%p] failed: %s (%ld)",
client->name, client, pcmk_strerror(rc), rc);
} else if(client->dispatch_fn_ipc) {
const char *buffer = crm_ipc_buffer(client->ipc);
crm_trace("New message from %s[%p] = %d", client->name, client, rc, condition);
if(client->dispatch_fn_ipc(buffer, rc, client->userdata) < 0) {
crm_trace("Connection to %s no longer required", client->name);
keep = FALSE;
}
}
} while(keep && rc > 0 && --max > 0);
} else {
crm_trace("New message from %s[%p]", client->name, client);
if(client->dispatch_fn_io) {
if(client->dispatch_fn_io(client->userdata) < 0) {
crm_trace("Connection to %s no longer required", client->name);
keep = FALSE;
}
}
}
}
if(client->ipc && crm_ipc_connected(client->ipc) == FALSE) {
crm_err("Connection to %s[%p] closed (I/O condition=%d)", client->name, client, condition);
keep = FALSE;
} else if(condition & (G_IO_HUP|G_IO_NVAL|G_IO_ERR)) {
crm_trace("The connection %s[%p] has been closed (I/O condition=%d, refcount=%d)",
client->name, client, condition, mainloop_gio_refcount(client));
keep = FALSE;
} else if((condition & G_IO_IN) == 0) {
/*
#define GLIB_SYSDEF_POLLIN =1
#define GLIB_SYSDEF_POLLPRI =2
#define GLIB_SYSDEF_POLLOUT =4
#define GLIB_SYSDEF_POLLERR =8
#define GLIB_SYSDEF_POLLHUP =16
#define GLIB_SYSDEF_POLLNVAL =32
typedef enum
{
G_IO_IN GLIB_SYSDEF_POLLIN,
G_IO_OUT GLIB_SYSDEF_POLLOUT,
G_IO_PRI GLIB_SYSDEF_POLLPRI,
G_IO_ERR GLIB_SYSDEF_POLLERR,
G_IO_HUP GLIB_SYSDEF_POLLHUP,
G_IO_NVAL GLIB_SYSDEF_POLLNVAL
} GIOCondition;
A bitwise combination representing a condition to watch for on an event source.
G_IO_IN There is data to read.
G_IO_OUT Data can be written (without blocking).
G_IO_PRI There is urgent data to read.
G_IO_ERR Error condition.
G_IO_HUP Hung up (the connection has been broken, usually for pipes and sockets).
G_IO_NVAL Invalid request. The file descriptor is not open.
*/
crm_err("Strange condition: %d", condition);
}
/* keep == FALSE results in mainloop_gio_destroy() being called
* just before the source is removed from mainloop
*/
return keep;
}
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.