diff options
author | thestig <thestig@chromium.org> | 2016-04-06 23:57:31 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-06 23:57:31 -0700 |
commit | 8833342afc225214ce7180db612f104c9880f2c8 (patch) | |
tree | fb784f430eef18fc338b52f8d8429cb21c72337f | |
parent | 46bf0331229a7b7fe73cbe111550f5dd467b184a (diff) | |
download | pdfium-8833342afc225214ce7180db612f104c9880f2c8.tar.xz |
Fix an infinite loop in agg's stroke_calc_arc().
BUG=pdfium:466
Review URL: https://codereview.chromium.org/1861963002
-rw-r--r-- | third_party/agg23/0000-bug-466.patch | 45 | ||||
-rw-r--r-- | third_party/agg23/README.pdfium | 14 | ||||
-rw-r--r-- | third_party/agg23/agg_math_stroke.h | 22 |
3 files changed, 71 insertions, 10 deletions
diff --git a/third_party/agg23/0000-bug-466.patch b/third_party/agg23/0000-bug-466.patch new file mode 100644 index 0000000000..3217b3838a --- /dev/null +++ b/third_party/agg23/0000-bug-466.patch @@ -0,0 +1,45 @@ +diff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h +index 6d7ba8a..2b06b1b 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)); + } diff --git a/third_party/agg23/README.pdfium b/third_party/agg23/README.pdfium new file mode 100644 index 0000000000..54687934b6 --- /dev/null +++ b/third_party/agg23/README.pdfium @@ -0,0 +1,14 @@ +Name: Anti-Grain Geometry +URL: https://sourceforge.net/projects/agg/ +Version: 2.3 +Security Critical: yes +License: MIT + +Description: +2D vector graphics library. + +Local Modifications: + +0000-bug-466.patch: Fixes an infinite loop in stroke_calc_arc(). +Various changes to use FX_ library functions. +Possibly more? diff --git a/third_party/agg23/agg_math_stroke.h b/third_party/agg23/agg_math_stroke.h index 6d7ba8a96e..2b06b1bfda 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)); } |