starsofchance commited on
Commit
30de2c4
Β·
verified Β·
1 Parent(s): 93ff88d

Add dataset card

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