summaryrefslogtreecommitdiff
path: root/glib/gstdio.h
diff options
context:
space:
mode:
authorChristoph Reiter <reiter.christoph@gmail.com>2018-08-05 11:21:26 +0200
committerChristoph Reiter <reiter.christoph@gmail.com>2018-08-05 11:40:22 +0200
commit631893f750746fe7d873ab6dcd63a41ac66fad0a (patch)
tree0f10fd465e51e8b5df0abad25494961ba664ade8 /glib/gstdio.h
parent516101c7023af25083c385b91a1ca7dc635c15a6 (diff)
downloadglib-mingw-statbuf-size.tar.gz
gstdio: use _stat64 for GStatBuf on 64bit mingw. Fixes #1476mingw-statbuf-size
The size of stat depends on various macros on Windows which leads to the problem of size mismatches when glib is built with a different configuration than a program using it. For example the autotools build defaults to _FILE_OFFSET_BITS=64 and a program not defining _FILE_OFFSET_BITS will allocate a too small struct on the stack, leading to stack corruption when glib writes to it. To make the size the user sees always match the default mingw build define GStatBuf as _stat64 (same as _FILE_OFFSET_BITS=64) under mingw+64bit.
Diffstat (limited to 'glib/gstdio.h')
-rw-r--r--glib/gstdio.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/glib/gstdio.h b/glib/gstdio.h
index 15091b3e7..94f4fa36f 100644
--- a/glib/gstdio.h
+++ b/glib/gstdio.h
@@ -44,6 +44,10 @@ G_BEGIN_DECLS
typedef struct _stat32 GStatBuf;
+#elif defined(__MINGW64_VERSION_MAJOR) && defined(_WIN64)
+
+typedef struct _stat64 GStatBuf;
+
#else
typedef struct stat GStatBuf;