diff options
| author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2025-04-25 15:27:08 -0300 |
|---|---|---|
| committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2025-04-25 17:46:06 -0300 |
| commit | 7ebb8ec3c78d8fe5428b41ce37cae7a60e865b66 (patch) | |
| tree | a974bd1a3a02a34d203c04cd29561c52480315b9 | |
| parent | 46b2287d66be14eb72317035b81f3cb2564cb991 (diff) | |
| download | glibc-azanella/ubsan-undef.tar.xz glibc-azanella/ubsan-undef.zip | |
gmon: Fix UB in sprofilazanella/ubsan-undef
UBSAN: Undefined behaviour in ../sysdeps/posix/sprofil.c:272:16 variable length array bound evaluates to non-positive value 0
Move the VLA to after the porfile stop condition (where size might
be zero).
| -rw-r--r-- | sysdeps/posix/sprofil.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/sysdeps/posix/sprofil.c b/sysdeps/posix/sprofil.c index 0af671d001..0a3d1a8e50 100644 --- a/sysdeps/posix/sprofil.c +++ b/sysdeps/posix/sprofil.c @@ -269,7 +269,6 @@ int __sprofil (struct prof *profp, int profcnt, struct timeval *tvp, unsigned int flags) { - struct prof *p[profcnt]; struct itimerval timer; struct sigaction act; int i; @@ -295,6 +294,7 @@ __sprofil (struct prof *profp, int profcnt, struct timeval *tvp, return 0; } + struct prof *p[profcnt]; prof_info.num_regions = 0; prof_info.region = NULL; prof_info.overflow = &default_overflow_region; |
