Fix regression in CFX_SkiaDeviceDriver::PaintStroke().

The refactoring in https://pdfium-review.googlesource.com/70738
allocated too little memory. The original code allocated too much. This
CL gets it just right.

Bug: chromium:1099990
Change-Id: I6c413207344d3eb41f9b324879ed3e0818e2e9f0
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70917
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/skia/fx_skia_device.cpp b/core/fxge/skia/fx_skia_device.cpp
index bd166ca..3dbb494 100644
--- a/core/fxge/skia/fx_skia_device.cpp
+++ b/core/fxge/skia/fx_skia_device.cpp
@@ -1582,7 +1582,7 @@
                std::min(deviceUnits[0].length(), deviceUnits[1].length()));
   if (!pGraphState->m_DashArray.empty()) {
     size_t count = (pGraphState->m_DashArray.size() + 1) / 2;
-    std::vector<SkScalar> intervals(count);
+    std::vector<SkScalar> intervals(count * 2);
     // Set dash pattern
     for (size_t i = 0; i < count; i++) {
       float on = pGraphState->m_DashArray[i * 2];
@@ -1595,8 +1595,8 @@
       intervals[i * 2] = on;
       intervals[i * 2 + 1] = off;
     }
-    spaint->setPathEffect(SkDashPathEffect::Make(intervals.data(), count * 2,
-                                                 pGraphState->m_DashPhase));
+    spaint->setPathEffect(SkDashPathEffect::Make(
+        intervals.data(), intervals.size(), pGraphState->m_DashPhase));
   }
   spaint->setStyle(SkPaint::kStroke_Style);
   spaint->setAntiAlias(true);