PR #24405 opened by Martin Storsjö (mstorsjo) URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24405 Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/24405.patch
This file attempts to define _DEFAULT_SOURCE and similar macros to affect the system headers regarding what APIs they expose. However, as this file includes libavutil/error.h before defining the _*_SOURCE macros, we may end up including system headers that end up initializing which features are exposed, before we set our defines (before including <sys/mman.h>). This is not an issue with glibc 2.37 and newer, since those versions stopped looking for defines like _DEFAULT_SOURCE for exposing MAP_ANONYMOUS (see [1]). This wasn't an issue before these functions were split out to a separate file in 4d9be5f57c0e3153c1741bcfc54a13d0d3943f43 either, as these defines used to be set at the top of libswscale/utils.c, before including other headers than config.h. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=954b8f38958de72c4712088735eb175118f17b51 From 80fd6ac4472edf7f84fc7ac6f6806c5cb137bbf2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Storsj=C3=B6?= <[email protected]> Date: Mon, 7 Sep 2026 11:12:49 +0300 Subject: [PATCH] swscale/jit: Fix getting MAP_ANONYMOUS defined on older glibc This file attempts to define _DEFAULT_SOURCE and similar macros to affect the system headers regarding what APIs they expose. However, as this file includes libavutil/error.h before defining the _*_SOURCE macros, we may end up including system headers that end up initializing which features are exposed, before we set our defines (before including <sys/mman.h>). This is not an issue with glibc 2.37 and newer, since those versions stopped looking for defines like _DEFAULT_SOURCE for exposing MAP_ANONYMOUS (see [1]). This wasn't an issue before these functions were split out to a separate file in 4d9be5f57c0e3153c1741bcfc54a13d0d3943f43 either, as these defines used to be set at the top of libswscale/utils.c, before including other headers than config.h. [1] https://sourceware.org/git/?p=glibc.git;a=commit;h=954b8f38958de72c4712088735eb175118f17b51 --- libswscale/jit.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libswscale/jit.c b/libswscale/jit.c index dce333d856..3a6ef6138a 100644 --- a/libswscale/jit.c +++ b/libswscale/jit.c @@ -21,10 +21,6 @@ #include "config.h" -#include "libavutil/error.h" - -#include "jit.h" - #if HAVE_MMAP && HAVE_MPROTECT # define _DEFAULT_SOURCE # define _SVID_SOURCE // needed for MAP_ANONYMOUS @@ -35,6 +31,10 @@ # endif #endif +#include "libavutil/error.h" + +#include "jit.h" + #if HAVE_MMAP && HAVE_MPROTECT && defined(MAP_ANONYMOUS) void *ff_sws_jit_alloc(size_t size) -- 2.52.0 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
