Skip to content

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

Open
@chestnykh

Description

@chestnykh

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions