aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/fns.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/fns.c b/src/fns.c
index fa52e5e1978..37c581f15b8 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -3176,8 +3176,14 @@ The data read from the system are decoded using `locale-coding-system'. */)
3176# endif 3176# endif
3177# ifdef HAVE_LANGINFO__NL_PAPER_WIDTH 3177# ifdef HAVE_LANGINFO__NL_PAPER_WIDTH
3178 if (EQ (item, Qpaper)) 3178 if (EQ (item, Qpaper))
3179 return list2i ((intptr_t) nl_langinfo (_NL_PAPER_WIDTH), 3179 /* We have to cast twice here: first to a correctly-sized integer,
3180 (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT)); 3180 then to int, because that's what nl_langinfo is documented to
3181 return for _NO_PAPER_{WIDTH,HEIGHT}. The first cast doesn't
3182 suffice because it could overflow an Emacs fixnum. This can
3183 happen when running under ASan, which fills allocated but
3184 uninitialized memory with 0xBE bytes. */
3185 return list2i ((int) (intptr_t) nl_langinfo (_NL_PAPER_WIDTH),
3186 (int) (intptr_t) nl_langinfo (_NL_PAPER_HEIGHT));
3181# endif 3187# endif
3182#endif /* HAVE_LANGINFO_CODESET*/ 3188#endif /* HAVE_LANGINFO_CODESET*/
3183 return Qnil; 3189 return Qnil;