summaryrefslogtreecommitdiff
path: root/lib/builtins/fixunsxfdi.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2015-09-06 18:41:23 +0000
committerDimitry Andric <dim@FreeBSD.org>2015-09-06 18:41:23 +0000
commitf31bcc68c72371a2bf63aead9f3373a1ff2053b6 (patch)
treeb259e5d585da0f8cde9579939a74d5ef44c72abd /lib/builtins/fixunsxfdi.c
parentcd2dd3df15523e2be8d2bbace27641d6ac9fa40d (diff)
Notes
Diffstat (limited to 'lib/builtins/fixunsxfdi.c')
-rw-r--r--lib/builtins/fixunsxfdi.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/builtins/fixunsxfdi.c b/lib/builtins/fixunsxfdi.c
index 7224d467e7c9..075304e78dc9 100644
--- a/lib/builtins/fixunsxfdi.c
+++ b/lib/builtins/fixunsxfdi.c
@@ -38,6 +38,8 @@ __fixunsxfdi(long double a)
int e = (fb.u.high.s.low & 0x00007FFF) - 16383;
if (e < 0 || (fb.u.high.s.low & 0x00008000))
return 0;
+ if ((unsigned)e > sizeof(du_int) * CHAR_BIT)
+ return ~(du_int)0;
return fb.u.low.all >> (63 - e);
}