dataset
stringclasses
1 value
file
stringlengths
27
83
fun_name
stringlengths
7
83
llvm_ir_function
stringlengths
61
8.29k
label
stringclasses
2 values
juliet-test-suite-c
CWE127_Buffer_Underread__char_alloca_memcpy_06-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = ptrtoint i64* %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = add i64 %0, -97 %3 = and i64 %2, -16 %4 = inttoptr i64 %3 to i64* %5 = call i64* @memset(i64* %4, i32 65, i32 99) %6 = add i64 %3, 99 %7 = inttoptr i64 %6 to i8* store i8 0, i8* %7, align 1 store i64 %3, i64* %sv_1, align 8 %8 = call i64* @memset(i64* nonnull %sv_0, i32 67, i32 99) %9 = load i64, i64* %sv_1, align 8 %10 = inttoptr i64 %9 to i64* %11 = load i64, i64* %10, align 8 store i64 %11, i64* %sv_0, align 8 %12 = ptrtoint i64* %sv_0 to i64 %13 = call i64 @FUNC(i64 %12) %14 = call i64 @FUNC(i64 40) %15 = icmp eq i64 %1, %14 store i64 0, i64* %rax.0.reg2mem br i1 %15, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %3, { 0, 2, 1 } uselistorder i64* %sv_0, { 1, 2, 0 } uselistorder i64* (i64*, i32, i32)* @memset, { 3, 2, 1, 0, 4 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__int_listen_socket_add_05-bad
CWE190_Integer_Overflow__int_listen_socket_add_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.1.ph.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 0 br i1 %2, label LBL_11, label LBL_1 LBL_1: %3 = call i32 @socket(i32 2, i32 1, i32 6) %4 = icmp eq i32 %3, -1 store i32 0, i32* %sv_0.1.ph.reg2mem br i1 %4, label LBL_9, label LBL_2 LBL_2: %5 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %6 = call i16 @htons(i16 27015) %7 = bitcast i64* %sv_2 to %sockaddr* %8 = call i32 @bind(i32 %3, %sockaddr* nonnull %7, i32 16) %9 = icmp eq i32 %8, -1 br i1 %9, label LBL_7, label LBL_3 LBL_3: %10 = call i32 @listen(i32 %3, i32 5) %11 = icmp eq i32 %10, -1 br i1 %11, label LBL_7, label LBL_4 LBL_4: %12 = call i32 @accept(i32 %3, %sockaddr* null, i32* null) %13 = icmp eq i32 %12, -1 br i1 %13, label LBL_7, label LBL_5 LBL_5: %14 = call i32 @recv(i32 %12, i64* nonnull %sv_1, i32 13, i32 0) %15 = add i32 %14, 1 %16 = icmp ult i32 %15, 2 store i32 0, i32* %sv_0.0.ph.reg2mem br i1 %16, label LBL_8, label LBL_6 LBL_6: %17 = ptrtoint i64* %sv_3 to i64 %18 = sext i32 %14 to i64 %19 = add i64 %17, -22 %20 = add i64 %19, %18 %21 = inttoptr i64 %20 to i8* store i8 0, i8* %21, align 1 %22 = bitcast i64* %sv_1 to i8* %23 = call i32 @atoi(i8* nonnull %22) store i32 %23, i32* %sv_0.0.ph.reg2mem br label LBL_8 LBL_7: %24 = call i32 @close(i32 %3) store i32 0, i32* %sv_0.1.ph.reg2mem br label LBL_9 LBL_8: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %25 = call i32 @close(i32 %3) %26 = call i32 @close(i32 %12) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.ph.reg2mem br label LBL_9 LBL_9: %.pr = load i32, i32* @gv_0, align 4 %27 = icmp eq i32 %.pr, 0 br i1 %27, label LBL_11, label LBL_10 LBL_10: %sv_0.1.ph.reload = load i32, i32* %sv_0.1.ph.reg2mem %28 = add i32 %sv_0.1.ph.reload, 1 %29 = zext i32 %28 to i64 %30 = call i64 @FUNC(i64 %29) br label LBL_11 LBL_11: %31 = call i64 @FUNC(i64 40) %32 = icmp eq i64 %0, %31 store i64 0, i64* %rax.0.reg2mem br i1 %32, label LBL_13, label LBL_12 LBL_12: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_13 LBL_13: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %14, { 1, 0 } uselistorder i32 %3, { 4, 0, 1, 2, 3, 5 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32* %sv_0.1.ph.reg2mem, { 0, 2, 3, 1 } uselistorder i32 (i32)* @close, { 2, 1, 0, 3 } uselistorder label LBL_11, { 1, 2, 0 } uselistorder label LBL_9, { 2, 1, 0 } }
1
juliet-test-suite-c
CWE665_Improper_Initialization__char_ncat_01-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = bitcast i64* %sv_1 to i8* store i8 0, i8* %1, align 8 %2 = call i64* @memset(i64* nonnull %sv_0, i32 67, i32 99) %3 = bitcast i64* %sv_0 to i8* %4 = call i32 @strlen(i8* nonnull %3) %5 = call i8* @strncat(i8* nonnull %1, i8* nonnull %3, i32 %4) %6 = ptrtoint i64* %sv_1 to i64 %7 = call i64 @FUNC(i64 %6) %8 = call i64 @FUNC(i64 40) %9 = icmp eq i64 %0, %8 store i64 0, i64* %rax.0.reg2mem br i1 %9, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE806_char_alloca_ncpy_14-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = ptrtoint i64* %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = add i64 %0, -97 %3 = and i64 %2, -16 store i64 %3, i64* %sv_1, align 8 %4 = load i32, i32* @gv_0, align 4 %5 = icmp eq i32 %4, 5 %6 = icmp eq i1 %5, false br i1 %6, label LBL_2, label LBL_1 LBL_1: %7 = inttoptr i64 %3 to i64* %8 = call i64* @memset(i64* %7, i32 65, i32 49) %9 = add i64 %3, 49 %10 = inttoptr i64 %9 to i8* store i8 0, i8* %10, align 1 br label LBL_2 LBL_2: %11 = inttoptr i64 %3 to i8* store i64 0, i64* %sv_0, align 8 %12 = call i32 @strlen(i8* %11) %13 = bitcast i64* %sv_0 to i8* %14 = call i8* @strncpy(i8* nonnull %13, i8* %11, i32 %12) %15 = call i64 @FUNC(i64 %3) %16 = call i64 @FUNC(i64 40) %17 = icmp eq i64 %1, %16 store i64 0, i64* %rax.0.reg2mem br i1 %17, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i8* %11, { 1, 0 } uselistorder i64 %3, { 0, 3, 2, 1, 4 } uselistorder i8* (i8*, i8*, i32)* @strncpy, { 1, 0, 2 } uselistorder i32 (i8*)* @strlen, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE806_char_declare_memcpy_09-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = bitcast i64* %sv_1 to i8* %2 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 49) %3 = ptrtoint i64* %sv_1 to i64 %4 = add i64 %3, 49 %5 = inttoptr i64 %4 to i8* store i8 0, i8* %5, align 1 store i64 0, i64* %sv_0, align 8 %6 = call i32 @strlen(i8* nonnull %1) %7 = call i64* @memcpy(i64* nonnull %sv_0, i64* nonnull %sv_1, i32 %6) %8 = call i64 @FUNC(i64 %3) %9 = call i64 @FUNC(i64 40) %10 = icmp eq i64 %0, %9 store i64 0, i64* %rax.0.reg2mem br i1 %10, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* (i64*, i64*, i32)* @memcpy, { 1, 0, 2 } uselistorder i32 (i8*)* @strlen, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__int_fscanf_add_01-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 0, i64* %sv_0, align 8 %1 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %2 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i64* nonnull %sv_0) %3 = load i64, i64* %sv_0, align 8 %4 = trunc i64 %3 to i32 %5 = icmp eq i32 %4, 2147483647 br i1 %5, label LBL_2, label LBL_1 LBL_1: %6 = add i64 %3, 1 %7 = and i64 %6, 4294967295 %8 = call i64 @FUNC(i64 %7) br label LBL_3 LBL_2: %9 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_2 to i64)) br label LBL_3 LBL_3: %10 = call i64 @FUNC(i64 40) %11 = icmp eq i64 %0, %10 store i64 0, i64* %rax.0.reg2mem br i1 %11, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %sv_0, { 1, 0, 2 } uselistorder i64 (i64)* @printIntLine, { 1, 0 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE135_13-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i32*, align 8 %0 = ptrtoint i32** %sv_0 to i64 %1 = call i64 @FUNC(i64 40) %2 = load i32, i32* inttoptr (i64 8588 to i32*), align 4 %3 = icmp eq i32 %2, 5 %4 = icmp eq i1 %3, false %spec.store.select = select i1 %4, i32* null, i32* getelementptr inbounds ([43 x i32], [43 x i32]* @gv_0, i64 0, i64 0) store i32* %spec.store.select, i32** %sv_0, align 8 %5 = call i32 @wcslen(i32* %spec.store.select) %6 = sext i32 %5 to i64 %7 = mul i64 %6, 4 %8 = add nsw i64 %7, 27 %9 = udiv i64 %8, 16 %10 = mul i64 %9, 16 %11 = and i64 %10, -4096 %12 = and i64 %10, 4080 %13 = add i64 %0, 15 %14 = sub i64 %13, %12 %15 = sub i64 %14, %11 %16 = and i64 %15, -16 %17 = load i32*, i32** %sv_0, align 8 %18 = inttoptr i64 %16 to i32* %19 = call i32* @wcscpy(i32* %18, i32* %17) %20 = call i64 @FUNC(i64 %16) %21 = call i64 @FUNC(i64 40) %22 = icmp eq i64 %1, %21 store i64 0, i64* %rax.0.reg2mem br i1 %22, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %16, { 1, 0 } uselistorder i64 %10, { 1, 0 } uselistorder i32** %sv_0, { 2, 1, 0 } }
0
juliet-test-suite-c
CWE606_Unchecked_Loop_Condition__char_file_01-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.lcssa.reg2mem = alloca i64 %storemerge5.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 0, i64* %sv_2, align 8 %1 = bitcast i64* %sv_2 to i8* %2 = call i32 @strlen(i8* nonnull %1) %3 = sext i32 %2 to i64 %4 = sub nsw i64 100, %3 %5 = icmp ult i64 %4, 2 br i1 %5, label LBL_5, label LBL_1 LBL_1: %6 = call %_IO_FILE* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @gv_0, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @gv_1, i64 0, i64 0)) %7 = icmp eq %_IO_FILE* %6, null br i1 %7, label LBL_5, label LBL_2 LBL_2: %8 = sub i32 100, %2 %9 = ptrtoint i64* %sv_2 to i64 %10 = add i64 %3, %9 %11 = inttoptr i64 %10 to i8* %12 = call i8* @fgets(i8* %11, i32 %8, %_IO_FILE* nonnull %6) %13 = icmp eq i8* %12, null %14 = icmp eq i1 %13, false br i1 %14, label LBL_4, label LBL_3 LBL_3: %15 = call i64 @FUNC(i64 ptrtoint ([15 x i8]* @gv_2 to i64)) store i8 0, i8* %11, align 1 br label LBL_4 LBL_4: %16 = call i32 @fclose(%_IO_FILE* nonnull %6) br label LBL_5 LBL_5: %17 = call i32 (i8*, i8*, ...) @sscanf(i8* nonnull %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_3, i64 0, i64 0), i64* nonnull %sv_1) %18 = icmp eq i32 %17, 1 %19 = icmp eq i1 %18, false br i1 %19, label LBL_11, label LBL_6 LBL_6: %20 = load i64, i64* %sv_1, align 8 %21 = trunc i64 %20 to i32 %22 = icmp sgt i32 %21, ptrtoint (i1* @gv_4 to i32) br i1 %22, label LBL_11, label LBL_7 LBL_7: %23 = and i64 %20, 4294967295 %24 = icmp eq i64 %23, 0 store i32 0, i32* %storemerge5.reg2mem store i64 0, i64* %sv_0.0.lcssa.reg2mem br i1 %24, label LBL_10, label LBL_8 LBL_8: %storemerge5.reload = load i32, i32* %storemerge5.reg2mem %25 = add i32 %storemerge5.reload, 1 %26 = sext i32 %25 to i64 %27 = icmp sgt i64 %23, %26 store i32 %25, i32* %storemerge5.reg2mem br i1 %27, label LBL_8, label LBL_9 LBL_9: %phitmp = zext i32 %25 to i64 store i64 %phitmp, i64* %sv_0.0.lcssa.reg2mem br label LBL_10 LBL_10: %sv_0.0.lcssa.reload = load i64, i64* %sv_0.0.lcssa.reg2mem %28 = call i64 @FUNC(i64 %sv_0.0.lcssa.reload) br label LBL_11 LBL_11: %29 = call i64 @FUNC(i64 40) %30 = icmp eq i64 %0, %29 store i64 0, i64* %rax.0.reg2mem br i1 %30, label LBL_13, label LBL_12 LBL_12: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_13 LBL_13: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %25, { 1, 0, 2 } uselistorder i64* %sv_1, { 1, 0 } uselistorder i32* %storemerge5.reg2mem, { 2, 0, 1 } uselistorder i64* %sv_0.0.lcssa.reg2mem, { 0, 2, 1 } uselistorder i64 (i64)* @printIntLine, { 1, 0 } uselistorder label LBL_10, { 1, 0 } uselistorder label LBL_8, { 1, 0 } }
0
juliet-test-suite-c
CWE369_Divide_by_Zero__float_listenSocket_31-bad
CWE369_Divide_by_Zero__float_listenSocket_31_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = alloca i128 %rax.0.reg2mem = alloca i64 %sv_0.056.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %1 = load i128, i128* %0 %2 = load i128, i128* %0 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %3 = call i64 @FUNC(i64 40) %4 = call i128 @FUNC(i128 %2, i128 %2) %5 = call i64 @FUNC(i128 %4) %6 = trunc i64 %5 to i32 %7 = call i32 @socket(i32 2, i32 1, i32 6) %8 = icmp eq i32 %7, -1 store i32 %6, i32* %sv_0.056.reg2mem br i1 %8, label LBL_8, label LBL_1 LBL_1: %9 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %10 = call i16 @htons(i16 27015) %11 = bitcast i64* %sv_2 to %sockaddr* %12 = call i32 @bind(i32 %7, %sockaddr* nonnull %11, i32 16) %13 = icmp eq i32 %12, -1 br i1 %13, label LBL_6, label LBL_2 LBL_2: %14 = call i32 @listen(i32 %7, i32 5) %15 = icmp eq i32 %14, -1 br i1 %15, label LBL_6, label LBL_3 LBL_3: %16 = call i32 @accept(i32 %7, %sockaddr* null, i32* null) %17 = icmp eq i32 %16, -1 br i1 %17, label LBL_6, label LBL_4 LBL_4: %18 = call i32 @recv(i32 %16, i64* nonnull %sv_1, i32 19, i32 0) %19 = add i32 %18, 1 %20 = icmp ult i32 %19, 2 store i32 %6, i32* %sv_0.0.ph.reg2mem br i1 %20, label LBL_7, label LBL_5 LBL_5: %21 = ptrtoint i64* %sv_3 to i64 %22 = sext i32 %18 to i64 %23 = add i64 %21, -32 %24 = add i64 %23, %22 %25 = inttoptr i64 %24 to i8* store i8 0, i8* %25, align 1 %26 = bitcast i64* %sv_1 to i8* %27 = call double @atof(i8* nonnull %26) %28 = fptrunc double %27 to float %29 = bitcast float %28 to i32 %30 = sext i32 %29 to i128 %31 = call i128 @FUNC(i128 %30) %32 = call i64 @FUNC(i128 %31) %33 = trunc i64 %32 to i32 store i32 %33, i32* %sv_0.0.ph.reg2mem br label LBL_7 LBL_6: %34 = call i32 @close(i32 %7) store i32 %6, i32* %sv_0.056.reg2mem br label LBL_8 LBL_7: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %35 = call i32 @close(i32 %7) %36 = call i32 @close(i32 %16) store i32 %sv_0.0.ph.reload, i32* %sv_0.056.reg2mem br label LBL_8 LBL_8: %sv_0.056.reload = load i32, i32* %sv_0.056.reg2mem %37 = call i128 @__asm_movss.1(i32 %sv_0.056.reload) %38 = call i64 @FUNC(i128 %37) %39 = trunc i64 %38 to i32 %40 = call i128 @__asm_movss.1(i32 %39) %41 = call i64 @FUNC(i128 %40) %42 = trunc i64 %41 to i32 %43 = call i128 @FUNC(i128 %1, i128 %1) %44 = call i128 @FUNC(i32 %42) %45 = call i128 @FUNC(i64 4636737291354636288) %46 = call i128 @FUNC(i128 %45, i128 %44) %47 = call i32 @FUNC(i128 %46) %48 = zext i32 %47 to i64 %49 = call i64 @FUNC(i64 %48) %50 = call i64 @FUNC(i64 40) %51 = icmp eq i64 %3, %50 store i64 0, i64* %rax.0.reg2mem br i1 %51, label LBL_10, label LBL_9 LBL_9: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_10 LBL_10: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %18, { 1, 0 } uselistorder i32 %7, { 4, 0, 1, 2, 3, 5 } uselistorder i32 %6, { 1, 2, 0 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32* %sv_0.056.reg2mem, { 0, 3, 2, 1 } uselistorder i128* %0, { 1, 0 } uselistorder i32 (i32)* @close, { 2, 1, 0, 3 } uselistorder label LBL_8, { 2, 1, 0 } }
1
juliet-test-suite-c
CWE377_Insecure_Temporary_File__char_tmpnam_11-bad
CWE377_Insecure_Temporary_File__char_tmpnam_11_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = call i64 @FUNC() %1 = trunc i64 %0 to i32 %2 = icmp eq i32 %1, 0 store i64 %0, i64* %rax.0.reg2mem br i1 %2, label LBL_5, label LBL_1 LBL_1: %3 = call i8* @tmpnam(i8* null) %4 = icmp eq i8* %3, null %5 = icmp eq i1 %4, false br i1 %5, label LBL_3, label LBL_2 LBL_2: call void @exit(i32 1) unreachable LBL_3: %6 = ptrtoint i8* %3 to i64 %7 = call i64 @FUNC(i64 %6) %8 = call i32 (i8*, i32, ...) @open(i8* %3, i32 66) %9 = icmp eq i32 %8, -1 store i64 -1, i64* %rax.0.reg2mem br i1 %9, label LBL_5, label LBL_4 LBL_4: %10 = call i64 @FUNC(i64 ptrtoint ([45 x i8]* @gv_0 to i64)) %11 = call i32 @close(i32 %8) %12 = sext i32 %11 to i64 store i64 %12, i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i8* %3, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE122_Heap_Based_Buffer_Overflow__c_src_char_cat_01-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 100) %2 = icmp eq i64* %1, null %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %4 = bitcast i64* %1 to i8* %5 = call i64* @memset(i64* %1, i32 65, i32 49) %6 = ptrtoint i64* %1 to i64 %7 = add i64 %6, 49 %8 = inttoptr i64 %7 to i8* store i8 0, i8* %8, align 1 store i64 0, i64* %sv_0, align 8 %9 = bitcast i64* %sv_0 to i8* %10 = call i8* @strcat(i8* nonnull %9, i8* %4) %11 = call i64 @FUNC(i64 %6) call void @free(i64* %1) %12 = call i64 @FUNC(i64 40) %13 = icmp eq i64 %0, %12 store i64 0, i64* %rax.0.reg2mem br i1 %13, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %1, { 0, 1, 2, 4, 3 } }
0
juliet-test-suite-c
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_partial_init_12-bad
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_partial_init_12_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.3.reg2mem = alloca i64 %indvars.iv.reg2mem = alloca i64 %xmm0.38.reg2mem = alloca i128 %indvars.iv18.reg2mem = alloca i64 %indvars.iv21.reg2mem = alloca i64 %xmm0.2.reg2mem = alloca i128 %xmm0.111.reg2mem = alloca i128 %indvars.iv24.reg2mem = alloca i64 %xmm0.013.reg2mem = alloca i128 %indvars.iv27.reg2mem = alloca i64 %0 = call i64* @malloc(i32 80) %1 = icmp eq i64* %0, null %2 = icmp eq i1 %1, false br i1 %2, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %3 = ptrtoint i64* %0 to i64 %4 = call i64 @FUNC() %5 = trunc i64 %4 to i32 %6 = icmp eq i32 %5, 0 store i64 0, i64* %indvars.iv27.reg2mem store i64 0, i64* %indvars.iv24.reg2mem br i1 %6, label LBL_4, label LBL_3 LBL_3: %xmm0.013.reload = load i128, i128* %xmm0.013.reg2mem %indvars.iv27.reload = load i64, i64* %indvars.iv27.reg2mem %7 = mul i64 %indvars.iv27.reload, 8 %8 = add i64 %7, %3 %9 = call i128 @FUNC(i128 %xmm0.013.reload, i128 %xmm0.013.reload) %10 = trunc i64 %indvars.iv27.reload to i32 %11 = call i128 @FUNC(i32 %10) %12 = call i64 @FUNC(i128 %11) %13 = inttoptr i64 %8 to i64* store i64 %12, i64* %13, align 8 %indvars.iv.next28 = add nuw nsw i64 %indvars.iv27.reload, 1 %exitcond29 = icmp eq i64 %indvars.iv.next28, 5 store i64 %indvars.iv.next28, i64* %indvars.iv27.reg2mem store i128 %11, i128* %xmm0.013.reg2mem store i128 %11, i128* %xmm0.2.reg2mem br i1 %exitcond29, label LBL_5, label LBL_3 LBL_4: %xmm0.111.reload = load i128, i128* %xmm0.111.reg2mem %indvars.iv24.reload = load i64, i64* %indvars.iv24.reg2mem %14 = mul i64 %indvars.iv24.reload, 8 %15 = add i64 %14, %3 %16 = call i128 @FUNC(i128 %xmm0.111.reload, i128 %xmm0.111.reload) %17 = trunc i64 %indvars.iv24.reload to i32 %18 = call i128 @FUNC(i32 %17) %19 = call i64 @FUNC(i128 %18) %20 = inttoptr i64 %15 to i64* store i64 %19, i64* %20, align 8 %indvars.iv.next25 = add nuw nsw i64 %indvars.iv24.reload, 1 %exitcond26 = icmp eq i64 %indvars.iv.next25, 10 store i64 %indvars.iv.next25, i64* %indvars.iv24.reg2mem store i128 %18, i128* %xmm0.111.reg2mem store i128 %18, i128* %xmm0.2.reg2mem br i1 %exitcond26, label LBL_5, label LBL_4 LBL_5: %xmm0.2.reload = load i128, i128* %xmm0.2.reg2mem %21 = call i64 @FUNC() %22 = trunc i64 %21 to i32 %23 = icmp eq i32 %22, 0 store i64 0, i64* %indvars.iv21.reg2mem store i64 0, i64* %indvars.iv18.reg2mem store i128 %xmm0.2.reload, i128* %xmm0.38.reg2mem br i1 %23, label LBL_7, label LBL_6 LBL_6: %indvars.iv21.reload = load i64, i64* %indvars.iv21.reg2mem %24 = mul i64 %indvars.iv21.reload, 8 %25 = add i64 %24, %3 %26 = inttoptr i64 %25 to i64* %27 = load i64, i64* %26, align 8 %28 = call i128 @FUNC(i64 %27) %29 = call i64 @FUNC() %indvars.iv.next22 = add nuw nsw i64 %indvars.iv21.reload, 1 %exitcond23 = icmp eq i64 %indvars.iv.next22, 10 store i64 %indvars.iv.next22, i64* %indvars.iv21.reg2mem store i64 %29, i64* %rax.3.reg2mem br i1 %exitcond23, label LBL_9, label LBL_6 LBL_7: %xmm0.38.reload = load i128, i128* %xmm0.38.reg2mem %indvars.iv18.reload = load i64, i64* %indvars.iv18.reg2mem %30 = mul i64 %indvars.iv18.reload, 8 %31 = add i64 %30, %3 %32 = call i128 @FUNC(i128 %xmm0.38.reload, i128 %xmm0.38.reload) %33 = trunc i64 %indvars.iv18.reload to i32 %34 = call i128 @FUNC(i32 %33) %35 = call i64 @FUNC(i128 %34) %36 = inttoptr i64 %31 to i64* store i64 %35, i64* %36, align 8 %indvars.iv.next19 = add nuw nsw i64 %indvars.iv18.reload, 1 %exitcond20 = icmp eq i64 %indvars.iv.next19, 10 store i64 %indvars.iv.next19, i64* %indvars.iv18.reg2mem store i128 %34, i128* %xmm0.38.reg2mem store i64 0, i64* %indvars.iv.reg2mem br i1 %exitcond20, label LBL_8, label LBL_7 LBL_8: %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem %37 = mul i64 %indvars.iv.reload, 8 %38 = add i64 %37, %3 %39 = inttoptr i64 %38 to i64* %40 = load i64, i64* %39, align 8 %41 = call i128 @FUNC(i64 %40) %42 = call i64 @FUNC() %indvars.iv.next = add nuw nsw i64 %indvars.iv.reload, 1 %exitcond = icmp eq i64 %indvars.iv.next, 10 store i64 %indvars.iv.next, i64* %indvars.iv.reg2mem store i64 %42, i64* %rax.3.reg2mem br i1 %exitcond, label LBL_9, label LBL_8 LBL_9: %rax.3.reload = load i64, i64* %rax.3.reg2mem ret i64 %rax.3.reload uselistorder i128 %xmm0.38.reload, { 1, 0 } uselistorder i128 %xmm0.111.reload, { 1, 0 } uselistorder i128 %xmm0.013.reload, { 1, 0 } uselistorder i64* %0, { 1, 0 } uselistorder i64* %indvars.iv27.reg2mem, { 2, 0, 1 } uselistorder i128* %xmm0.013.reg2mem, { 1, 0 } uselistorder i64* %indvars.iv24.reg2mem, { 2, 0, 1 } uselistorder i128* %xmm0.111.reg2mem, { 1, 0 } uselistorder i128* %xmm0.2.reg2mem, { 0, 2, 1 } uselistorder i64* %indvars.iv21.reg2mem, { 2, 0, 1 } uselistorder i64* %indvars.iv18.reg2mem, { 2, 0, 1 } uselistorder i128* %xmm0.38.reg2mem, { 2, 0, 1 } uselistorder i64* %indvars.iv.reg2mem, { 2, 0, 1 } uselistorder i64* %rax.3.reg2mem, { 0, 2, 1 } uselistorder i64 ()* @printDoubleLine, { 1, 0 } uselistorder i64 10, { 3, 2, 1, 0 } uselistorder i64 ()* @globalReturnsTrueOrFalse, { 1, 0 } uselistorder label LBL_9, { 1, 0 } uselistorder label LBL_8, { 1, 0 } uselistorder label LBL_7, { 1, 0 } uselistorder label LBL_6, { 1, 0 } uselistorder label LBL_5, { 1, 0 } uselistorder label LBL_4, { 1, 0 } uselistorder label LBL_3, { 1, 0 } }
1
juliet-test-suite-c
CWE197_Numeric_Truncation_Error__int_rand_to_short_17-bad
CWE197_Numeric_Truncation_Error__int_rand_to_short_17_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = call i32 @rand() %1 = call i32 @rand() %2 = call i32 @rand() %3 = call i32 @rand() %4 = urem i32 %0, 2 %5 = icmp eq i32 %4, 0 %6 = mul i32 %2, 32768 %7 = xor i32 %3, %6 %8 = mul i32 %7, 65536 %9 = xor i32 %8, -65536 %phitmp.le = select i1 %5, i32 %9, i32 %8 %phitmp2.le = ashr exact i32 %phitmp.le, 16 %phitmp3.le = zext i32 %phitmp2.le to i64 %10 = call i64 @FUNC(i64 %phitmp3.le) ret i64 %10 uselistorder i32 %8, { 1, 0 } }
1
juliet-test-suite-c
CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_environment_04-bad
CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_environment_04_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %sv_0.04.reg2mem = alloca i8* %sv_0.05.reg2mem = alloca i8* %.reg2mem = alloca i8 %0 = call i64* @malloc(i32 100) %1 = icmp eq i64* %0, null %2 = icmp eq i1 %1, false br i1 %2, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %3 = bitcast i64* %0 to i8* store i8 0, i8* %3, align 1 %4 = call i32 @strlen(i8* %3) %5 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @gv_0, i64 0, i64 0)) %6 = icmp eq i8* %5, null br i1 %6, label LBL_4, label LBL_3 LBL_3: %7 = sext i32 %4 to i64 %8 = ptrtoint i64* %0 to i64 %9 = add i64 %7, %8 %10 = inttoptr i64 %9 to i8* %11 = sub i32 99, %4 %12 = call i8* @strncat(i8* %10, i8* nonnull %5, i32 %11) br label LBL_4 LBL_4: %13 = load i8, i8* %3, align 1 %14 = icmp eq i8 %13, 0 %15 = icmp eq i1 %14, false store i8 %13, i8* %.reg2mem store i8* %3, i8** %sv_0.05.reg2mem store i8* %3, i8** %sv_0.04.reg2mem br i1 %15, label LBL_5, label LBL_8 LBL_5: %sv_0.05.reload = load i8*, i8** %sv_0.05.reg2mem %.reload = load i8, i8* %.reg2mem %16 = icmp eq i8 %.reload, 83 %17 = icmp eq i1 %16, false br i1 %17, label LBL_7, label LBL_6 LBL_6: %18 = call i64 @FUNC(i64 ptrtoint ([17 x i8]* @gv_1 to i64)) store i8* %sv_0.05.reload, i8** %sv_0.04.reg2mem br label LBL_8 LBL_7: %19 = ptrtoint i8* %sv_0.05.reload to i64 %20 = add i64 %19, 1 %21 = inttoptr i64 %20 to i8* %22 = load i8, i8* %21, align 1 %23 = icmp eq i8 %22, 0 %24 = icmp eq i1 %23, false store i8 %22, i8* %.reg2mem store i8* %21, i8** %sv_0.05.reg2mem store i8* %21, i8** %sv_0.04.reg2mem br i1 %24, label LBL_5, label LBL_8 LBL_8: %sv_0.04.reload = load i8*, i8** %sv_0.04.reg2mem %25 = bitcast i8* %sv_0.04.reload to i64* call void @free(i64* %25) ret i64 ptrtoint (i32* @1 to i64) uselistorder i8* %sv_0.05.reload, { 1, 0 } uselistorder i8* %3, { 0, 1, 2, 4, 3 } uselistorder i64* %0, { 0, 2, 1 } uselistorder i8* %.reg2mem, { 2, 0, 1 } uselistorder i8** %sv_0.05.reg2mem, { 2, 0, 1 } uselistorder i8** %sv_0.04.reg2mem, { 0, 1, 3, 2 } uselistorder i8 0, { 1, 0, 2, 3 } uselistorder label LBL_8, { 0, 2, 1 } uselistorder label LBL_5, { 1, 0 } }
1
juliet-test-suite-c
CWE127_Buffer_Underread__malloc_char_ncpy_03-bad
CWE127_Buffer_Underread__malloc_char_ncpy_03_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 100) %2 = icmp eq i64* %1, null %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %4 = ptrtoint i64* %1 to i64 %5 = call i64* @memset(i64* %1, i32 65, i32 99) %6 = add i64 %4, 99 %7 = inttoptr i64 %6 to i8* store i8 0, i8* %7, align 1 %8 = add i64 %4, -8 %9 = inttoptr i64 %8 to i8* %10 = call i64* @memset(i64* nonnull %sv_0, i32 67, i32 99) %11 = bitcast i64* %sv_0 to i8* %12 = call i32 @strlen(i8* nonnull %11) %13 = call i8* @strncpy(i8* nonnull %11, i8* %9, i32 %12) %14 = call i64 @FUNC(i64* nonnull %sv_0) %15 = call i64 @FUNC(i64 40) %16 = icmp eq i64 %0, %15 store i64 0, i64* %rax.0.reg2mem br i1 %16, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %1, { 0, 2, 1 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE400_Resource_Exhaustion__listen_socket_sleep_08-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.1.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 store i32 -1, i32* %sv_0.1.reg2mem br i1 %3, label LBL_9, label LBL_1 LBL_1: %4 = call i32 @socket(i32 2, i32 1, i32 6) %5 = icmp eq i32 %4, -1 store i32 -1, i32* %sv_0.1.reg2mem br i1 %5, label LBL_9, label LBL_2 LBL_2: %6 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %7 = call i16 @htons(i16 27015) %8 = bitcast i64* %sv_2 to %sockaddr* %9 = call i32 @bind(i32 %4, %sockaddr* nonnull %8, i32 16) %10 = icmp eq i32 %9, -1 br i1 %10, label LBL_7, label LBL_3 LBL_3: %11 = call i32 @listen(i32 %4, i32 5) %12 = icmp eq i32 %11, -1 br i1 %12, label LBL_7, label LBL_4 LBL_4: %13 = call i32 @accept(i32 %4, %sockaddr* null, i32* null) %14 = icmp eq i32 %13, -1 br i1 %14, label LBL_7, label LBL_5 LBL_5: %15 = call i32 @recv(i32 %13, i64* nonnull %sv_1, i32 13, i32 0) %16 = add i32 %15, 1 %17 = icmp ult i32 %16, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %17, label LBL_8, label LBL_6 LBL_6: %18 = ptrtoint i64* %sv_3 to i64 %19 = sext i32 %15 to i64 %20 = add i64 %18, -22 %21 = add i64 %20, %19 %22 = inttoptr i64 %21 to i8* store i8 0, i8* %22, align 1 %23 = bitcast i64* %sv_1 to i8* %24 = call i32 @atoi(i8* nonnull %23) store i32 %24, i32* %sv_0.0.ph.reg2mem br label LBL_8 LBL_7: %25 = call i32 @close(i32 %4) store i32 -1, i32* %sv_0.1.reg2mem br label LBL_9 LBL_8: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %26 = call i32 @close(i32 %4) %27 = call i32 @close(i32 %13) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.reg2mem br label LBL_9 LBL_9: %28 = call i64 @FUNC() %29 = trunc i64 %28 to i32 %30 = icmp eq i32 %29, 0 br i1 %30, label LBL_13, label LBL_10 LBL_10: %sv_0.1.reload = load i32, i32* %sv_0.1.reg2mem %31 = icmp slt i32 %sv_0.1.reload, 1 %32 = icmp sgt i32 %sv_0.1.reload, ptrtoint (i1* @gv_0 to i32) %or.cond4 = or i1 %31, %32 br i1 %or.cond4, label LBL_12, label LBL_11 LBL_11: %33 = call i32 @usleep(i32 %sv_0.1.reload) %34 = call i64 @FUNC(i64 ptrtoint ([14 x i8]* @gv_1 to i64)) br label LBL_13 LBL_12: %35 = call i64 @FUNC(i64 ptrtoint ([20 x i8]* @gv_2 to i64)) br label LBL_13 LBL_13: %36 = call i64 @FUNC(i64 40) %37 = icmp eq i64 %0, %36 store i64 0, i64* %rax.0.reg2mem br i1 %37, label LBL_15, label LBL_14 LBL_14: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_15 LBL_15: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %15, { 1, 0 } uselistorder i32 %4, { 4, 0, 1, 2, 3, 5 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32* %sv_0.1.reg2mem, { 0, 3, 2, 1, 4 } uselistorder i32 (i32)* @close, { 5, 4, 0, 3, 2, 1, 6 } uselistorder i32 (i8*)* @atoi, { 1, 0, 2 } uselistorder i32 (i32, i64*, i32, i32)* @recv, { 1, 0, 2 } uselistorder i32 (i32, %sockaddr*, i32*)* @accept, { 1, 0, 2 } uselistorder i32 (i32, i32)* @listen, { 1, 0, 2 } uselistorder i32 (i32, %sockaddr*, i32)* @bind, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } uselistorder label LBL_9, { 2, 1, 0, 3 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__int_fscanf_square_31-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i32, align 4 %0 = call i64 @FUNC(i64 40) store i32 0, i32* %sv_0, align 4 %1 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %2 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i32* nonnull %sv_0) %3 = load i32, i32* %sv_0, align 4 %.off = add i32 %3, 46339 %4 = icmp ugt i32 %.off, 92678 br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = mul i32 %3, %3 %6 = zext i32 %5 to i64 %7 = call i64 @FUNC(i64 %6) br label LBL_3 LBL_2: %8 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_2 to i64)) br label LBL_3 LBL_3: %9 = call i64 @FUNC(i64 40) %10 = icmp eq i64 %0, %9 store i64 0, i64* %rax.0.reg2mem br i1 %10, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %3, { 2, 1, 0 } uselistorder i32* %sv_0, { 1, 0, 2 } uselistorder i64 (i64)* @printIntLine, { 1, 0 } }
0
juliet-test-suite-c
CWE369_Divide_by_Zero__int_zero_modulo_08-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = call i64 @FUNC() %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 store i64 %1, i64* %rax.0.reg2mem br i1 %3, label LBL_4, label LBL_1 LBL_1: %4 = trunc i64 %0 to i32 %5 = icmp eq i32 %4, 0 %6 = icmp eq i1 %5, false br i1 %6, label LBL_3, label LBL_2 LBL_2: %7 = call i64 @FUNC(i64 100) store i64 %7, i64* %rax.0.reg2mem br label LBL_4 LBL_3: %8 = call i64 @FUNC(i64 ptrtoint ([38 x i8]* @gv_0 to i64)) store i64 %8, i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %rax.0.reg2mem, { 0, 2, 1, 3 } }
0
juliet-test-suite-c
CWE606_Unchecked_Loop_Condition__char_listen_socket_05-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.lcssa.reg2mem = alloca i64 %storemerge8.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 0, i64* %sv_2, align 8 %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 0 br i1 %2, label LBL_19, label LBL_1 LBL_1: %3 = bitcast i64* %sv_2 to i8* %4 = call i32 @strlen(i8* nonnull %3) %5 = call i32 @socket(i32 2, i32 1, i32 6) %6 = icmp eq i32 %5, -1 br i1 %6, label LBL_12, label LBL_2 LBL_2: %7 = call i64* @memset(i64* nonnull %sv_1, i32 0, i32 16) store i64 2, i64* %sv_1, align 8 %8 = call i16 @htons(i16 27015) %9 = bitcast i64* %sv_1 to %sockaddr* %10 = call i32 @bind(i32 %5, %sockaddr* nonnull %9, i32 16) %11 = icmp eq i32 %10, -1 br i1 %11, label LBL_10, label LBL_3 LBL_3: %12 = call i32 @listen(i32 %5, i32 5) %13 = icmp eq i32 %12, -1 br i1 %13, label LBL_10, label LBL_4 LBL_4: %14 = call i32 @accept(i32 %5, %sockaddr* null, i32* null) %15 = icmp eq i32 %14, -1 br i1 %15, label LBL_10, label LBL_5 LBL_5: %16 = sext i32 %4 to i64 %17 = ptrtoint i64* %sv_2 to i64 %18 = add i64 %16, %17 %19 = inttoptr i64 %18 to i64* %20 = sub i32 99, %4 %21 = call i32 @recv(i32 %14, i64* %19, i32 %20, i32 0) %22 = add i32 %21, 1 %23 = icmp ult i32 %22, 2 br i1 %23, label LBL_11, label LBL_6 LBL_6: %24 = sext i32 %21 to i64 %25 = add i64 %18, %24 %26 = inttoptr i64 %25 to i8* store i8 0, i8* %26, align 1 %27 = call i8* @strchr(i8* nonnull %3, i32 13) %28 = icmp eq i8* %27, null br i1 %28, label LBL_8, label LBL_7 LBL_7: store i8 0, i8* %27, align 1 br label LBL_8 LBL_8: %29 = call i8* @strchr(i8* nonnull %3, i32 10) %30 = icmp eq i8* %29, null br i1 %30, label LBL_11, label LBL_9 LBL_9: store i8 0, i8* %29, align 1 br label LBL_11 LBL_10: %31 = call i32 @close(i32 %5) br label LBL_12 LBL_11: %32 = call i32 @close(i32 %5) %33 = call i32 @close(i32 %14) br label LBL_12 LBL_12: %.pr = load i32, i32* @gv_0, align 4 %34 = icmp eq i32 %.pr, 0 br i1 %34, label LBL_19, label LBL_13 LBL_13: %35 = call i32 (i8*, i8*, ...) @sscanf(i8* nonnull %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i64* nonnull %sv_3) %36 = icmp eq i32 %35, 1 %37 = icmp eq i1 %36, false br i1 %37, label LBL_19, label LBL_14 LBL_14: %38 = load i64, i64* %sv_3, align 8 %39 = trunc i64 %38 to i32 %40 = icmp sgt i32 %39, 9999 br i1 %40, label LBL_19, label LBL_15 LBL_15: %41 = and i64 %38, 4294967295 %42 = icmp eq i64 %41, 0 store i32 0, i32* %storemerge8.reg2mem store i64 0, i64* %sv_0.0.lcssa.reg2mem br i1 %42, label LBL_18, label LBL_16 LBL_16: %storemerge8.reload = load i32, i32* %storemerge8.reg2mem %43 = add i32 %storemerge8.reload, 1 %44 = sext i32 %43 to i64 %45 = icmp sgt i64 %41, %44 store i32 %43, i32* %storemerge8.reg2mem br i1 %45, label LBL_16, label LBL_17 LBL_17: %phitmp = zext i32 %43 to i64 store i64 %phitmp, i64* %sv_0.0.lcssa.reg2mem br label LBL_18 LBL_18: %sv_0.0.lcssa.reload = load i64, i64* %sv_0.0.lcssa.reg2mem %46 = call i64 @FUNC(i64 %sv_0.0.lcssa.reload) br label LBL_19 LBL_19: %47 = call i64 @FUNC(i64 40) %48 = icmp eq i64 %0, %47 store i64 0, i64* %rax.0.reg2mem br i1 %48, label LBL_21, label LBL_20 LBL_20: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_21 LBL_21: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %43, { 1, 0, 2 } uselistorder i32 %21, { 1, 0 } uselistorder i32 %5, { 4, 0, 1, 2, 3, 5 } uselistorder i8* %3, { 3, 0, 1, 2 } uselistorder i64* %sv_3, { 1, 0 } uselistorder i64* %sv_1, { 0, 2, 1 } uselistorder i32* %storemerge8.reg2mem, { 2, 0, 1 } uselistorder i64* %sv_0.0.lcssa.reg2mem, { 0, 2, 1 } uselistorder i32 (i32)* @close, { 5, 4, 0, 3, 2, 1, 6 } uselistorder i8* (i8*, i32)* @strchr, { 3, 2, 1, 0, 4 } uselistorder i32 (i32, i64*, i32, i32)* @recv, { 1, 0, 2 } uselistorder i32 (i32, %sockaddr*, i32*)* @accept, { 1, 0, 2 } uselistorder i32 (i32, i32)* @listen, { 1, 0, 2 } uselistorder i32 (i32, %sockaddr*, i32)* @bind, { 1, 0, 2 } uselistorder i16 (i16)* @htons, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } uselistorder i32 (i32, i32, i32)* @socket, { 1, 0, 2 } uselistorder i32 (i8*)* @strlen, { 1, 0, 2 } uselistorder label LBL_19, { 1, 2, 3, 4, 0 } uselistorder label LBL_18, { 1, 0 } uselistorder label LBL_16, { 1, 0 } uselistorder label LBL_12, { 2, 1, 0 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_loop_08-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i64 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 br i1 %3, label LBL_2, label LBL_1 LBL_1: %4 = ptrtoint i64* %sv_2 to i64 %5 = bitcast i64* %sv_2 to i8* store i8 0, i8* %5, align 8 store i64 %4, i64* %sv_0.0.reg2mem br label LBL_2 LBL_2: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem store i64 4702111234474983745, i64* %sv_1, align 8 %6 = bitcast i64* %sv_1 to i8* %7 = call i32 @strlen(i8* nonnull %6) %8 = sext i32 %7 to i64 %9 = add nsw i64 %8, 1 %10 = icmp eq i64 %9, 0 br i1 %10, label LBL_5, label LBL_3 LBL_3: %11 = ptrtoint i64* %sv_1 to i64 store i64 0, i64* %storemerge1.reg2mem br label LBL_4 LBL_4: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %12 = add i64 %storemerge1.reload, %sv_0.0.reload %13 = add i64 %storemerge1.reload, %11 %14 = inttoptr i64 %13 to i8* %15 = load i8, i8* %14, align 1 %16 = inttoptr i64 %12 to i8* store i8 %15, i8* %16, align 1 %17 = add nuw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %17, %9 store i64 %17, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_5, label LBL_4 LBL_5: %18 = call i64 @FUNC(i64 %sv_0.0.reload) %19 = call i64 @FUNC(i64 40) %20 = icmp eq i64 %0, %19 store i64 0, i64* %rax.0.reg2mem br i1 %20, label LBL_7, label LBL_6 LBL_6: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %storemerge1.reload, { 0, 2, 1 } uselistorder i64* %sv_1, { 1, 0, 2 } uselistorder i64* %storemerge1.reg2mem, { 1, 0, 2 } uselistorder i32 (i8*)* @strlen, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE590_Free_Memory_Not_on_Heap__free_int64_t_alloca_32-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i64 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 ptrtoint (i32* @gv_0 to i32)) %2 = ptrtoint i64* %1 to i64 %3 = icmp eq i64* %1, null %4 = icmp eq i1 %3, false store i64 0, i64* %storemerge1.reg2mem br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_1 to i64)) call void @exit(i32 1) unreachable LBL_2: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %6 = mul i64 %storemerge1.reload, 8 %7 = add i64 %6, %2 %8 = inttoptr i64 %7 to i64* store i64 5, i64* %8, align 8 %9 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %9, 100 store i64 %9, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_3, label LBL_2 LBL_3: %10 = load i64, i64* %1, align 8 %11 = call i64 @FUNC(i64 %10) call void @free(i64* %1) %12 = call i64 @FUNC(i64 40) %13 = icmp eq i64 %0, %12 store i64 0, i64* %rax.0.reg2mem br i1 %13, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %storemerge1.reg2mem, { 2, 0, 1 } uselistorder label LBL_2, { 1, 0 } }
0
juliet-test-suite-c
CWE400_Resource_Exhaustion__rand_sleep_08-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i32 %0 = call i64 @FUNC() %1 = trunc i64 %0 to i32 %2 = icmp eq i32 %1, 0 store i32 -1, i32* %sv_0.0.reg2mem br i1 %2, label LBL_2, label LBL_1 LBL_1: %3 = call i32 @rand() %4 = urem i32 %3, 2 %5 = icmp eq i32 %4, 0 %6 = call i32 @rand() %7 = mul i32 %6, 1073741824 %8 = call i32 @rand() %9 = mul i32 %8, 32768 %10 = xor i32 %9, %7 %11 = call i32 @rand() %12 = xor i32 %10, %11 %13 = sext i1 %5 to i32 %storemerge.in = xor i32 %12, %13 store i32 %storemerge.in, i32* %sv_0.0.reg2mem br label LBL_2 LBL_2: %14 = call i64 @FUNC() %15 = trunc i64 %14 to i32 %16 = icmp eq i32 %15, 0 br i1 %16, label LBL_4, label LBL_3 LBL_3: %17 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_0 to i64)) store i64 %17, i64* %rax.0.reg2mem br label LBL_7 LBL_4: %sv_0.0.reload = load i32, i32* %sv_0.0.reg2mem %18 = icmp slt i32 %sv_0.0.reload, 1 %19 = icmp sgt i32 %sv_0.0.reload, ptrtoint (i1* @gv_1 to i32) %or.cond = or i1 %18, %19 br i1 %or.cond, label LBL_6, label LBL_5 LBL_5: %20 = call i32 @usleep(i32 %sv_0.0.reload) %21 = call i64 @FUNC(i64 ptrtoint ([14 x i8]* @gv_2 to i64)) store i64 %21, i64* %rax.0.reg2mem br label LBL_7 LBL_6: %22 = call i64 @FUNC(i64 ptrtoint ([20 x i8]* @gv_3 to i64)) store i64 %22, i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %rax.0.reg2mem, { 0, 3, 2, 1 } }
0
juliet-test-suite-c
CWE127_Buffer_Underread__CWE839_listen_socket_15-bad
CWE127_Buffer_Underread__CWE839_listen_socket_15_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0479.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = ptrtoint i64* %sv_3 to i64 %1 = call i64 @FUNC(i64 40) %2 = call i32 @socket(i32 2, i32 1, i32 6) %3 = icmp eq i32 %2, -1 br i1 %3, label LBL_7, label LBL_1 LBL_1: %4 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %5 = call i16 @htons(i16 27015) %6 = bitcast i64* %sv_2 to %sockaddr* %7 = call i32 @bind(i32 %2, %sockaddr* nonnull %6, i32 16) %8 = icmp eq i32 %7, -1 br i1 %8, label LBL_6, label LBL_2 LBL_2: %9 = call i32 @listen(i32 %2, i32 5) %10 = icmp eq i32 %9, -1 br i1 %10, label LBL_6, label LBL_3 LBL_3: %11 = call i32 @accept(i32 %2, %sockaddr* null, i32* null) %12 = icmp eq i32 %11, -1 br i1 %12, label LBL_6, label LBL_4 LBL_4: %13 = call i32 @recv(i32 %11, i64* nonnull %sv_1, i32 13, i32 0) %14 = add i32 %13, 1 %15 = icmp ult i32 %14, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %15, label LBL_8, label LBL_5 LBL_5: %16 = sext i32 %13 to i64 %17 = add i64 %0, -22 %18 = add i64 %17, %16 %19 = inttoptr i64 %18 to i8* store i8 0, i8* %19, align 1 %20 = bitcast i64* %sv_1 to i8* %21 = call i32 @atoi(i8* nonnull %20) store i32 %21, i32* %sv_0.0.ph.reg2mem br label LBL_8 LBL_6: %22 = call i32 @close(i32 %2) br label LBL_7 LBL_7: store i64 0, i64* %sv_2, align 8 store i32 -1, i32* %sv_0.0479.reg2mem br label LBL_9 LBL_8: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %23 = call i32 @close(i32 %2) %24 = call i32 @close(i32 %11) store i64 0, i64* %sv_2, align 8 %25 = icmp sgt i32 %sv_0.0.ph.reload, 9 store i32 %sv_0.0.ph.reload, i32* %sv_0.0479.reg2mem br i1 %25, label LBL_10, label LBL_9 LBL_9: %sv_0.0479.reload = load i32, i32* %sv_0.0479.reg2mem %26 = sext i32 %sv_0.0479.reload to i64 %27 = mul i64 %26, 4 %28 = add i64 %0, -64 %29 = add i64 %28, %27 %30 = inttoptr i64 %29 to i32* %31 = load i32, i32* %30, align 4 %32 = zext i32 %31 to i64 %33 = call i64 @FUNC(i64 %32) br label LBL_11 LBL_10: %34 = call i64 @FUNC(i64 ptrtoint ([31 x i8]* @gv_0 to i64)) br label LBL_11 LBL_11: %35 = call i64 @FUNC(i64 40) %36 = icmp eq i64 %1, %35 store i64 0, i64* %rax.0.reg2mem br i1 %36, label LBL_13, label LBL_12 LBL_12: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_13 LBL_13: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %13, { 1, 0 } uselistorder i32 %2, { 4, 0, 1, 2, 3, 5 } uselistorder i64 %0, { 1, 0 } uselistorder i64* %sv_2, { 3, 0, 1, 4, 2 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32 (i32)* @close, { 1, 2, 0, 3 } uselistorder label LBL_9, { 1, 0 } uselistorder label LBL_8, { 1, 0 } }
1
juliet-test-suite-c
CWE681_Incorrect_Conversion_Between_Numeric_Types__doubleNaN2int_07-bad
CWE681_Incorrect_Conversion_Between_Numeric_Types__doubleNaN2int_07_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = alloca i128 %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i64 %1 = load i128, i128* %0 %sv_1 = alloca i64, align 8 %2 = call i64 @FUNC(i64 40) %3 = load i32, i32* @gv_0, align 4 %4 = icmp eq i32 %3, 5 %5 = icmp eq i1 %4, false br i1 %5, label LBL_5, label LBL_1 LBL_1: %6 = call i128 @FUNC(i128 %1, i128 %1) %7 = call i64 @FUNC(i128 %6) %8 = load %_IO_FILE*, %_IO_FILE** @gv_1, align 8 %9 = bitcast i64* %sv_1 to i8* %10 = call i8* @fgets(i8* nonnull %9, i32 256, %_IO_FILE* %8) %11 = icmp eq i8* %10, null br i1 %11, label LBL_3, label LBL_2 LBL_2: %12 = call double @atof(i8* nonnull %9) %13 = fptrunc double %12 to float %14 = bitcast float %13 to i32 %15 = sext i32 %14 to i128 %16 = call i64 @FUNC(i128 %15) store i64 %16, i64* %sv_0.0.reg2mem br label LBL_4 LBL_3: %17 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_2 to i64)) store i64 %7, i64* %sv_0.0.reg2mem br label LBL_4 LBL_4: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem %18 = call i128 @__asm_movq.1(i64 %sv_0.0.reload) %19 = trunc i128 %18 to i64 %20 = bitcast i64 %19 to double %21 = call double @sqrt(double %20) %22 = fptrunc double %21 to float %23 = bitcast float %22 to i32 %24 = sext i32 %23 to i128 %25 = call i32 @FUNC(i128 %24) %26 = zext i32 %25 to i64 %27 = call i64 @FUNC(i64 %26) br label LBL_5 LBL_5: %28 = call i64 @FUNC(i64 40) %29 = icmp eq i64 %2, %28 store i64 0, i64* %rax.0.reg2mem br i1 %29, label LBL_7, label LBL_6 LBL_6: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %sv_0.0.reg2mem, { 0, 2, 1 } uselistorder %_IO_FILE** @gv_1, { 1, 0 } }
1
juliet-test-suite-c
CWE191_Integer_Underflow__unsigned_int_rand_postdec_13-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = load i32, i32* inttoptr (i64 8420 to i32*), align 4 %1 = icmp eq i32 %0, 5 %2 = icmp eq i1 %1, false br i1 %2, label LBL_3, label LBL_1 LBL_1: %3 = call i32 @rand() %4 = urem i32 %3, 2 %5 = icmp eq i32 %4, 0 %6 = call i32 @rand() %7 = mul i32 %6, 1073741824 %8 = call i32 @rand() %9 = mul i32 %8, 32768 %10 = xor i32 %9, %7 %11 = call i32 @rand() %12 = xor i32 %10, %11 %13 = sext i1 %5 to i32 %storemerge.in = xor i32 %12, %13 %14 = icmp eq i32 %storemerge.in, 0 br i1 %14, label LBL_3, label LBL_2 LBL_2: %15 = add i32 %storemerge.in, -1 %16 = zext i32 %15 to i64 %17 = call i64 @FUNC(i64 %16) store i64 %17, i64* %rax.0.reg2mem br label LBL_4 LBL_3: %18 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_0 to i64)) store i64 %18, i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %storemerge.in, { 1, 0 } uselistorder i64* %rax.0.reg2mem, { 0, 2, 1 } uselistorder label LBL_3, { 1, 0 } }
0
juliet-test-suite-c
CWE126_Buffer_Overread__char_declare_loop_05-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i64 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @memset(i64* nonnull %sv_3, i32 65, i32 49) %2 = call i64* @memset(i64* nonnull %sv_2, i32 65, i32 99) %3 = load i32, i32* @gv_0, align 4 %4 = icmp eq i32 %3, 0 br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_1 to i64)) br label LBL_3 LBL_2: %6 = ptrtoint i64* %sv_2 to i64 store i64 %6, i64* %sv_0.0.reg2mem br label LBL_3 LBL_3: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem %7 = call i64* @memset(i64* nonnull %sv_1, i32 67, i32 99) %8 = bitcast i64* %sv_1 to i8* %9 = call i32 @strlen(i8* nonnull %8) %10 = sext i32 %9 to i64 %11 = icmp eq i32 %9, 0 %.pre = ptrtoint i64* %sv_1 to i64 store i64 0, i64* %storemerge1.reg2mem br i1 %11, label LBL_5, label LBL_4 LBL_4: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %12 = add i64 %storemerge1.reload, %sv_0.0.reload %13 = inttoptr i64 %12 to i8* %14 = load i8, i8* %13, align 1 %15 = add i64 %storemerge1.reload, %.pre %16 = inttoptr i64 %15 to i8* store i8 %14, i8* %16, align 1 %17 = add nuw i64 %storemerge1.reload, 1 %18 = icmp ult i64 %17, %10 store i64 %17, i64* %storemerge1.reg2mem br i1 %18, label LBL_4, label LBL_5 LBL_5: %19 = call i64 @FUNC(i64 %.pre) %20 = call i64 @FUNC(i64 40) %21 = icmp eq i64 %0, %20 store i64 0, i64* %rax.0.reg2mem br i1 %21, label LBL_7, label LBL_6 LBL_6: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %storemerge1.reload, { 0, 2, 1 } uselistorder i64 %.pre, { 1, 0 } uselistorder i64* %sv_2, { 1, 0 } uselistorder i64* %storemerge1.reg2mem, { 2, 0, 1 } uselistorder label LBL_4, { 1, 0 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__short_rand_postinc_08-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i32 %0 = call i64 @FUNC() %1 = trunc i64 %0 to i32 %2 = icmp eq i32 %1, 0 store i32 0, i32* %sv_0.0.reg2mem br i1 %2, label LBL_2, label LBL_1 LBL_1: %3 = call i32 @rand() %4 = urem i32 %3, 2 %5 = icmp eq i32 %4, 0 %6 = call i32 @rand() %7 = call i32 @rand() %8 = mul i32 %7, 32768 %9 = call i32 @rand() %10 = xor i32 %9, %8 %11 = sext i1 %5 to i32 %storemerge.in = xor i32 %10, %11 %sext = mul i32 %storemerge.in, 65536 %12 = ashr exact i32 %sext, 16 store i32 %12, i32* %sv_0.0.reg2mem br label LBL_2 LBL_2: %13 = call i64 @FUNC() %14 = trunc i64 %13 to i32 %15 = icmp eq i32 %14, 0 store i64 %13, i64* %rax.0.reg2mem br i1 %15, label LBL_6, label LBL_3 LBL_3: %sv_0.0.reload = load i32, i32* %sv_0.0.reg2mem %16 = trunc i32 %sv_0.0.reload to i16 %17 = icmp eq i16 %16, 32767 br i1 %17, label LBL_5, label LBL_4 LBL_4: %18 = mul i32 %sv_0.0.reload, 65536 %sext2 = add i32 %18, 65536 %19 = ashr exact i32 %sext2, 16 %20 = zext i32 %19 to i64 %21 = call i64 @FUNC(i64 %20) store i64 %21, i64* %rax.0.reg2mem br label LBL_6 LBL_5: %22 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_0 to i64)) store i64 %22, i64* %rax.0.reg2mem br label LBL_6 LBL_6: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %sv_0.0.reload, { 1, 0 } uselistorder i64* %rax.0.reg2mem, { 0, 2, 1, 3 } uselistorder i32 65536, { 4, 0, 1, 5, 2, 3 } }
0
juliet-test-suite-c
CWE789_Uncontrolled_Mem_Alloc__malloc_char_connect_socket_09-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i32 @socket(i32 2, i32 1, i32 6) %2 = icmp eq i32 %1, -1 br i1 %2, label LBL_8, label LBL_1 LBL_1: %3 = call i64* @memset(i64* nonnull %sv_1, i32 0, i32 16) store i64 2, i64* %sv_1, align 8 %4 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @gv_0, i64 0, i64 0)) %5 = call i16 @htons(i16 27015) %6 = bitcast i64* %sv_1 to %sockaddr* %7 = call i32 @connect(i32 %1, %sockaddr* nonnull %6, i32 16) %8 = icmp eq i32 %7, -1 br i1 %8, label LBL_3, label LBL_2 LBL_2: %9 = call i32 @recv(i32 %1, i64* nonnull %sv_0, i32 25, i32 0) %10 = add i32 %9, 1 %11 = icmp ult i32 %10, 2 br i1 %11, label LBL_3, label LBL_4 LBL_3: %12 = call i32 @close(i32 %1) br label LBL_8 LBL_4: %13 = ptrtoint i64* %sv_2 to i64 %14 = sext i32 %9 to i64 %15 = add i64 %13, -48 %16 = add i64 %15, %14 %17 = inttoptr i64 %16 to i8* store i8 0, i8* %17, align 1 %18 = bitcast i64* %sv_0 to i8* %19 = call i32 @strtoul(i8* nonnull %18, i8** null, i32 0) %20 = call i32 @close(i32 %1) %sv_3.0.off = add i32 %19, -6 %21 = icmp ult i32 %sv_3.0.off, 94 br i1 %21, label LBL_5, label LBL_8 LBL_5: %22 = call i64* @malloc(i32 %19) %23 = icmp eq i64* %22, null %24 = icmp eq i1 %23, false br i1 %24, label LBL_7, label LBL_6 LBL_6: call void @exit(i32 -1) unreachable LBL_7: %25 = ptrtoint i64* %22 to i64 %26 = bitcast i64* %22 to i32* store i32 1819043176, i32* %26, align 4 %27 = add i64 %25, 4 %28 = inttoptr i64 %27 to i16* store i16 111, i16* %28, align 2 %29 = call i64 @FUNC(i64 %25) call void @free(i64* %22) br label LBL_9 LBL_8: %30 = call i64 @FUNC(i64 ptrtoint ([64 x i8]* @gv_1 to i64)) br label LBL_9 LBL_9: %31 = call i64 @FUNC(i64 40) %32 = icmp eq i64 %0, %31 store i64 0, i64* %rax.0.reg2mem br i1 %32, label LBL_11, label LBL_10 LBL_10: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_11 LBL_11: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %22, { 0, 1, 3, 2 } uselistorder i32 %19, { 1, 0 } uselistorder i32 %9, { 1, 0 } uselistorder i32 %1, { 3, 0, 1, 2, 4 } uselistorder i64* %sv_1, { 0, 2, 1 } uselistorder i32 (i8*, i8**, i32)* @strtoul, { 1, 0, 2 } uselistorder i32 (i32)* @close, { 3, 0, 2, 1, 4 } uselistorder i32 (i32, i64*, i32, i32)* @recv, { 1, 0, 2 } uselistorder i16 (i16)* @htons, { 1, 0, 2 } uselistorder i32 (i8*)* @inet_addr, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } uselistorder label LBL_8, { 2, 1, 0 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE193_char_alloca_memmove_05-bad
CWE121_Stack_Based_Buffer_Overflow__CWE193_char_alloca_memmove_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 0 br i1 %2, label LBL_2, label LBL_1 LBL_1: %3 = ptrtoint i64* %sv_1 to i64 %4 = add i64 %3, -17 %5 = and i64 %4, -16 store i64 %5, i64* %sv_1, align 8 %6 = inttoptr i64 %5 to i8* store i8 0, i8* %6, align 16 br label LBL_2 LBL_2: store i64 4702111234474983745, i64* %sv_0, align 8 %7 = bitcast i64* %sv_0 to i8* %8 = call i32 @strlen(i8* nonnull %7) %9 = add i32 %8, 1 %10 = load i64, i64* %sv_1, align 8 %11 = inttoptr i64 %10 to i64* %12 = call i64* @memmove(i64* %11, i64* nonnull %sv_0, i32 %9) %13 = load i64, i64* %sv_1, align 8 %14 = call i64 @FUNC(i64 %13) %15 = call i64 @FUNC(i64 40) %16 = icmp eq i64 %0, %15 store i64 0, i64* %rax.0.reg2mem br i1 %16, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %5, { 1, 0 } }
1
juliet-test-suite-c
CWE127_Buffer_Underread__malloc_char_loop_13-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i64 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* inttoptr (i64 8360 to i32*), align 8 %2 = icmp eq i32 %1, 5 br i1 %2, label LBL_2, label LBL_1 LBL_1: %3 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_0 to i64)) store i64 0, i64* %sv_0.0.reg2mem br label LBL_5 LBL_2: %4 = call i64* @malloc(i32 100) %5 = icmp eq i64* %4, null %6 = icmp eq i1 %5, false br i1 %6, label LBL_4, label LBL_3 LBL_3: call void @exit(i32 -1) unreachable LBL_4: %7 = ptrtoint i64* %4 to i64 %8 = call i64* @memset(i64* %4, i32 65, i32 99) %9 = add i64 %7, 99 %10 = inttoptr i64 %9 to i8* store i8 0, i8* %10, align 1 store i64 %7, i64* %sv_0.0.reg2mem br label LBL_5 LBL_5: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem %11 = call i64* @memset(i64* nonnull %sv_1, i32 67, i32 99) %12 = ptrtoint i64* %sv_1 to i64 store i64 0, i64* %storemerge1.reg2mem br label LBL_6 LBL_6: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %13 = add i64 %storemerge1.reload, %sv_0.0.reload %14 = inttoptr i64 %13 to i8* %15 = load i8, i8* %14, align 1 %16 = add i64 %storemerge1.reload, %12 %17 = inttoptr i64 %16 to i8* store i8 %15, i8* %17, align 1 %18 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %18, 100 store i64 %18, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_7, label LBL_6 LBL_7: %19 = call i64 @FUNC(i64 %12) %20 = call i64 @FUNC(i64 40) %21 = icmp eq i64 %0, %20 store i64 0, i64* %rax.0.reg2mem br i1 %21, label LBL_9, label LBL_8 LBL_8: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_9 LBL_9: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %storemerge1.reload, { 0, 2, 1 } uselistorder i64 %12, { 1, 0 } uselistorder i64* %4, { 0, 2, 1 } uselistorder i64* %sv_1, { 1, 0 } uselistorder i64* %sv_0.0.reg2mem, { 0, 2, 1 } uselistorder i64* %storemerge1.reg2mem, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE131_memmove_12-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = ptrtoint i64* %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = call i64 @FUNC() %storemerge.in = add i64 %0, -33 %storemerge = and i64 %storemerge.in, -16 store i64 0, i64* %sv_0, align 8 %3 = inttoptr i64 %storemerge to i64* %4 = call i64* @memmove(i64* %3, i64* nonnull %sv_0, i32 40) %5 = inttoptr i64 %storemerge to i32* %6 = load i32, i32* %5, align 16 %7 = zext i32 %6 to i64 %8 = call i64 @FUNC(i64 %7) %9 = call i64 @FUNC(i64 40) %10 = icmp eq i64 %1, %9 store i64 0, i64* %rax.0.reg2mem br i1 %10, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %storemerge, { 1, 0 } }
0
juliet-test-suite-c
CWE690_NULL_Deref_From_Return__int64_t_malloc_07-bad
CWE690_NULL_Deref_From_Return__int64_t_malloc_07_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = call i64* @malloc(i32 8) %1 = load i32, i32* @gv_0, align 4 %2 = zext i32 %1 to i64 %3 = icmp eq i32 %1, 5 %4 = icmp eq i1 %3, false store i64 %2, i64* %rax.0.reg2mem br i1 %4, label LBL_2, label LBL_1 LBL_1: store i64 5, i64* %0, align 8 %5 = call i64 @FUNC(i64 5) call void @free(i64* %0) store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
1
juliet-test-suite-c
CWE191_Integer_Underflow__int64_t_fscanf_sub_12-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = call i64 @FUNC() %1 = call i64 @FUNC() %2 = call i64 @FUNC(i64 -3) ret i64 %2 uselistorder i64 (i64)* @printLongLongLine, { 2, 1, 0 } uselistorder i64 ()* @globalReturnsTrueOrFalse, { 3, 2, 1, 0 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__int_fgets_add_07-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false store i32 0, i32* %sv_0.0.reg2mem br i1 %3, label LBL_4, label LBL_1 LBL_1: store i64 0, i64* %sv_1, align 8 %4 = load %_IO_FILE*, %_IO_FILE** @gv_1, align 8 %5 = bitcast i64* %sv_1 to i8* %6 = call i8* @fgets(i8* nonnull %5, i32 14, %_IO_FILE* %4) %7 = icmp eq i8* %6, null br i1 %7, label LBL_3, label LBL_2 LBL_2: %8 = call i32 @atoi(i8* nonnull %5) store i32 %8, i32* %sv_0.0.reg2mem br label LBL_4 LBL_3: %9 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_2 to i64)) store i32 0, i32* %sv_0.0.reg2mem br label LBL_4 LBL_4: %10 = load i32, i32* @gv_0, align 4 %11 = icmp eq i32 %10, 5 %12 = icmp eq i1 %11, false br i1 %12, label LBL_8, label LBL_5 LBL_5: %sv_0.0.reload = load i32, i32* %sv_0.0.reg2mem %13 = icmp eq i32 %sv_0.0.reload, 2147483647 br i1 %13, label LBL_7, label LBL_6 LBL_6: %14 = add i32 %sv_0.0.reload, 1 %15 = zext i32 %14 to i64 %16 = call i64 @FUNC(i64 %15) br label LBL_8 LBL_7: %17 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_3 to i64)) br label LBL_8 LBL_8: %18 = call i64 @FUNC(i64 40) %19 = icmp eq i64 %0, %18 store i64 0, i64* %rax.0.reg2mem br i1 %19, label LBL_10, label LBL_9 LBL_9: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_10 LBL_10: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32* %sv_0.0.reg2mem, { 0, 2, 1, 3 } uselistorder %_IO_FILE** @gv_1, { 2, 1, 0 } }
0
juliet-test-suite-c
CWE457_Use_of_Uninitialized_Variable__int_pointer_08-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i32* %0 = call i64 @FUNC() %1 = trunc i64 %0 to i32 %2 = icmp eq i32 %1, 0 br i1 %2, label LBL_4, label LBL_1 LBL_1: %3 = call i64* @malloc(i32 4) %4 = icmp eq i64* %3, null %5 = icmp eq i1 %4, false br i1 %5, label LBL_3, label LBL_2 LBL_2: call void @exit(i32 -1) unreachable LBL_3: %6 = bitcast i64* %3 to i32* store i32 5, i32* %6, align 4 store i32* %6, i32** %sv_0.0.reg2mem br label LBL_4 LBL_4: %7 = call i64 @FUNC() %8 = trunc i64 %7 to i32 %9 = icmp eq i32 %8, 0 store i64 %7, i64* %rax.0.reg2mem br i1 %9, label LBL_6, label LBL_5 LBL_5: %sv_0.0.reload = load i32*, i32** %sv_0.0.reg2mem %10 = load i32, i32* %sv_0.0.reload, align 4 %11 = zext i32 %10 to i64 %12 = call i64 @FUNC(i64 %11) store i64 %12, i64* %rax.0.reg2mem br label LBL_6 LBL_6: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %3, { 1, 0 } uselistorder i64 (i64)* @printIntLine, { 3, 2, 1, 0 } uselistorder void (i32)* @exit, { 2, 1, 0, 3, 4 } uselistorder i64* (i32)* @malloc, { 3, 1, 0, 2, 4 } uselistorder i64 ()* @staticReturnsTrue, { 5, 4, 3, 2, 1, 0 } }
0
juliet-test-suite-c
CWE195_Signed_to_Unsigned_Conversion_Error__connect_socket_strncpy_02-bad
CWE195_Signed_to_Unsigned_Conversion_Error__connect_socket_strncpy_02_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.034.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %sv_4 = alloca i64, align 8 %0 = ptrtoint i64* %sv_4 to i64 %1 = call i64 @FUNC(i64 40) %2 = call i32 @socket(i32 2, i32 1, i32 6) %3 = icmp eq i32 %2, -1 br i1 %3, label LBL_1, label LBL_2 LBL_1: store i64 0, i64* %sv_2, align 8 %4 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 99) store i32 -1, i32* %sv_0.034.reg2mem br label LBL_6 LBL_2: %5 = call i64* @memset(i64* nonnull %sv_3, i32 0, i32 16) store i64 2, i64* %sv_3, align 8 %6 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @gv_0, i64 0, i64 0)) %7 = call i16 @htons(i16 27015) %8 = bitcast i64* %sv_3 to %sockaddr* %9 = call i32 @connect(i32 %2, %sockaddr* nonnull %8, i32 16) %10 = icmp eq i32 %9, -1 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %10, label LBL_5, label LBL_3 LBL_3: %11 = call i32 @recv(i32 %2, i64* nonnull %sv_2, i32 13, i32 0) %12 = add i32 %11, 1 %13 = icmp ult i32 %12, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %13, label LBL_5, label LBL_4 LBL_4: %14 = sext i32 %11 to i64 %15 = add i64 %0, -112 %16 = add i64 %15, %14 %17 = inttoptr i64 %16 to i8* store i8 0, i8* %17, align 1 %18 = bitcast i64* %sv_2 to i8* %19 = call i32 @atoi(i8* nonnull %18) store i32 %19, i32* %sv_0.0.ph.reg2mem br label LBL_5 LBL_5: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %20 = call i32 @close(i32 %2) store i64 0, i64* %sv_2, align 8 %21 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 99) %22 = icmp sgt i32 %sv_0.0.ph.reload, 99 store i32 %sv_0.0.ph.reload, i32* %sv_0.034.reg2mem br i1 %22, label LBL_7, label LBL_6 LBL_6: %sv_0.034.reload = load i32, i32* %sv_0.034.reg2mem %23 = bitcast i64* %sv_2 to i8* %24 = bitcast i64* %sv_1 to i8* %25 = call i8* @strncpy(i8* nonnull %23, i8* nonnull %24, i32 %sv_0.034.reload) %26 = sext i32 %sv_0.034.reload to i64 %27 = add i64 %0, -112 %28 = add i64 %27, %26 %29 = inttoptr i64 %28 to i8* store i8 0, i8* %29, align 1 br label LBL_7 LBL_7: %30 = call i64 @FUNC(i64* nonnull %sv_2) %31 = call i64 @FUNC(i64 40) %32 = icmp eq i64 %1, %31 store i64 0, i64* %rax.0.reg2mem br i1 %32, label LBL_9, label LBL_8 LBL_8: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_9 LBL_9: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %sv_0.034.reload, { 1, 0 } uselistorder i32 %11, { 1, 0 } uselistorder i32 %2, { 2, 0, 1, 3 } uselistorder i64 %0, { 1, 0 } uselistorder i64* %sv_3, { 0, 2, 1 } uselistorder i64* %sv_2, { 1, 2, 5, 3, 4, 0 } uselistorder i64* %sv_1, { 1, 2, 0 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 3, 2, 1 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 2, 0, 3 } uselistorder i32 99, { 2, 1, 0 } uselistorder i32 65, { 1, 0 } uselistorder i32 -1, { 2, 1, 3, 0, 4 } uselistorder label LBL_6, { 1, 0 } uselistorder label LBL_5, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE190_Integer_Overflow__int_fscanf_postinc_13-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 0, i64* %sv_0, align 8 %1 = load i32, i32* inttoptr (i64 8420 to i32*), align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false store i64 0, i64* %.reg2mem br i1 %3, label LBL_2, label LBL_1 LBL_1: %4 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %5 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i64* nonnull %sv_0) %.pre = load i64, i64* %sv_0, align 8 %6 = trunc i64 %.pre to i32 %7 = icmp eq i32 %6, 2147483647 store i64 %.pre, i64* %.reg2mem br i1 %7, label LBL_3, label LBL_2 LBL_2: %.reload = load i64, i64* %.reg2mem %8 = mul i64 %.reload, 4294967296 %sext = add i64 %8, 4294967296 %9 = ashr exact i64 %sext, 32 store i64 %9, i64* %sv_0, align 8 %10 = and i64 %9, 4294967295 %11 = call i64 @FUNC(i64 %10) br label LBL_4 LBL_3: %12 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_2 to i64)) br label LBL_4 LBL_4: %13 = call i64 @FUNC(i64 40) %14 = icmp eq i64 %0, %13 store i64 0, i64* %rax.0.reg2mem br i1 %14, label LBL_6, label LBL_5 LBL_5: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_6 LBL_6: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %sv_0, { 2, 0, 1, 3 } uselistorder i64* %.reg2mem, { 0, 2, 1 } uselistorder label LBL_2, { 1, 0 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__int_connect_socket_postinc_07-bad
CWE190_Integer_Overflow__int_connect_socket_postinc_07_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.1.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false store i32 0, i32* %sv_0.1.reg2mem br i1 %3, label LBL_6, label LBL_1 LBL_1: %4 = call i32 @socket(i32 2, i32 1, i32 6) %5 = icmp eq i32 %4, -1 store i32 0, i32* %sv_0.1.reg2mem br i1 %5, label LBL_6, label LBL_2 LBL_2: %6 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %7 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @gv_1, i64 0, i64 0)) %8 = call i16 @htons(i16 27015) %9 = bitcast i64* %sv_2 to %sockaddr* %10 = call i32 @connect(i32 %4, %sockaddr* nonnull %9, i32 16) %11 = icmp eq i32 %10, -1 store i32 0, i32* %sv_0.0.ph.reg2mem br i1 %11, label LBL_5, label LBL_3 LBL_3: %12 = call i32 @recv(i32 %4, i64* nonnull %sv_1, i32 13, i32 0) %13 = add i32 %12, 1 %14 = icmp ult i32 %13, 2 store i32 0, i32* %sv_0.0.ph.reg2mem br i1 %14, label LBL_5, label LBL_4 LBL_4: %15 = ptrtoint i64* %sv_3 to i64 %16 = sext i32 %12 to i64 %17 = add i64 %15, -22 %18 = add i64 %17, %16 %19 = inttoptr i64 %18 to i8* store i8 0, i8* %19, align 1 %20 = bitcast i64* %sv_1 to i8* %21 = call i32 @atoi(i8* nonnull %20) store i32 %21, i32* %sv_0.0.ph.reg2mem br label LBL_5 LBL_5: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %22 = call i32 @close(i32 %4) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.reg2mem br label LBL_6 LBL_6: %23 = load i32, i32* @gv_0, align 4 %24 = icmp eq i32 %23, 5 %25 = icmp eq i1 %24, false br i1 %25, label LBL_8, label LBL_7 LBL_7: %sv_0.1.reload = load i32, i32* %sv_0.1.reg2mem %26 = add i32 %sv_0.1.reload, 1 %27 = zext i32 %26 to i64 %28 = call i64 @FUNC(i64 %27) br label LBL_8 LBL_8: %29 = call i64 @FUNC(i64 40) %30 = icmp eq i64 %0, %29 store i64 0, i64* %rax.0.reg2mem br i1 %30, label LBL_10, label LBL_9 LBL_9: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_10 LBL_10: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %12, { 1, 0 } uselistorder i32 %4, { 2, 0, 1, 3 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 3, 2, 1 } uselistorder i32* %sv_0.1.reg2mem, { 0, 2, 1, 3 } uselistorder i32* @gv_0, { 1, 0 } uselistorder label LBL_6, { 1, 0, 2 } uselistorder label LBL_5, { 1, 2, 0 } }
1
juliet-test-suite-c
CWE457_Use_of_Uninitialized_Variable__struct_array_declare_no_init_07-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %indvars.iv.reg2mem = alloca i64 %.reg2mem = alloca i32 %indvars.iv5.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = ptrtoint i64* %sv_0 to i64 %2 = load i32, i32* @gv_0, align 4 %3 = icmp eq i32 %2, 5 %4 = icmp eq i1 %3, false store i64 0, i64* %indvars.iv5.reg2mem store i32 %2, i32* %.reg2mem br i1 %4, label LBL_3, label LBL_1 LBL_1: %indvars.iv5.reload = load i64, i64* %indvars.iv5.reg2mem %5 = mul i64 %indvars.iv5.reload, 8 %6 = add i64 %5, %1 %7 = inttoptr i64 %6 to i32* %8 = trunc i64 %indvars.iv5.reload to i32 store i32 %8, i32* %7, align 8 %9 = or i64 %6, 4 %10 = inttoptr i64 %9 to i32* store i32 %8, i32* %10, align 4 %indvars.iv.next6 = add nuw nsw i64 %indvars.iv5.reload, 1 %exitcond7 = icmp eq i64 %indvars.iv.next6, 10 store i64 %indvars.iv.next6, i64* %indvars.iv5.reg2mem br i1 %exitcond7, label LBL_2, label LBL_1 LBL_2: %.pre = load i32, i32* @gv_0, align 4 store i32 %.pre, i32* %.reg2mem br label LBL_3 LBL_3: %.reload = load i32, i32* %.reg2mem %11 = icmp eq i32 %.reload, 5 %12 = icmp eq i1 %11, false store i64 0, i64* %indvars.iv.reg2mem br i1 %12, label LBL_5, label LBL_4 LBL_4: %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem %13 = mul i64 %indvars.iv.reload, 8 %14 = add i64 %13, %1 %15 = inttoptr i64 %14 to i32* %16 = load i32, i32* %15, align 8 %17 = zext i32 %16 to i64 %18 = call i64 @FUNC(i64 %17) %19 = or i64 %14, 4 %20 = inttoptr i64 %19 to i32* %21 = load i32, i32* %20, align 4 %22 = zext i32 %21 to i64 %23 = call i64 @FUNC(i64 %22) %indvars.iv.next = add nuw nsw i64 %indvars.iv.reload, 1 %exitcond = icmp eq i64 %indvars.iv.next, 10 store i64 %indvars.iv.next, i64* %indvars.iv.reg2mem br i1 %exitcond, label LBL_5, label LBL_4 LBL_5: %24 = call i64 @FUNC(i64 40) %25 = icmp eq i64 %0, %24 store i64 0, i64* %rax.0.reg2mem br i1 %25, label LBL_7, label LBL_6 LBL_6: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %indvars.iv5.reg2mem, { 2, 0, 1 } uselistorder i32* %.reg2mem, { 0, 2, 1 } uselistorder i64* %indvars.iv.reg2mem, { 2, 0, 1 } uselistorder i64 (i64)* @printIntLine, { 7, 6, 5, 4, 3, 2, 1, 0 } uselistorder i64 10, { 1, 0, 3, 2, 5, 4, 7, 6 } uselistorder i32* @gv_0, { 0, 5, 4, 3, 2, 1 } uselistorder label LBL_4, { 1, 0 } uselistorder label LBL_1, { 1, 0 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__dest_char_declare_cpy_15-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = ptrtoint i64* %sv_1 to i64 %2 = bitcast i64* %sv_1 to i8* store i8 0, i8* %2, align 8 %3 = call i64* @memset(i64* nonnull %sv_0, i32 67, i32 99) %4 = bitcast i64* %sv_0 to i8* %5 = call i8* @strcpy(i8* nonnull %2, i8* nonnull %4) %6 = call i64 @FUNC(i64 %1) %7 = call i64 @FUNC(i64 40) %8 = icmp eq i64 %0, %7 store i64 0, i64* %rax.0.reg2mem br i1 %8, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i8* (i8*, i8*)* @strcpy, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE191_Integer_Underflow__int_fgets_multiply_17-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = bitcast i64* %sv_0 to i8* store i64 0, i64* %sv_0, align 8 %2 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %3 = call i8* @fgets(i8* nonnull %1, i32 14, %_IO_FILE* %2) %4 = icmp eq i8* %3, null br i1 %4, label LBL_1, label LBL_2 LBL_1: %5 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_1 to i64)) br label LBL_6 LBL_2: %6 = call i32 @atoi(i8* nonnull %1) %7 = icmp slt i32 %6, 0 %8 = icmp eq i1 %7, false br i1 %8, label LBL_6, label LBL_3 LBL_3: %9 = icmp slt i32 %6, -1073741823 br i1 %9, label LBL_5, label LBL_4 LBL_4: %10 = mul i32 %6, 2 %11 = zext i32 %10 to i64 %12 = call i64 @FUNC(i64 %11) br label LBL_6 LBL_5: %13 = call i64 @FUNC(i64 ptrtoint ([51 x i8]* @gv_2 to i64)) br label LBL_6 LBL_6: %14 = call i64 @FUNC(i64 40) %15 = icmp eq i64 %0, %14 store i64 0, i64* %rax.0.reg2mem br i1 %15, label LBL_8, label LBL_7 LBL_7: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_8 LBL_8: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %6, { 0, 2, 1 } uselistorder i64* %sv_0, { 1, 0 } uselistorder label LBL_6, { 3, 2, 1, 0 } }
0
juliet-test-suite-c
CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_environment_13-bad
CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_environment_13_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.04.reg2mem = alloca i8* %sv_0.05.reg2mem = alloca i8* %.reg2mem = alloca i8 %0 = call i64* @malloc(i32 100) %1 = icmp eq i64* %0, null %2 = icmp eq i1 %1, false br i1 %2, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %3 = bitcast i64* %0 to i8* store i8 0, i8* %3, align 1 %4 = call i32 @strlen(i8* %3) %5 = call i8* @getenv(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @gv_0, i64 0, i64 0)) %6 = icmp eq i8* %5, null br i1 %6, label LBL_4, label LBL_3 LBL_3: %7 = sext i32 %4 to i64 %8 = ptrtoint i64* %0 to i64 %9 = add i64 %7, %8 %10 = inttoptr i64 %9 to i8* %11 = sub i32 99, %4 %12 = call i8* @strncat(i8* %10, i8* nonnull %5, i32 %11) br label LBL_4 LBL_4: %13 = load i32, i32* inttoptr (i64 8360 to i32*), align 8 %14 = zext i32 %13 to i64 %15 = icmp eq i32 %13, 5 %16 = icmp eq i1 %15, false store i64 %14, i64* %rax.0.reg2mem br i1 %16, label LBL_10, label LBL_5 LBL_5: %17 = load i8, i8* %3, align 1 %18 = icmp eq i8 %17, 0 %19 = icmp eq i1 %18, false store i8 %17, i8* %.reg2mem store i8* %3, i8** %sv_0.05.reg2mem store i8* %3, i8** %sv_0.04.reg2mem br i1 %19, label LBL_6, label LBL_9 LBL_6: %sv_0.05.reload = load i8*, i8** %sv_0.05.reg2mem %.reload = load i8, i8* %.reg2mem %20 = icmp eq i8 %.reload, 83 %21 = icmp eq i1 %20, false br i1 %21, label LBL_8, label LBL_7 LBL_7: %22 = call i64 @FUNC(i64 ptrtoint ([17 x i8]* @gv_1 to i64)) store i8* %sv_0.05.reload, i8** %sv_0.04.reg2mem br label LBL_9 LBL_8: %23 = ptrtoint i8* %sv_0.05.reload to i64 %24 = add i64 %23, 1 %25 = inttoptr i64 %24 to i8* %26 = load i8, i8* %25, align 1 %27 = icmp eq i8 %26, 0 %28 = icmp eq i1 %27, false store i8 %26, i8* %.reg2mem store i8* %25, i8** %sv_0.05.reg2mem store i8* %25, i8** %sv_0.04.reg2mem br i1 %28, label LBL_6, label LBL_9 LBL_9: %sv_0.04.reload = load i8*, i8** %sv_0.04.reg2mem %29 = bitcast i8* %sv_0.04.reload to i64* call void @free(i64* %29) store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_10 LBL_10: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i8* %sv_0.05.reload, { 1, 0 } uselistorder i8* %3, { 0, 1, 2, 4, 3 } uselistorder i64* %0, { 0, 2, 1 } uselistorder i8* %.reg2mem, { 2, 0, 1 } uselistorder i8** %sv_0.05.reg2mem, { 2, 0, 1 } uselistorder i8** %sv_0.04.reg2mem, { 0, 1, 3, 2 } uselistorder i8 0, { 1, 0, 2, 3 } uselistorder label LBL_9, { 0, 2, 1 } uselistorder label LBL_6, { 1, 0 } }
1
juliet-test-suite-c
CWE122_Heap_Based_Buffer_Overflow__CWE131_memcpy_08-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i64 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 store i64 0, i64* %sv_0.0.reg2mem br i1 %3, label LBL_3, label LBL_1 LBL_1: %4 = call i64* @malloc(i32 40) %5 = ptrtoint i64* %4 to i64 %6 = icmp eq i64* %4, null %7 = icmp eq i1 %6, false store i64 %5, i64* %sv_0.0.reg2mem br i1 %7, label LBL_3, label LBL_2 LBL_2: call void @exit(i32 -1) unreachable LBL_3: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem store i64 0, i64* %sv_1, align 8 %8 = inttoptr i64 %sv_0.0.reload to i64* %9 = call i64* @memcpy(i64* %8, i64* nonnull %sv_1, i32 40) %10 = inttoptr i64 %sv_0.0.reload to i32* %11 = load i32, i32* %10, align 4 %12 = zext i32 %11 to i64 %13 = call i64 @FUNC(i64 %12) call void @free(i64* %8) %14 = call i64 @FUNC(i64 40) %15 = icmp eq i64 %0, %14 store i64 0, i64* %rax.0.reg2mem br i1 %15, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder void (i64*)* @free, { 1, 0, 2 } uselistorder i64 (i64)* @printIntLine, { 1, 0 } uselistorder i64* (i32)* @malloc, { 1, 0, 2 } uselistorder i32 40, { 0, 1, 3, 2 } }
0
juliet-test-suite-c
CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_connect_socket_08-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge4.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 100) %2 = icmp eq i64* %1, null %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %4 = bitcast i64* %1 to i8* store i8 0, i8* %4, align 1 %5 = call i32 @strlen(i8* %4) %6 = call i32 @socket(i32 2, i32 1, i32 6) %cond = icmp eq i32 %6, -1 br i1 %cond, label LBL_10, label LBL_3 LBL_3: %7 = call i64* @memset(i64* nonnull %sv_0, i32 0, i32 16) store i64 2, i64* %sv_0, align 8 %8 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @gv_0, i64 0, i64 0)) %9 = call i16 @htons(i16 27015) %10 = bitcast i64* %sv_0 to %sockaddr* %11 = call i32 @connect(i32 %6, %sockaddr* nonnull %10, i32 16) %12 = icmp eq i32 %11, -1 br i1 %12, label LBL_9, label LBL_4 LBL_4: %13 = sext i32 %5 to i64 %14 = ptrtoint i64* %1 to i64 %15 = add i64 %13, %14 %16 = inttoptr i64 %15 to i64* %17 = sub i32 99, %5 %18 = call i32 @recv(i32 %6, i64* %16, i32 %17, i32 0) %19 = add i32 %18, 1 %20 = icmp ult i32 %19, 2 br i1 %20, label LBL_9, label LBL_5 LBL_5: %21 = sext i32 %18 to i64 %22 = add i64 %15, %21 %23 = inttoptr i64 %22 to i8* store i8 0, i8* %23, align 1 %24 = call i8* @strchr(i8* nonnull %4, i32 13) %25 = icmp eq i8* %24, null br i1 %25, label LBL_7, label LBL_6 LBL_6: store i8 0, i8* %24, align 1 br label LBL_7 LBL_7: %26 = call i8* @strchr(i8* nonnull %4, i32 10) %27 = icmp eq i8* %26, null br i1 %27, label LBL_9, label LBL_8 LBL_8: store i8 0, i8* %26, align 1 br label LBL_9 LBL_9: %28 = call i32 @close(i32 %6) br label LBL_10 LBL_10: %29 = call i64 @FUNC() %30 = trunc i64 %29 to i32 %31 = icmp eq i32 %30, 0 br i1 %31, label LBL_11, label LBL_13 LBL_11: %32 = call i32 @strlen(i8* nonnull %4) %33 = icmp eq i32 %32, 0 br i1 %33, label LBL_17, label LBL_12 LBL_12: %34 = ptrtoint i64* %1 to i64 store i64 0, i64* %storemerge4.reg2mem br label LBL_14 LBL_13: %35 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_1 to i64)) br label LBL_18 LBL_14: %storemerge4.reload = load i64, i64* %storemerge4.reg2mem %36 = add i64 %storemerge4.reload, %34 %37 = inttoptr i64 %36 to i8* %38 = load i8, i8* %37, align 1 %39 = icmp eq i8 %38, 83 %40 = icmp eq i1 %39, false br i1 %40, label LBL_16, label LBL_15 LBL_15: %41 = call i64 @FUNC(i64 ptrtoint ([17 x i8]* @gv_2 to i64)) br label LBL_17 LBL_16: %42 = add nuw i64 %storemerge4.reload, 1 %43 = call i32 @strlen(i8* %4) %44 = sext i32 %43 to i64 %45 = icmp ult i64 %42, %44 store i64 %42, i64* %storemerge4.reg2mem br i1 %45, label LBL_14, label LBL_17 LBL_17: call void @free(i64* %1) br label LBL_18 LBL_18: %46 = call i64 @FUNC(i64 40) %47 = icmp eq i64 %0, %46 store i64 0, i64* %rax.0.reg2mem br i1 %47, label LBL_20, label LBL_19 LBL_19: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_20 LBL_20: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %18, { 1, 0 } uselistorder i32 %6, { 3, 1, 2, 0 } uselistorder i8* %4, { 3, 0, 1, 2, 5, 4 } uselistorder i64* %1, { 1, 0, 2, 4, 3 } uselistorder i64* %sv_0, { 0, 2, 1 } uselistorder i64* %storemerge4.reg2mem, { 1, 0, 2 } uselistorder label LBL_17, { 0, 2, 1 } uselistorder label LBL_14, { 1, 0 } uselistorder label LBL_10, { 1, 0 } uselistorder label LBL_9, { 2, 1, 0, 3 } }
0
juliet-test-suite-c
CWE457_Use_of_Uninitialized_Variable__double_pointer_07-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %storemerge.reg2mem = alloca i64 %0 = load i32, i32* @gv_0, align 4 %1 = icmp eq i32 %0, 5 br i1 %1, label LBL_2, label LBL_1 LBL_1: %2 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_1 to i64)) store i64 %2, i64* %storemerge.reg2mem br label LBL_5 LBL_2: %3 = call i64* @malloc(i32 8) %4 = icmp eq i64* %3, null %5 = icmp eq i1 %4, false br i1 %5, label LBL_4, label LBL_3 LBL_3: call void @exit(i32 -1) unreachable LBL_4: %6 = call i128 @FUNC(i64 4617315517961601024) %7 = call i64 @__asm_movsd.1(i128 %6) store i64 %7, i64* %3, align 8 %8 = call i128 @FUNC(i64 %7) %9 = call i64 @FUNC() store i64 %9, i64* %storemerge.reg2mem br label LBL_5 LBL_5: %storemerge.reload = load i64, i64* %storemerge.reg2mem ret i64 %storemerge.reload uselistorder i64* %storemerge.reg2mem, { 0, 2, 1 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_07-bad
CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memcpy_07_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = alloca i64 %rax.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %1 = load i64, i64* %0 %sv_2 = alloca i64, align 8 %2 = ptrtoint i64* %sv_2 to i64 %3 = call i64 @FUNC(i64 40) %4 = load i32, i32* @gv_0, align 4 %5 = icmp eq i32 %4, 5 store i64 0, i64* %storemerge1.reg2mem br label LBL_1 LBL_1: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %6 = mul i64 %storemerge1.reload, 8 %7 = add i64 %6, %2 %8 = add i64 %7, -816 %9 = inttoptr i64 %8 to i32* store i32 0, i32* %9, align 8 %10 = add i64 %7, -812 %11 = inttoptr i64 %10 to i32* store i32 0, i32* %11, align 4 %12 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %12, 100 store i64 %12, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_2, label LBL_1 LBL_2: %13 = ptrtoint i64* %sv_1 to i64 %14 = icmp eq i1 %5, false %spec.select = select i1 %14, i64 %1, i64 %13 %15 = inttoptr i64 %spec.select to i64* %16 = call i64* @memcpy(i64* %15, i64* nonnull %sv_0, i32 ptrtoint (i32* @gv_1 to i32)) %17 = call i64 @FUNC(i64 %spec.select) %18 = call i64 @FUNC(i64 40) %19 = icmp eq i64 %3, %18 store i64 0, i64* %rax.0.reg2mem br i1 %19, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %storemerge1.reg2mem, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_14-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false %4 = ptrtoint i64* %sv_1 to i64 %5 = add i64 %4, -33 %6 = and i64 %5, -16 %sv_2.0 = select i1 %3, i64 0, i64 %6 store i64 0, i64* %sv_0, align 8 %7 = inttoptr i64 %sv_2.0 to i64* %8 = call i64* @memcpy(i64* %7, i64* nonnull %sv_0, i32 40) %9 = inttoptr i64 %sv_2.0 to i32* %10 = load i32, i32* %9, align 16 %11 = zext i32 %10 to i64 %12 = call i64 @FUNC(i64 %11) %13 = call i64 @FUNC(i64 40) %14 = icmp eq i64 %0, %13 store i64 0, i64* %rax.0.reg2mem br i1 %14, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 (i64)* @printIntLine, { 1, 0 } uselistorder i64* (i64*, i64*, i32)* @memcpy, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE369_Divide_by_Zero__int_zero_divide_11-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = call i64 @FUNC() %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 store i64 %1, i64* %rax.0.reg2mem br i1 %3, label LBL_2, label LBL_1 LBL_1: %4 = trunc i64 %0 to i32 %5 = icmp eq i32 %4, 0 %spec.select = select i1 %5, i32 -1, i32 7 %6 = udiv i32 100, %spec.select %7 = zext i32 %6 to i64 %8 = call i64 @FUNC(i64 %7) store i64 %8, i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 (i64)* @printIntLine, { 3, 2, 1, 0 } uselistorder i32 7, { 1, 0 } uselistorder i32 -1, { 1, 0 } uselistorder i64 ()* @globalReturnsTrue, { 5, 4, 3, 2, 1, 0 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__int_max_add_05-bad
CWE190_Integer_Overflow__int_max_add_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = load i32, i32* @gv_0, align 4 %1 = icmp eq i32 %0, 0 store i64 0, i64* %rax.0.reg2mem br i1 %1, label LBL_2, label LBL_1 LBL_1: %2 = call i64 @FUNC(i64 2147483648) store i64 %2, i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
1
juliet-test-suite-c
CWE690_NULL_Deref_From_Return__struct_realloc_12-bad
CWE690_NULL_Deref_From_Return__struct_realloc_12_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = call i64* @realloc(i64* null, i32 8) %1 = ptrtoint i64* %0 to i64 %2 = call i64 @FUNC() %3 = trunc i64 %2 to i32 %4 = icmp eq i32 %3, 0 br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = bitcast i64* %0 to i32* store i32 1, i32* %5, align 4 %6 = add i64 %1, 4 %7 = inttoptr i64 %6 to i32* store i32 1, i32* %7, align 4 %8 = call i64 @FUNC(i64 %1) call void @free(i64* %0) store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_2: %9 = icmp eq i64* %0, null store i64 %2, i64* %rax.0.reg2mem br i1 %9, label LBL_4, label LBL_3 LBL_3: %10 = bitcast i64* %0 to i32* store i32 1, i32* %10, align 4 %11 = add i64 %1, 4 %12 = inttoptr i64 %11 to i32* store i32 1, i32* %12, align 4 %13 = call i64 @FUNC(i64 %1) call void @free(i64* nonnull %0) store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %1, { 2, 3, 0, 1 } uselistorder i64* %rax.0.reg2mem, { 0, 2, 3, 1 } uselistorder void (i64*)* @free, { 1, 0, 2 } uselistorder i64 (i64)* @printStructLine, { 1, 0 } }
1
juliet-test-suite-c
CWE197_Numeric_Truncation_Error__int_listen_socket_to_char_12-bad
CWE197_Numeric_Truncation_Error__int_listen_socket_to_char_12_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.1.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 store i32 122, i32* %sv_0.1.reg2mem br i1 %3, label LBL_9, label LBL_1 LBL_1: %4 = call i32 @socket(i32 2, i32 1, i32 6) %5 = icmp eq i32 %4, -1 store i32 -1, i32* %sv_0.1.reg2mem br i1 %5, label LBL_9, label LBL_2 LBL_2: %6 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %7 = call i16 @htons(i16 27015) %8 = bitcast i64* %sv_2 to %sockaddr* %9 = call i32 @bind(i32 %4, %sockaddr* nonnull %8, i32 16) %10 = icmp eq i32 %9, -1 br i1 %10, label LBL_7, label LBL_3 LBL_3: %11 = call i32 @listen(i32 %4, i32 5) %12 = icmp eq i32 %11, -1 br i1 %12, label LBL_7, label LBL_4 LBL_4: %13 = call i32 @accept(i32 %4, %sockaddr* null, i32* null) %14 = icmp eq i32 %13, -1 br i1 %14, label LBL_7, label LBL_5 LBL_5: %15 = call i32 @recv(i32 %13, i64* nonnull %sv_1, i32 13, i32 0) %16 = add i32 %15, 1 %17 = icmp ult i32 %16, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %17, label LBL_8, label LBL_6 LBL_6: %18 = ptrtoint i64* %sv_3 to i64 %19 = sext i32 %15 to i64 %20 = add i64 %18, -22 %21 = add i64 %20, %19 %22 = inttoptr i64 %21 to i8* store i8 0, i8* %22, align 1 %23 = bitcast i64* %sv_1 to i8* %24 = call i32 @atoi(i8* nonnull %23) store i32 %24, i32* %sv_0.0.ph.reg2mem br label LBL_8 LBL_7: %25 = call i32 @close(i32 %4) store i32 -1, i32* %sv_0.1.reg2mem br label LBL_9 LBL_8: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %26 = call i32 @close(i32 %4) %27 = call i32 @close(i32 %13) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.reg2mem br label LBL_9 LBL_9: %sv_0.1.reload = load i32, i32* %sv_0.1.reg2mem %sext = mul i32 %sv_0.1.reload, 16777216 %28 = ashr exact i32 %sext, 24 %29 = zext i32 %28 to i64 %30 = call i64 @FUNC(i64 %29) %31 = call i64 @FUNC(i64 40) %32 = icmp eq i64 %0, %31 store i64 0, i64* %rax.0.reg2mem br i1 %32, label LBL_11, label LBL_10 LBL_10: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_11 LBL_11: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %15, { 1, 0 } uselistorder i32 %4, { 4, 0, 1, 2, 3, 5 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32* %sv_0.1.reg2mem, { 0, 4, 2, 1, 3 } uselistorder i32 (i32)* @close, { 2, 1, 0, 3 } uselistorder i32 -1, { 1, 2, 3, 4, 5, 0, 6 } uselistorder label LBL_9, { 3, 1, 0, 2 } }
1
juliet-test-suite-c
CWE191_Integer_Underflow__short_min_multiply_10-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = load i32, i32* @gv_0, align 4 %1 = icmp eq i32 %0, 0 store i64 0, i64* %rax.0.reg2mem br i1 %1, label LBL_3, label LBL_1 LBL_1: %spec.store.select = select i1 %1, i32 0, i32 -2 %2 = zext i32 %0 to i64 %3 = trunc i32 %spec.store.select to i16 %4 = icmp slt i16 %3, 0 %5 = icmp eq i1 %4, false store i64 %2, i64* %rax.0.reg2mem br i1 %5, label LBL_3, label LBL_2 LBL_2: %6 = mul i32 %spec.store.select, 2 %7 = zext i32 %6 to i64 %8 = call i64 @FUNC(i64 %7) store i64 %8, i64* %rax.0.reg2mem br label LBL_3 LBL_3: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i1 %1, { 1, 0 } uselistorder i64 (i64)* @printIntLine, { 1, 0 } uselistorder i32 -2, { 1, 0 } uselistorder i32* @gv_0, { 3, 2, 1, 0 } }
0
juliet-test-suite-c
CWE415_Double_Free__malloc_free_int_18-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = call i64* @malloc(i32 400) %1 = icmp eq i64* %0, null %2 = icmp eq i1 %1, false br i1 %2, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: call void @free(i64* %0) ret i64 ptrtoint (i32* @1 to i64) uselistorder void (i64*)* @free, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE134_Uncontrolled_Format_String__char_file_fprintf_13-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = bitcast i64* %sv_0 to i8* %2 = ptrtoint i64* %sv_0 to i64 store i64 8247343692658534758, i64* %sv_0, align 8 %3 = add i64 %2, 8 %4 = inttoptr i64 %3 to i64* store i64 32777976880262761, i64* %4, align 8 %5 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %6 = call i32 (%_IO_FILE*, i8*, ...) @fprintf(%_IO_FILE* %5, i8* nonnull %1) %7 = call i64 @FUNC(i64 40) %8 = icmp eq i64 %0, %7 store i64 0, i64* %rax.0.reg2mem br i1 %8, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %sv_0, { 1, 0, 2 } uselistorder i32 (%_IO_FILE*, i8*, ...)* @fprintf, { 2, 1, 3, 0, 4 } uselistorder %_IO_FILE** @gv_0, { 4, 3, 2, 1, 0 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__unsigned_int_fscanf_square_17-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i32, align 4 %0 = call i64 @FUNC(i64 40) store i32 0, i32* %sv_0, align 4 %1 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %2 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i32* nonnull %sv_0) %3 = load i32, i32* %sv_0, align 4 %.off = add i32 %3, 65534 %4 = icmp ugt i32 %.off, 131068 br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = mul i32 %3, %3 %6 = zext i32 %5 to i64 %7 = call i64 @FUNC(i64 %6) br label LBL_3 LBL_2: %8 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_2 to i64)) br label LBL_3 LBL_3: %9 = call i64 @FUNC(i64 40) %10 = icmp eq i64 %0, %9 store i64 0, i64* %rax.0.reg2mem br i1 %10, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %3, { 2, 1, 0 } uselistorder i32* %sv_0, { 1, 0, 2 } uselistorder label LBL_3, { 1, 0 } }
0
juliet-test-suite-c
CWE457_Use_of_Uninitialized_Variable__double_array_malloc_no_init_15-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %indvars.iv.reg2mem = alloca i64 %xmm0.04.reg2mem = alloca i128 %indvars.iv6.reg2mem = alloca i64 %0 = call i64* @malloc(i32 80) %1 = ptrtoint i64* %0 to i64 %2 = icmp eq i64* %0, null %3 = icmp eq i1 %2, false store i64 0, i64* %indvars.iv6.reg2mem br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %xmm0.04.reload = load i128, i128* %xmm0.04.reg2mem %indvars.iv6.reload = load i64, i64* %indvars.iv6.reg2mem %4 = mul i64 %indvars.iv6.reload, 8 %5 = add i64 %4, %1 %6 = call i128 @FUNC(i128 %xmm0.04.reload, i128 %xmm0.04.reload) %7 = trunc i64 %indvars.iv6.reload to i32 %8 = call i128 @FUNC(i32 %7) %9 = call i64 @FUNC(i128 %8) %10 = inttoptr i64 %5 to i64* store i64 %9, i64* %10, align 8 %indvars.iv.next7 = add nuw nsw i64 %indvars.iv6.reload, 1 %exitcond8 = icmp eq i64 %indvars.iv.next7, 10 store i64 %indvars.iv.next7, i64* %indvars.iv6.reg2mem store i128 %8, i128* %xmm0.04.reg2mem store i64 0, i64* %indvars.iv.reg2mem br i1 %exitcond8, label LBL_3, label LBL_2 LBL_3: %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem %11 = mul i64 %indvars.iv.reload, 8 %12 = add i64 %11, %1 %13 = inttoptr i64 %12 to i64* %14 = load i64, i64* %13, align 8 %15 = call i128 @FUNC(i64 %14) %16 = call i64 @FUNC() %indvars.iv.next = add nuw nsw i64 %indvars.iv.reload, 1 %exitcond = icmp eq i64 %indvars.iv.next, 10 store i64 %indvars.iv.next, i64* %indvars.iv.reg2mem br i1 %exitcond, label LBL_4, label LBL_3 LBL_4: ret i64 %16 uselistorder i128 %xmm0.04.reload, { 1, 0 } uselistorder i64* %indvars.iv6.reg2mem, { 2, 0, 1 } uselistorder i128* %xmm0.04.reg2mem, { 1, 0 } uselistorder i64* %indvars.iv.reg2mem, { 2, 0, 1 } uselistorder i64 ()* @printDoubleLine, { 3, 2, 1, 0 } uselistorder i64 10, { 1, 0, 3, 2, 5, 4, 7, 6 } uselistorder void (i32)* @exit, { 3, 2, 1, 0, 4 } uselistorder label LBL_3, { 1, 0 } uselistorder label LBL_2, { 1, 0 } }
0
juliet-test-suite-c
CWE789_Uncontrolled_Mem_Alloc__malloc_char_rand_17-bad
CWE789_Uncontrolled_Mem_Alloc__malloc_char_rand_17_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %storemerge2.reg2mem = alloca i64 %0 = call i32 @rand() %1 = icmp ult i32 %0, 6 br i1 %1, label LBL_4, label LBL_1 LBL_1: %2 = call i64* @malloc(i32 %0) %3 = icmp eq i64* %2, null %4 = icmp eq i1 %3, false br i1 %4, label LBL_3, label LBL_2 LBL_2: call void @exit(i32 -1) unreachable LBL_3: %5 = ptrtoint i64* %2 to i64 %6 = bitcast i64* %2 to i32* store i32 1819043176, i32* %6, align 4 %7 = add i64 %5, 4 %8 = inttoptr i64 %7 to i16* store i16 111, i16* %8, align 2 %9 = call i64 @FUNC(i64 %5) call void @free(i64* %2) store i64 ptrtoint (i32* @1 to i64), i64* %storemerge2.reg2mem br label LBL_5 LBL_4: %10 = call i64 @FUNC(i64 ptrtoint ([51 x i8]* @gv_0 to i64)) store i64 %10, i64* %storemerge2.reg2mem br label LBL_5 LBL_5: %storemerge2.reload = load i64, i64* %storemerge2.reg2mem ret i64 %storemerge2.reload uselistorder i64* %2, { 0, 1, 3, 2 } uselistorder i32 %0, { 1, 0 } uselistorder i64* %storemerge2.reg2mem, { 0, 2, 1 } uselistorder label LBL_5, { 1, 0 } }
1
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE131_memcpy_11-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i64 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 br i1 %3, label LBL_1, label LBL_2 LBL_1: %4 = ptrtoint i64* %sv_2 to i64 %5 = add i64 %4, -33 %6 = and i64 %5, -16 store i64 %6, i64* %sv_0.0.reg2mem br label LBL_3 LBL_2: %7 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_0 to i64)) store i64 0, i64* %sv_0.0.reg2mem br label LBL_3 LBL_3: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem store i64 0, i64* %sv_1, align 8 %8 = inttoptr i64 %sv_0.0.reload to i64* %9 = call i64* @memcpy(i64* %8, i64* nonnull %sv_1, i32 40) %10 = inttoptr i64 %sv_0.0.reload to i32* %11 = load i32, i32* %10, align 16 %12 = zext i32 %11 to i64 %13 = call i64 @FUNC(i64 %12) %14 = call i64 @FUNC(i64 40) %15 = icmp eq i64 %0, %14 store i64 0, i64* %rax.0.reg2mem br i1 %15, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder label LBL_3, { 1, 0 } }
0
juliet-test-suite-c
CWE758_Undefined_Behavior__char_pointer_malloc_use_05-bad
CWE758_Undefined_Behavior__char_pointer_malloc_use_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = load i32, i32* @gv_0, align 4 %1 = icmp eq i32 %0, 0 store i64 0, i64* %rax.0.reg2mem br i1 %1, label LBL_4, label LBL_1 LBL_1: %2 = call i64* @malloc(i32 8) %3 = icmp eq i64* %2, null %4 = icmp eq i1 %3, false br i1 %4, label LBL_3, label LBL_2 LBL_2: call void @exit(i32 -1) unreachable LBL_3: %5 = load i64, i64* %2, align 8 call void @free(i64* %2) %6 = call i64 @FUNC(i64 %5) store i64 %6, i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
1
juliet-test-suite-c
CWE590_Free_Memory_Not_on_Heap__free_int64_t_alloca_05-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %storemerge1.reg2mem = alloca i64 %0 = load i32, i32* @gv_0, align 4 %1 = icmp eq i32 %0, 0 br i1 %1, label LBL_2, label LBL_1 LBL_1: %2 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_1 to i64)) unreachable LBL_2: %3 = call i64* @malloc(i32 ptrtoint (i32* @gv_2 to i32)) %4 = ptrtoint i64* %3 to i64 %5 = icmp eq i64* %3, null %6 = icmp eq i1 %5, false store i64 0, i64* %storemerge1.reg2mem br i1 %6, label LBL_4, label LBL_3 LBL_3: %7 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_3 to i64)) call void @exit(i32 1) unreachable LBL_4: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %8 = mul i64 %storemerge1.reload, 8 %9 = add i64 %8, %4 %10 = inttoptr i64 %9 to i64* store i64 5, i64* %10, align 8 %11 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %11, 100 store i64 %11, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_5, label LBL_4 LBL_5: %12 = load i64, i64* %3, align 8 %13 = call i64 @FUNC(i64 %12) call void @free(i64* %3) ret i64 ptrtoint (i32* @1 to i64) uselistorder i64* %storemerge1.reg2mem, { 2, 0, 1 } uselistorder label LBL_4, { 1, 0 } }
0
juliet-test-suite-c
CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int_loop_17-bad
CWE122_Heap_Based_Buffer_Overflow__c_CWE805_int_loop_17_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge3.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 200) %2 = icmp eq i64* %1, null %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %4 = ptrtoint i64* %sv_1 to i64 %5 = ptrtoint i64* %1 to i64 %6 = bitcast i64* %sv_0 to i8* call void @FUNC(i8* nonnull %6, i64 0, i64 50) %7 = add i64 %4, -416 store i64 0, i64* %storemerge3.reg2mem br label LBL_3 LBL_3: %storemerge3.reload = load i64, i64* %storemerge3.reg2mem %8 = mul i64 %storemerge3.reload, 4 %9 = add i64 %8, %5 %10 = add i64 %7, %8 %11 = inttoptr i64 %10 to i32* %12 = load i32, i32* %11, align 4 %13 = inttoptr i64 %9 to i32* store i32 %12, i32* %13, align 4 %14 = add nuw nsw i64 %storemerge3.reload, 1 %exitcond = icmp eq i64 %14, 100 store i64 %14, i64* %storemerge3.reg2mem br i1 %exitcond, label LBL_4, label LBL_3 LBL_4: %15 = bitcast i64* %1 to i32* %16 = load i32, i32* %15, align 4 %17 = zext i32 %16 to i64 %18 = call i64 @FUNC(i64 %17) call void @free(i64* %1) %19 = call i64 @FUNC(i64 40) %20 = icmp eq i64 %0, %19 store i64 0, i64* %rax.0.reg2mem br i1 %20, label LBL_6, label LBL_5 LBL_5: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_6 LBL_6: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %storemerge3.reg2mem, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE563_Unused_Variable__unused_value_struct_07-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: store i64 0, i64* %sv_0, align 8 %4 = call i64 @FUNC(i64* nonnull %sv_0) br label LBL_2 LBL_2: %5 = call i64 @FUNC(i64 40) %6 = icmp eq i64 %0, %5 store i64 0, i64* %rax.0.reg2mem br i1 %6, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder label LBL_2, { 1, 0 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__short_fscanf_square_13-bad
CWE190_Integer_Overflow__short_fscanf_square_13_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %.reg2mem = alloca i16 %sv_0 = alloca i16, align 2 %0 = call i64 @FUNC(i64 40) store i16 0, i16* %sv_0, align 2 %1 = load i32, i32* inttoptr (i64 8340 to i32*), align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false store i16 0, i16* %.reg2mem br i1 %3, label LBL_2, label LBL_1 LBL_1: %4 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %5 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @gv_1, i64 0, i64 0), i16* nonnull %sv_0) %.pre = load i16, i16* %sv_0, align 2 store i16 %.pre, i16* %.reg2mem br label LBL_2 LBL_2: %.reload = load i16, i16* %.reg2mem %6 = mul i16 %.reload, %.reload %7 = sext i16 %6 to i64 %8 = and i64 %7, 4294967295 %9 = call i64 @FUNC(i64 %8) %10 = call i64 @FUNC(i64 40) %11 = icmp eq i64 %0, %10 store i64 0, i64* %rax.0.reg2mem br i1 %11, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder label LBL_2, { 1, 0 } }
1
juliet-test-suite-c
CWE457_Use_of_Uninitialized_Variable__struct_array_declare_partial_init_13-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %indvars.iv.reg2mem = alloca i64 %indvars.iv6.reg2mem = alloca i64 %indvars.iv9.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = ptrtoint i64* %sv_0 to i64 %2 = load i32, i32* inttoptr (i64 8360 to i32*), align 8 %3 = icmp eq i32 %2, 5 %4 = icmp eq i1 %3, false store i64 0, i64* %indvars.iv9.reg2mem br i1 %4, label LBL_2, label LBL_1 LBL_1: %indvars.iv9.reload = load i64, i64* %indvars.iv9.reg2mem %5 = mul i64 %indvars.iv9.reload, 8 %6 = add i64 %5, %1 %7 = inttoptr i64 %6 to i32* %8 = trunc i64 %indvars.iv9.reload to i32 store i32 %8, i32* %7, align 8 %9 = or i64 %6, 4 %10 = inttoptr i64 %9 to i32* store i32 %8, i32* %10, align 4 %indvars.iv.next10 = add nuw nsw i64 %indvars.iv9.reload, 1 %exitcond11 = icmp eq i64 %indvars.iv.next10, 5 store i64 %indvars.iv.next10, i64* %indvars.iv9.reg2mem br i1 %exitcond11, label LBL_2, label LBL_1 LBL_2: store i64 0, i64* %indvars.iv6.reg2mem br label LBL_3 LBL_3: %indvars.iv6.reload = load i64, i64* %indvars.iv6.reg2mem %11 = mul i64 %indvars.iv6.reload, 8 %12 = add i64 %11, %1 %13 = inttoptr i64 %12 to i32* %14 = trunc i64 %indvars.iv6.reload to i32 store i32 %14, i32* %13, align 8 %15 = or i64 %12, 4 %16 = inttoptr i64 %15 to i32* store i32 %14, i32* %16, align 4 %indvars.iv.next7 = add nuw nsw i64 %indvars.iv6.reload, 1 %exitcond8 = icmp eq i64 %indvars.iv.next7, 10 store i64 %indvars.iv.next7, i64* %indvars.iv6.reg2mem store i64 0, i64* %indvars.iv.reg2mem br i1 %exitcond8, label LBL_4, label LBL_3 LBL_4: %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem %17 = mul i64 %indvars.iv.reload, 8 %18 = add i64 %17, %1 %19 = inttoptr i64 %18 to i32* %20 = load i32, i32* %19, align 8 %21 = zext i32 %20 to i64 %22 = call i64 @FUNC(i64 %21) %23 = or i64 %18, 4 %24 = inttoptr i64 %23 to i32* %25 = load i32, i32* %24, align 4 %26 = zext i32 %25 to i64 %27 = call i64 @FUNC(i64 %26) %indvars.iv.next = add nuw nsw i64 %indvars.iv.reload, 1 %exitcond = icmp eq i64 %indvars.iv.next, 10 store i64 %indvars.iv.next, i64* %indvars.iv.reg2mem br i1 %exitcond, label LBL_5, label LBL_4 LBL_5: %28 = call i64 @FUNC(i64 40) %29 = icmp eq i64 %0, %28 store i64 0, i64* %rax.0.reg2mem br i1 %29, label LBL_7, label LBL_6 LBL_6: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %indvars.iv9.reg2mem, { 2, 0, 1 } uselistorder i64* %indvars.iv6.reg2mem, { 1, 0, 2 } uselistorder i64* %indvars.iv.reg2mem, { 2, 0, 1 } uselistorder label LBL_4, { 1, 0 } uselistorder label LBL_1, { 1, 0 } }
0
juliet-test-suite-c
CWE400_Resource_Exhaustion__connect_socket_fwrite_14-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge7.reg2mem = alloca i64 %sv_0.1.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* inttoptr (i64 20500 to i32*), align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false store i32 -1, i32* %sv_0.1.reg2mem br i1 %3, label LBL_6, label LBL_1 LBL_1: %4 = call i32 @socket(i32 2, i32 1, i32 6) %5 = icmp eq i32 %4, -1 store i32 -1, i32* %sv_0.1.reg2mem br i1 %5, label LBL_6, label LBL_2 LBL_2: %6 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %7 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @gv_0, i64 0, i64 0)) %8 = call i16 @htons(i16 27015) %9 = bitcast i64* %sv_2 to %sockaddr* %10 = call i32 @connect(i32 %4, %sockaddr* nonnull %9, i32 16) %11 = icmp eq i32 %10, -1 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %11, label LBL_5, label LBL_3 LBL_3: %12 = call i32 @recv(i32 %4, i64* nonnull %sv_1, i32 13, i32 0) %13 = add i32 %12, 1 %14 = icmp ult i32 %13, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %14, label LBL_5, label LBL_4 LBL_4: %15 = ptrtoint i64* %sv_3 to i64 %16 = sext i32 %12 to i64 %17 = add i64 %15, -22 %18 = add i64 %17, %16 %19 = inttoptr i64 %18 to i8* store i8 0, i8* %19, align 1 %20 = bitcast i64* %sv_1 to i8* %21 = call i32 @atoi(i8* nonnull %20) store i32 %21, i32* %sv_0.0.ph.reg2mem br label LBL_5 LBL_5: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %22 = call i32 @close(i32 %4) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.reg2mem br label LBL_6 LBL_6: %23 = load i32, i32* @gv_1, align 4 %24 = icmp eq i32 %23, 5 br i1 %24, label LBL_8, label LBL_7 LBL_7: %25 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_2 to i64)) br label LBL_16 LBL_8: %sv_0.1.reload = load i32, i32* %sv_0.1.reg2mem %sv_0.1.off = add i32 %sv_0.1.reload, -1 %26 = icmp ugt i32 %sv_0.1.off, 19 br i1 %26, label LBL_16, label LBL_9 LBL_9: %27 = call %_IO_FILE* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @gv_3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_4, i64 0, i64 0)) %28 = icmp eq %_IO_FILE* %27, null %29 = icmp eq i1 %28, false br i1 %29, label LBL_10, label LBL_11 LBL_10: %30 = sext i32 %sv_0.1.reload to i64 store i64 0, i64* %storemerge7.reg2mem br label LBL_12 LBL_11: call void @exit(i32 1) unreachable LBL_12: %31 = call i32 @fwrite(i64* bitcast ([51 x i8]* @gv_5 to i64*), i32 1, i32 50, %_IO_FILE* %27) %32 = icmp eq i32 %31, 50 br i1 %32, label LBL_14, label LBL_13 LBL_13: call void @exit(i32 1) unreachable LBL_14: %storemerge7.reload = load i64, i64* %storemerge7.reg2mem %33 = add nuw i64 %storemerge7.reload, 1 %34 = icmp ult i64 %33, %30 store i64 %33, i64* %storemerge7.reg2mem br i1 %34, label LBL_12, label LBL_15 LBL_15: %35 = call i32 @fclose(%_IO_FILE* nonnull %27) br label LBL_16 LBL_16: %36 = call i64 @FUNC(i64 40) %37 = icmp eq i64 %0, %36 store i64 0, i64* %rax.0.reg2mem br i1 %37, label LBL_18, label LBL_17 LBL_17: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_18 LBL_18: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder %_IO_FILE* %27, { 1, 0, 2 } uselistorder i32 %12, { 1, 0 } uselistorder i32 %4, { 2, 0, 1, 3 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 3, 2, 1 } uselistorder i32* %sv_0.1.reg2mem, { 0, 2, 1, 3 } uselistorder i64* %storemerge7.reg2mem, { 1, 0, 2 } uselistorder label LBL_12, { 1, 0 } uselistorder label LBL_6, { 1, 0, 2 } uselistorder label LBL_5, { 1, 2, 0 } }
0
juliet-test-suite-c
CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_listen_socket_03-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge7.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 100) %2 = icmp eq i64* %1, null %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %4 = bitcast i64* %1 to i8* store i8 0, i8* %4, align 1 %5 = call i32 @strlen(i8* %4) %6 = call i32 @socket(i32 2, i32 1, i32 6) %7 = icmp eq i32 %6, -1 br i1 %7, label LBL_13, label LBL_3 LBL_3: %8 = call i64* @memset(i64* nonnull %sv_0, i32 0, i32 16) store i64 2, i64* %sv_0, align 8 %9 = call i16 @htons(i16 27015) %10 = bitcast i64* %sv_0 to %sockaddr* %11 = call i32 @bind(i32 %6, %sockaddr* nonnull %10, i32 16) %12 = icmp eq i32 %11, -1 br i1 %12, label LBL_11, label LBL_4 LBL_4: %13 = call i32 @listen(i32 %6, i32 5) %14 = icmp eq i32 %13, -1 br i1 %14, label LBL_11, label LBL_5 LBL_5: %15 = call i32 @accept(i32 %6, %sockaddr* null, i32* null) %16 = icmp eq i32 %15, -1 br i1 %16, label LBL_11, label LBL_6 LBL_6: %17 = sext i32 %5 to i64 %18 = ptrtoint i64* %1 to i64 %19 = add i64 %17, %18 %20 = inttoptr i64 %19 to i64* %21 = sub i32 99, %5 %22 = call i32 @recv(i32 %15, i64* %20, i32 %21, i32 0) %23 = add i32 %22, 1 %24 = icmp ult i32 %23, 2 br i1 %24, label LBL_12, label LBL_7 LBL_7: %25 = sext i32 %22 to i64 %26 = add i64 %19, %25 %27 = inttoptr i64 %26 to i8* store i8 0, i8* %27, align 1 %28 = call i8* @strchr(i8* nonnull %4, i32 13) %29 = icmp eq i8* %28, null br i1 %29, label LBL_9, label LBL_8 LBL_8: store i8 0, i8* %28, align 1 br label LBL_9 LBL_9: %30 = call i8* @strchr(i8* nonnull %4, i32 10) %31 = icmp eq i8* %30, null br i1 %31, label LBL_12, label LBL_10 LBL_10: store i8 0, i8* %30, align 1 br label LBL_12 LBL_11: %32 = call i32 @close(i32 %6) br label LBL_13 LBL_12: %33 = call i32 @close(i32 %6) %34 = call i32 @close(i32 %15) br label LBL_13 LBL_13: %35 = call i32 @strlen(i8* nonnull %4) %36 = icmp eq i32 %35, 0 br i1 %36, label LBL_18, label LBL_14 LBL_14: %37 = ptrtoint i64* %1 to i64 store i64 0, i64* %storemerge7.reg2mem br label LBL_15 LBL_15: %storemerge7.reload = load i64, i64* %storemerge7.reg2mem %38 = add i64 %storemerge7.reload, %37 %39 = inttoptr i64 %38 to i8* %40 = load i8, i8* %39, align 1 %41 = icmp eq i8 %40, 83 %42 = icmp eq i1 %41, false br i1 %42, label LBL_17, label LBL_16 LBL_16: %43 = call i64 @FUNC(i64 ptrtoint ([17 x i8]* @gv_0 to i64)) br label LBL_18 LBL_17: %44 = add nuw i64 %storemerge7.reload, 1 %45 = call i32 @strlen(i8* %4) %46 = sext i32 %45 to i64 %47 = icmp ult i64 %44, %46 store i64 %44, i64* %storemerge7.reg2mem br i1 %47, label LBL_15, label LBL_18 LBL_18: call void @free(i64* %1) %48 = call i64 @FUNC(i64 40) %49 = icmp eq i64 %0, %48 store i64 0, i64* %rax.0.reg2mem br i1 %49, label LBL_20, label LBL_19 LBL_19: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_20 LBL_20: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %22, { 1, 0 } uselistorder i32 %6, { 4, 0, 1, 2, 3, 5 } uselistorder i8* %4, { 3, 0, 1, 2, 5, 4 } uselistorder i64* %1, { 1, 0, 2, 4, 3 } uselistorder i64* %sv_0, { 0, 2, 1 } uselistorder i64* %storemerge7.reg2mem, { 1, 0, 2 } uselistorder void (i64*)* @free, { 1, 0, 2 } uselistorder i32 (i32)* @close, { 5, 4, 0, 3, 2, 1, 6 } uselistorder i8* (i8*, i32)* @strchr, { 3, 2, 1, 0, 4 } uselistorder i32 (i32, i64*, i32, i32)* @recv, { 1, 0, 2 } uselistorder i32 (i32, %sockaddr*, i32*)* @accept, { 1, 0, 2 } uselistorder i32 (i32, i32)* @listen, { 1, 0, 2 } uselistorder i32 (i32, %sockaddr*, i32)* @bind, { 1, 0, 2 } uselistorder i16 (i16)* @htons, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } uselistorder i32 (i8*)* @strlen, { 4, 0, 5, 3, 1, 2, 6 } uselistorder i64* (i32)* @malloc, { 1, 0, 2 } uselistorder label LBL_18, { 0, 2, 1 } uselistorder label LBL_15, { 1, 0 } uselistorder label LBL_13, { 2, 1, 0 } }
0
juliet-test-suite-c
CWE194_Unexpected_Sign_Extension__fgets_strncpy_12-bad
CWE194_Unexpected_Sign_Extension__fgets_strncpy_12_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 store i32 99, i32* %sv_0.0.reg2mem br i1 %3, label LBL_4, label LBL_1 LBL_1: store i64 0, i64* %sv_2, align 8 %4 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %5 = bitcast i64* %sv_2 to i8* %6 = call i8* @fgets(i8* nonnull %5, i32 8, %_IO_FILE* %4) %7 = icmp eq i8* %6, null br i1 %7, label LBL_3, label LBL_2 LBL_2: %8 = call i32 @atoi(i8* nonnull %5) %sext = mul i32 %8, 65536 %9 = ashr exact i32 %sext, 16 store i32 %9, i32* %sv_0.0.reg2mem br label LBL_4 LBL_3: %10 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_1 to i64)) store i32 0, i32* %sv_0.0.reg2mem br label LBL_4 LBL_4: %sv_0.0.reload = load i32, i32* %sv_0.0.reg2mem store i64 0, i64* %sv_2, align 8 %11 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 99) %12 = trunc i32 %sv_0.0.reload to i16 %13 = icmp sgt i16 %12, 99 br i1 %13, label LBL_6, label LBL_5 LBL_5: %14 = ptrtoint i64* %sv_3 to i64 %15 = bitcast i64* %sv_2 to i8* %16 = bitcast i64* %sv_1 to i8* %17 = call i8* @strncpy(i8* nonnull %15, i8* nonnull %16, i32 %sv_0.0.reload) %18 = sext i32 %sv_0.0.reload to i64 %19 = add i64 %14, -112 %20 = add i64 %19, %18 %21 = inttoptr i64 %20 to i8* store i8 0, i8* %21, align 1 br label LBL_6 LBL_6: %22 = ptrtoint i64* %sv_2 to i64 %23 = call i64 @FUNC(i64 %22) %24 = call i64 @FUNC(i64 40) %25 = icmp eq i64 %0, %24 store i64 0, i64* %rax.0.reg2mem br i1 %25, label LBL_8, label LBL_7 LBL_7: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_8 LBL_8: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %sv_0.0.reload, { 1, 2, 0 } uselistorder i64* %sv_2, { 2, 0, 3, 1, 4 } uselistorder i32* %sv_0.0.reg2mem, { 0, 3, 2, 1 } uselistorder i8 0, { 1, 2, 0 } uselistorder i32 99, { 1, 0 } uselistorder label LBL_4, { 1, 2, 0 } }
1
juliet-test-suite-c
CWE369_Divide_by_Zero__float_listenSocket_08-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = alloca i128 %rax.0.reg2mem = alloca i64 %sv_0.1.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %1 = load i128, i128* %0 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %2 = call i64 @FUNC(i64 40) %3 = call i128 @FUNC(i128 %1, i128 %1) %4 = call i64 @FUNC(i128 %3) %5 = trunc i64 %4 to i32 %6 = call i64 @FUNC() %7 = trunc i64 %6 to i32 %8 = icmp eq i32 %7, 0 store i32 %5, i32* %sv_0.1.reg2mem br i1 %8, label LBL_9, label LBL_1 LBL_1: %9 = call i32 @socket(i32 2, i32 1, i32 6) %10 = icmp eq i32 %9, -1 store i32 %5, i32* %sv_0.1.reg2mem br i1 %10, label LBL_9, label LBL_2 LBL_2: %11 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %12 = call i16 @htons(i16 27015) %13 = bitcast i64* %sv_2 to %sockaddr* %14 = call i32 @bind(i32 %9, %sockaddr* nonnull %13, i32 16) %15 = icmp eq i32 %14, -1 br i1 %15, label LBL_7, label LBL_3 LBL_3: %16 = call i32 @listen(i32 %9, i32 5) %17 = icmp eq i32 %16, -1 br i1 %17, label LBL_7, label LBL_4 LBL_4: %18 = call i32 @accept(i32 %9, %sockaddr* null, i32* null) %19 = icmp eq i32 %18, -1 br i1 %19, label LBL_7, label LBL_5 LBL_5: %20 = call i32 @recv(i32 %18, i64* nonnull %sv_1, i32 19, i32 0) %21 = add i32 %20, 1 %22 = icmp ult i32 %21, 2 store i32 %5, i32* %sv_0.0.ph.reg2mem br i1 %22, label LBL_8, label LBL_6 LBL_6: %23 = ptrtoint i64* %sv_3 to i64 %24 = sext i32 %20 to i64 %25 = add i64 %23, -32 %26 = add i64 %25, %24 %27 = inttoptr i64 %26 to i8* store i8 0, i8* %27, align 1 %28 = bitcast i64* %sv_1 to i8* %29 = call double @atof(i8* nonnull %28) %30 = fptrunc double %29 to float %31 = bitcast float %30 to i32 %32 = sext i32 %31 to i128 %33 = call i128 @FUNC(i128 %32) %34 = call i64 @FUNC(i128 %33) %35 = trunc i64 %34 to i32 store i32 %35, i32* %sv_0.0.ph.reg2mem br label LBL_8 LBL_7: %36 = call i32 @close(i32 %9) store i32 %5, i32* %sv_0.1.reg2mem br label LBL_9 LBL_8: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %37 = call i32 @close(i32 %9) %38 = call i32 @close(i32 %18) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.reg2mem br label LBL_9 LBL_9: %39 = call i64 @FUNC() %40 = trunc i64 %39 to i32 %41 = icmp eq i32 %40, 0 br i1 %41, label LBL_11, label LBL_10 LBL_10: %sv_0.1.reload = load i32, i32* %sv_0.1.reg2mem %42 = call i128 @__asm_movss.1(i32 %sv_0.1.reload) %43 = call i128 @__asm_movss.1(i32 2147483647) %44 = call i128 @FUNC(i128 %42, i128 %43) %45 = call i128 @FUNC(i128 %44) %46 = load i128, i128* @gv_0, align 8 call void @FUNC(i128 %45, i128 %46) %47 = call i128 @FUNC(i128 %43, i128 %43) %48 = call i128 @__asm_cvtss2sd.2(i32 %sv_0.1.reload) %49 = call i128 @FUNC(i64 4636737291354636288) %50 = call i128 @FUNC(i128 %49, i128 %48) %51 = call i32 @FUNC(i128 %50) %52 = zext i32 %51 to i64 %53 = call i64 @FUNC(i64 %52) br label LBL_11 LBL_11: %54 = call i64 @FUNC(i64 40) %55 = icmp eq i64 %2, %54 store i64 0, i64* %rax.0.reg2mem br i1 %55, label LBL_13, label LBL_12 LBL_12: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_13 LBL_13: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i128 %43, { 1, 0, 2 } uselistorder i32 %sv_0.1.reload, { 1, 0 } uselistorder i32 %20, { 1, 0 } uselistorder i32 %9, { 4, 0, 1, 2, 3, 5 } uselistorder i32 %5, { 1, 3, 0, 2 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32* %sv_0.1.reg2mem, { 0, 3, 2, 1, 4 } uselistorder i128* @gv_0, { 1, 0 } uselistorder i32 (i32)* @close, { 5, 4, 0, 3, 2, 1, 6 } uselistorder double (i8*)* @atof, { 1, 0, 2 } uselistorder i32 (i32, i64*, i32, i32)* @recv, { 1, 0, 2 } uselistorder i32 (i32, %sockaddr*, i32*)* @accept, { 1, 0, 2 } uselistorder i32 (i32, i32)* @listen, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } uselistorder i32 (i32, i32, i32)* @socket, { 1, 0, 2 } uselistorder label LBL_9, { 2, 1, 0, 3 } }
0
juliet-test-suite-c
CWE127_Buffer_Underread__char_declare_memcpy_13-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i64 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @memset(i64* nonnull %sv_2, i32 65, i32 99) %2 = load i32, i32* inttoptr (i64 8360 to i32*), align 8 %3 = icmp eq i32 %2, 5 br i1 %3, label LBL_2, label LBL_1 LBL_1: %4 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_0 to i64)) br label LBL_3 LBL_2: %5 = ptrtoint i64* %sv_2 to i64 store i64 %5, i64* %sv_0.0.reg2mem br label LBL_3 LBL_3: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem %6 = call i64* @memset(i64* nonnull %sv_1, i32 67, i32 99) %7 = inttoptr i64 %sv_0.0.reload to i64* %8 = load i64, i64* %7, align 8 store i64 %8, i64* %sv_1, align 8 %9 = ptrtoint i64* %sv_1 to i64 %10 = call i64 @FUNC(i64 %9) %11 = call i64 @FUNC(i64 40) %12 = icmp eq i64 %0, %11 store i64 0, i64* %rax.0.reg2mem br i1 %12, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %sv_2, { 1, 0 } uselistorder i64* %sv_1, { 1, 2, 0 } }
0
juliet-test-suite-c
CWE122_Heap_Based_Buffer_Overflow__c_CWE129_connect_socket_05-bad
CWE122_Heap_Based_Buffer_Overflow__c_CWE129_connect_socket_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %indvars.iv.reg2mem = alloca i64 %indvars.iv6.reg2mem = alloca i64 %sv_0.1.ph.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 0 br i1 %2, label LBL_15, label LBL_1 LBL_1: %3 = call i32 @socket(i32 2, i32 1, i32 6) %4 = icmp eq i32 %3, -1 store i32 -1, i32* %sv_0.1.ph.reg2mem br i1 %4, label LBL_6, label LBL_2 LBL_2: %5 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %6 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @gv_1, i64 0, i64 0)) %7 = call i16 @htons(i16 27015) %8 = bitcast i64* %sv_2 to %sockaddr* %9 = call i32 @connect(i32 %3, %sockaddr* nonnull %8, i32 16) %10 = icmp eq i32 %9, -1 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %10, label LBL_5, label LBL_3 LBL_3: %11 = call i32 @recv(i32 %3, i64* nonnull %sv_1, i32 13, i32 0) %12 = add i32 %11, 1 %13 = icmp ult i32 %12, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %13, label LBL_5, label LBL_4 LBL_4: %14 = ptrtoint i64* %sv_3 to i64 %15 = sext i32 %11 to i64 %16 = add i64 %14, -22 %17 = add i64 %16, %15 %18 = inttoptr i64 %17 to i8* store i8 0, i8* %18, align 1 %19 = bitcast i64* %sv_1 to i8* %20 = call i32 @atoi(i8* nonnull %19) store i32 %20, i32* %sv_0.0.ph.reg2mem br label LBL_5 LBL_5: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %21 = call i32 @close(i32 %3) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.ph.reg2mem br label LBL_6 LBL_6: %.pr = load i32, i32* @gv_0, align 4 %22 = icmp eq i32 %.pr, 0 br i1 %22, label LBL_15, label LBL_7 LBL_7: %sv_0.1.ph.reload = load i32, i32* %sv_0.1.ph.reg2mem %23 = call i64* @malloc(i32 40) %24 = ptrtoint i64* %23 to i64 %25 = icmp eq i64* %23, null %26 = icmp eq i1 %25, false store i64 0, i64* %indvars.iv6.reg2mem br i1 %26, label LBL_9, label LBL_8 LBL_8: call void @exit(i32 -1) unreachable LBL_9: %indvars.iv6.reload = load i64, i64* %indvars.iv6.reg2mem %27 = mul i64 %indvars.iv6.reload, 4 %28 = add i64 %27, %24 %29 = inttoptr i64 %28 to i32* store i32 0, i32* %29, align 4 %indvars.iv.next7 = add nuw nsw i64 %indvars.iv6.reload, 1 %exitcond8 = icmp eq i64 %indvars.iv.next7, 10 store i64 %indvars.iv.next7, i64* %indvars.iv6.reg2mem br i1 %exitcond8, label LBL_10, label LBL_9 LBL_10: %30 = icmp slt i32 %sv_0.1.ph.reload, 0 br i1 %30, label LBL_13, label LBL_11 LBL_11: %31 = sext i32 %sv_0.1.ph.reload to i64 %32 = mul i64 %31, 4 %33 = add i64 %32, %24 %34 = inttoptr i64 %33 to i32* store i32 1, i32* %34, align 4 store i64 0, i64* %indvars.iv.reg2mem br label LBL_12 LBL_12: %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem %35 = mul i64 %indvars.iv.reload, 4 %36 = add i64 %35, %24 %37 = inttoptr i64 %36 to i32* %38 = load i32, i32* %37, align 4 %39 = zext i32 %38 to i64 %40 = call i64 @FUNC(i64 %39) %indvars.iv.next = add nuw nsw i64 %indvars.iv.reload, 1 %exitcond = icmp eq i64 %indvars.iv.next, 10 store i64 %indvars.iv.next, i64* %indvars.iv.reg2mem br i1 %exitcond, label LBL_14, label LBL_12 LBL_13: %41 = call i64 @FUNC(i64 ptrtoint ([32 x i8]* @gv_2 to i64)) br label LBL_14 LBL_14: call void @free(i64* %23) br label LBL_15 LBL_15: %42 = call i64 @FUNC(i64 40) %43 = icmp eq i64 %0, %42 store i64 0, i64* %rax.0.reg2mem br i1 %43, label LBL_17, label LBL_16 LBL_16: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_17 LBL_17: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %24, { 1, 0, 2 } uselistorder i32 %sv_0.1.ph.reload, { 1, 0 } uselistorder i32 %11, { 1, 0 } uselistorder i32 %3, { 2, 0, 1, 3 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 3, 2, 1 } uselistorder i64* %indvars.iv6.reg2mem, { 2, 0, 1 } uselistorder i64* %indvars.iv.reg2mem, { 1, 0, 2 } uselistorder i64 10, { 1, 0 } uselistorder i32 -1, { 5, 2, 1, 3, 0, 4 } uselistorder label LBL_15, { 1, 2, 0 } uselistorder label LBL_14, { 1, 0 } uselistorder label LBL_9, { 1, 0 } uselistorder label LBL_6, { 1, 0 } uselistorder label LBL_5, { 1, 2, 0 } }
1
juliet-test-suite-c
CWE369_Divide_by_Zero__int_listen_socket_modulo_05-bad
CWE369_Divide_by_Zero__int_listen_socket_modulo_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.1.ph.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 0 br i1 %2, label LBL_11, label LBL_1 LBL_1: %3 = call i32 @socket(i32 2, i32 1, i32 6) %4 = icmp eq i32 %3, -1 store i32 -1, i32* %sv_0.1.ph.reg2mem br i1 %4, label LBL_9, label LBL_2 LBL_2: %5 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %6 = call i16 @htons(i16 27015) %7 = bitcast i64* %sv_2 to %sockaddr* %8 = call i32 @bind(i32 %3, %sockaddr* nonnull %7, i32 16) %9 = icmp eq i32 %8, -1 br i1 %9, label LBL_7, label LBL_3 LBL_3: %10 = call i32 @listen(i32 %3, i32 5) %11 = icmp eq i32 %10, -1 br i1 %11, label LBL_7, label LBL_4 LBL_4: %12 = call i32 @accept(i32 %3, %sockaddr* null, i32* null) %13 = icmp eq i32 %12, -1 br i1 %13, label LBL_7, label LBL_5 LBL_5: %14 = call i32 @recv(i32 %12, i64* nonnull %sv_1, i32 13, i32 0) %15 = add i32 %14, 1 %16 = icmp ult i32 %15, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %16, label LBL_8, label LBL_6 LBL_6: %17 = ptrtoint i64* %sv_3 to i64 %18 = sext i32 %14 to i64 %19 = add i64 %17, -22 %20 = add i64 %19, %18 %21 = inttoptr i64 %20 to i8* store i8 0, i8* %21, align 1 %22 = bitcast i64* %sv_1 to i8* %23 = call i32 @atoi(i8* nonnull %22) store i32 %23, i32* %sv_0.0.ph.reg2mem br label LBL_8 LBL_7: %24 = call i32 @close(i32 %3) store i32 -1, i32* %sv_0.1.ph.reg2mem br label LBL_9 LBL_8: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %25 = call i32 @close(i32 %3) %26 = call i32 @close(i32 %12) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.ph.reg2mem br label LBL_9 LBL_9: %.pr = load i32, i32* @gv_0, align 4 %27 = icmp eq i32 %.pr, 0 br i1 %27, label LBL_11, label LBL_10 LBL_10: %sv_0.1.ph.reload = load i32, i32* %sv_0.1.ph.reg2mem %28 = urem i32 100, %sv_0.1.ph.reload %29 = zext i32 %28 to i64 %30 = call i64 @FUNC(i64 %29) br label LBL_11 LBL_11: %31 = call i64 @FUNC(i64 40) %32 = icmp eq i64 %0, %31 store i64 0, i64* %rax.0.reg2mem br i1 %32, label LBL_13, label LBL_12 LBL_12: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_13 LBL_13: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %14, { 1, 0 } uselistorder i32 %3, { 4, 0, 1, 2, 3, 5 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32* %sv_0.1.ph.reg2mem, { 0, 2, 3, 1 } uselistorder i32 (i32)* @close, { 2, 1, 0, 3 } uselistorder i32 -1, { 1, 2, 3, 4, 5, 0, 6 } uselistorder label LBL_11, { 1, 2, 0 } uselistorder label LBL_9, { 2, 1, 0 } }
1
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_13-bad
CWE121_Stack_Based_Buffer_Overflow__CWE805_struct_declare_memmove_13_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = alloca i64 %rax.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %1 = load i64, i64* %0 %sv_2 = alloca i64, align 8 %2 = ptrtoint i64* %sv_2 to i64 %3 = call i64 @FUNC(i64 40) %4 = load i32, i32* inttoptr (i64 8336 to i32*), align 16 %5 = icmp eq i32 %4, 5 store i64 0, i64* %storemerge1.reg2mem br label LBL_1 LBL_1: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %6 = mul i64 %storemerge1.reload, 8 %7 = add i64 %6, %2 %8 = add i64 %7, -816 %9 = inttoptr i64 %8 to i32* store i32 0, i32* %9, align 8 %10 = add i64 %7, -812 %11 = inttoptr i64 %10 to i32* store i32 0, i32* %11, align 4 %12 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %12, 100 store i64 %12, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_2, label LBL_1 LBL_2: %13 = ptrtoint i64* %sv_1 to i64 %14 = icmp eq i1 %5, false %spec.select = select i1 %14, i64 %1, i64 %13 %15 = inttoptr i64 %spec.select to i64* %16 = call i64* @memmove(i64* %15, i64* nonnull %sv_0, i32 ptrtoint (i32* @gv_0 to i32)) %17 = call i64 @FUNC(i64 %spec.select) %18 = call i64 @FUNC(i64 40) %19 = icmp eq i64 %3, %18 store i64 0, i64* %rax.0.reg2mem br i1 %19, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %storemerge1.reg2mem, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE190_Integer_Overflow__int64_t_fscanf_multiply_08-bad
CWE190_Integer_Overflow__int64_t_fscanf_multiply_08_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 0, i64* %sv_0, align 8 %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 br i1 %3, label LBL_2, label LBL_1 LBL_1: %4 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %5 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @gv_1, i64 0, i64 0), i64* nonnull %sv_0) br label LBL_2 LBL_2: %6 = call i64 @FUNC() %7 = trunc i64 %6 to i32 %8 = icmp eq i32 %7, 0 %9 = load i64, i64* %sv_0, align 8 %10 = icmp slt i64 %9, 1 %or.cond = or i1 %8, %10 br i1 %or.cond, label LBL_4, label LBL_3 LBL_3: %11 = mul i64 %9, 2 %12 = call i64 @FUNC(i64 %11) br label LBL_4 LBL_4: %13 = call i64 @FUNC(i64 40) %14 = icmp eq i64 %0, %13 store i64 0, i64* %rax.0.reg2mem br i1 %14, label LBL_6, label LBL_5 LBL_5: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_6 LBL_6: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 ()* @staticReturnsTrue, { 1, 0 } }
1
juliet-test-suite-c
CWE590_Free_Memory_Not_on_Heap__free_struct_alloca_14-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %sv_0.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i64 %0 = load i32, i32* @gv_0, align 4 %1 = icmp eq i32 %0, 5 %2 = icmp eq i1 %1, false store i64 0, i64* %sv_0.0.reg2mem br i1 %2, label LBL_4, label LBL_1 LBL_1: %3 = call i64* @malloc(i32 ptrtoint (i32* @gv_1 to i32)) %4 = ptrtoint i64* %3 to i64 %5 = icmp eq i64* %3, null %6 = icmp eq i1 %5, false store i64 0, i64* %storemerge1.reg2mem br i1 %6, label LBL_3, label LBL_2 LBL_2: %7 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_2 to i64)) call void @exit(i32 1) unreachable LBL_3: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %8 = mul i64 %storemerge1.reload, 8 %9 = add i64 %8, %4 %10 = inttoptr i64 %9 to i32* store i32 1, i32* %10, align 4 %11 = add i64 %9, 4 %12 = inttoptr i64 %11 to i32* store i32 1, i32* %12, align 4 %13 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %13, 100 store i64 %13, i64* %storemerge1.reg2mem store i64 %4, i64* %sv_0.0.reg2mem br i1 %exitcond, label LBL_4, label LBL_3 LBL_4: %sv_0.0.reload = load i64, i64* %sv_0.0.reg2mem %14 = call i64 @FUNC(i64 %sv_0.0.reload) %15 = inttoptr i64 %sv_0.0.reload to i64* call void @free(i64* %15) ret i64 ptrtoint (i32* @1 to i64) uselistorder i64* %storemerge1.reg2mem, { 2, 0, 1 } uselistorder void (i64*)* @free, { 1, 0, 2 } uselistorder i64 (i64)* @printStructLine, { 1, 0 } uselistorder void (i32)* @exit, { 1, 0, 2 } uselistorder i64* (i32)* @malloc, { 1, 0, 2 } uselistorder label LBL_3, { 1, 0 } }
0
juliet-test-suite-c
CWE78_OS_Command_Injection__char_listen_socket_execl_14-bad
CWE78_OS_Command_Injection__char_listen_socket_execl_14_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 2126700, i64* %sv_1, align 8 %1 = load i32, i32* inttoptr (i64 16404 to i32*), align 4 %2 = icmp eq i32 %1, 5 %3 = icmp eq i1 %2, false br i1 %3, label LBL_12, label LBL_1 LBL_1: %4 = bitcast i64* %sv_1 to i8* %5 = call i32 @strlen(i8* nonnull %4) %6 = call i32 @socket(i32 2, i32 1, i32 6) %7 = icmp eq i32 %6, -1 br i1 %7, label LBL_12, label LBL_2 LBL_2: %8 = call i64* @memset(i64* nonnull %sv_0, i32 0, i32 16) store i64 2, i64* %sv_0, align 8 %9 = call i16 @htons(i16 27015) %10 = bitcast i64* %sv_0 to %sockaddr* %11 = call i32 @bind(i32 %6, %sockaddr* nonnull %10, i32 16) %12 = icmp eq i32 %11, -1 br i1 %12, label LBL_10, label LBL_3 LBL_3: %13 = call i32 @listen(i32 %6, i32 5) %14 = icmp eq i32 %13, -1 br i1 %14, label LBL_10, label LBL_4 LBL_4: %15 = call i32 @accept(i32 %6, %sockaddr* null, i32* null) %16 = icmp eq i32 %15, -1 br i1 %16, label LBL_10, label LBL_5 LBL_5: %17 = sext i32 %5 to i64 %18 = ptrtoint i64* %sv_1 to i64 %19 = add i64 %17, %18 %20 = inttoptr i64 %19 to i64* %21 = sub i32 99, %5 %22 = call i32 @recv(i32 %15, i64* %20, i32 %21, i32 0) %23 = add i32 %22, 1 %24 = icmp ult i32 %23, 2 br i1 %24, label LBL_11, label LBL_6 LBL_6: %25 = sext i32 %22 to i64 %26 = add i64 %19, %25 %27 = inttoptr i64 %26 to i8* store i8 0, i8* %27, align 1 %28 = call i8* @strchr(i8* nonnull %4, i32 13) %29 = icmp eq i8* %28, null br i1 %29, label LBL_8, label LBL_7 LBL_7: store i8 0, i8* %28, align 1 br label LBL_8 LBL_8: %30 = call i8* @strchr(i8* nonnull %4, i32 10) %31 = icmp eq i8* %30, null br i1 %31, label LBL_11, label LBL_9 LBL_9: store i8 0, i8* %30, align 1 br label LBL_11 LBL_10: %32 = call i32 @close(i32 %6) br label LBL_12 LBL_11: %33 = call i32 @close(i32 %6) %34 = call i32 @close(i32 %15) br label LBL_12 LBL_12: %35 = call i32 (i8*, i8*, ...) @execl(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @gv_0, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @gv_0, i64 0, i64 0)) %36 = call i64 @FUNC(i64 40) %37 = icmp eq i64 %0, %36 store i64 0, i64* %rax.0.reg2mem br i1 %37, label LBL_14, label LBL_13 LBL_13: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_14 LBL_14: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %22, { 1, 0 } uselistorder i32 %6, { 4, 0, 1, 2, 3, 5 } uselistorder i64* %sv_0, { 0, 2, 1 } uselistorder i32 (i32)* @close, { 2, 1, 0, 3 } uselistorder i8* (i8*, i32)* @strchr, { 1, 0, 2 } uselistorder i32 5, { 1, 0 } uselistorder label LBL_12, { 2, 1, 0, 3 } }
1
juliet-test-suite-c
CWE195_Signed_to_Unsigned_Conversion_Error__connect_socket_strncpy_05-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 0 store i32 99, i32* %sv_0.0.reg2mem br i1 %2, label LBL_2, label LBL_1 LBL_1: %3 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_1 to i64)) store i32 -1, i32* %sv_0.0.reg2mem br label LBL_2 LBL_2: %4 = ptrtoint i64* %sv_3 to i64 %sv_0.0.reload = load i32, i32* %sv_0.0.reg2mem store i64 0, i64* %sv_2, align 8 %5 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 99) %6 = bitcast i64* %sv_2 to i8* %7 = bitcast i64* %sv_1 to i8* %8 = call i8* @strncpy(i8* nonnull %6, i8* nonnull %7, i32 %sv_0.0.reload) %9 = sext i32 %sv_0.0.reload to i64 %10 = add i64 %4, -112 %11 = add i64 %10, %9 %12 = inttoptr i64 %11 to i8* store i8 0, i8* %12, align 1 %13 = ptrtoint i64* %sv_2 to i64 %14 = call i64 @FUNC(i64 %13) %15 = call i64 @FUNC(i64 40) %16 = icmp eq i64 %0, %15 store i64 0, i64* %rax.0.reg2mem br i1 %16, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %sv_0.0.reload, { 1, 0 } uselistorder i64* %sv_2, { 1, 0, 2 } uselistorder i32* %sv_0.0.reg2mem, { 0, 2, 1 } uselistorder label LBL_2, { 1, 0 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE805_char_alloca_ncpy_32-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = ptrtoint i64* %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = add i64 %0, -161 %3 = and i64 %2, -16 %4 = inttoptr i64 %3 to i8* store i8 0, i8* %4, align 16 %5 = call i64* @memset(i64* nonnull %sv_0, i32 67, i32 99) %6 = bitcast i64* %sv_0 to i8* %7 = call i8* @strncpy(i8* %4, i8* nonnull %6, i32 99) %8 = add i64 %3, 99 %9 = inttoptr i64 %8 to i8* store i8 0, i8* %9, align 1 %10 = call i64 @FUNC(i64 %3) %11 = call i64 @FUNC(i64 40) %12 = icmp eq i64 %1, %11 store i64 0, i64* %rax.0.reg2mem br i1 %12, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %3, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE590_Free_Memory_Not_on_Heap__free_int64_t_declare_12-bad
CWE590_Free_Memory_Not_on_Heap__free_int64_t_declare_12_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge1.ptr.reg2mem = alloca i64* %storemerge24.reg2mem = alloca i64 %storemerge5.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 br i1 %3, label LBL_3, label LBL_1 LBL_1: %4 = ptrtoint i64* %sv_1 to i64 %5 = add i64 %4, -816 store i64 0, i64* %storemerge5.reg2mem br label LBL_2 LBL_2: %storemerge5.reload = load i64, i64* %storemerge5.reg2mem %6 = mul i64 %storemerge5.reload, 8 %7 = add i64 %5, %6 %8 = inttoptr i64 %7 to i64* store i64 5, i64* %8, align 8 %9 = add nuw nsw i64 %storemerge5.reload, 1 %exitcond6 = icmp eq i64 %9, 100 store i64 %9, i64* %storemerge5.reg2mem store i64* %sv_0, i64** %storemerge1.ptr.reg2mem br i1 %exitcond6, label LBL_6, label LBL_2 LBL_3: %10 = call i64* @malloc(i32 ptrtoint (i32* @gv_0 to i32)) %11 = ptrtoint i64* %10 to i64 %12 = icmp eq i64* %10, null %13 = icmp eq i1 %12, false store i64 0, i64* %storemerge24.reg2mem br i1 %13, label LBL_5, label LBL_4 LBL_4: %14 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_1 to i64)) call void @exit(i32 1) unreachable LBL_5: %storemerge24.reload = load i64, i64* %storemerge24.reg2mem %15 = mul i64 %storemerge24.reload, 8 %16 = add i64 %15, %11 %17 = inttoptr i64 %16 to i64* store i64 5, i64* %17, align 8 %18 = add nuw nsw i64 %storemerge24.reload, 1 %exitcond = icmp eq i64 %18, 100 store i64 %18, i64* %storemerge24.reg2mem store i64* %10, i64** %storemerge1.ptr.reg2mem br i1 %exitcond, label LBL_6, label LBL_5 LBL_6: %storemerge1.ptr.reload = load i64*, i64** %storemerge1.ptr.reg2mem %19 = load i64, i64* %storemerge1.ptr.reload, align 8 %20 = call i64 @FUNC(i64 %19) call void @free(i64* %storemerge1.ptr.reload) %21 = call i64 @FUNC(i64 40) %22 = icmp eq i64 %0, %21 store i64 0, i64* %rax.0.reg2mem br i1 %22, label LBL_8, label LBL_7 LBL_7: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_8 LBL_8: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %storemerge1.ptr.reload, { 1, 0 } uselistorder i64* %storemerge5.reg2mem, { 1, 0, 2 } uselistorder i64* %storemerge24.reg2mem, { 2, 0, 1 } uselistorder i64** %storemerge1.ptr.reg2mem, { 0, 2, 1 } uselistorder i64 100, { 1, 0 } uselistorder label LBL_6, { 1, 0 } uselistorder label LBL_5, { 1, 0 } }
1
juliet-test-suite-c
CWE190_Integer_Overflow__int_rand_postinc_12-bad
CWE190_Integer_Overflow__int_rand_postinc_12_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge1.reg2mem = alloca i32 %0 = call i64 @FUNC() %1 = trunc i64 %0 to i32 %2 = icmp eq i32 %1, 0 store i32 2, i32* %storemerge1.reg2mem br i1 %2, label LBL_2, label LBL_1 LBL_1: %3 = call i32 @rand() %4 = urem i32 %3, 2 %5 = icmp eq i32 %4, 0 %6 = call i32 @rand() %7 = mul i32 %6, 1073741824 %8 = call i32 @rand() %9 = mul i32 %8, 32768 %10 = xor i32 %9, %7 %11 = call i32 @rand() %12 = xor i32 %10, %11 %13 = sext i1 %5 to i32 %storemerge.in = xor i32 %12, %13 store i32 %storemerge.in, i32* %storemerge1.reg2mem br label LBL_2 LBL_2: %storemerge1.reload = load i32, i32* %storemerge1.reg2mem %14 = call i64 @FUNC() %15 = trunc i64 %14 to i32 %16 = icmp eq i32 %15, 0 br i1 %16, label LBL_4, label LBL_3 LBL_3: %17 = add i32 %storemerge1.reload, 1 %18 = zext i32 %17 to i64 %19 = call i64 @FUNC(i64 %18) store i64 %19, i64* %rax.0.reg2mem br label LBL_7 LBL_4: %20 = icmp eq i32 %storemerge1.reload, 2147483647 br i1 %20, label LBL_6, label LBL_5 LBL_5: %21 = add i32 %storemerge1.reload, 1 %22 = zext i32 %21 to i64 %23 = call i64 @FUNC(i64 %22) store i64 %23, i64* %rax.0.reg2mem br label LBL_7 LBL_6: %24 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_0 to i64)) store i64 %24, i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %storemerge1.reload, { 0, 2, 1 } uselistorder i32* %storemerge1.reg2mem, { 0, 2, 1 } uselistorder i64* %rax.0.reg2mem, { 0, 3, 2, 1 } uselistorder i64 (i64)* @printIntLine, { 1, 0 } uselistorder i64 ()* @globalReturnsTrueOrFalse, { 1, 0 } uselistorder label LBL_2, { 1, 0 } }
1
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__CWE806_char_alloca_memmove_10-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %.pre-phi.reg2mem = alloca i64* %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = ptrtoint i64* %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = add i64 %0, -97 %3 = and i64 %2, -16 store i64 %3, i64* %sv_1, align 8 %4 = load i32, i32* @gv_0, align 4 %5 = icmp eq i32 %4, 0 br i1 %5, label LBL_2, label LBL_1 LBL_1: %6 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_1 to i64)) %.pre = inttoptr i64 %3 to i64* store i64* %.pre, i64** %.pre-phi.reg2mem br label LBL_3 LBL_2: %7 = inttoptr i64 %3 to i64* %8 = call i64* @memset(i64* %7, i32 65, i32 49) %9 = add i64 %3, 49 %10 = inttoptr i64 %9 to i8* store i8 0, i8* %10, align 1 store i64* %7, i64** %.pre-phi.reg2mem br label LBL_3 LBL_3: %11 = inttoptr i64 %3 to i8* %.pre-phi.reload = load i64*, i64** %.pre-phi.reg2mem store i64 0, i64* %sv_0, align 8 %12 = call i32 @strlen(i8* %11) %13 = call i64* @memmove(i64* nonnull %sv_0, i64* %.pre-phi.reload, i32 %12) %14 = call i64 @FUNC(i64 %3) %15 = call i64 @FUNC(i64 40) %16 = icmp eq i64 %1, %15 store i64 0, i64* %rax.0.reg2mem br i1 %16, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %3, { 2, 4, 3, 1, 0, 5 } uselistorder i64** %.pre-phi.reg2mem, { 0, 2, 1 } }
0
juliet-test-suite-c
CWE416_Use_After_Free__malloc_free_int64_t_01-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %storemerge1.reg2mem = alloca i64 %0 = call i64* @malloc(i32 ptrtoint (i32* @gv_0 to i32)) %1 = ptrtoint i64* %0 to i64 %2 = icmp eq i64* %0, null %3 = icmp eq i1 %2, false store i64 0, i64* %storemerge1.reg2mem br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %4 = mul i64 %storemerge1.reload, 8 %5 = add i64 %4, %1 %6 = inttoptr i64 %5 to i64* store i64 5, i64* %6, align 8 %7 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %7, 100 store i64 %7, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_3, label LBL_2 LBL_3: call void @free(i64* %0) ret i64 ptrtoint (i32* @1 to i64) uselistorder i64* %storemerge1.reg2mem, { 2, 0, 1 } uselistorder label LBL_2, { 1, 0 } }
0
juliet-test-suite-c
CWE369_Divide_by_Zero__int_listen_socket_modulo_01-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.0479.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i32 @socket(i32 2, i32 1, i32 6) %2 = icmp eq i32 %1, -1 store i32 -1, i32* %sv_0.0479.reg2mem br i1 %2, label LBL_8, label LBL_1 LBL_1: %3 = call i64* @memset(i64* nonnull %sv_2, i32 0, i32 16) store i64 2, i64* %sv_2, align 8 %4 = call i16 @htons(i16 27015) %5 = bitcast i64* %sv_2 to %sockaddr* %6 = call i32 @bind(i32 %1, %sockaddr* nonnull %5, i32 16) %7 = icmp eq i32 %6, -1 br i1 %7, label LBL_6, label LBL_2 LBL_2: %8 = call i32 @listen(i32 %1, i32 5) %9 = icmp eq i32 %8, -1 br i1 %9, label LBL_6, label LBL_3 LBL_3: %10 = call i32 @accept(i32 %1, %sockaddr* null, i32* null) %11 = icmp eq i32 %10, -1 br i1 %11, label LBL_6, label LBL_4 LBL_4: %12 = call i32 @recv(i32 %10, i64* nonnull %sv_1, i32 13, i32 0) %13 = add i32 %12, 1 %14 = icmp ult i32 %13, 2 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %14, label LBL_7, label LBL_5 LBL_5: %15 = ptrtoint i64* %sv_3 to i64 %16 = sext i32 %12 to i64 %17 = add i64 %15, -22 %18 = add i64 %17, %16 %19 = inttoptr i64 %18 to i8* store i8 0, i8* %19, align 1 %20 = bitcast i64* %sv_1 to i8* %21 = call i32 @atoi(i8* nonnull %20) store i32 %21, i32* %sv_0.0.ph.reg2mem br label LBL_7 LBL_6: %22 = call i32 @close(i32 %1) store i32 -1, i32* %sv_0.0479.reg2mem br label LBL_8 LBL_7: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %23 = call i32 @close(i32 %1) %24 = call i32 @close(i32 %10) %25 = icmp eq i32 %sv_0.0.ph.reload, 0 store i32 %sv_0.0.ph.reload, i32* %sv_0.0479.reg2mem br i1 %25, label LBL_9, label LBL_8 LBL_8: %sv_0.0479.reload = load i32, i32* %sv_0.0479.reg2mem %26 = urem i32 100, %sv_0.0479.reload %27 = zext i32 %26 to i64 %28 = call i64 @FUNC(i64 %27) br label LBL_10 LBL_9: %29 = call i64 @FUNC(i64 ptrtoint ([38 x i8]* @gv_0 to i64)) br label LBL_10 LBL_10: %30 = call i64 @FUNC(i64 40) %31 = icmp eq i64 %0, %30 store i64 0, i64* %rax.0.reg2mem br i1 %31, label LBL_12, label LBL_11 LBL_11: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_12 LBL_12: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %12, { 1, 0 } uselistorder i32 %1, { 4, 0, 1, 2, 3, 5 } uselistorder i64* %sv_2, { 0, 2, 1 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 1 } uselistorder i32* %sv_0.0479.reg2mem, { 0, 3, 2, 1 } uselistorder i64 (i64)* @printIntLine, { 1, 0 } uselistorder i32 (i32)* @close, { 2, 1, 0, 3 } uselistorder i32 -1, { 1, 2, 3, 4, 5, 0, 6 } uselistorder label LBL_8, { 2, 1, 0 } uselistorder label LBL_7, { 1, 0 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__src_char_declare_cat_32-good
goodG2B
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = bitcast i64* %sv_1 to i8* %2 = ptrtoint i64* %sv_1 to i64 %3 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 49) %4 = add i64 %2, 49 %5 = inttoptr i64 %4 to i8* store i8 0, i8* %5, align 1 store i64 0, i64* %sv_0, align 8 %6 = bitcast i64* %sv_0 to i8* %7 = call i8* @strcat(i8* nonnull %6, i8* nonnull %1) %8 = call i64 @FUNC(i64 %2) %9 = call i64 @FUNC(i64 40) %10 = icmp eq i64 %0, %9 store i64 0, i64* %rax.0.reg2mem br i1 %10, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__src_char_declare_cat_17-bad
CWE121_Stack_Based_Buffer_Overflow__src_char_declare_cat_17_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = ptrtoint i64* %sv_1 to i64 %2 = add i64 %1, 99 %3 = inttoptr i64 %2 to i8* %4 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 99) store i8 0, i8* %3, align 1 %5 = bitcast i64* %sv_1 to i8* store i64 0, i64* %sv_0, align 8 %6 = bitcast i64* %sv_0 to i8* %7 = call i8* @strcat(i8* nonnull %6, i8* nonnull %5) %8 = call i64 @FUNC(i64 %1) %9 = call i64 @FUNC(i64 40) %10 = icmp eq i64 %0, %9 store i64 0, i64* %rax.0.reg2mem br i1 %10, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %sv_1, { 2, 1, 0 } }
1
juliet-test-suite-c
CWE252_Unchecked_Return_Value__char_scanf_08-bad
CWE252_Unchecked_Return_Value__char_scanf_08_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 br i1 %3, label LBL_2, label LBL_1 LBL_1: store i64 0, i64* %sv_0, align 8 %4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @gv_0, i64 0, i64 0), i64* nonnull %sv_0) br label LBL_2 LBL_2: %5 = call i64 @FUNC(i64 40) %6 = icmp eq i64 %0, %5 store i64 0, i64* %rax.0.reg2mem br i1 %6, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
1
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_17-bad
CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_17_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = ptrtoint i64* %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = add i64 %0, -97 %3 = and i64 %2, -16 %4 = inttoptr i64 %3 to i64* %5 = add i64 %3, 99 %6 = inttoptr i64 %5 to i8* %7 = call i64* @memset(i64* %4, i32 65, i32 99) store i8 0, i8* %6, align 1 %8 = inttoptr i64 %3 to i8* store i64 0, i64* %sv_0, align 8 %9 = bitcast i64* %sv_0 to i8* %10 = call i8* @strcpy(i8* nonnull %9, i8* %8) %11 = call i64 @FUNC(i64 %3) %12 = call i64 @FUNC(i64 40) %13 = icmp eq i64 %1, %12 store i64 0, i64* %rax.0.reg2mem br i1 %13, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %3, { 2, 3, 0, 1 } }
1
juliet-test-suite-c
CWE78_OS_Command_Injection__char_connect_socket_system_08-good
goodG2B1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 2126700, i64* %sv_0, align 8 %1 = bitcast i64* %sv_0 to i8* %2 = call i64 @FUNC() %3 = trunc i64 %2 to i32 %4 = icmp eq i32 %3, 0 br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_0 to i64)) br label LBL_3 LBL_2: %6 = call i32 @strlen(i8* nonnull %1) %7 = sext i32 %6 to i64 %8 = ptrtoint i64* %sv_0 to i64 %9 = add i64 %7, %8 %10 = inttoptr i64 %9 to i32* store i32 2764330, i32* %10, align 4 br label LBL_3 LBL_3: %11 = call i32 @system(i8* nonnull %1) %12 = icmp eq i32 %11, 0 br i1 %12, label LBL_5, label LBL_4 LBL_4: %13 = call i64 @FUNC(i64 ptrtoint ([26 x i8]* @gv_1 to i64)) call void @exit(i32 1) unreachable LBL_5: %14 = call i64 @FUNC(i64 40) %15 = icmp eq i64 %0, %14 store i64 0, i64* %rax.0.reg2mem br i1 %15, label LBL_7, label LBL_6 LBL_6: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
0
juliet-test-suite-c
CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fscanf_11-bad
CWE122_Heap_Based_Buffer_Overflow__c_CWE129_fscanf_11_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %indvars.iv.reg2mem = alloca i64 %indvars.iv4.reg2mem = alloca i64 %sv_0 = alloca i32, align 4 %0 = call i64 @FUNC(i64 40) store i32 -1, i32* %sv_0, align 4 %1 = call i64 @FUNC() %2 = trunc i64 %1 to i32 %3 = icmp eq i32 %2, 0 br i1 %3, label LBL_2, label LBL_1 LBL_1: %4 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %5 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i32* nonnull %sv_0) br label LBL_2 LBL_2: %6 = call i64 @FUNC() %7 = trunc i64 %6 to i32 %8 = icmp eq i32 %7, 0 br i1 %8, label LBL_11, label LBL_3 LBL_3: %9 = call i64* @malloc(i32 40) %10 = ptrtoint i64* %9 to i64 %11 = icmp eq i64* %9, null %12 = icmp eq i1 %11, false store i64 0, i64* %indvars.iv4.reg2mem br i1 %12, label LBL_5, label LBL_4 LBL_4: call void @exit(i32 -1) unreachable LBL_5: %indvars.iv4.reload = load i64, i64* %indvars.iv4.reg2mem %13 = mul i64 %indvars.iv4.reload, 4 %14 = add i64 %13, %10 %15 = inttoptr i64 %14 to i32* store i32 0, i32* %15, align 4 %indvars.iv.next5 = add nuw nsw i64 %indvars.iv4.reload, 1 %exitcond6 = icmp eq i64 %indvars.iv.next5, 10 store i64 %indvars.iv.next5, i64* %indvars.iv4.reg2mem br i1 %exitcond6, label LBL_6, label LBL_5 LBL_6: %16 = load i32, i32* %sv_0, align 4 %17 = icmp slt i32 %16, 0 br i1 %17, label LBL_9, label LBL_7 LBL_7: %18 = sext i32 %16 to i64 %19 = mul i64 %18, 4 %20 = add i64 %19, %10 %21 = inttoptr i64 %20 to i32* store i32 1, i32* %21, align 4 store i64 0, i64* %indvars.iv.reg2mem br label LBL_8 LBL_8: %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem %22 = mul i64 %indvars.iv.reload, 4 %23 = add i64 %22, %10 %24 = inttoptr i64 %23 to i32* %25 = load i32, i32* %24, align 4 %26 = zext i32 %25 to i64 %27 = call i64 @FUNC(i64 %26) %indvars.iv.next = add nuw nsw i64 %indvars.iv.reload, 1 %exitcond = icmp eq i64 %indvars.iv.next, 10 store i64 %indvars.iv.next, i64* %indvars.iv.reg2mem br i1 %exitcond, label LBL_10, label LBL_8 LBL_9: %28 = call i64 @FUNC(i64 ptrtoint ([32 x i8]* @gv_2 to i64)) br label LBL_10 LBL_10: call void @free(i64* %9) br label LBL_11 LBL_11: %29 = call i64 @FUNC(i64 40) %30 = icmp eq i64 %0, %29 store i64 0, i64* %rax.0.reg2mem br i1 %30, label LBL_13, label LBL_12 LBL_12: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_13 LBL_13: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32* %sv_0, { 1, 0, 2 } uselistorder i64* %indvars.iv4.reg2mem, { 2, 0, 1 } uselistorder i64* %indvars.iv.reg2mem, { 1, 0, 2 } uselistorder i64 10, { 1, 0 } uselistorder i64 ()* @globalReturnsTrue, { 1, 0 } uselistorder label LBL_10, { 1, 0 } uselistorder label LBL_5, { 1, 0 } }
1
juliet-test-suite-c
CWE124_Buffer_Underwrite__CWE839_fgets_09-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %indvars.iv.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) store i64 0, i64* %sv_0, align 8 %1 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %2 = bitcast i64* %sv_0 to i8* %3 = call i8* @fgets(i8* nonnull %2, i32 14, %_IO_FILE* %1) %4 = icmp eq i8* %3, null br i1 %4, label LBL_1, label LBL_2 LBL_1: %5 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_1 to i64)) br label LBL_5 LBL_2: %6 = call i32 @atoi(i8* nonnull %2) %7 = icmp ugt i32 %6, 9 br i1 %7, label LBL_5, label LBL_3 LBL_3: %8 = ptrtoint i64* %sv_1 to i64 %9 = sext i32 %6 to i64 %10 = mul i64 %9, 4 %11 = add i64 %8, -64 %12 = add i64 %10, %11 %13 = inttoptr i64 %12 to i32* store i32 1, i32* %13, align 4 store i64 0, i64* %indvars.iv.reg2mem br label LBL_4 LBL_4: %indvars.iv.reload = load i64, i64* %indvars.iv.reg2mem %14 = mul i64 %indvars.iv.reload, 4 %15 = add i64 %14, %11 %16 = inttoptr i64 %15 to i32* %17 = load i32, i32* %16, align 4 %18 = zext i32 %17 to i64 %19 = call i64 @FUNC(i64 %18) %indvars.iv.next = add nuw nsw i64 %indvars.iv.reload, 1 %exitcond = icmp eq i64 %indvars.iv.next, 10 store i64 %indvars.iv.next, i64* %indvars.iv.reg2mem br i1 %exitcond, label LBL_6, label LBL_4 LBL_5: %20 = call i64 @FUNC(i64 ptrtoint ([36 x i8]* @gv_2 to i64)) br label LBL_6 LBL_6: %21 = call i64 @FUNC(i64 40) %22 = icmp eq i64 %0, %21 store i64 0, i64* %rax.0.reg2mem br i1 %22, label LBL_8, label LBL_7 LBL_7: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_8 LBL_8: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %6, { 1, 0 } uselistorder i64* %indvars.iv.reg2mem, { 1, 0, 2 } uselistorder i8* (i8*, i32, %_IO_FILE*)* @fgets, { 1, 0, 2 } uselistorder %_IO_FILE** @gv_0, { 1, 0 } uselistorder label LBL_6, { 1, 0 } uselistorder label LBL_5, { 1, 0 } }
0
juliet-test-suite-c
CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cpy_15-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i8*, align 8 %0 = ptrtoint i8** %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = add i64 %0, -97 %3 = and i64 %2, -16 %4 = inttoptr i64 %3 to i8* store i8* %4, i8** %sv_1, align 8 %5 = inttoptr i64 %3 to i64* %6 = call i64* @memset(i64* %5, i32 65, i32 49) %7 = add i64 %3, 49 %8 = inttoptr i64 %7 to i8* store i8 0, i8* %8, align 1 store i64 0, i64* %sv_0, align 8 %9 = bitcast i64* %sv_0 to i8* %10 = call i8* @strcpy(i8* nonnull %9, i8* %4) %11 = call i64 @FUNC(i64 %3) %12 = call i64 @FUNC(i64 40) %13 = icmp eq i64 %1, %12 store i64 0, i64* %rax.0.reg2mem br i1 %13, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %3, { 2, 1, 0, 3 } uselistorder i8** %sv_1, { 1, 0 } uselistorder i8* (i8*, i8*)* @strcpy, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE369_Divide_by_Zero__int_fscanf_divide_04-good
goodB2G2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i32, align 4 %0 = call i64 @FUNC(i64 40) store i32 -1, i32* %sv_0, align 4 %1 = load %_IO_FILE*, %_IO_FILE** @gv_0, align 8 %2 = call i32 (%_IO_FILE*, i8*, ...) @fscanf(%_IO_FILE* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i32* nonnull %sv_0) %3 = load i32, i32* %sv_0, align 4 %4 = icmp eq i32 %3, 0 br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = udiv i32 100, %3 %6 = zext i32 %5 to i64 %7 = call i64 @FUNC(i64 %6) br label LBL_3 LBL_2: %8 = call i64 @FUNC(i64 ptrtoint ([38 x i8]* @gv_2 to i64)) br label LBL_3 LBL_3: %9 = call i64 @FUNC(i64 40) %10 = icmp eq i64 %0, %9 store i64 0, i64* %rax.0.reg2mem br i1 %10, label LBL_5, label LBL_4 LBL_4: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_5 LBL_5: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32* %sv_0, { 1, 0, 2 } uselistorder i32 (%_IO_FILE*, i8*, ...)* @fscanf, { 1, 0, 2 } uselistorder %_IO_FILE** @gv_0, { 1, 0 } }
0
juliet-test-suite-c
CWE665_Improper_Initialization__char_cat_08-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = bitcast i64* %sv_1 to i8* %2 = call i64 @FUNC() %3 = trunc i64 %2 to i32 %4 = icmp eq i32 %3, 0 br i1 %4, label LBL_2, label LBL_1 LBL_1: store i8 0, i8* %1, align 8 br label LBL_2 LBL_2: %5 = call i64* @memset(i64* nonnull %sv_0, i32 67, i32 99) %6 = bitcast i64* %sv_0 to i8* %7 = call i8* @strcat(i8* nonnull %1, i8* nonnull %6) %8 = ptrtoint i64* %sv_1 to i64 %9 = call i64 @FUNC(i64 %8) %10 = call i64 @FUNC(i64 40) %11 = icmp eq i64 %0, %10 store i64 0, i64* %rax.0.reg2mem br i1 %11, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i8* %1, { 1, 0 } uselistorder i8* (i8*, i8*)* @strcat, { 1, 0, 2 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } }
0
juliet-test-suite-c
CWE590_Free_Memory_Not_on_Heap__free_int64_t_alloca_11-good
goodG2B2
define i64 @FUNC() local_unnamed_addr { LBL_0: %storemerge1.reg2mem = alloca i64 %0 = call i64 @FUNC() %1 = call i64* @malloc(i32 ptrtoint (i32* @gv_0 to i32)) %2 = ptrtoint i64* %1 to i64 %3 = icmp eq i64* %1, null %4 = icmp eq i1 %3, false store i64 0, i64* %storemerge1.reg2mem br i1 %4, label LBL_2, label LBL_1 LBL_1: %5 = call i64 @FUNC(i64 ptrtoint ([16 x i8]* @gv_1 to i64)) call void @exit(i32 1) unreachable LBL_2: %storemerge1.reload = load i64, i64* %storemerge1.reg2mem %6 = mul i64 %storemerge1.reload, 8 %7 = add i64 %6, %2 %8 = inttoptr i64 %7 to i64* store i64 5, i64* %8, align 8 %9 = add nuw nsw i64 %storemerge1.reload, 1 %exitcond = icmp eq i64 %9, 100 store i64 %9, i64* %storemerge1.reg2mem br i1 %exitcond, label LBL_3, label LBL_2 LBL_3: %10 = load i64, i64* %1, align 8 %11 = call i64 @FUNC(i64 %10) call void @free(i64* %1) ret i64 ptrtoint (i32* @1 to i64) uselistorder i64* %storemerge1.reg2mem, { 2, 0, 1 } uselistorder void (i64*)* @free, { 1, 0, 2 } uselistorder i64 (i64)* @printLongLongLine, { 1, 0 } uselistorder void (i32)* @exit, { 1, 0, 2 } uselistorder i64* (i32)* @malloc, { 1, 0, 2 } uselistorder label LBL_2, { 1, 0 } }
0
juliet-test-suite-c
CWE675_Duplicate_Operations_on_Resource__fopen_04-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %0 = call %_IO_FILE* @fopen(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @gv_0, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0)) %1 = call i32 @fclose(%_IO_FILE* %0) ret i64 0 }
0
juliet-test-suite-c
CWE194_Unexpected_Sign_Extension__listen_socket_strncpy_07-bad
CWE194_Unexpected_Sign_Extension__listen_socket_strncpy_07_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0.1.reg2mem = alloca i32 %sv_0.0.ph.reg2mem = alloca i32 %sv_1 = alloca i64, align 8 %sv_2 = alloca i64, align 8 %sv_3 = alloca i64, align 8 %sv_4 = alloca i64, align 8 %0 = ptrtoint i64* %sv_4 to i64 %1 = call i64 @FUNC(i64 40) %2 = load i32, i32* @gv_0, align 4 %3 = icmp eq i32 %2, 5 %4 = icmp eq i1 %3, false store i32 0, i32* %sv_0.1.reg2mem br i1 %4, label LBL_10, label LBL_1 LBL_1: %5 = call i32 @socket(i32 2, i32 1, i32 6) %6 = icmp eq i32 %5, -1 store i32 0, i32* %sv_0.1.reg2mem br i1 %6, label LBL_10, label LBL_2 LBL_2: %7 = call i64* @memset(i64* nonnull %sv_3, i32 0, i32 16) store i64 2, i64* %sv_3, align 8 %8 = call i16 @htons(i16 27015) %9 = bitcast i64* %sv_3 to %sockaddr* %10 = call i32 @bind(i32 %5, %sockaddr* nonnull %9, i32 16) %11 = icmp eq i32 %10, -1 br i1 %11, label LBL_8, label LBL_3 LBL_3: %12 = call i32 @listen(i32 %5, i32 5) %13 = icmp eq i32 %12, -1 br i1 %13, label LBL_8, label LBL_4 LBL_4: %14 = call i32 @accept(i32 %5, %sockaddr* null, i32* null) %15 = icmp eq i32 %14, -1 br i1 %15, label LBL_8, label LBL_5 LBL_5: %16 = call i32 @recv(i32 %14, i64* nonnull %sv_2, i32 7, i32 0) %17 = add i32 %16, 1 %18 = icmp ult i32 %17, 2 store i32 0, i32* %sv_0.0.ph.reg2mem br i1 %18, label LBL_9, label LBL_6 LBL_6: %19 = sext i32 %16 to i64 %20 = add i64 %0, -112 %21 = add i64 %20, %19 %22 = inttoptr i64 %21 to i8* store i8 0, i8* %22, align 1 %23 = bitcast i64* %sv_2 to i8* %24 = call i32 @atoi(i8* nonnull %23) %.off = add i32 %24, 32768 %25 = icmp ult i32 %.off, 65536 store i32 -1, i32* %sv_0.0.ph.reg2mem br i1 %25, label LBL_7, label LBL_9 LBL_7: %sext3 = mul i32 %24, 65536 %26 = ashr exact i32 %sext3, 16 store i32 %26, i32* %sv_0.0.ph.reg2mem br label LBL_9 LBL_8: %27 = call i32 @close(i32 %5) store i32 0, i32* %sv_0.1.reg2mem br label LBL_10 LBL_9: %sv_0.0.ph.reload = load i32, i32* %sv_0.0.ph.reg2mem %28 = call i32 @close(i32 %5) %29 = call i32 @close(i32 %14) store i32 %sv_0.0.ph.reload, i32* %sv_0.1.reg2mem br label LBL_10 LBL_10: %sv_0.1.reload = load i32, i32* %sv_0.1.reg2mem store i64 0, i64* %sv_2, align 8 %30 = call i64* @memset(i64* nonnull %sv_1, i32 65, i32 99) %31 = trunc i32 %sv_0.1.reload to i16 %32 = icmp sgt i16 %31, 99 br i1 %32, label LBL_12, label LBL_11 LBL_11: %33 = bitcast i64* %sv_2 to i8* %34 = bitcast i64* %sv_1 to i8* %35 = call i8* @strncpy(i8* nonnull %33, i8* nonnull %34, i32 %sv_0.1.reload) %36 = sext i32 %sv_0.1.reload to i64 %37 = add i64 %0, -112 %38 = add i64 %37, %36 %39 = inttoptr i64 %38 to i8* store i8 0, i8* %39, align 1 br label LBL_12 LBL_12: %40 = call i64 @FUNC(i64* nonnull %sv_2) %41 = call i64 @FUNC(i64 40) %42 = icmp eq i64 %1, %41 store i64 0, i64* %rax.0.reg2mem br i1 %42, label LBL_14, label LBL_13 LBL_13: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_14 LBL_14: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %sv_0.1.reload, { 1, 2, 0 } uselistorder i32 %16, { 1, 0 } uselistorder i32 %5, { 4, 0, 1, 2, 3, 5 } uselistorder i64 %0, { 1, 0 } uselistorder i64* %sv_3, { 0, 2, 1 } uselistorder i64* %sv_2, { 0, 1, 4, 2, 3 } uselistorder i32* %sv_0.0.ph.reg2mem, { 0, 2, 3, 1 } uselistorder i32* %sv_0.1.reg2mem, { 0, 3, 2, 1, 4 } uselistorder i32 (i32)* @close, { 2, 1, 0, 3 } uselistorder i32 5, { 1, 0, 2 } uselistorder label LBL_10, { 2, 1, 0, 3 } uselistorder label LBL_9, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE761_Free_Pointer_Not_at_Start_of_Buffer__char_connect_socket_13-good
goodB2G1
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %storemerge4.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 100) %2 = icmp eq i64* %1, null %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %4 = bitcast i64* %1 to i8* store i8 0, i8* %4, align 1 %5 = call i32 @strlen(i8* %4) %6 = call i32 @socket(i32 2, i32 1, i32 6) %cond = icmp eq i32 %6, -1 br i1 %cond, label LBL_10, label LBL_3 LBL_3: %7 = call i64* @memset(i64* nonnull %sv_0, i32 0, i32 16) store i64 2, i64* %sv_0, align 8 %8 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @gv_0, i64 0, i64 0)) %9 = call i16 @htons(i16 27015) %10 = bitcast i64* %sv_0 to %sockaddr* %11 = call i32 @connect(i32 %6, %sockaddr* nonnull %10, i32 16) %12 = icmp eq i32 %11, -1 br i1 %12, label LBL_9, label LBL_4 LBL_4: %13 = sext i32 %5 to i64 %14 = ptrtoint i64* %1 to i64 %15 = add i64 %13, %14 %16 = inttoptr i64 %15 to i64* %17 = sub i32 99, %5 %18 = call i32 @recv(i32 %6, i64* %16, i32 %17, i32 0) %19 = add i32 %18, 1 %20 = icmp ult i32 %19, 2 br i1 %20, label LBL_9, label LBL_5 LBL_5: %21 = sext i32 %18 to i64 %22 = add i64 %15, %21 %23 = inttoptr i64 %22 to i8* store i8 0, i8* %23, align 1 %24 = call i8* @strchr(i8* nonnull %4, i32 13) %25 = icmp eq i8* %24, null br i1 %25, label LBL_7, label LBL_6 LBL_6: store i8 0, i8* %24, align 1 br label LBL_7 LBL_7: %26 = call i8* @strchr(i8* nonnull %4, i32 10) %27 = icmp eq i8* %26, null br i1 %27, label LBL_9, label LBL_8 LBL_8: store i8 0, i8* %26, align 1 br label LBL_9 LBL_9: %28 = call i32 @close(i32 %6) br label LBL_10 LBL_10: %29 = load i32, i32* inttoptr (i64 8388 to i32*), align 4 %30 = icmp eq i32 %29, 5 br i1 %30, label LBL_11, label LBL_13 LBL_11: %31 = call i32 @strlen(i8* nonnull %4) %32 = icmp eq i32 %31, 0 br i1 %32, label LBL_17, label LBL_12 LBL_12: %33 = ptrtoint i64* %1 to i64 store i64 0, i64* %storemerge4.reg2mem br label LBL_14 LBL_13: %34 = call i64 @FUNC(i64 ptrtoint ([21 x i8]* @gv_1 to i64)) br label LBL_18 LBL_14: %storemerge4.reload = load i64, i64* %storemerge4.reg2mem %35 = add i64 %storemerge4.reload, %33 %36 = inttoptr i64 %35 to i8* %37 = load i8, i8* %36, align 1 %38 = icmp eq i8 %37, 83 %39 = icmp eq i1 %38, false br i1 %39, label LBL_16, label LBL_15 LBL_15: %40 = call i64 @FUNC(i64 ptrtoint ([17 x i8]* @gv_2 to i64)) br label LBL_17 LBL_16: %41 = add nuw i64 %storemerge4.reload, 1 %42 = call i32 @strlen(i8* %4) %43 = sext i32 %42 to i64 %44 = icmp ult i64 %41, %43 store i64 %41, i64* %storemerge4.reg2mem br i1 %44, label LBL_14, label LBL_17 LBL_17: call void @free(i64* %1) br label LBL_18 LBL_18: %45 = call i64 @FUNC(i64 40) %46 = icmp eq i64 %0, %45 store i64 0, i64* %rax.0.reg2mem br i1 %46, label LBL_20, label LBL_19 LBL_19: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_20 LBL_20: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i32 %18, { 1, 0 } uselistorder i32 %6, { 3, 1, 2, 0 } uselistorder i8* %4, { 3, 0, 1, 2, 5, 4 } uselistorder i64* %1, { 1, 0, 2, 4, 3 } uselistorder i64* %sv_0, { 0, 2, 1 } uselistorder i64* %storemerge4.reg2mem, { 1, 0, 2 } uselistorder label LBL_17, { 0, 2, 1 } uselistorder label LBL_14, { 1, 0 } uselistorder label LBL_10, { 1, 0 } uselistorder label LBL_9, { 2, 1, 0, 3 } }
0
juliet-test-suite-c
CWE190_Integer_Overflow__short_rand_postinc_12-good
goodB2G
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %0 = call i64 @FUNC() %1 = call i32 @rand() %2 = urem i32 %1, 2 %3 = icmp eq i32 %2, 0 %4 = call i32 @rand() %5 = call i32 @rand() %6 = mul i32 %5, 32768 %7 = call i32 @rand() %8 = xor i32 %7, %6 %9 = sext i1 %3 to i32 %storemerge6.in = xor i32 %8, %9 %storemerge5.in = mul i32 %storemerge6.in, 65536 %10 = call i64 @FUNC() %11 = trunc i64 %10 to i32 %12 = icmp eq i32 %11, 0 %13 = trunc i32 %storemerge6.in to i16 %14 = icmp eq i16 %13, 32767 br i1 %12, label LBL_4, label LBL_1 LBL_1: br i1 %14, label LBL_3, label LBL_2 LBL_2: %sext2 = add i32 %storemerge5.in, 65536 %15 = ashr exact i32 %sext2, 16 %16 = zext i32 %15 to i64 %17 = call i64 @FUNC(i64 %16) store i64 %17, i64* %rax.0.reg2mem br label LBL_7 LBL_3: %18 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_0 to i64)) store i64 %18, i64* %rax.0.reg2mem br label LBL_7 LBL_4: br i1 %14, label LBL_6, label LBL_5 LBL_5: %sext3 = add i32 %storemerge5.in, 65536 %19 = ashr exact i32 %sext3, 16 %20 = zext i32 %19 to i64 %21 = call i64 @FUNC(i64 %20) store i64 %21, i64* %rax.0.reg2mem br label LBL_7 LBL_6: %22 = call i64 @FUNC(i64 ptrtoint ([54 x i8]* @gv_0 to i64)) store i64 %22, i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i1 %14, { 1, 0 } uselistorder i32 %storemerge5.in, { 1, 0 } uselistorder i32 %storemerge6.in, { 1, 0 } uselistorder i64* %rax.0.reg2mem, { 0, 4, 3, 2, 1 } uselistorder i32 65536, { 1, 2, 0 } }
0
juliet-test-suite-c
CWE127_Buffer_Underread__char_alloca_cpy_32-bad
CWE127_Buffer_Underread__char_alloca_cpy_32_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %sv_1 = alloca i64, align 8 %0 = ptrtoint i64* %sv_1 to i64 %1 = call i64 @FUNC(i64 40) %2 = add i64 %0, -97 %3 = and i64 %2, -16 %4 = inttoptr i64 %3 to i64* %5 = call i64* @memset(i64* %4, i32 65, i32 99) %6 = add i64 %3, 99 %7 = inttoptr i64 %6 to i8* store i8 0, i8* %7, align 1 %8 = add i64 %3, -8 store i64 %8, i64* %sv_1, align 8 %9 = call i64* @memset(i64* nonnull %sv_0, i32 67, i32 199) %10 = bitcast i64* %sv_0 to i8* %11 = inttoptr i64 %8 to i8* %12 = call i8* @strcpy(i8* nonnull %10, i8* nonnull %11) %13 = call i64 @FUNC(i64* nonnull %sv_0) %14 = call i64 @FUNC(i64 40) %15 = icmp eq i64 %1, %14 store i64 0, i64* %rax.0.reg2mem br i1 %15, label LBL_2, label LBL_1 LBL_1: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_2 LBL_2: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64 %3, { 0, 2, 1 } uselistorder i64* (i64*, i32, i32)* @memset, { 1, 0, 2 } }
1
juliet-test-suite-c
CWE758_Undefined_Behavior__double_pointer_alloca_use_05-bad
CWE758_Undefined_Behavior__double_pointer_alloca_use_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = load i32, i32* @gv_0, align 4 %2 = icmp eq i32 %1, 0 br i1 %2, label LBL_2, label LBL_1 LBL_1: %3 = ptrtoint i64* %sv_0 to i64 %4 = add i64 %3, -1 %5 = and i64 %4, -16 %6 = inttoptr i64 %5 to i64* %7 = load i64, i64* %6, align 16 %8 = inttoptr i64 %7 to i64* %9 = load i64, i64* %8, align 8 %10 = call i128 @FUNC(i64 %9) %11 = call i64 @FUNC() br label LBL_2 LBL_2: %12 = call i64 @FUNC(i64 40) %13 = icmp eq i64 %0, %12 store i64 0, i64* %rax.0.reg2mem br i1 %13, label LBL_4, label LBL_3 LBL_3: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_4 LBL_4: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload }
1
juliet-test-suite-c
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_05-bad
CWE122_Heap_Based_Buffer_Overflow__c_CWE806_char_snprintf_05_bad
define i64 @FUNC() local_unnamed_addr { LBL_0: %rax.0.reg2mem = alloca i64 %.pre-phi.reg2mem = alloca i64 %sv_0 = alloca i64, align 8 %0 = call i64 @FUNC(i64 40) %1 = call i64* @malloc(i32 100) %2 = icmp eq i64* %1, null %3 = icmp eq i1 %2, false br i1 %3, label LBL_2, label LBL_1 LBL_1: call void @exit(i32 -1) unreachable LBL_2: %4 = load i32, i32* @gv_0, align 4 %5 = icmp eq i32 %4, 0 br i1 %5, label LBL_2.LBL_5_crit_edge, label LBL_4 LBL_3: %.pre = ptrtoint i64* %1 to i64 store i64 %.pre, i64* %.pre-phi.reg2mem br label LBL_5 LBL_4: %6 = call i64* @memset(i64* %1, i32 65, i32 99) %7 = ptrtoint i64* %1 to i64 %8 = add i64 %7, 99 %9 = inttoptr i64 %8 to i8* store i8 0, i8* %9, align 1 store i64 %7, i64* %.pre-phi.reg2mem br label LBL_5 LBL_5: %10 = bitcast i64* %1 to i8* %.pre-phi.reload = load i64, i64* %.pre-phi.reg2mem store i64 0, i64* %sv_0, align 8 %11 = call i32 @strlen(i8* %10) %12 = bitcast i64* %sv_0 to i8* %13 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* nonnull %12, i32 %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @gv_1, i64 0, i64 0), i64* %1) %14 = call i64 @FUNC(i64 %.pre-phi.reload) call void @free(i64* %1) %15 = call i64 @FUNC(i64 40) %16 = icmp eq i64 %0, %15 store i64 0, i64* %rax.0.reg2mem br i1 %16, label LBL_7, label LBL_6 LBL_6: call void @__stack_chk_fail() store i64 ptrtoint (i32* @1 to i64), i64* %rax.0.reg2mem br label LBL_7 LBL_7: %rax.0.reload = load i64, i64* %rax.0.reg2mem ret i64 %rax.0.reload uselistorder i64* %1, { 1, 2, 6, 3, 4, 0, 5 } uselistorder label LBL_5, { 1, 0 } }
1