--- /dev/null
+/* contains all autofix checkers */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/********************* ALLOC_SIZE_MISMATCH *********************/
+struct Person {
+ int age;
+ char name[20];
+};
+
+struct Person *alloc_size_mismatch(void) {
+ struct Person *ptr;
+ ptr = (struct Person *)malloc(sizeof(ptr));
+ return ptr;
+}
+/****************************************************************/
+
+/********************* BAD_ALLOC_ARITHMETIC *********************/
+char *bad_alloc_arithmetic(char *str, int len) {
+ char *res = malloc(len) + 1;
+
+ memcpy(res, str, len);
+ res[len] = '\0';
+
+ return res;
+}
+/****************************************************************/
+
+/********************* BAD_COPY_PASTE *********************/
+int callee(int x) { return x * x + 1; }
+
+int bad_copy_paste(int a, int b, int x) {
+ int result = 0;
+
+ // copied
+ if (b > 0) {
+ result = callee(a) + callee(x); // auto fix
+ }
+
+ // maybe origin
+ if (a > 0) {
+ result = callee(a) + callee(x);
+ }
+
+ return result;
+}
+/****************************************************************/
+
+/********************* BAD_SIZEOF *********************/
+void bad_sizeof() {
+ short s;
+ memset(&s, 0, sizeof(&s)); // auto fix
+}
+/****************************************************************/
+
+/********************* MEMSET_SIZE_MISMATCH *********************/
+typedef struct {
+ int x;
+ int y;
+} FooBarStruct;
+
+void memset_size_mismatch() {
+ FooBarStruct fbs;
+ memset(&fbs, 0, 4); // auto fix
+}
+/****************************************************************/
+
+/********************* NO_CAST.INTEGER_DIVISION *********************/
+float divv(int a, int b) { return (a / b); }
+void no_cast_integer_division() { printf("%0.2f\n", divv(10, 4)); }
+/****************************************************************/
+
+/********************* NO_CAST.INTEGER_OVERFLOW *********************/
+long mult(int a, int b) { return (a * b); } // auto fix
+void no_cast_integer_overflow() { printf("%ld\n", mult(0x7FFFFFFF, 2)); }
+/****************************************************************/
+
+/********************* NO_EFFECT *********************/
+void no_effect() {
+ int *ptr1, *ptr2;
+ ptr1 = new int(10);
+ ptr2 = new int(15);
+ delete ptr1, ptr2;
+}
+/****************************************************************/
+
+/********************* SIZEOF_POINNTER_TYPE *********************/
+struct buffer {
+ char b[100];
+};
+
+void sizeof_pointer_type() {
+ struct buffer buf;
+ memset(&buf, 0, sizeof(&buf));
+
+ struct buffer *pbuf;
+ pbuf = (struct buffer *)malloc(sizeof(struct buffer *)); // auto fix
+}
+/****************************************************************/
+
+/********************* SIZEOF_POINTER_TYPE.CHAR *********************/
+void sizeof_pointer_type_char(int len, char *pc) {
+ pc = (char *)malloc(len * sizeof(pc));
+}
+/****************************************************************/
+
+/********************* UNREACHABLE_CODE.NO_PATH *********************/
+int unreachable_code_no_path(int a) {
+ int ret = 0;
+ switch (a) {
+ case 1:
+ ret = 2;
+ break;
+ ret = 3; // unreachable
+ default:
+ ret = -1;
+ break;
+ }
+ return ret;
+ ret = ret * a; // unreachable
+}
+/****************************************************************/
+