id
stringlengths
14
84
tier
stringclasses
2 values
code
stringlengths
71
9.09k
cwe
stringclasses
9 values
family
stringclasses
6 values
cve
stringlengths
0
16
⌀
description
stringlengths
166
430
source
stringclasses
8 values
project
stringlengths
3
35
⌀
lang
stringclasses
3 values
lines
int64
3
282
split
stringclasses
1 value
rv5_crossvul_CWE-119_bad_3087_1_1780
hard
pickCopyFunc(TIFF* in, TIFF* out, uint16 bitspersample, uint16 samplesperpixel) { uint16 shortv; uint32 w, l, tw, tl; int bychunk; (void) TIFFGetField(in, TIFFTAG_PLANARCONFIG, &shortv); if (shortv != config && bitspersample != 8 && samplesperpixel > 1) { fprintf(stderr, "%s: Cannot handle different plana...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: pickCopyFunc() reads PLANARCONFIG with TIFFGetField without checking its return, so shortv stays uninitialized when the tag is missing and is then used in the config comparison and in the pack()/switch that selects the copy routine.
crossvul
null
c
104
train
rv5_crossvul_CWE-119_bad_5590_0_150
easy
kvp_respond_to_host(char *key, char *value, int error) { struct hv_kvp_msg *kvp_msg; struct hv_kvp_msg_enumerate *kvp_data; char *key_name; struct icmsg_hdr *icmsghdrp; int keylen, valuelen; u32 buf_len; struct vmbus_channel *channel; u64 req_id; /* * If a transaction is not active; log and return. */ ...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: kvp_respond_to_host() calls utf8s_to_utf16s() on the key and value strings without any output-length bound, so overly long strings overflow the fixed-size kvp_data->data.key / data.value buffers.
crossvul
null
c
81
train
rv5_crossvul_CWE-125_bad_2925_0_1621
easy
ims_pcu_get_cdc_union_desc(struct usb_interface *intf) { const void *buf = intf->altsetting->extra; size_t buflen = intf->altsetting->extralen; struct usb_cdc_union_desc *union_desc; if (!buf) { dev_err(&intf->dev, "Missing descriptor data\n"); return NULL; } if (!buflen) { dev_err(&intf->dev, "Zero lengt...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: The while (buflen > 0) loop in ims_pcu_get_cdc_union_desc() reads union_desc->bDescriptorType/bDescriptorSubType and advances by bLength without checking that buflen holds a full descriptor or that bLength <= buflen. A malicious device can therefore cause out-of-bounds reads p...
crossvul
null
c
32
train
rv5_crossvul_CWE-125_bad_4161_1_52
easy
inline TfLiteTensor* GetTemporary(TfLiteContext* context, const TfLiteNode* node, int index) { return &context->tensors[node->temporaries->data[index]]; }
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: GetTemporary() reads node->temporaries->data[index] without checking index against node->temporaries->size, then uses the resulting value (possibly -1/kTfLiteOptionalTensor) to index context->tensors, causing an out-of-bounds read.
crossvul
null
c
4
train
rv5_crossvul_CWE-125_bad_4161_1_56
easy
inline const TfLiteTensor* GetIntermediates(TfLiteContext* context, const TfLiteNode* node, int index) { return &context->tensors[node->intermediates->data[index]]; }
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: GetIntermediates indexes node->intermediates->data[index] without bounds-checking index against intermediates->size, and uses the resulting tensor index (possibly -1/kTfLiteOptionalTensor) to index context->tensors, causing an out-of-bounds read.
crossvul
null
c
4
train
rv5_crossvul_CWE-125_bad_486_6_45
easy
mcs_parse_domain_params(STREAM s) { int length; ber_parse_header(s, MCS_TAG_DOMAIN_PARAMS, &length); in_uint8s(s, length); return s_check(s); }
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: mcs_parse_domain_params() advances the stream with in_uint8s(s, length) using a server-supplied BER length without checking it against the remaining stream bytes, so the stream can be read past the end of the buffer.
crossvul
null
c
9
train
rv5_crossvul_CWE-17_bad_1789_0_222
hard
void CoreUserInputHandler::doMode(const BufferInfo &bufferInfo, const QChar& addOrRemove, const QChar& mode, const QString &nicks) { QString m; bool isNumber; int maxModes = network()->support("MODES").toInt(&isNumber); if (!isNumber || maxModes == 0) maxModes = 1; QStringList nickList; if (nic...
CWE-476
null
null
CWE-476: NULL Pointer Dereference This instance: When nicks == "*" in a non-channel buffer, network()->ircChannel(bufferInfo.bufferName()) returns NULL and is dereferenced via ->ircUsers()/->userModes() without checking the buffer type or the pointer.
crossvul
null
cpp
30
train
rv5_crossvul_CWE-269_bad_3151_1_234
hard
static void copy_xauthority(void) { // copy XAUTHORITY_FILE in the new home directory char *src = RUN_XAUTHORITY_FILE ; char *dest; if (asprintf(&dest, "%s/.Xauthority", cfg.homedir) == -1) errExit("asprintf"); // if destination is a symbolic link, exit the sandbox!!! if (is_link(dest)) { fprintf(stderr, "Er...
CWE-362
race
null
CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') This instance: After the unprivileged child copies the file, the root parent calls chown(dest, ...) and chmod(dest, ...) by path on the user-controlled $HOME/.Xauthority, so a symlink swapped in after the is_link() chec...
crossvul
null
c
41
train
rv5_crossvul_CWE-269_bad_3151_1_276
hard
static void copy_asoundrc(void) { // copy XAUTHORITY_FILE in the new home directory char *src = RUN_ASOUNDRC_FILE ; char *dest; if (asprintf(&dest, "%s/.asoundrc", cfg.homedir) == -1) errExit("asprintf"); // if destination is a symbolic link, exit the sandbox!!! if (is_link(dest)) { fprintf(stderr, "Error: %...
CWE-362
race
null
CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') This instance: After the unprivileged child copies .asoundrc, the root parent calls chown(dest) and chmod(dest) on a user-writable path, which the user can replace with a symlink after the is_link check, letting root ch...
crossvul
null
c
41
train
rv5_crossvul_CWE-362_bad_1664_4_106
hard
( OUT p_fm_config_conx_hdlt *p_hdl, IN int instance, OPTIONAL IN char *rem_address, OPTIONAL IN char *community ) { fm_config_conx_hdl *hdl; fm_mgr_config_errno_t res = FM_CONF_OK; if ( (hdl = calloc(1,sizeof(fm_config_conx_hdl))) == NULL ) { res = FM_CONF_NO_M...
CWE-416
uaf
null
CWE-416: Use After Free This instance: On connect failure, the cleanup path frees hdl after it was already returned through *p_hdl, leaving the caller with a dangling handle that is later used or freed again.
crossvul
null
c
56
train
rv5_crossvul_CWE-416_bad_4007_0_4006
hard
static ssize_t __FUNC(struct elevator_queue *e, const char *page, size_t count)\ { \ struct bfq_data *bfqd = e->elevator_data; \ unsigned long uninitialized_var(__data); \ int ret = bfq_var_store(&__data, (page), count); \ if (__data < (MIN)) \ __data = (MIN); \ else if (__data > (MAX)) ...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The store macro uses __data (declared with uninitialized_var) after bfq_var_store() without checking for parse failure, so on invalid input an uninitialized stack value is clamped and written into *__PTR.
crossvul
null
c
12
train
rv5_crossvul_CWE-476_bad_799_0_2836
hard
static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal) { HEVCLocalContext *lc = s->HEVClc; GetBitContext *gb = &lc->gb; int ctb_addr_ts, ret; *gb = nal->gb; s->nal_unit_type = nal->type; s->temporal_id = nal->temporal_id; switch (s->nal_unit_type) { case HEVC...
CWE-476
null
null
CWE-476: NULL Pointer Dereference This instance: decode_nal_unit() detects a second slice with first_slice_in_pic_flag while s->ref is set only after hls_slice_header() has already reset parameter-set and frame state, so later slice decoding dereferences NULL or stale state.
crossvul
null
c
185
train
rv5_easy4_bigvul_162c377a653bb381
easy
write_message( RenderState state ) { ADisplay adisplay = (ADisplay)state->display.disp; if ( state->message == NULL ) { FontFace face = &state->faces[state->face_index]; int idx, total; idx = face->index; total = 1; while ( total + state->face_index < state->nu...
CWE-787
oob
CVE-2010-2527
CWE-787: Out-of-bounds Write This instance (CVE-2010-2527): write_message() uses sprintf with an unbounded "%s" of state->filename into the fixed-size state->message0 buffer, so a long filename overflows it.
bigvul
null
c/cpp
35
train
rv5_easy4_bigvul_251bbb929d01628f
easy
long vorbis_book_decodev_add(codebook *book,ogg_int32_t *a, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ ogg_int32_t *v = book->dec_buf;//(ogg_int32_t *)alloca(sizeof(*v)*book->dim); int i,j; if (!v) return -1; for(i=0;i<n;){ if(decode_map(book,b,v,point))return ...
CWE-787
oob
CVE-2017-0814
CWE-787: Out-of-bounds Write This instance (CVE-2017-0814): In vorbis_book_decodev_add(), the inner loop over book->dim increments i and does a[i++]+=v[j] without checking i<n, so it reads and writes past the end of array a when n is not a multiple of dim.
bigvul
null
c/cpp
16
train
rv5_easy4_bigvul_28152a3742e7d13e
easy
write_header( FT_Error error_code ) { FT_Face face; const char* basename; const char* format; error = FTC_Manager_LookupFace( handle->cache_manager, handle->scaler.face_id, &face ); if ( error ) Fatal( "can't access font file" ); if ( !statu...
CWE-787
oob
CVE-2010-2527
CWE-787: Out-of-bounds Write This instance (CVE-2010-2527): write_header() uses unbounded sprintf with %s for face->family_name, face->style_name and basename into the fixed-size status.header_buffer, so long font names from a crafted font file overflow the buffer.
bigvul
null
c/cpp
98
train
rv5_easy4_bigvul_3df44f584bf9a1af
easy
xps_parse_gradient_stops(xps_document *doc, char *base_uri, fz_xml *node, struct stop *stops, int maxcount) { fz_colorspace *colorspace; float sample[8]; float rgb[3]; int before, after; int count; int i; /* We may have to insert 2 extra stops when postprocessing */ m...
CWE-787
oob
CVE-2014-2013
CWE-787: Out-of-bounds Write This instance (CVE-2014-2013): xps_parse_gradient_stops() passes the 8-element stack array `float sample[8]` to xps_parse_color(), which can write up to FZ_MAX_COLORS (or more) color components from an attacker-controlled Color/ContextColor attribute, overflowing the stack buffer.
bigvul
mupdf
c/cpp
138
train
rv5_easy4_bigvul_5b9963bdd41e538c
easy
write_header( FT_Error error_code ) { FT_Face face; const char* basename; error = FTC_Manager_LookupFace( handle->cache_manager, handle->scaler.face_id, &face ); if ( error ) PanicZ( "can't access font file" ); if ( !status.header ) { b...
CWE-787
oob
CVE-2010-2527
CWE-787: Out-of-bounds Write This instance (CVE-2010-2527): write_header() uses unbounded sprintf "%s" to copy the font-controlled face->family_name, face->style_name and the file basename into the fixed-size status.header_buffer, overflowing it when these strings are long.
bigvul
null
c/cpp
47
train
rv5_easy4_bigvul_6cb5a18fa0f6d606
hard
void BackendImpl::OnEntryDestroyEnd() { DecreaseNumRefs(); if (data_->header.num_bytes > max_size_ && !read_only_ && (up_ticks_ > kTrimDelay || user_flags_ & kNoRandom)) eviction_.TrimCache(false); }
CWE-416
uaf
CVE-2018-6085
CWE-416: Use After Free This instance (CVE-2018-6085): OnEntryDestroyEnd() calls eviction_.TrimCache() synchronously while a backend operation is still in progress, so eviction can free entries the ongoing operation still references, causing a use-after-free.
bigvul
chromium/chromium
c/cpp
6
train
rv5_easy4_bigvul_913070da78d41c72
easy
void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst) { if (src == NULL || src_len == 0 || dst == NULL) { return; } const char32_t *cur_utf32 = src; const char32_t *end_utf32 = src + src_len; char *cur = dst; while (cur_utf32 < end_utf32) { size_t len = utf32_codepoin...
CWE-787
oob
CVE-2016-3861
CWE-787: Out-of-bounds Write This instance (CVE-2016-3861): utf32_to_utf8() writes each encoded codepoint via utf32_codepoint_to_utf8() into cur and then the trailing '\0' without any destination length, so dst can be overflowed when the caller's buffer is smaller than the encoded output.
bigvul
null
c/cpp
17
train
rv5_easy4_bigvul_92f1ab2f0483c78d
hard
check_mountpoint(const char *progname, char *mountpoint) { int err; struct stat statbuf; /* does mountpoint exist and is it a directory? */ err = stat(mountpoint, &statbuf); if (err) { fprintf(stderr, "%s: failed to stat %s: %s\n", progname, ...
CWE-362
race
CVE-2010-0787
CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') This instance (CVE-2010-0787): check_mountpoint() stats the user-supplied mountpoint path to verify ownership and directory type, but the path is later re-resolved for mounting, so a symlink swap between check and use (...
bigvul
samba
c/cpp
39
train
rv5_easy4_bigvul_c1a24db285c40af3
hard
void BrowserContextDestroyer::FinishDestroyContext() { DCHECK_EQ(pending_hosts_, 0U); delete context_; context_ = nullptr; delete this; }
CWE-416
uaf
CVE-2016-1586
CWE-416: Use After Free This instance (CVE-2016-1586): FinishDestroyContext() deletes context_ based only on the pending_hosts_ counter (checked by a debug-only DCHECK), so RenderProcessHosts or off-the-record contexts that still reference it can use the freed BrowserContext afterwards.
bigvul
null
c/cpp
8
train
rv5_easy4_bigvul_f939a64af11ba7a0
hard
bool PrintWebViewHelper::UpdatePrintSettings( const DictionaryValue& job_settings, bool is_preview) { PrintMsg_PrintPages_Params settings; Send(new PrintHostMsg_UpdatePrintSettings(routing_id(), print_pages_params_->params.document_cookie, job_settings, &settings)); if (settings.params.dpi < kMinD...
CWE-476
null
CVE-2011-3897
CWE-476: NULL Pointer Dereference This instance (CVE-2011-3897): UpdatePrintSettings() dereferences print_pages_params_->params.document_cookie when sending PrintHostMsg_UpdatePrintSettings without checking that print_pages_params_ is non-NULL.
bigvul
chromium/chromium
c/cpp
54
train
rv5_easy4_cvefixes_202cc6708664a705
easy
static void draw_block_rectangle(uint8_t *buf, int sx, int sy, int w, int h, ptrdiff_t stride, int color) { for (int x = sx; x < sx + w; x++) buf[x] = color; for (int y = sy; y < sy + h; y++) { buf[sx] = color; buf[sx + w - 1] = color; buf += stride; } for (int x = sx; ...
CWE-787
oob
CVE-2024-31582
CWE-787: Out-of-bounds Write This instance (CVE-2024-31582): After the vertical loop has advanced buf by h*stride, the final loop in draw_block_rectangle writes buf[x] one row beyond the block (row sy+h), causing an out-of-bounds write for blocks at the bottom of the frame.
cvefixes
ffmpeg/ffmpeg
c/cpp
14
train
rv5_easy4_cvefixes_2a21b35b12c0ca6a
easy
static void read_version(struct pbap_data *pbap, GObexApparam *apparam) { const guint8 *data; uint8_t value[16]; gsize len; if (!(pbap->supported_features & FOLDER_VERSION_FEATURE)) return; if (!g_obex_apparam_get_bytes(apparam, PRIMARY_COUNTER_TAG, &data, &len)) { len = sizeof(value); memset(value...
CWE-787
oob
CVE-2023-50229
CWE-787: Out-of-bounds Write This instance (CVE-2023-50229): read_version() memcpy()s the attacker-controlled length len returned by g_obex_apparam_get_bytes into the fixed-size pbap->primary and pbap->secondary arrays without checking that len equals their size, causing a heap buffer overflow.
cvefixes
bluez/bluez
c/cpp
37
train
rv5_easy4_cvefixes_771864656a727228
hard
Variant HHVM_METHOD(XMLReader, expand, const Variant& basenode /* = null */) { auto* data = Native::data<XMLReader>(this_); req::ptr<XMLDocumentData> doc; xmlDocPtr docp = nullptr; SYNC_VM_REGS_SCOPED(); if (!basenode.isNull()) { auto dombasenode = Native::data<DOMNode>(basenode.toObj...
CWE-476
null
CVE-2019-3556
CWE-476: NULL Pointer Dereference This instance (CVE-2019-3556): In XMLReader::expand, the result of dombasenode->doc() is dereferenced via doc->docp() without a NULL check, so a DOMNode with no owning document causes a null pointer dereference.
cvefixes
facebook/hhvm
c/cpp
36
train
rv5_easy4_cvefixes_90103e753a739876
hard
bool fastly_compute_at_edge_http_req_downstream_tls_client_hello( fastly_world_list_u8_t *ret, fastly_compute_at_edge_types_error_t *err) { auto default_size = 512; ret->ptr = static_cast<uint8_t *>(cabi_malloc(default_size, 4)); auto status = fastly::req_downstream_tls_client_hello(ret->ptr, default_size, &r...
CWE-416
uaf
CVE-2024-38375
CWE-416: Use After Free This instance (CVE-2024-38375): In fastly_compute_at_edge_http_req_downstream_tls_client_hello the result of cabi_realloc is discarded, so the retry call to req_downstream_tls_client_hello writes ret->len bytes into the stale (possibly freed, only 512-byte) ret->ptr buffer.
cvefixes
fastly/js-compute-runtime
c/cpp
11
train
rv5_easy4_cvefixes_ea50394b35a5a80f
hard
bool fastly_compute_at_edge_http_req_downstream_tls_protocol( fastly_world_string_t *ret, fastly_compute_at_edge_types_error_t *err) { auto default_size = 32; ret->ptr = static_cast<uint8_t *>(cabi_malloc(default_size, 4)); auto status = fastly::req_downstream_tls_protocol(reinterpret_cast<char *>(ret->ptr), ...
CWE-416
uaf
CVE-2024-38375
CWE-416: Use After Free This instance (CVE-2024-38375): In fastly_compute_at_edge_http_req_downstream_tls_protocol the result of cabi_realloc is discarded, so the second req_downstream_tls_protocol call writes ret->len bytes into the stale, possibly freed ret->ptr.
cvefixes
fastly/js-compute-runtime
c/cpp
13
train
rv5_easy4_diversevul_0617d688f664ecf7
easy
get_text_rgb_row (j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading text-format PPM files with any maxval */ { ppm_source_ptr source = (ppm_source_ptr) sinfo; FILE * infile = source->pub.input_file; register JSAMPROW ptr; register JSAMPLE *rescale = source->rescale; JDIMENSION col; ...
CWE-125
oob
CVE-2018-11213
CWE-125: Out-of-bounds Read This instance (CVE-2018-11213): In get_text_rgb_row(), the unvalidated value returned by read_pbm_integer() is used as an index into source->rescale[] (sized maxval+1), so a sample value greater than maxval in a text PPM file causes an out-of-bounds read.
diversevul
libjpeg-turbo/libjpeg-turbo
c/cpp
17
train
rv5_easy4_diversevul_2633341b2da6332e
hard
void dd_sanitize_mode_and_owner(struct dump_dir *dd) { /* Don't sanitize if we aren't run under root: * we assume that during file creation (by whatever means, * even by "hostname >file" in abrt_event.conf) * normal umask-based mode setting takes care of correct mode, * and uid:gid is, of course...
CWE-362
race
CVE-2015-3150
CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') This instance (CVE-2015-3150): dd_sanitize_mode_and_owner() lstat()s each entry by its path name (full_path) and then separately calls open()/fchmod() and lchown() on that same path, so a local user can replace the file...
diversevul
abrt/libreport
c/cpp
67
train
rv5_easy4_diversevul_8e9ddf6eac65468b
hard
control_notify_input(struct client *c, struct window_pane *wp, struct evbuffer *input) { u_char *buf; size_t len; struct evbuffer *message; u_int i; if (c->session == NULL) return; buf = EVBUFFER_DATA(input); len = EVBUFFER_LENGTH(input); /* * Only write input if the window pane is linked to ...
CWE-476
null
CVE-2018-19387
CWE-476: NULL Pointer Dereference This instance (CVE-2018-19387): control_notify_input() calls evbuffer_new() and passes the result to evbuffer_add_printf() without checking for NULL, causing a NULL pointer dereference on allocation failure.
diversevul
openbsd/src
c/cpp
31
train
rv5_easy4_diversevul_99e682675faa2377
hard
void shut(pid_t pid) { EUID_ASSERT(); EUID_ROOT(); char *comm = pid_proc_comm(pid); EUID_USER(); if (comm) { if (strcmp(comm, "firejail") != 0) { fprintf(stderr, "Error: this is not a firejail sandbox\n"); exit(1); } free(comm); } else { fprintf(stderr, "Error: cannot find process %d\n", pid); e...
CWE-362
race
CWE-362: Concurrent Execution using Shared Resource with Improper Synchronization ('Race Condition') This instance: shut() checks the process name and owner uid by pid, then later (after polling /proc/<pid>/cmdline as root for up to 11 seconds) calls kill(pid/child, SIGTERM/SIGKILL) on the bare pid, a TOCTOU race where...
diversevul
netblue30/firejail
c/cpp
77
train
rv5_easy4_diversevul_d49681cbea7e5e9b
easy
int format_expand_styles(GString *out, const char **format, int *flags) { int retval = 1; char *p, fmt; /* storage for numerical parsing code for %x/X formats. */ int tmp; unsigned int tmp2; fmt = **format; switch (fmt) { case '{': case '}': case '%': /* escaped char */ g_string_append_c(out, fmt); b...
CWE-125
oob
CVE-2017-5193
CWE-125: Out-of-bounds Read This instance (CVE-2017-5193): In the '[' case, format_expand_styles calls format_expand_code(format, ...), which can leave *format at the terminating NUL of an unterminated '%[' code; without stepping back, the caller advances past the string end and reads out of bounds.
diversevul
irssi/irssi
c/cpp
163
train
rv5_easy4_diversevul_ea4ffc548e3125c2
hard
server_client_create(int fd) { struct client *c; setblocking(fd, 0); c = xcalloc(1, sizeof *c); c->references = 1; c->peer = proc_add_peer(server_proc, fd, server_client_dispatch, c); if (gettimeofday(&c->creation_time, NULL) != 0) fatal("gettimeofday failed"); memcpy(&c->activity_time, &c->creation_time, s...
CWE-476
null
CVE-2018-19387
CWE-476: NULL Pointer Dereference This instance (CVE-2018-19387): server_client_create() stores the results of evbuffer_new() in c->stdin_data, c->stdout_data and c->stderr_data without checking for NULL, so an allocation failure leads to a later NULL pointer dereference.
diversevul
openbsd/src
c/cpp
55
train
rv5_easy4_icvul_b103f0adf89f67c0
easy
static void dhcps_send_offer(struct pbuf *packet_buffer) { uint8_t temp_ip = 0; dhcp_message_repository = (struct dhcp_msg *)packet_buffer->payload; #if (!IS_USE_FIXED_IP) temp_ip = check_client_request_ip(&client_request_ip, client_addr); /* create new client ip */ if(temp_ip == 0) temp_ip = search_next_ip()...
CWE-787
oob
CVE-2022-29859
CWE-787: Out-of-bounds Write This instance (CVE-2022-29859): dhcps_send_offer() casts the received discover packet_buffer->payload to dhcp_message_repository and writes the offer header and options (dhcps_initialize_message/add_msg_type/add_offer_options at options[4]) into it without ensuring the pbuf is large enough,...
icvul
ambiot/amb1_sdk
c/cpp
30
train
rv5_easy4_icvul_f735b87a3cb518df
hard
const char *osdp_reply_name(int reply_id) { const char *name; static const char * const names[] = { [REPLY_ACK - REPLY_ACK] = "ACK", [REPLY_NAK - REPLY_ACK] = "NAK", [REPLY_PDID - REPLY_ACK] = "PDID", [REPLY_PDCAP - REPLY_ACK] = "PDCAP", [REPLY_LSTATR - REPLY_ACK] = "LSTATR", [REPL...
CWE-476
null
CVE-2024-52296
CWE-476: NULL Pointer Dereference This instance (CVE-2024-52296): In osdp_reply_name(), an in-range but undefined reply_id selects a NULL slot of the sparse names[] array, and name[0] is then dereferenced without a NULL check.
icvul
goToMain/libosdp
c/cpp
39
train
rv5_juliet_CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_memcpy_07
easy
void do_work_71() { char * data; char dataBuffer[100]; data = dataBuffer; if(staticFive==5) { memset(data, 'A', 100-1); data[100-1] = '\0'; } { char dest[50] = ""; memcpy(dest, data, strlen(data)*sizeof(char)); dest[50-1] = '\0'; ...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: memcpy copies strlen(data) (99) bytes from the 100-byte data buffer into the 50-byte stack buffer dest without checking dest's size, causing a stack buffer overflow.
sard
juliet
c
17
train
rv5_juliet_CWE121_Stack_Based_Buffer_Overflow__CWE806_wchar_t_alloca_memcpy_02
easy
void compute_result_11() { wchar_t * data; wchar_t * dataBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); data = dataBuffer; if(1) { wmemset(data, L'A', 100-1); data[100-1] = L'\0'; } { wchar_t dest[50] = L""; memcpy(dest, data, wcslen(data)*size...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: memcpy copies wcslen(data) (99) wide characters from the 100-element data buffer into the 50-element stack array dest without checking dest's size, overflowing dest.
sard
juliet
c
17
train
rv5_juliet_CWE122_Heap_Based_Buffer_Overflow__c_CWE805_char_memcpy_07
easy
void load_entry_15() { char * data; data = NULL; if(staticFive==5) { data = (char *)malloc(50*sizeof(char)); if (data == NULL) {exit(-1);} data[0] = '\0'; } { char source[100]; memset(source, 'C', 100-1); source[100-1] = '\0'; ...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: memcpy(data, source, 100*sizeof(char)) writes 100 bytes into the 50-byte heap buffer data allocated by malloc(50), and data[100-1] is then written out of bounds.
sard
juliet
c
20
train
rv5_juliet_CWE122_Heap_Based_Buffer_Overflow__c_CWE805_wchar_t_loop_18
easy
void handle_request_14() { wchar_t * data; data = NULL; goto source; source: data = (wchar_t *)malloc(50*sizeof(wchar_t)); if (data == NULL) {exit(-1);} data[0] = L'\0'; { size_t i; wchar_t source[100]; wmemset(source, L'C', 100-1); source[100-1]...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: The for loop copies 100 wchar_t elements from source into data, which was malloc'd for only 50 wchar_t, and data[100-1] is then written, overflowing the heap buffer.
sard
juliet
c
23
train
rv5_juliet_CWE122_Heap_Based_Buffer_Overflow__c_dest_char_cat_12
easy
void parse_input_73() { char * data; data = NULL; if(globalReturnsTrueOrFalse()) { data = (char *)malloc(50*sizeof(char)); if (data == NULL) {exit(-1);} data[0] = '\0'; } else { data = (char *)malloc(100*sizeof(char)); if (data == NULL) {e...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: When globalReturnsTrueOrFalse() is true, data is malloc'd with only 50 bytes, and strcat(data, source) then copies a 99-character string into it, writing past the end of the heap buffer.
sard
juliet
c
25
train
rv5_juliet_CWE122_Heap_Based_Buffer_Overflow__sizeof_double_02
easy
void process_91() { double * data; data = NULL; if(1) { data = (double *)malloc(sizeof(data)); if (data == NULL) {exit(-1);} *data = 1.7E300; } printDoubleLine(*data); free(data); }
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: data is allocated with malloc(sizeof(data)), the size of a pointer rather than of a double, so the write *data = 1.7E300 can overflow the undersized heap buffer.
sard
juliet
c
13
train
rv5_juliet_CWE122_Heap_Based_Buffer_Overflow__sizeof_int64_t_04
easy
void run_task_85() { int64_t * data; data = NULL; if(STATIC_CONST_TRUE) { data = (int64_t *)malloc(sizeof(data)); if (data == NULL) {exit(-1);} *data = 2147483643LL; } printLongLongLine(*data); free(data); }
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: data is allocated with malloc(sizeof(data)), the size of a pointer rather than of int64_t, so the 8-byte store `*data = 2147483643LL` can write past the allocated heap buffer.
sard
juliet
c
13
train
rv5_juliet_CWE124_Buffer_Underwrite__CWE839_fscanf_08
easy
void load_entry_31() { int data; data = -1; if(staticReturnsTrue()) { fscanf(stdin, "%d", &data); } if(staticReturnsTrue()) { { int i; int buffer[10] = { 0 }; if (data < 10) { buffer[data] = 1; ...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: data read via fscanf is checked only for data < 10 (no lower bound), so a negative value makes buffer[data] = 1 write out of bounds below the stack array buffer.
sard
juliet
c
28
train
rv5_juliet_CWE124_Buffer_Underwrite__malloc_char_loop_01
easy
void apply_config_97() { char * data; data = NULL; { char * dataBuffer = (char *)malloc(100*sizeof(char)); if (dataBuffer == NULL) {exit(-1);} memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; data = dataBuffer - 8; } { size_t i; ...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: data is set to dataBuffer - 8, so the copy loop writing data[i] for i in 0..99 writes 8 bytes before the start of the heap-allocated dataBuffer (buffer underwrite).
sard
juliet
c
24
train
rv5_juliet_CWE124_Buffer_Underwrite__malloc_wchar_t_cpy_10
easy
void run_task_86() { wchar_t * data; data = NULL; if(globalTrue) { { wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t)); if (dataBuffer == NULL) {exit(-1);} wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; ...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: data is set to dataBuffer - 8, before the start of the malloc'd buffer, and wcscpy(data, source) then writes to memory before the heap buffer (buffer underwrite).
sard
juliet
c
22
train
rv5_juliet_CWE124_Buffer_Underwrite__wchar_t_alloca_memmove_16
easy
void do_work_97() { wchar_t * data; wchar_t * dataBuffer = (wchar_t *)ALLOCA(100*sizeof(wchar_t)); wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; while(1) { data = dataBuffer - 8; break; } { wchar_t source[100]; wmemset(source, L...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: data is set to dataBuffer - 8, so memmove(data, source, 100*sizeof(wchar_t)) writes before the start of the stack-allocated dataBuffer (buffer underwrite).
sard
juliet
c
20
train
rv5_juliet_CWE124_Buffer_Underwrite__wchar_t_declare_loop_01
easy
void run_task_61() { wchar_t * data; wchar_t dataBuffer[100]; wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; data = dataBuffer - 8; { size_t i; wchar_t source[100]; wmemset(source, L'C', 100-1); source[100-1] = L'\0'; for (i = 0...
CWE-787
oob
null
CWE-787: Out-of-bounds Write This instance: data is set to dataBuffer - 8, and the loop writing data[i] for i in 0..99 writes before the start of the stack array dataBuffer (buffer underwrite).
sard
juliet
c
20
train
rv5_juliet_CWE126_Buffer_Overread__malloc_char_memcpy_03
easy
void do_work_45() { char * data; data = NULL; if(5==5) { data = (char *)malloc(50*sizeof(char)); if (data == NULL) {exit(-1);} memset(data, 'A', 50-1); data[50-1] = '\0'; } { char dest[100]; memset(dest, 'C', 100-1); dest[100...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: memcpy(dest, data, strlen(dest)) copies 99 bytes from the 50-byte heap buffer data, reading past the end of its allocation.
sard
juliet
c
21
train
rv5_juliet_CWE127_Buffer_Underread__char_declare_loop_31
easy
void do_work_90() { char * data; char dataBuffer[100]; memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; data = dataBuffer - 8; { char * dataCopy = data; char * data = dataCopy; { size_t i; char dest[100]; memset(de...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: data is set to dataBuffer - 8, so the loop copying data[i] into dest reads memory before the start of dataBuffer (buffer under-read).
sard
juliet
c
24
train
rv5_juliet_CWE127_Buffer_Underread__malloc_char_memcpy_01
easy
void do_work_66() { char * data; data = NULL; { char * dataBuffer = (char *)malloc(100*sizeof(char)); if (dataBuffer == NULL) {exit(-1);} memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; data = dataBuffer - 8; } { char dest[100]; ...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: data is set to dataBuffer - 8, so memcpy(dest, data, 100) reads 8 bytes before the start of the malloc'd heap buffer (buffer under-read).
sard
juliet
c
20
train
rv5_juliet_CWE127_Buffer_Underread__malloc_char_memcpy_18
easy
void run_task_35() { char * data; data = NULL; goto source; source: { char * dataBuffer = (char *)malloc(100*sizeof(char)); if (dataBuffer == NULL) {exit(-1);} memset(dataBuffer, 'A', 100-1); dataBuffer[100-1] = '\0'; data = dataBuffer - 8; } {...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: data is set to dataBuffer - 8, before the start of the malloc'd buffer, and memcpy(dest, data, 100) then reads memory before the buffer (buffer underread).
sard
juliet
c
22
train
rv5_juliet_CWE127_Buffer_Underread__malloc_wchar_t_memcpy_11
easy
void update_state_44() { wchar_t * data; data = NULL; if(globalReturnsTrue()) { { wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t)); if (dataBuffer == NULL) {exit(-1);} wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: data is set to dataBuffer - 8 (before the start of the malloc'd buffer), and memcpy(dest, data, 100*sizeof(wchar_t)) reads memory before the heap allocation.
sard
juliet
c
23
train
rv5_juliet_CWE127_Buffer_Underread__malloc_wchar_t_memmove_12
easy
void service_step_61() { wchar_t * data; data = NULL; if(globalReturnsTrueOrFalse()) { { wchar_t * dataBuffer = (wchar_t *)malloc(100*sizeof(wchar_t)); if (dataBuffer == NULL) {exit(-1);} wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1]...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: data is set to dataBuffer - 8 (before the start of the malloc'd buffer), and memmove(dest, data, 100*sizeof(wchar_t)) reads memory before the buffer start.
sard
juliet
c
33
train
rv5_juliet_CWE127_Buffer_Underread__wchar_t_declare_loop_08
easy
void update_state_66() { wchar_t * data; wchar_t dataBuffer[100]; wmemset(dataBuffer, L'A', 100-1); dataBuffer[100-1] = L'\0'; if(staticReturnsTrue()) { data = dataBuffer - 8; } { size_t i; wchar_t dest[100]; wmemset(dest, L'C', 100-1); ...
CWE-125
oob
null
CWE-125: Out-of-bounds Read This instance: data is set to dataBuffer - 8, so the copy loop reading data[i] into dest reads memory before the start of the stack buffer dataBuffer (buffer under-read).
sard
juliet
c
23
train
rv5_juliet_CWE401_Memory_Leak__char_malloc_11
hard
void update_state_15() { char * data; data = NULL; if(globalReturnsTrue()) { data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} strcpy(data, "A String"); printLine(data); } if(globalReturnsTrue()) { ; } }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The heap buffer `data` allocated with malloc(100) is never freed: the second globalReturnsTrue() block is an empty statement, so the memory leaks when update_state_15() returns.
sard
juliet
c
16
train
rv5_juliet_CWE401_Memory_Leak__char_malloc_16
hard
void service_step_47() { char * data; data = NULL; while(1) { data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} strcpy(data, "A String"); printLine(data); break; } while(1) { ; break; } }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The buffer allocated with malloc into data is never freed before service_step_47() returns, leaking memory.
sard
juliet
c
18
train
rv5_juliet_CWE401_Memory_Leak__char_realloc_07
hard
void do_work_74() { char * data; data = NULL; if(staticFive==5) { data = (char *)realloc(data, 100*sizeof(char)); if (data == NULL) {exit(-1);} strcpy(data, "A String"); printLine(data); } if(staticFive==5) { ; } }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: In do_work_74(), the buffer `data` allocated with realloc() is never freed before the function returns, leaking the memory.
sard
juliet
c
16
train
rv5_juliet_CWE401_Memory_Leak__char_realloc_08
hard
void parse_input_34() { char * data; data = NULL; if(staticReturnsTrue()) { data = (char *)realloc(data, 100*sizeof(char)); if (data == NULL) {exit(-1);} strcpy(data, "A String"); printLine(data); } if(staticReturnsTrue()) { ; } }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The 100-byte buffer allocated into data via realloc() in parse_input_34() is never freed before the function returns, leaking memory.
sard
juliet
c
16
train
rv5_juliet_CWE401_Memory_Leak__char_realloc_10
hard
void process_93() { char * data; data = NULL; if(globalTrue) { data = (char *)realloc(data, 100*sizeof(char)); if (data == NULL) {exit(-1);} strcpy(data, "A String"); printLine(data); } if(globalTrue) { ; } }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The buffer allocated with realloc() into data in process_93() is never freed before the function returns, because the second globalTrue block is empty, so the memory leaks.
sard
juliet
c
16
train
rv5_juliet_CWE401_Memory_Leak__int64_t_calloc_14
hard
void service_step_12() { int64_t * data; data = NULL; if(globalFive==5) { data = (int64_t *)calloc(100, sizeof(int64_t)); if (data == NULL) {exit(-1);} data[0] = 5LL; printLongLongLine(data[0]); } if(globalFive==5) { ; } }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The buffer `data` allocated with calloc(100, sizeof(int64_t)) is never freed before service_step_12() returns, leaking memory.
sard
juliet
c
16
train
rv5_juliet_CWE401_Memory_Leak__int64_t_malloc_01
hard
void run_task_88() { int64_t * data; data = NULL; data = (int64_t *)malloc(100*sizeof(int64_t)); if (data == NULL) {exit(-1);} data[0] = 5LL; printLongLongLine(data[0]); ; }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The heap buffer allocated with malloc into data in run_task_88() is never freed before the function returns, leaking memory.
sard
juliet
c
10
train
rv5_juliet_CWE401_Memory_Leak__int_realloc_03
hard
void update_state_38() { int * data; data = NULL; if(5==5) { data = (int *)realloc(data, 100*sizeof(int)); if (data == NULL) {exit(-1);} data[0] = 5; printIntLine(data[0]); } if(5==5) { ; } }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: Memory allocated to data via realloc() in update_state_38() is never freed before the function returns, leaking the buffer.
sard
juliet
c
16
train
rv5_juliet_CWE401_Memory_Leak__struct_twoIntsStruct_calloc_14
hard
void compute_result_32() { struct _twoIntsStruct * data; data = NULL; if(globalFive==5) { data = (struct _twoIntsStruct *)calloc(100, sizeof(struct _twoIntsStruct)); if (data == NULL) {exit(-1);} data[0].intOne = 0; data[0].intTwo = 0; printStructLine((tw...
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The buffer data allocated with calloc in compute_result_32() is never freed; the second globalFive==5 block does nothing instead of calling free(data), so the memory leaks.
sard
juliet
c
17
train
rv5_juliet_CWE401_Memory_Leak__wchar_t_malloc_01
hard
void update_state_24() { wchar_t * data; data = NULL; data = (wchar_t *)malloc(100*sizeof(wchar_t)); if (data == NULL) {exit(-1);} wcscpy(data, L"A String"); printWLine(data); ; }
CWE-401
leak
null
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance: The buffer `data` allocated with malloc(100*sizeof(wchar_t)) in update_state_24() is never freed before the function returns, leaking memory.
sard
juliet
c
10
train
rv5_juliet_CWE416_Use_After_Free__malloc_free_char_01
hard
void parse_input_62() { char * data; data = NULL; data = (char *)malloc(100*sizeof(char)); if (data == NULL) {exit(-1);} memset(data, 'A', 100-1); data[100-1] = '\0'; free(data); printLine(data); }
CWE-416
uaf
null
CWE-416: Use After Free This instance: In parse_input_62(), data is freed with free(data) and then immediately passed to printLine(data), which reads the freed heap memory (use after free).
sard
juliet
c
11
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__double_array_alloca_no_init_02
hard
void process_72() { double * data; data = (double *)ALLOCA(10*sizeof(double)); if(1) { ; } if(1) { { int i; for(i=0; i<10; i++) { printDoubleLine(data[i]); } } } }
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The ALLOCA'd array data is never initialized (the init branch is empty) before its 10 elements are read and printed via printDoubleLine(data[i]).
sard
juliet
c
19
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__double_array_alloca_no_init_04
hard
void process_65() { double * data; data = (double *)ALLOCA(10*sizeof(double)); if(STATIC_CONST_TRUE) { ; } if(STATIC_CONST_TRUE) { { int i; for(i=0; i<10; i++) { printDoubleLine(data[i]); } ...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The ALLOCA'd double array data is never initialized (the init branch is empty) before its 10 elements are read and printed via printDoubleLine(data[i]).
sard
juliet
c
19
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__double_array_alloca_no_init_05
hard
void apply_config_92() { double * data; data = (double *)ALLOCA(10*sizeof(double)); if(staticTrue) { ; } if(staticTrue) { { int i; for(i=0; i<10; i++) { printDoubleLine(data[i]); } } ...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: In apply_config_92(), the ALLOCA'd array data is never initialized, yet data[i] is read and printed via printDoubleLine in the loop.
sard
juliet
c
19
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__double_array_alloca_no_init_07
hard
void handle_request_73() { double * data; data = (double *)ALLOCA(10*sizeof(double)); if(staticFive==5) { ; } if(staticFive==5) { { int i; for(i=0; i<10; i++) { printDoubleLine(data[i]); } ...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The alloca'd double array data is never initialized, yet handle_request_73() reads and prints data[0..9] via printDoubleLine, using uninitialized memory.
sard
juliet
c
19
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__double_array_alloca_no_init_15
hard
void handle_request_62() { double * data; data = (double *)ALLOCA(10*sizeof(double)); switch(6) { case 6: ; break; default: printLine("Benign, fixed string"); break; } switch(7) { case 7: { int i; for(i=0; i<1...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The ALLOCA'd array data is never initialized (case 6 is empty), yet all 10 elements data[i] are read and printed via printDoubleLine in the second switch.
sard
juliet
c
29
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__double_array_alloca_partial_init_10
hard
void apply_config_59() { double * data; data = (double *)ALLOCA(10*sizeof(double)); if(globalTrue) { { int i; for(i=0; i<(10/2); i++) { data[i] = (double)i; } } } if(globalTrue) { { ...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: In apply_config_59(), only data[0..4] of the alloca'd 10-double buffer are initialized, yet the second loop reads and prints data[0..9], using uninitialized elements data[5..9].
sard
juliet
c
25
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__int_array_alloca_no_init_05
hard
void do_work_83() { int * data; data = (int *)ALLOCA(10*sizeof(int)); if(staticTrue) { ; } if(staticTrue) { { int i; for(i=0; i<10; i++) { printIntLine(data[i]); } } } }
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The int array data allocated via ALLOCA is never initialized (the first staticTrue branch is empty) before data[i] is read and printed in the loop.
sard
juliet
c
19
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__int_array_alloca_partial_init_02
hard
void service_step_93() { int * data; data = (int *)ALLOCA(10*sizeof(int)); if(1) { { int i; for(i=0; i<(10/2); i++) { data[i] = i; } } } if(1) { { int i; for(i=0;...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: Only the first half of the alloca'd array data is initialized (loop to 10/2), but the second loop reads and prints all 10 elements, using uninitialized data[5..9].
sard
juliet
c
25
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__int_array_malloc_no_init_18
hard
void compute_result_12() { int * data; data = (int *)malloc(10*sizeof(int)); if (data == NULL) {exit(-1);} goto source; source: ; goto sink; sink: { int i; for(i=0; i<10; i++) { printIntLine(data[i]); } } }
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The malloc'd buffer data is never initialized, yet data[i] is read and printed in the sink loop, using uninitialized memory.
sard
juliet
c
18
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__struct_array_alloca_no_init_02
hard
void compute_result_65() { twoIntsStruct * data; data = (twoIntsStruct *)ALLOCA(10*sizeof(twoIntsStruct)); if(1) { ; } if(1) { { int i; for(i=0; i<10; i++) { printIntLine(data[i].intOne); prin...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The ALLOCA'd array data is never initialized (the initialization branch is empty), yet the loop reads and prints data[i].intOne and data[i].intTwo.
sard
juliet
c
20
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__struct_array_alloca_no_init_03
hard
void handle_request_14() { twoIntsStruct * data; data = (twoIntsStruct *)ALLOCA(10*sizeof(twoIntsStruct)); if(5==5) { ; } if(5==5) { { int i; for(i=0; i<10; i++) { printIntLine(data[i].intOne); ...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The ALLOCA'd twoIntsStruct array 'data' is never initialized before its intOne and intTwo fields are read and printed in the loop.
sard
juliet
c
20
train
rv5_juliet_CWE457_Use_of_Uninitialized_Variable__struct_array_alloca_no_init_10
hard
void apply_config_94() { twoIntsStruct * data; data = (twoIntsStruct *)ALLOCA(10*sizeof(twoIntsStruct)); if(globalTrue) { ; } if(globalTrue) { { int i; for(i=0; i<10; i++) { printIntLine(data[i].intOne); ...
CWE-908
uninit
null
CWE-908: Use of Uninitialized Resource This instance: The ALLOCA'd twoIntsStruct array data is never initialized (the first globalTrue branch is empty), yet its intOne/intTwo fields are read and printed in the loop.
sard
juliet
c
20
train
rv5_juliet_CWE690_NULL_Deref_From_Return__int64_t_malloc_11
hard
void load_entry_70() { int64_t * data; data = NULL; data = (int64_t *)malloc(1*sizeof(int64_t)); if(globalReturnsTrue()) { data[0] = 5LL; printLongLongLine(data[0]); free(data); } }
CWE-476
null
null
CWE-476: NULL Pointer Dereference This instance: The return value of malloc() assigned to data is not checked for NULL before data[0] is written and read in load_entry_70(), causing a NULL pointer dereference if allocation fails.
sard
juliet
c
12
train
rv5_megavul_102315
hard
static int unregister_mem_int(struct mmio_rb_tree *rbt, struct mem_range *memp) { struct mem_range *mr; struct mmio_rb_range *entry = NULL; int err; pthread_rwlock_wrlock(&mmio_rwlock); err = mmio_rb_lookup(rbt, memp->base, &entry); if (err == 0) { mr = &entry->mr_param; if (strncmp(mr->name, memp->name, MEM...
CWE-416
uaf
CVE-2021-36145
CWE-416: Use After Free This instance (CVE-2021-36145): In unregister_mem_int(), entry is freed after the lock is released even when the validation check fails and RB_REMOVE was not called, leaving a freed node in the mmio rb tree that later traversals use.
megavul
projectacrn/acrn-hypervisor
c
30
train
rv5_megavul_10555
hard
int SMB2_write(const unsigned int xid, struct cifs_io_parms *io_parms, unsigned int *nbytes, struct kvec *iov, int n_vec) { struct smb_rqst rqst; int rc = 0; struct smb2_write_req *req = NULL; struct smb2_write_rsp *rsp = NULL; int resp_buftype; struct kvec rsp_iov; int flags = 0; unsigned int total_len; ...
CWE-416
uaf
CVE-2019-15919
CWE-416: Use After Free This instance (CVE-2019-15919): SMB2_write() frees req via cifs_small_buf_release(req) immediately after cifs_send_recv() and then dereferences req->PersistentFileId in the trace_smb3_write_err/trace_smb3_write_done calls.
megavul
torvalds/linux
c
77
train
rv5_megavul_10596
hard
static int pf_detect(void) { struct pf_unit *pf = units; int k, unit; printk("%s: %s version %s, major %d, cluster %d, nice %d\n", name, name, PF_VERSION, major, cluster, nice); par_drv = pi_register_driver(name); if (!par_drv) { pr_err("failed to register %s driver\n", name); return -1; } k = 0; ...
CWE-476
null
CVE-2019-15922
CWE-476: NULL Pointer Dereference This instance (CVE-2019-15922): In pf_detect()'s 'No ATAPI disk detected' cleanup loop, pf->disk->queue is dereferenced for every unit without checking that pf->disk is non-NULL, which it is when alloc_disk failed.
megavul
torvalds/linux
c
52
train
rv5_megavul_108011
hard
int net_bind(short unsigned *port, int type, const char *log_service_name) { struct addrinfo hints = { 0 }; struct addrinfo *servinfo; struct addrinfo *ptr; const char *cfgaddr; char addr[INET6_ADDRSTRLEN]; char strport[8]; int yes = 1; int no = 0; int fd; int ret; cfgaddr = cfg_getstr(cfg_getsec...
CWE-416
uaf
CVE-2021-38383
CWE-416: Use After Free This instance (CVE-2021-38383): net_bind() calls freeaddrinfo(servinfo) and then still uses ptr (an element of that freed list), passing ptr->ai_addr and ptr->ai_addrlen to getsockname(), net_port_get() and net_address_get().
megavul
owntone/owntone-server
c
88
train
rv5_megavul_111967
easy
int writelogentry(PFTPCONTEXT context, const char *logtext1, const char *logtext2) { char cvbuf[32], _text[512]; time_t itm = time(NULL); struct tm ltm; localtime_r(&itm, &ltm); _text[0] = 0; if ( ltm.tm_mday < 10 ) strcat(_text, "0"); ultostr(ltm.tm_mday, cvbuf); strcat(_text, cvbuf); strcat(_text, "-"...
CWE-787
oob
CVE-2017-1000218
CWE-787: Out-of-bounds Write This instance (CVE-2017-1000218): writelogentry() strcat's attacker-influenced logtext1/logtext2 into the fixed 512-byte stack buffer _text without any length check, causing a stack buffer overflow.
megavul
hfiref0x/LightFTP
c
60
train
rv5_megavul_112048
hard
static gboolean on_unregister_handler(TCMUService1HandlerManager1 *interface, GDBusMethodInvocation *invocation, gchar *subtype, gpointer user_data) { struct tcmur_handler *handler = find_handler_by_subtype(subtype); struct dbus_info *info = handler->opaque; if (!handler) { g_dbus_method_i...
CWE-476
null
CVE-2017-1000201
CWE-476: NULL Pointer Dereference This instance (CVE-2017-1000201): In on_unregister_handler(), handler->opaque is dereferenced before the !handler check, so a NULL return from find_handler_by_subtype() for an unknown subtype causes a NULL pointer dereference.
megavul
open-iscsi/tcmu-runner
c
24
train
rv5_megavul_113834
easy
void fli_read_lc(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf) { unsigned short yc, firstline, numline; unsigned char *pos; memcpy(framebuf, old_framebuf, fli_header->width * fli_header->height); firstline = fli_read_short(f); numline = fli_read_short(f); for (yc=0; yc <...
CWE-787
oob
CVE-2017-17785
CWE-787: Out-of-bounds Write This instance (CVE-2017-17785): fli_read_lc() uses file-supplied firstline/numline and per-packet skip/ps counts to compute pos and xc without checking them against fli_header->width*height, so memset(&pos[xc],...) and fread(&pos[xc],...) write past the end of the heap buffer framebuf.
megavul
GNOME/gimp
c
30
train
rv5_megavul_113836
easy
void fli_read_lc_2(FILE *f, s_fli_header *fli_header, unsigned char *old_framebuf, unsigned char *framebuf) { unsigned short yc, lc, numline; unsigned char *pos; memcpy(framebuf, old_framebuf, fli_header->width * fli_header->height); yc=0; numline = fli_read_short(f); for (lc=0; lc < numline; lc++) { unsigned s...
CWE-787
oob
CVE-2017-17785
CWE-787: Out-of-bounds Write This instance (CVE-2017-17785): In fli_read_lc_2() the file-controlled line counter yc and column offset xc (advanced by skip and packet counts) are never bounded by fli_header->width*height, so pos[xc++]=v1/v2, fread(&pos[xc],ps,2,f) and pos[xc]=lpn write past the end of the heap buffer fr...
megavul
GNOME/gimp
c
45
train
rv5_megavul_121925
easy
static int same_leader( linenr_T lnum, int leader1_len, char_u *leader1_flags, int leader2_len, char_u *leader2_flags) { int idx1 = 0, idx2 = 0; char_u *p; char_u *line1; char_u *line2; if (leader1_len == 0) return (leader2_len == 0); // If first leader ha...
CWE-125
oob
CVE-2023-0433
CWE-125: Out-of-bounds Read This instance (CVE-2023-0433): In same_leader(), the COM_START branch dereferences ml_get(lnum) + leader1_len without checking that leader1_len is within the line length, reading past the end of the heap line buffer.
megavul
vim
c
66
train
rv5_megavul_12259
easy
static int lmp_print_data_link_subobjs(netdissect_options *ndo, const u_char *obj_tptr, int total_subobj_len, int offset) { int hexdump = FALSE; int subobj_type, subobj_len; union { /* int to float conversion buffer */ float f; uint32_t i; } bw; while (t...
CWE-125
oob
CVE-2018-14464
CWE-125: Out-of-bounds Read This instance (CVE-2018-14464): In the INT_SWITCHING_TYPE_SUBOBJ case, lmp_print_data_link_subobjs() calls EXTRACT_32BITS(obj_tptr+offset+4) for the bandwidth fields without a bounds check against the captured data, so it reads past the end of the packet buffer.
megavul
the-tcpdump-group/tcpdump
c
66
train
rv5_megavul_123183
easy
char *gf_text_get_utf8_line(char *szLine, u32 lineSize, FILE *txt_in, s32 unicode_type) { u32 i, j, len; char *sOK; char szLineConv[2048]; unsigned short *sptr; memset(szLine, 0, sizeof(char)*lineSize); sOK = gf_fgets(szLine, lineSize, txt_in); if (!sOK) return NULL; if (unicode_type<=1) { j=0; len = (u32)...
CWE-787
oob
CVE-2023-0818
CWE-787: Out-of-bounds Write This instance (CVE-2023-0818): In gf_text_get_utf8_line(), the UTF-8 multi-byte branches write several bytes into the stack buffer szLineConv[2048] while the only bound check on j sits after the final copy, so a long line with multi-byte characters writes past the end of szLineConv.
megavul
gpac
c
91
train
rv5_megavul_124147
hard
static int dwc3_qcom_acpi_register_core(struct platform_device *pdev) { struct dwc3_qcom *qcom = platform_get_drvdata(pdev); struct device *dev = &pdev->dev; struct resource *res, *child_res = NULL; struct platform_device *pdev_irq = qcom->urs_usb ? qcom->urs_usb : pdev; int irq; int ret; qcom-...
CWE-401
leak
CVE-2023-22995
CWE-401: Missing Release of Memory after Effective Lifetime (memory leak) This instance (CVE-2023-22995): In dwc3_qcom_acpi_register_core(), the platform device qcom->dwc3 obtained from platform_device_alloc() is never released with platform_device_put() on error paths (kcalloc failure and every goto out failure), leak...
megavul
torvalds/linux
c
66
train
rv5_megavul_124452
hard
int win_new_tabpage(int after) { tabpage_T *tp = curtab; tabpage_T *prev_tp = curtab; tabpage_T *newtp; int n; newtp = alloc_tabpage(); if (newtp == NULL) return FAIL; // Remember the current windows in this Tab page. if (leave_tabpage(curbuf, TRUE) == FAIL) { vim_free(newtp); ...
CWE-476
null
CVE-2022-0696
CWE-476: NULL Pointer Dereference This instance (CVE-2022-0696): win_new_tabpage() does not reject being called while the command-line window is active (cmdwin_type != 0), so it switches curtab/curwin out from under the cmdline window and a NULL pointer dereference follows.
megavul
vim
c
77
train
rv5_megavul_134546
easy
static int read_data_section (Bit_Chain *sec_dat, Bit_Chain *dat, r2007_section *restrict sections_map, r2007_page *restrict pages_map, Dwg_Section_Type sec_type) { r2007_section *section; r2007_page *page; uint64_t max_decomp_size; BITCODE_RC *decomp; int error = 0, i; ...
CWE-787
oob
CVE-2021-42586
CWE-787: Out-of-bounds Write This instance (CVE-2021-42586): read_data_section() writes section_page->uncomp_size bytes into the decomp heap buffer at decomp[section_page->offset] via read_data_page/memcpy without checking that the page fits within max_decomp_size (section->data_size), causing a heap buffer overflow.
megavul
LibreDWG/libredwg
c
91
train
rv5_megavul_13559
hard
static int parseuid(const char *s, uid_t *uid) { struct passwd *pw; const char *errstr; if ((pw = getpwnam(s)) != NULL) { *uid = pw->pw_uid; return 0; } #if !defined(__linux__) && !defined(__NetBSD__) *uid = strtonum(s, 0, UID_MAX, &errstr); #else sscanf(s, "%d", uid); #endif if (errstr) return -1; re...
CWE-908
uninit
CVE-2019-15900
CWE-908: Use of Uninitialized Resource This instance (CVE-2019-15900): In parseuid(), on Linux/NetBSD the sscanf() return value is ignored and the uninitialized pointer errstr is tested instead, so a failed parse of a nonexistent user name can return success with an unset uid (e.g. root).
megavul
slicer69/doas
c
19
train
rv5_megavul_13652
easy
int idn2_to_ascii_4i (const uint32_t * input, size_t inlen, char * output, int flags) { uint32_t *input_u32; uint8_t *input_u8, *output_u8; size_t length; int rc; if (!input) { if (output) *output = 0; return IDN2_OK; } input_u32 = (uint32_t *) malloc ((inlen + 1) * sizeof(uint32_t));...
CWE-787
oob
CVE-2019-18224
CWE-787: Out-of-bounds Write This instance (CVE-2019-18224): idn2_to_ascii_4i() strcpy()s the lookup result output_u8 into the caller's output buffer (documented as 64 bytes) without checking that its length is at most 63, causing a buffer overflow for long domains.
megavul
libidn/libidn2
c
48
train
rv5_megavul_14284
hard
bool Jsi_ValueIsNumber(Jsi_Interp *interp, Jsi_Value *pv) { return (pv->vt == JSI_VT_NUMBER || (pv->vt == JSI_VT_OBJECT && pv->d.obj->ot == JSI_OT_NUMBER)); }
CWE-476
null
CVE-2021-46485
CWE-476: NULL Pointer Dereference This instance (CVE-2021-46485): Jsi_ValueIsNumber() dereferences pv->vt without first checking that pv is non-NULL, so a caller passing a NULL value causes a segfault.
megavul
pcmacdon/jsish
c
4
train
rv5_megavul_146922
hard
static char *skip_white(char *s) { while(*s) { if(*s == '\n' || *s == '\r') return NULL; if(isspace(*s)) { ++s; continue; } return s; } return NULL; }
CWE-476
null
CVE-2016-7445
CWE-476: NULL Pointer Dereference This instance (CVE-2016-7445): skip_white() dereferences its argument s in `while(*s)` without a NULL check, so the NULL returned by a prior skip_int/skip_white on malformed PNM header input crashes it.
megavul
uclouvain/openjpeg
c
10
train
rv5_megavul_150898
easy
void addMultirowsForm(Buffer *buf, AnchorList *al) { int i, j, k, col, ecol, pos; Anchor a_form, *a; Line *l, *ls; if (al == NULL || al->nanchor == 0) return; for (i = 0; i < al->nanchor; i++) { a_form = al->anchors[i]; al->anchors[i].rows = 1; if (a_form.hseq < 0 || a_form.rows <= 1) cont...
CWE-787
oob
CVE-2016-9425
CWE-787: Out-of-bounds Write This instance (CVE-2016-9425): In addMultirowsForm, pos (from columnPos) and a->end.pos (pos + ecol - col) are used to write l->lineBuf[pos - 1], l->lineBuf[a->end.pos] and l->propBuf[k] without checking pos >= 1 or end.pos < l->size, causing a heap buffer overflow.
megavul
tats/w3m
c
54
train
rv5_megavul_15307
hard
static int rtsx_usb_ms_drv_probe(struct platform_device *pdev) { struct memstick_host *msh; struct rtsx_usb_ms *host; struct rtsx_ucr *ucr; int err; ucr = usb_get_intfdata(to_usb_interface(pdev->dev.parent)); if (!ucr) return -ENXIO; dev_dbg(&(pdev->dev), "Realtek USB Memstick controller found\n"); msh ...
CWE-416
uaf
CVE-2022-0487
CWE-416: Use After Free This instance (CVE-2022-0487): In the err_out path of rtsx_usb_ms_drv_probe(), memstick_free_host(msh) frees the host (whose private area holds host) before pm_runtime_disable(ms_dev(host)) and pm_runtime_put_noidle(ms_dev(host)) dereference it.
megavul
torvalds/linux
c
51
train
rv5_megavul_153266
easy
int rewrite_packets(tcpedit_t *tcpedit, pcap_t *pin, pcap_dumper_t *pout) { tcpr_dir_t cache_result = TCPR_DIR_C2S; /* default to primary */ struct pcap_pkthdr pkthdr, *pkthdr_ptr; /* packet header */ const u_char *pktconst = NULL; /* packet from libpcap */ u_char **pktdata = NULL; ...
CWE-787
oob
CVE-2016-6160
CWE-787: Out-of-bounds Write This instance (CVE-2016-6160): In rewrite_packets(), memcpy(*pktdata, pktconst, pkthdr.caplen) copies an attacker-controlled caplen from the pcap file into the MAXPACKET-sized pktdata_buff without checking caplen against MAXPACKET, causing a heap buffer overflow.
megavul
appneta/tcpreplay
c
106
train
rv5_megavul_156146
hard
void MutationObserverInterestGroup::enqueueMutationRecord(PassRefPtrWillBeRawPtr<MutationRecord> prpMutation) { RefPtrWillBeRawPtr<MutationRecord> mutation = prpMutation; RefPtrWillBeRawPtr<MutationRecord> mutationWithNullOldValue = nullptr; for (auto& iter : m_observers) { MutationObserver* observe...
CWE-416
uaf
CVE-2015-6789
CWE-416: Use After Free This instance (CVE-2015-6789): MutationObserverInterestGroup::enqueueMutationRecord() takes raw MutationObserver* keys from m_observers and calls observer->enqueueMutationRecord() on them, even though the observer may have been freed because the group held no strong reference to it.
megavul
chromium
cpp
19
train