forked from pool/mupdf
42cfc2defc
CVE-2017-5627 and CVE-2017-5628 bsc#1022503 bsc#1022504 OBS-URL: https://build.opensuse.org/package/show/Publishing/mupdf?expand=0&rev=47
36 lines
791 B
Diff
36 lines
791 B
Diff
From 8f62ea10a0af68e56d5c00720523ebcba13c2e6a Mon Sep 17 00:00:00 2001
|
|
From: Tor Andersson <tor.andersson@gmail.com>
|
|
Date: Tue, 24 Jan 2017 14:32:14 +0100
|
|
Subject: [PATCH] Fix 697496: Check NAN before accessing array in MakeDay().
|
|
|
|
---
|
|
jsdate.c | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/jsdate.c b/jsdate.c
|
|
index 2b43edf..6efbb60 100644
|
|
--- a/jsdate.c
|
|
+++ b/jsdate.c
|
|
@@ -207,12 +207,17 @@ static double MakeDay(double y, double m, double date)
|
|
};
|
|
|
|
double yd, md;
|
|
+ int im;
|
|
|
|
y += floor(m / 12);
|
|
m = pmod(m, 12);
|
|
|
|
+ im = (int)m;
|
|
+ if (im < 0 || im >= 12)
|
|
+ return NAN;
|
|
+
|
|
yd = floor(TimeFromYear(y) / msPerDay);
|
|
- md = firstDayOfMonth[InLeapYear(y)][(int)m];
|
|
+ md = firstDayOfMonth[InLeapYear(y)][im];
|
|
|
|
return yd + md + date - 1;
|
|
}
|
|
--
|
|
2.9.1
|
|
|