project
stringclasses 788
values | commit_id
stringlengths 6
81
| CVE ID
stringlengths 13
16
| CWE ID
stringclasses 126
values | func
stringlengths 14
482k
| vul
int8 0
1
|
---|---|---|---|---|---|
icu | 53d8c8f3d181d87a6aa925b449b51c4a2c922a51 | NOT_APPLICABLE | NOT_APPLICABLE | void NumberFormatTest::TestLocalizedPatternSymbolCoverage() {
IcuTestErrorCode errorCode(*this, "TestLocalizedPatternSymbolCoverage");
// Ticket #12961: DecimalFormat::toLocalizedPattern() is not working as designed.
DecimalFormatSymbols dfs(errorCode);
dfs.setSymbol(DecimalFormatSymbols::kGroupingSeparatorSymbol, u'β');
dfs.setSymbol(DecimalFormatSymbols::kDecimalSeparatorSymbol, u'β');
dfs.setSymbol(DecimalFormatSymbols::kPatternSeparatorSymbol, u'β');
dfs.setSymbol(DecimalFormatSymbols::kDigitSymbol, u'β°');
dfs.setSymbol(DecimalFormatSymbols::kZeroDigitSymbol, u'ΰ»');
dfs.setSymbol(DecimalFormatSymbols::kSignificantDigitSymbol, u'β');
dfs.setSymbol(DecimalFormatSymbols::kPlusSignSymbol, u'β ');
dfs.setSymbol(DecimalFormatSymbols::kMinusSignSymbol, u'β‘');
dfs.setSymbol(DecimalFormatSymbols::kPercentSymbol, u'β');
dfs.setSymbol(DecimalFormatSymbols::kPerMillSymbol, u'β±');
dfs.setSymbol(DecimalFormatSymbols::kExponentialSymbol, u"ββ"); // tests multi-char sequence
dfs.setSymbol(DecimalFormatSymbols::kPadEscapeSymbol, u'β');
{
UnicodeString standardPattern(u"#,##0.05+%;#,##0.05-%");
UnicodeString localizedPattern(u"β°ββ°β°ΰ»βΰ»ΰ»β βββ°ββ°β°ΰ»βΰ»ΰ»β‘β");
DecimalFormat df1("#", new DecimalFormatSymbols(dfs), errorCode);
df1.applyPattern(standardPattern, errorCode);
DecimalFormat df2("#", new DecimalFormatSymbols(dfs), errorCode);
df2.applyLocalizedPattern(localizedPattern, errorCode);
assertTrue("DecimalFormat instances should be equal", df1 == df2);
UnicodeString p2;
assertEquals("toPattern should match on localizedPattern instance",
standardPattern, df2.toPattern(p2));
UnicodeString lp1;
assertEquals("toLocalizedPattern should match on standardPattern instance",
localizedPattern, df1.toLocalizedPattern(lp1));
}
{
UnicodeString standardPattern(u"* @@@E0β°");
UnicodeString localizedPattern(u"β βββββΰ»β±");
DecimalFormat df1("#", new DecimalFormatSymbols(dfs), errorCode);
df1.applyPattern(standardPattern, errorCode);
DecimalFormat df2("#", new DecimalFormatSymbols(dfs), errorCode);
df2.applyLocalizedPattern(localizedPattern, errorCode);
assertTrue("DecimalFormat instances should be equal", df1 == df2);
UnicodeString p2;
assertEquals("toPattern should match on localizedPattern instance",
standardPattern, df2.toPattern(p2));
UnicodeString lp1;
assertEquals("toLocalizedPattern should match on standardPattern instance",
localizedPattern, df1.toLocalizedPattern(lp1));
}
} | 0 |
Chrome | c3957448cfc6e299165196a33cd954b790875fdb | NOT_APPLICABLE | NOT_APPLICABLE | void Document::NotifyLayoutTreeOfSubtreeChanges() {
if (!GetLayoutView()->WasNotifiedOfSubtreeChange())
return;
lifecycle_.AdvanceTo(DocumentLifecycle::kInLayoutSubtreeChange);
GetLayoutView()->HandleSubtreeModifications();
DCHECK(!GetLayoutView()->WasNotifiedOfSubtreeChange());
lifecycle_.AdvanceTo(DocumentLifecycle::kLayoutSubtreeChangeClean);
}
| 0 |
linux | 0d0e57697f162da4aa218b5feafe614fb666db07 | CVE-2017-9150 | CWE-200 | static int do_check(struct bpf_verifier_env *env)
{
struct bpf_verifier_state *state = &env->cur_state;
struct bpf_insn *insns = env->prog->insnsi;
struct bpf_reg_state *regs = state->regs;
int insn_cnt = env->prog->len;
int insn_idx, prev_insn_idx = 0;
int insn_processed = 0;
bool do_print_state = false;
init_reg_state(regs);
insn_idx = 0;
env->varlen_map_value_access = false;
for (;;) {
struct bpf_insn *insn;
u8 class;
int err;
if (insn_idx >= insn_cnt) {
verbose("invalid insn idx %d insn_cnt %d\n",
insn_idx, insn_cnt);
return -EFAULT;
}
insn = &insns[insn_idx];
class = BPF_CLASS(insn->code);
if (++insn_processed > BPF_COMPLEXITY_LIMIT_INSNS) {
verbose("BPF program is too large. Processed %d insn\n",
insn_processed);
return -E2BIG;
}
err = is_state_visited(env, insn_idx);
if (err < 0)
return err;
if (err == 1) {
/* found equivalent state, can prune the search */
if (log_level) {
if (do_print_state)
verbose("\nfrom %d to %d: safe\n",
prev_insn_idx, insn_idx);
else
verbose("%d: safe\n", insn_idx);
}
goto process_bpf_exit;
}
if (log_level && do_print_state) {
verbose("\nfrom %d to %d:", prev_insn_idx, insn_idx);
print_verifier_state(&env->cur_state);
do_print_state = false;
}
if (log_level) {
verbose("%d: ", insn_idx);
print_bpf_insn(insn);
}
err = ext_analyzer_insn_hook(env, insn_idx, prev_insn_idx);
if (err)
return err;
if (class == BPF_ALU || class == BPF_ALU64) {
err = check_alu_op(env, insn);
if (err)
return err;
} else if (class == BPF_LDX) {
enum bpf_reg_type *prev_src_type, src_reg_type;
/* check for reserved fields is already done */
/* check src operand */
err = check_reg_arg(regs, insn->src_reg, SRC_OP);
if (err)
return err;
err = check_reg_arg(regs, insn->dst_reg, DST_OP_NO_MARK);
if (err)
return err;
src_reg_type = regs[insn->src_reg].type;
/* check that memory (src_reg + off) is readable,
* the state of dst_reg will be updated by this func
*/
err = check_mem_access(env, insn->src_reg, insn->off,
BPF_SIZE(insn->code), BPF_READ,
insn->dst_reg);
if (err)
return err;
if (BPF_SIZE(insn->code) != BPF_W &&
BPF_SIZE(insn->code) != BPF_DW) {
insn_idx++;
continue;
}
prev_src_type = &env->insn_aux_data[insn_idx].ptr_type;
if (*prev_src_type == NOT_INIT) {
/* saw a valid insn
* dst_reg = *(u32 *)(src_reg + off)
* save type to validate intersecting paths
*/
*prev_src_type = src_reg_type;
} else if (src_reg_type != *prev_src_type &&
(src_reg_type == PTR_TO_CTX ||
*prev_src_type == PTR_TO_CTX)) {
/* ABuser program is trying to use the same insn
* dst_reg = *(u32*) (src_reg + off)
* with different pointer types:
* src_reg == ctx in one branch and
* src_reg == stack|map in some other branch.
* Reject it.
*/
verbose("same insn cannot be used with different pointers\n");
return -EINVAL;
}
} else if (class == BPF_STX) {
enum bpf_reg_type *prev_dst_type, dst_reg_type;
if (BPF_MODE(insn->code) == BPF_XADD) {
err = check_xadd(env, insn);
if (err)
return err;
insn_idx++;
continue;
}
/* check src1 operand */
err = check_reg_arg(regs, insn->src_reg, SRC_OP);
if (err)
return err;
/* check src2 operand */
err = check_reg_arg(regs, insn->dst_reg, SRC_OP);
if (err)
return err;
dst_reg_type = regs[insn->dst_reg].type;
/* check that memory (dst_reg + off) is writeable */
err = check_mem_access(env, insn->dst_reg, insn->off,
BPF_SIZE(insn->code), BPF_WRITE,
insn->src_reg);
if (err)
return err;
prev_dst_type = &env->insn_aux_data[insn_idx].ptr_type;
if (*prev_dst_type == NOT_INIT) {
*prev_dst_type = dst_reg_type;
} else if (dst_reg_type != *prev_dst_type &&
(dst_reg_type == PTR_TO_CTX ||
*prev_dst_type == PTR_TO_CTX)) {
verbose("same insn cannot be used with different pointers\n");
return -EINVAL;
}
} else if (class == BPF_ST) {
if (BPF_MODE(insn->code) != BPF_MEM ||
insn->src_reg != BPF_REG_0) {
verbose("BPF_ST uses reserved fields\n");
return -EINVAL;
}
/* check src operand */
err = check_reg_arg(regs, insn->dst_reg, SRC_OP);
if (err)
return err;
/* check that memory (dst_reg + off) is writeable */
err = check_mem_access(env, insn->dst_reg, insn->off,
BPF_SIZE(insn->code), BPF_WRITE,
-1);
if (err)
return err;
} else if (class == BPF_JMP) {
u8 opcode = BPF_OP(insn->code);
if (opcode == BPF_CALL) {
if (BPF_SRC(insn->code) != BPF_K ||
insn->off != 0 ||
insn->src_reg != BPF_REG_0 ||
insn->dst_reg != BPF_REG_0) {
verbose("BPF_CALL uses reserved fields\n");
return -EINVAL;
}
err = check_call(env, insn->imm, insn_idx);
if (err)
return err;
} else if (opcode == BPF_JA) {
if (BPF_SRC(insn->code) != BPF_K ||
insn->imm != 0 ||
insn->src_reg != BPF_REG_0 ||
insn->dst_reg != BPF_REG_0) {
verbose("BPF_JA uses reserved fields\n");
return -EINVAL;
}
insn_idx += insn->off + 1;
continue;
} else if (opcode == BPF_EXIT) {
if (BPF_SRC(insn->code) != BPF_K ||
insn->imm != 0 ||
insn->src_reg != BPF_REG_0 ||
insn->dst_reg != BPF_REG_0) {
verbose("BPF_EXIT uses reserved fields\n");
return -EINVAL;
}
/* eBPF calling convetion is such that R0 is used
* to return the value from eBPF program.
* Make sure that it's readable at this time
* of bpf_exit, which means that program wrote
* something into it earlier
*/
err = check_reg_arg(regs, BPF_REG_0, SRC_OP);
if (err)
return err;
if (is_pointer_value(env, BPF_REG_0)) {
verbose("R0 leaks addr as return value\n");
return -EACCES;
}
process_bpf_exit:
insn_idx = pop_stack(env, &prev_insn_idx);
if (insn_idx < 0) {
break;
} else {
do_print_state = true;
continue;
}
} else {
err = check_cond_jmp_op(env, insn, &insn_idx);
if (err)
return err;
}
} else if (class == BPF_LD) {
u8 mode = BPF_MODE(insn->code);
if (mode == BPF_ABS || mode == BPF_IND) {
err = check_ld_abs(env, insn);
if (err)
return err;
} else if (mode == BPF_IMM) {
err = check_ld_imm(env, insn);
if (err)
return err;
insn_idx++;
} else {
verbose("invalid BPF_LD mode\n");
return -EINVAL;
}
reset_reg_range_values(regs, insn->dst_reg);
} else {
verbose("unknown insn class %d\n", class);
return -EINVAL;
}
insn_idx++;
}
verbose("processed %d insns\n", insn_processed);
return 0;
}
| 1 |
ghostpdl | 2793769ff107d8d22dadd30c6e68cd781b569550 | NOT_APPLICABLE | NOT_APPLICABLE | pcx_write_rle(const byte * from, const byte * end, int step, gp_file * file)
{ /*
* The PCX format theoretically allows encoding runs of 63
* identical bytes, but some readers can't handle repetition
* counts greater than 15.
*/
#define MAX_RUN_COUNT 15
int max_run = step * MAX_RUN_COUNT;
while (from < end) {
byte data = *from;
from += step;
if (from >= end || data != *from) {
if (data >= 0xc0)
gp_fputc(0xc1, file);
} else {
const byte *start = from;
while ((from < end) && (*from == data))
from += step;
/* Now (from - start) / step + 1 is the run length. */
while (from - start >= max_run) {
gp_fputc(0xc0 + MAX_RUN_COUNT, file);
gp_fputc(data, file);
start += max_run;
}
if (from > start || data >= 0xc0)
gp_fputc((from - start) / step + 0xc1, file);
}
gp_fputc(data, file);
}
#undef MAX_RUN_COUNT
} | 0 |
linux | 45f6fad84cc305103b28d73482b344d7f5b76f39 | NOT_APPLICABLE | NOT_APPLICABLE | static void tcp_v6_reqsk_destructor(struct request_sock *req)
{
kfree_skb(inet_rsk(req)->pktopts);
}
| 0 |
Chrome | 116d0963cadfbf55ef2ec3d13781987c4d80517a | NOT_APPLICABLE | NOT_APPLICABLE | void PrintWebViewHelper::UpdateFrameMarginsCssInfo(
const DictionaryValue& settings) {
int margins_type = 0;
if (!settings.GetInteger(printing::kSettingMarginsType, &margins_type))
margins_type = printing::DEFAULT_MARGINS;
ignore_css_margins_ = margins_type != printing::DEFAULT_MARGINS;
}
| 0 |
Chrome | 0579ed631fb37de5704b54ed2ee466bf29630ad0 | NOT_APPLICABLE | NOT_APPLICABLE | void NetworkThrottleManagerImpl::ThrottleImpl::NotifyUnblocked() {
DCHECK_EQ(State::BLOCKED, state_);
state_ = State::OUTSTANDING;
delegate_->OnThrottleUnblocked(this);
}
| 0 |
freeradius-server | 860cad9e02ba344edb0038419e415fe05a9a01f4 | NOT_APPLICABLE | NOT_APPLICABLE | static int calc_replydigest(RADIUS_PACKET *packet, RADIUS_PACKET *original,
const char *secret)
{
uint8_t calc_digest[AUTH_VECTOR_LEN];
MD5_CTX context;
/*
* Very bad!
*/
if (original == NULL) {
return 3;
}
/*
* Copy the original vector in place.
*/
memcpy(packet->data + 4, original->vector, AUTH_VECTOR_LEN);
/*
* MD5(packet + secret);
*/
MD5Init(&context);
MD5Update(&context, packet->data, packet->data_len);
MD5Update(&context, secret, strlen(secret));
MD5Final(calc_digest, &context);
/*
* Copy the packet's vector back to the packet.
*/
memcpy(packet->data + 4, packet->vector, AUTH_VECTOR_LEN);
/*
* Return 0 if OK, 2 if not OK.
*/
packet->verified =
memcmp(packet->vector, calc_digest, AUTH_VECTOR_LEN) ? 2 : 0;
return packet->verified;
} | 0 |
php-src | 158d8a6b088662ce9d31e0c777c6ebe90efdc854 | NOT_APPLICABLE | NOT_APPLICABLE | int phar_is_tar(char *buf, char *fname) /* {{{ */
{
tar_header *header = (tar_header *) buf;
php_uint32 checksum = phar_tar_number(header->checksum, sizeof(header->checksum));
php_uint32 ret;
char save[sizeof(header->checksum)];
/* assume that the first filename in a tar won't begin with <?php */
if (!strncmp(buf, "<?php", sizeof("<?php")-1)) {
return 0;
}
memcpy(save, header->checksum, sizeof(header->checksum));
memset(header->checksum, ' ', sizeof(header->checksum));
ret = (checksum == phar_tar_checksum(buf, 512));
memcpy(header->checksum, save, sizeof(header->checksum));
if (!ret && strstr(fname, ".tar")) {
/* probably a corrupted tar - so we will pretend it is one */
return 1;
}
return ret;
} | 0 |
linux | c03aa9f6e1f938618e6db2e23afef0574efeeb65 | NOT_APPLICABLE | NOT_APPLICABLE | static void udf_split_extents(struct inode *inode, int *c, int offset,
int newblocknum,
struct kernel_long_ad laarr[EXTENT_MERGE_SIZE],
int *endnum)
{
unsigned long blocksize = inode->i_sb->s_blocksize;
unsigned char blocksize_bits = inode->i_sb->s_blocksize_bits;
if ((laarr[*c].extLength >> 30) == (EXT_NOT_RECORDED_ALLOCATED >> 30) ||
(laarr[*c].extLength >> 30) ==
(EXT_NOT_RECORDED_NOT_ALLOCATED >> 30)) {
int curr = *c;
int blen = ((laarr[curr].extLength & UDF_EXTENT_LENGTH_MASK) +
blocksize - 1) >> blocksize_bits;
int8_t etype = (laarr[curr].extLength >> 30);
if (blen == 1)
;
else if (!offset || blen == offset + 1) {
laarr[curr + 2] = laarr[curr + 1];
laarr[curr + 1] = laarr[curr];
} else {
laarr[curr + 3] = laarr[curr + 1];
laarr[curr + 2] = laarr[curr + 1] = laarr[curr];
}
if (offset) {
if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30)) {
udf_free_blocks(inode->i_sb, inode,
&laarr[curr].extLocation,
0, offset);
laarr[curr].extLength =
EXT_NOT_RECORDED_NOT_ALLOCATED |
(offset << blocksize_bits);
laarr[curr].extLocation.logicalBlockNum = 0;
laarr[curr].extLocation.
partitionReferenceNum = 0;
} else
laarr[curr].extLength = (etype << 30) |
(offset << blocksize_bits);
curr++;
(*c)++;
(*endnum)++;
}
laarr[curr].extLocation.logicalBlockNum = newblocknum;
if (etype == (EXT_NOT_RECORDED_NOT_ALLOCATED >> 30))
laarr[curr].extLocation.partitionReferenceNum =
UDF_I(inode)->i_location.partitionReferenceNum;
laarr[curr].extLength = EXT_RECORDED_ALLOCATED |
blocksize;
curr++;
if (blen != offset + 1) {
if (etype == (EXT_NOT_RECORDED_ALLOCATED >> 30))
laarr[curr].extLocation.logicalBlockNum +=
offset + 1;
laarr[curr].extLength = (etype << 30) |
((blen - (offset + 1)) << blocksize_bits);
curr++;
(*endnum)++;
}
}
}
| 0 |
linux | f60a85cad677c4f9bb4cadd764f1d106c38c7cf8 | NOT_APPLICABLE | NOT_APPLICABLE | static int preload(struct bpf_preload_info *obj)
{
int magic = BPF_PRELOAD_START;
loff_t pos = 0;
int i, err;
ssize_t n;
err = fork_usermode_driver(&umd_ops.info);
if (err)
return err;
/* send the start magic to let UMD proceed with loading BPF progs */
n = kernel_write(umd_ops.info.pipe_to_umh,
&magic, sizeof(magic), &pos);
if (n != sizeof(magic))
return -EPIPE;
/* receive bpf_link IDs and names from UMD */
pos = 0;
for (i = 0; i < BPF_PRELOAD_LINKS; i++) {
n = kernel_read(umd_ops.info.pipe_from_umh,
&obj[i], sizeof(*obj), &pos);
if (n != sizeof(*obj))
return -EPIPE;
}
return 0;
} | 0 |
Chrome | ce1446c00f0fd8f5a3b00727421be2124cb7370f | NOT_APPLICABLE | NOT_APPLICABLE | htmlCtxtUseOptions(htmlParserCtxtPtr ctxt, int options)
{
if (ctxt == NULL)
return(-1);
if (options & HTML_PARSE_NOWARNING) {
ctxt->sax->warning = NULL;
ctxt->vctxt.warning = NULL;
options -= XML_PARSE_NOWARNING;
ctxt->options |= XML_PARSE_NOWARNING;
}
if (options & HTML_PARSE_NOERROR) {
ctxt->sax->error = NULL;
ctxt->vctxt.error = NULL;
ctxt->sax->fatalError = NULL;
options -= XML_PARSE_NOERROR;
ctxt->options |= XML_PARSE_NOERROR;
}
if (options & HTML_PARSE_PEDANTIC) {
ctxt->pedantic = 1;
options -= XML_PARSE_PEDANTIC;
ctxt->options |= XML_PARSE_PEDANTIC;
} else
ctxt->pedantic = 0;
if (options & XML_PARSE_NOBLANKS) {
ctxt->keepBlanks = 0;
ctxt->sax->ignorableWhitespace = xmlSAX2IgnorableWhitespace;
options -= XML_PARSE_NOBLANKS;
ctxt->options |= XML_PARSE_NOBLANKS;
} else
ctxt->keepBlanks = 1;
if (options & HTML_PARSE_RECOVER) {
ctxt->recovery = 1;
options -= HTML_PARSE_RECOVER;
} else
ctxt->recovery = 0;
if (options & HTML_PARSE_COMPACT) {
ctxt->options |= HTML_PARSE_COMPACT;
options -= HTML_PARSE_COMPACT;
}
if (options & XML_PARSE_HUGE) {
ctxt->options |= XML_PARSE_HUGE;
options -= XML_PARSE_HUGE;
}
if (options & HTML_PARSE_NODEFDTD) {
ctxt->options |= HTML_PARSE_NODEFDTD;
options -= HTML_PARSE_NODEFDTD;
}
if (options & HTML_PARSE_IGNORE_ENC) {
ctxt->options |= HTML_PARSE_IGNORE_ENC;
options -= HTML_PARSE_IGNORE_ENC;
}
if (options & HTML_PARSE_NOIMPLIED) {
ctxt->options |= HTML_PARSE_NOIMPLIED;
options -= HTML_PARSE_NOIMPLIED;
}
ctxt->dictNames = 0;
return (options);
}
| 0 |
ImageMagick6 | 11d9dac3d991c62289d1ef7a097670166480e76c | NOT_APPLICABLE | NOT_APPLICABLE | static MagickBooleanType WritePICTImage(const ImageInfo *image_info,
Image *image)
{
#define MaxCount 128
#define PictCropRegionOp 0x01
#define PictEndOfPictureOp 0xff
#define PictJPEGOp 0x8200
#define PictInfoOp 0x0C00
#define PictInfoSize 512
#define PictPixmapOp 0x9A
#define PictPICTOp 0x98
#define PictVersion 0x11
const StringInfo
*profile;
double
x_resolution,
y_resolution;
MagickBooleanType
status;
MagickOffsetType
offset;
PICTPixmap
pixmap;
PICTRectangle
bounds,
crop_rectangle,
destination_rectangle,
frame_rectangle,
size_rectangle,
source_rectangle;
register const IndexPacket
*indexes;
register const PixelPacket
*p;
register ssize_t
i,
x;
size_t
bytes_per_line,
count,
row_bytes,
storage_class;
ssize_t
y;
unsigned char
*buffer,
*packed_scanline,
*scanline;
unsigned short
base_address,
transfer_mode;
/*
Open output image file.
*/
assert(image_info != (const ImageInfo *) NULL);
assert(image_info->signature == MagickCoreSignature);
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if ((image->columns > 65535L) || (image->rows > 65535L))
ThrowWriterException(ImageError,"WidthOrHeightExceedsLimit");
status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
if (status == MagickFalse)
return(status);
if (IssRGBCompatibleColorspace(image->colorspace) == MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace);
/*
Initialize image info.
*/
size_rectangle.top=0;
size_rectangle.left=0;
size_rectangle.bottom=(short) image->rows;
size_rectangle.right=(short) image->columns;
frame_rectangle=size_rectangle;
crop_rectangle=size_rectangle;
source_rectangle=size_rectangle;
destination_rectangle=size_rectangle;
base_address=0xff;
row_bytes=image->columns;
bounds.top=0;
bounds.left=0;
bounds.bottom=(short) image->rows;
bounds.right=(short) image->columns;
pixmap.version=0;
pixmap.pack_type=0;
pixmap.pack_size=0;
pixmap.pixel_type=0;
pixmap.bits_per_pixel=8;
pixmap.component_count=1;
pixmap.component_size=8;
pixmap.plane_bytes=0;
pixmap.table=0;
pixmap.reserved=0;
transfer_mode=0;
x_resolution=image->x_resolution != 0.0 ? image->x_resolution :
DefaultResolution;
y_resolution=image->y_resolution != 0.0 ? image->y_resolution :
DefaultResolution;
storage_class=image->storage_class;
if (image_info->compression == JPEGCompression)
storage_class=DirectClass;
if (storage_class == DirectClass)
{
pixmap.component_count=image->matte != MagickFalse ? 4 : 3;
pixmap.pixel_type=16;
pixmap.bits_per_pixel=32;
pixmap.pack_type=0x04;
transfer_mode=0x40;
row_bytes=4*image->columns;
}
/*
Allocate memory.
*/
bytes_per_line=image->columns;
if (storage_class == DirectClass)
bytes_per_line*=image->matte != MagickFalse ? 4 : 3;
buffer=(unsigned char *) AcquireQuantumMemory(PictInfoSize,sizeof(*buffer));
packed_scanline=(unsigned char *) AcquireQuantumMemory((size_t)
(row_bytes+MaxCount),sizeof(*packed_scanline));
scanline=(unsigned char *) AcquireQuantumMemory(row_bytes,sizeof(*scanline));
if ((buffer == (unsigned char *) NULL) ||
(packed_scanline == (unsigned char *) NULL) ||
(scanline == (unsigned char *) NULL))
{
if (scanline != (unsigned char *) NULL)
scanline=(unsigned char *) RelinquishMagickMemory(scanline);
if (packed_scanline != (unsigned char *) NULL)
packed_scanline=(unsigned char *) RelinquishMagickMemory(
packed_scanline);
if (buffer != (unsigned char *) NULL)
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
ThrowWriterException(ResourceLimitError,"MemoryAllocationFailed");
}
(void) memset(scanline,0,row_bytes);
(void) memset(packed_scanline,0,(size_t) (row_bytes+MaxCount));
/*
Write header, header size, size bounding box, version, and reserved.
*/
(void) memset(buffer,0,PictInfoSize);
(void) WriteBlob(image,PictInfoSize,buffer);
(void) WriteBlobMSBShort(image,0);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) size_rectangle.right);
(void) WriteBlobMSBShort(image,PictVersion);
(void) WriteBlobMSBShort(image,0x02ff); /* version #2 */
(void) WriteBlobMSBShort(image,PictInfoOp);
(void) WriteBlobMSBLong(image,0xFFFE0000U);
/*
Write full size of the file, resolution, frame bounding box, and reserved.
*/
(void) WriteBlobMSBShort(image,(unsigned short) x_resolution);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) y_resolution);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) frame_rectangle.right);
(void) WriteBlobMSBLong(image,0x00000000L);
profile=GetImageProfile(image,"iptc");
if (profile != (StringInfo *) NULL)
{
(void) WriteBlobMSBShort(image,0xa1);
(void) WriteBlobMSBShort(image,0x1f2);
(void) WriteBlobMSBShort(image,(unsigned short)
(GetStringInfoLength(profile)+4));
(void) WriteBlobString(image,"8BIM");
(void) WriteBlob(image,GetStringInfoLength(profile),
GetStringInfoDatum(profile));
}
profile=GetImageProfile(image,"icc");
if (profile != (StringInfo *) NULL)
{
(void) WriteBlobMSBShort(image,0xa1);
(void) WriteBlobMSBShort(image,0xe0);
(void) WriteBlobMSBShort(image,(unsigned short)
(GetStringInfoLength(profile)+4));
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlob(image,GetStringInfoLength(profile),
GetStringInfoDatum(profile));
(void) WriteBlobMSBShort(image,0xa1);
(void) WriteBlobMSBShort(image,0xe0);
(void) WriteBlobMSBShort(image,4);
(void) WriteBlobMSBLong(image,0x00000002U);
}
/*
Write crop region opcode and crop bounding box.
*/
(void) WriteBlobMSBShort(image,PictCropRegionOp);
(void) WriteBlobMSBShort(image,0xa);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) crop_rectangle.right);
if (image_info->compression == JPEGCompression)
{
Image
*jpeg_image;
ImageInfo
*jpeg_info;
size_t
length;
unsigned char
*blob;
jpeg_image=CloneImage(image,0,0,MagickTrue,&image->exception);
if (jpeg_image == (Image *) NULL)
{
(void) CloseBlob(image);
return(MagickFalse);
}
jpeg_info=CloneImageInfo(image_info);
(void) CopyMagickString(jpeg_info->magick,"JPEG",MaxTextExtent);
length=0;
blob=(unsigned char *) ImageToBlob(jpeg_info,jpeg_image,&length,
&image->exception);
jpeg_info=DestroyImageInfo(jpeg_info);
if (blob == (unsigned char *) NULL)
return(MagickFalse);
jpeg_image=DestroyImage(jpeg_image);
(void) WriteBlobMSBShort(image,PictJPEGOp);
(void) WriteBlobMSBLong(image,(unsigned int) length+154);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBLong(image,0x00010000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00010000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x40000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00400000U);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) image->rows);
(void) WriteBlobMSBShort(image,(unsigned short) image->columns);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,768);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00566A70U);
(void) WriteBlobMSBLong(image,0x65670000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000001U);
(void) WriteBlobMSBLong(image,0x00016170U);
(void) WriteBlobMSBLong(image,0x706C0000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBShort(image,768);
(void) WriteBlobMSBShort(image,(unsigned short) image->columns);
(void) WriteBlobMSBShort(image,(unsigned short) image->rows);
(void) WriteBlobMSBShort(image,(unsigned short) x_resolution);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) y_resolution);
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBLong(image,length);
(void) WriteBlobMSBShort(image,0x0001);
(void) WriteBlobMSBLong(image,0x0B466F74U);
(void) WriteBlobMSBLong(image,0x6F202D20U);
(void) WriteBlobMSBLong(image,0x4A504547U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x00000000U);
(void) WriteBlobMSBLong(image,0x0018FFFFU);
(void) WriteBlob(image,length,blob);
if ((length & 0x01) != 0)
(void) WriteBlobByte(image,'\0');
blob=(unsigned char *) RelinquishMagickMemory(blob);
}
/*
Write picture opcode, row bytes, and picture bounding box, and version.
*/
if (storage_class == PseudoClass)
(void) WriteBlobMSBShort(image,PictPICTOp);
else
{
(void) WriteBlobMSBShort(image,PictPixmapOp);
(void) WriteBlobMSBLong(image,(unsigned int) base_address);
}
(void) WriteBlobMSBShort(image,(unsigned short) (row_bytes | 0x8000));
(void) WriteBlobMSBShort(image,(unsigned short) bounds.top);
(void) WriteBlobMSBShort(image,(unsigned short) bounds.left);
(void) WriteBlobMSBShort(image,(unsigned short) bounds.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) bounds.right);
/*
Write pack type, pack size, resolution, pixel type, and pixel size.
*/
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.version);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.pack_type);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.pack_size);
(void) WriteBlobMSBShort(image,(unsigned short) (x_resolution+0.5));
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) (y_resolution+0.5));
(void) WriteBlobMSBShort(image,0x0000);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.pixel_type);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.bits_per_pixel);
/*
Write component count, size, plane bytes, table size, and reserved.
*/
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.component_count);
(void) WriteBlobMSBShort(image,(unsigned short) pixmap.component_size);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.plane_bytes);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.table);
(void) WriteBlobMSBLong(image,(unsigned int) pixmap.reserved);
if (storage_class == PseudoClass)
{
/*
Write image colormap.
*/
(void) WriteBlobMSBLong(image,0x00000000L); /* color seed */
(void) WriteBlobMSBShort(image,0L); /* color flags */
(void) WriteBlobMSBShort(image,(unsigned short) (image->colors-1));
for (i=0; i < (ssize_t) image->colors; i++)
{
(void) WriteBlobMSBShort(image,(unsigned short) i);
(void) WriteBlobMSBShort(image,ScaleQuantumToShort(
image->colormap[i].red));
(void) WriteBlobMSBShort(image,ScaleQuantumToShort(
image->colormap[i].green));
(void) WriteBlobMSBShort(image,ScaleQuantumToShort(
image->colormap[i].blue));
}
}
/*
Write source and destination rectangle.
*/
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) source_rectangle.right);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.top);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.left);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.bottom);
(void) WriteBlobMSBShort(image,(unsigned short) destination_rectangle.right);
(void) WriteBlobMSBShort(image,(unsigned short) transfer_mode);
/*
Write picture data.
*/
count=0;
if (storage_class == PseudoClass)
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
indexes=GetVirtualIndexQueue(image);
for (x=0; x < (ssize_t) image->columns; x++)
scanline[x]=(unsigned char) GetPixelIndex(indexes+x);
count+=EncodeImage(image,scanline,(size_t) (row_bytes & 0x7FFF),
packed_scanline);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
else
if (image_info->compression == JPEGCompression)
{
(void) memset(scanline,0,row_bytes);
for (y=0; y < (ssize_t) image->rows; y++)
count+=EncodeImage(image,scanline,(size_t) (row_bytes & 0x7FFF),
packed_scanline);
}
else
{
register unsigned char
*blue,
*green,
*opacity,
*red;
red=scanline;
green=scanline+image->columns;
blue=scanline+2*image->columns;
opacity=scanline+3*image->columns;
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception);
if (p == (const PixelPacket *) NULL)
break;
red=scanline;
green=scanline+image->columns;
blue=scanline+2*image->columns;
if (image->matte != MagickFalse)
{
opacity=scanline;
red=scanline+image->columns;
green=scanline+2*image->columns;
blue=scanline+3*image->columns;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
*red++=ScaleQuantumToChar(GetPixelRed(p));
*green++=ScaleQuantumToChar(GetPixelGreen(p));
*blue++=ScaleQuantumToChar(GetPixelBlue(p));
if (image->matte != MagickFalse)
*opacity++=ScaleQuantumToChar((Quantum) (GetPixelAlpha(p)));
p++;
}
count+=EncodeImage(image,scanline,bytes_per_line,packed_scanline);
if (image->previous == (Image *) NULL)
{
status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
image->rows);
if (status == MagickFalse)
break;
}
}
}
if ((count & 0x01) != 0)
(void) WriteBlobByte(image,'\0');
(void) WriteBlobMSBShort(image,PictEndOfPictureOp);
offset=TellBlob(image);
offset=SeekBlob(image,512,SEEK_SET);
(void) WriteBlobMSBShort(image,(unsigned short) offset);
scanline=(unsigned char *) RelinquishMagickMemory(scanline);
packed_scanline=(unsigned char *) RelinquishMagickMemory(packed_scanline);
buffer=(unsigned char *) RelinquishMagickMemory(buffer);
(void) CloseBlob(image);
return(MagickTrue);
} | 0 |
Chrome | bf381d8a02c3d272d4dd879ac719d8993dfb5ad6 | NOT_APPLICABLE | NOT_APPLICABLE | void SyncBackendHost::Core::RouteJsEvent(
const std::string& name, const JsEventDetails& details) {
host_->frontend_loop_->PostTask(
FROM_HERE, NewRunnableMethod(
this, &Core::RouteJsEventOnFrontendLoop, name, details));
}
| 0 |
unzip | 41beb477c5744bc396fa1162ee0c14218ec12213 | NOT_APPLICABLE | NOT_APPLICABLE | unsigned char *uzmbsrchr(str, c)
ZCONST unsigned char *str;
unsigned int c;
{
unsigned char *match = NULL;
while(*str != '\0'){
if (*str == c) {match = (unsigned char *)str;}
INCSTR(str);
}
return match;
} | 0 |
openldap | 3539fc33212b528c56b716584f2c2994af7c30b0 | NOT_APPLICABLE | NOT_APPLICABLE | octetStringSubstringsFilter (
slap_mask_t use,
slap_mask_t flags,
Syntax *syntax,
MatchingRule *mr,
struct berval *prefix,
void * assertedValue,
BerVarray *keysp,
void *ctx)
{
SubstringsAssertion *sa;
char pre;
ber_len_t nkeys = 0;
size_t klen;
BerVarray keys;
HASH_CONTEXT HASHcontext;
unsigned char HASHdigest[HASH_BYTES];
struct berval *value;
struct berval digest;
sa = (SubstringsAssertion *) assertedValue;
if( flags & SLAP_INDEX_SUBSTR_INITIAL &&
!BER_BVISNULL( &sa->sa_initial ) &&
sa->sa_initial.bv_len >= index_substr_if_minlen )
{
nkeys++;
if ( sa->sa_initial.bv_len > index_substr_if_maxlen &&
( flags & SLAP_INDEX_SUBSTR_ANY ))
{
nkeys += 1 + (sa->sa_initial.bv_len - index_substr_if_maxlen) / index_substr_any_step;
}
}
if ( flags & SLAP_INDEX_SUBSTR_ANY && sa->sa_any != NULL ) {
ber_len_t i;
for( i=0; !BER_BVISNULL( &sa->sa_any[i] ); i++ ) {
if( sa->sa_any[i].bv_len >= index_substr_any_len ) {
/* don't bother accounting with stepping */
nkeys += sa->sa_any[i].bv_len -
( index_substr_any_len - 1 );
}
}
}
if( flags & SLAP_INDEX_SUBSTR_FINAL &&
!BER_BVISNULL( &sa->sa_final ) &&
sa->sa_final.bv_len >= index_substr_if_minlen )
{
nkeys++;
if ( sa->sa_final.bv_len > index_substr_if_maxlen &&
( flags & SLAP_INDEX_SUBSTR_ANY ))
{
nkeys += 1 + (sa->sa_final.bv_len - index_substr_if_maxlen) / index_substr_any_step;
}
}
if( nkeys == 0 ) {
*keysp = NULL;
return LDAP_SUCCESS;
}
digest.bv_val = (char *)HASHdigest;
digest.bv_len = HASH_LEN;
keys = slap_sl_malloc( sizeof( struct berval ) * (nkeys+1), ctx );
nkeys = 0;
if( flags & SLAP_INDEX_SUBSTR_INITIAL &&
!BER_BVISNULL( &sa->sa_initial ) &&
sa->sa_initial.bv_len >= index_substr_if_minlen )
{
pre = SLAP_INDEX_SUBSTR_INITIAL_PREFIX;
value = &sa->sa_initial;
klen = index_substr_if_maxlen < value->bv_len
? index_substr_if_maxlen : value->bv_len;
hashPreset( &HASHcontext, prefix, pre, syntax, mr );
hashIter( &HASHcontext, HASHdigest,
(unsigned char *)value->bv_val, klen );
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
/* If initial is too long and we have subany indexed, use it
* to match the excess...
*/
if (value->bv_len > index_substr_if_maxlen && (flags & SLAP_INDEX_SUBSTR_ANY))
{
ber_len_t j;
pre = SLAP_INDEX_SUBSTR_PREFIX;
hashPreset( &HASHcontext, prefix, pre, syntax, mr);
for ( j=index_substr_if_maxlen-1; j <= value->bv_len - index_substr_any_len; j+=index_substr_any_step )
{
hashIter( &HASHcontext, HASHdigest,
(unsigned char *)&value->bv_val[j], index_substr_any_len );
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
}
if( flags & SLAP_INDEX_SUBSTR_ANY && sa->sa_any != NULL ) {
ber_len_t i, j;
pre = SLAP_INDEX_SUBSTR_PREFIX;
klen = index_substr_any_len;
for( i=0; !BER_BVISNULL( &sa->sa_any[i] ); i++ ) {
if( sa->sa_any[i].bv_len < index_substr_any_len ) {
continue;
}
value = &sa->sa_any[i];
hashPreset( &HASHcontext, prefix, pre, syntax, mr);
for(j=0;
j <= value->bv_len - index_substr_any_len;
j += index_substr_any_step )
{
hashIter( &HASHcontext, HASHdigest,
(unsigned char *)&value->bv_val[j], klen );
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
}
if( flags & SLAP_INDEX_SUBSTR_FINAL &&
!BER_BVISNULL( &sa->sa_final ) &&
sa->sa_final.bv_len >= index_substr_if_minlen )
{
pre = SLAP_INDEX_SUBSTR_FINAL_PREFIX;
value = &sa->sa_final;
klen = index_substr_if_maxlen < value->bv_len
? index_substr_if_maxlen : value->bv_len;
hashPreset( &HASHcontext, prefix, pre, syntax, mr );
hashIter( &HASHcontext, HASHdigest,
(unsigned char *)&value->bv_val[value->bv_len-klen], klen );
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
/* If final is too long and we have subany indexed, use it
* to match the excess...
*/
if (value->bv_len > index_substr_if_maxlen && (flags & SLAP_INDEX_SUBSTR_ANY))
{
ber_len_t j;
pre = SLAP_INDEX_SUBSTR_PREFIX;
hashPreset( &HASHcontext, prefix, pre, syntax, mr);
for ( j=0; j <= value->bv_len - index_substr_if_maxlen; j+=index_substr_any_step )
{
hashIter( &HASHcontext, HASHdigest,
(unsigned char *)&value->bv_val[j], index_substr_any_len );
ber_dupbv_x( &keys[nkeys++], &digest, ctx );
}
}
}
if( nkeys > 0 ) {
BER_BVZERO( &keys[nkeys] );
*keysp = keys;
} else {
ch_free( keys );
*keysp = NULL;
}
return LDAP_SUCCESS;
} | 0 |
php-src | f151e048ed27f6f4eef729f3310d053ab5da71d4 | NOT_APPLICABLE | NOT_APPLICABLE | PHP_FUNCTION(link)
{
char *topath, *frompath;
size_t topath_len, frompath_len;
int ret;
char source_p[MAXPATHLEN];
char dest_p[MAXPATHLEN];
/*First argument to link function is the target and hence should go to frompath
Second argument to link function is the link itself and hence should go to topath */
if (zend_parse_parameters(ZEND_NUM_ARGS(), "ss", &frompath, &frompath_len, &topath, &topath_len) == FAILURE) {
return;
}
if (!expand_filepath(frompath, source_p) || !expand_filepath(topath, dest_p)) {
php_error_docref(NULL, E_WARNING, "No such file or directory");
RETURN_FALSE;
}
if (php_stream_locate_url_wrapper(source_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY) ||
php_stream_locate_url_wrapper(dest_p, NULL, STREAM_LOCATE_WRAPPERS_ONLY) )
{
php_error_docref(NULL, E_WARNING, "Unable to link to a URL");
RETURN_FALSE;
}
if (OPENBASEDIR_CHECKPATH(source_p)) {
RETURN_FALSE;
}
if (OPENBASEDIR_CHECKPATH(dest_p)) {
RETURN_FALSE;
}
#ifndef ZTS
ret = CreateHardLinkA(topath, frompath, NULL);
#else
ret = CreateHardLinkA(dest_p, source_p, NULL);
#endif
if (ret == 0) {
php_error_docref(NULL, E_WARNING, "%s", strerror(errno));
RETURN_FALSE;
}
RETURN_TRUE;
}
| 0 |
Android | 04839626ed859623901ebd3a5fd483982186b59d | CVE-2016-1621 | CWE-119 | ContentEncoding::ContentCompression::ContentCompression()
: algo(0),
settings(NULL),
settings_len(0) {
}
| 1 |
linux | 77f4689de17c0887775bb77896f4cc11a39bf848 | CVE-2021-1048 | CWE-416 | static int ep_loop_check_proc(void *priv, void *cookie, int call_nests)
{
int error = 0;
struct file *file = priv;
struct eventpoll *ep = file->private_data;
struct eventpoll *ep_tovisit;
struct rb_node *rbp;
struct epitem *epi;
mutex_lock_nested(&ep->mtx, call_nests + 1);
ep->visited = 1;
list_add(&ep->visited_list_link, &visited_list);
for (rbp = rb_first_cached(&ep->rbr); rbp; rbp = rb_next(rbp)) {
epi = rb_entry(rbp, struct epitem, rbn);
if (unlikely(is_file_epoll(epi->ffd.file))) {
ep_tovisit = epi->ffd.file->private_data;
if (ep_tovisit->visited)
continue;
error = ep_call_nested(&poll_loop_ncalls,
ep_loop_check_proc, epi->ffd.file,
ep_tovisit, current);
if (error != 0)
break;
} else {
/*
* If we've reached a file that is not associated with
* an ep, then we need to check if the newly added
* links are going to add too many wakeup paths. We do
* this by adding it to the tfile_check_list, if it's
* not already there, and calling reverse_path_check()
* during ep_insert().
*/
if (list_empty(&epi->ffd.file->f_tfile_llink)) {
get_file(epi->ffd.file);
list_add(&epi->ffd.file->f_tfile_llink,
&tfile_check_list);
}
}
}
mutex_unlock(&ep->mtx);
return error;
} | 1 |
Android | a209ff12ba9617c10550678ff93d01fb72a33399 | NOT_APPLICABLE | NOT_APPLICABLE | static jboolean android_net_wifi_enable_disable_tdls(JNIEnv *env,jclass cls, jint iface,
jboolean enable, jstring addr) {
JNIHelper helper(env);
wifi_interface_handle handle = getIfaceHandle(helper, cls, iface);
mac_addr address;
parseMacAddress(env, addr, address);
wifi_tdls_handler tdls_handler;
if(enable) {
return (hal_fn.wifi_enable_tdls(handle, address, NULL, tdls_handler) == WIFI_SUCCESS);
} else {
return (hal_fn.wifi_disable_tdls(handle, address) == WIFI_SUCCESS);
}
}
| 0 |
ImageMagick | d63a3c5729df59f183e9e110d5d8385d17caaad0 | NOT_APPLICABLE | NOT_APPLICABLE | MagickExport size_t GetImageDepth(const Image *image,ExceptionInfo *exception)
{
return(GetImageChannelDepth(image,CompositeChannels,exception));
}
| 0 |
pupnp-code | be0a01bdb83395d9f3a5ea09c1308a4f1a972cbd | NOT_APPLICABLE | NOT_APPLICABLE | static int GetNextRange(
/*! string containing the token / range. */
char **SrcRangeStr,
/*! gets the first byte of the token. */
off_t *FirstByte,
/*! gets the last byte of the token. */
off_t *LastByte)
{
char *Ptr;
char *Tok;
int i;
int64_t F = -1;
int64_t L = -1;
int Is_Suffix_byte_Range = 1;
if (*SrcRangeStr == NULL)
return -1;
Tok = StrTok(SrcRangeStr, ",");
if ((Ptr = strstr(Tok, "-")) == NULL)
return -1;
*Ptr = ' ';
sscanf(Tok, "%" SCNd64 "%" SCNd64, &F, &L);
if (F == -1 || L == -1) {
*Ptr = '-';
for (i = 0; i < (int)strlen(Tok); i++) {
if (Tok[i] == '-') {
break;
} else if (isdigit(Tok[i])) {
Is_Suffix_byte_Range = 0;
break;
}
}
if (Is_Suffix_byte_Range) {
*FirstByte = (off_t) L;
*LastByte = (off_t) F;
return 1;
}
}
*FirstByte = (off_t) F;
*LastByte = (off_t) L;
return 1;
}
| 0 |
ImageMagick6 | 27b1c74979ac473a430e266ff6c4b645664bc805 | NOT_APPLICABLE | NOT_APPLICABLE | MagickExport MagickBooleanType SetImageClipMask(Image *image,
const Image *clip_mask)
{
assert(image != (Image *) NULL);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(image->signature == MagickCoreSignature);
if (clip_mask != (const Image *) NULL)
if ((clip_mask->columns != image->columns) ||
(clip_mask->rows != image->rows))
ThrowBinaryImageException(ImageError,"ImageSizeDiffers",image->filename);
if (image->clip_mask != (Image *) NULL)
image->clip_mask=DestroyImage(image->clip_mask);
image->clip_mask=NewImageList();
if (clip_mask == (Image *) NULL)
return(MagickTrue);
if (SetImageStorageClass(image,DirectClass) == MagickFalse)
return(MagickFalse);
image->clip_mask=CloneImage(clip_mask,0,0,MagickTrue,&image->exception);
if (image->clip_mask == (Image *) NULL)
return(MagickFalse);
return(MagickTrue);
} | 0 |
Chrome | 01e4ee2fda0a5e57a8d0c8cb829022eb84fdff12 | NOT_APPLICABLE | NOT_APPLICABLE | static PassRefPtr<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle* style, RenderView* renderView)
{
RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
bool showHorizontalBottomLeft = style->borderTopRightRadius().width() != style->borderBottomLeftRadius().width();
bool showHorizontalBottomRight = style->borderBottomRightRadius().width() != style->borderTopLeftRadius().width();
bool showHorizontalTopRight = style->borderTopRightRadius().width() != style->borderTopLeftRadius().width();
bool showVerticalBottomLeft = style->borderTopRightRadius().height() != style->borderBottomLeftRadius().height();
bool showVerticalBottomRight = (style->borderBottomRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomLeft;
bool showVerticalTopRight = (style->borderTopRightRadius().height() != style->borderTopLeftRadius().height()) || showVerticalBottomRight;
bool showVerticalTopLeft = (style->borderTopLeftRadius().width() != style->borderTopLeftRadius().height());
RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style->borderTopLeftRadius(), style, renderView);
RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style->borderTopRightRadius(), style, renderView);
RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style->borderBottomRightRadius(), style, renderView);
RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style->borderBottomLeftRadius(), style, renderView);
RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
horizontalRadii->append(topLeftRadius->item(0));
if (showHorizontalTopRight)
horizontalRadii->append(topRightRadius->item(0));
if (showHorizontalBottomRight)
horizontalRadii->append(bottomRightRadius->item(0));
if (showHorizontalBottomLeft)
horizontalRadii->append(bottomLeftRadius->item(0));
list->append(horizontalRadii);
if (showVerticalTopLeft) {
RefPtr<CSSValueList> verticalRadii = CSSValueList::createSpaceSeparated();
verticalRadii->append(topLeftRadius->item(1));
if (showVerticalTopRight)
verticalRadii->append(topRightRadius->item(1));
if (showVerticalBottomRight)
verticalRadii->append(bottomRightRadius->item(1));
if (showVerticalBottomLeft)
verticalRadii->append(bottomLeftRadius->item(1));
list->append(verticalRadii);
}
return list.release();
}
| 0 |
tmux | a868bacb46e3c900530bed47a1c6f85b0fbe701c | NOT_APPLICABLE | NOT_APPLICABLE | input_csi_dispatch_sm(struct input_ctx *ictx)
{
struct screen_write_ctx *sctx = &ictx->ctx;
u_int i;
for (i = 0; i < ictx->param_list_len; i++) {
switch (input_get(ictx, i, 0, -1)) {
case -1:
break;
case 4: /* IRM */
screen_write_mode_set(sctx, MODE_INSERT);
break;
case 34:
screen_write_mode_clear(sctx, MODE_BLINKING);
break;
default:
log_debug("%s: unknown '%c'", __func__, ictx->ch);
break;
}
}
} | 0 |
ImageMagick | 948356eec65aea91995d4b7cc487d197d2c5f602 | NOT_APPLICABLE | NOT_APPLICABLE | static QuantizationTable *DestroyQuantizationTable(QuantizationTable *table)
{
assert(table != (QuantizationTable *) NULL);
if (table->slot != (char *) NULL)
table->slot=DestroyString(table->slot);
if (table->description != (char *) NULL)
table->description=DestroyString(table->description);
if (table->levels != (unsigned int *) NULL)
table->levels=(unsigned int *) RelinquishMagickMemory(table->levels);
table=(QuantizationTable *) RelinquishMagickMemory(table);
return(table);
}
| 0 |
linux | fc0a80798576f80ca10b3f6c9c7097f12fd1d64e | NOT_APPLICABLE | NOT_APPLICABLE | int v4l2_video_std_construct(struct v4l2_standard *vs,
int id, const char *name)
{
vs->id = id;
v4l2_video_std_frame_period(id, &vs->frameperiod);
vs->framelines = (id & V4L2_STD_525_60) ? 525 : 625;
strlcpy(vs->name, name, sizeof(vs->name));
return 0;
}
| 0 |
libssh | 4aea835974996b2deb011024c53f4ff4329a95b5 | NOT_APPLICABLE | NOT_APPLICABLE | uint64_t ssh_scp_request_get_size64(ssh_scp scp)
{
if (scp == NULL) {
return 0;
}
return scp->filelen;
} | 0 |
linux | 4a491b1ab11ca0556d2fda1ff1301e862a2d44c4 | NOT_APPLICABLE | NOT_APPLICABLE | static enum sas_device_type to_dev_type(struct discover_resp *dr)
{
/* This is detecting a failure to transmit initial dev to host
* FIS as described in section J.5 of sas-2 r16
*/
if (dr->attached_dev_type == SAS_PHY_UNUSED && dr->attached_sata_dev &&
dr->linkrate >= SAS_LINK_RATE_1_5_GBPS)
return SAS_SATA_PENDING;
else
return dr->attached_dev_type;
}
| 0 |
Chrome | b2dfe7c175fb21263f06eb586f1ed235482a3281 | NOT_APPLICABLE | NOT_APPLICABLE | const char* ewk_frame_uri_get(const Evas_Object* ewkFrame)
{
EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, 0);
return smartData->uri;
}
| 0 |
linux | c3e2219216c92919a6bd1711f340f5faa98695e6 | NOT_APPLICABLE | NOT_APPLICABLE | static ssize_t queue_wb_lat_show(struct request_queue *q, char *page)
{
if (!wbt_rq_qos(q))
return -EINVAL;
return sprintf(page, "%llu\n", div_u64(wbt_get_min_lat(q), 1000));
} | 0 |
linux | dab6cf55f81a6e16b8147aed9a843e1691dcd318 | NOT_APPLICABLE | NOT_APPLICABLE | static int poke_user(struct task_struct *child, addr_t addr, addr_t data)
{
addr_t mask;
/*
* Stupid gdb peeks/pokes the access registers in 64 bit with
* an alignment of 4. Programmers from hell indeed...
*/
mask = __ADDR_MASK;
#ifdef CONFIG_64BIT
if (addr >= (addr_t) &((struct user *) NULL)->regs.acrs &&
addr < (addr_t) &((struct user *) NULL)->regs.orig_gpr2)
mask = 3;
#endif
if ((addr & mask) || addr > sizeof(struct user) - __ADDR_MASK)
return -EIO;
return __poke_user(child, addr, data);
}
| 0 |
tensorflow | c2426bba00a01de6913738df8fa78e0215fcce02 | NOT_APPLICABLE | NOT_APPLICABLE | bool ParseAttrValueHelper_TensorNestsUnderLimit(int limit, string to_parse) {
int nests = 0;
int maxed_out = to_parse.length();
int open_curly = to_parse.find('{');
int open_bracket = to_parse.find('<');
int close_curly = to_parse.find('}');
int close_bracket = to_parse.find('>');
if (open_curly == -1) {
open_curly = maxed_out;
}
if (open_bracket == -1) {
open_bracket = maxed_out;
}
int min = std::min(open_curly, open_bracket);
do {
if (open_curly == maxed_out && open_bracket == maxed_out) {
return true;
}
if (min == open_curly) {
nests += 1;
open_curly = to_parse.find('{', open_curly + 1);
if (open_curly == -1) {
open_curly = maxed_out;
}
} else if (min == open_bracket) {
nests += 1;
open_bracket = to_parse.find('<', open_bracket + 1);
if (open_bracket == -1) {
open_bracket = maxed_out;
}
} else if (min == close_curly) {
nests -= 1;
close_curly = to_parse.find('}', close_curly + 1);
if (close_curly == -1) {
close_curly = maxed_out;
}
} else if (min == close_bracket) {
nests -= 1;
close_bracket = to_parse.find('>', close_bracket + 1);
if (close_bracket == -1) {
close_bracket = maxed_out;
}
}
min = std::min({open_curly, open_bracket, close_curly, close_bracket});
} while (nests < 100);
return false;
} | 0 |
linux | 550fd08c2cebad61c548def135f67aba284c6162 | NOT_APPLICABLE | NOT_APPLICABLE | ar6000_btcoex_stats_event(struct ar6_softc *ar, u8 *ptr, u32 len)
{
WMI_BTCOEX_STATS_EVENT *pBtcoexStats = (WMI_BTCOEX_STATS_EVENT *)ptr;
AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("AR6000 BTCOEX CONFIG EVENT \n"));
memcpy(&ar->arBtcoexStats, pBtcoexStats, sizeof(WMI_BTCOEX_STATS_EVENT));
if (ar->statsUpdatePending) {
ar->statsUpdatePending = false;
wake_up(&arEvent);
}
}
| 0 |
memcached | d9cd01ede97f4145af9781d448c62a3318952719 | NOT_APPLICABLE | NOT_APPLICABLE | static void write_and_free(conn *c, char *buf, int bytes) {
if (buf) {
c->write_and_free = buf;
c->wcurr = buf;
c->wbytes = bytes;
conn_set_state(c, conn_write);
c->write_and_go = conn_new_cmd;
} else {
out_string(c, "SERVER_ERROR out of memory writing stats");
}
}
| 0 |
acrn-hypervisor | 154fe59531c12b82e26d1b24b5531f5066d224f5 | NOT_APPLICABLE | NOT_APPLICABLE | virtio_set_modern_mmio_bar(struct virtio_base *base, int barnum)
{
struct virtio_ops *vops;
int rc;
struct virtio_pci_cap cap = {
.cap_vndr = PCIY_VENDOR,
.cap_next = 0,
.cap_len = sizeof(cap),
.bar = barnum,
};
struct virtio_pci_notify_cap notify = {
.cap.cap_vndr = PCIY_VENDOR,
.cap.cap_next = 0,
.cap.cap_len = sizeof(notify),
.cap.cfg_type = VIRTIO_PCI_CAP_NOTIFY_CFG,
.cap.bar = barnum,
.cap.offset = VIRTIO_CAP_NOTIFY_OFFSET,
.cap.length = VIRTIO_CAP_NOTIFY_SIZE,
.notify_off_multiplier = VIRTIO_MODERN_NOTIFY_OFF_MULT,
};
struct virtio_pci_cfg_cap cfg = {
.cap.cap_vndr = PCIY_VENDOR,
.cap.cap_next = 0,
.cap.cap_len = sizeof(cfg),
.cap.cfg_type = VIRTIO_PCI_CAP_PCI_CFG,
};
vops = base->vops;
if (vops->cfgsize > VIRTIO_CAP_DEVICE_SIZE) {
pr_err("%s: cfgsize %lu > max %d\r\n",
vops->name, vops->cfgsize, VIRTIO_CAP_DEVICE_SIZE);
return -1;
}
/* common configuration capability */
cap.cfg_type = VIRTIO_PCI_CAP_COMMON_CFG;
cap.offset = VIRTIO_CAP_COMMON_OFFSET;
cap.length = VIRTIO_CAP_COMMON_SIZE;
rc = pci_emul_add_capability(base->dev, (u_char *)&cap, sizeof(cap));
if (rc != 0) {
pr_err("pci emulation add common configuration capability failed\n");
return -1;
}
/* isr status capability */
cap.cfg_type = VIRTIO_PCI_CAP_ISR_CFG;
cap.offset = VIRTIO_CAP_ISR_OFFSET;
cap.length = VIRTIO_CAP_ISR_SIZE;
rc = pci_emul_add_capability(base->dev, (u_char *)&cap, sizeof(cap));
if (rc != 0) {
pr_err("pci emulation add isr status capability failed\n");
return -1;
}
/* device specific configuration capability */
cap.cfg_type = VIRTIO_PCI_CAP_DEVICE_CFG;
cap.offset = VIRTIO_CAP_DEVICE_OFFSET;
cap.length = VIRTIO_CAP_DEVICE_SIZE;
rc = pci_emul_add_capability(base->dev, (u_char *)&cap, sizeof(cap));
if (rc != 0) {
pr_err("pci emulation add device specific configuration capability failed\n");
return -1;
}
/* notification capability */
rc = pci_emul_add_capability(base->dev, (u_char *)¬ify,
sizeof(notify));
if (rc != 0) {
pr_err("pci emulation add notification capability failed\n");
return -1;
}
/* pci alternative configuration access capability */
rc = pci_emul_add_capability(base->dev, (u_char *)&cfg, sizeof(cfg));
if (rc != 0) {
pr_err("pci emulation add alternative configuration access capability failed\n");
return -1;
}
/* allocate and register modern memory bar */
rc = pci_emul_alloc_bar(base->dev, barnum, PCIBAR_MEM64,
VIRTIO_MODERN_MEM_BAR_SIZE);
if (rc != 0) {
pr_err("allocate and register modern memory bar failed\n");
return -1;
}
base->cfg_coff = virtio_find_capability(base, VIRTIO_PCI_CAP_PCI_CFG);
if (base->cfg_coff < 0) {
pr_err("%s: VIRTIO_PCI_CAP_PCI_CFG not found\r\n",
vops->name);
return -1;
}
base->modern_mmio_bar_idx = barnum;
return 0;
} | 0 |
libsndfile | 85c877d5072866aadbe8ed0c3e0590fbb5e16788 | NOT_APPLICABLE | NOT_APPLICABLE | d2i_array (const double *src, int count, int *dest, double scale)
{ while (--count >= 0)
{ dest [count] = lrint (scale * src [count]) ;
} ;
} /* d2i_array */ | 0 |
rsyslog | dfa88369d4ca4290db56b843f9eabdae1bfe0fd5 | NOT_APPLICABLE | NOT_APPLICABLE | if(pThis->bIsDA && getPhysicalQueueSize(pThis) > 0 && pThis->bSaveOnShutdown) {
CHKiRet(DoSaveOnShutdown(pThis));
} | 0 |
Chrome | 5cd363bc34f508c63b66e653bc41bd1783a4b711 | NOT_APPLICABLE | NOT_APPLICABLE | void RenderFrameHostManager::EnsureRenderFrameHostVisibilityConsistent() {
RenderWidgetHostView* view = GetRenderWidgetHostView();
if (view && static_cast<RenderWidgetHostImpl*>(view->GetRenderWidgetHost())
->is_hidden() != delegate_->IsHidden()) {
if (delegate_->IsHidden()) {
view->Hide();
} else {
view->Show();
}
}
}
| 0 |
Android | 073a80800f341325932c66818ce4302b312909a4 | NOT_APPLICABLE | NOT_APPLICABLE | static void init_once() {
list_init(&created_effects_list);
list_init(&active_outputs_list);
pthread_mutex_init(&lock, NULL);
init_status = 0;
}
| 0 |
capstone | 87a25bb543c8e4c09b48d4b4a6c7db31ce58df06 | NOT_APPLICABLE | NOT_APPLICABLE | static void arr_replace(uint16_t *arr, uint8_t max, x86_reg r1, x86_reg r2)
{
uint8_t i;
for(i = 0; i < max; i++) {
if (arr[i] == r1) {
arr[i] = r2;
break;
}
}
}
| 0 |
evolution | 9c55a311325f5905d8b8403b96607e46cf343f21 | NOT_APPLICABLE | NOT_APPLICABLE | mail_parser_run (EMailParser *parser,
EMailPartList *part_list,
GCancellable *cancellable)
{
EMailExtensionRegistry *reg;
CamelMimeMessage *message;
EMailPart *mail_part;
GQueue *parsers;
GQueue mail_part_queue = G_QUEUE_INIT;
GList *iter;
GString *part_id;
if (cancellable)
g_object_ref (cancellable);
else
cancellable = g_cancellable_new ();
g_mutex_lock (&parser->priv->mutex);
g_hash_table_insert (parser->priv->ongoing_part_lists, cancellable, part_list);
g_mutex_unlock (&parser->priv->mutex);
message = e_mail_part_list_get_message (part_list);
reg = e_mail_parser_get_extension_registry (parser);
parsers = e_mail_extension_registry_get_for_mime_type (
reg, "application/vnd.evolution.message");
if (parsers == NULL)
parsers = e_mail_extension_registry_get_for_mime_type (
reg, "message/*");
/* No parsers means the internal Evolution parser
* extensions were not loaded. Something is terribly wrong! */
g_return_if_fail (parsers != NULL);
part_id = g_string_new (".message");
mail_part = e_mail_part_new (CAMEL_MIME_PART (message), ".message");
e_mail_part_list_add_part (part_list, mail_part);
g_object_unref (mail_part);
for (iter = parsers->head; iter; iter = iter->next) {
EMailParserExtension *extension;
gboolean message_handled;
if (g_cancellable_is_cancelled (cancellable))
break;
extension = iter->data;
if (!extension)
continue;
message_handled = e_mail_parser_extension_parse (
extension, parser,
CAMEL_MIME_PART (message),
part_id, cancellable, &mail_part_queue);
if (message_handled)
break;
}
mail_parser_move_security_before_headers (&mail_part_queue);
while (!g_queue_is_empty (&mail_part_queue)) {
mail_part = g_queue_pop_head (&mail_part_queue);
e_mail_part_list_add_part (part_list, mail_part);
g_object_unref (mail_part);
}
g_mutex_lock (&parser->priv->mutex);
g_hash_table_remove (parser->priv->ongoing_part_lists, cancellable);
g_mutex_unlock (&parser->priv->mutex);
g_clear_object (&cancellable);
g_string_free (part_id, TRUE);
} | 0 |
linux | c6688ef9f29762e65bce325ef4acd6c675806366 | NOT_APPLICABLE | NOT_APPLICABLE | static int is_set_interface_cmd(struct urb *urb)
{
struct usb_ctrlrequest *req;
req = (struct usb_ctrlrequest *) urb->setup_packet;
return (req->bRequest == USB_REQ_SET_INTERFACE) &&
(req->bRequestType == USB_RECIP_INTERFACE);
} | 0 |
linux | cf01fb9985e8deb25ccf0ea54d916b8871ae0e62 | NOT_APPLICABLE | NOT_APPLICABLE | static void migrate_page_add(struct page *page, struct list_head *pagelist,
unsigned long flags)
{
/*
* Avoid migrating a page that is shared with others.
*/
if ((flags & MPOL_MF_MOVE_ALL) || page_mapcount(page) == 1) {
if (!isolate_lru_page(page)) {
list_add_tail(&page->lru, pagelist);
inc_node_page_state(page, NR_ISOLATED_ANON +
page_is_file_cache(page));
}
}
}
| 0 |
php | 73cabfedf519298e1a11192699f44d53c529315e | NOT_APPLICABLE | NOT_APPLICABLE | static int add_oid_section(struct php_x509_request * req) /* {{{ */
{
char * str;
STACK_OF(CONF_VALUE) * sktmp;
CONF_VALUE * cnf;
int i;
str = CONF_get_string(req->req_config, NULL, "oid_section");
if (str == NULL) {
return SUCCESS;
}
sktmp = CONF_get_section(req->req_config, str);
if (sktmp == NULL) {
php_error_docref(NULL, E_WARNING, "problem loading oid section %s", str);
return FAILURE;
}
for (i = 0; i < sk_CONF_VALUE_num(sktmp); i++) {
cnf = sk_CONF_VALUE_value(sktmp, i);
if (OBJ_sn2nid(cnf->name) == NID_undef && OBJ_ln2nid(cnf->name) == NID_undef &&
OBJ_create(cnf->value, cnf->name, cnf->name) == NID_undef) {
php_error_docref(NULL, E_WARNING, "problem creating object %s=%s", cnf->name, cnf->value);
return FAILURE;
}
}
return SUCCESS;
}
/* }}} */
| 0 |
samba | c300a85848350635e7ddd8129b31c4d439dc0f8a | NOT_APPLICABLE | NOT_APPLICABLE | bool change_notify_fsp_has_changes(struct files_struct *fsp)
{
if (fsp == NULL) {
return false;
}
if (fsp->notify == NULL) {
return false;
}
if (fsp->notify->num_changes == 0) {
return false;
}
return true;
} | 0 |
qemu | ce560dcf20c14194db5ef3b9fc1ea592d4e68109 | NOT_APPLICABLE | NOT_APPLICABLE | static void cmd_read_dvd_structure(IDEState *s, uint8_t* buf)
{
int max_len;
int media = buf[1];
int format = buf[7];
int ret;
max_len = ube16_to_cpu(buf + 8);
if (format < 0xff) {
if (media_is_cd(s)) {
ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
ASC_INCOMPATIBLE_FORMAT);
return;
} else if (!media_present(s)) {
ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
ASC_INV_FIELD_IN_CMD_PACKET);
return;
}
}
memset(buf, 0, max_len > IDE_DMA_BUF_SECTORS * 512 + 4 ?
IDE_DMA_BUF_SECTORS * 512 + 4 : max_len);
switch (format) {
case 0x00 ... 0x7f:
case 0xff:
if (media == 0) {
ret = ide_dvd_read_structure(s, format, buf, buf);
if (ret < 0) {
ide_atapi_cmd_error(s, ILLEGAL_REQUEST, -ret);
} else {
ide_atapi_cmd_reply(s, ret, max_len);
}
break;
}
/* TODO: BD support, fall through for now */
/* Generic disk structures */
case 0x80: /* TODO: AACS volume identifier */
case 0x81: /* TODO: AACS media serial number */
case 0x82: /* TODO: AACS media identifier */
case 0x83: /* TODO: AACS media key block */
case 0x90: /* TODO: List of recognized format layers */
case 0xc0: /* TODO: Write protection status */
default:
ide_atapi_cmd_error(s, ILLEGAL_REQUEST,
ASC_INV_FIELD_IN_CMD_PACKET);
break;
}
} | 0 |
gpac | 6063b1a011c3f80cee25daade18154e15e4c058c | NOT_APPLICABLE | NOT_APPLICABLE |
GF_Err vmhd_Size(GF_Box *s)
{
GF_VideoMediaHeaderBox *ptr = (GF_VideoMediaHeaderBox *)s;
ptr->size += 8;
return GF_OK; | 0 |
Chrome | c3957448cfc6e299165196a33cd954b790875fdb | NOT_APPLICABLE | NOT_APPLICABLE | String Document::designMode() const {
return InDesignMode() ? "on" : "off";
}
| 0 |
oniguruma | 3b63d12038c8d8fc278e81c942fa9bec7c704c8b | NOT_APPLICABLE | NOT_APPLICABLE | bitset_and(BitSetRef dest, BitSetRef bs)
{
int i;
for (i = 0; i < (int )BITSET_SIZE; i++) { dest[i] &= bs[i]; }
}
| 0 |
linux | 3b2d69114fefa474fca542e51119036dceb4aa6f | NOT_APPLICABLE | NOT_APPLICABLE | struct acpi_namespace_node *acpi_ns_validate_handle(acpi_handle handle)
{
ACPI_FUNCTION_ENTRY();
/* Parameter validation */
if ((!handle) || (handle == ACPI_ROOT_OBJECT)) {
return (acpi_gbl_root_node);
}
/* We can at least attempt to verify the handle */
if (ACPI_GET_DESCRIPTOR_TYPE(handle) != ACPI_DESC_TYPE_NAMED) {
return (NULL);
}
return (ACPI_CAST_PTR(struct acpi_namespace_node, handle));
}
| 0 |
weechat | 9904cb6d2eb40f679d8ff6557c22d53a3e3dc75a | NOT_APPLICABLE | NOT_APPLICABLE | IRC_PROTOCOL_CALLBACK(numeric)
{
char *pos_args;
IRC_PROTOCOL_MIN_ARGS(3);
if (irc_server_strcasecmp (server, server->nick, argv[2]) == 0)
{
pos_args = (argc > 3) ?
((argv_eol[3][0] == ':') ? argv_eol[3] + 1 : argv_eol[3]) : NULL;
}
else
{
pos_args = (argv_eol[2][0] == ':') ? argv_eol[2] + 1 : argv_eol[2];
}
weechat_printf_date_tags (
irc_msgbuffer_get_target_buffer (server, NULL, command, NULL, NULL),
date,
irc_protocol_tags (command, "irc_numeric", NULL, NULL),
"%s%s",
weechat_prefix ("network"),
pos_args);
return WEECHAT_RC_OK;
} | 0 |
ceph | ff72c50a2c43c57aead933eb4903ad1ca6d1748a | NOT_APPLICABLE | NOT_APPLICABLE | tcp::endpoint parse_endpoint(boost::asio::string_view input,
unsigned short default_port,
boost::system::error_code& ec)
{
tcp::endpoint endpoint;
if (input.empty()) {
ec = boost::asio::error::invalid_argument;
return endpoint;
}
if (input[0] == '[') { // ipv6
const size_t addr_begin = 1;
const size_t addr_end = input.find(']');
if (addr_end == input.npos) { // no matching ]
ec = boost::asio::error::invalid_argument;
return endpoint;
}
if (addr_end + 1 < input.size()) {
// :port must must follow [ipv6]
if (input[addr_end + 1] != ':') {
ec = boost::asio::error::invalid_argument;
return endpoint;
} else {
auto port_str = input.substr(addr_end + 2);
endpoint.port(parse_port(port_str.data(), ec));
}
} else {
endpoint.port(default_port);
}
auto addr = input.substr(addr_begin, addr_end - addr_begin);
endpoint.address(boost::asio::ip::make_address_v6(addr, ec));
} else { // ipv4
auto colon = input.find(':');
if (colon != input.npos) {
auto port_str = input.substr(colon + 1);
endpoint.port(parse_port(port_str.data(), ec));
if (ec) {
return endpoint;
}
} else {
endpoint.port(default_port);
}
auto addr = input.substr(0, colon);
endpoint.address(boost::asio::ip::make_address_v4(addr, ec));
}
return endpoint;
} | 0 |
linux | ae53b5bd77719fed58086c5be60ce4f22bffe1c6 | NOT_APPLICABLE | NOT_APPLICABLE | void sctp_icmp_frag_needed(struct sock *sk, struct sctp_association *asoc,
struct sctp_transport *t, __u32 pmtu)
{
if (!t || (t->pathmtu <= pmtu))
return;
if (sock_owned_by_user(sk)) {
asoc->pmtu_pending = 1;
t->pmtu_pending = 1;
return;
}
if (t->param_flags & SPP_PMTUD_ENABLE) {
/* Update transports view of the MTU */
sctp_transport_update_pmtu(t, pmtu);
/* Update association pmtu. */
sctp_assoc_sync_pmtu(asoc);
}
/* Retransmit with the new pmtu setting.
* Normally, if PMTU discovery is disabled, an ICMP Fragmentation
* Needed will never be sent, but if a message was sent before
* PMTU discovery was disabled that was larger than the PMTU, it
* would not be fragmented, so it must be re-transmitted fragmented.
*/
sctp_retransmit(&asoc->outqueue, t, SCTP_RTXR_PMTUD);
}
| 0 |
Chrome | 09fbb829eab7ee25e90bb4e9c2f4973c6c62d0f3 | NOT_APPLICABLE | NOT_APPLICABLE | inline size_t SearchBuffer::append(const UChar* characters, size_t length)
{
ASSERT(length);
if (m_atBreak) {
m_buffer.shrink(0);
m_prefixLength = 0;
m_atBreak = false;
} else if (m_buffer.size() == m_buffer.capacity()) {
memcpy(m_buffer.data(), m_buffer.data() + m_buffer.size() - m_overlap, m_overlap * sizeof(UChar));
m_prefixLength -= min(m_prefixLength, m_buffer.size() - m_overlap);
m_buffer.shrink(m_overlap);
}
size_t oldLength = m_buffer.size();
size_t usableLength = min(m_buffer.capacity() - oldLength, length);
ASSERT(usableLength);
m_buffer.append(characters, usableLength);
foldQuoteMarksAndSoftHyphens(m_buffer.data() + oldLength, usableLength);
return usableLength;
}
| 0 |
xserver | 1b1d4c04695dced2463404174b50b3581dbd857b | NOT_APPLICABLE | NOT_APPLICABLE | DGAVTSwitch(void)
{
ScreenPtr pScreen;
int i;
for (i = 0; i < screenInfo.numScreens; i++) {
pScreen = screenInfo.screens[i];
/* Alternatively, this could send events to DGA clients */
if (DGAScreenKeyRegistered) {
DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen);
if (pScreenPriv && pScreenPriv->current)
return FALSE;
}
}
return TRUE;
}
| 0 |
libarchive | 59357157706d47c365b2227739e17daba3607526 | NOT_APPLICABLE | NOT_APPLICABLE | lazy_stat(struct archive_write_disk *a)
{
if (a->pst != NULL) {
/* Already have stat() data available. */
return (ARCHIVE_OK);
}
#ifdef HAVE_FSTAT
if (a->fd >= 0 && fstat(a->fd, &a->st) == 0) {
a->pst = &a->st;
return (ARCHIVE_OK);
}
#endif
/*
* XXX At this point, symlinks should not be hit, otherwise
* XXX a race occurred. Do we want to check explicitly for that?
*/
if (lstat(a->name, &a->st) == 0) {
a->pst = &a->st;
return (ARCHIVE_OK);
}
archive_set_error(&a->archive, errno, "Couldn't stat file");
return (ARCHIVE_WARN);
}
| 0 |
Android | c894aa36be535886a8e5ff02cdbcd07dd24618f6 | NOT_APPLICABLE | NOT_APPLICABLE | AudioFlinger::EffectHandle::~EffectHandle()
{
ALOGV("Destructor %p", this);
if (mEffect == 0) {
mDestroyed = true;
return;
}
mEffect->lock();
mDestroyed = true;
mEffect->unlock();
disconnect(false);
}
| 0 |
linux | 43761473c254b45883a64441dd0bc85a42f3645c | NOT_APPLICABLE | NOT_APPLICABLE | void __audit_log_capset(const struct cred *new, const struct cred *old)
{
struct audit_context *context = current->audit_context;
context->capset.pid = task_pid_nr(current);
context->capset.cap.effective = new->cap_effective;
context->capset.cap.inheritable = new->cap_effective;
context->capset.cap.permitted = new->cap_permitted;
context->type = AUDIT_CAPSET;
}
| 0 |
server | 9e39d0ae44595dbd1570805d97c9c874778a6be8 | NOT_APPLICABLE | NOT_APPLICABLE | int ha_maria::index_read_idx_map(uchar * buf, uint index, const uchar * key,
key_part_map keypart_map,
enum ha_rkey_function find_flag)
{
int error;
register_handler(file);
/* Use the pushed index condition if it matches the index we're scanning */
end_range= NULL;
if (index == pushed_idx_cond_keyno)
ma_set_index_cond_func(file, handler_index_cond_check, this);
error= maria_rkey(file, buf, index, key, keypart_map, find_flag);
ma_set_index_cond_func(file, NULL, 0);
return error;
} | 0 |
Chrome | 7f8cdab6fda192d15e45a3e9682b1eec427870c5 | NOT_APPLICABLE | NOT_APPLICABLE | bool ShellWindowViews::CanMaximize() const {
return true;
}
| 0 |
linux-2.6 | 28e9fc592cb8c7a43e4d3147b38be6032a0e81bc | NOT_APPLICABLE | NOT_APPLICABLE | static int llc_ui_wait_for_busy_core(struct sock *sk, long timeout)
{
DEFINE_WAIT(wait);
struct llc_sock *llc = llc_sk(sk);
int rc;
while (1) {
prepare_to_wait(sk->sk_sleep, &wait, TASK_INTERRUPTIBLE);
rc = 0;
if (sk_wait_event(sk, &timeout,
(sk->sk_shutdown & RCV_SHUTDOWN) ||
(!llc_data_accept_state(llc->state) &&
!llc->remote_busy_flag &&
!llc->p_flag)))
break;
rc = -ERESTARTSYS;
if (signal_pending(current))
break;
rc = -EAGAIN;
if (!timeout)
break;
}
finish_wait(sk->sk_sleep, &wait);
return rc;
} | 0 |
cgit | 53efaf30b50f095cad8c160488c74bba3e3b2680 | NOT_APPLICABLE | NOT_APPLICABLE | void cgit_clone_head(void)
{
send_file(git_path("%s", "HEAD"));
} | 0 |
jdk11u-dev | 41825fa33d605f8501164f9296572e4378e8183b | NOT_APPLICABLE | NOT_APPLICABLE | JNIid::JNIid(Klass* holder, int offset, JNIid* next) {
_holder = holder;
_offset = offset;
_next = next;
debug_only(_is_static_field_id = false;)
} | 0 |
linux | c290f8358acaeffd8e0c551ddcc24d1206143376 | NOT_APPLICABLE | NOT_APPLICABLE | void tty_shutdown(struct tty_struct *tty)
{
tty_driver_remove_tty(tty->driver, tty);
tty_free_termios(tty);
}
| 0 |
cronie | acdf4ae8456888ed78201906ef528f4c28f54582 | NOT_APPLICABLE | NOT_APPLICABLE | static void parse_args(int argc, char *argv[]) {
int argch;
while (-1 != (argch = getopt(argc, argv, "hnpsix:m:c"))) {
switch (argch) {
case 'x':
if (!set_debug_flags(optarg))
usage();
break;
case 'n':
NoFork = 1;
break;
case 'p':
PermitAnyCrontab = 1;
break;
case 's':
SyslogOutput = 1;
break;
case 'i':
DisableInotify = 1;
break;
case 'm':
strncpy(MailCmd, optarg, MAX_COMMAND);
break;
case 'c':
EnableClustering = 1;
break;
case 'h':
default:
usage();
break;
}
}
} | 0 |
linux | 15fab63e1e57be9fdb5eec1bbc5916e9825e9acb | CVE-2019-11487 | CWE-416 | static int link_pipe(struct pipe_inode_info *ipipe,
struct pipe_inode_info *opipe,
size_t len, unsigned int flags)
{
struct pipe_buffer *ibuf, *obuf;
int ret = 0, i = 0, nbuf;
/*
* Potential ABBA deadlock, work around it by ordering lock
* grabbing by pipe info address. Otherwise two different processes
* could deadlock (one doing tee from A -> B, the other from B -> A).
*/
pipe_double_lock(ipipe, opipe);
do {
if (!opipe->readers) {
send_sig(SIGPIPE, current, 0);
if (!ret)
ret = -EPIPE;
break;
}
/*
* If we have iterated all input buffers or ran out of
* output room, break.
*/
if (i >= ipipe->nrbufs || opipe->nrbufs >= opipe->buffers)
break;
ibuf = ipipe->bufs + ((ipipe->curbuf + i) & (ipipe->buffers-1));
nbuf = (opipe->curbuf + opipe->nrbufs) & (opipe->buffers - 1);
/*
* Get a reference to this pipe buffer,
* so we can copy the contents over.
*/
pipe_buf_get(ipipe, ibuf);
obuf = opipe->bufs + nbuf;
*obuf = *ibuf;
/*
* Don't inherit the gift flag, we need to
* prevent multiple steals of this page.
*/
obuf->flags &= ~PIPE_BUF_FLAG_GIFT;
if (obuf->len > len)
obuf->len = len;
opipe->nrbufs++;
ret += obuf->len;
len -= obuf->len;
i++;
} while (len);
/*
* return EAGAIN if we have the potential of some data in the
* future, otherwise just return 0
*/
if (!ret && ipipe->waiting_writers && (flags & SPLICE_F_NONBLOCK))
ret = -EAGAIN;
pipe_unlock(ipipe);
pipe_unlock(opipe);
/*
* If we put data in the output pipe, wakeup any potential readers.
*/
if (ret > 0)
wakeup_pipe_readers(opipe);
return ret;
}
| 1 |
linux | dbb2483b2a46fbaf833cfb5deb5ed9cace9c7399 | NOT_APPLICABLE | NOT_APPLICABLE | static inline __u32 xfrm_smark_get(__u32 mark, struct xfrm_state *x)
{
struct xfrm_mark *m = &x->props.smark;
return (m->v & m->m) | (mark & ~m->m);
} | 0 |
php-src | 5b597a2e5b28e2d5a52fc1be13f425f08f47cb62?w=1 | NOT_APPLICABLE | NOT_APPLICABLE | const char *php_mb_regex_get_mbctype(TSRMLS_D)
{
return _php_mb_regex_mbctype2name(MBREX(current_mbctype));
}
| 0 |
exim | 57aa14b216432be381b6295c312065b2fd034f86 | NOT_APPLICABLE | NOT_APPLICABLE | spa_build_auth_response (SPAAuthChallenge * challenge,
SPAAuthResponse * response, char *user,
char *password)
{
uint8x lmRespData[24];
uint8x ntRespData[24];
char *d = strdup (GetUnicodeString (challenge, uDomain));
char *domain = d;
char *u = strdup (user);
char *p = strchr (u, '@');
if (p)
{
domain = p + 1;
*p = '\0';
}
spa_smb_encrypt (US password, challenge->challengeData, lmRespData);
spa_smb_nt_encrypt (US password, challenge->challengeData, ntRespData);
response->bufIndex = 0;
memcpy (response->ident, "NTLMSSP\0\0\0", 8);
SIVAL (&response->msgType, 0, 3);
spa_bytes_add (response, lmResponse, lmRespData, 24);
spa_bytes_add (response, ntResponse, ntRespData, 24);
spa_unicode_add_string (response, uDomain, domain);
spa_unicode_add_string (response, uUser, u);
spa_unicode_add_string (response, uWks, u);
spa_string_add (response, sessionKey, NULL);
response->flags = challenge->flags;
free (d);
free (u);
} | 0 |
staging | 4c41aa24baa4ed338241d05494f2c595c885af8f | NOT_APPLICABLE | NOT_APPLICABLE | ncp_write_kernel(struct ncp_server *server, const char *file_id,
__u32 offset, __u16 to_write,
const char *source, int *bytes_written)
{
int result;
ncp_init_request(server);
ncp_add_byte(server, 0);
ncp_add_mem(server, file_id, 6);
ncp_add_be32(server, offset);
ncp_add_be16(server, to_write);
ncp_add_mem(server, source, to_write);
if ((result = ncp_request(server, 73)) == 0)
*bytes_written = to_write;
ncp_unlock_server(server);
return result;
} | 0 |
Chrome | 6b96dd532af164a73f2aac757bafff58211aca2c | CVE-2013-6635 | CWE-399 | void ChromeWebContentsDelegateAndroid::AddNewContents(
WebContents* source,
WebContents* new_contents,
WindowOpenDisposition disposition,
const gfx::Rect& initial_rect,
bool user_gesture,
bool* was_blocked) {
DCHECK_NE(disposition, SAVE_TO_DISK);
DCHECK_NE(disposition, CURRENT_TAB);
TabHelpers::AttachTabHelpers(new_contents);
JNIEnv* env = AttachCurrentThread();
ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env);
AddWebContentsResult add_result =
ADD_WEB_CONTENTS_RESULT_STOP_LOAD_AND_DELETE;
if (!obj.is_null()) {
ScopedJavaLocalRef<jobject> jsource;
if (source)
jsource = source->GetJavaWebContents();
ScopedJavaLocalRef<jobject> jnew_contents;
if (new_contents)
jnew_contents = new_contents->GetJavaWebContents();
add_result = static_cast<AddWebContentsResult>(
Java_ChromeWebContentsDelegateAndroid_addNewContents(
env,
obj.obj(),
jsource.obj(),
jnew_contents.obj(),
static_cast<jint>(disposition),
NULL,
user_gesture));
}
if (was_blocked)
*was_blocked = !(add_result == ADD_WEB_CONTENTS_RESULT_PROCEED);
if (add_result == ADD_WEB_CONTENTS_RESULT_STOP_LOAD_AND_DELETE)
delete new_contents;
}
| 1 |
Chrome | f084d7007f67809ef116ee6b11f251bf3c9ed895 | NOT_APPLICABLE | NOT_APPLICABLE | void ContainerNode::attach(const AttachContext& context)
{
attachChildren(context);
clearChildNeedsStyleRecalc();
Node::attach(context);
}
| 0 |
linux-2.6 | 17ac2e9c58b69a1e25460a568eae1b0dc0188c25 | NOT_APPLICABLE | NOT_APPLICABLE | static void rose_destroy_timer(unsigned long data)
{
rose_destroy_socket((struct sock *)data);
} | 0 |
linux | 68035c80e129c4cfec659aac4180354530b26527 | NOT_APPLICABLE | NOT_APPLICABLE | static void uvc_stream_delete(struct uvc_streaming *stream)
{
if (stream->async_wq)
destroy_workqueue(stream->async_wq);
mutex_destroy(&stream->mutex);
usb_put_intf(stream->intf);
kfree(stream->format);
kfree(stream->header.bmaControls);
kfree(stream);
} | 0 |
FreeRDP | b73143cf7ee5fe4cdabcbf56908aa15d8a883821 | NOT_APPLICABLE | NOT_APPLICABLE | wStream* cliprdr_packet_new(UINT16 msgType, UINT16 msgFlags, UINT32 dataLen)
{
wStream* s;
s = Stream_New(NULL, dataLen + 8);
if (!s)
{
WLog_ERR(TAG, "Stream_New failed!");
return NULL;
}
Stream_Write_UINT16(s, msgType);
Stream_Write_UINT16(s, msgFlags);
/* Write actual length after the entire packet has been constructed. */
Stream_Seek(s, 4);
return s;
} | 0 |
linux | 340d394a789518018f834ff70f7534fc463d3226 | NOT_APPLICABLE | NOT_APPLICABLE | static int i8042_pm_suspend(struct device *dev)
{
int i;
if (pm_suspend_via_firmware())
i8042_controller_reset(true);
/* Set up serio interrupts for system wakeup. */
for (i = 0; i < I8042_NUM_PORTS; i++) {
struct serio *serio = i8042_ports[i].serio;
if (serio && device_may_wakeup(&serio->dev))
enable_irq_wake(i8042_ports[i].irq);
}
return 0;
}
| 0 |
Chrome | 1c40f9042ae2d6ee7483d72998aabb5e73b2ff60 | NOT_APPLICABLE | NOT_APPLICABLE | std::unique_ptr<TracedValue> InspectorResourceFinishEvent::Data(
unsigned long identifier,
double finish_time,
bool did_fail,
int64_t encoded_data_length,
int64_t decoded_body_length) {
String request_id = IdentifiersFactory::RequestId(identifier);
std::unique_ptr<TracedValue> value = TracedValue::Create();
value->SetString("requestId", request_id);
value->SetBoolean("didFail", did_fail);
value->SetDouble("encodedDataLength", encoded_data_length);
value->SetDouble("decodedBodyLength", decoded_body_length);
if (finish_time)
value->SetDouble("finishTime", finish_time);
return value;
}
| 0 |
Chrome | 70340ce072cee8a0bdcddb5f312d32567b2269f6 | NOT_APPLICABLE | NOT_APPLICABLE | VaapiVideoDecodeAccelerator::GetSupportedProfiles() {
return VaapiWrapper::GetSupportedDecodeProfiles();
}
| 0 |
linux-stable | 59643d1535eb220668692a5359de22545af579f6 | NOT_APPLICABLE | NOT_APPLICABLE | static bool rb_is_reader_page(struct buffer_page *page)
{
struct list_head *list = page->list.prev;
return rb_list_head(list->next) != &page->list;
} | 0 |
linux | 295dc39d941dc2ae53d5c170365af4c9d5c16212 | NOT_APPLICABLE | NOT_APPLICABLE | int page_symlink(struct inode *inode, const char *symname, int len)
{
return __page_symlink(inode, symname, len,
!(mapping_gfp_mask(inode->i_mapping) & __GFP_FS));
}
| 0 |
linux | 3567eb6af614dac436c4b16a8d426f9faed639b3 | NOT_APPLICABLE | NOT_APPLICABLE | void snd_seq_check_queue(struct snd_seq_queue *q, int atomic, int hop)
{
unsigned long flags;
struct snd_seq_event_cell *cell;
if (q == NULL)
return;
/* make this function non-reentrant */
spin_lock_irqsave(&q->check_lock, flags);
if (q->check_blocked) {
q->check_again = 1;
spin_unlock_irqrestore(&q->check_lock, flags);
return; /* other thread is already checking queues */
}
q->check_blocked = 1;
spin_unlock_irqrestore(&q->check_lock, flags);
__again:
/* Process tick queue... */
while ((cell = snd_seq_prioq_cell_peek(q->tickq)) != NULL) {
if (snd_seq_compare_tick_time(&q->timer->tick.cur_tick,
&cell->event.time.tick)) {
cell = snd_seq_prioq_cell_out(q->tickq);
if (cell)
snd_seq_dispatch_event(cell, atomic, hop);
} else {
/* event remains in the queue */
break;
}
}
/* Process time queue... */
while ((cell = snd_seq_prioq_cell_peek(q->timeq)) != NULL) {
if (snd_seq_compare_real_time(&q->timer->cur_time,
&cell->event.time.time)) {
cell = snd_seq_prioq_cell_out(q->timeq);
if (cell)
snd_seq_dispatch_event(cell, atomic, hop);
} else {
/* event remains in the queue */
break;
}
}
/* free lock */
spin_lock_irqsave(&q->check_lock, flags);
if (q->check_again) {
q->check_again = 0;
spin_unlock_irqrestore(&q->check_lock, flags);
goto __again;
}
q->check_blocked = 0;
spin_unlock_irqrestore(&q->check_lock, flags);
}
| 0 |
linux | 8909c9ad8ff03611c9c96c9a92656213e4bb495b | NOT_APPLICABLE | NOT_APPLICABLE | static int __dev_close_many(struct list_head *head)
{
struct net_device *dev;
ASSERT_RTNL();
might_sleep();
list_for_each_entry(dev, head, unreg_list) {
/*
* Tell people we are going down, so that they can
* prepare to death, when device is still operating.
*/
call_netdevice_notifiers(NETDEV_GOING_DOWN, dev);
clear_bit(__LINK_STATE_START, &dev->state);
/* Synchronize to scheduled poll. We cannot touch poll list, it
* can be even on different cpu. So just clear netif_running().
*
* dev->stop() will invoke napi_disable() on all of it's
* napi_struct instances on this device.
*/
smp_mb__after_clear_bit(); /* Commit netif_running(). */
}
dev_deactivate_many(head);
list_for_each_entry(dev, head, unreg_list) {
const struct net_device_ops *ops = dev->netdev_ops;
/*
* Call the device specific close. This cannot fail.
* Only if device is UP
*
* We allow it to be called even after a DETACH hot-plug
* event.
*/
if (ops->ndo_stop)
ops->ndo_stop(dev);
/*
* Device is now down.
*/
dev->flags &= ~IFF_UP;
/*
* Shutdown NET_DMA
*/
net_dmaengine_put();
}
return 0;
}
| 0 |
gpsd | 08edc49d8f63c75bfdfb480b083b0d960310f94f | NOT_APPLICABLE | NOT_APPLICABLE | static void aivdm_event_hook(struct gps_device_t *session, event_t event)
{
if (event == event_configure)
/*@i1@*/session->aivdm->type24_queue.index = 0;
} | 0 |
tensorflow | 204945b19e44b57906c9344c0d00120eeeae178a | NOT_APPLICABLE | NOT_APPLICABLE | TEST(SegmentSumOpModelTest, Int32Test_OneDimension) {
SegmentSumOpModel<int32_t> model({TensorType_INT32, {3}},
{TensorType_INT32, {3}});
model.PopulateTensor<int32_t>(model.data(), {1, 2, 3});
model.PopulateTensor<int32_t>(model.segment_ids(), {0, 0, 1});
model.Invoke();
EXPECT_THAT(model.GetOutput(), ElementsAreArray({3, 3}));
EXPECT_THAT(model.GetOutputShape(), ElementsAreArray({2}));
} | 0 |
libgd | 4859d69e07504d4b0a4bdf9bcb4d9e3769ca35ae | NOT_APPLICABLE | NOT_APPLICABLE | BGD_DECLARE(gdImagePtr) gdImageCreateFromTiffPtr(int size, void *data)
{
gdImagePtr im;
gdIOCtx *in = gdNewDynamicCtxEx (size, data, 0);
if (in == NULL) return NULL;
im = gdImageCreateFromTiffCtx(in);
in->gd_free(in);
return im;
}
| 0 |
Chrome | b7a161633fd7ecb59093c2c56ed908416292d778 | NOT_APPLICABLE | NOT_APPLICABLE | PassRefPtr<AccessibilityUIElement> AccessibilityUIElement::rowAtIndex(unsigned index)
{
return 0;
}
| 0 |
ardour | 96daa4036a425ff3f23a7dfcba57bfb0f942bec6 | NOT_APPLICABLE | NOT_APPLICABLE | XMLNode::remove_property_recursively(const string& n)
{
remove_property (n);
for (XMLNodeIterator i = _children.begin(); i != _children.end(); ++i) {
(*i)->remove_property_recursively (n);
}
} | 0 |
neomutt | 57971dba06346b2d7179294f4528b8d4427a7c5d | NOT_APPLICABLE | NOT_APPLICABLE | void imap_allow_reopen(struct Context *ctx)
{
struct ImapData *idata = NULL;
if (!ctx || !ctx->data || ctx->magic != MUTT_IMAP)
return;
idata = ctx->data;
if (idata->ctx == ctx)
idata->reopen |= IMAP_REOPEN_ALLOW;
} | 0 |
php-src | 81406c0c1d45f75fcc7972ed974d2597abb0b9e9 | NOT_APPLICABLE | NOT_APPLICABLE | static size_t php_zip_ops_write(php_stream *stream, const char *buf, size_t count TSRMLS_DC)
{
if (!stream) {
return 0;
}
return count;
} | 0 |
date | 8f2d7a0c7e52cea8333824bd527822e5449ed83d | NOT_APPLICABLE | NOT_APPLICABLE | set_of(union DateData *x, int of)
{
assert(complex_dat_p(x));
get_c_jd(x);
get_c_df(x);
clear_civil(x);
x->c.of = of;
} | 0 |
linux | 0720a06a7518c9d0c0125bd5d1f3b6264c55c3dd | NOT_APPLICABLE | NOT_APPLICABLE | static int vfat_build_slots(struct inode *dir, const unsigned char *name,
int len, int is_dir, int cluster,
struct timespec *ts,
struct msdos_dir_slot *slots, int *nr_slots)
{
struct msdos_sb_info *sbi = MSDOS_SB(dir->i_sb);
struct fat_mount_options *opts = &sbi->options;
struct msdos_dir_slot *ps;
struct msdos_dir_entry *de;
unsigned char cksum, lcase;
unsigned char msdos_name[MSDOS_NAME];
wchar_t *uname;
__le16 time, date;
u8 time_cs;
int err, ulen, usize, i;
loff_t offset;
*nr_slots = 0;
uname = __getname();
if (!uname)
return -ENOMEM;
err = xlate_to_uni(name, len, (unsigned char *)uname, &ulen, &usize,
opts->unicode_xlate, opts->utf8, sbi->nls_io);
if (err)
goto out_free;
err = vfat_is_used_badchars(uname, ulen);
if (err)
goto out_free;
err = vfat_create_shortname(dir, sbi->nls_disk, uname, ulen,
msdos_name, &lcase);
if (err < 0)
goto out_free;
else if (err == 1) {
de = (struct msdos_dir_entry *)slots;
err = 0;
goto shortname;
}
/* build the entry of long file name */
cksum = fat_checksum(msdos_name);
*nr_slots = usize / 13;
for (ps = slots, i = *nr_slots; i > 0; i--, ps++) {
ps->id = i;
ps->attr = ATTR_EXT;
ps->reserved = 0;
ps->alias_checksum = cksum;
ps->start = 0;
offset = (i - 1) * 13;
fatwchar_to16(ps->name0_4, uname + offset, 5);
fatwchar_to16(ps->name5_10, uname + offset + 5, 6);
fatwchar_to16(ps->name11_12, uname + offset + 11, 2);
}
slots[0].id |= 0x40;
de = (struct msdos_dir_entry *)ps;
shortname:
/* build the entry of 8.3 alias name */
(*nr_slots)++;
memcpy(de->name, msdos_name, MSDOS_NAME);
de->attr = is_dir ? ATTR_DIR : ATTR_ARCH;
de->lcase = lcase;
fat_time_unix2fat(sbi, ts, &time, &date, &time_cs);
de->time = de->ctime = time;
de->date = de->cdate = de->adate = date;
de->ctime_cs = time_cs;
de->start = cpu_to_le16(cluster);
de->starthi = cpu_to_le16(cluster >> 16);
de->size = 0;
out_free:
__putname(uname);
return err;
}
| 0 |
yubico-pam | 4712da70cac159d5ca9579c1e4fac0645b674043 | NOT_APPLICABLE | NOT_APPLICABLE | pam_sm_setcred (pam_handle_t * pamh, int flags, int argc, const char **argv)
{
return PAM_SUCCESS;
} | 0 |
php-src | 5fdfab743d964bb13602effc9efcd6f747e2f58c | NOT_APPLICABLE | NOT_APPLICABLE | PHP_FUNCTION(curl_close)
{
zval *zid;
php_curl *ch;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &zid) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(ch, php_curl *, &zid, -1, le_curl_name, le_curl);
if (ch->in_callback) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Attempt to close cURL handle from a callback");
return;
}
zend_list_delete(Z_LVAL_P(zid));
} | 0 |
FreeRDP | ce21b9d7ecd967e0bc98ed31a6b3757848aa6c9e | NOT_APPLICABLE | NOT_APPLICABLE | INLINE BOOL gdi_SetRgn(HGDI_RGN hRgn, INT32 nXLeft, INT32 nYLeft, INT32 nWidth, INT32 nHeight)
{
hRgn->x = nXLeft;
hRgn->y = nYLeft;
hRgn->w = nWidth;
hRgn->h = nHeight;
hRgn->null = FALSE;
return TRUE;
} | 0 |
qemu | 4f1c6cb2f9afafda05eab150fd2bd284edce6676 | NOT_APPLICABLE | NOT_APPLICABLE | void rom_reset_order_override(void)
{
if (!fw_cfg)
return;
fw_cfg_reset_order_override(fw_cfg);
} | 0 |
hhvm | f1cd34e63c2a0d9702be3d41462db7bfd0ae7da3 | NOT_APPLICABLE | NOT_APPLICABLE | Variant HHVM_FUNCTION(imageaffinematrixget,
int64_t type,
const Variant& options /* = Array() */) {
Array ret = Array::Create();
double affine[6];
int res = GD_FALSE, i;
switch((gdAffineStandardMatrix)type) {
case GD_AFFINE_TRANSLATE:
case GD_AFFINE_SCALE: {
double x, y;
Array aoptions = options.toArray();
if (aoptions.empty()) {
raise_warning("imageaffinematrixget(): Array expected as options");
return false;
}
if (aoptions.exists(s_x)) {
x = aoptions[s_x].toDouble();
} else {
raise_warning("imageaffinematrixget(): Missing x position");
return false;
}
if (aoptions.exists(s_y)) {
y = aoptions[s_y].toDouble();
} else {
raise_warning("imageaffinematrixget(): Missing x position");
return false;
}
if (type == GD_AFFINE_TRANSLATE) {
res = gdAffineTranslate(affine, x, y);
} else {
res = gdAffineScale(affine, x, y);
}
break;
}
case GD_AFFINE_ROTATE:
case GD_AFFINE_SHEAR_HORIZONTAL:
case GD_AFFINE_SHEAR_VERTICAL: {
double angle;
double doptions = options.toDouble();
if (!doptions) {
raise_warning("imageaffinematrixget(): Number is expected as option");
return false;
}
angle = doptions;
if (type == GD_AFFINE_SHEAR_HORIZONTAL) {
res = gdAffineShearHorizontal(affine, angle);
} else if (type == GD_AFFINE_SHEAR_VERTICAL) {
res = gdAffineShearVertical(affine, angle);
} else {
res = gdAffineRotate(affine, angle);
}
break;
}
default:
raise_warning("imageaffinematrixget():Invalid type for "
"element %" PRId64, type);
return false;
}
if (res == GD_FALSE) {
return false;
} else {
for (i = 0; i < 6; i++) {
ret.set(String(i, CopyString), affine[i]);
}
}
return ret;
} | 0 |
linux | ccd5b3235180eef3cfec337df1c8554ab151b5cc | NOT_APPLICABLE | NOT_APPLICABLE | static inline void arch_bprm_mm_init(struct mm_struct *mm,
struct vm_area_struct *vma)
{
mpx_mm_init(mm);
} | 0 |
Chrome | 0da6dcdbe8e34740133773d20cc466b89d399d0a | NOT_APPLICABLE | NOT_APPLICABLE | bool XSSAuditor::FilterMetaToken(const FilterTokenRequest& request) {
DCHECK_EQ(request.token.GetType(), HTMLToken::kStartTag);
DCHECK(HasName(request.token, metaTag));
return EraseAttributeIfInjected(request, http_equivAttr);
}
| 0 |
linux | 0e5cc9a40ada6046e6bc3bdfcd0c0d7e4b706b14 | NOT_APPLICABLE | NOT_APPLICABLE | int udf_build_ustr(struct ustr *dest, dstring *ptr, int size)
{
int usesize;
if (!dest || !ptr || !size)
return -1;
BUG_ON(size < 2);
usesize = min_t(size_t, ptr[size - 1], sizeof(dest->u_name));
usesize = min(usesize, size - 2);
dest->u_cmpID = ptr[0];
dest->u_len = usesize;
memcpy(dest->u_name, ptr + 1, usesize);
memset(dest->u_name + usesize, 0, sizeof(dest->u_name) - usesize);
return 0;
}
| 0 |
Subsets and Splits