Files
RedBear-OS/recipes/wip/libs/other/libxkbcommon/source/fuzz/compose/target.c
T
vasilito ff4ff35918 feat: track all source trees in git — full fork offline-first model
Red Bear OS is a full fork. All sources must be available from git clone
with zero network access. Removed gitignore rules that excluded fetched
source trees under recipes/*/source/, local/recipes/kde/*/source/,
local/recipes/qt/*/source/, and vendor source trees.

Build artifacts (target/, build/, source.tar, *.o, *.so) remain excluded.

127291 files added — kernel, relibc, base, bootloader, pkgar, all KDE/Qt
frameworks, mesa, wayland, DRM drivers, and every other recipe source.
2026-05-14 10:55:53 +01:00

47 lines
1.1 KiB
C

/*
* A target program for fuzzing the Compose text format.
*
* Currently, just parses an input file, and hopefully doesn't crash or hang.
*/
#include "config.h"
#include <assert.h>
#include "xkbcommon/xkbcommon.h"
#include "xkbcommon/xkbcommon-compose.h"
int
main(int argc, char *argv[])
{
struct xkb_context *ctx;
FILE *file;
struct xkb_compose_table *table;
if (argc != 2) {
fprintf(stderr, "usage: %s <file>\n", argv[0]);
return 1;
}
ctx = xkb_context_new(XKB_CONTEXT_NO_DEFAULT_INCLUDES | XKB_CONTEXT_NO_ENVIRONMENT_NAMES);
assert(ctx);
#ifdef __AFL_HAVE_MANUAL_CONTROL
__AFL_INIT();
while (__AFL_LOOP(1000))
#endif
{
file = fopen(argv[1], "rb");
assert(file);
table = xkb_compose_table_new_from_file(ctx, file,
"en_US.UTF-8",
XKB_COMPOSE_FORMAT_TEXT_V1,
XKB_COMPOSE_COMPILE_NO_FLAGS);
xkb_compose_table_unref(table);
fclose(file);
}
puts(table ? "OK" : "FAIL");
xkb_context_unref(ctx);
}