summaryrefslogtreecommitdiff
path: root/libraries/agg/patches/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch
diff options
context:
space:
mode:
authorMatteo Bernardini <ponce@slackbuilds.org>2014-07-16 18:00:19 +0200
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2014-08-03 16:34:16 +0700
commite28787e9e05fc37a6b194ebf62ad5bc647190596 (patch)
treead51d84194c2656f61b59428b08fc6b11940e02d /libraries/agg/patches/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch
parent6fd855630e6d1862995a200f5a07d9ade9190286 (diff)
downloadslackbuilds-e28787e9e05fc37a6b194ebf62ad5bc647190596.tar.gz
libraries/agg: Added patches from fedora.
Signed-off-by: Matteo Bernardini <ponce@slackbuilds.org>
Diffstat (limited to 'libraries/agg/patches/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch')
-rw-r--r--libraries/agg/patches/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch30
1 files changed, 30 insertions, 0 deletions
diff --git a/libraries/agg/patches/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch b/libraries/agg/patches/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch
new file mode 100644
index 0000000000..547b0d2188
--- /dev/null
+++ b/libraries/agg/patches/0014-Avoid-potential-zero-division-resulting-in-nan-in-ag.patch
@@ -0,0 +1,30 @@
+From 6433a64f4cd41e88499386b0b7c7ae05d30683b8 Mon Sep 17 00:00:00 2001
+From: Tom Hughes <tom@compton.nu>
+Date: Sat, 22 Jun 2013 12:33:32 +0100
+Subject: [PATCH 14/15] Avoid potential zero division resulting in nan in
+ agg::gamma_linear
+
+---
+ include/agg_gamma_functions.h | 6 +++++-
+ 1 file changed, 5 insertions(+), 1 deletion(-)
+
+diff --git a/include/agg_gamma_functions.h b/include/agg_gamma_functions.h
+index fa38a45..beb0c04 100644
+--- a/include/agg_gamma_functions.h
++++ b/include/agg_gamma_functions.h
+@@ -94,7 +94,11 @@ namespace agg
+ {
+ if(x < m_start) return 0.0;
+ if(x > m_end) return 1.0;
+- return (x - m_start) / (m_end - m_start);
++ double delta = m_end - m_start;
++ // avoid nan from potential zero division
++ // https://github.com/mapnik/mapnik/issues/761
++ if (delta <= 0.0) return 0.0;
++ return (x - m_start) / delta;
+ }
+
+ private:
+--
+1.8.1.4
+