functionSource
stringlengths 20
729k
| fName
stringlengths 59
73
| oriFile
stringlengths 5
109
| startEndLine
stringlengths 3
11
| label
int64 0
1
| vulLine
int64 0
16.3k
| cwe
stringclasses 2
values |
---|---|---|---|---|---|---|
int main(int argc, char * argv[])
{
srand( (unsigned)time(NULL) );
#ifndef OMITGOOD
printLine("Calling good()...");
good();
printLine("Finished good()");
#endif
#ifndef OMITBAD
printLine("Calling bad()...");
bad();
printLine("Finished bad()");
#endif
return 0;
} | VulDeePecker-master-joern/CWE-119/source_files/66860/myfile_4.c | CWE121_Stack_Based_Buffer_Overflow__dest_wchar_t_alloca_cat_73a.cpp | 93,108 | 0 | 0 | CWE-119 |
void CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_alloca_ncpy_54c_goodG2BSink(wchar_t * data)
{
CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_alloca_ncpy_54d_goodG2BSink(data);
} | VulDeePecker-master-joern/CWE-119/source_files/66312/myfile_7.c | CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_alloca_ncpy_54c.c | 41,44 | 0 | 0 | CWE-119 |
static int proto_seq_show(struct seq_file *seq, void *v)
{
if (v == &proto_list)
seq_printf(seq, "%-9s %-4s %-8s %-6s %-5s %-7s %-4s %-10s %s",
"protocol",
"size",
"sockets",
"memory",
"press",
"maxhdr",
"slab",
"module",
"cl co di ac io in de sh ss gs se re sp bi br ha uh gp em\n");
else
proto_seq_printf(seq, list_entry(v, struct proto, node));
return 0;
} | VulDeePecker-master-joern/CWE-119/source_files/CVE-2012-6704/myfile_14.c | linux_kernel_3.4.113_CVE_2012_6704_net_core_sock.c | 2621,2637 | 0 | 0 | CWE-119 |
void
AudioBufferSourceNode::SendBufferParameterToStream(JSContext* aCx)
{
AudioNodeStream* ns = static_cast<AudioNodeStream*>(mStream.get());
MOZ_ASSERT(ns, "Why don't we have a stream here?");
if (mBuffer) {
float rate = mBuffer->SampleRate();
nsRefPtr<ThreadSharedFloatArrayBufferList> data =
mBuffer->GetThreadSharedChannelsForRate(aCx);
ns->SetBuffer(data.forget());
ns->SetInt32Parameter(SAMPLE_RATE, rate);
if (mStartCalled) {
SendOffsetAndDurationParametersToStream(ns, mOffset, mDuration);
}
} else {
ns->SetBuffer(nullptr);
}
} | VulDeePecker-master-joern/CWE-119/source_files/CVE-2014-1549/myfile_6.c | Firefox_27.0.1_CVE_2014_1549_content_media_webaudio_AudioBufferSourceNode.cpp | 523,542 | 0 | 0 | CWE-119 |
nsSize
nsFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
nsSize aCBSize, nscoord aAvailableWidth,
nsSize aMargin, nsSize aBorder, nsSize aPadding,
bool aShrinkWrap)
{
nsSize result(0xdeadbeef, NS_UNCONSTRAINEDSIZE);
if (GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Auto) {
nscoord availBased = aAvailableWidth - aMargin.width - aBorder.width -
aPadding.width;
result.width = ShrinkWidthToFit(aRenderingContext, availBased);
}
return result;
} | VulDeePecker-master-joern/CWE-399/source_files/CVE-2012-1974/myfile_59.c | firefox_14.0b12_CVE_2012_1974_layout_generic_nsFrame.cpp | 3893,3909 | 0 | 0 | CWE-399 |
static unsigned int rt_hash_code(u32 daddr, u32 saddr, u8 tos)
{
return (jhash_3words(daddr, saddr, (u32) tos, rt_hash_rnd)
& rt_hash_mask);
} | VulDeePecker-master-joern/CWE-399/source_files/CVE-2006-1525/myfile_3.c | linux_kernel_2.5.75_CVE_2006_1525_net_ipv4_route.c | 208,212 | 0 | 0 | CWE-399 |
static void xhci_wakeup_endpoint(USBBus *bus, USBEndpoint *ep,
unsigned int stream)
{
XHCIState *xhci = container_of(bus, XHCIState, bus);
int slotid;
DPRINTF("%s\n", __func__);
slotid = ep->dev->addr;
if (slotid == 0 || !xhci->slots[slotid-1].enabled) {
DPRINTF("%s: oops, no slot for dev %d\n", __func__, ep->dev->addr);
return;
}
xhci_kick_ep(xhci, slotid, xhci_find_epid(ep), stream);
} | VulDeePecker-master-joern/CWE-119/source_files/CVE-2014-5263/myfile_65.c | qemu_1.6.0_CVE-2014-5263_hcd-xhci.c | 3276,3289 | 0 | 0 | CWE-119 |
void CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_ncpy_10_bad()
{
char * data;
char dataBadBuffer[10];
char dataGoodBuffer[10+1];
if(globalTrue)
{
data = dataBadBuffer;
data[0] = '\0';
}
{
char source[10+1] = SRC_STRING;
strncpy(data, source, strlen(source) + 1);
printLine(data);
}
} | VulDeePecker-master-joern/CWE-119/source_files/63401/myfile_1.c | CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_ncpy_10.c | 28,47 | 1 | 44 | CWE-119 |
static struct create_durable *
create_reconnect_durable_buf(struct cifs_fid *fid)
{
struct create_durable *buf;
buf = kzalloc(sizeof(struct create_durable), GFP_KERNEL);
if (!buf)
return NULL;
buf->ccontext.DataOffset = cpu_to_le16(offsetof
(struct create_durable, Data));
buf->ccontext.DataLength = cpu_to_le32(16);
buf->ccontext.NameOffset = cpu_to_le16(offsetof
(struct create_durable, Name));
buf->ccontext.NameLength = cpu_to_le16(4);
buf->Data.Fid.PersistentFileId = fid->persistent_fid;
buf->Data.Fid.VolatileFileId = fid->volatile_fid;
buf->Name[0] = 'D';
buf->Name[1] = 'H';
buf->Name[2] = 'n';
buf->Name[3] = 'C';
return buf;
} | VulDeePecker-master-joern/CWE-399/source_files/CVE-2014-7145/myfile_12.c | linux_kernel_3.11.9_CVE_2014_7145_fs_cifs_smb2pdu.c | 872,894 | 0 | 0 | CWE-399 |
void gimp_context_set_tool_preset(GimpContext *context,GimpToolPreset *tool_preset)
{
do {
if (({
GTypeInstance *__inst = (GTypeInstance *)context;
GType __t = gimp_context_get_type();
gboolean __r;
if (!__inst) {
__r = 0;
}
else {
if (__inst -> g_class && __inst -> g_class -> g_type == __t) {
__r = !0;
}
else {
__r = g_type_check_instance_is_a(__inst,__t);
}
}
__r;
}))
{
}
else {
g_return_if_fail_warning("Gimp-Core",__PRETTY_FUNCTION__,"GIMP_IS_CONTEXT (context)");
return ;
}
;
}while (0);
do {
if (!tool_preset || (({
GTypeInstance *__inst = (GTypeInstance *)tool_preset;
GType __t = gimp_tool_preset_get_type();
gboolean __r;
if (!__inst) {
__r = 0;
}
else {
if (__inst -> g_class && __inst -> g_class -> g_type == __t) {
__r = !0;
}
else {
__r = g_type_check_instance_is_a(__inst,__t);
}
}
__r;
})))
{
}
else {
g_return_if_fail_warning("Gimp-Core",__PRETTY_FUNCTION__,"! tool_preset || GIMP_IS_TOOL_PRESET (tool_preset)");
return ;
}
;
}while (0);
while(!(context -> defined_props & (1 << GIMP_CONTEXT_PROP_TOOL_PRESET)) && context -> parent)
context = context -> parent;
gimp_context_real_set_tool_preset(context,tool_preset);
} | VulDeePecker-master-joern/CWE-399/source_files/150665/myfile_66.c | gimpcontext.c | 3930,3987 | 0 | 0 | CWE-399 |
void CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncat_31_bad()
{
char * data;
char dataBuffer[100];
data = dataBuffer;
memset(data, 'A', 100-1);
data[100-1] = '\0';
{
char * dataCopy = data;
char * data = dataCopy;
{
char dest[50] = "";
strncat(dest, data, strlen(data));
dest[50-1] = '\0';
printLine(data);
}
}
} | VulDeePecker-master-joern/CWE-119/source_files/65964/myfile_4.c | CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_ncat_31.c | 23,42 | 1 | 37 | CWE-119 |
nsresult
nsCSSFrameConstructor::CreateAnonymousFrames(nsFrameConstructorState& aState,
nsIContent* aParent,
nsIDocument* aDocument,
nsIFrame* aParentFrame,
PRBool aAppendToExisting,
nsFrameItems& aChildItems)
{
nsIAnonymousContentCreator* creator = nsnull;
CallQueryInterface(aParentFrame, &creator);
if (!creator)
return NS_OK;
nsresult rv;
nsAutoTArray<nsIContent*, 4> newAnonymousItems;
rv = creator->CreateAnonymousContent(newAnonymousItems);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 count = newAnonymousItems.Length();
if (count == 0) {
return NS_OK;
}
nsPseudoFrames priorPseudoFrames;
aState.mPseudoFrames.Reset(&priorPseudoFrames);
for (PRUint32 i=0; i < count; i++) {
nsIContent* content = newAnonymousItems[i];
NS_ASSERTION(content, "null anonymous content?");
#ifdef MOZ_SVG
if (aParent &&
aParent->NodeInfo()->Equals(nsGkAtoms::use, kNameSpaceID_SVG)) {
content->SetFlags(NODE_IS_ANONYMOUS);
} else
#endif
{
content->SetNativeAnonymous();
}
rv = content->BindToTree(aDocument, aParent, aParent, PR_TRUE);
if (NS_FAILED(rv)) {
content->UnbindFromTree();
return rv;
}
nsIFrame* newFrame = creator->CreateFrameFor(content);
if (newFrame) {
aChildItems.AddChild(newFrame);
}
else {
ConstructFrame(aState, content, aParentFrame, aChildItems);
}
}
creator->PostCreateFrames();
if (!aState.mPseudoFrames.IsEmpty()) {
ProcessPseudoFrames(aState, aChildItems);
}
aState.mPseudoFrames = priorPseudoFrames;
return NS_OK;
} | VulDeePecker-master-joern/CWE-119/source_files/CVE-2010-3778/myfile_212.c | Firefox_3.5.8_CVE_2010_3778_layout_base_nsCSSFrameConstructor.cpp | 5704,5777 | 0 | 0 | CWE-119 |
void good()
{
goodG2B1();
goodG2B2();
} | VulDeePecker-master-joern/CWE-119/source_files/74719/myfile_3.c | CWE124_Buffer_Underwrite__new_char_cpy_02.cpp | 115,119 | 0 | 0 | CWE-119 |
static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node,
int threshold)
{
Jpeg2000TgtNode *stack[30];
int sp = -1, curval = 0;
if (!node) {
av_log(s->avctx, AV_LOG_ERROR, "missing node\n");
return AVERROR_INVALIDDATA;
}
while (node && !node->vis) {
stack[++sp] = node;
node = node->parent;
}
if (node)
curval = node->val;
else
curval = stack[sp]->val;
while (curval < threshold && sp >= 0) {
if (curval < stack[sp]->val)
curval = stack[sp]->val;
while (curval < threshold) {
int ret;
if ((ret = get_bits(s, 1)) > 0) {
stack[sp]->vis++;
break;
} else if (!ret)
curval++;
else
return ret;
}
stack[sp]->val = curval;
sp--;
}
return curval;
} | VulDeePecker-master-joern/CWE-119/source_files/CVE-2016-2213/myfile_22.c | Ffmpeg_2.8.2_CVE_2016_2213_libavcodec_jpeg2000dec.c | 150,188 | 0 | 0 | CWE-119 |
JS_HasPropertyById(JSContext *cx, JSObject *obj, jsid id, JSBool *foundp)
{
JSBool ok;
JSObject *obj2;
JSProperty *prop;
CHECK_REQUEST(cx);
ok = LookupPropertyById(cx, obj, id,
JSRESOLVE_QUALIFIED | JSRESOLVE_DETECTING,
&obj2, &prop);
if (ok) {
*foundp = (prop != NULL);
if (prop)
OBJ_DROP_PROPERTY(cx, obj2, prop);
}
return ok;
} | VulDeePecker-master-joern/CWE-399/source_files/CVE-2010-0160/myfile_210.c | firefox_3.5.7_CVE_2010_0160_js_src_jsapi.cpp | 3446,3462 | 0 | 0 | CWE-399 |
void svn_stream_set_skip(svn_stream_t *stream,svn_stream_skip_fn_t skip_fn)
{
stream -> skip_fn = skip_fn;
} | VulDeePecker-master-joern/CWE-399/source_files/151913/myfile_63.c | stream.c | 182,185 | 0 | 0 | CWE-399 |
void CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memcpy_13_bad()
{
char * data;
data = NULL;
if(GLOBAL_CONST_FIVE==5)
{
data = (char *)malloc(10*sizeof(char));
}
{
char source[10+1] = SRC_STRING;
memcpy(data, source, (strlen(source) + 1) * sizeof(char));
printLine(data);
free(data);
}
} | VulDeePecker-master-joern/CWE-119/source_files/70844/myfile_1.c | CWE122_Heap_Based_Buffer_Overflow__c_CWE193_char_memcpy_13.c | 28,45 | 1 | 42 | CWE-119 |
static guint get_non_implicit_size(SmiType *sT)
{
SmiRange *sR;
guint size = 0xffffffff;
switch(sT -> basetype){
case SMI_BASETYPE_OCTETSTRING:
{
}
case SMI_BASETYPE_OBJECTIDENTIFIER:
break;
default:
return 0;
}
for (; sT; sT = smiGetParentType(sT)) {
for (sR = smiGetFirstRange(sT); sR; sR = smiGetNextRange(sR)) {
if (size == 0xffffffff) {
if (sR -> minValue . value . unsigned32 == sR -> maxValue . value . unsigned32) {
size = sR -> minValue . value . unsigned32;
}
else {
return 0;
}
}
else {
if (sR -> minValue . value . unsigned32 != size || sR -> maxValue . value . unsigned32 != size) {
return 0;
}
}
}
}
return size == 0xffffffff?0 : size;
} | VulDeePecker-master-joern/CWE-119/source_files/152920/myfile_40.c | oids.c | 452,483 | 0 | 0 | CWE-119 |