From 4db3a388ddef8799fa97e6e38dd8971ba2b25221 Mon Sep 17 00:00:00 2001 From: Vincent Rabaud Date: Tue, 11 Jan 2022 12:01:47 +0100 Subject: [PATCH] Fix a potential UBSAN error. We only use that value as uint64_t below anyway. --- modules/core/src/matrix.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/core/src/matrix.cpp b/modules/core/src/matrix.cpp index 1deff6b450..be3dcc2608 100644 --- a/modules/core/src/matrix.cpp +++ b/modules/core/src/matrix.cpp @@ -269,7 +269,7 @@ void setSize( Mat& m, int _dims, const int* _sz, const size_t* _steps, bool auto else if( autoSteps ) { m.step.p[i] = total; - int64 total1 = (int64)total*s; + uint64 total1 = (uint64)total*s; if( (uint64)total1 != (size_t)total1 ) CV_Error( CV_StsOutOfRange, "The total matrix size does not fit to \"size_t\" type" ); total = (size_t)total1;