[llvm] [BPF] Fix out-of-bounds write in fillGenericConstant (PR #203759)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 24 09:00:20 PDT 2026


https://github.com/yonghong-song requested changes to this pull request.

See an example:
```
$ cat bpf_elem.c
struct elem {
  char a[3735923519];
  char b;
  char c[1152921500870923457];
};

struct elem g[16] = { { {0}, 42, {0} } };

char test(void) {
  return g[0].a[0];
}
```
The compilation
```
$ clang --target=bpf -O2 -S -emit-llvm bpf_elem.c -o -
bpf_elem.c:1:8: error: structure 'elem' is too large, which exceeds maximum allowed size of 1152921504606846976 bytes
    1 | struct elem {
      |        ^
bpf_elem.c:7:15: error: array is too large (16 elements)
    7 | struct elem g[16] = { { {0}, 42, {0} } };
      |               ^~
2 errors generated.
```

https://github.com/llvm/llvm-project/pull/203759


More information about the llvm-commits mailing list