[AGG] Only add positive dash lengths and gap lengths
It does not make sense for a dash length or gap length to be negative,
and a CHECK is failing because of negative dash lengths being added in
agg::vcgen_dash::add_dash(). Modify the only caller to make sure the
values being passed in are always positive.
Bug: 370299908
Change-Id: I027411a6a64e07fd392ca6f8211617cfca0b631f
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/127350
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/agg/cfx_agg_devicedriver.cpp b/core/fxge/agg/cfx_agg_devicedriver.cpp
index 9f82167..a306b4c 100644
--- a/core/fxge/agg/cfx_agg_devicedriver.cpp
+++ b/core/fxge/agg/cfx_agg_devicedriver.cpp
@@ -316,7 +316,7 @@
}
float off = i * 2 + 1 == dash_array.size() ? on : dash_array[i * 2 + 1];
off = std::max(off, 0.0f);
- dash.add_dash(on * scale, off * scale);
+ dash.add_dash(fabs(on * scale), fabs(off * scale));
}
dash.dash_start(pGraphState->dash_phase() * scale);
using DashStroke = agg::conv_stroke<DashConverter>;
diff --git a/testing/SUPPRESSIONS b/testing/SUPPRESSIONS
index 0d845d3..7c837b1 100644
--- a/testing/SUPPRESSIONS
+++ b/testing/SUPPRESSIONS
@@ -677,9 +677,6 @@
# TODO(chromium:983289): Remove after associated bug is fixed
bug_983289.in * * * agg
-# TODO(crbug.com/370299908): Remove after associated bug is fixed
-dashed_line_negative_scale.in * * * agg
-
# TODO(pdfium:1747): Remove after associated bug is fixed
jpxdecode.in * * * *
jpxdecode_without_bitspercomponent.in * * * *