From 665cb657a9ff2f8aefb9fde8e15eb0537862ddc3 Mon Sep 17 00:00:00 2001 From: Matt Davis Date: Thu, 23 May 2024 11:12:19 -0700 Subject: [PATCH] test proposed recompiler fix for null-pointer-subtraction error --- src/cffi/recompiler.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cffi/recompiler.py b/src/cffi/recompiler.py index 4167bc05..ac6c163e 100644 --- a/src/cffi/recompiler.py +++ b/src/cffi/recompiler.py @@ -953,7 +953,7 @@ def _struct_ctx(self, tp, cname, approxname, named_ptr=None): if cname is None or fbitsize >= 0: offset = '(size_t)-1' elif named_ptr is not None: - offset = '((char *)&((%s)0)->%s) - (char *)0' % ( + offset = '((char *)&((%s)4096)->%s) - (char *)4096' % ( named_ptr.name, fldname) else: offset = 'offsetof(%s, %s)' % (tp.get_c_name(''), fldname)