1*592efe25SPierre Pronchery /* 2*592efe25SPierre Pronchery * alloc-inject.h 3*592efe25SPierre Pronchery * allocator fault injection for fuzzing harnesses 4*592efe25SPierre Pronchery * 5*592efe25SPierre Pronchery * SPDX-License-Identifier: pkgconf 6*592efe25SPierre Pronchery * 7*592efe25SPierre Pronchery * Copyright (c) 2026 pkgconf authors (see AUTHORS). 8*592efe25SPierre Pronchery * 9*592efe25SPierre Pronchery * Permission to use, copy, modify, and/or distribute this software for any 10*592efe25SPierre Pronchery * purpose with or without fee is hereby granted, provided that the above 11*592efe25SPierre Pronchery * copyright notice and this permission notice appear in all copies. 12*592efe25SPierre Pronchery * 13*592efe25SPierre Pronchery * This software is provided 'as is' and without any warranty, express or 14*592efe25SPierre Pronchery * implied. In no event shall the authors be liable for any damages arising 15*592efe25SPierre Pronchery * from the use of this software. 16*592efe25SPierre Pronchery */ 17*592efe25SPierre Pronchery 18*592efe25SPierre Pronchery #ifndef PKGCONF_FUZZER_ALLOC_INJECT_H 19*592efe25SPierre Pronchery #define PKGCONF_FUZZER_ALLOC_INJECT_H 20*592efe25SPierre Pronchery 21*592efe25SPierre Pronchery #include <stdbool.h> 22*592efe25SPierre Pronchery 23*592efe25SPierre Pronchery /* arm injection so that the fail_at-th allocation made while armed fails */ 24*592efe25SPierre Pronchery void alloc_inject_arm(unsigned long fail_at); 25*592efe25SPierre Pronchery 26*592efe25SPierre Pronchery /* stop failing allocations */ 27*592efe25SPierre Pronchery void alloc_inject_disarm(void); 28*592efe25SPierre Pronchery 29*592efe25SPierre Pronchery /* whether the armed failure point was actually reached since the last arm */ 30*592efe25SPierre Pronchery bool alloc_inject_fired(void); 31*592efe25SPierre Pronchery 32*592efe25SPierre Pronchery #endif 33