Files
TheRock/compiler/amd-llvm/compiler-rt/test/asan/TestCases/stack-buffer-overflow-with-position.cpp
derek.holloway 7502bf64a4
CodeQL / Analyze (actions) (push) Canceled after 0s
CodeQL / Analyze (python) (push) Canceled after 0s
pre-commit / pre-commit (push) Canceled after 0s
Multi-Arch CI / setup (push) Canceled after 0s
Publish build_manylinux_x86_64 images / publish_build_manylinux_x86_64 (push) Canceled after 0s
Setup (Multi-Arch) / setup (push) Canceled after 0s
Multi-Arch CI / Linux::${{ fromJSON(needs.setup.outputs.linux_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubi10 image / publish_no_rocm_image_ubi10 (push) Canceled after 0s
Multi-Arch CI / Windows::${{ fromJSON(needs.setup.outputs.windows_build_config || '{}').build_variant_label || 'skip' }} (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Multi-Arch CI / Manifest Diff (push) Canceled after 0s
TheRock Manifest Diff Report / Generate Manifest Diff Report (push) Canceled after 0s
Multi-Arch CI / CI Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_ocl_rt images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04_rocgdb images / publish_no_rocm_image_ubuntu24_04_rocgdb (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_ocl_rt (push) Canceled after 0s
Publish TheRock Docker image / build-and-push-image (push) Canceled after 0s
Unit Tests / Unit Tests :: ubuntu-24.04 (push) Canceled after 0s
Unit Tests / Unit Tests :: windows-2022 (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_media (push) Canceled after 0s
Unit Tests / Unit Tests Summary (push) Canceled after 0s
Publish no_rocm_image_ubuntu24_04 images / publish_no_rocm_image_ubuntu24_04_openmpi (push) Canceled after 0s
Flatten subprojects into a single base monorepo
2026-09-02 16:34:47 -07:00

47 lines
2.1 KiB
C++

// RUN: %clangxx_asan -O2 %s -o %t
// RUN: not %run %t -2 2>&1 | FileCheck --check-prefix=CHECK-m2 %s
// RUN: not %run %t -1 2>&1 | FileCheck --check-prefix=CHECK-m1 %s
// RUN: %run %t 0
// RUN: %run %t 8
// RUN: not %run %t 9 2>&1 | FileCheck --check-prefix=CHECK-9 %s
// RUN: not %run %t 10 2>&1 | FileCheck --check-prefix=CHECK-10 %s
// RUN: not %run %t 30 2>&1 | FileCheck --check-prefix=CHECK-30 %s
// RUN: not %run %t 31 2>&1 | FileCheck --check-prefix=CHECK-31 %s
// RUN: not %run %t 41 2>&1 | FileCheck --check-prefix=CHECK-41 %s
// RUN: not %run %t 42 2>&1 | FileCheck --check-prefix=CHECK-42 %s
// RUN: not %run %t 62 2>&1 | FileCheck --check-prefix=CHECK-62 %s
// RUN: not %run %t 63 2>&1 | FileCheck --check-prefix=CHECK-63 %s
// RUN: not %run %t 73 2>&1 | FileCheck --check-prefix=CHECK-73 %s
// RUN: not %run %t 74 2>&1 | FileCheck --check-prefix=CHECK-74 %s
// XFAIL: msvc
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
int main(int argc, char **argv) {
assert(argc >= 2);
int idx = atoi(argv[1]);
char AAA[10], BBB[10], CCC[10];
memset(AAA, 0, sizeof(AAA));
memset(BBB, 0, sizeof(BBB));
memset(CCC, 0, sizeof(CCC));
int res = 0;
char *p = AAA + idx;
printf("AAA: %p\ny: %p\nz: %p\np: %p\n", AAA, BBB, CCC, p);
// make sure BBB and CCC are not removed;
return *(short*)(p) + BBB[argc % 2] + CCC[argc % 2];
}
// CHECK-m2: 'AAA'{{.*}} <== {{.*}}underflows this variable
// CHECK-m1: 'AAA'{{.*}} <== {{.*}}partially underflows this variable
// CHECK-9: 'AAA'{{.*}} <== {{.*}}partially overflows this variable
// CHECK-10: 'AAA'{{.*}} <== {{.*}}overflows this variable
// CHECK-30: 'BBB'{{.*}} <== {{.*}}underflows this variable
// CHECK-31: 'BBB'{{.*}} <== {{.*}}partially underflows this variable
// CHECK-41: 'BBB'{{.*}} <== {{.*}}partially overflows this variable
// CHECK-42: 'BBB'{{.*}} <== {{.*}}overflows this variable
// CHECK-62: 'CCC'{{.*}} <== {{.*}}underflows this variable
// CHECK-63: 'CCC'{{.*}} <== {{.*}}partially underflows this variable
// CHECK-73: 'CCC'{{.*}} <== {{.*}}partially overflows this variable
// CHECK-74: 'CCC'{{.*}} <== {{.*}}overflows this variable
// REQUIRES: shadow-scale-3