diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/fns.c | 10 |
1 files changed, 8 insertions, 2 deletions
| @@ -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; |