[all-commits] [llvm/llvm-project] 909043: Add clang::lifetimebound annotation to StringRef c...

Haojian Wu via All-commits all-commits at lists.llvm.org
Mon Oct 28 06:28:29 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 9090430d4176fa260b8da46b7b983b3760d452be
      https://github.com/llvm/llvm-project/commit/9090430d4176fa260b8da46b7b983b3760d452be
  Author: Haojian Wu <hokein.wu at gmail.com>
  Date:   2024-10-28 (Mon, 28 Oct 2024)

  Changed paths:
    M llvm/include/llvm/ADT/StringRef.h

  Log Message:
  -----------
  Add clang::lifetimebound annotation to StringRef constructors. (#113878)

Adding the lifetimebound annotation to the ArrayRef's array constructor
can enable us to detect the following use-after-free issues:

```
llvm::StringRef TestZoneName() {
   char test[] = "foo"; // oops, missing static
   return test; // use-after-free.
}
```

See #113533



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list