Adding validation for requiredBytesInCopy overflow

Also some uint32_t computations are now done on uint64_t.

Bug: dawn:482
Change-Id: Ia0094e16999ec3a9fec193f27760e73cd14d289c
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/26540
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Jiawei Shao <jiawei.shao@intel.com>
Commit-Queue: Tomek Ponitka <tommek@google.com>
diff --git a/src/dawn_native/CommandValidation.h b/src/dawn_native/CommandValidation.h
index 719ce17..0aaa398 100644
--- a/src/dawn_native/CommandValidation.h
+++ b/src/dawn_native/CommandValidation.h
@@ -41,10 +41,10 @@
 
     MaybeError ValidateTimestampQuery(QuerySetBase* querySet, uint32_t queryIndex);
 
-    uint32_t ComputeRequiredBytesInCopy(const TexelBlockInfo& blockInfo,
-                                        const Extent3D& copySize,
-                                        uint32_t bytesPerRow,
-                                        uint32_t rowsPerImage);
+    ResultOrError<uint64_t> ComputeRequiredBytesInCopy(const TexelBlockInfo& blockInfo,
+                                                       const Extent3D& copySize,
+                                                       uint32_t bytesPerRow,
+                                                       uint32_t rowsPerImage);
 
     MaybeError ValidateLinearTextureData(const TextureDataLayout& layout,
                                          uint64_t byteSize,