Dataset Viewer
Auto-converted to Parquet Duplicate
conversations
listlengths
2
2
source
stringclasses
1 value
score
float64
4.8
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nint ZEXPORT inflateReset(strm)\nz_streamp strm;\n{\n struct inflate_sta...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nint __udf_add_aext(struct inode *inode, struct extent_position *epos,\n\t\...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nStringVal StringVal::copy_from(FunctionContext* ctx, const uint8_t* buf, i...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nString Config::get_default(const KeyInfo * ki) const\n {\n bool in_r...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic int query_raw_packet_qp_rq_state(struct mlx5_ib_dev *dev,\n\t\t\t\t...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic unsigned HuffmanTree_makeFromLengths(HuffmanTree* tree, const unsig...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstruct page *f2fs_get_read_data_page(struct inode *inode, pgoff_t index,\n...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nvrrp_vmac_handler(vector_t *strvec)\n{\n\tvrrp_t *vrrp = LIST_TAIL_DATA(vr...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic size_t safe_size(const unsigned int dx, const unsigned int dy,\n ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nbool AuthorizationSessionImpl::isAuthorizedToListCollections(StringData db...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\n**/\n CImgList<T>& operator=(const CImgDisplay& disp) {\n return a...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nvoid _exception(int signr, struct pt_regs *regs, int code, unsigned long a...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic __inline__ ssize_t tun_get_user(struct tun_struct *tun,\n\t\t\t\t ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\ninline Query_arena *activate_stmt_arena_if_needed(Query_arena *backup)\n ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nbool PackLinuxElf32::canPack()\n{\n union {\n unsigned char buf[...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic INLINE BOOL ORDER_FIELD_COLOR(const ORDER_INFO* orderInfo, wStream*...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nint generic_ptrace_peekdata(struct task_struct *tsk, unsigned long addr,\n...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void build_sk_flow_key(struct flowi4 *fl4, const struct sock *sk)\n...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void srpt_cm_rtu_recv(struct ib_cm_id *cm_id)\n{\n\tstruct srpt_rdm...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nTEST_P(Http2MetadataIntegrationTest, ProxyMultipleMetadataReachSizeLimit) ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void stimer_init(struct kvm_vcpu_hv_stimer *stimer, int timer_index...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void vrend_update_viewport_state(struct vrend_sub_context *sub_ctx)...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nint sqlite3GetTempRange(Parse *pParse, int nReg){\n int i, n;\n if( nReg...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic RList* sections(RBinFile *bf) {\n\tr_return_val_if_fail (bf && bf->...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic PK11SymKey *import_symmetric_key(struct crypto_instance *instance, ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\n//! Resize image to new dimensions \\newinstance.\n CImg<T> get_resize(...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic int ndpi_search_tls_udp(struct ndpi_detection_module_struct *ndpi_s...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void __hidp_copy_session(struct hidp_session *session, struct hidp_...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic CURLcode blobdup(struct curl_blob **dest,\n ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nint sta_info_insert_rcu(struct sta_info *sta) __acquires(RCU)\n{\n\tstruct...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nR_API void r_bin_java_print_unknown_cp_summary(RBinJavaCPTypeObj *obj) {\n...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nxfs_attr3_leaf_hdr_from_disk(\n\tstruct xfs_da_geometry\t\t*geo,\n\tstruct...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nR_API RBinJavaStackMapFrame *r_bin_java_build_stack_frame_from_local_varia...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nconst CImg<T>& save_medcon_external(const char *const filename) const {\n ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nvoid js_pushvalue(js_State *J, js_Value v)\n{\n\tCHECKSTACK(1);\n\tSTACK[T...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic ssize_t node_read_cpumap(struct device *dev, bool list, char *buf)\...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nCImg<Tfloat> get_RGBtoXYZ(const bool use_D65=true) const {\n return C...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic int vnc_zlib_stop(VncState *vs)\n{\n z_streamp zstream = &vs->zl...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic int audit_to_watch(struct audit_krule *krule, char *path, int len,\...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nbool CIRCSock::OnJoinMessage(CJoinMessage& Message) {\n const CNick& Ni...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void tg3_ints_fini(struct tg3 *tp)\n{\n\tif (tg3_flag(tp, USING_MSI...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic int packet_getname(struct socket *sock, struct sockaddr *uaddr,\n\t...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nGF_Err stdp_box_size(GF_Box *s)\n{\n\tGF_DegradationPriorityBox *ptr = (GF...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstruct crypto_alg *crypto_larval_lookup(const char *name, u32 type, u32 ma...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nAuditPrefix(void)\n{\n time_t tm;\n char *autime, *s;\n char *tmp...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nrepodata_set(Repodata *data, Id solvid, Repokey *key, Id val)\n{\n Id key...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nrpl_dio_printopt(netdissect_options *ndo,\n const struct r...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nint sc_bin_to_hex(const u8 *in, size_t in_len, char *out, size_t out_len,\...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void keyring_publish_name(struct key *keyring)\n{\n\tint bucket;\n\...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic void timestamp(void)\n{\n struct compile_time * const oct = &off...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic int bt_seq_open(struct inode *inode, struct file *file)\n{\n\tstruc...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nSPL_METHOD(SplObjectStorage, rewind)\n{\n\tspl_SplObjectStorage *intern = ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nint sqfs_size(const char *filename, loff_t *size)\n{\n\tstruct squashfs_su...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\ntrust_key(dns_zone_t *zone, dns_name_t *keyname,\n\t dns_rdata_dnskey_t *...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic int iwl_pcie_load_given_ucode(struct iwl_trans *trans,\n\t\t\t\tcon...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstatic SSL_CTX *init_tls_ctx(EAP_TLS_CONF *conf)\n{\n\tSSL_METHOD *meth;\n...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nu8 iwl_prep_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx,\n...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\npsp_zalloc (void *opaque,\n guint items,\n guint ...
code_vulnerability_cwe
4.8
[ { "from": "human", "value": "Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.\n\n```c\nstack_double(int is_alloca, char** arg_alloc_base,\n\t OnigStackType**...
code_vulnerability_cwe
4.8
End of preview. Expand in Data Studio

πŸ” Code Vulnerability FineTome β€” CWE-Enriched Conversation Dataset


πŸ“Œ Overview

This dataset converts raw security-labeled C/C++ code samples into instruction-following conversation pairs suitable for fine-tuning large language models (LLMs) on software vulnerability detection and analysis.

It is built by preprocessing and transforming the ChamaraVishwajithRajapaksha/Code_Vulnerability_Dataset (330k rows, sourced from DiverseVul + MITRE CWE enrichment) into the ShareGPT / FineTome conversation format used by mlabonne/FineTome-100k.

🎯 Use Cases

  • Fine-tuning LLMs for security code review
  • Training vulnerability detection models
  • Building code-aware security assistants
  • Research in automated static analysis and secure coding

πŸ“Š Dataset Statistics

Property Value
Source Dataset ChamaraVishwajithRajapaksha/Code_Vulnerability_Dataset
Original Rows 330,492
Rows After Cleaning ~180,000+
Format ShareGPT (conversations)
Languages C, C++
Splits train (90%) Β· test (10%)
License MIT

πŸ—‚οΈ Data Format

Each row follows the ShareGPT conversation format with two turns:

{
  "conversations": [
    {
      "from": "human",
      "value": "Analyze the following code snippet and identify any security vulnerabilities...\n\n```c\n<source code>\n```"
    },
    {
      "from": "gpt",
      "value": "## Security Vulnerability Analysis\n\n⚠️ This code sample is marked as **Vulnerable**.\n\n### πŸ” Vulnerability Classification\n- **CWE ID**: CWE-787\n- **Type**: Out-of-bounds Write\n- **Severity**: High\n..."
    }
  ],
  "source": "code_vulnerability_cwe",
  "score": 4.8
}

Fields

Field Type Description
conversations list List of 2 conversation turns
conversations[0].from str Always "human"
conversations[0].value str Instruction + C/C++ code block (from func)
conversations[1].from str Always "gpt"
conversations[1].value str Structured vulnerability analysis (from cwe_details)
source str Always "code_vulnerability_cwe"
score float Quality score (4.8)

πŸ”„ Preprocessing Pipeline

The raw dataset was transformed in the following steps:

Step 1 β€” Load

Download the source dataset from Hugging Face Hub (330k rows, Parquet format).

Step 2 β€” Filter

Filter Condition
func must exist Non-null, length > 10 characters
cwe_details must be valid Non-null, parseable as JSON
No duplicates Drop duplicate func + cwe_details pairs

Step 3 β€” Transform Human Turn

The func (source code column) is wrapped in an instruction prompt:

Analyze the following code snippet and identify any security vulnerabilities.
Provide a detailed explanation of the vulnerability type, its severity, potential impact,
and the CWE classification.

```c
<source code here>

### Step 4 β€” Transform Assistant Turn
The `cwe_details` JSON is rendered into structured Markdown including:
- CWE ID and vulnerability type
- Severity and category
- Affected programming languages
- Potential impact (from MITRE CWE database)
- Security recommendation
- Whether the sample is `Vulnerable` or `Safe` (patched)

### Step 5 β€” Split & Push
- 90% / 10% train-test split (random seed 42)
- Pushed to Hugging Face Hub in Parquet format

---

## πŸ“‹ CWE Categories Covered

The dataset covers a wide range of Common Weakness Enumeration types including:

| CWE ID | Vulnerability Type |
|---|---|
| CWE-787 | Out-of-bounds Write |
| CWE-416 | Use After Free |
| CWE-125 | Out-of-bounds Read |
| CWE-476 | NULL Pointer Dereference |
| CWE-119 | Improper Buffer Restriction |
| CWE-284 | Improper Access Control |
| CWE-20 | Improper Input Validation |
| CWE-78 | OS Command Injection |
| CWE-327 | Broken Cryptographic Algorithm |
| CWE-835 | Infinite Loop |
| CWE-122 | Heap-based Buffer Overflow |
| CWE-362 | Race Condition |
| CWE-22 | Path Traversal |
| CWE-287 | Improper Authentication |
| CWE-319 | Cleartext Transmission |
| ... | 30+ more CWE types |

---

## πŸ§ͺ Sample Example

### Human Turn

Analyze the following code snippet and identify any security vulnerabilities. Provide a detailed explanation of the vulnerability type, its severity, potential impact, and the CWE classification.

static boolean ReadICCProfile(j_decompress_ptr jpeg_info) {
  char magick[12];
  ErrorManager *error_manager;
  ExceptionInfo *exception;
  Image *image;
  ...
}

### Assistant Turn
```markdown
## Security Vulnerability Analysis

⚠️ This code sample is marked as **Vulnerable**.

### πŸ” Vulnerability Classification
- **CWE ID**: CWE-416
- **Type**: Use After Free
- **Severity**: High
- **Category**: Memory Corruption
- **Affected Languages**: C, C++

### πŸ“‹ Description
The product reuses or references memory after it has been freed. At some point
afterward, the memory may be allocated again and saved in another pointer, while
the original pointer references a location somewhere within the new allocation.

### πŸ’₯ Potential Impact
  - Execute Unauthorized Code or Commands
  - Read Memory
  - Modify Memory
  - DoS: Crash, Exit, or Restart

### πŸ›‘οΈ Recommendation
Review the code for Use After Free patterns. Ensure proper bounds checking,
input validation, and memory management practices are applied as recommended
by the CWE guidelines for CWE-416.

πŸš€ Usage

Load with πŸ€— Datasets

from datasets import load_dataset

dataset = load_dataset("YOUR_USERNAME/Code-Vulnerability-FineTome")
print(dataset)
# DatasetDict({
#     train: Dataset({features: ['conversations', 'source', 'score'], num_rows: ...}),
#     test:  Dataset({features: ['conversations', 'source', 'score'], num_rows: ...})
# })

Access a Sample

sample = dataset['train'][0]

# Print the human question (code to analyze)
print(sample['conversations'][0]['value'])

# Print the assistant answer (vulnerability analysis)
print(sample['conversations'][1]['value'])

Fine-tuning with Unsloth / TRL

from trl import SFTTrainer
from unsloth import FastLanguageModel

# The dataset is already in ShareGPT format β€” compatible with
# most fine-tuning frameworks that support conversation datasets.
trainer = SFTTrainer(
    model=model,
    tokenizer=tokenizer,
    train_dataset=dataset['train'],
    dataset_text_field="conversations",  # adjust per framework
    ...
)

πŸ“ Source Dataset

This dataset is derived from:


⚠️ Limitations

  • Code samples are primarily in C and C++ β€” limited coverage of other languages
  • Some rows were dropped due to missing or malformed cwe_details
  • The Safe samples represent patched/fixed versions, not inherently safe code β€” context matters
  • CWE details describe the class of vulnerability, not a precise analysis of each individual function
  • This dataset is intended for research and educational purposes

πŸ“œ License

This dataset is released under the MIT License, consistent with the source dataset license.


πŸ™ Citation

If you use this dataset in your research, please cite the original source:

@dataset{code_vulnerability_finetome,
  title        = {Code Vulnerability FineTome: CWE-Enriched Conversation Dataset},
  author       = {Derived from ChamaraVishwajithRajapaksha/Code\_Vulnerability\_Dataset},
  year         = {2025},
  publisher    = {Hugging Face},
  url          = {https://huggingface.co/datasets/YOUR_USERNAME/Code-Vulnerability-FineTome},
  note         = {Preprocessed into ShareGPT conversation format for LLM fine-tuning}
}

πŸ”— Related Resources

Downloads last month
568

Paper for ChamaraVishwajithRajapaksha/Code-Vulnerability-FineTune