Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[clang][UBSan] Segfault with -fsanitize=vla-bound -ftrivial-auto-var-init=zero/pattern #93949

Open
chestnykh opened this issue May 31, 2024 · 0 comments
Labels
compiler-rt:ubsan Undefined behavior sanitizer

Comments

@chestnykh
Copy link
Contributor

chestnykh commented May 31, 2024

Just compile

int main(int argc, char **argv) {
  int x = -1;
  int arr[x];
  return 0;
}

with
clang -fsanitize=vla-bound -ftrivial-auto-var-init=zero
or with
clang -fsanitize=vla-bound -ftrivial-auto-var-init=pattern
Run the executable and see that UBSan rt catches segfault:
UndefinedBehaviorSanitizer:DEADLYSIGNAL.

With
clang -fsanitize=vla-bound -ftrivial-auto-var-init=uninitialized
UBSan works fine and the process terminates with zero exit-code.

Observed in clang-17.0.6 and clang-18.1.3.
OSes: Ubuntu-24.04 and ArchLinux.

@github-actions github-actions bot added the clang Clang issues not falling into any other category label May 31, 2024
@EugeneZelenko EugeneZelenko added compiler-rt:ubsan Undefined behavior sanitizer and removed clang Clang issues not falling into any other category labels May 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
compiler-rt:ubsan Undefined behavior sanitizer
Projects
None yet
Development

No branches or pull requests

2 participants