Files
42-LibUnit/tests/libunit/04_sigbus.c
Erwann Lagouche cf491b279d feat/stdout (#3)
* feat: disable standard output for tests

* fuck les fds

* patch some complation issues

* style: norm

* feat: timeout

* fix: patc more stuff

* fix: patch merge

* feat: more tests
2026-01-25 16:43:39 +01:00

26 lines
1.1 KiB
C

/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* 04_sigbus.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: elagouch <elagouch@student.42lyon.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2026/01/24 15:38:17 by elagouch #+# #+# */
/* Updated: 2026/01/25 15:22:52 by elagouch ### ########.fr */
/* */
/* ************************************************************************** */
#include <stdlib.h>
int test_sigbus(void)
{
char *cptr;
int *iptr;
__asm__("pushf\norl $0x40000,(%rsp)\npopf");
cptr = malloc(sizeof(int) + 1);
iptr = (int *)++cptr;
*iptr = 42;
return (1);
}