xref: /aosp_15_r20/external/pdfium/third_party/agg23/0012-infinite-loop.patch (revision 3ac0a46f773bac49fa9476ec2b1cf3f8da5ec3a4)
1diff --git a/third_party/agg23/agg_vcgen_dash.cpp b/third_party/agg23/agg_vcgen_dash.cpp
2index f690760b0..d44fca178 100644
3--- a/third_party/agg23/agg_vcgen_dash.cpp
4+++ b/third_party/agg23/agg_vcgen_dash.cpp
5@@ -18,8 +18,11 @@
6 //
7 //----------------------------------------------------------------------------
8
9+#include <cmath>
10+
11 #include "agg_shorten_path.h"
12 #include "agg_vcgen_dash.h"
13+#include "third_party/base/check_op.h"
14
15 namespace pdfium
16 {
17@@ -60,6 +63,8 @@ void vcgen_dash::dash_start(float ds)
18 }
19 void vcgen_dash::calc_dash_start(float ds)
20 {
21+    DCHECK_GT(m_total_dash_len, 0);
22+    ds -= floor(ds / m_total_dash_len) * m_total_dash_len;
23     m_curr_dash = 0;
24     m_curr_dash_start = 0;
25     while(ds > 0) {
26