Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(597)

Unified Diff: third_party/agg23/agg_math_stroke.h

Issue 1861963002: Fix an infinite loop in agg's stroke_calc_arc(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/agg23/README.pdfium ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/agg23/agg_math_stroke.h
diff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h
index 6d7ba8a96e0eab13d4f85704dfdde126bab73a68..2b06b1bfda76ef76b00909878252a41a165e4b4e 100644
--- a/third_party/agg23/agg_math_stroke.h
+++ b/third_party/agg23/agg_math_stroke.h
@@ -60,28 +60,30 @@ void stroke_calc_arc(VertexConsumer& out_vertices,
}
da = FXSYS_acos(width / (width + ((1.0f / 8) / approximation_scale))) * 2;
out_vertices.add(coord_type(x + dx1, y + dy1));
- if(!ccw) {
- if(a1 > a2) {
- a2 += 2 * FX_PI;
+ if (da > 0) {
+ if (!ccw) {
+ if (a1 > a2) {
+ a2 += 2 * FX_PI;
}
a2 -= da / 4;
a1 += da;
- while(a1 < a2) {
+ while (a1 < a2) {
out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
y + (width * FXSYS_sin(a1))));
- a1 += da;
+ a1 += da;
}
- } else {
- if(a1 < a2) {
- a2 -= 2 * FX_PI;
+ } else {
+ if (a1 < a2) {
+ a2 -= 2 * FX_PI;
}
a2 += da / 4;
a1 -= da;
- while(a1 > a2) {
+ while (a1 > a2) {
out_vertices.add(coord_type(x + (width * FXSYS_cos(a1)),
y + (width * FXSYS_sin(a1))));
- a1 -= da;
+ a1 -= da;
}
+ }
}
out_vertices.add(coord_type(x + dx2, y + dy2));
}
« no previous file with comments | « third_party/agg23/README.pdfium ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698