diff --git a/src/gpu/ops/DrawCustomMeshOp.cpp b/src/gpu/ops/DrawCustomMeshOp.cpp index 124a23b7b79c2fa3465ce989e3e1c06b8de70a4d..92962dabcc21d5f131152b2d428808de2b464bdb 100644 --- a/src/gpu/ops/DrawCustomMeshOp.cpp +++ b/src/gpu/ops/DrawCustomMeshOp.cpp @@ -779,10 +779,13 @@ GrOp::CombineResult CustomMeshOp::onCombineIfPossible(GrOp* t, SkArenaAlloc*, co return CombineResult::kCannotCombine; } + if (fVertexCount > INT32_MAX - that->fVertexCount) { + return CombineResult::kCannotCombine; + } if (SkToBool(fIndexCount) != SkToBool(that->fIndexCount)) { return CombineResult::kCannotCombine; } - if (SkToBool(fIndexCount) && fVertexCount + that->fVertexCount > SkToInt(UINT16_MAX)) { + if (SkToBool(fIndexCount) && fVertexCount > UINT16_MAX - that->fVertexCount) { return CombineResult::kCannotCombine; }