summaryrefslogtreecommitdiff
path: root/third_party/agg23/0004-ubsan-sweep-scanline-error.patch
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/agg23/0004-ubsan-sweep-scanline-error.patch')
-rw-r--r--third_party/agg23/0004-ubsan-sweep-scanline-error.patch33
1 files changed, 33 insertions, 0 deletions
diff --git a/third_party/agg23/0004-ubsan-sweep-scanline-error.patch b/third_party/agg23/0004-ubsan-sweep-scanline-error.patch
new file mode 100644
index 0000000000..3348f0500b
--- /dev/null
+++ b/third_party/agg23/0004-ubsan-sweep-scanline-error.patch
@@ -0,0 +1,33 @@
+diff --git a/third_party/agg23/agg_rasterizer_scanline_aa.h b/third_party/agg23/agg_rasterizer_scanline_aa.h
+index c747ee379..da166bb14 100644
+--- a/third_party/agg23/agg_rasterizer_scanline_aa.h
++++ b/third_party/agg23/agg_rasterizer_scanline_aa.h
+@@ -349,14 +349,14 @@ public:
+ cover += cur_cell->cover;
+ }
+ if(area) {
+- alpha = calculate_alpha((cover << (poly_base_shift + 1)) - area, no_smooth);
++ alpha = calculate_alpha(calculate_area(cover, poly_base_shift + 1) - area, no_smooth);
+ if(alpha) {
+ sl.add_cell(x, alpha);
+ }
+ x++;
+ }
+ if(num_cells && cur_cell->x > x) {
+- alpha = calculate_alpha(cover << (poly_base_shift + 1), no_smooth);
++ alpha = calculate_alpha(calculate_area(cover, poly_base_shift + 1), no_smooth);
+ if(alpha) {
+ sl.add_span(x, cur_cell->x - x, alpha);
+ }
+@@ -458,6 +458,11 @@ private:
+ m_prev_x = x;
+ m_prev_y = y;
+ }
++ static int calculate_area(int cover, int shift) {
++ unsigned int result = cover;
++ result <<= shift;
++ return result;
++ }
+ private:
+ outline_aa m_outline;
+ filling_rule_e m_filling_rule;