Create bugs.json
Browse files
bugs.json
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"easy": {
|
| 3 |
+
"null_check": {
|
| 4 |
+
"type": "ast",
|
| 5 |
+
"bug_type": "null_check",
|
| 6 |
+
"oracle_hint": "Add back the if-guard that was removed"
|
| 7 |
+
},
|
| 8 |
+
"simple_typo": {
|
| 9 |
+
"type": "ast",
|
| 10 |
+
"bug_type": "simple_typo",
|
| 11 |
+
"oracle_hint": "Fix the misspelled variable name"
|
| 12 |
+
},
|
| 13 |
+
"string_index": {
|
| 14 |
+
"type": "ast",
|
| 15 |
+
"bug_type": "string_index",
|
| 16 |
+
"oracle_hint": "Correct the index offset"
|
| 17 |
+
},
|
| 18 |
+
"default_value": {
|
| 19 |
+
"type": "ast",
|
| 20 |
+
"bug_type": "default_value",
|
| 21 |
+
"oracle_hint": "Restore dict.get() with proper default"
|
| 22 |
+
},
|
| 23 |
+
"empty_return": {
|
| 24 |
+
"type": "ast",
|
| 25 |
+
"bug_type": "empty_return",
|
| 26 |
+
"oracle_hint": "Remove the premature return None"
|
| 27 |
+
}
|
| 28 |
+
},
|
| 29 |
+
"medium": {
|
| 30 |
+
"off_by_one": {
|
| 31 |
+
"type": "ast",
|
| 32 |
+
"bug_type": "off_by_one"
|
| 33 |
+
},
|
| 34 |
+
"loop_skip": {
|
| 35 |
+
"type": "ast",
|
| 36 |
+
"bug_type": "loop_skip"
|
| 37 |
+
},
|
| 38 |
+
"sign_error": {
|
| 39 |
+
"type": "ast",
|
| 40 |
+
"bug_type": "sign_error"
|
| 41 |
+
},
|
| 42 |
+
"swap_args": {
|
| 43 |
+
"type": "ast",
|
| 44 |
+
"bug_type": "swap_args"
|
| 45 |
+
},
|
| 46 |
+
"uninitialised_var": {
|
| 47 |
+
"type": "ast",
|
| 48 |
+
"bug_type": "uninitialised_var"
|
| 49 |
+
}
|
| 50 |
+
},
|
| 51 |
+
"hard": {
|
| 52 |
+
"division_by_zero_empty": {
|
| 53 |
+
"type": "ast",
|
| 54 |
+
"bug_type": "division_by_zero_empty"
|
| 55 |
+
},
|
| 56 |
+
"division_by_zero_zero": {
|
| 57 |
+
"type": "ast",
|
| 58 |
+
"bug_type": "division_by_zero_zero"
|
| 59 |
+
},
|
| 60 |
+
"float_precision": {
|
| 61 |
+
"type": "ast",
|
| 62 |
+
"bug_type": "float_precision"
|
| 63 |
+
},
|
| 64 |
+
"abs_usage": {
|
| 65 |
+
"type": "ast",
|
| 66 |
+
"bug_type": "abs_usage"
|
| 67 |
+
},
|
| 68 |
+
"round_error": {
|
| 69 |
+
"type": "ast",
|
| 70 |
+
"bug_type": "round_error"
|
| 71 |
+
}
|
| 72 |
+
},
|
| 73 |
+
"harder": {
|
| 74 |
+
"missing_lock": {
|
| 75 |
+
"type": "template",
|
| 76 |
+
"buggy": "counter = 0\ndef increment():\n global counter\n counter += 1",
|
| 77 |
+
"oracle": "counter = 0\nimport threading\nlock = threading.Lock()\ndef increment():\n global counter\n with lock:\n counter += 1"
|
| 78 |
+
},
|
| 79 |
+
"double_lock": {
|
| 80 |
+
"type": "template",
|
| 81 |
+
"buggy": "import threading\nlock = threading.Lock()\ndef do_work():\n lock.acquire()\n lock.acquire()\n print('working')\n lock.release()",
|
| 82 |
+
"oracle": "import threading\nlock = threading.Lock()\ndef do_work():\n with lock:\n print('working')"
|
| 83 |
+
},
|
| 84 |
+
"global_nonatomic": {
|
| 85 |
+
"type": "template",
|
| 86 |
+
"buggy": "count = 0\ndef add():\n global count\n count = count + 1",
|
| 87 |
+
"oracle": "count = 0\ndef add():\n global count\n count += 1"
|
| 88 |
+
},
|
| 89 |
+
"thread_safe_list": {
|
| 90 |
+
"type": "template",
|
| 91 |
+
"buggy": "import threading\nitems = []\ndef append_item(item):\n items.append(item)",
|
| 92 |
+
"oracle": "import threading\nitems = []\nlock = threading.Lock()\ndef append_item(item):\n with lock:\n items.append(item)"
|
| 93 |
+
},
|
| 94 |
+
"volatile_read": {
|
| 95 |
+
"type": "template",
|
| 96 |
+
"buggy": "import threading\nstop = False\ndef worker():\n while not stop:\n pass",
|
| 97 |
+
"oracle": "import threading\nstop = False\nlock = threading.Lock()\ndef worker():\n while True:\n with lock:\n if stop:\n break"
|
| 98 |
+
}
|
| 99 |
+
},
|
| 100 |
+
"hardest": {
|
| 101 |
+
"deadlock_order": {
|
| 102 |
+
"type": "template",
|
| 103 |
+
"buggy": "import threading\nlock1 = threading.Lock()\nlock2 = threading.Lock()\ndef thread1():\n with lock1:\n with lock2:\n pass\ndef thread2():\n with lock2:\n with lock1:\n pass",
|
| 104 |
+
"oracle": "import threading\nlock1 = threading.Lock()\nlock2 = threading.Lock()\ndef thread1():\n with lock1:\n with lock2:\n pass\ndef thread2():\n with lock1:\n with lock2:\n pass"
|
| 105 |
+
},
|
| 106 |
+
"nested_lock_timeout": {
|
| 107 |
+
"type": "template",
|
| 108 |
+
"buggy": "import threading\nlock = threading.Lock()\ndef work():\n lock.acquire()\n # critical section\n lock.release()",
|
| 109 |
+
"oracle": "import threading\nlock = threading.Lock()\ndef work():\n if lock.acquire(timeout=1):\n try:\n # critical section\n finally:\n lock.release()"
|
| 110 |
+
},
|
| 111 |
+
"fork_join": {
|
| 112 |
+
"type": "template",
|
| 113 |
+
"buggy": "import threading\ndef worker():\n pass\nt = threading.Thread(target=worker)\nt.start()",
|
| 114 |
+
"oracle": "import threading\ndef worker():\n pass\nt = threading.Thread(target=worker)\nt.start()\nt.join()"
|
| 115 |
+
},
|
| 116 |
+
"mutex_release": {
|
| 117 |
+
"type": "template",
|
| 118 |
+
"buggy": "import threading\nlock = threading.Lock()\ndef thread_A():\n lock.acquire()\n lock.release()\ndef thread_B():\n lock.release()",
|
| 119 |
+
"oracle": "import threading\nlock = threading.Lock()\ndef thread_A():\n with lock:\n pass\ndef thread_B():\n with lock:\n pass"
|
| 120 |
+
},
|
| 121 |
+
"race_on_init": {
|
| 122 |
+
"type": "template",
|
| 123 |
+
"buggy": "import threading\nitems = []\ndef init():\n global items\n items = [1,2,3]\nt = threading.Thread(target=init)\nt.start()\nprint(items)",
|
| 124 |
+
"oracle": "import threading\nitems = []\ndef init():\n global items\n items = [1,2,3]\nt = threading.Thread(target=init)\nt.start()\nt.join()\nprint(items)"
|
| 125 |
+
}
|
| 126 |
+
}
|
| 127 |
+
}
|