Lecture: Testing and verification

Question

Describe one type of bugs that cannot be prevented by KLEE and one type of bugs that cannot be prevented by STACK.

overview

void test_me(int x, int y) {
  int z = 2 * x;
  if (z == y) {
    if (y == x + 10) {
      crash();
    }
  }
}

bug-finding tools

#include <stdio.h>
#include <stdlib.h>

int foo(int n)
{
        int *arr = malloc(n * sizeof(int));
        //arr[0] = 42;
        //free(arr);
        return arr[0];
}

int main(int argc, const char * argv[]) {
    printf("%d\n", foo(argc));
    return 0;
}
#include <assert.h>
#include <stdint.h>
#include <string.h>

void test_me(int x, int y) {
  int z = 2 * x;
  if (z == y) {
    if (y == x + 10) {
      assert(0);
    }
  }
}

int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
  int arr[2];

  if (Size == sizeof(arr)) {
    memcpy(&arr, Data, sizeof(arr));
    test_me(arr[0], arr[1]);
  }
  return 0;
}

other approaches