File size: 3,205 Bytes
30de2c4 0928b42 30de2c4 114856d 30de2c4 114856d 30de2c4 114856d 30de2c4 0928b42 30de2c4 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 | ---
# YAML Metadata Block
language:
- en
tags:
- vulnerability-detection
- cve
- code-changes
- software-security
license: mit
dataset_info:
features:
- name: CVE_ID
dtype: string
- name: CWE_ID
dtype: string
- name: Score
dtype: float
- name: Summary
dtype: string
- name: commit_id
dtype: string
- name: codeLink
dtype: string
- name: file_name
dtype: string
- name: func_after
dtype: string
- name: lines_after
dtype: string
dataset_size: 10GB
---
# MSR Data Cleaned - C/C++ Code Vulnerability Dataset
[](LICENSE)
## ๐ Dataset Description
A curated collection of C/C++ code vulnerabilities paired with:
- CVE details (scores, classifications, exploit status)
- Code changes (commit messages, added/deleted lines)
- File-level and function-level diffs
## ๐ Sample Data Structure
```python
+---------------+-----------------+----------------------+---------------------------+
| CVE ID | Attack Origin | Publish Date | Summary |
+===============+=================+======================+===========================+
| CVE-2015-8467 | Remote | 2015-12-29 | "The samldb_check_user..."|
+---------------+-----------------+----------------------+---------------------------+
| CVE-2016-1234 | Local | 2016-01-15 | "Buffer overflow in..." |
+---------------+-----------------+----------------------+---------------------------+
```
## ๐ ๏ธ Usage Instructions
### 1. Accessing in Colab
```python
!pip install huggingface_hub -q
from huggingface_hub import snapshot_download
repo_id = "starsofchance/MSR_data_cleaned"
dataset_path = snapshot_download(repo_id=repo_id, repo_type="dataset")
```
### 2. Extracting the Dataset
```python
!apt-get install unzip -qq
!unzip "/root/.cache/huggingface/.../MSR_data_cleaned.zip" -d "/content/extracted_data"
```
**Note:** Extracted size is **10GB** (1.5GB compressed).
### 3. Creating Splits (Colab Pro Recommended)
We used this memory-efficient approach:
```python
from datasets import load_dataset
dataset = load_dataset("csv", data_files="MSR_data_cleaned.csv", streaming=True)
# Randomly distribute rows (80-10-10)
for row in dataset:
rand = random.random()
if rand < 0.8: write_to(train.csv)
elif rand < 0.9: write_to(validation.csv)
else: write_to(test.csv)
```
**Hardware Requirements:**
- Minimum 25GB RAM
- Strong CPU (Colab Pro T4 GPU recommended)
## ๐ Citation
```bibtex
@inproceedings{fan2020ccode,
title={A C/C++ Code Vulnerability Dataset with Code Changes and CVE Summaries},
author={Fan, Jiahao and Li, Yi and Wang, Shaohua and Nguyen, Tien N},
booktitle={MSR '20: 17th International Conference on Mining Software Repositories},
pages={1--5},
year={2020},
doi={10.1145/3379597.3387501}
}
```
## ๐ Dataset Creation
- **Source**: Original data from [MSR 2020 Paper](https://doi.org/10.1145/3379597.3387501)
- **Processing**:
- Cleaned and standardized CSV format
- Stream-based splitting to handle large size
- Preserved all original metadata
|