diff options
| author | otto <> | 2023-10-22 12:20:07 +0000 |
|---|---|---|
| committer | otto <> | 2023-10-22 12:20:07 +0000 |
| commit | 57a15907f06e47afd441ecdd84eb5468e4ae8f77 (patch) | |
| tree | f35a7c208da29d1c802eaceff2e55e5aa6194327 /src/regress/lib/libc | |
| parent | b5cf5d1cfd03d5dce101bec12c9cfb6512def233 (diff) | |
| download | openbsd-57a15907f06e47afd441ecdd84eb5468e4ae8f77.tar.gz openbsd-57a15907f06e47afd441ecdd84eb5468e4ae8f77.tar.bz2 openbsd-57a15907f06e47afd441ecdd84eb5468e4ae8f77.zip | |
A few more tests
Diffstat (limited to 'src/regress/lib/libc')
| -rw-r--r-- | src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c index 6040590a65..c711980861 100644 --- a/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c +++ b/src/regress/lib/libc/malloc/malloc_errs/malloc_errs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: malloc_errs.c,v 1.3 2023/06/04 06:58:33 otto Exp $ */ | 1 | /* $OpenBSD: malloc_errs.c,v 1.4 2023/10/22 12:20:07 otto Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> | 3 | * Copyright (c) 2023 Otto Moerbeek <otto@drijf.net> |
| 4 | * | 4 | * |
| @@ -226,6 +226,17 @@ t20(void) | |||
| 226 | free(p); | 226 | free(p); |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | /* out-of-bound write preceding chunk */ | ||
| 230 | void | ||
| 231 | t22(void) | ||
| 232 | { | ||
| 233 | int i, j; | ||
| 234 | unsigned char *p = malloc(32); | ||
| 235 | p[32] = 0; | ||
| 236 | for (i = 0; i < 10000; i++) | ||
| 237 | p = malloc(32); | ||
| 238 | } | ||
| 239 | |||
| 229 | struct test { | 240 | struct test { |
| 230 | void (*test)(void); | 241 | void (*test)(void); |
| 231 | const char *flags; | 242 | const char *flags; |
| @@ -253,6 +264,9 @@ struct test tests[] = { | |||
| 253 | { t18, "" }, | 264 | { t18, "" }, |
| 254 | { t19, "" }, | 265 | { t19, "" }, |
| 255 | { t20, "C" }, | 266 | { t20, "C" }, |
| 267 | { t8, "FJD" }, /* t21 re-uses code from t8 */ | ||
| 268 | { t22, "J" }, | ||
| 269 | { t22, "JD" }, /* t23 re-uses code from t22 */ | ||
| 256 | }; | 270 | }; |
| 257 | 271 | ||
| 258 | int main(int argc, char *argv[]) | 272 | int main(int argc, char *argv[]) |
