From afeb42a7e91407f754b60b18fe29799e6383a5dc Mon Sep 17 00:00:00 2001 From: Jakub Wilk Date: Fri, 10 Mar 2023 20:48:40 +0100 Subject: [PATCH] Get rid of DEF statements. https://github.com/jwilk/python-afl/issues/27 --- afl.pyx | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/afl.pyx b/afl.pyx index dd8cc03..c466f52 100644 --- a/afl.pyx +++ b/afl.pyx @@ -36,11 +36,17 @@ import struct import sys import warnings -# These constants must be kept in sync with afl-fuzz: -DEF SHM_ENV_VAR = b'__AFL_SHM_ID' -DEF FORKSRV_FD = 198 -DEF MAP_SIZE_POW2 = 16 -DEF MAP_SIZE = 1 << MAP_SIZE_POW2 +cdef extern from *: + # These constants must be kept in sync with afl-fuzz: + ''' + #define SHM_ENV_VAR "__AFL_SHM_ID" + #define FORKSRV_FD 198 + #define MAP_SIZE_POW2 16 + #define MAP_SIZE (1 << MAP_SIZE_POW2) + ''' + extern const char *SHM_ENV_VAR + extern int FORKSRV_FD + extern int MAP_SIZE from cpython.exc cimport PyErr_SetFromErrno from libc cimport errno